-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove dependency on jQuery - Remove dedicated code in render phase continuation
- Loading branch information
Showing
15 changed files
with
100 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 0 additions & 84 deletions
84
repository/JQuery-Core.package/JQAjaxifierLibrary.class/instance/ajaxifierJs.st
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"separateMethodMetaAndSource" : false, | ||
"noMethodMetaData" : true, | ||
"useCypressPropertiesFile" : true | ||
} |
1 change: 1 addition & 0 deletions
1
repository/Seaside-Ajaxifier-Core.package/WAAjaxifierLibrary.class/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
I ajaxify a web application by turning full page requests into background AJAX requests. |
80 changes: 80 additions & 0 deletions
80
repository/Seaside-Ajaxifier-Core.package/WAAjaxifierLibrary.class/instance/ajaxifierJs.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
uploads | ||
ajaxifierJs | ||
^ '/* JavaScript based Ajaxifier | ||
* Copyright (c) 2008 Lukas Renggli, [email protected] | ||
* Copyright (c) 2022 Philippe Marschall, [email protected] | ||
*/ | ||
window.addEventListener("DOMContentLoaded", (loadEvent) => { | ||
// variables | ||
let activeHash = ""; | ||
// ajax action | ||
function load(type, url, data, modifyHistory) { | ||
const xhr = new XMLHttpRequest(); | ||
xhr.responseType = "document" | ||
xhr.addEventListener("load", (event) => { | ||
if (xhr.status === 200) { | ||
Array.from(xhr.response.head.children).forEach((child) => { | ||
if (child.nodeType === Node.ELEMENT_NODE && child.nodeName === "SCRIPT") { | ||
child.remove(); | ||
} | ||
}); | ||
document.head.innerHTML = xhr.response.head; | ||
document.body = xhr.response.body; | ||
if (modifyHistory) { | ||
const path = xhr.responseURL; | ||
window.history.pushState(path, null, path); | ||
} | ||
} | ||
}); | ||
xhr.open(type, url); | ||
// WAActionCallback per default are disabled for AJAX requests | ||
// Detection happens with X-Requested-With so we override it | ||
xhr.setRequestHeader("X-Requested-With", "Ajaxifier"); | ||
xhr.send(data); | ||
} | ||
// click handler | ||
document.addEventListener("click", (event) => { | ||
// links | ||
const anchor = event.target.closest("a"); | ||
if (anchor !== null) { | ||
load("GET", anchor.getAttribute("href"), null, true); | ||
event.preventDefault(); | ||
return; | ||
} | ||
// submit | ||
const submit = event.target.closest("input[type=submit], button[type=submit]"); | ||
if (submit !== null) { | ||
const form = submit.closest("form"); | ||
if (form !== null) { | ||
const formData = new FormData(form); | ||
formData.append(submit.getAttribute("name"), ""); | ||
load("POST", form.getAttribute("action"), formData, true); | ||
event.preventDefault(); | ||
} | ||
} | ||
}); | ||
// check for changes in the hash | ||
setInterval(() => { | ||
const currentHash = window.location.hash.substr(1); | ||
if (currentHash !== activeHash) | ||
load("GET", "?" + (activeHash = currentHash), null, true); | ||
}, 250); | ||
// We assume nobody else will override onpopstate... since we are LIKELY the only ones to use pushstate etc. | ||
window.onpopstate = (event) => { | ||
load("GET", event.state, null, false); | ||
} | ||
});' |
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
.../JQAjaxifierLibrary.class/properties.json → .../WAAjaxifierLibrary.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"commentStamp" : "", | ||
"commentStamp" : "pmm 8/25/2022 15:03", | ||
"super" : "WAFileLibrary", | ||
"category" : "JQuery-Core-Libraries", | ||
"category" : "Seaside-Ajaxifier-Core", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ ], | ||
"name" : "JQAjaxifierLibrary", | ||
"name" : "WAAjaxifierLibrary", | ||
"type" : "normal" | ||
} |
1 change: 1 addition & 0 deletions
1
repository/Seaside-Ajaxifier-Core.package/monticello.meta/categories.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SystemOrganization addCategory: #'Seaside-Ajaxifier-Core'! |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
repository/Seaside-Ajaxifier-Core.package/monticello.meta/package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(name 'Seaside-Ajaxifier-Core') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ } |
7 changes: 0 additions & 7 deletions
7
...ide-RenderLoop.package/WARenderPhaseContinuation.class/instance/addRedirectedToHeader..st
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...ry/Seaside-RenderLoop.package/WARenderPhaseContinuation.class/instance/handleFiltered..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters