diff --git a/core/files.js b/core/files.js index 456e3b20..d762e512 100644 --- a/core/files.js +++ b/core/files.js @@ -152,6 +152,9 @@ var files = { // jQuery jeditable 'resources/jquery-jeditable/1.8.0/jquery.jeditable.min.jsm': true, + // jQuery URLive + 'resources/urlive/latest/jquery.urlive.min.jsm': true, + // JavaScript Cookie '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/2.6.11/vue.min.jsm': true, + // WebComponents.js + 'resources/webcomponentsjs/latest/webcomponents-loader.jsm': true, + // Web Font Loader 'resources/webfont/1.6.28/webfont.jsm': true, diff --git a/core/mappings.js b/core/mappings.js index e6872e12..e6ce0293 100644 --- a/core/mappings.js +++ b/core/mappings.js @@ -198,6 +198,8 @@ var mappings = { 'scriptaculous-js@{version}/scriptaculous.': resources.scriptaculous, 'underscore@{version}/underscore.': 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 }, // Deprecated (?) diff --git a/core/resources.js b/core/resources.js index 8d715073..f4b1a5ff 100644 --- a/core/resources.js +++ b/core/resources.js @@ -200,6 +200,11 @@ var resources = { 'path': 'resources/jqueryui/{version}/themes/base/minified/jquery-ui.min.css', 'type': 'text/css' }, + // jQuery URLive + 'jqueryURLive': { + 'path': 'resources/urlive/{version}/jquery.urlive.min.jsm', + 'type': 'application/javascript' + }, // jQuery Validation Plugin 'jqueryValidationPlugin': { 'path': 'resources/jquery-validate/{version}/jquery.validate.min.jsm', @@ -352,6 +357,11 @@ var resources = { 'path': 'resources/vue/{version}/vue.min.jsm', 'type': 'application/javascript' }, + // WebComponents.js + 'webcomponentsJS': { + 'path': 'resources/webcomponentsjs/{version}/webcomponents-loader.jsm', + 'type': 'application/javascript' + }, // Web Font Loader 'webfont': { 'path': 'resources/webfont/{version}/webfont.jsm', diff --git a/modules/internal/helpers.js b/modules/internal/helpers.js index 22323a3f..73b9dc9c 100644 --- a/modules/internal/helpers.js +++ b/modules/internal/helpers.js @@ -282,6 +282,8 @@ helpers.determineResourceName = function (filename) { return 'jQuery jeditable'; case 'jquery.jeditable.min.jsm': return 'jQuery Validation Plugin'; + case 'jquery.urlive.min.jsm': + return 'jQuery URLive'; case 'js.cookie.min.jsm': return 'JavaScript Cookie'; case 'lazysizes.min.jsm': @@ -350,6 +352,8 @@ helpers.determineResourceName = function (filename) { return 'jsDelivr combined'; case 'algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm': return 'jsDelivr combined'; + case 'webcomponents-loader.jsm': + return 'WebComponents Loader JS'; default: return 'Unknown'; } diff --git a/pages/updates/updates.html b/pages/updates/updates.html index 6d0e49d5..eb1390db 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -24,6 +24,7 @@
Please update your uBlock/uMatrix rules diff --git a/resources/urlive/latest/jquery.urlive.min.jsm b/resources/urlive/latest/jquery.urlive.min.jsm new file mode 100644 index 00000000..41cc138c --- /dev/null +++ b/resources/urlive/latest/jquery.urlive.min.jsm @@ -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(/]+?\/>|/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("
",{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("",{"class":"urlive-link",href:a.url,target:e.target});imgWrapper=c("
",{"class":"urlive-img-wrapper"});textWrapper=c("
",{"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("",{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("",{"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); diff --git a/resources/webcomponentsjs/latest/webcomponents-loader.jsm b/resources/webcomponentsjs/latest/webcomponents-loader.jsm new file mode 100644 index 00000000..d3ccb6bb --- /dev/null +++ b/resources/webcomponentsjs/latest/webcomponents-loader.jsm @@ -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