(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("jQuery")); else if(typeof define === 'function' && define.amd) define(["jQuery"], factory); else if(typeof exports === 'object') exports["app"] = factory(require("jQuery")); else root["app"] = factory(root["jQuery"]); })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/assets/production/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 258); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_0__; /***/ }), /***/ 10: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["e"] = makeString; /* harmony export (immutable) */ __webpack_exports__["a"] = copy; /* harmony export (immutable) */ __webpack_exports__["h"] = setPath; /* harmony export (immutable) */ __webpack_exports__["f"] = pushPath; /* harmony export (immutable) */ __webpack_exports__["d"] = getPath; /* harmony export (immutable) */ __webpack_exports__["b"] = deepExtend; /* harmony export (immutable) */ __webpack_exports__["g"] = regexEscape; /* harmony export (immutable) */ __webpack_exports__["c"] = escape; function makeString(object) { if (object == null) return ''; /* eslint prefer-template: 0 */ return '' + object; } function copy(a, s, t) { a.forEach(function (m) { if (s[m]) t[m] = s[m]; }); } function getLastOfPath(object, path, Empty) { function cleanKey(key) { return key && key.indexOf('###') > -1 ? key.replace(/###/g, '.') : key; } function canNotTraverseDeeper() { return !object || typeof object === 'string'; } var stack = typeof path !== 'string' ? [].concat(path) : path.split('.'); while (stack.length > 1) { if (canNotTraverseDeeper()) return {}; var key = cleanKey(stack.shift()); if (!object[key] && Empty) object[key] = new Empty(); object = object[key]; } if (canNotTraverseDeeper()) return {}; return { obj: object, k: cleanKey(stack.shift()) }; } function setPath(object, path, newValue) { var _getLastOfPath = getLastOfPath(object, path, Object), obj = _getLastOfPath.obj, k = _getLastOfPath.k; obj[k] = newValue; } function pushPath(object, path, newValue, concat) { var _getLastOfPath2 = getLastOfPath(object, path, Object), obj = _getLastOfPath2.obj, k = _getLastOfPath2.k; obj[k] = obj[k] || []; if (concat) obj[k] = obj[k].concat(newValue); if (!concat) obj[k].push(newValue); } function getPath(object, path) { var _getLastOfPath3 = getLastOfPath(object, path), obj = _getLastOfPath3.obj, k = _getLastOfPath3.k; if (!obj) return undefined; return obj[k]; } function deepExtend(target, source, overwrite) { /* eslint no-restricted-syntax: 0 */ for (var prop in source) { if (prop in target) { // If we reached a leaf string in target or source then replace with source or skip depending on the 'overwrite' switch if (typeof target[prop] === 'string' || target[prop] instanceof String || typeof source[prop] === 'string' || source[prop] instanceof String) { if (overwrite) target[prop] = source[prop]; } else { deepExtend(target[prop], source[prop], overwrite); } } else { target[prop] = source[prop]; } } return target; } function regexEscape(str) { /* eslint no-useless-escape: 0 */ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); } /* eslint-disable */ var _entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }; /* eslint-enable */ function escape(data) { if (typeof data === 'string') { return data.replace(/[&<>"'\/]/g, function (s) { return _entityMap[s]; }); } return data; } /***/ }), /***/ 12: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ({ processors: {}, addPostProcessor: function addPostProcessor(module) { this.processors[module.name] = module; }, handle: function handle(processors, value, key, options, translator) { var _this = this; processors.forEach(function (processor) { if (_this.processors[processor]) value = _this.processors[processor].process(value, key, options, translator); }); return value; } }); /***/ }), /***/ 13: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = convertAPIOptions; /* harmony export (immutable) */ __webpack_exports__["c"] = convertJSONOptions; /* harmony export (immutable) */ __webpack_exports__["d"] = convertTOptions; /* harmony export (immutable) */ __webpack_exports__["a"] = appendBackwardsAPI; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__logger__ = __webpack_require__(3); /* eslint no-param-reassign: 0 */ function convertInterpolation(options) { options.interpolation = { unescapeSuffix: 'HTML' }; options.interpolation.prefix = options.interpolationPrefix || '__'; options.interpolation.suffix = options.interpolationSuffix || '__'; options.interpolation.escapeValue = options.escapeInterpolation || false; options.interpolation.nestingPrefix = options.reusePrefix || '$t('; options.interpolation.nestingSuffix = options.reuseSuffix || ')'; return options; } function convertAPIOptions(options) { if (options.resStore) options.resources = options.resStore; if (options.ns && options.ns.defaultNs) { options.defaultNS = options.ns.defaultNs; options.ns = options.ns.namespaces; } else { options.defaultNS = options.ns || 'translation'; } if (options.fallbackToDefaultNS && options.defaultNS) options.fallbackNS = options.defaultNS; options.saveMissing = options.sendMissing; options.saveMissingTo = options.sendMissingTo || 'current'; options.returnNull = !options.fallbackOnNull; options.returnEmptyString = !options.fallbackOnEmpty; options.returnObjects = options.returnObjectTrees; options.joinArrays = '\n'; options.returnedObjectHandler = options.objectTreeKeyHandler; options.parseMissingKeyHandler = options.parseMissingKey; options.appendNamespaceToMissingKey = true; options.nsSeparator = options.nsseparator || ':'; options.keySeparator = options.keyseparator || '.'; if (options.shortcutFunction === 'sprintf') { options.overloadTranslationOptionHandler = function handle(args) { var values = []; for (var i = 1; i < args.length; i++) { values.push(args[i]); } return { postProcess: 'sprintf', sprintf: values }; }; } options.whitelist = options.lngWhitelist; options.preload = options.preload; if (options.load === 'current') options.load = 'currentOnly'; if (options.load === 'unspecific') options.load = 'languageOnly'; // backend options.backend = options.backend || {}; options.backend.loadPath = options.resGetPath || 'locales/__lng__/__ns__.json'; options.backend.addPath = options.resPostPath || 'locales/add/__lng__/__ns__'; options.backend.allowMultiLoading = options.dynamicLoad; // cache options.cache = options.cache || {}; options.cache.prefix = 'res_'; options.cache.expirationTime = 7 * 24 * 60 * 60 * 1000; options.cache.enabled = options.useLocalStorage; options = convertInterpolation(options); if (options.defaultVariables) options.interpolation.defaultVariables = options.defaultVariables; // COMPATIBILITY: deprecation // if (options.getAsync === false) throw deprecation error return options; } function convertJSONOptions(options) { options = convertInterpolation(options); options.joinArrays = '\n'; return options; } function convertTOptions(options) { if (options.interpolationPrefix || options.interpolationSuffix || options.escapeInterpolation !== undefined) { options = convertInterpolation(options); } options.nsSeparator = options.nsseparator; options.keySeparator = options.keyseparator; options.returnObjects = options.returnObjectTrees; return options; } function appendBackwardsAPI(i18n) { i18n.lng = function () { __WEBPACK_IMPORTED_MODULE_0__logger__["a" /* default */].deprecate('i18next.lng() can be replaced by i18next.language for detected language or i18next.languages for languages ordered by translation lookup.'); return i18n.services.languageUtils.toResolveHierarchy(i18n.language)[0]; }; i18n.preload = function (lngs, cb) { __WEBPACK_IMPORTED_MODULE_0__logger__["a" /* default */].deprecate('i18next.preload() can be replaced with i18next.loadLanguages()'); i18n.loadLanguages(lngs, cb); }; i18n.setLng = function (lng, options, callback) { __WEBPACK_IMPORTED_MODULE_0__logger__["a" /* default */].deprecate('i18next.setLng() can be replaced with i18next.changeLanguage() or i18next.getFixedT() to get a translation function with fixed language or namespace.'); if (typeof options === 'function') { callback = options; options = {}; } if (!options) options = {}; if (options.fixLng === true) { if (callback) return callback(null, i18n.getFixedT(lng)); } return i18n.changeLanguage(lng, callback); }; i18n.addPostProcessor = function (name, fc) { __WEBPACK_IMPORTED_MODULE_0__logger__["a" /* default */].deprecate('i18next.addPostProcessor() can be replaced by i18next.use({ type: \'postProcessor\', name: \'name\', process: fc })'); i18n.use({ type: 'postProcessor', name: name, process: fc }); }; } /***/ }), /***/ 14: /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(jQuery) { // @TODO enable lints /* eslint-disable max-len*/ /* eslint-disable object-shorthand*/ /* eslint-disable dot-notation*/ /* eslint-disable vars-on-top*/ /* eslint-disable prefer-template*/ /* eslint-disable prefer-const*/ /* eslint-disable spaced-comment*/ /* eslint-disable curly*/ /* eslint-disable object-curly-spacing*/ /* eslint-disable spaced-comment*/ /* eslint-disable prefer-arrow-callback*/ /* eslint-disable one-var*/ /* eslint-disable space-in-parens*/ /* eslint-disable camelcase*/ /* eslint-disable no-undef*/ /* eslint-disable quote-props*/ /* eslint-disable no-shadow*/ /* eslint-disable no-param-reassign*/ /* eslint-disable no-unused-expressions*/ /* eslint-disable no-shadow*/ /* eslint-disable no-implied-eval*/ /* eslint-disable brace-style*/ /* eslint-disable no-unused-vars*/ /* eslint-disable brace-style*/ /* eslint-disable no-lonely-if*/ /* eslint-disable no-inline-comments*/ /* eslint-disable default-case*/ /* eslint-disable one-var*/ /* eslint-disable semi*/ var pym = __webpack_require__(17); /* * jQuery Tooltip plugin 1.3 * * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ * http://docs.jquery.com/Plugins/Tooltip * * Copyright (c) 2006 - 2008 J�rn Zaefferer * * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $ * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function ($) { $(document).bind('keydown', function (event) { if ($.tooltip === undefined) return; if (event.keyCode === 27 && $.tooltip.blocked === true) { unfixTooltip(); } }); var activeThumbnailFrame = void 0; // the tooltip element var helper = {}, // the title of the current element, used for restoring title = void 0, // timeout id for delayed tooltips tID = void 0, // IE 5.5 or 6 IE = navigator.userAgent.match(/msie/i) && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent), // flag for mouse tracking track = false; $.tooltip = { blocked: false, ajaxTimeout: false, ajaxRequest: false, ajaxEvent: false, current: null, visible: false, defaults: { delay: 700, fixable: false, fixableIndex: 100, fade: true, showURL: true, outside: true, isBrowsable: false, extraClass: '', top: 15, left: 15, id: 'tooltip' }, block: function block() { $.tooltip.blocked = !$.tooltip.blocked; }, delayAjax: function delayAjax(a, b, c) { var datas = {}; $.tooltip.ajaxRequest = $.ajax({ url: $.tooltip.current.tooltipSrc, type: 'post', data: datas, success: function success(data) { title = data; positioning($.tooltip.ajaxEvent); }, error: function error() { return; } }); } }; $.fn.extend({ tooltip: function tooltip(settings) { settings = $.extend({}, $.tooltip.defaults, settings); createHelper(settings); return this.each(function () { $.data(this, 'tooltip', settings); // copy tooltip into its own expando and remove the title this.tooltipText = $(this).attr('title'); this.tooltipSrc = $(this).attr('tooltipsrc'); this.ajaxLoad = $.trim(this.tooltipText) === '' && this.tooltipSrc !== ''; this.ajaxTimeout; this.orEl = $(this); $(this).removeAttr('title'); // also remove alt attribute to prevent default tooltip in IE this.alt = ''; }).mouseover(save).mouseout(hide).mouseleave(function () { if (settings.isBrowsable) { $.tooltip.currentHover = false; // close caption container after a small delay // (safe travel delay of the mouse between thumbnail and caption / allow user to cross // boundaries without unexpected closing of the catpion) setTimeout(function () { hide(); }, 500); } }).mousedown(fix); }, fixPNG: IE ? function () { return this.each(function () { var image = $(this).css('backgroundImage'); if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) { image = RegExp.$1; $(this).css({ backgroundImage: 'none', filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" }).each(function () { var position = $(this).css('position'); if (position !== 'absolute' && position !== 'relative') $(this).css('position', 'relative'); }); } }); } : function () { return this; }, unfixPNG: IE ? function () { return this.each(function () { $(this).css({ filter: '', backgroundImage: '' }); }); } : function () { return this; }, hideWhenEmpty: function hideWhenEmpty() { return this.each(function () { $(this)[$(this).html() ? 'show' : 'hide'](); }); }, url: function url() { return this.attr('href') || this.attr('src'); } }); function createHelper(settings) { // there can be only one tooltip helper if (helper.parent) return; // create the helper, h3 for title, div for url helper.parent = $('
') // add to document .appendTo(document.body) // hide it at first .hide(); // apply bgiframe if available if ($.fn.bgiframe) helper.parent.bgiframe(); // save references to title and url elements helper.title = $('h3', helper.parent); helper.body = $('div.body', helper.parent); helper.url = $('div.url', helper.parent); } function settings(element) { return $.data(element, 'tooltip'); } // main event handler to start showing tooltips function handle(event) { if ($($.tooltip.current).hasClass('SSTT') && $($.tooltip.current).hasClass('ui-state-active')) return; // show helper, either with timeout or on instant if (settings(this).delay) tID = setTimeout(visible, settings(this).delay);else visible(); show(); // if selected, update the helper position when the mouse moves track = !!settings(this).track; $(document.body).bind('mousemove', update); // update at least once update(event); } // save elements title before the tooltip is displayed function save(event) { // if this is the current source, or it has no title (occurs with click event), stop if (event.stopPropagation) event.stopPropagation(); event.cancelBubble = true; if ($.tooltip.blocked || this === $.tooltip.current || !this.tooltipText && !this.tooltipSrc && !settings(this).bodyHandler) return; // save current $.tooltip.current = this; title = this.tooltipText; // if element has href or src, add and show it, otherwise hide it if (settings(this).showURL && $(this).url()) helper.url.html($(this).url().replace('http://', '')).show();else helper.url.hide(); // add an optional class for this tip helper.parent.removeClass(); helper.parent.addClass(settings(this).extraClass); if (this.ajaxLoad) { // @TODO debounce instead of timeout clearTimeout($.tooltip.ajaxTimeout); $.tooltip.ajaxTimeout = setTimeout($.tooltip.delayAjax, 300); $.tooltip.ajaxEvent = event; } else { title = '
' + '
' + '
' + '
' + title + '
' + '
' + '
'; positioning.apply(this, arguments); } return; } function positioning(event) { helper.body.html(title); helper.body.show(); var $this = $.tooltip.current; var tooltipSettings = settings($this) ? settings($this) : {}; var fixedPosition = $.tooltip.blocked; // fix PNG background for IE if (tooltipSettings.fixPNG) helper.parent.fixPNG(); if (tooltipSettings.outside) { var width = 'auto'; var height = 'auto'; var tooltipId = tooltipSettings.id; var $defaultTips = $('#' + tooltipId); var customId = 'phraseanet-embed-tooltip-frame'; $defaultTips.find('#phraseanet-embed-frame').attr('id', customId); var $audioTips = $('#' + tooltipId + ' .audioTips'); var $imgTips = $('#' + tooltipId + ' .imgTips'); var $videoTips = $('#' + tooltipId + ' .videoTips'); var $documentTips = $('#' + tooltipId + ' .documentTips'); var shouldResize = $('#' + tooltipId + ' .noToolTipResize').length === 0 ? true : false; // get image or video original dimensions var recordWidth = 400; var recordHeight = 0; var tooltipVerticalOffset = 75; var tooltipHorizontalOffset = 35; var maxWidthAllowed = 1024; var maxHeightAllowed = 768; var tooltipWidth = 0; var tooltipHeight = 0; var viewportDimensions = viewport(); var left = 0; var top = 0; var recordWidthOffset = 0; var recordHeightOffset = 0; var topOffset = 0; var leftOffset = 0; var rightOffset = 0; var bottomOffset = 0; var $selector = $defaultTips; if ($imgTips[0] && shouldResize) { recordWidth = parseInt($imgTips[0].style.width, 10); recordHeight = parseInt($imgTips[0].style.height, 10); $imgTips.css({ display: 'block', margin: '0 auto' }); $selector = $imgTips; } else if ($documentTips[0] && shouldResize) { var recordUrl = $documentTips.data('src'); recordWidth = $documentTips.data('original-width') > 400 ? $documentTips.data('original-width') : 400; recordHeight = $documentTips.data('original-width') > 400 ? $documentTips.data('original-height') : 600; $documentTips.css({ display: 'block', margin: '0 auto' }); $selector = $documentTips; activeThumbnailFrame = new pym.Parent(customId, recordUrl); activeThumbnailFrame.iframe.setAttribute('allowfullscreen', ''); } else if ($audioTips[0] && shouldResize) { var _recordUrl = $audioTips.data('src'); recordWidth = 240; recordHeight = 240; $audioTips.css({ display: 'block', margin: '0 auto' }); $selector = $audioTips; activeThumbnailFrame = new pym.Parent(customId, _recordUrl); activeThumbnailFrame.iframe.setAttribute('allowfullscreen', ''); } else if ($videoTips[0] && shouldResize) { var _recordUrl2 = $videoTips.data('src'); recordWidth = $videoTips.data('original-width'); recordHeight = $videoTips.data('original-height'); // limit video to maxWidth: /*if( recordWidth > 720 ) { let limitRatio = recordWidth/recordHeight; recordWidth = 720; recordHeight = recordWidth / limitRatio; }*/ $videoTips.css({ display: 'block', margin: '0 auto' }); $selector = $videoTips; activeThumbnailFrame = new pym.Parent(customId, _recordUrl2); activeThumbnailFrame.iframe.setAttribute('allowfullscreen', ''); //activeThumbnailFrame.iframe.setAttribute('height', '100%'); } else { // handle captions if ($selector.find('.popover').length > 0) { recordWidth = parseInt($selector.find('.popover')[0].style.width, 10) || recordWidth; } var contentHeight = $selector.height(); shouldResize = false; tooltipVerticalOffset = 13; recordHeight = contentHeight > maxHeightAllowed ? maxHeightAllowed : contentHeight; $selector.css({ height: 'auto' }); } tooltipWidth = recordWidth + tooltipHorizontalOffset; tooltipHeight = recordHeight + tooltipVerticalOffset; var rescale = function rescale(containerWidth, containerHeight, resourceWidth, resourceHeight, maxWidthAllowed, maxHeightAllowed, $selector) { var resourceRatio = resourceHeight / resourceWidth; var resizeW = resourceWidth; var resizeH = resourceHeight; if (resourceWidth > resourceHeight) { // if width still too large: if (resizeW > containerWidth) { resizeW = containerWidth; resizeH = containerWidth * resourceRatio; } if (resizeH > containerHeight) { resizeW = containerHeight / resourceRatio; resizeH = containerHeight; } } else { if (resizeH > containerHeight) { resizeW = containerHeight / resourceRatio; resizeH = containerHeight; } } if (maxWidthAllowed !== undefined && maxHeightAllowed !== undefined) { if (resizeW > maxWidthAllowed || resizeH > maxHeightAllowed) { return rescale(maxWidthAllowed, maxHeightAllowed, resourceWidth, resourceHeight); } } if ($selector !== undefined) { $selector.css({ width: Math.floor(resizeW), height: Math.floor(resizeH) }); } return { width: Math.floor(resizeW), height: Math.floor(resizeH) }; }; if (event) { var $origEventTarget = $(event.target); // previewTips // since event target can have different positionning, try to get common closest parent: var $eventTarget = $origEventTarget.closest('.diapo'); if ($eventTarget.length > 0) { // tooltip from records answer recordWidthOffset = $eventTarget.width() - 2; // remove width with margin/2 recordHeightOffset = $eventTarget.height() + 2; // remove height with margin/2 // change offsets: topOffset = 14; leftOffset = 1; rightOffset = 2; bottomOffset = -15; } else { // tooltip from workzone (basket) tooltipVerticalOffset = 0; tooltipHorizontalOffset = 0; topOffset = 50; // fallback on original target if nothing found: $eventTarget = $origEventTarget; } var recordPosition = $eventTarget.offset(); var totalViewportWidth = viewportDimensions.x; var totalViewportHeight = viewportDimensions.y; //for basket if (recordPosition.left < 30) { leftOffset = $('.insidebloc').width(); } var leftAvailableSpace = recordPosition.left + leftOffset; var topAvailableSpace = recordPosition.top + topOffset; var rightAvailableSpace = totalViewportWidth - leftAvailableSpace - recordWidthOffset - rightOffset; var bottomAvailableSpace = totalViewportHeight - topAvailableSpace - recordHeightOffset; var shouldBeOnTop = false; var availableHeight = bottomAvailableSpace; var tooltipSize = { width: tooltipWidth, height: tooltipHeight }; var position = 'top'; if (topAvailableSpace > bottomAvailableSpace) { shouldBeOnTop = true; availableHeight = topAvailableSpace; } if (leftAvailableSpace > rightAvailableSpace) { position = 'left'; } else { position = 'right'; } // prefer bottom position if tooltip is a small caption: if (bottomAvailableSpace > leftAvailableSpace && bottomAvailableSpace > rightAvailableSpace) { position = 'bottom'; } else if (shouldBeOnTop && availableHeight > leftAvailableSpace && availableHeight > rightAvailableSpace) { position = 'top'; } if (fixedPosition === true) { leftAvailableSpace = totalViewportWidth; topAvailableSpace = totalViewportHeight; position = 'top'; } switch (position) { case 'top': tooltipSize = rescale(totalViewportWidth, topAvailableSpace, tooltipWidth, tooltipHeight, maxWidthAllowed, maxHeightAllowed); tooltipWidth = tooltipSize.width; tooltipHeight = tooltipSize.height; left = leftAvailableSpace - tooltipSize.width / 2 + recordWidthOffset / 2; top = topAvailableSpace - tooltipSize.height; break; case 'bottom': tooltipSize = rescale(totalViewportWidth, bottomAvailableSpace, tooltipWidth, tooltipHeight, maxWidthAllowed, maxHeightAllowed); tooltipWidth = tooltipSize.width; tooltipHeight = tooltipSize.height; left = leftAvailableSpace - tooltipSize.width / 2 + recordWidthOffset / 2; top = totalViewportHeight - bottomAvailableSpace + bottomOffset; break; case 'left': tooltipSize = rescale(leftAvailableSpace, totalViewportHeight, tooltipWidth, tooltipHeight, maxWidthAllowed, maxHeightAllowed); tooltipWidth = tooltipSize.width; tooltipHeight = tooltipSize.height; left = leftAvailableSpace - tooltipSize.width; break; case 'right': tooltipSize = rescale(rightAvailableSpace, totalViewportHeight, tooltipWidth, tooltipHeight, maxWidthAllowed, maxHeightAllowed); tooltipWidth = tooltipSize.width; tooltipHeight = tooltipSize.height; left = leftAvailableSpace + recordWidthOffset + rightOffset; break; } // tooltipHeight = tooltipHeight + 18; // tooltipWidth = tooltipWidth + 28; if (fixedPosition === true) { left = totalViewportWidth / 2 - tooltipWidth / 2; top = totalViewportHeight / 2 - tooltipHeight / 2; } else { // try to vertical center, relative to source: if (position === 'left' || position === 'right') { var verticalSpace = topAvailableSpace + recordHeightOffset / 2 + tooltipHeight / 2; if (verticalSpace < totalViewportHeight) { // tooltip can be aligned vertically top = topAvailableSpace + recordHeightOffset / 2 - tooltipHeight / 2; } else { top = totalViewportHeight - tooltipHeight; } top = top < 0 ? 0 : top; } // try to horizontal center, relative to source: if (position === 'top' || position === 'bottom') { // push to left // push to right var takeLeftSpace = tooltipWidth / 2 + leftAvailableSpace; var takeRightSpace = tooltipWidth / 2 + rightAvailableSpace; // if centering on top or bottom and tooltip is offcanvas if (takeLeftSpace > totalViewportWidth || takeRightSpace > totalViewportWidth) { if (leftAvailableSpace > totalViewportWidth / 2) { // push at left left = 0; } else { // push at right left = totalViewportWidth - tooltipWidth; } } else { // center left = leftAvailableSpace - tooltipWidth / 2 + recordWidthOffset / 2; } } } var resizeProperties = { left: left, top: top }; if (shouldResize) { // rescale $selector css: rescale(tooltipWidth - tooltipHorizontalOffset, tooltipHeight - tooltipVerticalOffset, recordWidth, recordHeight, maxWidthAllowed, maxHeightAllowed, $selector); // reset non used css properties: resizeProperties['max-width'] = ''; resizeProperties['min-width'] = ''; } else { // ensure tooltip width match with left position resizeProperties['max-width'] = Math.round(tooltipWidth); resizeProperties['min-width'] = Math.round(tooltipWidth); } resizeProperties['width'] = shouldResize ? Math.round(tooltipWidth) : 'auto'; resizeProperties['height'] = shouldResize ? Math.round(tooltipHeight) : 'auto'; helper.parent.css(resizeProperties); } } handle.apply($this, arguments); return; } // delete timeout and show helper function show() { tID = null; var isBrowsable = false; if ($.tooltip.current !== null) { isBrowsable = settings($.tooltip.current).isBrowsable; } if ((!IE || !$.fn.bgiframe) && settings($.tooltip.current).fade) { if (helper.parent.is(':animated')) helper.parent.stop().show().fadeTo(settings($.tooltip.current).fade, 100);else helper.parent.is(':visible') ? helper.parent.fadeTo(settings($.tooltip.current).fade, 100) : helper.parent.fadeIn(settings($.tooltip.current).fade); } else { helper.parent.show(); } $(helper.parent[0]).unbind('mouseenter').unbind('mouseleave').mouseenter(function () { if (isBrowsable) { $.tooltip.currentHover = true; } }).mouseleave(function () { if (isBrowsable) { // if tooltip has scrollable content or selectionnable text - should be closed on mouseleave: $.tooltip.currentHover = false; helper.parent.hide(); } }); update(); } function fix(event) { if (!$.tooltip.current) { return; } if (!$(this).hasClass('captionTips') || !event.altKey) { if (!settings(this).fixable) { hide(event); return; } } event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); showOverlay('_tooltip', 'body', unfixTooltip, settings(this).fixableIndex); $('#tooltip .tooltip_closer').show().bind('click', unfixTooltip); $.tooltip.blocked = true; positioning.apply(this, arguments); } function visible() { $.tooltip.visible = true; helper.parent.css({ visibility: 'visible' }); } /** * callback for mousemove * updates the helper position * removes itself when no current element */ function update(event) { if ($.tooltip.blocked) return; if (event && event.target.tagName === 'OPTION') { return; } // stop updating when tracking is disabled and the tooltip is visible if (!track && helper.parent.is(':visible')) { $(document.body).unbind('mousemove', update); $.tooltip.currentHover = true; } // if no current element is available, remove this listener if ($.tooltip.current === null) { $(document.body).unbind('mousemove', update); $.tooltip.currentHover = false; return; } // remove position helper classes helper.parent.removeClass('viewport-right').removeClass('viewport-bottom'); if (!settings($.tooltip.current).outside) { var left = helper.parent[0].offsetLeft; var top = helper.parent[0].offsetTop; helper.parent.width('auto'); helper.parent.height('auto'); if (event) { // position the helper 15 pixel to bottom right, starting from mouse position left = event.pageX + settings($.tooltip.current).left; top = event.pageY + settings($.tooltip.current).top; var right = 'auto'; if (settings($.tooltip.current).positionLeft) { right = $(window).width() - left; left = 'auto'; } helper.parent.css({ left: left, right: right, top: top }); } var v = viewport(), h = helper.parent[0]; // check horizontal position if (v.x + v.cx < h.offsetLeft + h.offsetWidth) { left -= h.offsetWidth + 20 + settings($.tooltip.current).left; helper.parent.css({ left: left + 'px' }).addClass('viewport-right'); } // check vertical position if (v.y + v.cy < h.offsetTop + h.offsetHeight) { top -= h.offsetHeight + 20 + settings($.tooltip.current).top; helper.parent.css({ top: top + 'px' }).addClass('viewport-bottom'); } } } function viewport() { return { x: $(window).width(), y: $(window).height(), cx: 0, cy: 0 }; } // hide helper and restore added classes and the title function hide(event) { var isBrowsable = false; if ($.tooltip.current !== null) { isBrowsable = settings($.tooltip.current).isBrowsable; } if ($.tooltip.currentHover && isBrowsable) { return; } if ($.tooltip.blocked || !$.tooltip.current) return; $(helper.parent[0]).unbind('mouseenter').unbind('mouseleave'); // clear timeout if possible if (tID) clearTimeout(tID); // no more current element $.tooltip.visible = false; var tsettings = settings($.tooltip.current); clearTimeout($.tooltip.ajaxTimeout); if ($.tooltip.ajaxRequest && $.tooltip.ajaxRequest.abort) { $.tooltip.ajaxRequest.abort(); } helper.body.empty(); $.tooltip.current = null; function complete() { helper.parent.removeClass(tsettings.extraClass).hide().css('opacity', ''); } if ((!IE || !$.fn.bgiframe) && tsettings.fade) { if (helper.parent.is(':animated')) helper.parent.stop().fadeTo(tsettings.fade, 0, complete);else helper.parent.stop().fadeOut(tsettings.fade, complete); } else complete(); if (tsettings.fixPNG) helper.parent.unfixPNG(); } function unfixTooltip() { $.tooltip.blocked = false; $.tooltip.visible = false; $.tooltip.current = null; $('#tooltip').hide(); $('#tooltip .tooltip_closer').hide(); hideOverlay('_tooltip'); } var showOverlay = function showOverlay(n, appendto, callback, zIndex) { var div = 'OVERLAY'; if (typeof n !== 'undefined') div += n; if ($('#' + div).length === 0) { if (typeof appendto === 'undefined') appendto = 'body'; $(appendto).append(''); } var css = { display: 'block', opacity: 0, right: 0, bottom: 0, position: 'absolute', top: 0, zIndex: zIndex, left: 0 }; if (parseInt(zIndex, 10) > 0) css['zIndex'] = parseInt(zIndex, 10); if (typeof callback !== 'function') callback = function callback() {}; $('#' + div).css(css).addClass('overlay').fadeTo(500, 0.7).bind('click', function () { callback(); }); if (navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/)) { $('select').css({ visibility: 'hidden' }); } }; var hideOverlay = function hideOverlay(n) { if (navigator.userAgent.match(/msie/i) && navigator.userAgent.match(/6/)) { $('select').css({ visibility: 'visible' }); } var div = 'OVERLAY'; if (typeof n !== 'undefined') div += n; $('#' + div).hide().remove(); }; return { unfixTooltip: unfixTooltip }; })(jQuery); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /***/ }), /***/ 15: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _rx = __webpack_require__(7); var Rx = _interopRequireWildcard(_rx); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } var hasOwnProp = {}.hasOwnProperty; function createName(name) { return '$' + name; } var Emitter = function Emitter() { this.subjects = {}; }; Emitter.prototype.emit = function (name, data) { var fnName = createName(name); this.subjects[fnName] || (this.subjects[fnName] = new Rx.Subject()); this.subjects[fnName].onNext(data); return this.subjects[fnName]; }; Emitter.prototype.listen = function (name, handler) { var fnName = createName(name); this.subjects[fnName] || (this.subjects[fnName] = new Rx.Subject()); return this.subjects[fnName].subscribe(handler); }; Emitter.prototype.listenAll = function (group, name, handler) { for (var prop in group) { var fnName = createName(prop); this.subjects[fnName] || (this.subjects[fnName] = new Rx.Subject()); this.subjects[fnName].subscribe(group[prop]); } }; Emitter.prototype.disposeOf = function (startWith) { var search = new RegExp('^\\$' + startWith); var subjects = this.subjects; for (var prop in subjects) { if (hasOwnProp.call(subjects, prop)) { if (search.test(prop)) { subjects[prop].dispose(); } } } this.subjects = {}; }; Emitter.prototype.dispose = function () { var subjects = this.subjects; for (var prop in subjects) { if (hasOwnProp.call(subjects, prop)) { subjects[prop].dispose(); } } this.subjects = {}; }; exports.default = Emitter; /***/ }), /***/ 16: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _applicationConfigService = __webpack_require__(18); var _applicationConfigService2 = _interopRequireDefault(_applicationConfigService); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _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; } function _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, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var instance = null; var ConfigService = function (_ApplicationConfigSer) { _inherits(ConfigService, _ApplicationConfigSer); function ConfigService(configuration) { var _ret; _classCallCheck(this, ConfigService); var _this = _possibleConstructorReturn(this, (ConfigService.__proto__ || Object.getPrototypeOf(ConfigService)).call(this, configuration)); if (!instance) { instance = _this; } return _ret = instance, _possibleConstructorReturn(_this, _ret); } return ConfigService; }(_applicationConfigService2.default); exports.default = ConfigService; /***/ }), /***/ 17: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! pym.js - v1.3.2 - 2018-02-13 */ /* * Pym.js is library that resizes an iframe based on the width of the parent and the resulting height of the child. * Check out the docs at http://blog.apps.npr.org/pym.js/ or the readme at README.md for usage. */ /** @module pym */ (function(factory) { if (true) { !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof module !== 'undefined' && module.exports) { module.exports = factory(); } else { window.pym = factory.call(this); } })(function() { var MESSAGE_DELIMITER = 'xPYMx'; var lib = {}; /** * Create and dispatch a custom pym event * * @method _raiseCustomEvent * @inner * * @param {String} eventName */ var _raiseCustomEvent = function(eventName) { var event = document.createEvent('Event'); event.initEvent('pym:' + eventName, true, true); document.dispatchEvent(event); }; /** * Generic function for parsing URL params. * Via http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript * * @method _getParameterByName * @inner * * @param {String} name The name of the paramter to get from the URL. */ var _getParameterByName = function(name) { var regex = new RegExp("[\\?&]" + name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]') + '=([^&#]*)'); var results = regex.exec(location.search); if (results === null) { return ''; } return decodeURIComponent(results[1].replace(/\+/g, " ")); }; /** * Check the message to make sure it comes from an acceptable xdomain. * Defaults to '*' but can be overriden in config. * * @method _isSafeMessage * @inner * * @param {Event} e The message event. * @param {Object} settings Configuration. */ var _isSafeMessage = function(e, settings) { if (settings.xdomain !== '*') { // If origin doesn't match our xdomain, return. if (!e.origin.match(new RegExp(settings.xdomain + '$'))) { return; } } // Ignore events that do not carry string data #151 if (typeof e.data !== 'string') { return; } return true; }; var _isSafeUrl = function(url) { // Adapted from angular 2 url sanitizer var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp):|[^&:/?#]*(?:[/?#]|$))/gi; if (!url.match(SAFE_URL_PATTERN)) { return; } return true; }; /** * Construct a message to send between frames. * * NB: We use string-building here because JSON message passing is * not supported in all browsers. * * @method _makeMessage * @inner * * @param {String} id The unique id of the message recipient. * @param {String} messageType The type of message to send. * @param {String} message The message to send. */ var _makeMessage = function(id, messageType, message) { var bits = ['pym', id, messageType, message]; return bits.join(MESSAGE_DELIMITER); }; /** * Construct a regex to validate and parse messages. * * @method _makeMessageRegex * @inner * * @param {String} id The unique id of the message recipient. */ var _makeMessageRegex = function(id) { var bits = ['pym', id, '(\\S+)', '(.*)']; return new RegExp('^' + bits.join(MESSAGE_DELIMITER) + '$'); }; /** * Underscore implementation of getNow * * @method _getNow * @inner * */ var _getNow = Date.now || function() { return new Date().getTime(); }; /** * Underscore implementation of throttle * * @method _throttle * @inner * * @param {function} func Throttled function * @param {number} wait Throttle wait time * @param {object} options Throttle settings */ var _throttle = function(func, wait, options) { var context, args, result; var timeout = null; var previous = 0; if (!options) {options = {};} var later = function() { previous = options.leading === false ? 0 : _getNow(); timeout = null; result = func.apply(context, args); if (!timeout) {context = args = null;} }; return function() { var now = _getNow(); if (!previous && options.leading === false) {previous = now;} var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { clearTimeout(timeout); timeout = null; } previous = now; result = func.apply(context, args); if (!timeout) {context = args = null;} } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; }; /** * Clean autoInit Instances: those that point to contentless iframes * @method _cleanAutoInitInstances * @inner */ var _cleanAutoInitInstances = function() { var length = lib.autoInitInstances.length; // Loop backwards to avoid index issues for (var idx = length - 1; idx >= 0; idx--) { var instance = lib.autoInitInstances[idx]; // If instance has been removed or is contentless then remove it if (instance.el.getElementsByTagName('iframe').length && instance.el.getElementsByTagName('iframe')[0].contentWindow) { continue; } else { // Remove the reference to the removed or orphan instance lib.autoInitInstances.splice(idx,1); } } }; /** * Store auto initialized Pym instances for further reference * @name module:pym#autoInitInstances * @type Array * @default [] */ lib.autoInitInstances = []; /** * Initialize Pym for elements on page that have data-pym attributes. * Expose autoinit in case we need to call it from the outside * @instance * @method autoInit * @param {Boolean} doNotRaiseEvents flag to avoid sending custom events */ lib.autoInit = function(doNotRaiseEvents) { var elements = document.querySelectorAll('[data-pym-src]:not([data-pym-auto-initialized])'); var length = elements.length; // Clean stored instances in case needed _cleanAutoInitInstances(); for (var idx = 0; idx < length; ++idx) { var element = elements[idx]; /* * Mark automatically-initialized elements so they are not * re-initialized if the user includes pym.js more than once in the * same document. */ element.setAttribute('data-pym-auto-initialized', ''); // Ensure elements have an id if (element.id === '') { element.id = 'pym-' + idx + "-" + Math.random().toString(36).substr(2,5); } var src = element.getAttribute('data-pym-src'); // List of data attributes to configure the component // structure: {'attribute name': 'type'} var settings = {'xdomain': 'string', 'title': 'string', 'name': 'string', 'id': 'string', 'sandbox': 'string', 'allowfullscreen': 'boolean', 'parenturlparam': 'string', 'parenturlvalue': 'string', 'optionalparams': 'boolean', 'trackscroll': 'boolean', 'scrollwait': 'number'}; var config = {}; for (var attribute in settings) { // via https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute#Notes if (element.getAttribute('data-pym-'+attribute) !== null) { switch (settings[attribute]) { case 'boolean': config[attribute] = !(element.getAttribute('data-pym-'+attribute) === 'false'); // jshint ignore:line break; case 'string': config[attribute] = element.getAttribute('data-pym-'+attribute); break; case 'number': var n = Number(element.getAttribute('data-pym-'+attribute)); if (!isNaN(n)) { config[attribute] = n; } break; default: console.err('unrecognized attribute type'); } } } // Store references to autoinitialized pym instances var parent = new lib.Parent(element.id, src, config); lib.autoInitInstances.push(parent); } // Fire customEvent if (!doNotRaiseEvents) { _raiseCustomEvent("pym-initialized"); } // Return stored autoinitalized pym instances return lib.autoInitInstances; }; /** * The Parent half of a response iframe. * * @memberof module:pym * @class Parent * @param {String} id The id of the div into which the iframe will be rendered. sets {@link module:pym.Parent~id} * @param {String} url The url of the iframe source. sets {@link module:pym.Parent~url} * @param {Object} [config] Configuration for the parent instance. sets {@link module:pym.Parent~settings} * @param {string} [config.xdomain='*'] - xdomain to validate messages received * @param {string} [config.title] - if passed it will be assigned to the iframe title attribute * @param {string} [config.name] - if passed it will be assigned to the iframe name attribute * @param {string} [config.id] - if passed it will be assigned to the iframe id attribute * @param {boolean} [config.allowfullscreen] - if passed and different than false it will be assigned to the iframe allowfullscreen attribute * @param {string} [config.sandbox] - if passed it will be assigned to the iframe sandbox attribute (we do not validate the syntax so be careful!!) * @param {string} [config.parenturlparam] - if passed it will be override the default parentUrl query string parameter name passed to the iframe src * @param {string} [config.parenturlvalue] - if passed it will be override the default parentUrl query string parameter value passed to the iframe src * @param {string} [config.optionalparams] - if passed and different than false it will strip the querystring params parentUrl and parentTitle passed to the iframe src * @param {boolean} [config.trackscroll] - if passed it will activate scroll tracking on the parent * @param {number} [config.scrollwait] - if passed it will set the throttle wait in order to fire scroll messaging. Defaults to 100 ms. * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe iFrame} */ lib.Parent = function(id, url, config) { /** * The id of the container element * * @memberof module:pym.Parent * @member {string} id * @inner */ this.id = id; /** * The url that will be set as the iframe's src * * @memberof module:pym.Parent * @member {String} url * @inner */ this.url = url; /** * The container DOM object * * @memberof module:pym.Parent * @member {HTMLElement} el * @inner */ this.el = document.getElementById(id); /** * The contained child iframe * * @memberof module:pym.Parent * @member {HTMLElement} iframe * @inner * @default null */ this.iframe = null; /** * The parent instance settings, updated by the values passed in the config object * * @memberof module:pym.Parent * @member {Object} settings * @inner */ this.settings = { xdomain: '*', optionalparams: true, parenturlparam: 'parentUrl', parenturlvalue: window.location.href, trackscroll: false, scrollwait: 100, }; /** * RegularExpression to validate the received messages * * @memberof module:pym.Parent * @member {String} messageRegex * @inner */ this.messageRegex = _makeMessageRegex(this.id); /** * Stores the registered messageHandlers for each messageType * * @memberof module:pym.Parent * @member {Object} messageHandlers * @inner */ this.messageHandlers = {}; // ensure a config object config = (config || {}); /** * Construct the iframe. * * @memberof module:pym.Parent * @method _constructIframe * @inner */ this._constructIframe = function() { // Calculate the width of this element. var width = this.el.offsetWidth.toString(); // Create an iframe element attached to the document. this.iframe = document.createElement('iframe'); // Save fragment id var hash = ''; var hashIndex = this.url.indexOf('#'); if (hashIndex > -1) { hash = this.url.substring(hashIndex, this.url.length); this.url = this.url.substring(0, hashIndex); } // If the URL contains querystring bits, use them. // Otherwise, just create a set of valid params. if (this.url.indexOf('?') < 0) { this.url += '?'; } else { this.url += '&'; } // Append the initial width as a querystring parameter // and optional params if configured to do so this.iframe.src = this.url + 'initialWidth=' + width + '&childId=' + this.id; if (this.settings.optionalparams) { this.iframe.src += '&parentTitle=' + encodeURIComponent(document.title); this.iframe.src += '&'+ this.settings.parenturlparam + '=' + encodeURIComponent(this.settings.parenturlvalue); } this.iframe.src +=hash; // Set some attributes to this proto-iframe. this.iframe.setAttribute('width', '100%'); this.iframe.setAttribute('scrolling', 'no'); this.iframe.setAttribute('marginheight', '0'); this.iframe.setAttribute('frameborder', '0'); if (this.settings.title) { this.iframe.setAttribute('title', this.settings.title); } if (this.settings.allowfullscreen !== undefined && this.settings.allowfullscreen !== false) { this.iframe.setAttribute('allowfullscreen',''); } if (this.settings.sandbox !== undefined && typeof this.settings.sandbox === 'string') { this.iframe.setAttribute('sandbox', this.settings.sandbox); } if (this.settings.id) { if (!document.getElementById(this.settings.id)) { this.iframe.setAttribute('id', this.settings.id); } } if (this.settings.name) { this.iframe.setAttribute('name', this.settings.name); } // Replace the child content if needed // (some CMSs might strip out empty elements) while(this.el.firstChild) { this.el.removeChild(this.el.firstChild); } // Append the iframe to our element. this.el.appendChild(this.iframe); // Add an event listener that will handle redrawing the child on resize. window.addEventListener('resize', this._onResize); // Add an event listener that will send the child the viewport. if (this.settings.trackscroll) { window.addEventListener('scroll', this._throttleOnScroll); } }; /** * Send width on resize. * * @memberof module:pym.Parent * @method _onResize * @inner */ this._onResize = function() { this.sendWidth(); if (this.settings.trackscroll) { this.sendViewportAndIFramePosition(); } }.bind(this); /** * Send viewport and iframe info on scroll. * * @memberof module:pym.Parent * @method _onScroll * @inner */ this._onScroll = function() { this.sendViewportAndIFramePosition(); }.bind(this); /** * Fire all event handlers for a given message type. * * @memberof module:pym.Parent * @method _fire * @inner * * @param {String} messageType The type of message. * @param {String} message The message data. */ this._fire = function(messageType, message) { if (messageType in this.messageHandlers) { for (var i = 0; i < this.messageHandlers[messageType].length; i++) { this.messageHandlers[messageType][i].call(this, message); } } }; /** * Remove this parent from the page and unbind it's event handlers. * * @memberof module:pym.Parent * @method remove * @instance */ this.remove = function() { window.removeEventListener('message', this._processMessage); window.removeEventListener('resize', this._onResize); this.el.removeChild(this.iframe); // _cleanAutoInitInstances in case this parent was autoInitialized _cleanAutoInitInstances(); }; /** * Process a new message from the child. * * @memberof module:pym.Parent * @method _processMessage * @inner * * @param {Event} e A message event. */ this._processMessage = function(e) { // First, punt if this isn't from an acceptable xdomain. if (!_isSafeMessage(e, this.settings)) { return; } // Discard object messages, we only care about strings if (typeof e.data !== 'string') { return; } // Grab the message from the child and parse it. var match = e.data.match(this.messageRegex); // If there's no match or too many matches in the message, punt. if (!match || match.length !== 3) { return false; } var messageType = match[1]; var message = match[2]; this._fire(messageType, message); }.bind(this); /** * Resize iframe in response to new height message from child. * * @memberof module:pym.Parent * @method _onHeightMessage * @inner * * @param {String} message The new height. */ this._onHeightMessage = function(message) { /* * Handle parent height message from child. */ var height = parseInt(message); this.iframe.setAttribute('height', height + 'px'); }; /** * Navigate parent to a new url. * * @memberof module:pym.Parent * @method _onNavigateToMessage * @inner * * @param {String} message The url to navigate to. */ this._onNavigateToMessage = function(message) { /* * Handle parent scroll message from child. */ if (!_isSafeUrl(message)) {return;} document.location.href = message; }; /** * Scroll parent to a given child position. * * @memberof module:pym.Parent * @method _onScrollToChildPosMessage * @inner * * @param {String} message The offset inside the child page. */ this._onScrollToChildPosMessage = function(message) { // Get the child container position using getBoundingClientRect + pageYOffset // via https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect var iframePos = document.getElementById(this.id).getBoundingClientRect().top + window.pageYOffset; var totalOffset = iframePos + parseInt(message); window.scrollTo(0, totalOffset); }; /** * Bind a callback to a given messageType from the child. * * Reserved message names are: "height", "scrollTo" and "navigateTo". * * @memberof module:pym.Parent * @method onMessage * @instance * * @param {String} messageType The type of message being listened for. * @param {module:pym.Parent~onMessageCallback} callback The callback to invoke when a message of the given type is received. */ this.onMessage = function(messageType, callback) { if (!(messageType in this.messageHandlers)) { this.messageHandlers[messageType] = []; } this.messageHandlers[messageType].push(callback); }; /** * @callback module:pym.Parent~onMessageCallback * @param {String} message The message data. */ /** * Send a message to the the child. * * @memberof module:pym.Parent * @method sendMessage * @instance * * @param {String} messageType The type of message to send. * @param {String} message The message data to send. */ this.sendMessage = function(messageType, message) { // When used alongside with pjax some references are lost if (this.el.getElementsByTagName('iframe').length) { if (this.el.getElementsByTagName('iframe')[0].contentWindow) { this.el.getElementsByTagName('iframe')[0].contentWindow .postMessage(_makeMessage(this.id, messageType, message), '*'); } else { // Contentless child detected remove listeners and iframe this.remove(); } } }; /** * Transmit the current iframe width to the child. * * You shouldn't need to call this directly. * * @memberof module:pym.Parent * @method sendWidth * @instance */ this.sendWidth = function() { var width = this.el.offsetWidth.toString(); this.sendMessage('width', width); }; /** * Transmit the current viewport and iframe position to the child. * Sends viewport width, viewport height * and iframe bounding rect top-left-bottom-right * all separated by spaces * * You shouldn't need to call this directly. * * @memberof module:pym.Parent * @method sendViewportAndIFramePosition * @instance */ this.sendViewportAndIFramePosition = function() { var iframeRect = this.iframe.getBoundingClientRect(); var vWidth = window.innerWidth || document.documentElement.clientWidth; var vHeight = window.innerHeight || document.documentElement.clientHeight; var payload = vWidth + ' ' + vHeight; payload += ' ' + iframeRect.top + ' ' + iframeRect.left; payload += ' ' + iframeRect.bottom + ' ' + iframeRect.right; this.sendMessage('viewport-iframe-position', payload); }; // Add any overrides to settings coming from config. for (var key in config) { this.settings[key] = config[key]; } /** * Throttled scroll function. * * @memberof module:pym.Parent * @method _throttleOnScroll * @inner */ this._throttleOnScroll = _throttle(this._onScroll.bind(this), this.settings.scrollwait); // Bind required message handlers this.onMessage('height', this._onHeightMessage); this.onMessage('navigateTo', this._onNavigateToMessage); this.onMessage('scrollToChildPos', this._onScrollToChildPosMessage); this.onMessage('parentPositionInfo', this.sendViewportAndIFramePosition); // Add a listener for processing messages from the child. window.addEventListener('message', this._processMessage, false); // Construct the iframe in the container element. this._constructIframe(); return this; }; /** * The Child half of a responsive iframe. * * @memberof module:pym * @class Child * @param {Object} [config] Configuration for the child instance. sets {@link module:pym.Child~settings} * @param {function} [config.renderCallback=null] Callback invoked after receiving a resize event from the parent, sets {@link module:pym.Child#settings.renderCallback} * @param {string} [config.xdomain='*'] - xdomain to validate messages received * @param {number} [config.polling=0] - polling frequency in milliseconds to send height to parent * @param {number} [config.id] - parent container id used when navigating the child iframe to a new page but we want to keep it responsive. * @param {string} [config.parenturlparam] - if passed it will be override the default parentUrl query string parameter name expected on the iframe src */ lib.Child = function(config) { /** * The initial width of the parent page * * @memberof module:pym.Child * @member {string} parentWidth * @inner */ this.parentWidth = null; /** * The id of the parent container * * @memberof module:pym.Child * @member {String} id * @inner */ this.id = null; /** * The title of the parent page from document.title. * * @memberof module:pym.Child * @member {String} parentTitle * @inner */ this.parentTitle = null; /** * The URL of the parent page from window.location.href. * * @memberof module:pym.Child * @member {String} parentUrl * @inner */ this.parentUrl = null; /** * The settings for the child instance. Can be overriden by passing a config object to the child constructor * i.e.: var pymChild = new pym.Child({renderCallback: render, xdomain: "\\*\.npr\.org"}) * * @memberof module:pym.Child.settings * @member {Object} settings - default settings for the child instance * @inner */ this.settings = { renderCallback: null, xdomain: '*', polling: 0, parenturlparam: 'parentUrl' }; /** * The timerId in order to be able to stop when polling is enabled * * @memberof module:pym.Child * @member {String} timerId * @inner */ this.timerId = null; /** * RegularExpression to validate the received messages * * @memberof module:pym.Child * @member {String} messageRegex * @inner */ this.messageRegex = null; /** * Stores the registered messageHandlers for each messageType * * @memberof module:pym.Child * @member {Object} messageHandlers * @inner */ this.messageHandlers = {}; // Ensure a config object config = (config || {}); /** * Bind a callback to a given messageType from the child. * * Reserved message names are: "width". * * @memberof module:pym.Child * @method onMessage * @instance * * @param {String} messageType The type of message being listened for. * @param {module:pym.Child~onMessageCallback} callback The callback to invoke when a message of the given type is received. */ this.onMessage = function(messageType, callback) { if (!(messageType in this.messageHandlers)) { this.messageHandlers[messageType] = []; } this.messageHandlers[messageType].push(callback); }; /** * @callback module:pym.Child~onMessageCallback * @param {String} message The message data. */ /** * Fire all event handlers for a given message type. * * @memberof module:pym.Child * @method _fire * @inner * * @param {String} messageType The type of message. * @param {String} message The message data. */ this._fire = function(messageType, message) { /* * Fire all event handlers for a given message type. */ if (messageType in this.messageHandlers) { for (var i = 0; i < this.messageHandlers[messageType].length; i++) { this.messageHandlers[messageType][i].call(this, message); } } }; /** * Process a new message from the parent. * * @memberof module:pym.Child * @method _processMessage * @inner * * @param {Event} e A message event. */ this._processMessage = function(e) { /* * Process a new message from parent frame. */ // First, punt if this isn't from an acceptable xdomain. if (!_isSafeMessage(e, this.settings)) { return; } // Discard object messages, we only care about strings if (typeof e.data !== 'string') { return; } // Get the message from the parent. var match = e.data.match(this.messageRegex); // If there's no match or it's a bad format, punt. if (!match || match.length !== 3) { return; } var messageType = match[1]; var message = match[2]; this._fire(messageType, message); }.bind(this); /** * Resize iframe in response to new width message from parent. * * @memberof module:pym.Child * @method _onWidthMessage * @inner * * @param {String} message The new width. */ this._onWidthMessage = function(message) { /* * Handle width message from the child. */ var width = parseInt(message); // Change the width if it's different. if (width !== this.parentWidth) { this.parentWidth = width; // Call the callback function if it exists. if (this.settings.renderCallback) { this.settings.renderCallback(width); } // Send the height back to the parent. this.sendHeight(); } }; /** * Send a message to the the Parent. * * @memberof module:pym.Child * @method sendMessage * @instance * * @param {String} messageType The type of message to send. * @param {String} message The message data to send. */ this.sendMessage = function(messageType, message) { /* * Send a message to the parent. */ window.parent.postMessage(_makeMessage(this.id, messageType, message), '*'); }; /** * Transmit the current iframe height to the parent. * * Call this directly in cases where you manually alter the height of the iframe contents. * * @memberof module:pym.Child * @method sendHeight * @instance */ this.sendHeight = function() { // Get the child's height. var height = document.getElementsByTagName('body')[0].offsetHeight.toString(); // Send the height to the parent. this.sendMessage('height', height); return height; }.bind(this); /** * Ask parent to send the current viewport and iframe position information * * @memberof module:pym.Child * @method sendHeight * @instance */ this.getParentPositionInfo = function() { // Send the height to the parent. this.sendMessage('parentPositionInfo'); }; /** * Scroll parent to a given element id. * * @memberof module:pym.Child * @method scrollParentTo * @instance * * @param {String} hash The id of the element to scroll to. */ this.scrollParentTo = function(hash) { this.sendMessage('navigateTo', '#' + hash); }; /** * Navigate parent to a given url. * * @memberof module:pym.Child * @method navigateParentTo * @instance * * @param {String} url The url to navigate to. */ this.navigateParentTo = function(url) { this.sendMessage('navigateTo', url); }; /** * Scroll parent to a given child element id. * * @memberof module:pym.Child * @method scrollParentToChildEl * @instance * * @param {String} id The id of the child element to scroll to. */ this.scrollParentToChildEl = function(id) { // Get the child element position using getBoundingClientRect + pageYOffset // via https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect var topPos = document.getElementById(id).getBoundingClientRect().top + window.pageYOffset; this.scrollParentToChildPos(topPos); }; /** * Scroll parent to a particular child offset. * * @memberof module:pym.Child * @method scrollParentToChildPos * @instance * * @param {Number} pos The offset of the child element to scroll to. */ this.scrollParentToChildPos = function(pos) { this.sendMessage('scrollToChildPos', pos.toString()); }; /** * Mark Whether the child is embedded or not * executes a callback in case it was passed to the config * * @memberof module:pym.Child * @method _markWhetherEmbedded * @inner * * @param {module:pym.Child~onMarkedEmbeddedStatus} The callback to execute after determining whether embedded or not. */ var _markWhetherEmbedded = function(onMarkedEmbeddedStatus) { var htmlElement = document.getElementsByTagName('html')[0], newClassForHtml, originalHtmlClasses = htmlElement.className; try { if(window.self !== window.top) { newClassForHtml = "embedded"; }else{ newClassForHtml = "not-embedded"; } }catch(e) { newClassForHtml = "embedded"; } if(originalHtmlClasses.indexOf(newClassForHtml) < 0) { htmlElement.className = originalHtmlClasses ? originalHtmlClasses + ' ' + newClassForHtml : newClassForHtml; if(onMarkedEmbeddedStatus){ onMarkedEmbeddedStatus(newClassForHtml); } _raiseCustomEvent("marked-embedded"); } }; /** * @callback module:pym.Child~onMarkedEmbeddedStatus * @param {String} classname "embedded" or "not-embedded". */ /** * Unbind child event handlers and timers. * * @memberof module:pym.Child * @method remove * @instance */ this.remove = function() { window.removeEventListener('message', this._processMessage); if (this.timerId) { clearInterval(this.timerId); } }; // Initialize settings with overrides. for (var key in config) { this.settings[key] = config[key]; } // Identify what ID the parent knows this child as. this.id = _getParameterByName('childId') || config.id; this.messageRegex = new RegExp('^pym' + MESSAGE_DELIMITER + this.id + MESSAGE_DELIMITER + '(\\S+)' + MESSAGE_DELIMITER + '(.*)$'); // Get the initial width from a URL parameter. var width = parseInt(_getParameterByName('initialWidth')); // Get the url of the parent frame this.parentUrl = _getParameterByName(this.settings.parenturlparam); // Get the title of the parent frame this.parentTitle = _getParameterByName('parentTitle'); // Bind the required message handlers this.onMessage('width', this._onWidthMessage); // Set up a listener to handle any incoming messages. window.addEventListener('message', this._processMessage, false); // If there's a callback function, call it. if (this.settings.renderCallback) { this.settings.renderCallback(width); } // Send the initial height to the parent. this.sendHeight(); // If we're configured to poll, create a setInterval to handle that. if (this.settings.polling) { this.timerId = window.setInterval(this.sendHeight, this.settings.polling); } _markWhetherEmbedded(config.onMarkedEmbeddedStatus); return this; }; // Initialize elements with pym data attributes // if we are not in server configuration if(typeof document !== "undefined") { lib.autoInit(true); } return lib; }); /***/ }), /***/ 18: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _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; }; }(); var _underscore = __webpack_require__(2); var _ = _interopRequireWildcard(_underscore); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var instance = null; var ApplicationConfigService = function () { function ApplicationConfigService(config) { _classCallCheck(this, ApplicationConfigService); // if( !instance ) { // instance = this; // } this.configuration = config; // return instance; } _createClass(ApplicationConfigService, [{ key: 'get', value: function get(configKey) { if (configKey !== undefined) { var foundValue = this._findKeyValue(configKey || this.configuration); switch (typeof foundValue === 'undefined' ? 'undefined' : _typeof(foundValue)) { case 'string': return foundValue; default: return foundValue ? foundValue : null; } } return this.configuration; } }, { key: 'set', value: function set(configKey, value) { if (configKey !== undefined) { if (_typeof(this.configuration[configKey]) === 'object') { // merge this.configuration[configKey] = _.extend({}, this.configuration[configKey], value); } else { this.configuration[configKey] = value; } } } // @TODO cast }, { key: '_findKeyValue', value: function _findKeyValue(configName) { if (!configName) { return undefined; } var isStr = _.isString(configName); var name = isStr ? configName : configName.name; var path = configName.indexOf('.') > 0 ? true : false; if (path) { return this._search(this.configuration, name); } var state = this.configuration[name]; if (state && (isStr || !isStr && state === configName)) { return state; } else if (isStr) { return state; } return undefined; } // @TODO cast }, { key: '_search', value: function _search(obj, path) { if (_.isNumber(path)) { path = [path]; } if (_.isEmpty(path)) { return obj; } if (_.isEmpty(obj)) { return null; } if (_.isString(path)) { return this._search(obj, path.split('.')); } var currentPath = path[0]; if (path.length === 1) { if (obj[currentPath] === void 0) { return null; } return obj[currentPath]; } return this._search(obj[currentPath], path.slice(1)); } }]); return ApplicationConfigService; }(); exports.default = ApplicationConfigService; /***/ }), /***/ 19: /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(jQuery) { // @TODO enable lints /* eslint-disable max-len*/ /* eslint-disable object-shorthand*/ /* eslint-disable dot-notation*/ /* eslint-disable vars-on-top*/ /* eslint-disable prefer-template*/ /* eslint-disable prefer-const*/ /* eslint-disable spaced-comment*/ /* eslint-disable curly*/ /* eslint-disable object-curly-spacing*/ /* eslint-disable spaced-comment*/ /* eslint-disable prefer-arrow-callback*/ /* eslint-disable one-var*/ /* eslint-disable space-in-parens*/ /* eslint-disable camelcase*/ /* eslint-disable no-undef*/ /* eslint-disable quote-props*/ /* eslint-disable no-shadow*/ /* eslint-disable no-param-reassign*/ /* eslint-disable no-unused-expressions*/ /* eslint-disable no-shadow*/ /* eslint-disable no-implied-eval*/ /* eslint-disable brace-style*/ /* eslint-disable no-unused-vars*/ /* eslint-disable brace-style*/ /* eslint-disable no-lonely-if*/ /* eslint-disable no-inline-comments*/ /* eslint-disable default-case*/ /* eslint-disable one-var*/ /* eslint-disable semi*/ /* eslint-disable no-throw-literal*/ /* eslint-disable no-sequences*/ /* eslint-disable consistent-this*/ /* eslint-disable no-dupe-keys*/ /* eslint-disable semi*/ /* eslint-disable no-loop-func*/ /* eslint-disable space-after-keywords*/ /* eslint-disable no-var*/ /* eslint-disable quotes*/ /** * Copyright (c)2005-2009 Matt Kruse (javascripttoolbox.com) * * Dual licensed under the MIT and GPL licenses. * This basically means you can use this code however you want for * free, but don't claim to have written it yourself! * Donations always accepted: http://www.JavascriptToolbox.com/donate/ * * Please do not link to the .js files on javascripttoolbox.com from * your site. Copy the files locally to your server instead. * */ /** * jquery.contextmenu.js * jQuery Plugin for Context Menus * http://www.JavascriptToolbox.com/lib/contextmenu/ * * Copyright (c) 2008 Matt Kruse (javascripttoolbox.com) * Dual licensed under the MIT and GPL licenses. * * @version 1.0 * @history 1.0 2008-10-20 Initial Release * @todo slideUp doesn't work in IE - because of iframe? * @todo Hide all other menus when contextmenu is shown? * @todo More themes * @todo Nested context menus */ (function ($) { $.contextMenu = { // props add by Alchemy _showEvent: null, // the original event the caused the menu to show (useful to find the original element clicked) _div: null, // openEvt: "contextmenu", // ouverture sur right-click closeTimer: null, // fermer le menu apres 100ms de mouseout shadow: true, dropDown: false, shadowOffset: 0, shadowOffsetX: 5, shadowOffsetY: 5, shadowWidthAdjust: -3, shadowHeightAdjust: -3, shadowOpacity: 0.2, shadowClass: 'context-menu-shadow', shadowColor: 'black', offsetX: 0, offsetY: 0, appendTo: 'body', direction: 'down', constrainToScreen: true, showTransition: 'show', hideTransition: 'hide', showSpeed: '', hideSpeed: '', showCallback: null, hideCallback: null, className: 'context-menu', itemClassName: 'context-menu-item', itemHoverClassName: 'context-menu-item-hover', disabledItemClassName: 'context-menu-item-disabled', disabledItemHoverClassName: 'context-menu-item-disabled-hover', separatorClassName: 'context-menu-separator', innerDivClassName: 'context-menu-item-inner', themePrefix: 'context-menu-theme-', theme: 'default', separator: 'context-menu-separator', // A specific key to identify a separator target: null, // The target of the context click, to be populated when triggered menu: null, // The jQuery object containing the HTML object that is the menu itself shadowObj: null, // Shadow object bgiframe: null, // The iframe object for IE6 shown: false, // Currently being shown? useIframe: /*@cc_on @*/ /*@if (@_win32) true, @else @*/false, /*@end @*/ // This is a better check than looking at userAgent! // Create the menu instance create: function create(menu, opts) { var cmenu = $.extend({}, this, opts); // Clone all default properties to created object // If a selector has been passed in, then use that as the menu if (typeof menu === "string") { cmenu.menu = $(menu); } // If a function has been passed in, call it each time the menu is shown to create the menu else if (typeof menu === "function") { cmenu.menuFunction = menu; } // Otherwise parse the Array passed in else { cmenu.menu = cmenu.createMenu(menu, cmenu); } if (cmenu.menu) { cmenu.menu.css({ display: 'none' }); $(cmenu.appendTo).append(cmenu.menu); } // Create the shadow object if shadow is enabled if (cmenu.shadow) { cmenu.createShadow(cmenu); // Extracted to method for extensibility if (cmenu.shadowOffset) { cmenu.shadowOffsetX = cmenu.shadowOffsetY = cmenu.shadowOffset; } } $('body').bind(cmenu.openEvt, function () { cmenu.hide(); }); // If right-clicked somewhere else in the document, hide this menu return cmenu; }, // Create an iframe object to go behind the menu createIframe: function createIframe() { return $('