allow demos without scripts (silly)
This commit is contained in:
parent
1a70436f28
commit
b7d0f50487
|
@ -512,7 +512,9 @@ toggle.addEventListener('click', function () {
|
||||||
var demoDiv = document.createElement('div');
|
var demoDiv = document.createElement('div');
|
||||||
demoDiv.innerHTML = template.innerHTML;
|
demoDiv.innerHTML = template.innerHTML;
|
||||||
var standaloneScript = demoDiv.querySelector('script');
|
var standaloneScript = demoDiv.querySelector('script');
|
||||||
standaloneScript.textContent = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + standaloneScript.textContent + ' })();';
|
if (standaloneScript) {
|
||||||
|
standaloneScript.textContent = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + standaloneScript.textContent + ' })();';
|
||||||
|
}
|
||||||
|
|
||||||
if (document.head.attachShadow) {
|
if (document.head.attachShadow) {
|
||||||
var templateScript = template.content.querySelector('script');
|
var templateScript = template.content.querySelector('script');
|
||||||
|
@ -534,10 +536,11 @@ toggle.addEventListener('click', function () {
|
||||||
|
|
||||||
var newScript = standalone.document.createElement('script');
|
var newScript = standalone.document.createElement('script');
|
||||||
var oldScript = standalone.document.querySelector('script');
|
var oldScript = standalone.document.querySelector('script');
|
||||||
newScript.textContent = oldScript.textContent;
|
if (oldScript) {
|
||||||
oldScript.parentNode.removeChild(oldScript);
|
newScript.textContent = oldScript.textContent;
|
||||||
standalone.document.body.appendChild(newScript);
|
oldScript.parentNode.removeChild(oldScript);
|
||||||
|
standalone.document.body.appendChild(newScript);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
standalone.document.title = 'demo ' + "285170a1c0812ad34ac4b853a052c8bd";
|
standalone.document.title = 'demo ' + "285170a1c0812ad34ac4b853a052c8bd";
|
||||||
|
|
|
@ -1879,7 +1879,9 @@ toggle.addEventListener('click', function () {
|
||||||
var demoDiv = document.createElement('div');
|
var demoDiv = document.createElement('div');
|
||||||
demoDiv.innerHTML = template.innerHTML;
|
demoDiv.innerHTML = template.innerHTML;
|
||||||
var standaloneScript = demoDiv.querySelector('script');
|
var standaloneScript = demoDiv.querySelector('script');
|
||||||
standaloneScript.textContent = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + standaloneScript.textContent + ' })();';
|
if (standaloneScript) {
|
||||||
|
standaloneScript.textContent = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + standaloneScript.textContent + ' })();';
|
||||||
|
}
|
||||||
|
|
||||||
if (document.head.attachShadow) {
|
if (document.head.attachShadow) {
|
||||||
var templateScript = template.content.querySelector('script');
|
var templateScript = template.content.querySelector('script');
|
||||||
|
@ -1901,10 +1903,11 @@ toggle.addEventListener('click', function () {
|
||||||
|
|
||||||
var newScript = standalone.document.createElement('script');
|
var newScript = standalone.document.createElement('script');
|
||||||
var oldScript = standalone.document.querySelector('script');
|
var oldScript = standalone.document.querySelector('script');
|
||||||
newScript.textContent = oldScript.textContent;
|
if (oldScript) {
|
||||||
oldScript.parentNode.removeChild(oldScript);
|
newScript.textContent = oldScript.textContent;
|
||||||
standalone.document.body.appendChild(newScript);
|
oldScript.parentNode.removeChild(oldScript);
|
||||||
|
standalone.document.body.appendChild(newScript);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
standalone.document.title = 'demo ' + "285170a1c0812ad34ac4b853a052c8bd";
|
standalone.document.title = 'demo ' + "285170a1c0812ad34ac4b853a052c8bd";
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,7 +25,9 @@
|
||||||
var demoDiv = document.createElement('div');
|
var demoDiv = document.createElement('div');
|
||||||
demoDiv.innerHTML = template.innerHTML;
|
demoDiv.innerHTML = template.innerHTML;
|
||||||
var standaloneScript = demoDiv.querySelector('script');
|
var standaloneScript = demoDiv.querySelector('script');
|
||||||
standaloneScript.textContent = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + standaloneScript.textContent + ' })();';
|
if (standaloneScript) {
|
||||||
|
standaloneScript.textContent = '(function() { document.getElementsByTagName(\'html\')[0].setAttribute(\'lang\', \'en\'); var demo = document; ' + standaloneScript.textContent + ' })();';
|
||||||
|
}
|
||||||
|
|
||||||
if (document.head.attachShadow) {
|
if (document.head.attachShadow) {
|
||||||
var templateScript = template.content.querySelector('script');
|
var templateScript = template.content.querySelector('script');
|
||||||
|
@ -47,10 +49,11 @@
|
||||||
// For activating the script :-(
|
// For activating the script :-(
|
||||||
var newScript = standalone.document.createElement('script');
|
var newScript = standalone.document.createElement('script');
|
||||||
var oldScript = standalone.document.querySelector('script');
|
var oldScript = standalone.document.querySelector('script');
|
||||||
newScript.textContent = oldScript.textContent;
|
if (oldScript) {
|
||||||
oldScript.parentNode.removeChild(oldScript);
|
newScript.textContent = oldScript.textContent;
|
||||||
standalone.document.body.appendChild(newScript);
|
oldScript.parentNode.removeChild(oldScript);
|
||||||
|
standalone.document.body.appendChild(newScript);
|
||||||
|
}
|
||||||
{{ if .Get "backgroundColor" }}
|
{{ if .Get "backgroundColor" }}
|
||||||
standalone.document.body.style.backgroundColor = {{ .Get "backgroundColor" | safeCSS }};
|
standalone.document.body.style.backgroundColor = {{ .Get "backgroundColor" | safeCSS }};
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user