(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Spotlight = factory()); })(this, (function () { 'use strict'; class BrowseGroupCateogries { connect() { var $container, slider; function init() { var data = $container.data(); var sidebar = $container.data().sidebar; var items = data.browseGroupCategoriesCount; var dir = $('html').attr('dir'); var controls = $container.parent().find('.browse-group-categories-controls')[0]; slider = tns({ container: $container[0], controlsContainer: controls, loop: false, nav: false, items: 1, slideBy: 'page', textDirection: dir, responsive: { 576: { items: itemCount(items, sidebar) } } }); } // Destroy the slider instance, as tns will change the dom elements, causing some issues with turbolinks function setupDestroy() { document.addEventListener('turbolinks:before-cache', function() { if (slider && slider.destroy) { slider.destroy(); } }); } function itemCount(items, sidebar) { if (items < 3) { return items; } return sidebar ? 3 : 4; } return $('[data-browse-group-categories-carousel]').each(function() { $container = $(this); init(); setupDestroy(); }); } } class Carousel { connect() { $('.carousel').carousel(); } } class ClearFormButton { connect() { var $clearBtn = $('.btn-reset'); var $input = $clearBtn.parent().prev('input'); var btnCheck = function(){ if ($input.val() !== '') { $clearBtn.css('display', 'inline-block'); } else { $clearBtn.css('display', 'none'); } }; btnCheck(); $input.on('keyup', function() { btnCheck(); }); $clearBtn.on('click', function(event) { event.preventDefault(); $input.val(''); }); } } class ReportProblem { connect(){ var container, target; function init() { const target_val = container.attr('data-target'); if (!target_val) return target = $("#" + target_val); container.on('click', open); target.find('[data-behavior="cancel-link"]').on('click', close); } function open(event) { event.preventDefault(); target.slideToggle('slow'); } function close(event) { event.preventDefault(); target.slideUp('fast'); } return $('[data-behavior="contact-link"]').each(function() { container = $(this); init(); }); } } class ZprLinks { connect() { $('.zpr-link').on('click', function() { var modalDialog = $('#blacklight-modal .modal-dialog'); var modalContent = modalDialog.find('.modal-content'); modalDialog.removeClass('modal-lg'); modalDialog.addClass('modal-xl'); modalContent.html('
'); var controls = `
`; $('#osd-modal-container').append('
'); $('#osd-modal-container').append(controls); $('#blacklight-modal').modal('show'); $('#blacklight-modal').one('hidden.bs.modal', function (event) { modalDialog.removeClass('modal-xl'); modalDialog.addClass('modal-lg'); }); OpenSeadragon({ id: 'osd-div', zoomInButton: "osd-zoom-in", zoomOutButton: "osd-zoom-out", // This is a hack where OpenSeadragon (if using mapped buttons) requires you // to map all of the buttons. homeButton: "empty-div-required-by-osd", fullPageButton: "empty-div-required-by-osd", nextButton: "empty-div-required-by-osd", previousButton: "empty-div-required-by-osd", tileSources: [$(this).data('iiif-tilesource')] }); }); } } class UserIndex { connect() { new BrowseGroupCateogries().connect(); new Carousel().connect(); new ClearFormButton().connect(); new ReportProblem().connect(); new ZprLinks().connect(); } } /*! * Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/ * Dual-licensed under the BSD or MIT licenses */ (function($, window, document, undefined$1) { var hasTouch = 'ontouchstart' in window; /** * Detect CSS pointer-events property * events are normally disabled on the dragging element to avoid conflicts * https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js */ var hasPointerEvents = (function() { var el = document.createElement('div'), docEl = document.documentElement; if (!('pointerEvents' in el.style)) { return false; } el.style.pointerEvents = 'auto'; el.style.pointerEvents = 'x'; docEl.appendChild(el); var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto'; docEl.removeChild(el); return !!supports; })(); var eStart = hasTouch ? 'touchstart' : 'mousedown', eMove = hasTouch ? 'touchmove' : 'mousemove', eEnd = hasTouch ? 'touchend' : 'mouseup', eCancel = hasTouch ? 'touchcancel' : 'mouseup'; var defaults = { listNodeName : 'ol', itemNodeName : 'li', rootClass : 'dd', listClass : 'dd-list', itemClass : 'dd-item', dragClass : 'dd-dragel', handleClass : 'dd-handle', collapsedClass : 'dd-collapsed', placeClass : 'dd-placeholder', noDragClass : 'dd-nodrag', noChildrenClass : 'dd-nochildren', emptyClass : 'dd-empty', expandBtnHTML : '', collapseBtnHTML : '', group : 0, maxDepth : 5, threshold : 20, reject : [], //method for call when an item has been successfully dropped //method has 1 argument in which sends an object containing all //necessary details dropCallback : null, // When a node is dragged it is moved to its new location. // You can set the next option to true to create a copy of the node that is dragged. cloneNodeOnDrag : false, // When the node is dragged and released outside its list delete it. dragOutsideToDelete : false }; function Plugin(element, options) { this.w = $(document); this.el = $(element); this.options = $.extend({}, defaults, options); this.init(); } Plugin.prototype = { init: function() { var list = this; list.reset(); list.el.data('nestable-group', this.options.group); list.placeEl = $('
'); $.each(this.el.find(list.options.itemNodeName), function(k, el) { list.setParent($(el)); }); list.el.on('click', 'button', function(e) { if (list.dragEl || (!hasTouch && e.button !== 0)) { return; } var target = $(e.currentTarget), action = target.data('action'), item = target.parent(list.options.itemNodeName); if (action === 'collapse') { list.collapseItem(item); } if (action === 'expand') { list.expandItem(item); } }); var onStartEvent = function(e) { var handle = $(e.target); list.nestableCopy = handle.closest('.'+list.options.rootClass).clone(true); if (!handle.hasClass(list.options.handleClass)) { if (handle.closest('.' + list.options.noDragClass).length) { return; } handle = handle.closest('.' + list.options.handleClass); } if (!handle.length || list.dragEl || (!hasTouch && e.which !== 1) || (hasTouch && e.touches.length !== 1)) { return; } e.preventDefault(); list.dragStart(hasTouch ? e.touches[0] : e); }; var onMoveEvent = function(e) { if (list.dragEl) { e.preventDefault(); list.dragMove(hasTouch ? e.touches[0] : e); } }; var onEndEvent = function(e) { if (list.dragEl) { e.preventDefault(); list.dragStop(hasTouch ? e.touches[0] : e); } }; if (hasTouch) { list.el[0].addEventListener(eStart, onStartEvent, false); window.addEventListener(eMove, onMoveEvent, false); window.addEventListener(eEnd, onEndEvent, false); window.addEventListener(eCancel, onEndEvent, false); } else { list.el.on(eStart, onStartEvent); list.w.on(eMove, onMoveEvent); list.w.on(eEnd, onEndEvent); } var destroyNestable = function() { if (hasTouch) { list.el[0].removeEventListener(eStart, onStartEvent, false); window.removeEventListener(eMove, onMoveEvent, false); window.removeEventListener(eEnd, onEndEvent, false); window.removeEventListener(eCancel, onEndEvent, false); } else { list.el.off(eStart, onStartEvent); list.w.off(eMove, onMoveEvent); list.w.off(eEnd, onEndEvent); } list.el.off('click'); list.el.unbind('destroy-nestable'); list.el.data("nestable", null); var buttons = list.el[0].getElementsByTagName('button'); $(buttons).remove(); }; list.el.bind('destroy-nestable', destroyNestable); }, destroy: function () { this.expandAll(); this.el.trigger('destroy-nestable'); }, serialize: function() { var data, list = this; const step = function(level, depth) { var array = [ ], items = level.children(list.options.itemNodeName); items.each(function() { var li = $(this), item = $.extend({}, li.data()), sub = li.children(list.options.listNodeName); if (sub.length) { item.children = step(sub); } array.push(item); }); return array; }; var el; if (list.el.is(list.options.listNodeName)) { el = list.el; } else { el = list.el.find(list.options.listNodeName).first(); } data = step(el); return data; }, reset: function() { this.mouse = { offsetX : 0, offsetY : 0, startX : 0, startY : 0, lastX : 0, lastY : 0, nowX : 0, nowY : 0, distX : 0, distY : 0, dirAx : 0, dirX : 0, dirY : 0, lastDirX : 0, lastDirY : 0, distAxX : 0, distAxY : 0 }; this.moving = false; this.dragEl = null; this.dragRootEl = null; this.dragDepth = 0; this.dragItem = null; this.hasNewRoot = false; this.pointEl = null; this.sourceRoot = null; this.isOutsideRoot = false; }, expandItem: function(li) { li.removeClass(this.options.collapsedClass); li.children('[data-action="expand"]').hide(); li.children('[data-action="collapse"]').show(); li.children(this.options.listNodeName).show(); this.el.trigger('expand', [li]); li.trigger('expand'); }, collapseItem: function(li) { var lists = li.children(this.options.listNodeName); if (lists.length) { li.addClass(this.options.collapsedClass); li.children('[data-action="collapse"]').hide(); li.children('[data-action="expand"]').show(); li.children(this.options.listNodeName).hide(); } this.el.trigger('collapse', [li]); li.trigger('collapse'); }, expandAll: function() { var list = this; list.el.find(list.options.itemNodeName).each(function() { list.expandItem($(this)); }); }, collapseAll: function() { var list = this; list.el.find(list.options.itemNodeName).each(function() { list.collapseItem($(this)); }); }, setParent: function(li) { if (li.children(this.options.listNodeName).length) { li.prepend($(this.options.expandBtnHTML)); li.prepend($(this.options.collapseBtnHTML)); } if( (' ' + li[0].className + ' ').indexOf(' ' + defaults.collapsedClass + ' ') > -1 ) { li.children('[data-action="collapse"]').hide(); } else { li.children('[data-action="expand"]').hide(); } }, unsetParent: function(li) { li.removeClass(this.options.collapsedClass); li.children('[data-action]').remove(); li.children(this.options.listNodeName).remove(); }, dragStart: function(e) { var mouse = this.mouse, target = $(e.target), dragItem = target.closest('.' + this.options.handleClass).closest(this.options.itemNodeName); this.sourceRoot = target.closest('.' + this.options.rootClass); this.dragItem = dragItem; this.placeEl.css('height', dragItem.height()); mouse.offsetX = e.offsetX !== undefined$1 ? e.offsetX : e.pageX - target.offset().left; mouse.offsetY = e.offsetY !== undefined$1 ? e.offsetY : e.pageY - target.offset().top; mouse.startX = mouse.lastX = e.pageX; mouse.startY = mouse.lastY = e.pageY; this.dragRootEl = this.el; this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass); this.dragEl.css('width', dragItem.width()); // fix for zepto.js //dragItem.after(this.placeEl).detach().appendTo(this.dragEl); if(this.options.cloneNodeOnDrag) { dragItem.after(dragItem.clone()); } else { dragItem.after(this.placeEl); } dragItem[0].parentNode.removeChild(dragItem[0]); dragItem.appendTo(this.dragEl); $(document.body).append(this.dragEl); this.dragEl.css({ 'left' : e.pageX - mouse.offsetX, 'top' : e.pageY - mouse.offsetY }); // total depth of dragging item var i, depth, items = this.dragEl.find(this.options.itemNodeName); for (i = 0; i < items.length; i++) { depth = $(items[i]).parents(this.options.listNodeName).length; if (depth > this.dragDepth) { this.dragDepth = depth; } } }, dragStop: function(e) { // fix for zepto.js //this.placeEl.replaceWith(this.dragEl.children(this.options.itemNodeName + ':first').detach()); var el = this.dragEl.children(this.options.itemNodeName).first(); el[0].parentNode.removeChild(el[0]); if(this.isOutsideRoot && this.options.dragOutsideToDelete) { var parent = this.placeEl.parent(); this.placeEl.remove(); if (!parent.children().length) { this.unsetParent(parent.parent()); } // If all nodes where deleted, create a placeholder element. if (!this.dragRootEl.find(this.options.itemNodeName).length) { this.dragRootEl.append('
'); } } else { this.placeEl.replaceWith(el); } if (!this.moving) { $(this.dragItem).trigger('click'); } var i; var isRejected = false; for (i = 0; i < this.options.reject.length; i++) { var reject = this.options.reject[i]; if (reject.rule.apply(this.dragRootEl)) { var nestableDragEl = el.clone(true); this.dragRootEl.html(this.nestableCopy.children().clone(true)); if (reject.action) { reject.action.apply(this.dragRootEl, [nestableDragEl]); } isRejected = true; break; } } if (!isRejected) { this.dragEl.remove(); this.el.trigger('change'); //Let's find out new parent id var parentItem = el.parent().parent(); var parentId = null; if(parentItem !== null && !parentItem.is('.' + this.options.rootClass)) parentId = parentItem.data('id'); if($.isFunction(this.options.dropCallback)) { var details = { sourceId : el.data('id'), destId : parentId, sourceEl : el, destParent : parentItem, destRoot : el.closest('.' + this.options.rootClass), sourceRoot : this.sourceRoot }; this.options.dropCallback.call(this, details); } if (this.hasNewRoot) { this.dragRootEl.trigger('change'); } this.reset(); } }, dragMove: function(e) { var list, parent, prev, next, depth, opt = this.options, mouse = this.mouse; this.dragEl.css({ 'left' : e.pageX - mouse.offsetX, 'top' : e.pageY - mouse.offsetY }); // mouse position last events mouse.lastX = mouse.nowX; mouse.lastY = mouse.nowY; // mouse position this events mouse.nowX = e.pageX; mouse.nowY = e.pageY; // distance mouse moved between events mouse.distX = mouse.nowX - mouse.lastX; mouse.distY = mouse.nowY - mouse.lastY; // direction mouse was moving mouse.lastDirX = mouse.dirX; mouse.lastDirY = mouse.dirY; // direction mouse is now moving (on both axis) mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1; mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1; // axis mouse is now moving on var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0; // do nothing on first move if (!this.moving) { mouse.dirAx = newAx; this.moving = true; return; } // calc distance moved on this axis (and direction) if (mouse.dirAx !== newAx) { mouse.distAxX = 0; mouse.distAxY = 0; } else { mouse.distAxX += Math.abs(mouse.distX); if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) { mouse.distAxX = 0; } mouse.distAxY += Math.abs(mouse.distY); if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) { mouse.distAxY = 0; } } mouse.dirAx = newAx; /** * move horizontal */ if (mouse.dirAx && mouse.distAxX >= opt.threshold) { // reset move distance on x-axis for new phase mouse.distAxX = 0; prev = this.placeEl.prev(opt.itemNodeName); // increase horizontal level if previous sibling exists and is not collapsed if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) { // cannot increase level when item above is collapsed list = prev.find(opt.listNodeName).last(); // check if depth limit has reached depth = this.placeEl.parents(opt.listNodeName).length; if (depth + this.dragDepth <= opt.maxDepth) { // create new sub-level if one doesn't exist if (!list.length) { list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass); list.append(this.placeEl); prev.append(list); this.setParent(prev); } else { // else append to next level up list = prev.children(opt.listNodeName).last(); list.append(this.placeEl); } } } // decrease horizontal level if (mouse.distX < 0) { // we can't decrease a level if an item preceeds the current one next = this.placeEl.next(opt.itemNodeName); if (!next.length) { parent = this.placeEl.parent(); this.placeEl.closest(opt.itemNodeName).after(this.placeEl); if (!parent.children().length) { this.unsetParent(parent.parent()); } } } } var isEmpty = false; // find list item under cursor if (!hasPointerEvents) { this.dragEl[0].style.visibility = 'hidden'; } this.pointEl = $(document.elementFromPoint(e.pageX - document.documentElement.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop))); // Check if the node is dragged outside of its list. if(this.dragRootEl.has(this.pointEl).length) { this.isOutsideRoot = false; this.dragEl[0].style.opacity = 1; } else { this.isOutsideRoot = true; this.dragEl[0].style.opacity = 0.5; } // find parent list of item under cursor var pointElRoot = this.pointEl.closest('.' + opt.rootClass), isNewRoot = this.dragRootEl.data('nestable-id') !== pointElRoot.data('nestable-id'); this.isOutsideRoot = !pointElRoot.length; if (!hasPointerEvents) { this.dragEl[0].style.visibility = 'visible'; } if (this.pointEl.hasClass(opt.handleClass)) { this.pointEl = this.pointEl.closest( opt.itemNodeName ); } if (opt.maxDepth == 1 && !this.pointEl.hasClass(opt.itemClass)) { this.pointEl = this.pointEl.closest("." + opt.itemClass); } if (this.pointEl.hasClass(opt.emptyClass)) { isEmpty = true; } else if (!this.pointEl.length || !this.pointEl.hasClass(opt.itemClass)) { return; } /** * move vertical */ if (!mouse.dirAx || isNewRoot || isEmpty) { // check if groups match if dragging over new root if (isNewRoot && opt.group !== pointElRoot.data('nestable-group')) { return; } // check depth limit depth = this.dragDepth - 1 + this.pointEl.parents(opt.listNodeName).length; if (depth > opt.maxDepth) { return; } var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2); parent = this.placeEl.parent(); // if empty create new list to replace empty placeholder if (isEmpty) { list = $(document.createElement(opt.listNodeName)).addClass(opt.listClass); list.append(this.placeEl); this.pointEl.replaceWith(list); } else if (before) { this.pointEl.before(this.placeEl); } else { this.pointEl.after(this.placeEl); } if (!parent.children().length) { this.unsetParent(parent.parent()); } if (!this.dragRootEl.find(opt.itemNodeName).length) { this.dragRootEl.append('
'); } // parent root list has changed this.dragRootEl = pointElRoot; if (isNewRoot) { this.hasNewRoot = this.el[0] !== this.dragRootEl[0]; } } } }; $.fn.nestable = function(params) { var lists = this, retval = this; var generateUid = function (separator) { var delim = separator || "-"; function S4() { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); } return (S4() + S4() + delim + S4() + delim + S4() + delim + S4() + delim + S4() + S4() + S4()); }; lists.each(function() { var plugin = $(this).data("nestable"); if (!plugin) { $(this).data("nestable", new Plugin(this, params)); $(this).data("nestable-id", generateUid()); } else { if (typeof params === 'string' && typeof plugin[params] === 'function') { retval = plugin[params](); } } }); return retval || lists; }; })(window.jQuery || window.Zepto, window, document); /* https://gist.github.com/pjambet/3710461 */ var LATIN_MAP = { 'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I', 'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U', 'Ý': 'Y', 'Þ': 'TH', 'ß': 'ss', 'à':'a', 'á':'a', 'â': 'a', 'ã': 'a', 'ä': 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c', 'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e', 'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': 'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u', 'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y' }; var LATIN_SYMBOLS_MAP = { '©':'(c)' }; var GREEK_MAP = { 'α':'a', 'β':'b', 'γ':'g', 'δ':'d', 'ε':'e', 'ζ':'z', 'η':'h', 'θ':'8', 'ι':'i', 'κ':'k', 'λ':'l', 'μ':'m', 'ν':'n', 'ξ':'3', 'ο':'o', 'π':'p', 'ρ':'r', 'σ':'s', 'τ':'t', 'υ':'y', 'φ':'f', 'χ':'x', 'ψ':'ps', 'ω':'w', 'ά':'a', 'έ':'e', 'ί':'i', 'ό':'o', 'ύ':'y', 'ή':'h', 'ώ':'w', 'ς':'s', 'ϊ':'i', 'ΰ':'y', 'ϋ':'y', 'ΐ':'i', 'Α':'A', 'Β':'B', 'Γ':'G', 'Δ':'D', 'Ε':'E', 'Ζ':'Z', 'Η':'H', 'Θ':'8', 'Ι':'I', 'Κ':'K', 'Λ':'L', 'Μ':'M', 'Ν':'N', 'Ξ':'3', 'Ο':'O', 'Π':'P', 'Ρ':'R', 'Σ':'S', 'Τ':'T', 'Υ':'Y', 'Φ':'F', 'Χ':'X', 'Ψ':'PS', 'Ω':'W', 'Ά':'A', 'Έ':'E', 'Ί':'I', 'Ό':'O', 'Ύ':'Y', 'Ή':'H', 'Ώ':'W', 'Ϊ':'I', 'Ϋ':'Y' }; var TURKISH_MAP = { 'ş':'s', 'Ş':'S', 'ı':'i', 'İ':'I', 'ç':'c', 'Ç':'C', 'ü':'u', 'Ü':'U', 'ö':'o', 'Ö':'O', 'ğ':'g', 'Ğ':'G' }; var RUSSIAN_MAP = { 'а':'a', 'б':'b', 'в':'v', 'г':'g', 'д':'d', 'е':'e', 'ё':'yo', 'ж':'zh', 'з':'z', 'и':'i', 'й':'j', 'к':'k', 'л':'l', 'м':'m', 'н':'n', 'о':'o', 'п':'p', 'р':'r', 'с':'s', 'т':'t', 'у':'u', 'ф':'f', 'х':'h', 'ц':'c', 'ч':'ch', 'ш':'sh', 'щ':'sh', 'ъ':'', 'ы':'y', 'ь':'', 'э':'e', 'ю':'yu', 'я':'ya', 'А':'A', 'Б':'B', 'В':'V', 'Г':'G', 'Д':'D', 'Е':'E', 'Ё':'Yo', 'Ж':'Zh', 'З':'Z', 'И':'I', 'Й':'J', 'К':'K', 'Л':'L', 'М':'M', 'Н':'N', 'О':'O', 'П':'P', 'Р':'R', 'С':'S', 'Т':'T', 'У':'U', 'Ф':'F', 'Х':'H', 'Ц':'C', 'Ч':'Ch', 'Ш':'Sh', 'Щ':'Sh', 'Ъ':'', 'Ы':'Y', 'Ь':'', 'Э':'E', 'Ю':'Yu', 'Я':'Ya' }; var UKRAINIAN_MAP = { 'Є':'Ye', 'І':'I', 'Ї':'Yi', 'Ґ':'G', 'є':'ye', 'і':'i', 'ї':'yi', 'ґ':'g' }; var CZECH_MAP = { 'č':'c', 'ď':'d', 'ě':'e', 'ň': 'n', 'ř':'r', 'š':'s', 'ť':'t', 'ů':'u', 'ž':'z', 'Č':'C', 'Ď':'D', 'Ě':'E', 'Ň': 'N', 'Ř':'R', 'Š':'S', 'Ť':'T', 'Ů':'U', 'Ž':'Z' }; var POLISH_MAP = { 'ą':'a', 'ć':'c', 'ę':'e', 'ł':'l', 'ń':'n', 'ó':'o', 'ś':'s', 'ź':'z', 'ż':'z', 'Ą':'A', 'Ć':'C', 'Ę':'e', 'Ł':'L', 'Ń':'N', 'Ó':'o', 'Ś':'S', 'Ź':'Z', 'Ż':'Z' }; var LATVIAN_MAP = { 'ā':'a', 'č':'c', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n', 'š':'s', 'ū':'u', 'ž':'z', 'Ā':'A', 'Č':'C', 'Ē':'E', 'Ģ':'G', 'Ī':'i', 'Ķ':'k', 'Ļ':'L', 'Ņ':'N', 'Š':'S', 'Ū':'u', 'Ž':'Z' }; var ALL_DOWNCODE_MAPS=new Array(); ALL_DOWNCODE_MAPS[0]=LATIN_MAP; ALL_DOWNCODE_MAPS[1]=LATIN_SYMBOLS_MAP; ALL_DOWNCODE_MAPS[2]=GREEK_MAP; ALL_DOWNCODE_MAPS[3]=TURKISH_MAP; ALL_DOWNCODE_MAPS[4]=RUSSIAN_MAP; ALL_DOWNCODE_MAPS[5]=UKRAINIAN_MAP; ALL_DOWNCODE_MAPS[6]=CZECH_MAP; ALL_DOWNCODE_MAPS[7]=POLISH_MAP; ALL_DOWNCODE_MAPS[8]=LATVIAN_MAP; var Downcoder = new Object(); Downcoder.Initialize = function() { if (Downcoder.map) // already made return ; Downcoder.map ={}; Downcoder.chars = '' ; for(var i in ALL_DOWNCODE_MAPS) { var lookup = ALL_DOWNCODE_MAPS[i]; for (var c in lookup) { Downcoder.map[c] = lookup[c] ; Downcoder.chars += c ; } } Downcoder.regex = new RegExp('[' + Downcoder.chars + ']|[^' + Downcoder.chars + ']+','g') ; }; /* From https://github.com/TimSchlechter/bootstrap-tagsinput/blob/2661784c2c281d3a69b93897ff3f39e4ffa5cbd1/dist/bootstrap-tagsinput.js */ /* The MIT License (MIT) Copyright (c) 2013 Tim Schlechter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Retrieved 12 February 2014 */ (function ($) { var defaultOptions = { tagClass: function(item) { return 'badge badge-info'; }, itemValue: function(item) { return item ? item.toString() : item; }, itemText: function(item) { return this.itemValue(item); }, freeInput: true, maxTags: undefined, confirmKeys: [13], onTagExists: function(item, $tag) { $tag.hide().fadeIn(); } }; /** * Constructor function */ function TagsInput(element, options) { this.itemsArray = []; this.$element = $(element); this.$element.hide(); this.isSelect = (element.tagName === 'SELECT'); this.multiple = (this.isSelect && element.hasAttribute('multiple')); this.objectItems = options && options.itemValue; this.placeholderText = element.hasAttribute('placeholder') ? this.$element.attr('placeholder') : ''; this.inputSize = Math.max(1, this.placeholderText.length); this.$container = $('
'); this.$input = $('').appendTo(this.$container); this.$element.after(this.$container); this.build(options); } TagsInput.prototype = { constructor: TagsInput, /** * Adds the given item as a new tag. Pass true to dontPushVal to prevent * updating the elements val() */ add: function(item, dontPushVal) { var self = this; if (self.options.maxTags && self.itemsArray.length >= self.options.maxTags) return; // Ignore falsey values, except false if (item !== false && !item) return; // Throw an error when trying to add an object while the itemValue option was not set if (typeof item === "object" && !self.objectItems) throw("Can't add objects when itemValue option is not set"); // Ignore strings only containg whitespace if (item.toString().match(/^\s*$/)) return; // If SELECT but not multiple, remove current tag if (self.isSelect && !self.multiple && self.itemsArray.length > 0) self.remove(self.itemsArray[0]); if (typeof item === "string" && this.$element[0].tagName === 'INPUT') { var items = item.split(','); if (items.length > 1) { for (var i = 0; i < items.length; i++) { this.add(items[i], true); } if (!dontPushVal) self.pushVal(); return; } } var itemValue = self.options.itemValue(item), itemText = self.options.itemText(item), tagClass = self.options.tagClass(item); // Ignore items allready added var existing = $.grep(self.itemsArray, function(item) { return self.options.itemValue(item) === itemValue; } )[0]; if (existing) { // Invoke onTagExists if (self.options.onTagExists) { var $existingTag = $(".tag", self.$container).filter(function() { return $(this).data("item") === existing; }); self.options.onTagExists(item, $existingTag); } return; } // register item in internal array and map self.itemsArray.push(item); // add a tag element var $tag = $('' + htmlEncode(itemText) + ''); $tag.data('item', item); self.findInputWrapper().before($tag); $tag.after(' '); // add '; }); return html; }, addCarouselMaxHeightOptions: function(options) { var html = '', _this = this; $.each(options.values, function(size, px) { var checked = (size === options.selected) ? 'checked' : '', id = _this.formId(_this.max_height_key); html += ''; html += ''; }); return html; }, afterPreviewLoad: function(options) { $(this.inner).find('.carousel').carousel(); // the bootstrap carousel only initializes data-slide widgets on page load, so we need // to initialize them ourselves.. var clickHandler = function (e) { var href; var $this = $(this); var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')); // strip for ie7 if (!$target.hasClass('carousel')) return var options = $.extend({}, $target.data(), $this.data()); var slideIndex = $this.attr('data-slide-to'); if (slideIndex) options.interval = false; $.fn.carousel.call($target, options); if (slideIndex) { $target.data('bs.carousel').to(slideIndex); } e.preventDefault(); }; $(this.inner).find('.carousel') .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler); } }); })(); //= require spotlight/admin/blocks/solr_documents_base_block SirTrevor.Blocks.SolrDocumentsEmbed = (function(){ return SirTrevor.Blocks.SolrDocumentsBase.extend({ type: "solr_documents_embed", icon_name: "item_embed", item_options: function() { return "" }, afterPreviewLoad: function(options) { $(this.inner).find('picture[data-openseadragon]').openseadragon(); } }); })(); //= require spotlight/admin/blocks/solr_documents_base_block SirTrevor.Blocks.SolrDocumentsFeatures = (function(){ return SirTrevor.Blocks.SolrDocumentsBase.extend({ plustextable: false, type: "solr_documents_features", icon_name: "item_features", afterPreviewLoad: function(options) { $(this.inner).find('.carousel').carousel(); // the bootstrap carousel only initializes data-slide widgets on page load, so we need // to initialize them ourselves.. var clickHandler = function (e) { var href; var $this = $(this); var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')); // strip for ie7 if (!$target.hasClass('carousel')) return var options = $.extend({}, $target.data(), $this.data()); var slideIndex = $this.attr('data-slide-to'); if (slideIndex) options.interval = false; $.fn.carousel.call($target, options); if (slideIndex) { $target.data('bs.carousel').to(slideIndex); } e.preventDefault(); }; $(this.inner).find('.carousel') .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler); } }); })(); //= require spotlight/admin/blocks/solr_documents_base_block SirTrevor.Blocks.SolrDocumentsGrid = (function(){ return SirTrevor.Blocks.SolrDocumentsBase.extend({ type: "solr_documents_grid", icon_name: "item_grid", item_options: function() { return "" } }); })(); SirTrevor.Blocks.UploadedItems = (function(){ return Spotlight$1.Block.Resources.extend({ plustextable: true, uploadable: true, autocompleteable: false, id_key: 'file', type: 'uploaded_items', icon_name: 'items', blockGroup: 'undefined', // Clear out the default Uploadable upload options // since we will be using our own custom controls upload_options: { html: '' }, fileInput: function() { return $(this.inner).find('input[type="file"]'); }, onBlockRender: function(){ Module.init($(this.inner).find('[data-behavior="nestable"]')); this.fileInput().on('change', (function(ev) { this.onDrop(ev.currentTarget); }).bind(this)); }, onDrop: function(transferData){ var file = transferData.files[0]; (typeof URL !== "undefined") ? URL : (typeof webkitURL !== "undefined") ? webkitURL : null; // Handle one upload at a time if (/image/.test(file.type)) { this.loading(); this.uploader( file, function(data) { this.createItemPanel(data); this.fileInput().val(''); this.ready(); }, function(error) { this.addMessage(i18n.t('blocks:image:upload_error')); this.ready(); } ); } }, title: function() { return i18n.t('blocks:uploaded_items:title'); }, description: function() { return i18n.t('blocks:uploaded_items:description'); }, globalIndex: 0, _itemPanel: function(data) { var index = "file_" + this.globalIndex++; var checked = 'checked="checked"'; if (data.display == 'false') { checked = ''; } var dataId = data.id || data.uid; var dataTitle = data.title || data.name; var dataUrl = data.url || data.file.url; var markup = `
  • ${i18n.t("blocks:resources:panel:drag")}
    ${dataTitle}
  • `; const panel = $(markup); panel.find('[data-field="caption"]').val(data.caption); panel.find('[data-field="link"]').val(data.link); var context = this; $('.remove a', panel).on('click', function(e) { e.preventDefault(); $(this).closest('.field').remove(); context.afterPanelDelete(); }); this.afterPanelRender(data, panel); return panel; }, editorHTML: function() { return `
    ${this.description()}
    ,
    '
    ${this.text_area()}
    ` }, zpr_key: 'zpr_link' }); })(); (function() { var BLOCK_REPLACER_CONTROL_TEMPLATE = function(block) { var el = document.createElement('button'); el.className = "st-block-controls__button"; el.setAttribute('data-type', block.type); el.type = "button"; var img = document.createElement('svg'); img.className = "st-icon"; img.setAttribute('role', 'img'); var use = document.createElement('use'); use.setAttributeNS('https://www.w3.org/1999/xlink', 'href', SirTrevor.config.defaults.iconUrl + "#" + block.icon_name); img.appendChild(use); el.appendChild(img); el.appendChild(document.createTextNode(block.title())); return el.outerHTML; }; function generateBlocksHTML(Blocks, availableTypes) { var groups = {}; for(var i in availableTypes) { var type = availableTypes[i]; if (Blocks.hasOwnProperty(type) && Blocks[type].prototype.toolbarEnabled) { var blockGroup; if ($.isFunction(Blocks[type].prototype.blockGroup)) { blockGroup = Blocks[type].prototype.blockGroup(); } else { blockGroup = Blocks[type].prototype.blockGroup; } if (blockGroup == 'undefined' || blockGroup === undefined) { blockGroup = i18n.t("blocks:group:undefined"); } groups[blockGroup] = groups[blockGroup] || []; groups[blockGroup].push(BLOCK_REPLACER_CONTROL_TEMPLATE(Blocks[type].prototype)); } } function generateBlock(groups, key) { var group = groups[key]; var groupEl = $("
    " + key + "
    "); var buttons = group.reduce(function(memo, btn) { return memo += btn; }, ""); groupEl.append(buttons); return groupEl[0].outerHTML; } var standardWidgets = generateBlock(groups, i18n.t("blocks:group:undefined")); var exhibitWidgets = Object.keys(groups).map(function(key) { if (key !== i18n.t("blocks:group:undefined")) { return generateBlock(groups, key); } }).filter(function (element) { return element != null; }); var blocks = [standardWidgets].concat(exhibitWidgets).join("
    "); return blocks; } function render(Blocks, availableTypes) { var el = document.createElement('div'); el.className = "st-block-controls__buttons"; el.innerHTML = generateBlocksHTML.apply(null, arguments); var elButtons = document.createElement('div'); elButtons.className = "spotlight-block-controls"; elButtons.appendChild(el); return elButtons; } Spotlight$1.BlockControls = function() { }; Spotlight$1.BlockControls.create = function(editor) { // REFACTOR - should probably not know about blockManager var el = render(SirTrevor.Blocks, editor.blockManager.blockTypes); function hide() { var parent = el.parentNode; if (!parent) { return; } parent.removeChild(el); parent.classList.remove("st-block--controls-active"); return parent; } function destroy() { SirTrevor = null; el = null; } function insert(e) { e.stopPropagation(); var parent = this.parentNode; if (!parent || hide() === parent) { return; } $('.st-block__inner', parent).after(el); parent.classList.add("st-block--controls-active"); } $(editor.wrapper).delegate(".st-block-replacer", "click", insert); $(editor.wrapper).delegate(".st-block-controls__button", "click", insert); return { el: el, hide: hide, destroy: destroy }; }; })(); Spotlight$1.BlockLimits = function(editor) { this.editor = editor; }; Spotlight$1.BlockLimits.prototype.enforceLimits = function(editor) { this.addEditorCallbacks(editor); this.checkGlobalBlockTypeLimit()(); }; Spotlight$1.BlockLimits.prototype.addEditorCallbacks = function(editor) { SirTrevor.EventBus.on('block:create:new', this.checkBlockTypeLimitOnAdd()); SirTrevor.EventBus.on('block:remove', this.checkGlobalBlockTypeLimit()); }; Spotlight$1.BlockLimits.prototype.checkBlockTypeLimitOnAdd = function() { var editor = this.editor; return function(block) { var control = $(".st-block-controls__button[data-type='" + block.type + "']", editor.blockControls.el); control.prop("disabled", !editor.blockManager.canCreateBlock(block.class())); }; }; Spotlight$1.BlockLimits.prototype.checkGlobalBlockTypeLimit = function() { // we don't know what type of block was created or removed.. So, try them all. var editor = this.editor; return function() { $.each(editor.blockManager.blockTypes, function(i, type) { var block_type = SirTrevor.Blocks[type].prototype; var control = $(editor.blockControls.el).find(".st-block-controls__button[data-type='" + block_type.type + "']"); control.prop("disabled", !editor.blockManager.canCreateBlock(type)); }); }; }; SirTrevor.Locales.en.blocks = $.extend(SirTrevor.Locales.en.blocks, { autocompleteable: { placeholder: "Enter a title..." }, browse: { title: "Browse Categories", description: "This widget highlights browse categories. Each highlighted category links to the corresponding browse category results page.", item_counts: "Include item counts?" }, browse_group_categories: { autocomplete: "Enter a browse group title...", title: "Browse Group Categories", description: "This widget displays all browse categories associated with a selected browse group as a horizontally-scrolling row. Each selected browse group is displayed as a separate row. Each displayed category in a group links to the corresponding browse category results page.", item_counts: "Include category item counts?" }, link_to_search: { title: "Saved Searches", description: "This widget highlights saved searches. Each highlighted saved search links to the search results page generated by the saved search parameters. Any saved search listed on the Curation > Browse categories page, whether published or not, can be highlighted as a saved search.", item_counts: "Include item counts?" }, iframe: { title: "IFrame", description: "This widget embeds iframe-based embed code into pages", placeholder: "Enter embed code here. It should begin with e.g. ' { new UserIndex().connect(); new AdminIndex().connect(); }); return Spotlight$1; })); //# sourceMappingURL=spotlight.js.map