feat(python): loading scripts on page load

This commit is contained in:
sshakndr
2025-06-18 15:53:28 +07:00
parent edb43ab59d
commit aba434f46d
4 changed files with 6 additions and 33 deletions

View File

@ -1,5 +1,6 @@
# Change Log
- python: loading scripts on page load
- php-laravel: loading scripts on page load
- php: loading scripts on page load
- java-spring: loading scripts on page load

View File

@ -511,10 +511,6 @@ label .checkbox {
line-height: 150%;
}
#loadScripts {
display: none;
}
#iframeScripts {
position: absolute;
visibility: hidden;

View File

@ -126,7 +126,7 @@ if (typeof jQuery !== "undefined") {
if (!formatManager.isAutoConvertible(posExt)) {
jq("#step2").addClass("done").removeClass("current");
loadScripts();
onuploaded();
return;
}
@ -183,35 +183,14 @@ if (typeof jQuery !== "undefined") {
} else {
jq("#uploadFileName").text(response.filename);
jq("#step2").addClass("done").removeClass("current");
loadScripts();
onuploaded();
}
}
});
}, 1000);
};
var loadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("current");
if (jq("#loadScripts").is(":empty")) {
var urlScripts = jq("#loadScripts").attr("data-docs");
var frame = "<iframe id=\"iframeScripts\" width=1 height=1 style=\"position: absolute; visibility: hidden;\" ></iframe>";
jq("#loadScripts").html(frame);
document.getElementById("iframeScripts").onload = onloadScripts;
jq("#loadScripts iframe").attr("src", urlScripts);
} else {
onloadScripts();
}
};
var onloadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("done").removeClass("current");
var onuploaded = function () {
jq("#beginView, #beginEmbedded").removeClass("disable");
var fileName = jq("#hiddenFileName").val();
@ -273,7 +252,7 @@ if (typeof jQuery !== "undefined") {
jq(document).on("click", "#skipPass", function () {
jq("#blockPassword").hide();
loadScripts();
onuploaded();
});
jq(document).on("click", "#beginEdit:not(.disable)", function () {

View File

@ -341,10 +341,7 @@
<span class="errorPass"></span>
<br />
</div>
<span id="step3" class="step">3. Loading editor scripts.</span>
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
<br />
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
<br />
<div class="error-message">
@ -388,7 +385,7 @@
</div>
</div>
<span id="loadScripts" data-docs="{{ preloadurl }}"></span>
<iframe id="iframeScripts" src="{{ preloadurl }}" width=1 height=1 style="position: absolute; visibility: hidden; top: 0;" ></iframe>
<footer>
<div class="center">