mediawiki-extensions-Popups/resources/dist/index.js.json

1 line
174 KiB
JSON
Raw Normal View History

Hygiene: consolidate CSS class manipulation • Instead of removing 'mwe-popups-no-image-tri' in renderer#layoutPreview(), add more conditions to #getClasses(). The addition condition in getClasses() was: ( !hasThumbnail || isTall ) && !flippedY The removal condition in layoutPreview() was: flippedX && !flippedY && hasThumbnail && isTall To combine them, the removal logic is inverted and the conjunction is taken: ( ( !hasThumbnail || isTall ) && !flippedY ) && !( flippedX && !flippedY && hasThumbnail && isTall ) Push the negation inwards: ( !hasThumbnail && !flippedY || isTall && !flippedY ) && ( !flippedX || flippedY || !hasThumbnail || !isTall ) Expand: !hasThumbnail && !flippedY && !flippedX || !hasThumbnail && !flippedY && flippedY || !hasThumbnail && !flippedY && !hasThumbnail || !hasThumbnail && !flippedY && !isTall || isTall && !flippedY && !flippedX || isTall && !flippedY && flippedY || isTall && !flippedY && !hasThumbnail || isTall && !flippedY && !isTall Eliminate always false conditions and combine redundancies: !hasThumbnail && !flippedY && !flippedX || !hasThumbnail && !flippedY || !hasThumbnail && !flippedY && !isTall || isTall && !flippedY && !flippedX || isTall && !flippedY && !hasThumbnail Further eliminate redundancies: !hasThumbnail && !flippedY || isTall && !flippedY && !flippedX || isTall && !flippedY && !hasThumbnail Factor: !flippedY && ( !hasThumbnail || isTall && !flippedX || isTall && !hasThumbnail ) Factor more: !flippedY && ( !hasThumbnail || isTall && ( !flippedX || !hasThumbnail ) ) Eliminate last redundancies: !flippedY && ( !hasThumbnail || isTall && !flippedX ) The getClasses() test is updated for the new logic. • Move thumbnail clip path manipulation from renderer#layoutPreview() to a new function, #setThumbnailClipPath(). The new function flips the order of the series of if statements so that an if / else block can be used instead which clarifies that clip-path state is exclusive. In other words: if ( a ) { foo.prop = 1; } if ( b ) { foo.prop = 2; } if ( c ) { foo.prop = 3; } if ( d ) { foo.prop = 4; } Can generically be refactored regardless of condition or value to: if ( d ) { foo.prop = 4; } else if ( c ) { foo.prop = 3; } else if ( b ) { foo.prop = 2; } else if ( a ) { foo.prop = 1; } Because prop was originally overwritten which implies if / else-like priority. Additionally: • The entire function call is wrapped in a hasThumbnail conditional which previously was checked as an input in each case. • Consolidate the last two conditions since they only differed by a single boolean input. • Move the setAttribute() action to the end of the function since the conditionals just map condition to value and the action is now identical. • Revise pokey mask doc to use clip-path terminology. This inverts the thinking about the mask but better matches usage. Bug: T190831 Change-Id: Ib460c6c07fcb054f8d425d127c588bb28a1d2473
2018-04-13 17:29:57 +00:00
{"version":3,"sources":["/w/extensions/Popups/webpack/bootstrap","/w/extensions/Popups/./node_modules/redux-thunk/dist/redux-thunk.min.js","/w/extensions/Popups/./node_modules/redux/dist/redux.min.js","/w/extensions/Popups/./src/counts.js","/w/extensions/Popups/./src/constants.js","/w/extensions/Popups/./src/preview/model.js","/w/extensions/Popups/./src/formatter.js","/w/extensions/Popups/./src/gateway/mediawiki.js","/w/extensions/Popups/./src/gateway/rest.js","/w/extensions/Popups/./src/gateway/restFormatters.js","/w/extensions/Popups/./src/gateway/index.js","/w/extensions/Popups/./src/userSettings.js","/w/extensions/Popups/./src/previewBehavior.js","/w/extensions/Popups/./src/ui/templates/templateUtil.js","/w/extensions/Popups/./src/ui/templates/settingsDialog/settingsDialog.js","/w/extensions/Popups/./src/ui/settingsDialog.js","/w/extensions/Popups/./src/ui/settingsDialogRenderer.js","/w/extensions/Popups/./src/changeListener.js","/w/extensions/Popups/./src/title.js","/w/extensions/Popups/./src/wait.js","/w/extensions/Popups/./src/ui/thumbnail.js","/w/extensions/Popups/./src/ui/templates/preview/preview.js","/w/extensions/Popups/./src/ui/renderer.js","/w/extensions/Popups/./src/ui/templates/pagePreview/pagePreview.js","/w/extensions/Popups/./src/changeListeners/footerLink.js","/w/extensions/Popups/./src/changeListeners/eventLogging.js","/w/extensions/Popups/./src/changeListeners/linkTitle.js","/w/extensions/Popups/./src/changeListeners/syncUserSettings.js","/w/extensions/Popups/./src/changeListeners/index.js","/w/extensions/Popups/./src/changeListeners/pageviews.js","/w/extensions/Popups/./src/changeListeners/render.js","/w/extensions/Popups/./src/changeListeners/settings.js","/w/extensions/Popups/./src/changeListeners/statsv.js","/w/extensions/Popups/./src/actionTypes.js","/w/extensions/Popups/./src/actions.js","/w/extensions/Popups/./src/reducers/nextState.js","/w/extensions/Popups/./src/reducers/eventLogging.js","/w/extensions/Popups/./src/reducers/index.js","/w/extensions/Popups/./src/reducers/pageviews.js","/w/extensions/Popups/./src/reducers/preview.js","/w/extensions/Popups/./src/reducers/settings.js","/w/extensions/Popups/./src/reducers/statsv.js","/w/extensions/Popups/./src/getUserBucket.js","/w/extensions/Popups/./src/getPageviewTracker.js","/w/extensions/Popups/./src/index.js","/w/extensions/Popups/./src/instrumentation/eventLogging.js","/w/extensions/Popups/./src/experiments.js","/w/extensions/Popups/./src/instrumentation/statsv.js","/w/extensions/Popups/./src/isEnabled.js","/w/extensions/Popups/./src/integrations/mwpopups.js","/w/extensions/Popups/./src/ui/pokey-mask.svg"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","object","property","prototype","hasOwnProperty","p","s","t","e","id","loaded","dispatch","getState","withExtraArgument","default","compose","applyMiddleware","bindActionCreators","combineReducers","createStore","u","a","f","y","arguments","length","Array","slice","reduceRight","apply","ActionTypes","b","h","v","Error","push","indexOf","splice","type","INIT","subscribe","replaceReducer","next","TypeError","unsubscribe","this","console","error","Function","toString","constructor","assign","map","keys","forEach","Math","random","substring","split","join","getPrototypeOf","window","Symbol","observable","getEditCountBucket","count","bucket","getPreviewCountBucket","undefined","constants_$","jQuery","BUCKETS","off","on","control","constants","THUMBNAIL_SIZE","bracketedDevicePixelRatio","EXTRACT_LENGTH","previewTypes","TYPE_GENERIC","TYPE_PAGE","TYPE_DISAMBIGUATION","createModel","title","url","languageCode","languageDirection","extract","thumbnail","pageId","processedExtract","processExtract","getPreviewType","createNullModel","formatter_$","formatter_mw","mediaWiki","formatter_formatPlainTextExtract","plainTextExtract","elements","boldIdentifier","snip","replace","trim","escapedTitle","RegExp","escape","regExp","part"