Last active
May 18, 2020 09:04
-
-
Save aisteron/a9e62e81ea56e5b84bcc50c7b5671a06 to your computer and use it in GitHub Desktop.
This file contains 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
function $_(element) { return document.querySelector(element) } | |
let stack = [ | |
'/js/autocomplete/jquery-1.12.4.js', | |
'/js/autocomplete/jquery-ui.js', | |
'/js/autocomplete/loadcss.js', | |
] | |
loadAutoComplete(stack) | |
document.addEventListener('ui-styles', () => { | |
goJq(); // jquery autocomplete | |
calcDelivery(); | |
}) | |
function loadAutoComplete(stack) { | |
if(stack.length > 0) { | |
let nextLib = stack.shift(); | |
let scripts = $_('.scripts-area'); | |
let tag = document.createElement('script'); | |
tag.src = nextLib; | |
scripts.appendChild(tag) | |
tag.onload = () => loadAutoComplete(stack) | |
} else { | |
let uiStyles = loadCSS('/js/autocomplete/jquery-ui.css'); | |
onloadCSS(uiStyles, () => { | |
let event = new Event('ui-styles'); | |
document.dispatchEvent(event); | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment