mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-06-05 21:49:31 +02:00
Fixed #56
This commit is contained in:
@ -152,6 +152,9 @@ var files = {
|
|||||||
// jQuery jeditable
|
// jQuery jeditable
|
||||||
'resources/jquery-jeditable/1.8.0/jquery.jeditable.min.jsm': true,
|
'resources/jquery-jeditable/1.8.0/jquery.jeditable.min.jsm': true,
|
||||||
|
|
||||||
|
// jQuery URLive
|
||||||
|
'resources/urlive/latest/jquery.urlive.min.jsm': true,
|
||||||
|
|
||||||
// JavaScript Cookie
|
// JavaScript Cookie
|
||||||
'resources/js-cookie/2.2.1/js.cookie.min.jsm': true,
|
'resources/js-cookie/2.2.1/js.cookie.min.jsm': true,
|
||||||
|
|
||||||
@ -233,6 +236,9 @@ var files = {
|
|||||||
'resources/vue/1.0.28/vue.min.jsm': true,
|
'resources/vue/1.0.28/vue.min.jsm': true,
|
||||||
'resources/vue/2.6.11/vue.min.jsm': true,
|
'resources/vue/2.6.11/vue.min.jsm': true,
|
||||||
|
|
||||||
|
// WebComponents.js
|
||||||
|
'resources/webcomponentsjs/latest/webcomponents-loader.jsm': true,
|
||||||
|
|
||||||
// Web Font Loader
|
// Web Font Loader
|
||||||
'resources/webfont/1.6.28/webfont.jsm': true,
|
'resources/webfont/1.6.28/webfont.jsm': true,
|
||||||
|
|
||||||
|
@ -198,6 +198,8 @@ var mappings = {
|
|||||||
'scriptaculous-js@{version}/scriptaculous.': resources.scriptaculous,
|
'scriptaculous-js@{version}/scriptaculous.': resources.scriptaculous,
|
||||||
'underscore@{version}/underscore.': resources.underscore,
|
'underscore@{version}/underscore.': resources.underscore,
|
||||||
'underscore@{version}/underscore-min.': resources.underscore,
|
'underscore@{version}/underscore-min.': resources.underscore,
|
||||||
|
'urlize.js/urlize.js': resources.jqueryURLive,
|
||||||
|
'@webcomponents/webcomponentsjs/webcomponents-loader.js': resources.webcomponentsJS,
|
||||||
'webfontloader@{version}/webfontloader.': resources.webfont
|
'webfontloader@{version}/webfontloader.': resources.webfont
|
||||||
},
|
},
|
||||||
// Deprecated (?)
|
// Deprecated (?)
|
||||||
|
@ -200,6 +200,11 @@ var resources = {
|
|||||||
'path': 'resources/jqueryui/{version}/themes/base/minified/jquery-ui.min.css',
|
'path': 'resources/jqueryui/{version}/themes/base/minified/jquery-ui.min.css',
|
||||||
'type': 'text/css'
|
'type': 'text/css'
|
||||||
},
|
},
|
||||||
|
// jQuery URLive
|
||||||
|
'jqueryURLive': {
|
||||||
|
'path': 'resources/urlive/{version}/jquery.urlive.min.jsm',
|
||||||
|
'type': 'application/javascript'
|
||||||
|
},
|
||||||
// jQuery Validation Plugin
|
// jQuery Validation Plugin
|
||||||
'jqueryValidationPlugin': {
|
'jqueryValidationPlugin': {
|
||||||
'path': 'resources/jquery-validate/{version}/jquery.validate.min.jsm',
|
'path': 'resources/jquery-validate/{version}/jquery.validate.min.jsm',
|
||||||
@ -352,6 +357,11 @@ var resources = {
|
|||||||
'path': 'resources/vue/{version}/vue.min.jsm',
|
'path': 'resources/vue/{version}/vue.min.jsm',
|
||||||
'type': 'application/javascript'
|
'type': 'application/javascript'
|
||||||
},
|
},
|
||||||
|
// WebComponents.js
|
||||||
|
'webcomponentsJS': {
|
||||||
|
'path': 'resources/webcomponentsjs/{version}/webcomponents-loader.jsm',
|
||||||
|
'type': 'application/javascript'
|
||||||
|
},
|
||||||
// Web Font Loader
|
// Web Font Loader
|
||||||
'webfont': {
|
'webfont': {
|
||||||
'path': 'resources/webfont/{version}/webfont.jsm',
|
'path': 'resources/webfont/{version}/webfont.jsm',
|
||||||
|
@ -282,6 +282,8 @@ helpers.determineResourceName = function (filename) {
|
|||||||
return 'jQuery jeditable';
|
return 'jQuery jeditable';
|
||||||
case 'jquery.jeditable.min.jsm':
|
case 'jquery.jeditable.min.jsm':
|
||||||
return 'jQuery Validation Plugin';
|
return 'jQuery Validation Plugin';
|
||||||
|
case 'jquery.urlive.min.jsm':
|
||||||
|
return 'jQuery URLive';
|
||||||
case 'js.cookie.min.jsm':
|
case 'js.cookie.min.jsm':
|
||||||
return 'JavaScript Cookie';
|
return 'JavaScript Cookie';
|
||||||
case 'lazysizes.min.jsm':
|
case 'lazysizes.min.jsm':
|
||||||
@ -350,6 +352,8 @@ helpers.determineResourceName = function (filename) {
|
|||||||
return 'jsDelivr combined';
|
return 'jsDelivr combined';
|
||||||
case 'algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm':
|
case 'algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm':
|
||||||
return 'jsDelivr combined';
|
return 'jsDelivr combined';
|
||||||
|
case 'webcomponents-loader.jsm':
|
||||||
|
return 'WebComponents Loader JS';
|
||||||
default:
|
default:
|
||||||
return 'Unknown';
|
return 'Unknown';
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Fixed <a href="https://gitlab.com/nobody42/localcdn/-/issues/55">#55</a></li>
|
<li>Fixed <a href="https://gitlab.com/nobody42/localcdn/-/issues/55">#55</a></li>
|
||||||
|
<li>Added WebComponents.js and jQuery URLive <a href="https://gitlab.com/nobody42/localcdn/-/issues/56">#56</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="topic-label">
|
<div class="topic-label">
|
||||||
Please update your uBlock/uMatrix rules
|
Please update your uBlock/uMatrix rules
|
||||||
|
9
resources/urlive/latest/jquery.urlive.min.jsm
Normal file
9
resources/urlive/latest/jquery.urlive.min.jsm
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* jquery.urlive.min.js v1.1.1, jQuery URLive
|
||||||
|
*
|
||||||
|
* View the plugin repository at:
|
||||||
|
* https://github.com/markserbol/urlive
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function(c){var k={container:".urlive-container",target:"_blank",imageSize:"auto",render:!0,disableClick:!1,regexp:/((https?:\/\/)?[\w-@]+(\.[a-z]+)+\.?(:\d+)?(\/\S*)?)/i,yqlSelect:"*",callbacks:{onStart:function(){},onSuccess:function(){},onFail:function(){},noData:function(){},onLoadEnd:function(){},imgError:function(){},onClick:function(){}}},l=function(a){var e=RegExp(window.location.protocol+"//"+window.location.hostname),g="http"+(/^https/.test(window.location.protocol)?"s":"")+"://query.yahooapis.com/v1/public/yql?callback=?";return function(d){var b=/^https?:\/\//i.test(d.url)?d.url:window.location.protocol+"//"+d.url;/get/i.test(d.type)&&!/json/i.test(d.dataType)&&!e.test(b)&&/:\/\//.test(b)&&(d.url=g,d.dataType="json",d.data={q:'select {SELECT} from html where url="{URL}" and xpath="*" and compat="html5"'.replace("{SELECT}",d.yqlSelect).replace("{URL}",b+(d.data?(/\?/.test(b)?"&":"?")+c.param(d.data):"")),format:"xml"},!d.success&&d.complete&&(d.success=d.complete,delete d.complete),d.success=function(c){return function(e){c&&c.call(this,{responseText:(e.results[0]||"").replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi,"")},"success")}}(d.success));return a.apply(this,arguments)}}(c.ajax),g=function(){var a=c(this).data("urlive-container")||c(this);return c(a).find(".urlive-link")},h={init:function(a){var e=c.extend(!0,k,a);return this.each(function(){function a(f){l({url:f,type:"GET",yqlSelect:e.yqlSelect,beforeSend:e.callbacks.onStart}).done(function(a){c.isEmptyObject(a.results)?(e.callbacks.noData(),c.error("YQL request succeeded but with empty results",a)):(a=a.results[0],html=c("<div/>",{html:a}),get=function(a){return html.find('[property="'+a+'"]').attr("content")||html.find('[name="'+a+'"]').attr("content")||html.find(a).html()||html.find(a).attr("src")},set={image:b.data("image")||get("og:image")||get("img"),title:b.data("title")||get("og:title")||get("title"),description:b.data("description")||get("og:description")||get("description"),url:b.data("url")||get("og:url")||f,type:b.data("type")||get("og:type"),sitename:b.data("site_name")||get("og:site_name")},e.callbacks.onSuccess(set),e.render&&d(set))}).fail(function(a,d,b){e.callbacks.onFail();c.error("YQL request error: ",d,b)})}function d(a){outer=c("<a/>",{"class":"urlive-link",href:a.url,target:e.target});imgWrapper=c("<div/>",{"class":"urlive-img-wrapper"});textWrapper=c("<div/>",{"class":"urlive-text-wrapper"});c.each(a,function(d,b){b&&("image"==d?(/^(?:[a-z]+:)?\/\//i.test(b)||(b=/^https?:\/\//i.test(a.url)?a.url+b:window.location.protocol+"//"+a.url+b),img=c("<img/>",{src:b}),img.error(e.callbacks.imgError),img.appendTo(imgWrapper),img.hide().load(function(){var a=c(this).width(),b=c(this).closest(".urlive-link");c(this).addClass("urlive-"+d).show();"auto"==e.imageSize?a>=b.width()?b.addClass("urlive-img-large"):b.addClass("urlive-img-small"):"large"==e.imageSize?b.addClass("urlive-img-large"):"small"==e.imageSize&&b.addClass("urlive-img-small");e.callbacks.onLoadEnd()})):(elem=c("<span/>",{"class":"urlive-"+d,text:b}),elem.appendTo(textWrapper)))});outer.append(imgWrapper,textWrapper).appendTo(b.data("urlive-container"));outer.on("click",e.callbacks.onClick);if(e.disableClick)outer.on("click",function(a){a.preventDefault()})}var b=c(this),f=void 0;b.data("urlive-container",e.container);if(b.is("a"))f=b.attr("href");else var f=b.val()||b.text(),g=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,f=(f=e.regexp.exec(f))&&!g.test(f[0])?f[0]:null;f&&(/\.(?:jpe?g|gif|png)/.test(f)?(g=f.substr(f.lastIndexOf("/")+1),d({image:f,title:g,url:f})):a(f))})},close:function(a){g.apply(this).fadeOut(a)},remove:function(a){var c=g.apply(this);a?c.fadeOut(a,function(){c.remove()}):c.remove()},open:function(a){g.apply(this).fadeIn(a)},disable:function(){g.apply(this).on("click",function(a){a.preventDefault()})},enable:function(){g.apply(this).off("click")}};c.fn.urlive=function(a){if(h[a])return h[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"!==typeof a&&a)c.error('Method "'+a+'" does not exist on jquery.urlive');else return h.init.apply(this,arguments)}})(jQuery);
|
185
resources/webcomponentsjs/latest/webcomponents-loader.jsm
Normal file
185
resources/webcomponentsjs/latest/webcomponents-loader.jsm
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
|
||||||
|
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||||
|
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||||
|
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||||
|
* Code distributed by Google as part of the polymer project is also
|
||||||
|
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic flow of the loader process
|
||||||
|
*
|
||||||
|
* There are 4 flows the loader can take when booting up
|
||||||
|
*
|
||||||
|
* - Synchronous script, no polyfills needed
|
||||||
|
* - wait for `DOMContentLoaded`
|
||||||
|
* - fire WCR event, as there could not be any callbacks passed to `waitFor`
|
||||||
|
*
|
||||||
|
* - Synchronous script, polyfills needed
|
||||||
|
* - document.write the polyfill bundle
|
||||||
|
* - wait on the `load` event of the bundle to batch Custom Element upgrades
|
||||||
|
* - wait for `DOMContentLoaded`
|
||||||
|
* - run callbacks passed to `waitFor`
|
||||||
|
* - fire WCR event
|
||||||
|
*
|
||||||
|
* - Asynchronous script, no polyfills needed
|
||||||
|
* - wait for `DOMContentLoaded`
|
||||||
|
* - run callbacks passed to `waitFor`
|
||||||
|
* - fire WCR event
|
||||||
|
*
|
||||||
|
* - Asynchronous script, polyfills needed
|
||||||
|
* - Append the polyfill bundle script
|
||||||
|
* - wait for `load` event of the bundle
|
||||||
|
* - batch Custom Element Upgrades
|
||||||
|
* - run callbacks pass to `waitFor`
|
||||||
|
* - fire WCR event
|
||||||
|
*/
|
||||||
|
|
||||||
|
var polyfillsLoaded = false;
|
||||||
|
var whenLoadedFns = [];
|
||||||
|
var allowUpgrades = false;
|
||||||
|
var flushFn;
|
||||||
|
|
||||||
|
function fireEvent() {
|
||||||
|
window.WebComponents.ready = true;
|
||||||
|
document.dispatchEvent(new CustomEvent('WebComponentsReady', { bubbles: true }));
|
||||||
|
}
|
||||||
|
|
||||||
|
function batchCustomElements() {
|
||||||
|
if (window.customElements && customElements.polyfillWrapFlushCallback) {
|
||||||
|
customElements.polyfillWrapFlushCallback(function (flushCallback) {
|
||||||
|
flushFn = flushCallback;
|
||||||
|
if (allowUpgrades) {
|
||||||
|
flushFn();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function asyncReady() {
|
||||||
|
batchCustomElements();
|
||||||
|
ready();
|
||||||
|
}
|
||||||
|
|
||||||
|
function ready() {
|
||||||
|
// bootstrap <template> elements before custom elements
|
||||||
|
if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
|
||||||
|
HTMLTemplateElement.bootstrap(window.document);
|
||||||
|
}
|
||||||
|
polyfillsLoaded = true;
|
||||||
|
runWhenLoadedFns().then(fireEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runWhenLoadedFns() {
|
||||||
|
allowUpgrades = false;
|
||||||
|
var fnsMap = whenLoadedFns.map(function(fn) {
|
||||||
|
return fn instanceof Function ? fn() : fn;
|
||||||
|
});
|
||||||
|
whenLoadedFns = [];
|
||||||
|
return Promise.all(fnsMap).then(function() {
|
||||||
|
allowUpgrades = true;
|
||||||
|
flushFn && flushFn();
|
||||||
|
}).catch(function(err) {
|
||||||
|
console.error(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
window.WebComponents = window.WebComponents || {};
|
||||||
|
window.WebComponents.ready = window.WebComponents.ready || false;
|
||||||
|
window.WebComponents.waitFor = window.WebComponents.waitFor || function(waitFn) {
|
||||||
|
if (!waitFn) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
whenLoadedFns.push(waitFn);
|
||||||
|
if (polyfillsLoaded) {
|
||||||
|
runWhenLoadedFns();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.WebComponents._batchCustomElements = batchCustomElements;
|
||||||
|
|
||||||
|
var name = 'webcomponents-loader.js';
|
||||||
|
// Feature detect which polyfill needs to be imported.
|
||||||
|
var polyfills = [];
|
||||||
|
if (!('attachShadow' in Element.prototype && 'getRootNode' in Element.prototype) ||
|
||||||
|
(window.ShadyDOM && window.ShadyDOM.force)) {
|
||||||
|
polyfills.push('sd');
|
||||||
|
}
|
||||||
|
if (!window.customElements || window.customElements.forcePolyfill) {
|
||||||
|
polyfills.push('ce');
|
||||||
|
}
|
||||||
|
|
||||||
|
var needsTemplate = (function() {
|
||||||
|
// no real <template> because no `content` property (IE and older browsers)
|
||||||
|
var t = document.createElement('template');
|
||||||
|
if (!('content' in t)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// broken doc fragment (older Edge)
|
||||||
|
if (!(t.content.cloneNode() instanceof DocumentFragment)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// broken <template> cloning (Edge up to at least version 17)
|
||||||
|
var t2 = document.createElement('template');
|
||||||
|
t2.content.appendChild(document.createElement('div'));
|
||||||
|
t.content.appendChild(t2);
|
||||||
|
var clone = t.cloneNode(true);
|
||||||
|
return (clone.content.childNodes.length === 0 ||
|
||||||
|
clone.content.firstChild.content.childNodes.length === 0);
|
||||||
|
})();
|
||||||
|
|
||||||
|
// NOTE: any browser that does not have template or ES6 features
|
||||||
|
// must load the full suite of polyfills.
|
||||||
|
if (!window.Promise || !Array.from || !window.URL || !window.Symbol || needsTemplate) {
|
||||||
|
polyfills = ['sd-ce-pf'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (polyfills.length) {
|
||||||
|
var url;
|
||||||
|
var polyfillFile = 'bundles/webcomponents-' + polyfills.join('-') + '.js';
|
||||||
|
|
||||||
|
// Load it from the right place.
|
||||||
|
if (window.WebComponents.root) {
|
||||||
|
url = window.WebComponents.root + polyfillFile;
|
||||||
|
} else {
|
||||||
|
var script = document.querySelector('script[src*="' + name +'"]');
|
||||||
|
// Load it from the right place.
|
||||||
|
url = script.src.replace(name, polyfillFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
var newScript = document.createElement('script');
|
||||||
|
newScript.src = url;
|
||||||
|
// if readyState is 'loading', this script is synchronous
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
// make sure custom elements are batched whenever parser gets to the injected script
|
||||||
|
newScript.setAttribute('onload', 'window.WebComponents._batchCustomElements()');
|
||||||
|
document.write(newScript.outerHTML);
|
||||||
|
document.addEventListener('DOMContentLoaded', ready);
|
||||||
|
} else {
|
||||||
|
newScript.addEventListener('load', function () {
|
||||||
|
asyncReady();
|
||||||
|
});
|
||||||
|
newScript.addEventListener('error', function () {
|
||||||
|
throw new Error('Could not load polyfill bundle' + url);
|
||||||
|
});
|
||||||
|
document.head.appendChild(newScript);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if readyState is 'complete', script is loaded imperatively on a spec-compliant browser, so just fire WCR
|
||||||
|
if (document.readyState === 'complete') {
|
||||||
|
polyfillsLoaded = true;
|
||||||
|
fireEvent();
|
||||||
|
} else {
|
||||||
|
// this script may come between DCL and load, so listen for both, and cancel load listener if DCL fires
|
||||||
|
window.addEventListener('load', ready);
|
||||||
|
window.addEventListener('DOMContentLoaded', function() {
|
||||||
|
window.removeEventListener('load', ready);
|
||||||
|
ready();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
Reference in New Issue
Block a user