add lisp packages
This commit is contained in:
18
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/after-window-onload.html
generated
vendored
Normal file
18
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/after-window-onload.html
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="assets/log.js"></script>
|
||||
<script src="assets/loadjs/loadjs.js"></script>
|
||||
<script>
|
||||
// load a file after window onload event fires
|
||||
window.addEventListener('load', function(ev) {
|
||||
loadjs('assets/file1.js', function() {
|
||||
log('file1.js loaded');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Example: Load script after window onload event fires</h1>
|
||||
</body>
|
||||
</html>
|
||||
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/example-error.js
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/example-error.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
throw "Error";
|
||||
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file.css
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file.css
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
.test-div {
|
||||
width: 100px;
|
||||
}
|
||||
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file1.js
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file1.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
window.timesLoaded1 = window.timesLoaded1 || 0;
|
||||
log('file1: loaded (' + timesLoaded1 + ')');
|
||||
timesLoaded1 += 1;
|
||||
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file2.js
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file2.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
window.timesLoaded2 = window.timesLoaded2 || 0;
|
||||
log('file2: loaded (' + timesLoaded2 + ')');
|
||||
timesLoaded2 += 1;
|
||||
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file3.js
generated
vendored
Normal file
3
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/file3.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
window.timesLoaded3 = window.timesLoaded3 || 0;
|
||||
log('file3: loaded (' + timesLoaded3 + ')');
|
||||
timesLoaded3 += 1;
|
||||
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/flash.png
generated
vendored
Normal file
BIN
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/flash.png
generated
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
14
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/flash.svg
generated
vendored
Normal file
14
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/flash.svg
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="1024px" height="1024px" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
|
||||
<!-- Generator: Sketch 3.3.2 (12043) - http://www.bohemiancoding.com/sketch -->
|
||||
<title>iTunesArtwork@2x</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs></defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
|
||||
<g id="Size-Guides" sketch:type="MSLayerGroup" transform="translate(0.000000, -124.000000)"></g>
|
||||
<g id="iTunesArtwork@2x" sketch:type="MSArtboardGroup">
|
||||
<path d="M357.009067,0 L666.990933,0 C769.792,0 821.179733,0 876.5184,17.4933333 C936.9344,39.4837333 984.516267,87.0656 1006.50667,147.4816 C1024,202.811733 1024,254.216533 1024,357.009067 L1024,666.990933 C1024,769.792 1024,821.179733 1006.50667,876.5184 C984.516267,936.9344 936.9344,984.516267 876.5184,1006.49813 C821.179733,1024 769.792,1024 666.990933,1024 L357.009067,1024 C254.208,1024 202.811733,1024 147.4816,1006.49813 C87.0656,984.516267 39.4837333,936.9344 17.4933333,876.5184 C0,821.179733 0,769.792 0,666.990933 L0,357.009067 C0,254.216533 0,202.811733 17.4933333,147.4816 C39.4837333,87.0656 87.0656,39.4837333 147.4816,17.4933333 C202.811733,0 254.208,0 357.009067,0 L357.009067,0" id="Icon-Shape" fill="#D7D7D7" sketch:type="MSShapeGroup"></path>
|
||||
<path d="M692.497264,349.385524 C697.470239,354.906145 698.437452,360.978828 695.398902,367.603573 L471.813752,846.652148 C468.227556,853.550716 462.428696,857 454.417171,857 C453.313047,857 451.378621,856.721761 448.613894,856.165282 C443.923575,854.787335 440.403627,852.163936 438.05405,848.295085 C435.704474,844.426234 435.081748,840.28356 436.185872,835.867063 L517.749735,501.31743 L349.640201,543.132822 C348.536077,543.406645 346.87989,543.543556 344.671642,543.543556 C339.698667,543.543556 335.419081,542.024281 331.832886,538.985731 C326.85991,534.843057 325.066813,529.459348 326.453593,522.834603 L409.673642,181.24949 C410.777766,177.380639 412.986014,174.205178 416.298387,171.723107 C419.61076,169.241036 423.475194,168 427.891691,168 L563.698968,168 C568.945766,168 573.362263,169.72685 576.948458,173.180551 C580.534654,176.634251 582.327751,180.706261 582.327751,185.396581 C582.327751,187.604829 581.638778,190.091317 580.260831,192.856044 L509.455554,384.562921 L673.417998,343.979732 C675.626246,343.423253 677.282433,343.145014 678.386557,343.145014 C683.633355,343.145014 688.328091,345.216351 692.470765,349.359025 L692.497264,349.385524 Z" id="Shape" fill="#C62828" sketch:type="MSShapeGroup"></path>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
308
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/loadjs/loadjs.js
generated
vendored
Normal file
308
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/loadjs/loadjs.js
generated
vendored
Normal file
@@ -0,0 +1,308 @@
|
||||
loadjs = (function () {
|
||||
/**
|
||||
* Global dependencies.
|
||||
* @global {Object} document - DOM
|
||||
*/
|
||||
|
||||
var devnull = function() {},
|
||||
bundleIdCache = {},
|
||||
bundleResultCache = {},
|
||||
bundleCallbackQueue = {};
|
||||
|
||||
|
||||
/**
|
||||
* Subscribe to bundle load event.
|
||||
* @param {string[]} bundleIds - Bundle ids
|
||||
* @param {Function} callbackFn - The callback function
|
||||
*/
|
||||
function subscribe(bundleIds, callbackFn) {
|
||||
// listify
|
||||
bundleIds = bundleIds.push ? bundleIds : [bundleIds];
|
||||
|
||||
var depsNotFound = [],
|
||||
i = bundleIds.length,
|
||||
numWaiting = i,
|
||||
fn,
|
||||
bundleId,
|
||||
r,
|
||||
q;
|
||||
|
||||
// define callback function
|
||||
fn = function (bundleId, pathsNotFound) {
|
||||
if (pathsNotFound.length) depsNotFound.push(bundleId);
|
||||
|
||||
numWaiting--;
|
||||
if (!numWaiting) callbackFn(depsNotFound);
|
||||
};
|
||||
|
||||
// register callback
|
||||
while (i--) {
|
||||
bundleId = bundleIds[i];
|
||||
|
||||
// execute callback if in result cache
|
||||
r = bundleResultCache[bundleId];
|
||||
if (r) {
|
||||
fn(bundleId, r);
|
||||
continue;
|
||||
}
|
||||
|
||||
// add to callback queue
|
||||
q = bundleCallbackQueue[bundleId] = bundleCallbackQueue[bundleId] || [];
|
||||
q.push(fn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish bundle load event.
|
||||
* @param {string} bundleId - Bundle id
|
||||
* @param {string[]} pathsNotFound - List of files not found
|
||||
*/
|
||||
function publish(bundleId, pathsNotFound) {
|
||||
// exit if id isn't defined
|
||||
if (!bundleId) return;
|
||||
|
||||
var q = bundleCallbackQueue[bundleId];
|
||||
|
||||
// cache result
|
||||
bundleResultCache[bundleId] = pathsNotFound;
|
||||
|
||||
// exit if queue is empty
|
||||
if (!q) return;
|
||||
|
||||
// empty callback queue
|
||||
while (q.length) {
|
||||
q[0](bundleId, pathsNotFound);
|
||||
q.splice(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execute callbacks.
|
||||
* @param {Object or Function} args - The callback args
|
||||
* @param {string[]} depsNotFound - List of dependencies not found
|
||||
*/
|
||||
function executeCallbacks(args, depsNotFound) {
|
||||
// accept function as argument
|
||||
if (args.call) args = {success: args};
|
||||
|
||||
// success and error callbacks
|
||||
if (depsNotFound.length) (args.error || devnull)(depsNotFound);
|
||||
else (args.success || devnull)(args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load individual file.
|
||||
* @param {string} path - The file path
|
||||
* @param {Function} callbackFn - The callback function
|
||||
*/
|
||||
function loadFile(path, callbackFn, args, numTries) {
|
||||
var doc = document,
|
||||
async = args.async,
|
||||
maxTries = (args.numRetries || 0) + 1,
|
||||
beforeCallbackFn = args.before || devnull,
|
||||
pathname = path.replace(/[\?|#].*$/, ''),
|
||||
pathStripped = path.replace(/^(css|img)!/, ''),
|
||||
isLegacyIECss,
|
||||
e;
|
||||
|
||||
numTries = numTries || 0;
|
||||
|
||||
if (/(^css!|\.css$)/.test(pathname)) {
|
||||
// css
|
||||
e = doc.createElement('link');
|
||||
e.rel = 'stylesheet';
|
||||
e.href = pathStripped;
|
||||
|
||||
// tag IE9+
|
||||
isLegacyIECss = 'hideFocus' in e;
|
||||
|
||||
// use preload in IE Edge (to detect load errors)
|
||||
if (isLegacyIECss && e.relList) {
|
||||
isLegacyIECss = 0;
|
||||
e.rel = 'preload';
|
||||
e.as = 'style';
|
||||
}
|
||||
} else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(pathname)) {
|
||||
// image
|
||||
e = doc.createElement('img');
|
||||
e.src = pathStripped;
|
||||
} else {
|
||||
// javascript
|
||||
e = doc.createElement('script');
|
||||
e.src = path;
|
||||
e.async = async === undefined ? true : async;
|
||||
}
|
||||
|
||||
e.onload = e.onerror = e.onbeforeload = function (ev) {
|
||||
var result = ev.type[0];
|
||||
|
||||
// treat empty stylesheets as failures to get around lack of onerror
|
||||
// support in IE9-11
|
||||
if (isLegacyIECss) {
|
||||
try {
|
||||
if (!e.sheet.cssText.length) result = 'e';
|
||||
} catch (x) {
|
||||
// sheets objects created from load errors don't allow access to
|
||||
// `cssText` (unless error is Code:18 SecurityError)
|
||||
if (x.code != 18) result = 'e';
|
||||
}
|
||||
}
|
||||
|
||||
// handle retries in case of load failure
|
||||
if (result == 'e') {
|
||||
// increment counter
|
||||
numTries += 1;
|
||||
|
||||
// exit function and try again
|
||||
if (numTries < maxTries) {
|
||||
return loadFile(path, callbackFn, args, numTries);
|
||||
}
|
||||
} else if (e.rel == 'preload' && e.as == 'style') {
|
||||
// activate preloaded stylesheets
|
||||
return e.rel = 'stylesheet'; // jshint ignore:line
|
||||
}
|
||||
|
||||
// execute callback
|
||||
callbackFn(path, result, ev.defaultPrevented);
|
||||
};
|
||||
|
||||
// add to document (unless callback returns `false`)
|
||||
if (beforeCallbackFn(path, e) !== false) doc.head.appendChild(e);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load multiple files.
|
||||
* @param {string[]} paths - The file paths
|
||||
* @param {Function} callbackFn - The callback function
|
||||
*/
|
||||
function loadFiles(paths, callbackFn, args) {
|
||||
// listify paths
|
||||
paths = paths.push ? paths : [paths];
|
||||
|
||||
var numWaiting = paths.length,
|
||||
x = numWaiting,
|
||||
pathsNotFound = [],
|
||||
fn,
|
||||
i;
|
||||
|
||||
// define callback function
|
||||
fn = function(path, result, defaultPrevented) {
|
||||
// handle error
|
||||
if (result == 'e') pathsNotFound.push(path);
|
||||
|
||||
// handle beforeload event. If defaultPrevented then that means the load
|
||||
// will be blocked (ex. Ghostery/ABP on Safari)
|
||||
if (result == 'b') {
|
||||
if (defaultPrevented) pathsNotFound.push(path);
|
||||
else return;
|
||||
}
|
||||
|
||||
numWaiting--;
|
||||
if (!numWaiting) callbackFn(pathsNotFound);
|
||||
};
|
||||
|
||||
// load scripts
|
||||
for (i=0; i < x; i++) loadFile(paths[i], fn, args);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initiate script load and register bundle.
|
||||
* @param {(string|string[])} paths - The file paths
|
||||
* @param {(string|Function|Object)} [arg1] - The (1) bundleId or (2) success
|
||||
* callback or (3) object literal with success/error arguments, numRetries,
|
||||
* etc.
|
||||
* @param {(Function|Object)} [arg2] - The (1) success callback or (2) object
|
||||
* literal with success/error arguments, numRetries, etc.
|
||||
*/
|
||||
function loadjs(paths, arg1, arg2) {
|
||||
var bundleId,
|
||||
args;
|
||||
|
||||
// bundleId (if string)
|
||||
if (arg1 && arg1.trim) bundleId = arg1;
|
||||
|
||||
// args (default is {})
|
||||
args = (bundleId ? arg2 : arg1) || {};
|
||||
|
||||
// throw error if bundle is already defined
|
||||
if (bundleId) {
|
||||
if (bundleId in bundleIdCache) {
|
||||
throw "LoadJS";
|
||||
} else {
|
||||
bundleIdCache[bundleId] = true;
|
||||
}
|
||||
}
|
||||
|
||||
function loadFn(resolve, reject) {
|
||||
loadFiles(paths, function (pathsNotFound) {
|
||||
// execute callbacks
|
||||
executeCallbacks(args, pathsNotFound);
|
||||
|
||||
// resolve Promise
|
||||
if (resolve) {
|
||||
executeCallbacks({success: resolve, error: reject}, pathsNotFound);
|
||||
}
|
||||
|
||||
// publish bundle load event
|
||||
publish(bundleId, pathsNotFound);
|
||||
}, args);
|
||||
}
|
||||
|
||||
if (args.returnPromise) return new Promise(loadFn);
|
||||
else loadFn();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Execute callbacks when dependencies have been satisfied.
|
||||
* @param {(string|string[])} deps - List of bundle ids
|
||||
* @param {Object} args - success/error arguments
|
||||
*/
|
||||
loadjs.ready = function ready(deps, args) {
|
||||
// subscribe to bundle load event
|
||||
subscribe(deps, function (depsNotFound) {
|
||||
// execute callbacks
|
||||
executeCallbacks(args, depsNotFound);
|
||||
});
|
||||
|
||||
return loadjs;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Manually satisfy bundle dependencies.
|
||||
* @param {string} bundleId - The bundle id
|
||||
*/
|
||||
loadjs.done = function done(bundleId) {
|
||||
publish(bundleId, []);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Reset loadjs dependencies statuses
|
||||
*/
|
||||
loadjs.reset = function reset() {
|
||||
bundleIdCache = {};
|
||||
bundleResultCache = {};
|
||||
bundleCallbackQueue = {};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Determine if bundle has already been defined
|
||||
* @param String} bundleId - The bundle id
|
||||
*/
|
||||
loadjs.isDefined = function isDefined(bundleId) {
|
||||
return bundleId in bundleIdCache;
|
||||
};
|
||||
|
||||
|
||||
// export
|
||||
return loadjs;
|
||||
|
||||
})();
|
||||
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/loadjs/loadjs.min.js
generated
vendored
Normal file
1
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/loadjs/loadjs.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
loadjs=function(){var h=function(){},c={},u={},f={};function o(e,n){if(e){var r=f[e];if(u[e]=n,r)for(;r.length;)r[0](e,n),r.splice(0,1)}}function l(e,n){e.call&&(e={success:e}),n.length?(e.error||h)(n):(e.success||h)(e)}function d(r,t,s,i){var c,o,e=document,n=s.async,u=(s.numRetries||0)+1,f=s.before||h,l=r.replace(/[\?|#].*$/,""),a=r.replace(/^(css|img)!/,"");i=i||0,/(^css!|\.css$)/.test(l)?((o=e.createElement("link")).rel="stylesheet",o.href=a,(c="hideFocus"in o)&&o.relList&&(c=0,o.rel="preload",o.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(l)?(o=e.createElement("img")).src=a:((o=e.createElement("script")).src=r,o.async=void 0===n||n),!(o.onload=o.onerror=o.onbeforeload=function(e){var n=e.type[0];if(c)try{o.sheet.cssText.length||(n="e")}catch(e){18!=e.code&&(n="e")}if("e"==n){if((i+=1)<u)return d(r,t,s,i)}else if("preload"==o.rel&&"style"==o.as)return o.rel="stylesheet";t(r,n,e.defaultPrevented)})!==f(r,o)&&e.head.appendChild(o)}function r(e,n,r){var t,s;if(n&&n.trim&&(t=n),s=(t?r:n)||{},t){if(t in c)throw"LoadJS";c[t]=!0}function i(n,r){!function(e,t,n){var r,s,i=(e=e.push?e:[e]).length,c=i,o=[];for(r=function(e,n,r){if("e"==n&&o.push(e),"b"==n){if(!r)return;o.push(e)}--i||t(o)},s=0;s<c;s++)d(e[s],r,n)}(e,function(e){l(s,e),n&&l({success:n,error:r},e),o(t,e)},s)}if(s.returnPromise)return new Promise(i);i()}return r.ready=function(e,n){return function(e,r){e=e.push?e:[e];var n,t,s,i=[],c=e.length,o=c;for(n=function(e,n){n.length&&i.push(e),--o||r(i)};c--;)t=e[c],(s=u[t])?n(t,s):(f[t]=f[t]||[]).push(n)}(e,function(e){l(n,e)}),r},r.done=function(e){o(e,[])},r.reset=function(){c={},u={},f={}},r.isDefined=function(e){return e in c},r}();
|
||||
20
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/log.js
generated
vendored
Normal file
20
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/assets/log.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// define global logging function
|
||||
function log(msg) {
|
||||
var d = new Date(), ts;
|
||||
ts = d.toLocaleTimeString().split(' ');
|
||||
ts = ts[0] + '.' + d.getMilliseconds() + ' ' + ts[1];
|
||||
|
||||
console.log('[' + ts + '] ' + msg);
|
||||
}
|
||||
|
||||
|
||||
// log DOMContentLoaded event
|
||||
document.addEventListener('DOMContentLoaded', function(ev) {
|
||||
log('DOMContentLoaded fired');
|
||||
});
|
||||
|
||||
|
||||
// log window onload event
|
||||
window.addEventListener('load', function(ev) {
|
||||
log('window load event fired');
|
||||
});
|
||||
10
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/before-domcontentloaded.html
generated
vendored
Normal file
10
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/before-domcontentloaded.html
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="assets/log.js"></script>
|
||||
<script src="assets/file1.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Example: Load script before DOMContentLoaded event fires</h1>
|
||||
</body>
|
||||
</html>
|
||||
16
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/before-window-onload.html
generated
vendored
Normal file
16
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/before-window-onload.html
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="assets/log.js"></script>
|
||||
<script src="assets/loadjs/loadjs.js"></script>
|
||||
<script>
|
||||
loadjs('assets/file1.js', function() {
|
||||
log('file1.js loaded');
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Example: Trigger script load before window onload event fires</h1>
|
||||
<p>Note: If the network fetch returns before the DOMContentLoaded event or the window onload event fires then the browser will delay event execution until the script has finished executing.</p>
|
||||
</body>
|
||||
</html>
|
||||
45
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/crossdomaincss.html
generated
vendored
Normal file
45
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/crossdomaincss.html
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="assets/log.js"></script>
|
||||
<script src="assets/loadjs/loadjs.js"></script>
|
||||
<script>
|
||||
loadjs("//cdn.muicss.com/mui-0.9.41/css/mui.min.css", {
|
||||
success: function() {
|
||||
log('example1: mui.min.css triggered success (OK)');
|
||||
},
|
||||
error: function() {
|
||||
log('example1: mui.min.css triggered error (FAIL)');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
loadjs("//cdn.muicss.com/mui-0.9.41/css/mui-doesntexist.min.css", {
|
||||
success: function() {
|
||||
log('example2: mui-doesntexist.css triggered success (FAIL)');
|
||||
},
|
||||
error: function() {
|
||||
log('example2: mui-doesntexist.css triggered error (OK)');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
loadjs('assets/fontcss-doesntexist.css', {
|
||||
success: function() {
|
||||
log('example3: font-doesntexist.css triggered success (FAIL)');
|
||||
},
|
||||
error: function() {
|
||||
log('example3: font-doesntexist.css triggered error (OK)');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<h1>My Title</h1>
|
||||
<button class="mui-btn mui-btn--primary mui-btn--raised">My Button</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
40
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/css-testonerror.html
generated
vendored
Normal file
40
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/css-testonerror.html
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
function loadSheet(path) {
|
||||
var e = document.createElement('link');
|
||||
|
||||
e.rel = 'stylesheet';
|
||||
e.href = path;
|
||||
|
||||
e.onload = function(ev) {
|
||||
console.log('---- ONLOAD ----');
|
||||
console.log(path + ': ' + ev.type);
|
||||
|
||||
try {
|
||||
console.log('sheet.cssText.length: ' + e.sheet.cssText.length);
|
||||
} catch (err) {
|
||||
console.log('error code: ' + err.code);
|
||||
}
|
||||
|
||||
console.log(ev);
|
||||
|
||||
console.log('----------------');
|
||||
};
|
||||
|
||||
e.onerror = function(ev) {console.log('onerror: ' + ev.type);};
|
||||
|
||||
document.head.appendChild(e);
|
||||
|
||||
}
|
||||
|
||||
loadSheet('//cdn.muicss.com/mui-0.9.41/css/mui.min.css');
|
||||
loadSheet('//cdn.muicss.com/mui-0.9.41/css/mui-doesntexist.min.css');
|
||||
loadSheet('assets/fontcss-doesntexist.css');
|
||||
loadSheet('assets/file.css');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
43
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/css-testpreload.html
generated
vendored
Normal file
43
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/css-testpreload.html
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
function loadSheet(path) {
|
||||
var e = document.createElement('link');
|
||||
|
||||
//e.rel = 'stylesheet';
|
||||
e.rel = 'preload';
|
||||
e.as = 'style';
|
||||
e.href = path;
|
||||
|
||||
e.onload = function(ev) {
|
||||
//if (e.rel == 'preload') return e.rel = 'stylesheet';
|
||||
|
||||
console.log('[ONLOAD] ' + path + ': ' + ev.type);
|
||||
};
|
||||
|
||||
e.onerror = function(ev) {
|
||||
//if (e.rel == 'preload') return e.rel = 'stylesheet';
|
||||
|
||||
console.log('[ONERROR] ' + path + ': ' + ev.type);
|
||||
};
|
||||
|
||||
document.head.appendChild(e);
|
||||
|
||||
}
|
||||
|
||||
//loadSheet('//cdn.muicss.com/mui-0.9.41/css/mui.min.css');
|
||||
loadSheet('//cdn.muicss.com/mui-0.9.41/css/mui-doesntexist.min.css');
|
||||
//loadSheet('assets/fontcss-doesntexist.css');
|
||||
//loadSheet('assets/file.css');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<h1>My Title</h1>
|
||||
<button class="mui-btn mui-btn--primary mui-btn--raised">My Button</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
133
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/css-testpreloadperformance.html
generated
vendored
Normal file
133
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/css-testpreloadperformance.html
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
var results = {
|
||||
0: [],
|
||||
1: [],
|
||||
2: []
|
||||
};
|
||||
|
||||
function standardDeviation(values) {
|
||||
var avg = average(values);
|
||||
|
||||
var squareDiffs = values.map(function(value){
|
||||
var diff = value - avg;
|
||||
var sqrDiff = diff * diff;
|
||||
return sqrDiff;
|
||||
});
|
||||
|
||||
var avgSquareDiff = average(squareDiffs);
|
||||
|
||||
var stdDev = Math.sqrt(avgSquareDiff);
|
||||
return stdDev;
|
||||
}
|
||||
|
||||
function average(data){
|
||||
var sum = data.reduce(function(sum, value){
|
||||
return sum + value;
|
||||
}, 0);
|
||||
|
||||
var avg = sum / data.length;
|
||||
return avg;
|
||||
}
|
||||
|
||||
function doLoad(path, callbackFn) {
|
||||
var e = document.createElement('link'),
|
||||
t0;
|
||||
|
||||
e.rel = 'stylesheet';
|
||||
e.href = path + '?' + Math.random();
|
||||
e.onload = function(ev) {
|
||||
var t1 = performance.now();
|
||||
results[0].push(t1 - t0);
|
||||
setTimeout(function(){callbackFn(e)}, 0);
|
||||
};
|
||||
|
||||
t0 = performance.now();
|
||||
document.head.appendChild(e);
|
||||
}
|
||||
|
||||
function doPreload(path, callbackFn) {
|
||||
var e = document.createElement('link'),
|
||||
t0;
|
||||
|
||||
e.rel = 'preload';
|
||||
e.as = 'style';
|
||||
e.href = path + '?' + Math.random();
|
||||
e.onload = function(ev) {
|
||||
var t1 = performance.now();
|
||||
results[1].push(t1 - t0);
|
||||
setTimeout(function(){callbackFn(e)}, 0);
|
||||
};
|
||||
|
||||
t0 = performance.now();
|
||||
document.head.appendChild(e);
|
||||
}
|
||||
|
||||
function doPreloadWithExecution(path, callbackFn) {
|
||||
var e = document.createElement('link'),
|
||||
t0;
|
||||
|
||||
e.rel = 'preload';
|
||||
e.as = 'style';
|
||||
e.href = path + '?' + Math.random();
|
||||
e.onload = function(ev) {
|
||||
if (e.rel == 'preload') return e.rel = 'stylesheet';
|
||||
var t1 = performance.now();
|
||||
results[2].push(t1 - t0);
|
||||
setTimeout(function(){callbackFn(e)}, 0);
|
||||
};
|
||||
|
||||
t0 = performance.now();
|
||||
document.head.appendChild(e);
|
||||
}
|
||||
|
||||
function printResults(str, data) {
|
||||
var sum = data.reduce(function(a, b) {return a + b;}, 0);
|
||||
|
||||
console.log('-----------');
|
||||
console.log(str + '(' + data.length + '):');
|
||||
console.log('Min: ' + Math.min(...data));
|
||||
console.log('Max: ' + Math.max(...data));
|
||||
console.log('Avg: ' + sum / data.length);
|
||||
console.log('Std: ' + standardDeviation(data));
|
||||
console.log('-----------');
|
||||
}
|
||||
|
||||
function loadAll(n) {
|
||||
console.log(n);
|
||||
|
||||
if (n == 100) {
|
||||
setTimeout(function() {
|
||||
printResults('Load', results[0]);
|
||||
printResults('Preload', results[1]);
|
||||
printResults('PreloadWithExecution', results[2]);
|
||||
}, 2000);
|
||||
return;
|
||||
}
|
||||
|
||||
var path = '//cdn.muicss.com/mui-0.9.41/css/mui.min.css';
|
||||
|
||||
doLoad(path, function(e1) {
|
||||
doPreload(path, function(e2) {
|
||||
doPreloadWithExecution(path, function(e3) {
|
||||
loadAll(n + 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
loadAll(0);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="mui-container">
|
||||
<div class="mui-panel">
|
||||
<h1>My Title</h1>
|
||||
<button class="mui-btn mui-btn--primary mui-btn--raised">My Button</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
99
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/examples.html
generated
vendored
Normal file
99
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/examples.html
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="assets/log.js"></script>
|
||||
<script src="assets/loadjs/loadjs.js"></script>
|
||||
<script>
|
||||
// load a single file
|
||||
loadjs('assets/file1.js', function() {
|
||||
log('example1: file1.js loaded');
|
||||
});
|
||||
|
||||
|
||||
// load multiple files
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], function() {
|
||||
log('example2: file1.js & file2.js loaded');
|
||||
});
|
||||
|
||||
|
||||
// add a bundle id
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], 'example3', function() {
|
||||
log('example3: file1.js & file2.js loaded');
|
||||
});
|
||||
|
||||
|
||||
// add a failure callback
|
||||
loadjs(['assets/file1.js', 'assets/file-doesntexist.js'],
|
||||
'example4',
|
||||
function() {
|
||||
throw "Load should fail";
|
||||
},
|
||||
function(pathsNotFound) {
|
||||
log('example4: ' + pathsNotFound + ' not found');
|
||||
});
|
||||
|
||||
|
||||
// execute a callback after bundle finishes loading
|
||||
loadjs(['assets/file1.js', 'assets/file2.js'], 'example5');
|
||||
|
||||
loadjs.ready('example5', function() {
|
||||
log('example5: file1.js & file2.js loaded');
|
||||
});
|
||||
|
||||
|
||||
// .ready() can be chained together
|
||||
loadjs('assets/file1.js', 'example6a');
|
||||
loadjs('assets/file2.js', 'example6b');
|
||||
|
||||
loadjs
|
||||
.ready('example6a', function() {
|
||||
log('example6a: file1.js loaded');
|
||||
})
|
||||
.ready('example6b', function() {
|
||||
log('example6b: file2.js loaded');
|
||||
});
|
||||
|
||||
|
||||
// compose more complex dependency lists
|
||||
loadjs('assets/file1.js', 'example7a');
|
||||
loadjs(['assets/file2.js', 'assets/file3.js'], 'example7b');
|
||||
loadjs(['assets/file3.js', 'assets/file-doesntexist.js'], 'example7c');
|
||||
|
||||
// wait for multiple depdendencies
|
||||
loadjs.ready(['example7a', 'example7b'],
|
||||
function() {
|
||||
log('example7ab: file1.js & file2.js & file3.js loaded');
|
||||
},
|
||||
function(depsNotFound) {
|
||||
throw "Load should succeed";
|
||||
});
|
||||
|
||||
loadjs.ready(['example7a', 'example7b', 'example7c'],
|
||||
function() {
|
||||
throw "Load should fail";
|
||||
},
|
||||
function(depsNotFound) {
|
||||
log('example7abc: ' + depsNotFound + ' failed');
|
||||
});
|
||||
|
||||
|
||||
// use .done() for more control
|
||||
loadjs.ready('my-awesome-plugin', function() {
|
||||
myAwesomePlugin();
|
||||
log('example8: my-awesome-plugin was loaded');
|
||||
});
|
||||
|
||||
loadjs('https://code.jquery.com/jquery-1.11.3.min.js', function() {
|
||||
// plugin requires jquery
|
||||
window.myAwesomePlugin = function() {
|
||||
if (!window.jQuery) throw "jQuery is missing!";
|
||||
};
|
||||
|
||||
// plugin is done loading
|
||||
loadjs.done('my-awesome-plugin');
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
31
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/image.html
generated
vendored
Normal file
31
lisp/emacs-application-framework/app/js-video-player/node_modules/loadjs/examples/image.html
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<script src="assets/log.js"></script>
|
||||
<script src="assets/loadjs/loadjs.js"></script>
|
||||
<script>
|
||||
loadjs('assets/flash.svg', function() {
|
||||
log('example1: flash.svg loaded');
|
||||
});
|
||||
|
||||
loadjs('assets/flash.png', function() {
|
||||
log('example2: flash.png loaded');
|
||||
});
|
||||
|
||||
loadjs('assets/flash-doesntexist.svg', {
|
||||
success: function() {
|
||||
log('example3: flash-doesntexist.svg triggered success (FAIL)');
|
||||
},
|
||||
error: function() {
|
||||
log('example3: flash-doesntexist.svg triggered error (OK)');
|
||||
}
|
||||
});
|
||||
|
||||
loadjs('img!assets/flash.svg?trick', function() {
|
||||
log('example4: flash.svg loaded');
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user