mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-12-11 07:16:08 +00:00
d35286a064
Upgrade from Webpack v2.0.12 to v4.1.1. There have been many changes to Webpack... Noticeable in the bundle size is that a number of files are now inlined and generally minification is improved. Changes related to the upgrade include: - Remove unsupported UglifyJS options which link back to T188081. These appear to have been anticipatory but never acted on and it isn't clear whether they even worked or not. - Pass the -p plag for production optimizations; pass the -d flag since production doesn't support watching. - NamedModulesPlugin is now on by default but only in development mode so no change was made. - Webpack command line client now must be installed separated and appears in package.json as webpack-cli. https://github.com/webpack/webpack/releases/tag/v2.2.0 https://github.com/webpack/webpack/releases/tag/v2.2.1 https://github.com/webpack/webpack/releases/tag/v2.3.0 https://github.com/webpack/webpack/releases/tag/v2.3.1 https://github.com/webpack/webpack/releases/tag/v2.3.2 https://github.com/webpack/webpack/releases/tag/v2.3.3 https://github.com/webpack/webpack/releases/tag/v2.4.0 https://github.com/webpack/webpack/releases/tag/v2.4.1 https://github.com/webpack/webpack/releases/tag/v2.5.0 https://github.com/webpack/webpack/releases/tag/v2.5.1 https://github.com/webpack/webpack/releases/tag/v2.6.0 https://github.com/webpack/webpack/releases/tag/v2.6.1 https://github.com/webpack/webpack/releases/tag/v3.0.0 https://github.com/webpack/webpack/releases/tag/v3.1.0 https://github.com/webpack/webpack/releases/tag/v3.2.0 https://github.com/webpack/webpack/releases/tag/v3.3.0 https://github.com/webpack/webpack/releases/tag/v3.4.0 https://github.com/webpack/webpack/releases/tag/v3.4.1 https://github.com/webpack/webpack/releases/tag/v3.5.0 https://github.com/webpack/webpack/releases/tag/v3.5.1 https://github.com/webpack/webpack/releases/tag/v3.5.2 https://github.com/webpack/webpack/releases/tag/v3.5.3 https://github.com/webpack/webpack/releases/tag/v3.5.4 https://github.com/webpack/webpack/releases/tag/v3.5.5 https://github.com/webpack/webpack/releases/tag/v3.5.6 https://github.com/webpack/webpack/releases/tag/v3.6.0 https://github.com/webpack/webpack/releases/tag/v3.7.0 https://github.com/webpack/webpack/releases/tag/v3.7.1 https://github.com/webpack/webpack/releases/tag/v3.8.0 https://github.com/webpack/webpack/releases/tag/v3.8.1 https://github.com/webpack/webpack/releases/tag/v3.9.0 https://github.com/webpack/webpack/releases/tag/v3.9.1 https://github.com/webpack/webpack/releases/tag/v3.10.0 https://github.com/webpack/webpack/releases/tag/v3.11.0 https://github.com/webpack/webpack/releases/tag/v4.0.0 https://medium.com/webpack/webpack-4-released-today-6cdb994702d4 https://github.com/webpack/webpack/releases/tag/v4.0.1 https://github.com/webpack/webpack/releases/tag/v4.1.0 https://github.com/webpack/webpack/releases/tag/v4.1.1 Bug: T165036 Change-Id: Ic146e680d368fee7ee207b484460ce94f8bd7283
2 lines
33 KiB
JavaScript
2 lines
33 KiB
JavaScript
!function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/index.js")}({"./node_modules/redux-thunk/dist/redux-thunk.min.js":function(e,t,n){e.exports=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t){"use strict";function n(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(r){return"function"==typeof r?r(n,i,e):t(r)}}}}t.__esModule=!0;var i=n();i.withExtraArgument=n,t.default=i}])},"./node_modules/redux/dist/redux.min.js":function(e,t,n){e.exports=function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var r=n(2),o=i(r),a=n(7),u=i(a),s=n(6),p=i(s),c=n(5),l=i(c),d=n(1),f=i(d),g=n(3);i(g),t.createStore=o.default,t.combineReducers=u.default,t.bindActionCreators=p.default,t.applyMiddleware=l.default,t.compose=f.default},function(e,t){"use strict";t.__esModule=!0,t.default=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];if(0===t.length)return function(e){return e};if(1===t.length)return t[0];var i=t[t.length-1],r=t.slice(0,-1);return function(){return r.reduceRight(function(e,t){return t(e)},i.apply(void 0,arguments))}}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.ActionTypes=void 0,t.default=function e(t,n,i){function r(){v===g&&(v=g.slice())}function a(){return f}function p(e){if("function"!=typeof e)throw Error("Expected listener to be a function.");var t=!0;return r(),v.push(e),function(){if(t){t=!1,r();var n=v.indexOf(e);v.splice(n,1)}}}function c(e){if(!(0,o.default)(e))throw Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(h)throw Error("Reducers may not dispatch actions.");try{h=!0,f=d(f,e)}finally{h=!1}for(var t=g=v,n=0;t.length>n;n++)t[n]();return e}var l;if("function"==typeof n&&void 0===i&&(i=n,n=void 0),void 0!==i){if("function"!=typeof i)throw Error("Expected the enhancer to be a function.");return i(e)(t,n)}if("function"!=typeof t)throw Error("Expected the reducer to be a function.");var d=t,f=n,g=[],v=g,h=!1;return c({type:s.INIT}),(l={dispatch:c,subscribe:p,getState:a,replaceReducer:function(e){if("function"!=typeof e)throw Error("Expected the nextReducer to be a function.");d=e,c({type:s.INIT})}})[u.default]=function(){var e,t=p;return(e={subscribe:function(e){function n(){e.next&&e.next(a())}if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");n();var i=t(n);return{unsubscribe:i}}})[u.default]=function(){return this},e},l};var r=n(4),o=i(r),a=n(12),u=i(a),s=t.ActionTypes={INIT:"@@redux/INIT"}},function(e,t){"use strict";t.__esModule=!0,t.default=function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw Error(e)}catch(e){}}},function(e,t,n){var i=n(8),r=n(9),o=n(11),a="[object Object]",u=Function.prototype,s=Object.prototype,p=u.toString,c=s.hasOwnProperty,l=p.call(Object),d=s.toString;e.exports=function(e){if(!o(e)||d.call(e)!=a||r(e))return!1;var t=i(e);if(null===t)return!0;var n=c.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&p.call(n)==l}},function(e,t,n){"use strict";t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};t.default=function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return function(e){return function(n,r,a){var u=e(n,r,a),s=u.dispatch,p=[],c={getState:u.getState,dispatch:function(e){return s(e)}};return p=t.map(function(e){return e(c)}),s=o.default.apply(void 0,p)(u.dispatch),i({},u,{dispatch:s})}}};var r=n(1),o=function(e){return e&&e.__esModule?e:{default:e}}(r)},function(e,t){"use strict";function n(e,t){return function(){return t(e.apply(void 0,arguments))}}t.__esModule=!0,t.default=function(e,t){if("function"==typeof e)return n(e,t);if("object"!=typeof e||null===e)throw Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var i=Object.keys(e),r={},o=0;i.length>o;o++){var a=i[o],u=e[a];"function"==typeof u&&(r[a]=n(u,t))}return r}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n=t&&t.type,i=n&&'"'+n+'"'||"an action";return"Given action "+i+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state.'}function o(e){Object.keys(e).forEach(function(t){var n=e[t],i=n(void 0,{type:a.ActionTypes.INIT});if(void 0===i)throw Error('Reducer "'+t+'" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined.');var r="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if(void 0===n(void 0,{type:r}))throw Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+a.ActionTypes.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined.')})}t.__esModule=!0,t.default=function(e){for(var t=Object.keys(e),n={},i=0;t.length>i;i++){var a=t[i];"function"==typeof e[a]&&(n[a]=e[a])}var u,s=Object.keys(n);try{o(n)}catch(e){u=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(u)throw u;for(var i=!1,o={},a=0;s.length>a;a++){var p=s[a],c=n[p],l=e[p],d=c(l,t);if(void 0===d){var f=r(p,t);throw Error(f)}o[p]=d,i=i||d!==l}return i?o:e}};var a=n(2),u=n(4),s=(i(u),n(3));i(s)},function(e,t,n){var i=n(10),r=i(Object.getPrototypeOf,Object);e.exports=r},function(e,t){e.exports=function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}},function(e,t){e.exports=function(e,t){return function(n){return e(t(n))}}},function(e,t){e.exports=function(e){return!!e&&"object"==typeof e}},function(e,t,n){e.exports=n(13)},function(e,t,n){(function(e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(14),r=function(e){return e&&e.__esModule?e:{default:e}}(i),o=void 0;void 0!==e?o=e:"undefined"!=typeof window&&(o=window);var a=(0,r.default)(o);t.default=a}).call(t,function(){return this}())},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}}])},"./src/counts.js":function(e,t){t.getEditCountBucket=function(e){var t;return 0===e?t="0":e>=1&&e<=4?t="1-4":e>=5&&e<=99?t="5-99":e>=100&&e<=999?t="100-999":e>=1e3&&(t="1000+"),t+" edits"},t.getPreviewCountBucket=function(e){var t;return 0===e?t="0":e>=1&&e<=4?t="1-4":e>=5&&e<=20?t="5-20":e>=21&&(t="21+"),void 0!==t?t+" previews":"unknown"}},"./src/index.js":function(e,t,n){"use strict";n.r(t);var i={};n.d(i,"boot",function(){return Te}),n.d(i,"fetch",function(){return ye}),n.d(i,"linkDwell",function(){return be}),n.d(i,"abandon",function(){return _e}),n.d(i,"linkClick",function(){return Se}),n.d(i,"previewDwell",function(){return Ie}),n.d(i,"previewShow",function(){return ke}),n.d(i,"pageviewLogged",function(){return xe}),n.d(i,"showSettings",function(){return Pe}),n.d(i,"hideSettings",function(){return Ae}),n.d(i,"saveSettings",function(){return Ne}),n.d(i,"eventLogged",function(){return Le}),n.d(i,"statsvLogged",function(){return Oe});var r=n("./node_modules/redux/dist/redux.min.js"),o=n("./node_modules/redux-thunk/dist/redux-thunk.min.js"),a=n.n(o),u=jQuery,s={off:"off",on:"on",control:"control"},p={THUMBNAIL_SIZE:320*(u.bracketedDevicePixelRatio&&u.bracketedDevicePixelRatio()||1),EXTRACT_LENGTH:525},c={TYPE_GENERIC:"generic",TYPE_PAGE:"page",TYPE_DISAMBIGUATION:"disambiguation"};function l(e,t,n,i,r,o,a,u){var s=function(e){if(void 0===e||null===e||0===e.length)return;return e}(r);return{title:e,url:t,languageCode:n,languageDirection:i,extract:s,type:function(e,t){if(void 0===t)return c.TYPE_GENERIC;switch(e){case c.TYPE_GENERIC:case c.TYPE_DISAMBIGUATION:case c.TYPE_PAGE:return e;default:return c.TYPE_PAGE}}(o,s),thumbnail:a,pageId:u}}function d(e,t){return l(e,t,"","",[],"")}var f=jQuery,g=window.mediaWiki;function v(e,t){var n=e;return void 0===e?[]:0===n.length?[]:n=function(e,t){var n,i,r=[],o="<bi-"+Math.random()+">",a="<snip-"+Math.random()+">";return t=t.replace(/\s+/g," ").trim(),i=g.RegExp.escape(t),n=new RegExp("(^|\\s)("+i+")(|$)","i"),e=(e=(e=e.replace(/\s+/," ")).replace(n,"$1"+a+o+"$2"+a+"$3")).split(a),f.each(e,function(e,t){0===t.indexOf(o)?r.push(f("<b>").text(t.substring(o.length))):r.push(document.createTextNode(t))}),r}(n,t)}var h=300,w=jQuery;function m(e){if(e.query&&e.query.pages&&e.query.pages.length)return e.query.pages[0];throw new Error("API response `query.pages` is empty.")}function E(e){var t=w.extend({},e);return t.extract=v(e.extract,e.title),t}function T(e){return l(e.title,e.canonicalurl,e.pagelanguagehtmlcode,e.pagelanguagedir,e.extract,e.type,e.thumbnail,e.pageid)}var y="https://www.mediawiki.org/wiki/Specs/Summary/1.2.0",b=window.mediaWiki,_=jQuery;function S(e,t,n){function i(n){var i=t.endpoint;return e({url:i+encodeURIComponent(n),headers:{Accept:'application/json; charset=utf-8; profile="'+y+'"'}})}return{fetch:i,convertPageToModel:I,getPageSummary:function(e){var r=_.Deferred();return i(e).then(function(i){i&&i.title||(i=_.extend(!0,i||{},{title:e})),void 0===i.extract&&(i.extract=""),r.resolve(I(i,t.THUMBNAIL_SIZE,n))},function(t,n,i){404===t.status?r.resolve(d(e,new b.Title(e).getUrl())):r.reject("http",{xhr:t,textStatus:n,exception:i})}),r.promise()}}}function I(e,t,n){return l(e.title,new b.Title(e.title).getUrl(),e.lang,e.dir,n(e),e.type,e.thumbnail?function(e,t,n){var i,r,o,a,u=e.source.split("/"),s=u[u.length-1];return-1===(r=s.indexOf("px-"))?t:(i=s.substr(r+3),e.width>e.height?(o=n,a=Math.floor(n/e.width*e.height)):(o=Math.floor(n/e.height*e.width),a=n),o>=t.width&&-1===i.indexOf(".svg")?t:(u[u.length-1]=o+"px-"+i,{source:u.join("/"),width:o,height:a}))}(e.thumbnail,e.originalimage,t):void 0,e.pageid)}function k(e){var t=e.extract_html;return 0===t.length?[]:$.parseHTML(t)}function x(e){return v(e.extract,e.title)}var P=mediaWiki,A=jQuery;function N(e){var t=A.extend({},p,{endpoint:e.get("wgPopupsRestGatewayEndpoint")});switch(e.get("wgPopupsGateway")){case"mwApiPlain":return function(e,t){function n(n){return e.get({action:"query",prop:"info|extracts|pageimages|revisions|info",formatversion:2,redirects:!0,exintro:!0,exchars:t.EXTRACT_LENGTH,explaintext:!0,piprop:"thumbnail",pithumbsize:t.THUMBNAIL_SIZE,pilicense:"any",rvprop:"timestamp",inprop:"url",titles:n,smaxage:h,maxage:h,uselang:"content"},{headers:{"X-Analytics":"preview=1"}})}return{fetch:n,extractPageFromResponse:m,convertPageToModel:T,getPageSummary:function(e){return n(e).then(m).then(E).then(T)},formatPlainTextExtract:E}}(new P.Api,p);case"restbasePlain":return S(A.ajax,t,x);case"restbaseHTML":return S(A.ajax,t,k);default:throw new Error("Unknown gateway")}}var L="mwe-popups-enabled",O="ext.popups.core.previewCount";var C=window.mediaWiki,D=jQuery;var G=window.mediaWiki;var R=jQuery;function H(){var e,t;return function(n){var i,r,o;return e||(i=W(),r=G.config.get("wgExtensionAssetsPath")+"/Popups/resources/ext.popups.main/images/",o=[{id:"simple",name:G.msg("popups-settings-option-simple"),description:G.msg("popups-settings-option-simple-description"),image:r+"hovercard.svg",isChecked:!0},{id:"advanced",name:G.msg("popups-settings-option-advanced"),description:G.msg("popups-settings-option-advanced-description"),image:r+"navpop.svg"},{id:"off",name:G.msg("popups-settings-option-off")}],i||o.splice(1,1),e=G.template.get("ext.popups.main","settings.mustache").render({heading:G.msg("popups-settings-title"),closeLabel:G.msg("popups-settings-cancel"),saveLabel:G.msg("popups-settings-save"),helpText:G.msg("popups-settings-help"),okLabel:G.msg("popups-settings-help-ok"),descriptionText:G.msg("popups-settings-description"),choices:o}),t=R("<div>").addClass("mwe-popups-overlay"),e.find(".save").click(function(){var t="simple"===e.find("input[name=mwe-popups-setting]:checked, #mwe-popups-settings").val();n.saveSettings(t)}),e.find(".close, .okay").click(n.hideSettings)),{appendTo:function(n){t.appendTo(n),e.appendTo(t)},show:function(){t.show()},hide:function(){t.hide()},toggleHelp:function(e){!function(e,t){var n=R("#mwe-popups-settings");t?(n.find("main, .save, .close").hide(),n.find(".mwe-popups-settings-help, .okay").show()):(n.find("main, .save, .close").show(),n.find(".mwe-popups-settings-help, .okay").hide())}(0,e)},setEnabled:function(t){var n="off";t?n="simple":W()&&(n="advanced"),e.find("#mwe-popups-settings-"+n).prop("checked",!0)}}}}function W(){return"undefined"!=typeof pg&&void 0!==pg.fn.disablePopups}function M(e,t){var n;e.subscribe(function(){var i=n;i!==(n=e.getState())&&t(i,n)})}var j=window.mediaWiki;function B(e,t){return n=function(e,t){var n,i,r,o=new RegExp(j.RegExp.escape(t.get("wgArticlePath")).replace("\\$1","(.+)"));try{n=new j.Uri(e)}catch(e){return}if(n.host===location.hostname)return(r=Object.keys(n.query).length)?1===r&&n.query.hasOwnProperty("title")?n.query.title:void 0:(i=o.exec(n.path))?decodeURIComponent(i[1]):void 0}(e.href,t),i=t.get("wgContentNamespaces"),n&&(r=j.Title.newFromText(n))&&$.inArray(r.namespace,i)>=0?r:null;var n,i,r}var F=jQuery;function U(e){var t=F.Deferred();return setTimeout(function(){t.resolve()},e),t.promise()}var V=n("./src/ui/pokey-mask.svg"),Y=n.n(V),K={portraitImage:{h:250,w:203},landscapeImage:{h:200,w:320}},X=jQuery;function Q(e){var t,n,i,r,o,a,u,s,p=X.bracketedDevicePixelRatio();return e?(t=e.width<e.height,n=e.width/p,i=e.height/p,!t&&n<K.landscapeImage.w||t&&i<K.portraitImage.h||e.source.indexOf("\\")>-1||e.source.indexOf("'")>-1||e.source.indexOf('"')>-1?null:(t?(r=n>K.portraitImage.w?(n-K.portraitImage.w)/-2:K.portraitImage.w-n,o=i>K.portraitImage.h?(i-K.portraitImage.h)/-2:0,a=K.portraitImage.w,u=K.portraitImage.h):(r=0,o=i>K.landscapeImage.h?(i-K.landscapeImage.h)/-2:0,a=K.landscapeImage.w+3,u=i>K.landscapeImage.h?K.landscapeImage.h:i,s="mwe-popups-mask"),{el:function(e,t,n,i,r,o,a,u,s){var p,c="http://www.w3.org/2000/svg";return(p=X(document.createElementNS(c,"image")))[0].setAttributeNS("http://www.w3.org/1999/xlink","href",t),p.addClass(e).attr({x:n,y:i,width:r,height:o,"clip-path":"url(#"+s+")"}),X(document.createElementNS(c,"svg")).attr({xmlns:c,width:a,height:u}).append(p)}(t?"mwe-popups-is-tall":"mwe-popups-is-not-tall",e.source,r,o,n,i,a,u,s),isTall:t,width:n,height:i})):null}var q=window.mediaWiki,z=jQuery,Z=z(window),J=450,ee=320,te=8;function ne(){var e;e=document.body,z("<div>").attr("id","mwe-popups-svg").html(Y.a).appendTo(e)}function ie(e){var t=function(e){switch(e.type){case c.TYPE_PAGE:return function(e){var t,n,i=Q(e.thumbnail),r=null!==i,o=e.extract;t=z.extend({},e,{hasThumbnail:r}),n=q.template.get("ext.popups.main","preview.mustache").render(t),r&&n.find(".mwe-popups-discreet").append(i.el);o&&n.find(".mwe-popups-extract").append(o);return{el:n,hasThumbnail:r,thumbnail:i,isTall:r&&i.isTall}}(e);case c.TYPE_DISAMBIGUATION:return function(e){var t;return t=z.extend({},e,{showTitle:!0,extractMsg:q.msg("popups-preview-disambiguation"),linkMsg:q.msg("popups-preview-disambiguation-link")}),{el:q.template.get("ext.popups.main","preview-generic.mustache").render(t),hasThumbnail:!1,isTall:!1}}(e);default:return function(e){var t;return t=z.extend({},e,{extractMsg:q.msg("popups-preview-no-preview"),linkMsg:q.msg("popups-preview-footer-read")}),{el:q.template.get("ext.popups.main","preview-generic.mustache").render(t),hasThumbnail:!1,isTall:!1}}(e)}}(e);return{show:function(e,n,i){return function(e,t,n,i,r,o){var a=function(e,t,n,i,r){var o=!1,a=!1,u=t.pageY?re(t.pageY-i.scrollTop,n.clientRects,!1)+i.scrollTop+r:n.offset.top+n.height+r,s=t.clientY?t.clientY:u,p=t.pageX?t.pageX:n.offset.left;p>i.width/2&&(p+=t.pageX?0:n.width,p-=e?J:ee,o=!0);t.pageX&&(p+=o?20:-20);s>i.height/2&&(a=!0,u=n.offset.top,t.pageY&&(u=re(t.pageY-i.scrollTop,n.clientRects,!0)+i.scrollTop),u-=r);return{offset:{top:u,left:p},flippedX:o,flippedY:a}}(e.isTall,{pageX:t.pageX,pageY:t.pageY,clientY:t.clientY},{clientRects:n.get(0).getClientRects(),offset:n.offset(),width:n.width(),height:n.height()},{scrollTop:Z.scrollTop(),width:Z.width(),height:Z.height()},te);return e.el.appendTo(o),function(e,t,n,i,r){var o=e.el,a=e.isTall,u=e.hasThumbnail,s=e.thumbnail,p=t.flippedY,c=t.flippedX,l=t.offset.top;!p&&!a&&u&&s.height<i&&o.find(".mwe-popups-extract").css("margin-top",s.height-r),o.addClass(n.join(" ")),p&&(l-=o.outerHeight()),o.css({top:l,left:t.offset.left+"px"}),p&&u&&o.find("image")[0].removeAttribute("clip-path"),p&&c&&u&&a&&o.find("image")[0].setAttribute("clip-path","url(#mwe-popups-landscape-mask-flip)"),c&&!p&&u&&!a&&o.find("image")[0].setAttribute("clip-path","url(#mwe-popups-mask-flip)"),c&&!p&&u&&a&&o.removeClass("mwe-popups-no-image-tri").find("image")[0].setAttribute("clip-path","url(#mwe-popups-landscape-mask)")}(e,a,function(e,t){var n=[];return t.flippedY?n.push("mwe-popups-fade-in-down"):n.push("mwe-popups-fade-in-up"),t.flippedY&&t.flippedX&&n.push("flipped_x_y"),t.flippedY&&!t.flippedX&&n.push("flipped_y"),t.flippedX&&!t.flippedY&&n.push("flipped_x"),e.hasThumbnail&&!e.isTall||t.flippedY||n.push("mwe-popups-no-image-tri"),!e.hasThumbnail||e.isTall||t.flippedY||n.push("mwe-popups-image-tri"),e.isTall?n.push("mwe-popups-is-tall"):n.push("mwe-popups-is-not-tall"),n}(e,a),K.landscapeImage.h,te),e.el.show(),U(200).then(function(){!function(e,t){e.el.on("mouseenter",t.previewDwell).on("mouseleave",t.previewAbandon),e.el.click(t.click),e.el.find(".mwe-popups-settings-icon").attr("href",t.settingsUrl).click(function(e){e.stopPropagation(),t.showSettings(e)})}(e,i)}).then(function(){i.previewShow(r)})}(t,e,z(e.target),n,i,document.body)},hide:function(){return function(e){var t,n;return t=e.el.hasClass("mwe-popups-fade-in-up")?"mwe-popups-fade-in-up":"mwe-popups-fade-in-down",n="mwe-popups-fade-in-up"===t?"mwe-popups-fade-out-down":"mwe-popups-fade-out-up",e.el.removeClass(t).addClass(n),U(150).then(function(){e.el.remove()})}(t)}}}function re(e,t,n){var i,r,o=null;return z.each(t,function(t,a){r=Math.abs(e-a.top+e-a.bottom),(null===o||o>r)&&(o=r,i=n?Math.floor(a.top):Math.ceil(a.bottom))}),i}var oe=window.mediaWiki,ae=jQuery;var ue=jQuery;var se=jQuery;function pe(e,t,n){return e[t]&&e[t][n]}function ce(e,t,n,i,r){var o=pe(t,n,i);e&&pe(e,n,i)!==o&&r(o)}var le={footerLink:function(e){var t;return function(n,i){var r,o;void 0===t&&((o=ae("<li>").append(ae("<a>").attr("href","#").text(oe.message("popups-settings-enable").text()))).hide(),0===(r=ae("#footer-places, #f-list")).length&&(r=ae("#footer li").parent()),r.append(o),(t=o).click(function(t){t.preventDefault(),e.showSettings()})),i.settings.shouldShowFooterLink?t.show():t.hide()}},eventLogging:function(e,t,n){return function(i,r){var o=r.eventLogging,a=o.event;a&&(a=ue.extend(!0,{},o.baseData,a,{timestamp:n()}),t("event.Popups",a),e.eventLogged(a))}},linkTitle:function(){var e;return function(t,n){var i,r=t&&t.preview.activeLink;n.preview.enabled&&(r&&t.preview.activeLink!==n.preview.activeLink&&(i=t.preview.activeLink,se(i).attr("title",e),e=void 0),n.preview.activeLink&&function(t){var n=se(t);e||(e=n.attr("title"),n.attr("title",""))}(n.preview.activeLink))}},pageviews:function(e,t){return function(n,i){var r;i.pageviews&&i.pageviews.pageview&&i.pageviews.page&&(r=i.pageviews.page,t("event.VirtualPageView",$.extend({},{source_page_id:r.id,source_namespace:r.namespaceId,source_title:r.title,source_url:r.url},i.pageviews.pageview)),e.pageviewLogged())}},render:function(e){var t;return function(n,i){i.preview.shouldShow&&!t?(t=ie(i.preview.fetchResponse)).show(i.preview.activeEvent,e,i.preview.activeToken):!i.preview.shouldShow&&t&&(t.hide(),t=void 0)}},settings:function(e,t){var n;return function(i,r){i&&(!1===i.settings.shouldShow&&!0===r.settings.shouldShow?(n||(n=t(e)).appendTo(document.body),n.setEnabled(r.preview.enabled),n.show()):!0===i.settings.shouldShow&&!1===r.settings.shouldShow&&n.hide(),i.settings.showHelp!==r.settings.showHelp&&n.toggleHelp(r.settings.showHelp))}},statsv:function(e,t){return function(n,i){var r=i.statsv;r.action&&(t(r.action,r.data),e.statsvLogged())}},syncUserSettings:function(e){return function(t,n){ce(t,n,"eventLogging","previewCount",e.setPreviewCount),ce(t,n,"preview","enabled",e.setIsEnabled)}}},de={BOOT:"BOOT",LINK_DWELL:"LINK_DWELL",ABANDON_START:"ABANDON_START",ABANDON_END:"ABANDON_END",LINK_CLICK:"LINK_CLICK",FETCH_START:"FETCH_START",FETCH_END:"FETCH_END",FETCH_COMPLETE:"FETCH_COMPLETE",FETCH_FAILED:"FETCH_FAILED",PAGEVIEW_LOGGED:"PAGEVIEW_LOGGED",PREVIEW_DWELL:"PREVIEW_DWELL",PREVIEW_SHOW:"PREVIEW_SHOW",PREVIEW_CLICK:"PREVIEW_CLICK",PREVIEW_SEEN:"PREVIEW_SEEN",SETTINGS_SHOW:"SETTINGS_SHOW",SETTINGS_HIDE:"SETTINGS_HIDE",SETTINGS_CHANGE:"SETTINGS_CHANGE",EVENT_LOGGED:"EVENT_LOGGED",STATSV_LOGGED:"STATSV_LOGGED"},fe=jQuery,ge=window.mediaWiki,ve=150,he=1e3,we=500,me=300;function Ee(e){return e.timestamp=ge.now(),e}function Te(e,t,n,i,r,o){var a=r.get("wgUserEditCount"),u=n.getPreviewCount();return{type:de.BOOT,isEnabled:e,isNavPopupsEnabled:r.get("wgPopupsConflictsWithNavPopupGadget"),sessionToken:t.sessionId(),pageToken:i(),page:{url:o,title:r.get("wgTitle"),namespaceId:r.get("wgNamespaceNumber"),id:r.get("wgArticleId")},user:{isAnon:t.isAnon(),editCount:a,previewCount:u}}}function ye(e,t,n,i){var r=t.getPrefixedDb(),o=t.namespace;return function(a){var u;return a(Ee({type:de.FETCH_START,el:n,title:r,namespaceId:o})),u=e.getPageSummary(r).then(function(e){return a(Ee({type:de.FETCH_END,el:n})),e}).catch(function(e){throw a({type:de.FETCH_FAILED,el:n}),e}),fe.when(u,U(we-ve)).then(function(e){a({type:de.FETCH_COMPLETE,el:n,result:e,token:i})}).catch(function(e,o){o&&o.xhr&&0===o.xhr.readyState&&"error"===o.textStatus&&""===o.exception||a({type:de.FETCH_COMPLETE,el:n,result:d(r,t.getUrl()),token:i})})}}function be(e,t,n,i,r){var o=r(),a=e.getPrefixedDb(),u=e.namespace;return function(r,s){var p=Ee({type:de.LINK_DWELL,el:t,event:n,token:o,title:a,namespaceId:u});function c(){return s().preview.activeToken===o}return r(p),c()?U(ve).then(function(){if(s().preview.enabled&&c())return r(ye(i,e,t,o))}):fe.Deferred().resolve().promise()}}function _e(){return function(e,t){var n=t().preview.activeToken;return n?(e(Ee({type:de.ABANDON_START,token:n})),U(me).then(function(){e({type:de.ABANDON_END,token:n})})):fe.Deferred().resolve().promise()}}function Se(e){return Ee({type:de.LINK_CLICK,el:e})}function Ie(){return{type:de.PREVIEW_DWELL}}function ke(e){return function(t,n){return t(Ee({type:de.PREVIEW_SHOW,token:e})),U(he).then(function(){var i=n().preview,r=i&&i.fetchResponse,o=i&&i.activeToken,a=r&&[c.TYPE_PAGE,c.TYPE_DISAMBIGUATION].indexOf(r.type)>-1;o&&o===e&&r&&a&&t({type:de.PREVIEW_SEEN,title:r.title,pageId:r.pageId,namespace:0})})}}function xe(){return{type:de.PAGEVIEW_LOGGED}}function Pe(){return{type:de.SETTINGS_SHOW}}function Ae(){return{type:de.SETTINGS_HIDE}}function Ne(e){return function(t,n){t({type:de.SETTINGS_CHANGE,wasEnabled:n().preview.enabled,enabled:e})}}function Le(e){return{type:de.EVENT_LOGGED,event:e}}function Oe(){return{type:de.STATSV_LOGGED}}function Ce(e,t){var n,i={};for(n in e)e.hasOwnProperty(n)&&!t.hasOwnProperty(n)&&(i[n]=e[n]);for(n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);return i}var De=n("./src/counts.js");function Ge(e,t){return t.linkInteractionToken=e.token,t.pageTitleHover=e.title,t.namespaceIdHover=e.namespaceId,void 0!==e.timeToPreviewShow&&(t.previewType=e.previewType,t.perceivedWait=e.timeToPreviewShow),t}function Re(e){var t={totalInteractionTime:Math.round(e.finished-e.started)};if(!e.finalized)return t.action=e.timeToPreviewShow?"dismissed":"dwelledButAbandoned",Ge(e,t)}var He={eventLogging:function(e,t){var n,i,r,o,a=[de.FETCH_COMPLETE,de.ABANDON_END,de.PREVIEW_SHOW];if(void 0===e&&(e={previewCount:void 0,baseData:{},interaction:void 0,event:void 0}),-1!==a.indexOf(t.type)&&(!e.interaction||t.token!==e.interaction.token))return e;if(!e.interaction&&t.type!==de.BOOT&&t.type!==de.LINK_DWELL&&t.type!==de.EVENT_LOGGED&&t.type!==de.SETTINGS_CHANGE)return e;switch(t.type){case de.BOOT:return Ce(e,{previewCount:t.user.previewCount,baseData:(r=t,o={pageTitleSource:r.page.title,namespaceIdSource:r.page.namespaceId,pageIdSource:r.page.id,isAnon:r.user.isAnon,popupEnabled:r.isEnabled,pageToken:r.pageToken,sessionToken:r.sessionToken,previewCountBucket:De.getPreviewCountBucket(r.user.previewCount),hovercardsSuppressedByGadget:r.isNavPopupsEnabled},r.user.isAnon||(o.editCountBucket=De.getEditCountBucket(r.user.editCount)),o),event:{action:"pageLoaded"}});case de.EVENT_LOGGED:return i=Ce(e,{event:void 0}),t.event.linkInteractionToken&&e.interaction&&t.event.linkInteractionToken===e.interaction.token&&(i.interaction=void 0),i;case de.FETCH_COMPLETE:return Ce(e,{interaction:Ce(e.interaction,{previewType:t.result.type})});case de.PREVIEW_SHOW:return Ce(e,{previewCount:n=e.previewCount+1,baseData:Ce(e.baseData,{previewCountBucket:De.getPreviewCountBucket(n)}),interaction:Ce(e.interaction,{timeToPreviewShow:Math.round(t.timestamp-e.interaction.started)})});case de.LINK_DWELL:return e.interaction&&t.el===e.interaction.link?Ce(e,{interaction:Ce(e.interaction,{isUserDwelling:!0})}):Ce(e,{interaction:{link:t.el,title:t.title,namespaceId:t.namespaceId,token:t.token,started:t.timestamp,isUserDwelling:!0},event:e.interaction?Re(e.interaction):void 0});case de.PREVIEW_DWELL:return Ce(e,{interaction:Ce(e.interaction,{isUserDwelling:!0})});case de.LINK_CLICK:return Ce(e,{interaction:Ce(e.interaction,{finalized:!0}),event:Ge(e.interaction,{action:"opened",totalInteractionTime:Math.round(t.timestamp-e.interaction.started)})});case de.ABANDON_START:return Ce(e,{interaction:Ce(e.interaction,{finished:t.timestamp,isUserDwelling:!1})});case de.ABANDON_END:return e.interaction.isUserDwelling?e:Ce(e,{interaction:void 0,event:Re(e.interaction)});case de.SETTINGS_SHOW:return Ce(e,{event:Ge(e.interaction,{action:"tapped settings cog"})});case de.SETTINGS_CHANGE:return t.wasEnabled&&!t.enabled?Ce(e,{event:{action:"disabled",popupEnabled:!1}}):e;default:return e}},pageviews:function(e,t){switch(void 0===e&&(e={pageview:void 0}),t.type){case de.BOOT:return Ce(e,{page:t.page});case de.PAGEVIEW_LOGGED:return Ce(e,{pageview:void 0});case de.PREVIEW_SEEN:return Ce(e,{pageview:{page_title:t.title,page_id:t.pageId,page_namespace:t.namespace}});default:return e}},preview:function(e,t){switch(void 0===e&&(e={enabled:void 0,activeLink:void 0,activeEvent:void 0,activeToken:"",shouldShow:!1,isUserDwelling:!1}),t.type){case de.BOOT:return Ce(e,{enabled:t.isEnabled});case de.SETTINGS_CHANGE:return Ce(e,{enabled:t.enabled});case de.LINK_DWELL:return t.el!==e.activeLink?Ce(e,{activeLink:t.el,activeEvent:t.event,activeToken:t.token,shouldShow:!1,isUserDwelling:!0}):Ce(e,{isUserDwelling:!0});case de.ABANDON_END:return t.token!==e.activeToken||e.isUserDwelling?e:Ce(e,{activeLink:void 0,activeToken:void 0,activeEvent:void 0,fetchResponse:void 0,shouldShow:!1});case de.PREVIEW_DWELL:return Ce(e,{isUserDwelling:!0});case de.ABANDON_START:return Ce(e,{isUserDwelling:!1});case de.FETCH_START:return Ce(e,{fetchResponse:void 0});case de.FETCH_COMPLETE:if(t.token===e.activeToken)return Ce(e,{fetchResponse:t.result,shouldShow:e.isUserDwelling});default:return e}},settings:function(e,t){switch(void 0===e&&(e={shouldShow:!1,showHelp:!1,shouldShowFooterLink:!1}),t.type){case de.SETTINGS_SHOW:return Ce(e,{shouldShow:!0,showHelp:!1});case de.SETTINGS_HIDE:return Ce(e,{shouldShow:!1,showHelp:!1});case de.SETTINGS_CHANGE:return t.wasEnabled===t.enabled?Ce(e,{shouldShow:!1}):Ce(e,{shouldShow:!t.enabled,showHelp:!t.enabled,shouldShowFooterLink:!t.enabled});case de.BOOT:return Ce(e,{shouldShowFooterLink:t.user.isAnon&&!t.isEnabled});default:return e}},statsv:function(e,t){switch(e=e||{},t.type){case de.FETCH_START:return Ce(e,{fetchStartedAt:t.timestamp});case de.FETCH_END:return Ce(e,{action:"timing.PagePreviewsApiResponse",data:t.timestamp-e.fetchStartedAt});case de.FETCH_FAILED:return Ce(e,{action:"counter.PagePreviewsApiFailure",data:1});case de.LINK_DWELL:return Ce(e,{linkDwellStartedAt:t.timestamp});case de.PREVIEW_SHOW:return Ce(e,{action:"timing.PagePreviewsPreviewShow",data:t.timestamp-e.linkDwellStartedAt});case de.STATSV_LOGGED:return Ce(e,{action:null,data:null});default:return e}}};var We=function(e,t,n){var i=t/2;return t?e.getBucket({name:"ext.Popups.visibility",enabled:!0,buckets:{off:1-t,control:i,on:i}},n):"on"},Me=mediaWiki,je=jQuery,Be=[".extiw",".image",".new",".internal",".external",".oo-ui-buttonedElement-button",".cancelLink a"];function Fe(e,t,n,i){return function(e,t,n,i){return!0===t.get("debug")||!!t.get("wgPopupsEventLogging")&&!(!i.navigator||!$.isFunction(i.navigator.sendBeacon))&&e.isAnon()&&n!==s.off}(e,t,n,i)?Me.track:je.noop}function Ue(){return window.performance&&window.performance.now?Math.round(window.performance.now()):null}Me.requestIdleCallback(function(){var e,t,n,o,u,p,c,l,d,f,g,v,h,w=r.compose,m=Me.user.generateRandomSessionId,E=N(Me.config);e=We(Me.experiments,Me.config.get("wgPopupsAnonsExperimentalGroupSize"),Me.user.sessionId()),v=Me.storage,u={getIsEnabled:function(){return"0"!==v.get(L)},setIsEnabled:function(e){v.set(L,e?"1":"0")},hasIsEnabled:function(){var e=v.get(L);return!1!==Boolean(e)},getPreviewCount:function(){var e,t=v.get(O);return!1===t?-1:null===t?0:(e=parseInt(t,10),isNaN(e)&&(e=0,this.setPreviewCount(e)),e)},setPreviewCount:function(e){v.set(O,e.toString())}},p=H(),h=Me.experiments,c={weightedBoolean:function(e,t,n){return"true"===h.getBucket({enabled:!0,name:e,buckets:{true:t,false:1-t}},n)}},l=function(e,t,n){return function(e,t,n){var i=t.get("wgPopupsStatsvSamplingRate",0);return n.weightedBoolean("ext.Popups.statsv",i,e.sessionId())}(e,t,n)?Me.track:je.noop}(Me.user,Me.config,c),o=Me.config.get("wgPopupsVirtualPageViews")?Me.track:je.noop,d=Fe(Me.user,Me.config,e,window),f=function(e,t,n,i){return!n.get("wgPopupsConflictsWithNavPopupGadget")&&(e.isAnon()?!n.get("wgPopupsBetaFeature")&&(t.hasIsEnabled()?t.getIsEnabled():i===s.on):n.get("wgPopupsShouldSendModuleToUser"))}(Me.user,u,Me.config,e),!0===Me.config.get("debug")&&(w=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__||w),t=r.createStore(r.combineReducers(He),w(r.applyMiddleware(a.a))),n=r.bindActionCreators(i,t.dispatch),g=function(e,t,n){var i,r,o=e.get("wgPopupsBetaFeature"),a=D.noop;return t.isAnon()?a=function(e){e.preventDefault(),n.showSettings()}:(i="Special:Preferences#mw-prefsection-",i+=o?"betafeatures":"rendering",r=C.Title.newFromText(i).getUrl()),{settingsUrl:r,showSettings:a,previewDwell:n.previewDwell,previewAbandon:n.abandon,previewShow:n.previewShow,click:n.linkClick}}(Me.config,Me.user,n),function(e,t,n,i,r,o,a,u,s){M(e,le.footerLink(t)),M(e,le.linkTitle()),M(e,le.render(r)),M(e,le.statsv(t,o)),M(e,le.syncUserSettings(n)),M(e,le.settings(t,i)),M(e,le.eventLogging(t,a,s)),M(e,le.pageviews(t,u))}(t,n,u,p,g,l,d,o,Ue),n.boot(f,Me.user,u,m,Me.config,window.location.href),Me.popups=function(e){return{isEnabled:function(){return e.getState().preview.enabled}}}(t),Me.hook("wikipage.content").add(function(e){var t="a[href][title]:not("+Be.join(", ")+")";ne(),e.on("mouseover keyup",t,function(e){var t=B(this,Me.config);t&&n.linkDwell(t,this,e,E,m)}).on("mouseout blur",t,function(){B(this,Me.config)&&n.abandon(this)}).on("click",t,function(){B(this,Me.config)&&n.linkClick(this)})})}),window.Redux=r,window.ReduxThunk=o},"./src/ui/pokey-mask.svg":function(e,t){e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0"><defs><clippath id="mwe-popups-mask"><polygon points="0 8, 10 8, 18 0, 26 8, 1000 8, 1000 1000, 0 1000"></polygon></clippath><clippath id="mwe-popups-mask-flip"><polygon points="0 8, 274 8, 282 0, 290 8, 1000 8, 1000 1000, 0 1000"></polygon></clippath><clippath id="mwe-popups-landscape-mask"><polygon points="0 8, 174 8, 182 0, 190 8, 1000 8, 1000 1000, 0 1000"></polygon></clippath><clippath id="mwe-popups-landscape-mask-flip"><polygon points="0 0, 1000 0, 1000 242, 190 242, 182 250, 174 242, 0 242"></polygon></clippath></defs></svg>'}});
|
|
//# sourceMappingURL=index.js.json
|