| 1 |
let __tagembedLoaderImageCustomPath = __tagembed__pluginLoaderImageUrlObj.__tagembed__pluginLoaderImageUrl + 'assets/images/loader.gif'; |
| 2 |
if (typeof __tagembed__plugin_url_for_js != "undefined") { |
| 3 |
__tagembedLoaderImageCustomPath = __tagembed__plugin_url_for_js + 'assets/images/loader.gif'; |
| 4 |
} |
| 5 |
function __tagembed__open_loader(text = '', loaderImage = '') { |
| 6 |
text = (text) ? text : 'Please Wait...'; |
| 7 |
loaderImage = (loaderImage) ? loaderImage : __tagembedLoaderImageCustomPath; |
| 8 |
document.body.style.cursor = "wait"; |
| 9 |
/* Built with DOM methods so no markup is produced from the arguments. */ |
| 10 |
let overlay = document.createElement('div'); |
| 11 |
overlay.setAttribute('id', '__tagembed__loader'); |
| 12 |
overlay.className = '__tagembed__loader-overlay'; |
| 13 |
let inner = document.createElement('div'); |
| 14 |
inner.className = '__tagembed__loader'; |
| 15 |
let image = document.createElement('img'); |
| 16 |
image.setAttribute('src', loaderImage); |
| 17 |
inner.appendChild(image); |
| 18 |
inner.appendChild(document.createElement('br')); |
| 19 |
inner.appendChild(document.createTextNode(text)); |
| 20 |
overlay.appendChild(inner); |
| 21 |
document.body.appendChild(overlay); |
| 22 |
} |
| 23 |
function __tagembed__close_loader() { |
| 24 |
document.body.style.cursor = "auto"; |
| 25 |
let elem = document.querySelector('#__tagembed__loader'); |
| 26 |
elem.remove(); |
| 27 |
} |