Rollback of initialization sequence

This commit is contained in:
jdescottes
2013-10-04 23:46:19 +02:00
parent 894486fba6
commit 1e99a051e6
4 changed files with 23 additions and 26 deletions

View File

@ -4,7 +4,7 @@
* @param {HTMLElement} iframe
*/
var processFrame = function (iframe) {
var type = iframe.dataset.iframeLoader;
var type = iframe.getAttribute('data-iframe-loader');
if (type === "display") {
displayFrame(iframe);
} else if (type === "store") {
@ -43,19 +43,10 @@
document.body.appendChild(script);
};
/**
* Retrieve iFrames with a data-attribute data-iframe-loader
* Converts the nodeList to an array for easier manipulation
* @return {Array} array of iframe elements
*/
var getLoaderFrames = function () {
var iframes = document.querySelectorAll("[data-iframe-loader]");
return Array.prototype.slice.call(iframes, 0);
};
var init = function () {
getLoaderFrames().forEach(processFrame);
};
init();
window.iframeloader = {
onLoad : function (event) {
var iframe = event.target || event.srcElement;
processFrame(iframe);
}
}
})();