remove jquery all together
This commit is contained in:
parent
b0f5b0b059
commit
8580a1f463
61 changed files with 4113 additions and 684 deletions
|
@ -1,36 +1,36 @@
|
|||
let deviceState = {
|
||||
isMobile: false,
|
||||
isTablet: false,
|
||||
isLaptop: false,
|
||||
};
|
||||
isLaptop: false
|
||||
}
|
||||
|
||||
function detectDeviceState() {
|
||||
function detectDeviceState () {
|
||||
if (window.innerWidth <= 425) {
|
||||
deviceState = {
|
||||
isMobile: true,
|
||||
isTablet: false,
|
||||
isLaptop: false,
|
||||
};
|
||||
isLaptop: false
|
||||
}
|
||||
} else if (window.innerWidth <= 768) {
|
||||
deviceState = {
|
||||
isMobile: false,
|
||||
isTablet: true,
|
||||
isLaptop: false,
|
||||
};
|
||||
isLaptop: false
|
||||
}
|
||||
} else {
|
||||
deviceState = {
|
||||
isMobile: false,
|
||||
isTablet: false,
|
||||
isLaptop: true,
|
||||
};
|
||||
isLaptop: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
detectDeviceState();
|
||||
window.addEventListener('resize', detectDeviceState);
|
||||
detectDeviceState()
|
||||
window.addEventListener('resize', detectDeviceState)
|
||||
|
||||
// returns a copy of the device state
|
||||
// so other parts of code can't override this.
|
||||
export function getDeviceState() {
|
||||
return { ... deviceState };
|
||||
export function getDeviceState () {
|
||||
return { ...deviceState }
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
export * from './device';
|
||||
export * from './insertScript';
|
||||
export * from './device'
|
||||
export * from './insertScript'
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
export const insertScript = (id, src, onload) => {
|
||||
// script is already inserted, do nothing
|
||||
if (document.getElementById(id)) return;
|
||||
if (document.getElementById(id)) return
|
||||
|
||||
// insert script
|
||||
const firstScriptTag = document.getElementsByTagName('script')[0];
|
||||
const scriptTag = document.createElement('script');
|
||||
scriptTag.id = id;
|
||||
scriptTag.onload = onload;
|
||||
scriptTag.src = src;
|
||||
scriptTag.defer = true;
|
||||
scriptTag.async = true;
|
||||
firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag);
|
||||
};
|
||||
const firstScriptTag = document.getElementsByTagName('script')[0]
|
||||
const scriptTag = document.createElement('script')
|
||||
scriptTag.id = id
|
||||
scriptTag.onload = onload
|
||||
scriptTag.src = src
|
||||
scriptTag.defer = true
|
||||
scriptTag.async = true
|
||||
firstScriptTag.parentNode.insertBefore(scriptTag, firstScriptTag)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue