mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Removed lazy loading
This commit is contained in:
parent
de410052dd
commit
60cdf82354
@ -11,22 +11,18 @@ module.exports = function layer2(options) {
|
||||
container
|
||||
});
|
||||
|
||||
var loadAuth = lazyLoadFrame(authUrl, container);
|
||||
|
||||
var getAuthFrame = function () {
|
||||
return loadAuth().then(function (frame) {
|
||||
frame.style.position = 'fixed';
|
||||
frame.style.width = '100%';
|
||||
frame.style.height = '100%';
|
||||
frame.style.background = 'transparent';
|
||||
frame.style.top = '0';
|
||||
frame.style['z-index'] = '9999';
|
||||
return frame;
|
||||
});
|
||||
};
|
||||
var loadAuth = loadFrame(authUrl, container).then(function (frame) {
|
||||
frame.style.position = 'fixed';
|
||||
frame.style.width = '100%';
|
||||
frame.style.height = '100%';
|
||||
frame.style.background = 'transparent';
|
||||
frame.style.top = '0';
|
||||
frame.style['z-index'] = '9999';
|
||||
return frame;
|
||||
});
|
||||
|
||||
function openAuth(hash, query = '') {
|
||||
return getAuthFrame().then(function (frame) {
|
||||
return loadAuth.then(function (frame) {
|
||||
return new Promise(function (resolve) {
|
||||
frame.src = `${authUrl}#${hash}?${query}`;
|
||||
frame.style.display = 'block';
|
||||
@ -82,17 +78,6 @@ module.exports = function layer2(options) {
|
||||
});
|
||||
};
|
||||
|
||||
function lazyLoadFrame(src, container) {
|
||||
let promise;
|
||||
return function getFrame() {
|
||||
if (promise) {
|
||||
return promise;
|
||||
}
|
||||
promise = loadFrame(src, container);
|
||||
return promise;
|
||||
};
|
||||
}
|
||||
|
||||
function loadFrame(src, container = document.body) {
|
||||
return new Promise(function (resolve) {
|
||||
const frame = document.createElement('iframe');
|
||||
|
Loading…
Reference in New Issue
Block a user