Current File : /home/aventura/www/site/wp-content/plugins/wp-smushit/assets/js/resize-detection.min.js.map |
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./_src/js/public-resize-detection.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","jQuery","$","window","load","toggle","detect_wrong_imgs","revert_detection","each","ele","this","css","css_width","replace","css_height","img_width","prop","img_height","higher_width","higher_height","smaller_width","smaller_height","tooltip_text","wp_smush_resize_vars","large_image","small_image","content","before","addClass","remove","removeClass"],"mappings":"aACA,IAAAA,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,IACAG,EAAAH,EACAI,GAAA,EACAH,YAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,GAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,aAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyC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Y,MAAQE,EAAa,qIAEfL,EAAY,MAAQE,EAAa,kBAIjFL,EAAIkB,OAAQD,GAGZjB,EAAImB,SAAU,yBAUZrB,EAAmB,WAEtBL,EAAG,qBAAsB2B,SAGzB3B,EAAG,uBAAwB4B,YAAa","file":"resize-detection.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 15);\n","jQuery( function ( $ ) {\n\t'use strict';\n\n\t/**\n\t * After page load, initialize toggle event.\n\t *\n\t * On detection link click, show all wrongly scaled images with\n\t * a highlighted border and resize box.\n\t * Upon clicking again, remove highlights.\n\t */\n\t$( window ).load( function () {\n\t\t// Handle detect link click.\n\t\t$( '#wp-admin-bar-smush-resize-detection' ).toggle( function () {\n\t\t\tdetect_wrong_imgs();\n\t\t}, function () {\n\t\t\trevert_detection();\n\t\t} );\n\t} );\n\n\t/**\n\t * Function to highlight all scaled images.\n\t *\n\t * Add yellow border and then show one small box to\n\t * resize the images as per the required size, on fly.\n\t */\n\tvar detect_wrong_imgs = function () {\n\n\t\t// Loop through all images which has data-smush-image attribute.\n\t\t$( 'body img[data-smush-image]' ).each( function () {\n\n\t\t\tvar ele = $( this );\n\n\t\t\t// If width attribute is not set, do not continue.\n\t\t\t// @todo We need to check if we can detect images in other way.\n\t\t\tif ( ele.css( 'width' ) === null || ele.css( 'height' ) === null ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// Get defined width and height.\n\t\t\tvar css_width = ele.css( 'width' ).replace( 'px', '' ),\n\t\t\t\tcss_height = ele.css( 'height' ).replace( 'px', '' ),\n\t\t\t\timg_width = ele.prop( 'naturalWidth' ),\n\t\t\t\timg_height = ele.prop( 'naturalHeight' ),\n\t\t\t\thigher_width = ( css_width * 1.5 ) < img_width,\n\t\t\t\thigher_height = ( css_height * 1.5 ) < img_height,\n\t\t\t\tsmaller_width = css_width > img_width,\n\t\t\t\tsmaller_height = css_height > img_height;\n\n\t\t\t// Incase image is in correct size, do not continue.\n\t\t\tif ( !higher_width && !higher_height && !smaller_width && !smaller_height ) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ( higher_width || higher_height ) {\n\t\t\t\tvar tooltip_text = wp_smush_resize_vars.large_image;\n\t\t\t} else if ( smaller_width || smaller_height ) {\n\t\t\t\tvar tooltip_text = wp_smush_resize_vars.small_image;\n\t\t\t}\n\n\t\t\ttooltip_text = tooltip_text.replace( 'width', css_width );\n\t\t\ttooltip_text = tooltip_text.replace( 'height', css_height );\n\n\t\t\t// Create HTML content to append.\n\t\t\tvar content = '<div class=\"smush-resize-box smush-tooltip smush-tooltip-constrained\" data-tooltip=\"' + tooltip_text + '\">' +\n\t\t\t\t'<span class=\"smush-tag\">' + img_width + ' × ' + img_height + 'px</span>' +\n\t\t\t\t'<i class=\"smush-front-icons smush-front-icon-arrows-in\" aria-hidden=\"true\"></i>' +\n\t\t\t\t'<span class=\"smush-tag smush-tag-success\">' + css_width + ' × ' + css_height + 'px</span>' +\n\t\t\t\t'</div>';\n\n\t\t\t// Append resize box to image.\n\t\t\tele.before( content );\n\n\t\t\t// Add a class to image.\n\t\t\tele.addClass( 'smush-detected-img' );\n\t\t} );\n\t};\n\n\t/**\n\t * Function to remove highlights from images.\n\t *\n\t * Remove already added borders and highlights from\n\t * images. Also remove the resize box.\n\t */\n\tvar revert_detection = function () {\n\t\t// Remove all detection boxes.\n\t\t$( '.smush-resize-box' ).remove();\n\n\t\t// Remove custom class from images.\n\t\t$( '.smush-detected-img' ).removeClass( 'smush-detected-img' );\n\t};\n} );\n"],"sourceRoot":""}