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
// Vanilla JavaScript function for dynamic script loading with improved caching and optional callback | |
const getScriptVanilla = async (source, callback) => { | |
try { | |
const response = await fetch(source, { | |
method: 'GET', | |
headers: { | |
'Accept': '*/*', | |
'Sec-Fetch-Dest': 'script' | |
}, | |
cache: 'force-cache' // Utilizes cache aggressively, falling back to network if unavailable |
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
// browser detect | |
var BrowserDetect = { | |
init: function(userAgent, appVersion) { | |
this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; | |
this.version = this.searchVersion(userAgent) || this.searchVersion(appVersion) || "an unknown version"; | |
this.OS = this.searchString(this.dataOS) || "an unknown OS"; | |
}, | |
searchString: function(data) { | |
for (var i = 0; i < data.length; i++) { | |
var dataString = data[i].string; |
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
// The code - first bit is all the UserAgent library. | |
(function(wndw) { | |
var Browsers, OS, Platform, Versions, browser_name, browser_version, os, platform; | |
Versions = { | |
Firefox: /firefox\/([\d\w\.\-]+)/i, | |
IE: /msie\s([\d\.]+[\d])/i, | |
Chrome: /chrome\/([\d\w\.\-]+)/i, | |
Safari: /version\/([\d\w\.\-]+)/i, | |
Ps3: /([\d\w\.\-]+)\)\s*$/i, | |
Psp: /([\d\w\.\-]+)\)?\s*$/i |
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
/* | |
* DWTFYW License | |
* | |
* Author: Tony Brix, http://tonybrix.info | |
* | |
* Check if a point is within an element. | |
* Useful for mouseover on absolutely positioned overlapping elements. | |
* | |
* Example: | |
* $(document).mousemove(function(e){ |
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
javascript:(function(w){ | |
var arr = ['contextmenu','copy','cut','paste','mousedown','mouseup','beforeunload','beforeprint']; | |
for(var i = 0, x; x = arr[i]; i++){ | |
if(w['on' + x])w['on' + x] = null; | |
w.addEventListener(x, function(e){e.stopPropagation()}, true); | |
}; | |
for(var j = 0, f; f = w.frames[j]; j++){try{arguments.callee(f)}catch(e){}}})(window); |
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
// Vanilla JavaScript - trim Leading and Trailing - ES5 | |
function TrimVanilla(str) { | |
return str.trim(); | |
} | |
// Older browsers - IE8 and before - using Polyfill. Call trim() method after running this. | |
function TrimPolyfill() { | |
if (!String.prototype.trim) { | |
String.prototype.trim = function () { | |
return this.replace(/^\s+|\s+$/g, ''); |
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
#!/bin/sh -x | |
set -e | |
SIZES=" | |
16,16x16 | |
32,32x32 | |
64,64x64 | |
128,128x128 | |
256,256x256 |
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
############################################################################### | |
# | |
# Docin document downloader | |
# | |
# Valid as of 2022-16-08 | |
# | |
############################################################################### | |
import argparse | |
import os | |
from types import SimpleNamespace |
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
/** | |
* Detects if two elements are colliding | |
* | |
* Credit goes to BC on Stack Overflow, cleaned up a little bit | |
* | |
* @link http://stackoverflow.com/questions/5419134/how-to-detect-if-two-divs-touch-with-jquery | |
* @param $div1 | |
* @param $div2 | |
* @returns {boolean} | |
*/ |