diff options
author | Anton Luka Šijanec <anton@sijanec.eu> | 2022-01-11 12:35:47 +0100 |
---|---|---|
committer | Anton Luka Šijanec <anton@sijanec.eu> | 2022-01-11 12:35:47 +0100 |
commit | 19985dbb8c0aa66dc4bf7905abc1148de909097d (patch) | |
tree | 2cd5a5d20d7e80fc2a51adf60d838d8a2c40999e /editors/ckeditor_4_4/uploader/upload.js | |
download | 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.gz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.bz2 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.lz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.xz 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.tar.zst 1ka-19985dbb8c0aa66dc4bf7905abc1148de909097d.zip |
Diffstat (limited to 'editors/ckeditor_4_4/uploader/upload.js')
-rw-r--r-- | editors/ckeditor_4_4/uploader/upload.js | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/editors/ckeditor_4_4/uploader/upload.js b/editors/ckeditor_4_4/uploader/upload.js new file mode 100644 index 0000000..3317997 --- /dev/null +++ b/editors/ckeditor_4_4/uploader/upload.js @@ -0,0 +1,48 @@ +function toggleBarVisibility() {
+ var e = document.getElementById("bar_blank");
+ e.style.display = (e.style.display == "block") ? "none" : "block";
+}
+
+function createRequestObject() {
+ var http;
+ if (navigator.appName == "Microsoft Internet Explorer") {
+ http = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ else {
+ http = new XMLHttpRequest();
+ }
+ return http;
+}
+
+function sendRequest() {
+ var http = createRequestObject();
+ http.open("GET", "progress.php");
+ http.onreadystatechange = function () { handleResponse(http); };
+ http.send(null);
+}
+
+function handleResponse(http) {
+ var response;
+ if (http.readyState == 4) {
+ response = http.responseText;
+ document.getElementById("bar_color").style.width = response + "%";
+ document.getElementById("status").innerHTML = response + "%";
+
+ if (response < 100) {
+ setTimeout("sendRequest()", 1000);
+ }
+ else {
+ toggleBarVisibility();
+ document.getElementById("status").innerHTML = "Done.";
+ }
+ }
+}
+
+function startUpload() {
+ toggleBarVisibility();
+ setTimeout("sendRequest()", 1000);
+}
+
+(function () {
+ document.getElementById("editorSlika").onsubmit = startUpload;
+})();
|