only load Sfjs if it is not present
Plus, avoid loading the toolbar if it is no longer on the page
This commit is contained in:
parent
9c9e645e87
commit
47ef65f336
@ -5,6 +5,7 @@
|
|||||||
them as JavaScript source code. Always use '/*' comments instead
|
them as JavaScript source code. Always use '/*' comments instead
|
||||||
of '//' comments to avoid impossible-to-debug side-effects #}
|
of '//' comments to avoid impossible-to-debug side-effects #}
|
||||||
|
|
||||||
|
if (typeof Sfjs === 'undefined') {
|
||||||
Sfjs = (function() {
|
Sfjs = (function() {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -424,6 +425,10 @@
|
|||||||
'sfwdt' + token,
|
'sfwdt' + token,
|
||||||
'{{ url("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
|
'{{ url("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
|
||||||
function(xhr, el) {
|
function(xhr, el) {
|
||||||
|
/* Do nothing in the edge case where the toolbar has already been replaced with a new one */
|
||||||
|
if (!document.getElementById('sfToolbarMainContent-' + newToken)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Evaluate in global scope scripts embedded inside the toolbar */
|
/* Evaluate in global scope scripts embedded inside the toolbar */
|
||||||
var i, scripts = [].slice.call(el.querySelectorAll('script'));
|
var i, scripts = [].slice.call(el.querySelectorAll('script'));
|
||||||
@ -799,5 +804,5 @@
|
|||||||
Sfjs.createTabs();
|
Sfjs.createTabs();
|
||||||
Sfjs.createToggles();
|
Sfjs.createToggles();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
/*]]>*/</script>
|
/*]]>*/</script>
|
||||||
|
Reference in New Issue
Block a user