The load content which was worked by vanilla now changed back to jQuery, the javascript ajax solution cant execute the javascripts somewhy.
parent
ffa1edc3e3
commit
912f974e76
|
|
@ -5,6 +5,13 @@
|
|||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PackageRequirementsSettings">
|
||||
<option name="requirementsPath" value="" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="EPYTEXT" />
|
||||
<option name="myDocStringFormat" value="Epytext" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
|
|
|
|||
|
|
@ -4,54 +4,10 @@ if(navigator.userAgent.indexOf("QtWebEngine") > 0) {
|
|||
window.sight = channel.objects.handler;
|
||||
});
|
||||
}
|
||||
/*
|
||||
function docReady(fn) {
|
||||
if(document.readyState === "complete" || document.readyState === "interactive") {
|
||||
setTimeout(fn, 1);
|
||||
} else {
|
||||
setTimeout(fn, 2);
|
||||
document.addEventListener("DOMContentLoaded", fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
document.querySelectorAll('a').forEach(link => {
|
||||
link.onclick = function() { alert("ss"); }
|
||||
|
||||
link.addEventListener("click", (e) => {
|
||||
e.preventDefault();
|
||||
alert("sds");
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
|
||||
|
||||
document.querySelectorAll('#screate').forEach(link => {
|
||||
alert("1");
|
||||
link.addEventListener("click", (e) => {
|
||||
alert("sds");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
const screate = document.getElementById("screate");
|
||||
screate.addEventListener("click",myFunc);
|
||||
|
||||
document.getElementById("screate").onclick = e => {
|
||||
alert("ss")
|
||||
}
|
||||
});*/
|
||||
/*
|
||||
document.getElementById("screate").onclick = e => {
|
||||
alert("ss")
|
||||
}*/
|
||||
|
||||
/*const screate = document;*/
|
||||
|
||||
(function ( $ ) {
|
||||
$.fn.s_create = function() {
|
||||
$(document).on( "click", "#screate", function() {
|
||||
$(document).on( "click", "#screate", function(event) {
|
||||
event.preventDefault();
|
||||
window.sight.create($(this).data("id"), $(this).data("type"), function(sight_id) {
|
||||
|
||||
|
|
@ -59,7 +15,7 @@ document.getElementById("screate").onclick = e => {
|
|||
})
|
||||
};
|
||||
$.fn.s_close = function() {
|
||||
$("body").on( "click", "#sclose", function() {
|
||||
$("body").on( "click", "#sclose", function(event) {
|
||||
event.preventDefault();
|
||||
window.sight.close();
|
||||
})
|
||||
|
|
@ -183,24 +139,68 @@ function setTitle(title) {
|
|||
***/
|
||||
function load(url, element)
|
||||
{
|
||||
fetch(url).then(res => {
|
||||
/*fetch(url,{
|
||||
method: "POST",
|
||||
headers: {"Content-type": "application/javascript;charset=UTF-8"}
|
||||
}).then(res => {
|
||||
return res.text();
|
||||
}).then((html) => {
|
||||
element.innerHTML = html;
|
||||
});
|
||||
});*/
|
||||
/*
|
||||
const xhttp = new XMLHttpRequest();
|
||||
xhttp.open("GET", url, true);*/
|
||||
|
||||
/*xhttp.onreadystatechange = function() {
|
||||
if (xhttp.readyState == XMLHttpRequest.DONE) {
|
||||
if (xhttp.status == 200) {
|
||||
// create a `div` elemenent, append response to `div` element
|
||||
// get specific elements by `id`, append `script` element to `document.body`
|
||||
var content = document.createElement("div");
|
||||
content.innerHTML = xhttp.responseText
|
||||
var contentScript = content.querySelector("script");
|
||||
var script = document.createElement("script");
|
||||
script.textContent = contentScript.textContent;
|
||||
element.innerHTML = content.innerHTML;
|
||||
|
||||
//window.sight.console(script.textContent)
|
||||
var rand = Math.random()*1000
|
||||
//script.setAttribute("script_run_"+rand)
|
||||
document.body.appendChild(script);
|
||||
|
||||
//document.body.removeChild(list.firstElementChild);
|
||||
}
|
||||
}
|
||||
};*/
|
||||
|
||||
/*
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (this.readyState == 4 && this.status == 200) {
|
||||
var doc = new DOMParser().parseFromString(this.responseText, "text/html");
|
||||
/*var fragmentElement = document.createDocumentFragment();
|
||||
var tempElement = fragmentElement.appendChild(doc.content.body);
|
||||
alert(tempElement)
|
||||
document.body.appendChild(tempElement);*/
|
||||
//element.innerHTML = this.responseText;
|
||||
/* }
|
||||
};
|
||||
*/
|
||||
/*xhttp.onload = function() {
|
||||
element.innerHTML = this.responseText;
|
||||
}*/
|
||||
|
||||
xhttp.send();
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
const scontent = document.querySelectorAll('[scontent]');
|
||||
|
||||
scontent.forEach((element) => {
|
||||
//$("[scontent="+element.getAttribute("scontent")+"]").load("content/"+element.getAttribute("scontent")+"/content.html");
|
||||
load("content/"+element.getAttribute("scontent")+"/content.html", document.querySelector("[scontent="+element.getAttribute("scontent")+"]"))
|
||||
$("[scontent="+element.getAttribute("scontent")+"]").load("content/"+element.getAttribute("scontent")+"/content.html");
|
||||
//load("content/"+element.getAttribute("scontent")+"/content.html", document.querySelector("[scontent="+element.getAttribute("scontent")+"]"))
|
||||
});
|
||||
|
||||
// INIT the Sight from init_sight variable
|
||||
if (typeof init_sight !== 'undefined') {
|
||||
|
||||
for ( const [key,value] of Object.entries( init_sight ) ) {
|
||||
window.sight.console(key + " - " + value)
|
||||
switch(key) {
|
||||
|
|
@ -228,7 +228,6 @@ $(document).ready(function(){
|
|||
if($("#stoggled").length) {
|
||||
var attr = $("#stoggled").attr("state")
|
||||
if (typeof attr !== 'undefined' && attr !== false && (attr == "restoredown" || attr == "maximized")) {
|
||||
|
||||
png_button = "restoredown"
|
||||
if(attr == "restoredown")
|
||||
png_button = "maximized"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,15 @@
|
|||
<link rel="stylesheet" type="text/css" href="content/main_text/test.css">
|
||||
|
||||
<div id="example">This is a sentence.</div>
|
||||
<button onclick="h()">JE</button>
|
||||
<script>
|
||||
window.sight.test("This appear in the console from the content/main_text. The content files reach the window.sight.")
|
||||
window.sight.console("This appear in the console from the content/main_text. The content files reach the window.sight.")
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
window.sight.console("2")
|
||||
function h(){
|
||||
alert("hello2")
|
||||
}
|
||||
</script>
|
||||
Loading…
Reference in New Issue