Restore jquery.frameready.js code from 1.11.x - refs BT#21508

pull/5509/head
Angel Fernando Quiroz Campos 1 year ago
parent 66f6fcd55f
commit a0ac5ef8ff
  1. 11
      public/main/inc/lib/javascript/jquery.frameready.js

@ -17,7 +17,7 @@
factory(jQuery); factory(jQuery);
} }
}(function ($) { }(function ($) {
$.frameReady = function (callback, targetSelector, resources) { $.frameReady = function (callback, targetSelector, resources, conditional) {
/** /**
* @type {window} * @type {window}
*/ */
@ -59,8 +59,17 @@
targetWindow.onload = function () { targetWindow.onload = function () {
scripsLoadedCount = 0; scripsLoadedCount = 0;
if (typeof conditional === 'function' && conditional()) {
return;
}
targetDocument = targetWindow.contentDocument; targetDocument = targetWindow.contentDocument;
if (!targetDocument) {
console.log('frameReady: Can\'t access to contentDocument.');
return;
}
scripts.forEach(function (script) { scripts.forEach(function (script) {
createScript(script); createScript(script);
}); });

Loading…
Cancel
Save