1(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 2'use strict'; 3 4Object.defineProperty(exports, "__esModule", { 5 value: true 6}); 7 8var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 10function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11 12var Debugger = function () { 13 function Debugger(pluginName) { 14 var _this = this; 15 16 _classCallCheck(this, Debugger); 17 18 this.flags = {}; 19 this.pluginName = pluginName; 20 var print = typeof console !== 'undefined' && typeof console.log !== 'undefined'; 21 var stringifyExists = typeof JSON !== 'undefined' && typeof JSON.stringify === 'function'; 22 23 if (print) { 24 this.logString = function (msg) { 25 _this.log(msg); 26 }; 27 this.logObject = stringifyExists ? function (obj) { 28 _this.log(JSON.stringify(obj, null, 4)); 29 } : function (obj) { 30 return _this.simplelogObject(obj); 31 }; 32 } else { 33 this.logString = function () {}; 34 this.logObject = function () {}; 35 } 36 } 37 38 _createClass(Debugger, [{ 39 key: 'getFlag', 40 value: function getFlag(flagName) { 41 return !!this.flags[flagName]; 42 } 43 }, { 44 key: 'log', 45 value: function log(str) { 46 if (!this.getFlag('print')) return; 47 console.log(this.pluginName + ' debug: ' + str); 48 } 49 }, { 50 key: 'setFlag', 51 value: function setFlag(flagName) { 52 this.flags[flagName] = true; 53 } 54 }, { 55 key: 'simplelogObject', 56 value: function simplelogObject(obj) { 57 if (!this.getFlag('print')) return; 58 var res = Object.keys(obj).filter(function (key) { 59 return obj.hasOwnPrototype(key); 60 }).map(function (key) { 61 return key + ': ' + obj[key] + '\n'; 62 }).join(); 63 this.log(res); 64 } 65 }]); 66 67 return Debugger; 68}(); 69 70exports.default = Debugger; 71 72},{}],2:[function(require,module,exports){ 73'use strict'; 74 75var _debug = require('./debug'); 76 77var _debug2 = _interopRequireDefault(_debug); 78 79var _modal = require('./modal'); 80 81var _modal2 = _interopRequireDefault(_modal); 82 83var _share = require('./share'); 84 85var _share2 = _interopRequireDefault(_share); 86 87function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 88 89(function ($) { 90 var settings = window.frizzlySettings; 91 var debug = new _debug2.default('frizzly'); 92 var shareModule = new _share2.default($, settings, debug); 93 window.frizzlyDebugger = debug; 94})(jQuery); 95 96},{"./debug":1,"./modal":3,"./share":15}],3:[function(require,module,exports){ 97'use strict'; 98 99 100(function (factory) { 101 factory(jQuery, window, document); 102})(function ($, window, document, undefined) { 103 104 var modals = [], 105 getCurrent = function getCurrent() { 106 return modals.length ? modals[modals.length - 1] : null; 107 }, 108 selectCurrent = function selectCurrent() { 109 var i, 110 selected = false;
vendor: 7,366 bytes, lines 111-308
111 for (i = modals.length - 1; i >= 0; i--) { 112 if (modals[i].$blocker) { 113 modals[i].$blocker.toggleClass('frizzly-current', !selected).toggleClass('frizzly-behind', selected); 114 selected = true; 115 } 116 } 117 }; 118 119 $.modal = function (el, options) { 120 this.$body = $('body'); 121 this.options = $.extend({}, $.modal.defaults, options); 122 this.options.doFade = !isNaN(parseInt(this.options.fadeDuration, 10)); 123 this.$blocker = null; 124 if (this.options.closeExisting) while ($.modal.isActive()) { 125 $.modal.close(); 126 } 127 modals.push(this); 128 this.$elm = el; 129 this.$body.append(this.$elm); 130 this.open(); 131 }; 132 133 $.modal.prototype = { 134 constructor: $.modal, 135 136 open: function open() { 137 var m = this; 138 this.block(); 139 if (this.options.doFade) { 140 setTimeout(function () { 141 m.show(); 142 }, this.options.fadeDuration * this.options.fadeDelay); 143 } else { 144 this.show(); 145 } 146 $(document).off('keydown.modal').on('keydown.modal', function (event) { 147 var current = getCurrent(); 148 if (event.which == 27 && current.options.escapeClose) current.close(); 149 }); 150 if (this.options.clickClose) this.$blocker.click(function (e) { 151 if (e.target == this) $.modal.close(); 152 }); 153 }, 154 155 close: function close() { 156 modals.pop(); 157 this.unblock(); 158 this.hide(); 159 if (!$.modal.isActive()) $(document).off('keydown.modal'); 160 }, 161 162 block: function block() { 163 this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]); 164 this.$body.css('overflow', 'hidden'); 165 this.$blocker = $('<div class="frizzly-blocker frizzly-current"></div>').appendTo(this.$body); 166 selectCurrent(); 167 if (this.options.doFade) { 168 this.$blocker.css('opacity', 0).animate({ opacity: 1 }, this.options.fadeDuration); 169 } 170 this.$elm.trigger($.modal.BLOCK, [this._ctx()]); 171 }, 172 173 unblock: function unblock(now) { 174 if (!now && this.options.doFade) this.$blocker.fadeOut(this.options.fadeDuration, this.unblock.bind(this, true));else { 175 this.$blocker.children().appendTo(this.$body); 176 this.$blocker.remove(); 177 this.$blocker = null; 178 selectCurrent(); 179 if (!$.modal.isActive()) this.$body.css('overflow', ''); 180 } 181 }, 182 183 show: function show() { 184 this.$elm.trigger($.modal.BEFORE_OPEN, [this._ctx()]); 185 if (this.options.showClose) { 186 this.closeButton = $('<a href="#close-modal" rel="modal:close" class="frizzly-close-modal ' + this.options.closeClass + '">' + this.options.closeText + '</a>'); 187 this.$elm.append(this.closeButton); 188 } 189 this.$elm.addClass(this.options.modalClass).appendTo(this.$blocker); 190 if (this.options.doFade) { 191 this.$elm.css('opacity', 0).show().animate({ opacity: 1 }, this.options.fadeDuration); 192 } else { 193 this.$elm.show(); 194 } 195 this.$elm.trigger($.modal.OPEN, [this._ctx()]); 196 }, 197 198 hide: function hide() { 199 this.$elm.trigger($.modal.BEFORE_CLOSE, [this._ctx()]); 200 if (this.closeButton) this.closeButton.remove(); 201 var _this = this; 202 if (this.options.doFade) { 203 this.$elm.fadeOut(this.options.fadeDuration, function () { 204 _this.$elm.trigger($.modal.AFTER_CLOSE, [_this._ctx()]); 205 }); 206 } else { 207 this.$elm.hide(0, function () { 208 _this.$elm.trigger($.modal.AFTER_CLOSE, [_this._ctx()]); 209 }); 210 } 211 this.$elm.trigger($.modal.CLOSE, [this._ctx()]); 212 }, 213 214 showSpinner: function showSpinner() { 215 if (!this.options.showSpinner) return; 216 this.spinner = this.spinner || $('<div class="' + this.options.modalClass + '-spinner"></div>').append(this.options.spinnerHtml); 217 this.$body.append(this.spinner); 218 this.spinner.show(); 219 }, 220 221 hideSpinner: function hideSpinner() { 222 if (this.spinner) this.spinner.remove(); 223 }, 224 225 _ctx: function _ctx() { 226 return { elm: this.$elm, $blocker: this.$blocker, options: this.options }; 227 } 228 }; 229 230 $.modal.close = function (event) { 231 if (!$.modal.isActive()) return; 232 if (event) event.preventDefault(); 233 var current = getCurrent(); 234 current.close(); 235 return current.$elm; 236 }; 237 238 $.modal.isActive = function () { 239 return modals.length > 0; 240 }; 241 242 $.modal.getCurrent = getCurrent; 243 244 $.modal.defaults = { 245 closeExisting: true, 246 escapeClose: true, 247 clickClose: true, 248 closeText: 'Close', 249 closeClass: '', 250 modalClass: "frizzly-modal", 251 spinnerHtml: null, 252 showSpinner: true, 253 showClose: true, 254 fadeDuration: null, 255 fadeDelay: 1.0 256 }; 257 258 $.modal.BEFORE_BLOCK = 'modal:before-block'; 259 $.modal.BLOCK = 'modal:block'; 260 $.modal.BEFORE_OPEN = 'modal:before-open'; 261 $.modal.OPEN = 'modal:open'; 262 $.modal.BEFORE_CLOSE = 'modal:before-close'; 263 $.modal.CLOSE = 'modal:close'; 264 $.modal.AFTER_CLOSE = 'modal:after-close'; 265 266 $.fn.modal = function (options) { 267 if (this.length === 1) { 268 new $.modal(this, options); 269 } 270 return this; 271 }; 272 273 $(document).on('click.modal', 'a[rel~="modal:close"]', $.modal.close); 274 $(document).on('click.modal', 'a[rel~="modal:open"]', function (event) { 275 event.preventDefault(); 276 $(this).modal(); 277 }); 278}); 279 280},{}],4:[function(require,module,exports){ 281'use strict'; 282 283Object.defineProperty(exports, "__esModule", { 284 value: true 285}); 286 287var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 288 289function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 290 291var EmailSharer = function () { 292 function EmailSharer($, i18n) { 293 _classCallCheck(this, EmailSharer); 294 295 this.$ = $; 296 this.i18n = i18n; 297 this.responseClassPrefix = 'frizzly-share-email-response-'; 298 this.html = this.createForm(); 299 } 300 301 _createClass(EmailSharer, [{ 302 key: 'cleanInputs', 303 value: function cleanInputs() { 304 this.html.sourceEmail.val(''); 305 this.html.targetEmail.val(''); 306 this.html.sourceName.val(''); 307 } 308 }, {
309 key: 'createForm', 310 value: function createForm() { 311 var _this = this; 312 313 var response = this.$('<p />', {}); 314 315 var targetEmailLabel = this.$('<label />', { 316 class: 'frizzly-share-email-header', 317 for: 'frizzly-share-email-target-email', 318 html: this.i18n.targetEmailLabel 319 }); 320 321 var targetEmail = this.$('<input />', { 322 class: 'frizzly-share-email-input', 323 type: 'text', 324 id: 'frizzly-share-email-target-email' 325 }); 326 327 var sourceEmailLabel = this.$('<label />', { 328 class: 'frizzly-share-email-input', 329 type: 'text', 330 for: 'frizzly-share-email-source-email', 331 html: this.i18n.sourceEmailLabel 332 }); 333 334 var sourceEmail = this.$('<input />', { 335 class: 'frizzly-share-email-input', 336 type: 'text', 337 id: 'frizzly-share-email-source-email' 338 }); 339 340 var sourceNameLabel = this.$('<label />', { 341 class: 'frizzly-share-email-input', 342 for: 'frizzly-share-email-source-name', 343 html: this.i18n.sourceNameLabel 344 }); 345 346 var sourceName = this.$('<input />', { 347 class: 'frizzly-share-email-input', 348 type: 'text', 349 id: 'frizzly-share-email-source-name' 350 }); 351 352 var btn = this.$('<div />', { 353 class: 'frizzly-share-email-submit-container', 354 html: this.$('<input />', { 355 class: 'frizzly-share-email-submit', 356 type: 'submit', 357 value: this.i18n.button 358 }) 359 }).click(function () { 360 var data = { 361 action: _this.i18n.ajax_action, 362 nonce: _this.i18n.ajax_nonce, 363 postId: _this.postId, 364 toEmail: _this.html.targetEmail.val(), 365 fromEmail: _this.html.sourceEmail.val(), 366 fromName: _this.html.sourceName.val() 367 }; 368 _this.$.post(_this.i18n.ajax_url, data, function (_ref) { 369 var status = _ref.status; 370 var message = _ref.message; 371 372 _this.cleanInputs(); 373 if (!status) { 374 _this.html.response.attr('class', _this.responseClassPrefix + 'error').html(_this.i18n.unknown_error); 375 } else { 376 _this.html.response.attr('class', '' + _this.responseClassPrefix + status).html(message); 377 } 378 }); 379 }); 380 var form = this.$('<div />', { class: 'frizzly-share-email' }).append(response).append(targetEmailLabel).append(targetEmail).append(sourceEmailLabel).append(sourceEmail).append(sourceNameLabel).append(sourceName).append(btn); 381 382 return { 383 targetEmail: targetEmail, 384 sourceEmail: sourceEmail, 385 sourceName: sourceName, 386 response: response, 387 form: form 388 }; 389 } 390 }, { 391 key: 'share', 392 value: function share(postId) { 393 this.html.response.html(''); 394 this.cleanInputs(); 395 this.postId = postId; 396 this.$(this.html.form).modal(); 397 return false; 398 } 399 }]); 400 401 return EmailSharer; 402}(); 403 404exports.default = EmailSharer; 405 406},{}],5:[function(require,module,exports){ 407'use strict'; 408 409Object.defineProperty(exports, "__esModule", { 410 value: true 411}); 412 413var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 414 415function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 416 417var Functions = function () { 418 function Functions() { 419 _classCallCheck(this, Functions); 420 } 421 422 _createClass(Functions, null, [{ 423 key: 'openWindow', 424 value: function openWindow(href, e, $) { 425 var isHrefUrl = href.slice(-1) !== '#' && href.indexOf('http') === 0; 426 if (isHrefUrl) { 427 e.preventDefault(); 428 e.stopPropagation(); 429 window.open(href, 'mw' + e.timeStamp, 'left=20,top=20,width=800,height=500,toolbar=1,resizable=0'); 430 } 431 return !isHrefUrl; 432 } 433 }]); 434 435 return Functions; 436}(); 437 438exports.default = Functions; 439 440},{}],6:[function(require,module,exports){ 441'use strict'; 442 443Object.defineProperty(exports, "__esModule", { 444 value: true 445}); 446 447var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 448 449var _functions = require('./../common/functions'); 450 451var _functions2 = _interopRequireDefault(_functions); 452 453function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 454 455function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 456 457var ContentModule = function () { 458 function ContentModule($, settings, emailSharer, logger) { 459 _classCallCheck(this, ContentModule); 460 461 this.settings = settings; 462 this.emailSharer = emailSharer; 463 this.$ = $; 464 this.logger = logger; 465 } 466 467 _createClass(ContentModule, [{ 468 key: 'init',
469 value: function init() { 470 this.config = { 471 attributesToCopy: ['^alt$', '^title$', 'data-frizzly-content-share-pinterest'], 472 cssPrefix: 'frizzly_pinmarklet', 473 minImgSize: 100, 474 thumbCellSize: 250 475 }; 476 this.structure = null; 477 this.saveScrollTop = 0; 478 479 var that = this; 480 this.$(document).on('click', '.frizzly-content a', function (e) { 481 var $btn = that.$(this); 482 if ($btn.attr('data-frizzly-pinmarklet')) { 483 var $images = that.$('img[data-frizzly-content-post-id="' + $btn.attr('data-frizzly-pinmarklet') + '"]'); 484 if ($images.length) { 485 that.openPinmarklet($images); 486 } else { 487 alert(that.settings.i18n.pinmarklet.no_images); 488 } 489 return false; 490 } else { 491 var href = $btn.attr('href'); 492 if (href.indexOf('mailto') === 0) { 493 return that.emailSharer.share($btn.attr('data-frizzly-content-post-id')); 494 } 495 return _functions2.default.openWindow(href, e, that.$); 496 } 497 }); 498 } 499 }, { 500 key: 'close', 501 value: function close() { 502 if (this.structure) { 503 this.structure.bg.remove(); 504 this.structure.bd.remove(); 505 this.structure = null; 506 } 507 window.scroll(0, this.saveScrollTop); 508 } 509 }, { 510 key: 'createStructure', 511 value: function createStructure() { 512 var _this = this; 513 514 var hd = this.$('<div />', { class: this.config.cssPrefix + '_hd' }).append(this.$('<span />', { class: this.config.cssPrefix + '_logo' })).append(this.$('<span />', { 515 class: this.config.cssPrefix + '_title', 516 html: this.settings.i18n.pinmarklet.choose 517 })).append(this.$('<a />', { 518 class: this.config.cssPrefix + '_x' 519 }).click(function () { 520 return _this.close(); 521 })); 522 523 this.structure = { 524 bd: this.$('<div />', { class: this.config.cssPrefix + '_bd' }).append(hd), 525 bg: this.$('<div />', { class: this.config.cssPrefix + '_bg' }).click(function () { 526 return _this.close(); 527 }) 528 }; 529 530 this.$(document.body).append(this.structure.bg).append(this.structure.bd); 531 window.scroll(0, 0); 532 } 533 }, { 534 key: 'createThumb', 535 value: function createThumb($img, realHeight, realWidth) { 536 var _this2 = this; 537 538 var image = this.$('<img />', { 539 css: { visibility: 'hidden' }, 540 src: $img.prop('src') 541 }); 542 543 [].filter.call($img[0].attributes, function (att) { 544 return _this2.config.attributesToCopy.some(function (regex) { 545 return new RegExp(regex).test(att.name); 546 }); 547 }).map(function (att) { 548 return att.name; 549 }
549).forEach(function (attName) { 550 image.attr(attName, $img.attr(attName)); 551 }); 552 553 image.load(function () { 554 return _this2.resizeImage(image); 555 }); 556 557 var link = this.$('<a />', { 558 href: image.attr('data-frizzly-content-share-pinterest') 559 }).append(image).append(this.$('<span />', { 560 html: realHeight + ' x ' + realWidth, 561 class: this.config.cssPrefix + '_resolution' 562 })); 563 564 var button = this.$('<span />', { 565 class: this.config.cssPrefix + '_button', 566 html: this.$('<div />', { 567 class: 'frizzly-button-container frizzly-button-size-' + this.settings.button_size + ' frizzly-theme-' + this.settings.button_shape, 568 css: { 'align-self': 'center' }, 569 html: this.$('<a />', { 570 class: 'frizzly-button frizzly-pinterest', 571 html: this.$('<i />', { 572 class: 'fa fa-fw fa-pinterest' 573 }) 574 }) 575 }) 576 }); 577 578 var container = this.$('<span />', { class: this.config.cssPrefix + '_pincontainer' }).append(link).append(button).click(function (e) { 579 _functions2.default.openWindow(link.attr('href'), e); 580 setTimeout(function () { 581 return _this2.close(); 582 }, 10); 583 }).hover(function () { 584 return button.css('display', 'flex'); 585 }, function () { 586 return button.hide(); 587 }); 588 589 return container; 590 } 591 }, { 592 key: 'loadParamImage', 593 value: function loadParamImage(img) { 594 var that = this; 595 this.$('<img />', { 596 src: img.src 597 }).load(function () { 598 if (this.height > that.config.minImgSize && this.width > that.config.minImgSize) { 599 var container = that.createThumb(that.$(img), this.height, this.width); 600 that.structure.bd.append(container); 601 } 602 }); 603 } 604 }, { 605 key: 'resizeImage', 606 value: function resizeImage(img) { 607 var width = img.width(), 608 height = img.height(); 609 if (width >= height) { 610 height = height * Math.min(this.config.thumbCellSize / width, 1); 611 width = Math.min(width, this.config.thumbCellSize); 612 } else { 613 width = width * Math.min(this.config.thumbCellSize / height, 1); 614 height = Math.min(height, this.config.thumbCellSize); 615 } 616 this.$(img).css({ 617 height: height, 618 width: width, 619 visibility: '', 620 marginTop: -Math.min(height, this.config.thumbCellSize) / 2 + 'px', 621 marginLeft: -Math.min(width, this.config.thumbCellSize) / 2 + 'px' 622 }); 623 } 624 }, { 625 key: 'openPinmarklet', 626 value: function openPinmarklet($images) { 627 var _this3 = this; 628 629 if (this.structure) return; 630 this.saveScrollTop = window.pageYOffset; 631 this.createStructure(); 632 $images.each(function (id, img) { 633 return _this3.loadParamImage(img); 634 }); 635 } 636 }]); 637 638 return ContentModule; 639}(); 640 641exports.default = ContentModule; 642 643},{"./../common/functions":5}],7:[function(require,module,exports){ 644'use strict'; 645 646Object.defineProperty(exports, "__esModule", { 647 value: true 648}); 649 650var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 651 652var _showStrategy = require('./show-strategy'); 653 654function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 655 656var ImageModule = function () { 657 function ImageModule($, settings, emailSharer, logger) { 658 _classCallCheck(this, ImageModule); 659 660 this.settings = settings; 661 this.$ = $; 662 this.emailSharer = emailSharer; 663 this.logger = logger; 664 } 665 666 _createClass(ImageModule, [{ 667 key: 'init',
668 value: function init() { 669 this.$('input.frizzly').closest('div').addClass('frizzly_container'); 670 this.showStrategy = this.getStrategy(); 671 this.showStrategy.start(); 672 } 673 }, { 674 key: 'getStrategy', 675 value: function getStrategy() { 676 var F = this.settings.show === 'always' ? _showStrategy.ShowAlwaysStrategy : _showStrategy.ShowOnHoverStrategy; 677 return new F(this.$, this.settings, this.emailSharer, this.logger); 678 } 679 }]); 680 681 return ImageModule; 682}(); 683 684exports.default = ImageModule; 685 686},{"./show-strategy":10}],8:[function(require,module,exports){ 687'use strict'; 688 689Object.defineProperty(exports, "__esModule", { 690 value: true 691}); 692 693var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 694 695var _functions = require('./../../common/functions'); 696 697var _functions2 = _interopRequireDefault(_functions); 698 699function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 700 701function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 702 703var ButtonGenerator = function () { 704 function ButtonGenerator($, settings, emailSharer) { 705 _classCallCheck(this, ButtonGenerator); 706 707 this.$ = $; 708 this.settings = settings; 709 this.emailSharer = emailSharer; 710 this.$element = this.$('<div />', { 711 class: 'frizzly-button-container frizzly-media frizzly-button-size-' + this.settings.button_size + ' frizzly-theme-' + this.settings.button_shape 712 }); 713 714 this.size = this.computeSize(); 715 } 716 717 _createClass(ButtonGenerator, [{ 718 key: 'generateButtons', 719 value: function generateButtons($image) { 720 var _this = this; 721 722 return this.settings.networks.map(function (networkName) { 723 var link = _this.getNetworkLink($image, networkName); 724 if (!link) return null; 725 return _this.$('<a />', { 726 class: 'frizzly-button frizzly-' + networkName, 727 target: _this.getTargetAttribute(networkName), 728 href: link, 729 html: '<i class="fa fa-fw ' + _this.getNetworkClass(networkName) + '"></i>' 730 }).click(function (e) { 731 var href = e.currentTarget.href; 732 if (href.indexOf('mailto') === 0) { 733 return _this.emailSharer.share($image.attr('data-frizzly-image-post-id')); 734 } 735 return _functions2.default.openWindow(e.currentTarget.href, e, _this.$); 736 }); 737 }).filter(function (e) { 738 return !!e; 739 }); 740 } 741 }, { 742 key: 'getNetworkClass', 743 value: function getNetworkClass(networkName) { 744 switch (networkName) { 745 case 'email': 746 return 'fa-envelope-o'; 747 case 'googleplus': 748 return 'fa-google-plus'; 749 default: 750 return 'fa-' + networkName; 751 } 752 } 753 }, { 754 key: 'getNetworkLink', 755 value: function getNetworkLink($img, networkName) { 756 return $img.attr('data-frizzly-image-share-' + networkName) || ''; 757 } 758 }, { 759 key: 'getTargetAttribute', 760 value: function getTargetAttribute(networkName) { 761 switch (networkName) { 762 case 'email': 763 return '_top'; 764 default: 765 return '_blank'; 766 } 767 } 768 }, {
769 key: 'computeSize', 770 value: function computeSize() { 771 var numberOfButtons = this.settings.networks.length; 772 var baseHeight = 48; 773 var baseWidth = 100; 774 var size = this.settings.button_size; 775 var theme = this.settings.button_shape; 776 777 var sizes = { 778 xsmall: 0.5, 779 small: 0.8, 780 normal: 1, 781 large: 1.5, 782 xlarge: 2 783 }; 784 785 var themes = { 786 square: baseHeight, 787 rounded: baseHeight, 788 round: baseHeight, 789 'rounded-rectangle': baseWidth, 790 rectangle: baseWidth 791 }; 792 return { 793 height: Math.round(baseHeight * sizes[size]), 794 width: Math.round(numberOfButtons * themes[theme] * sizes[size]) 795 }; 796 } 797 }, { 798 key: 'createButtons', 799 value: function createButtons($image) { 800 var $elem = this.$element.clone(false); 801 $elem.html(this.generateButtons($image)); 802 803 return { 804 $element: $elem, 805 size: this.size 806 }; 807 } 808 }]); 809 810 return ButtonGenerator; 811}(); 812 813exports.default = ButtonGenerator; 814 815},{"./../../common/functions":5}],9:[function(require,module,exports){ 816'use strict'; 817 818Object.defineProperty(exports, "__esModule", { 819 value: true 820}); 821 822var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 823 824function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 825 826var ImageFilter = function () { 827 function ImageFilter(settings) { 828 _classCallCheck(this, ImageFilter); 829 830 this.minWidth = settings.desktop_min_width; 831 this.minHeight = settings.desktop_min_height; 832 this.classes = settings.image_classes ? this.settings.image_classes.split(',') : []; 833 this.positive = settings.image_classes_positive; 834 } 835 836 _createClass(ImageFilter, [{ 837 key: 'checkClass', 838 value: function checkClass($img) { 839 var _this = this; 840 841 return this.classes.length === 0 || this.classes.reduce(function (res, name) { 842 return res && $img.hasClass(name) === _this.positive; 843 }, true); 844 } 845 }, { 846 key: 'imageEligible', 847 value: function imageEligible($img) { 848 return this.checkClass($img) && $img[0].clientWidth >= this.minWidth && $img[0].clientHeight >= this.minWidth; 849 } 850 }]); 851 852 return ImageFilter; 853}(); 854 855exports.default = ImageFilter; 856 857},{}],10:[function(require,module,exports){ 858'use strict'; 859 860Object.defineProperty(exports, "__esModule", { 861 value: true 862}); 863exports.ShowOnHoverStrategy = exports.ShowAlwaysStrategy = undefined; 864 865var _showAlwaysStrategy = require('./show-always-strategy'); 866 867var _showAlwaysStrategy2 = _interopRequireDefault(_showAlwaysStrategy); 868 869var _showOnHoverStrategy = require('./show-on-hover-strategy'); 870 871var _showOnHoverStrategy2 = _interopRequireDefault(_showOnHoverStrategy); 872 873function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 874 875exports.ShowAlwaysStrategy = _showAlwaysStrategy2.default; 876exports.ShowOnHoverStrategy = _showOnHoverStrategy2.default; 877 878},{"./show-always-strategy":12,"./show-on-hover-strategy":13}],11:[function(require,module,exports){ 879'use strict'; 880 881Object.defineProperty(exports, "__esModule", { 882 value: true 883}); 884 885var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 886 887function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 888
889var topPosition = function topPosition(topLeft, bottomRight, containerSize, margins) { 890 return topLeft.top + margins.top; 891}; 892 893var leftPosition = function leftPosition(topLeft, bottomRight, containerSize, margins) { 894 return topLeft.left + margins.left; 895}; 896 897var bottomPosition = function bottomPosition(topLeft, bottomRight, containerSize, margins) { 898 return bottomRight.top - containerSize.height - margins.bottom; 899}; 900 901var rightPosition = function rightPosition(topLeft, bottomRight, containerSize, margins) { 902 return bottomRight.left - margins.right - containerSize.width; 903}; 904 905var topCenterPosition = function topCenterPosition(topLeft, bottomRight, containerSize) { 906 return topLeft.top + ((bottomRight.top - topLeft.top) / 2 - containerSize.height / 2); 907}; 908 909var leftCenterPosition = function leftCenterPosition(topLeft, bottomRight, containerSize) { 910 return topLeft.left + ((bottomRight.left - topLeft.left) / 2 - containerSize.width / 2); 911}; 912 913var PositionCalculator = function () { 914 function PositionCalculator(topFunc, leftFunc) { 915 _classCallCheck(this, PositionCalculator); 916 917 this.topF = topFunc; 918 this.leftF = leftFunc; 919 } 920 921 _createClass(PositionCalculator, [{ 922 key: 'calculate', 923 value: function calculate(topLeft, bottomRight, containerSize, margins) { 924 return { 925 top: this.topF(topLeft, bottomRight, containerSize, margins), 926 left: this.leftF(topLeft, bottomRight, containerSize, margins) 927 }; 928 } 929 }]); 930 931 return PositionCalculator; 932}(); 933 934var Positioner = function () { 935 function Positioner(position, margins) { 936 _classCallCheck(this, Positioner); 937 938 this.margins = margins; 939 this.positionCalculator = this.getPositionCalculator(position); 940 } 941 942 _createClass(Positioner, [{ 943 key: 'getPositionCalculator', 944 value: function getPositionCalculator(position) { 945 switch (position) { 946 case 'top-left': 947 return new PositionCalculator(topPosition, leftPosition); 948 case 'top-right': 949 return new PositionCalculator(topPosition, rightPosition); 950 case 'bottom-left': 951 return new PositionCalculator(bottomPosition, leftPosition); 952 case 'bottom-right': 953 return new PositionCalculator(bottomPosition, rightPosition); 954 case 'center': 955 default: 956 return new PositionCalculator(topCenterPosition, leftCenterPosition); 957 } 958 } 959 }, { 960 key: 'calculatePosition', 961 value: function calculatePosition(topLeft, bottomRight, containerSize) { 962 return this.positionCalculator.calculate(topLeft, bottomRight, containerSize, this.margins); 963 } 964 }]); 965 966 return Positioner; 967}(); 968 969exports.default = Positioner; 970 971},{}],12:[function(require,module,exports){ 972"use strict"; 973 974Object.defineProperty(exports, "__esModule", { 975 value: true 976}); 977 978function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 979 980var ShowAlwaysStrategy = function ShowAlwaysStrategy(settings) { 981 _classCallCheck(this, ShowAlwaysStrategy); 982 983 this.settings = settings; 984}; 985 986exports.default = ShowAlwaysStrategy; 987 988},{}],13:[function(require,module,exports){ 989'use strict'; 990 991Object.defineProperty(exports, "__esModule", { 992 value: true 993}); 994 995var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 996 997var _showStrategy = require('./show-strategy'); 998 999var _showStrategy2 = _interopRequireDefault(_showStrategy); 1000 1001function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1002 1003function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1004 1005function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 1006 1007function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { c
1007onstructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 1008 1009var ShowOnHoverStrategy = function (_ShowStrategy) { 1010 _inherits(ShowOnHoverStrategy, _ShowStrategy); 1011 1012 function ShowOnHoverStrategy() { 1013 _classCallCheck(this, ShowOnHoverStrategy); 1014 1015 return _possibleConstructorReturn(this, Object.getPrototypeOf(ShowOnHoverStrategy).apply(this, arguments)); 1016 } 1017 1018 _createClass(ShowOnHoverStrategy, [{ 1019 key: 'start', 1020 value: function start() { 1021 var that = this; 1022 var indexerAttr = 'data-frizzly-indexer'; 1023 var timeoutAttr = 'data-frizzly-timeout'; 1024 var indexer = 0; 1025 1026 var containerSelector = function containerSelector(idx) { 1027 return that.$('.frizzly-button-container[' + indexerAttr + '="' + idx + '"]'); 1028 }; 1029 that.$(document).delegate(this.settings.image_selector, 'mouseenter', function handleHover() { 1030 var $image = that.$(this); 1031 1032 if (!that.imageFilter.imageEligible($image)) return; 1033 var currentIndexer = $image.attr(indexerAttr); 1034 if (!currentIndexer) { 1035 currentIndexer = indexer++; 1036 $image.attr(indexerAttr, currentIndexer); 1037 } 1038 1039 var $container = containerSelector(currentIndexer); 1040 if ($container.length === 0) { 1041 (function () { 1042 var _that$buttonGenerator = that.buttonGenerator.createButtons($image); 1043 1044 var $element = _that$buttonGenerator.$element; 1045 var size = _that$buttonGenerator.size; 1046 1047 var topLeft = $image.offset(); 1048 var bottomRight = { 1049 top: topLeft.top + $image[0].clientHeight, 1050 left: topLeft.left + $image[0].clientWidth 1051 }; 1052 var offset = that.positioner.calculatePosition(topLeft, bottomRight, size); 1053 1054 $image.after($element); 1055 $element.attr(indexerAttr, currentIndexer).css('visibility', 'hidden').show().offset(offset).css('visibility', 'visible').hover(function () { 1056 return clearTimeout($element.attr(timeoutAttr)); 1057 }, function () { 1058 return $element.attr(timeoutAttr, setTimeout(function () { 1059 $element.remove(); 1060 }, 100)); 1061 }); 1062 })(); 1063 } else { 1064 clearTimeout($container.attr(timeoutAttr)); 1065 } 1066 }); 1067 1068 that.$(document).delegate(this.settings.image_selector, 'mouseleave', function handleLeave() { 1069 if (that.logger.getFlag('image_prevent_hide')) { 1070 return; 1071 } 1072 var $image = that.$(this); 1073 var currentIndexer = $image.attr(indexerAttr); 1074 if (!currentIndexer) return; 1075 1076 var $container = containerSelector(currentIndexer); 1077 $container.attr(timeoutAttr, setTimeout(function () { 1078 $container.remove(); 1079 }, 100)); 1080 }); 1081 } 1082 }]); 1083 1084 return ShowOnHoverStrategy; 1085}(_showStrategy2.default); 1086 1087exports.default = ShowOnHoverStrategy; 1088 1089},{"./show-strategy":14}],14:[function(require,module,exports){ 1090'use strict'; 1091 1092Object.defineProperty(exports, "__esModule", { 1093 value: true 1094}); 1095 1096var _imageFilter = require('./image-filter'); 1097 1098var _imageFilter2 = _interopRequireDefault(_imageFilter); 1099 1100var _buttonGenerator = require('./button-generator'); 1101 1102var _buttonGenerator2 = _interopRequireDefault(_buttonGenerator); 1103 1104var _positioner = require('./positioner'); 1105 1106var _positioner2 = _interopRequireDefault(_positioner); 1107 1108function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1109 1110function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1111 1112var ShowStrategy = function ShowStrategy($, settings, emailSharer, logger) { 1113 _classCallCheck(this, ShowStrategy); 1114 1115 this.$ = $; 1116 this.settings = settings; 1117 this.emailSharer = emailSharer; 1118 this.logger = logger; 1119 this.imageFilter = new _imageFilter2.default(settings); 1120 this.buttonGenerator = new _buttonGenerator2.default($, settings, emailSharer); 1121 var margins = { 1122 left: settings.button_margin_left, 1123 top: settings.button_margin_top, 1124 right: settings.button_margin_right, 1125 bottom: settings.button_margin_bottom 1126 }; 1127 this.positioner = new _positioner2.default(settings.button_position, margins); 1128}; 1129 1130exports.default = ShowStrategy; 1131 1132},{"./button-generator":8,"./image-filter":9,"./positioner":11}],15:[function(require,module,exports){ 1133'use strict'; 1134 1135Object.defineProperty(exports, "__esModule", { 1136 value: true 1137}); 1138 1139var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 1140 1141var _image = require('./image'); 1142 1143var _image2 = _interopRequireDefault(_image); 1144 1145var _content = require('./content'); 1146 1147var _content2 = _interopRequireDefault(_content); 1148
1149var _emailSharer = require('./common/email-sharer'); 1150 1151var _emailSharer2 = _interopRequireDefault(_emailSharer); 1152 1153function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1154 1155function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 1156 1157var ShareModule = function () { 1158 function ShareModule($, settings, logger) { 1159 _classCallCheck(this, ShareModule); 1160 1161 this.$ = $; 1162 this.settings = settings; 1163 this.logger = logger; 1164 this.emailSharer = new _emailSharer2.default($, this.settings.general['i18n']['email_sharer']); 1165 1166 this.init(); 1167 } 1168 1169 _createClass(ShareModule, [{ 1170 key: 'init', 1171 value: function init() { 1172 this.imageModule = new _image2.default(this.$, this.settings.image, this.emailSharer, this.logger); 1173 this.imageModule.init(); 1174 1175 this.contentModule = new _content2.default(this.$, this.settings.content, this.emailSharer, this.logger); 1176 this.contentModule.init(); 1177 } 1178 }]); 1179 1180 return ShareModule; 1181}(); 1182 1183exports.default = ShareModule; 1184 1185},{"./common/email-sharer":4,"./content":6,"./image":7}]},{},[2])
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.