Created
March 28, 2017 21:37
-
-
Save rolandtoth/e106a292ff893c706de39fa9b015b4e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lightGallery(document.body, { | |
selector: '[data-editlink]', | |
iframeMaxWidth: '95%', | |
preload: false, | |
controls: false, | |
closable: true, | |
download: false, | |
counter: false | |
}); | |
var localStorageKeyName = 'editlink_reload'; | |
localStorage.removeItem(localStorageKeyName); // clear localStorageKey | |
document.body.addEventListener('onAfterOpen', function () { | |
var adminIframe = document.querySelector('iframe.lg-object'); | |
adminIframe.addEventListener("load", function () { | |
var editForm = adminIframe.contentWindow.document.querySelector('form#ProcessPageEdit'); | |
!editForm || editForm.addEventListener('submit', function () { | |
localStorage.setItem(localStorageKeyName, 1); // save localStorageKey state | |
}); | |
}); | |
}, false); | |
document.body.addEventListener('onCloseAfter', function () { | |
var needsReload = localStorage[localStorageKeyName]; | |
!needsReload || window.location.reload(true); // reload page if necessary | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment