diff options
author | neodarz <neodarz@neodarz.net> | 2019-08-28 12:21:29 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-08-28 12:21:29 +0200 |
commit | e1e025823c6e868e59cde9ecc8fa495ee45de7bc (patch) | |
tree | ae3450c92daec3b99059a569510a24d6ab6753a6 /js | |
parent | 03588331342e2a401ae4a8617f6225325d099fa7 (diff) | |
download | shaarli_ascii-master.tar.xz shaarli_ascii-master.zip |
Diffstat (limited to '')
-rw-r--r-- | js/pluginsadmin.min.js | 1 | ||||
-rw-r--r-- | js/shaarli.js | 411 | ||||
-rw-r--r-- | js/shaarli.min.js | 1 | ||||
-rw-r--r-- | js/thumbnails.min.js | 5 | ||||
-rw-r--r-- | js/thumbnails_update.min.js | 1 |
5 files changed, 8 insertions, 411 deletions
diff --git a/js/pluginsadmin.min.js b/js/pluginsadmin.min.js new file mode 100644 index 0000000..3784750 --- /dev/null +++ b/js/pluginsadmin.min.js @@ -0,0 +1 @@ +(function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=3)})({3:function(){'use strict';function a(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function b(a,b){var c=a.getAttribute('data-line');a.setAttribute('data-order',b);var d=document.querySelector('[name="order_'+c+'"]');d.setAttribute('value',b)}function c(a,c){var d=parseInt(a,10)+c,e=document.querySelectorAll('[data-order="'+a+'"]'),f=document.querySelectorAll('[data-order="'+d+'"]');0<c&&(e=[].slice.call(e).reverse());for(var g,h=0;h<e.length;h+=1){g=f[0].parentNode,b(e[h],d),b(f[h],parseInt(a,10));var i=0>c?f[0]:f[f.length-1].nextSibling;g.insertBefore(e[h],i)}}function d(a){0!==a&&c(a,-1)}function e(a){var b=parseInt(document.querySelector('[data-order]:last-child').getAttribute('data-order'),10);a!==b&&c(a,1)}(function(){var b=document.querySelectorAll('.order');[].concat(a(b)).forEach(function(a){a.addEventListener('click',function(a){a.preventDefault(),a.target.classList.contains('order-up')?d(parseInt(a.target.parentNode.parentNode.getAttribute('data-order'),10)):a.target.classList.contains('order-down')&&e(parseInt(a.target.parentNode.parentNode.getAttribute('data-order'),10))})})})()}});
\ No newline at end of file diff --git a/js/shaarli.js b/js/shaarli.js deleted file mode 100644 index 4d47fcd..0000000 --- a/js/shaarli.js +++ /dev/null @@ -1,411 +0,0 @@ -/** @licstart The following is the entire license notice for the - * JavaScript code in this page. - * - * Copyright: (c) 2011-2015 Sébastien SAUVAGE <sebsauvage@sebsauvage.net> - * (c) 2011-2017 The Shaarli Community, see AUTHORS - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from - * the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would - * be appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and must - * not be misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source distribution. - * - * @licend The above is the entire license notice - * for the JavaScript code in this page. - */ - -window.onload = function () { - - /** - * Retrieve an element up in the tree from its class name. - */ - function getParentByClass(el, className) { - var p = el.parentNode; - if (p == null || p.classList.contains(className)) { - return p; - } - return getParentByClass(p, className); - } - - - /** - * Handle responsive menu. - * Source: http://purecss.io/layouts/tucked-menu-vertical/ - */ - (function (window, document) { - var menu = document.getElementById('shaarli-menu'), - WINDOW_CHANGE_EVENT = ('onorientationchange' in window) ? 'orientationchange':'resize'; - - function toggleHorizontal() { - [].forEach.call( - document.getElementById('shaarli-menu').querySelectorAll('.menu-transform'), - function(el){ - el.classList.toggle('pure-menu-horizontal'); - } - ); - }; - - function toggleMenu() { - // set timeout so that the panel has a chance to roll up - // before the menu switches states - if (menu.classList.contains('open')) { - setTimeout(toggleHorizontal, 500); - } - else { - toggleHorizontal(); - } - menu.classList.toggle('open'); - document.getElementById('menu-toggle').classList.toggle('x'); - }; - - function closeMenu() { - if (menu.classList.contains('open')) { - toggleMenu(); - } - } - - var menuToggle = document.getElementById('menu-toggle'); - if (menuToggle != null) { - menuToggle.addEventListener('click', function (e) { - toggleMenu(); - }); - } - - window.addEventListener(WINDOW_CHANGE_EVENT, closeMenu); - })(this, this.document); - - /** - * Fold/Expand shaares description and thumbnail. - */ - var foldAllButtons = document.getElementsByClassName('fold-all'); - var foldButtons = document.getElementsByClassName('fold-button'); - - [].forEach.call(foldButtons, function (foldButton) { - // Retrieve description - var description = null; - var thumbnail = null; - var linklistItem = getParentByClass(foldButton, 'linklist-item'); - if (linklistItem != null) { - description = linklistItem.querySelector('.linklist-item-description'); - thumbnail = linklistItem.querySelector('.linklist-item-thumbnail'); - if (description != null || thumbnail != null) { - foldButton.style.display = 'inline'; - } - } - - foldButton.addEventListener('click', function (event) { - event.preventDefault(); - toggleFold(event.target, description, thumbnail); - }); - }); - - if (foldAllButtons != null) { - [].forEach.call(foldAllButtons, function (foldAllButton) { - foldAllButton.addEventListener('click', function (event) { - event.preventDefault(); - var state = foldAllButton.firstElementChild.getAttribute('class').indexOf('down') != -1 ? 'down' : 'up'; - [].forEach.call(foldButtons, function (foldButton) { - if (foldButton.firstElementChild.classList.contains('fa-chevron-up') && state == 'down' - || foldButton.firstElementChild.classList.contains('fa-chevron-down') && state == 'up' - ) { - return; - } - // Retrieve description - var description = null; - var thumbnail = null; - var linklistItem = getParentByClass(foldButton, 'linklist-item'); - if (linklistItem != null) { - description = linklistItem.querySelector('.linklist-item-description'); - thumbnail = linklistItem.querySelector('.linklist-item-thumbnail'); - if (description != null || thumbnail != null) { - foldButton.style.display = 'inline'; - } - } - - toggleFold(foldButton.firstElementChild, description, thumbnail); - }); - foldAllButton.firstElementChild.classList.toggle('fa-chevron-down'); - foldAllButton.firstElementChild.classList.toggle('fa-chevron-up'); - }); - }); - } - - function toggleFold(button, description, thumb) - { - // Switch fold/expand - up = fold - if (button.classList.contains('fa-chevron-up')) { - button.title = 'Expand'; - if (description != null) { - description.style.display = 'none'; - } - if (thumb != null) { - thumb.style.display = 'none'; - } - } - else { - button.title = 'Fold'; - if (description != null) { - description.style.display = 'block'; - } - if (thumb != null) { - thumb.style.display = 'block'; - } - } - button.classList.toggle('fa-chevron-down'); - button.classList.toggle('fa-chevron-up'); - } - - /** - * Confirmation message before deletion. - */ - var deleteLinks = document.querySelectorAll('.confirm-delete'); - [].forEach.call(deleteLinks, function(deleteLink) { - deleteLink.addEventListener('click', function(event) { - if(! confirm('Are you sure you want to delete this link ?')) { - event.preventDefault(); - } - }); - }); - - /** - * Close alerts - */ - var closeLinks = document.querySelectorAll('.pure-alert-close'); - [].forEach.call(closeLinks, function(closeLink) { - closeLink.addEventListener('click', function(event) { - var alert = getParentByClass(event.target, 'pure-alert-closable'); - alert.style.display = 'none'; - }); - }); - - /** - * New version dismiss. - * Hide the message for one week using localStorage. - */ - var newVersionDismiss = document.getElementById('new-version-dismiss'); - var newVersionMessage = document.querySelector('.new-version-message'); - if (newVersionMessage != null - && localStorage.getItem('newVersionDismiss') != null - && parseInt(localStorage.getItem('newVersionDismiss')) + 7*24*60*60*1000 > (new Date()).getTime() - ) { - newVersionMessage.style.display = 'none'; - } - if (newVersionDismiss != null) { - newVersionDismiss.addEventListener('click', function () { - localStorage.setItem('newVersionDismiss', (new Date()).getTime()); - }); - } - - var hiddenReturnurl = document.getElementsByName('returnurl'); - if (hiddenReturnurl != null) { - hiddenReturnurl.value = window.location.href; - } - - /** - * Autofocus text fields - */ - // ES6 syntax - let autofocusElements = document.querySelectorAll('.autofocus'); - for (let autofocusElement of autofocusElements) { - if (autofocusElement.value == '') { - autofocusElement.focus(); - break; - } - } - - /** - * Handle sub menus/forms - */ - var openers = document.getElementsByClassName('subheader-opener'); - if (openers != null) { - [].forEach.call(openers, function(opener) { - opener.addEventListener('click', function(event) { - event.preventDefault(); - - var id = opener.getAttribute('data-open-id'); - var sub = document.getElementById(id); - - if (sub != null) { - [].forEach.call(document.getElementsByClassName('subheader-form'), function (element) { - if (element != sub) { - removeClass(element, 'open') - } - }); - - sub.classList.toggle('open'); - } - }); - }); - } - - function removeClass(element, classname) { - element.className = element.className.replace(new RegExp('(?:^|\\s)'+ classname + '(?:\\s|$)'), ' '); - } - - /** - * Remove CSS target padding (for fixed bar) - */ - if (location.hash != '') { - var anchor = document.getElementById(location.hash.substr(1)); - if (anchor != null) { - var padsize = anchor.clientHeight; - this.window.scroll(0, this.window.scrollY - padsize); - anchor.style.paddingTop = 0; - } - } - - /** - * Text area resizer - */ - var description = document.getElementById('lf_description'); - var observe = function (element, event, handler) { - element.addEventListener(event, handler, false); - }; - function init () { - function resize () { - description.style.height = 'auto'; - description.style.height = description.scrollHeight+10+'px'; - } - /* 0-timeout to get the already changed text */ - function delayedResize () { - window.setTimeout(resize, 0); - } - observe(description, 'change', resize); - observe(description, 'cut', delayedResize); - observe(description, 'paste', delayedResize); - observe(description, 'drop', delayedResize); - observe(description, 'keydown', delayedResize); - - resize(); - } - - if (description != null) { - init(); - // Submit editlink form with CTRL + Enter in the text area. - description.addEventListener('keydown', function (event) { - if (event.ctrlKey && event.keyCode === 13) { - document.getElementById('button-save-edit').click(); - } - }); - } - - /** - * Awesomplete trigger. - */ - var tags = document.getElementById('lf_tags'); - if (tags != null) { - awesompleteUniqueTag('#lf_tags'); - } - - /** - * bLazy trigger - */ - var picwall = document.getElementById('picwall_container'); - if (picwall != null) { - var bLazy = new Blazy(); - } - - /** - * Bookmarklet alert - */ - var bookmarkletLinks = document.querySelectorAll('.bookmarklet-link'); - var bkmMessage = document.getElementById('bookmarklet-alert'); - [].forEach.call(bookmarkletLinks, function(link) { - link.addEventListener('click', function(event) { - event.preventDefault(); - alert(bkmMessage.value); - }); - }); - - /** - * Firefox Social - */ - var ffButton = document.getElementById('ff-social-button'); - if (ffButton != null) { - ffButton.addEventListener('click', function(event) { - activateFirefoxSocial(event.target); - }); - } - - /** - * Plugin admin order - */ - var orderPA = document.querySelectorAll('.order'); - [].forEach.call(orderPA, function(link) { - link.addEventListener('click', function(event) { - event.preventDefault(); - if (event.target.classList.contains('order-up')) { - return orderUp(event.target.parentNode.parentNode.getAttribute('data-order')); - } else if (event.target.classList.contains('order-down')) { - return orderDown(event.target.parentNode.parentNode.getAttribute('data-order')); - } - }); - }); - - var continent = document.getElementById('continent'); - var city = document.getElementById('city'); - if (continent != null && city != null) { - continent.addEventListener('change', function(event) { - hideTimezoneCities(city, continent.options[continent.selectedIndex].value, true); - }); - hideTimezoneCities(city, continent.options[continent.selectedIndex].value, false); - } -}; - -function activateFirefoxSocial(node) { - var loc = location.href; - var baseURL = loc.substring(0, loc.lastIndexOf("/")); - - // Keeping the data separated (ie. not in the DOM) so that it's maintainable and diffable. - var data = { - name: "{$shaarlititle}", - description: "The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community.", - author: "Shaarli", - version: "1.0.0", - - iconURL: baseURL + "/images/favicon.ico", - icon32URL: baseURL + "/images/favicon.ico", - icon64URL: baseURL + "/images/favicon.ico", - - shareURL: baseURL + "{noparse}?post=%{url}&title=%{title}&description=%{text}&source=firefoxsocialapi{/noparse}", - homepageURL: baseURL - }; - node.setAttribute("data-service", JSON.stringify(data)); - - var activate = new CustomEvent("ActivateSocialFeature"); - node.dispatchEvent(activate); -} - -/** - * Add the class 'hidden' to city options not attached to the current selected continent. - * - * @param cities List of <option> elements - * @param currentContinent Current selected continent - * @param reset Set to true to reset the selected value - */ -function hideTimezoneCities(cities, currentContinent, reset = false) { - var first = true; - [].forEach.call(cities, function(option) { - if (option.getAttribute('data-continent') != currentContinent) { - option.className = 'hidden'; - } else { - option.className = ''; - if (reset === true && first === true) { - option.setAttribute('selected', 'selected'); - first = false; - } - } - }); -} diff --git a/js/shaarli.min.js b/js/shaarli.min.js new file mode 100644 index 0000000..9f3b9ba --- /dev/null +++ b/js/shaarli.min.js @@ -0,0 +1 @@ +(function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=4)})([,,,,function(a,b,c){c(5),c(7),c(8),c(9),a.exports=c(10)},function(a,b,c){'use strict';function d(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function e(a,b,c){for(var d=function(b){return''!==c[b]&&-1!==a.getAttribute(b).indexOf(c[b])};a;){if(a.tagName.toLowerCase()===b&&Object.keys(c).find(d))return a;a=a.parentElement}return null}function f(){var a=new XMLHttpRequest;a.open('GET','?do=token'),a.onload=function(){var b=document.getElementById('token');b.setAttribute('value',a.responseText)},a.send()}function g(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[],c=new s.default(s.default.$(a));c.filter=function(a,b){return s.default.FILTER_CONTAINS(a,b.match(/[^ ]*$/)[0])},c.replace=function(a){var b=c.input.value.match(/^.+ \s*|/)[0];c.input.value=''+b+a+' '},c.item=function(a,b){return s.default.ITEM(a,b.match(/[^ ]*$/)[0])};var d=/(\w+) /g,e=void 0;return c.data=function(a,b){for(;e=d.exec(b);)if(a===e[1])return'';return a},c.minChars=1,b.length&&(c.list=b),c}function h(a,b,c){if(0===c.length){var e=document.querySelectorAll(a);[].concat(d(e)).forEach(function(a){c.push(g(a,b))})}else c.map(function(a){return a.list=b,a});return c}function i(a){return a.replace(/[\u00A0-\u9999<>&]/gim,function(a){return'&#'+a.charCodeAt(0)+';'})}function j(a,b){var c=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null,e=!0;null==c&&(c=!1),[].concat(d(a)).forEach(function(a){a.getAttribute('data-continent')===b?(a.className='',!0===c&&!0==e&&(a.setAttribute('selected','selected'),e=!1)):a.className='hidden'})}function k(a,b){var c=a.parentNode;return null==c||c.classList.contains(b)?c:k(c,b)}function l(){[].concat(d(document.getElementById('shaarli-menu').querySelectorAll('.menu-transform'))).forEach(function(a){a.classList.toggle('pure-menu-horizontal')})}function m(a){a.classList.contains('open')?setTimeout(l,500):l(),a.classList.toggle('open'),document.getElementById('menu-toggle').classList.toggle('x')}function n(a){a.classList.contains('open')&&m(a)}function o(a,b,c){a.classList.contains('fa-chevron-up')?(a.title=document.getElementById('translation-expand').innerHTML,null!=b&&(b.style.display='none'),null!=c&&(c.style.display='none')):(a.title=document.getElementById('translation-fold').innerHTML,null!=b&&(b.style.display='block'),null!=c&&(c.style.display='block')),a.classList.toggle('fa-chevron-down'),a.classList.toggle('fa-chevron-up')}function p(a,b){a.className=a.className.replace(new RegExp('(?:^|\\s)'+b+'(?:\\s|$)'),' ')}function q(a){function b(){var b=window.pageYOffset||(document.documentElement||document.body.parentNode||document.body).scrollTop;a.style.height='auto',a.style.height=a.scrollHeight+10+'px',window.scrollTo(0,b)}function c(){window.setTimeout(b,0)}var d=function(a,b,c){a.addEventListener(b,c,!1)};d(a,'change',b),d(a,'cut',c),d(a,'paste',c),d(a,'drop',c),d(a,'keydown',c),b()}var r=c(6),s=function(a){return a&&a.__esModule?a:{default:a}}(r);(function(){var a=document.getElementById('shaarli-menu'),b='onorientationchange'in window?'orientationchange':'resize',c=document.getElementById('menu-toggle');null!=c&&c.addEventListener('click',function(){return m(a)}),window.addEventListener(b,function(){return n(a)});var l=document.getElementsByClassName('fold-all'),r=document.getElementsByClassName('fold-button');[].concat(d(r)).forEach(function(a){var b=null,c=null,d=k(a,'linklist-item');null!=d&&(b=d.querySelector('.linklist-item-description'),c=d.querySelector('.linklist-item-thumbnail'),(null!=b||null!=c)&&(a.style.display='inline')),a.addEventListener('click',function(a){a.preventDefault(),o(a.target,b,c)})}),null!=l&&[].forEach.call(l,function(a){a.addEventListener('click',function(b){b.preventDefault();var c=-1===a.firstElementChild.getAttribute('class').indexOf('down')?'up':'down';[].forEach.call(r,function(a){if(!(a.firstElementChild.classList.contains('fa-chevron-up')&&'down'==c||a.firstElementChild.classList.contains('fa-chevron-down')&&'up'==c)){var b=null,d=null,e=k(a,'linklist-item');null!=e&&(b=e.querySelector('.linklist-item-description'),d=e.querySelector('.linklist-item-thumbnail'),(null!=b||null!=d)&&(a.style.display='inline')),o(a.firstElementChild,b,d)}}),a.firstElementChild.classList.toggle('fa-chevron-down'),a.firstElementChild.classList.toggle('fa-chevron-up'),a.title='down'==c?document.getElementById('translation-fold-all').innerHTML:document.getElementById('translation-expand-all').innerHTML})});var s=document.querySelectorAll('.confirm-delete');[].concat(d(s)).forEach(function(a){a.addEventListener('click',function(a){confirm(document.getElementById('translation-delete-link').innerHTML)||a.preventDefault()})});var t=document.querySelectorAll('.pure-alert-close');[].concat(d(t)).forEach(function(a){a.addEventListener('click',function(a){var b=k(a.target,'pure-alert-closable');b.style.display='none'})});var u=document.getElementById('new-version-dismiss'),v=document.querySelector('.new-version-message');null!=v&&null!=localStorage.getItem('newVersionDismiss')&&parseInt(localStorage.getItem('newVersionDismiss'),10)+604800000>new Date().getTime()&&(v.style.display='none'),null!=u&&u.addEventListener('click',function(){localStorage.setItem('newVersionDismiss',new Date().getTime().toString())});var w=document.getElementsByName('returnurl');null!=w&&(w.value=window.location.href);var x=document.querySelectorAll('.autofocus'),y=!1;[].forEach.call(x,function(a){''!==a.value||y||(a.focus(),y=!0)});var z=document.getElementsByClassName('subheader-opener');if(null!=z&&[].concat(d(z)).forEach(function(a){a.addEventListener('click',function(b){b.preventDefault();var c=a.getAttribute('data-open-id'),e=document.getElementById(c);null!=e&&([].concat(d(document.getElementsByClassName('subheader-form'))).forEach(function(a){a!==e&&p(a,'open')}),e.classList.toggle('open'))})}),''!==location.hash){var A=document.getElementById(location.hash.substr(1));if(null!=A){var B=A.clientHeight;window.scroll(0,window.scrollY-B),A.style.paddingTop='0'}}var C=document.getElementById('lf_description');null!=C&&(q(C),C.addEventListener('keydown',function(a){a.ctrlKey&&13===a.keyCode&&document.getElementById('button-save-edit').click()}));var D=document.querySelectorAll('.bookmarklet-link'),E=document.getElementById('bookmarklet-alert');[].forEach.call(D,function(a){a.addEventListener('click',function(a){a.preventDefault(),alert(E.value)})});var F=document.getElementById('continent'),G=document.getElementById('city');null!=F&&null!=G&&(F.addEventListener('change',function(){j(G,F.options[F.selectedIndex].value,!0)}),j(G,F.options[F.selectedIndex].value,!1));var H=document.querySelectorAll('.link-checkbox'),I=document.getElementById('actions');[].concat(d(H)).forEach(function(a){a.style.display='inline-block',a.addEventListener('change',function(){var a=document.querySelectorAll('.link-checkbox:checked'),b=[].concat(d(a)).length;0===b&&I.classList.contains('open')?I.classList.toggle('open'):0<b&&!I.classList.contains('open')&&I.classList.toggle('open')})});var J=document.getElementById('actions-delete'),K=document.getElementById('token');null!=J&&null!=K&&J.addEventListener('click',function(a){a.preventDefault();var b=[],c=document.querySelectorAll('.link-checkbox:checked');[].concat(d(c)).forEach(function(a){b.push({id:a.value,title:document.querySelector('.linklist-item[data-id="'+a.value+'"] .linklist-link').innerHTML})});var e='Are you sure you want to delete '+b.length+' links?\n';e+='This action is IRREVERSIBLE!\n\nTitles:\n';var f=[];b.forEach(function(a){e+=' - '+a.title+'\n',f.push(a.id)}),window.confirm(e)&&(window.location='?delete_link&lf_linkdate='+f.join('+')+'&token='+K.value)});var L=document.querySelectorAll('.actions-change-visibility');null!=L&&null!=K&&[].concat(d(L)).forEach(function(a){a.addEventListener('click',function(a){a.preventDefault();var b=a.target.getAttribute('data-visibility'),c=[],e=document.querySelectorAll('.link-checkbox:checked');[].concat(d(e)).forEach(function(a){c.push({id:a.value,title:document.querySelector('.linklist-item[data-id="'+a.value+'"] .linklist-link').innerHTML})});var f=c.map(function(a){return a.id});window.location='?change_visibility&token='+K.value+'&newVisibility='+b+'&ids='+f.join('+')})});var M=document.querySelectorAll('.select-all-button');[].concat(d(M)).forEach(function(a){a.addEventListener('click',function(b){b.preventDefault();var c=a.classList.contains('filter-off');[].concat(d(M)).forEach(function(a){a.classList.toggle('filter-off'),a.classList.toggle('filter-on')}),[].concat(d(H)).forEach(function(a){a.checked=c,a.dispatchEvent(new Event('change'))})})});var N=document.querySelector('input[name="taglist"]'),O=N?N.value.split(' '):[],P=[],Q=document.querySelectorAll('.rename-tag');[].concat(d(Q)).forEach(function(a){a.addEventListener('click',function(a){a.preventDefault();var b=e(a.target,'div',{class:'tag-list-item'}),c=b.querySelector('.rename-tag-form');c.style.display='none'===c.style.display||''===c.style.display?'block':'none',b.querySelector('input').focus()})});var R=document.querySelectorAll('.validate-rename-tag');[].concat(d(R)).forEach(function(a){a.addEventListener('click',function(a){a.preventDefault();var b=e(a.target,'div',{class:'tag-list-item'}),c=b.querySelector('.rename-tag-input'),d=c.value.replace('/"/g','\\"');if(''!==d.trim()){var g=document.getElementById('token').value,j=b.getAttribute('data-tag'),k=new XMLHttpRequest;k.open('POST','?do=changetag'),k.setRequestHeader('Content-Type','application/x-www-form-urlencoded'),k.onload=function(){200===k.status?(b.setAttribute('data-tag',d),c.setAttribute('name',d),c.setAttribute('value',d),e(c,'div',{class:'rename-tag-form'}).style.display='none',b.querySelector('a.tag-link').innerHTML=i(d),b.querySelector('a.tag-link').setAttribute('href','?searchtags='+encodeURIComponent(d)),b.querySelector('a.rename-tag').setAttribute('href','?do=changetag&fromtag='+encodeURIComponent(d)),O=O.map(function(a){return a===j?d:a}),P=h('.rename-tag-input',O,P)):(alert('An error occurred. Return code: '+k.status),location.reload())},k.send('renametag=1&fromtag='+encodeURIComponent(j)+'&totag='+encodeURIComponent(d)+'&token='+g),f()}})});var S=document.querySelectorAll('.rename-tag-input');[].concat(d(S)).forEach(function(a){a.addEventListener('keypress',function(a){13===a.keyCode&&e(a.target,'div',{class:'tag-list-item'}).querySelector('.validate-rename-tag').click()})});var T=document.querySelectorAll('.delete-tag');[].concat(d(T)).forEach(function(a){a.style.display='inline',a.addEventListener('click',function(a){a.preventDefault();var b=e(a.target,'div',{class:'tag-list-item'}),c=b.getAttribute('data-tag'),d=document.getElementById('token').value;if(confirm('Are you sure you want to delete the tag "'+c+'"?')){var g=new XMLHttpRequest;g.open('POST','?do=changetag'),g.setRequestHeader('Content-Type','application/x-www-form-urlencoded'),g.onload=function(){b.remove()},g.send(encodeURI('deletetag=1&fromtag='+c+'&token='+d)),f(),O=O.filter(function(a){return a!==c}),P=h('.rename-tag-input',O,P)}})});var U=document.querySelectorAll('input[data-multiple]');[].concat(d(U)).forEach(function(a){P.push(g(a))})})()},function(a){(function(){function b(a){var b=Array.isArray(a)?{label:a[0],value:a[1]}:'object'==typeof a&&'label'in a&&'value'in a?a:{label:a,value:a};this.label=b.label||b.value,this.value=b.value}function c(a,b,c){for(var d in b){var e=b[d],f=a.input.getAttribute('data-'+d.toLowerCase());a[d]='number'==typeof e?parseInt(f):!1===e?null!==f:e instanceof Function?null:f,a[d]||0===a[d]||(a[d]=d in c?c[d]:e)}}function d(a,b){return'string'==typeof a?(b||document).querySelector(a):a||null}function e(a,b){return h.call((b||document).querySelectorAll(a))}function f(){e('input.awesomplete').forEach(function(a){new g(a)})}var g=function(a,b){var e=this;g.count=(g.count||0)+1,this.count=g.count,this.isOpened=!1,this.input=d(a),this.input.setAttribute('autocomplete','off'),this.input.setAttribute('aria-owns','awesomplete_list_'+this.count),this.input.setAttribute('role','combobox'),this.options=b=b||{},c(this,{minChars:2,maxItems:10,autoFirst:!1,data:g.DATA,filter:g.FILTER_CONTAINS,sort:!1!==b.sort&&g.SORT_BYLENGTH,container:g.CONTAINER,item:g.ITEM,replace:g.REPLACE,tabSelect:!1},b),this.index=-1,this.container=this.container(a),this.ul=d.create('ul',{hidden:'hidden',role:'listbox',id:'awesomplete_list_'+this.count,inside:this.container}),this.status=d.create('span',{className:'visually-hidden',role:'status',"aria-live":'assertive',"aria-atomic":!0,inside:this.container,textContent:0==this.minChars?'Begin typing for results.':'Type '+this.minChars+' or more characters for results.'}),this._events={input:{input:this.evaluate.bind(this),blur:this.close.bind(this,{reason:'blur'}),keydown:function(a){var b=a.keyCode;e.opened&&(13===b&&e.selected?(a.preventDefault(),e.select()):9===b&&e.selected&&e.tabSelect?e.select():27===b?e.close({reason:'esc'}):(38===b||40===b)&&(a.preventDefault(),e[38===b?'previous':'next']()))}},form:{submit:this.close.bind(this,{reason:'submit'})},ul:{mousedown:function(a){a.preventDefault()},click:function(a){var b=a.target;if(b!==this){for(;b&&!/li/i.test(b.nodeName);)b=b.parentNode;b&&0===a.button&&(a.preventDefault(),e.select(b,a.target))}}}},d.bind(this.input,this._events.input),d.bind(this.input.form,this._events.form),d.bind(this.ul,this._events.ul),this.input.hasAttribute('list')?(this.list='#'+this.input.getAttribute('list'),this.input.removeAttribute('list')):this.list=this.input.getAttribute('data-list')||b.list||[],g.all.push(this)};g.prototype={set list(a){if(Array.isArray(a))this._list=a;else if('string'==typeof a&&-1<a.indexOf(','))this._list=a.split(/\s*,\s*/);else if(a=d(a),a&&a.children){var b=[];h.apply(a.children).forEach(function(a){if(!a.disabled){var c=a.textContent.trim(),d=a.value||c,e=a.label||c;''!==d&&b.push({label:e,value:d})}}),this._list=b}document.activeElement===this.input&&this.evaluate()},get selected(){return-1<this.index},get opened(){return this.isOpened},close:function(a){this.opened&&(this.ul.setAttribute('hidden',''),this.isOpened=!1,this.index=-1,this.status.setAttribute('hidden',''),d.fire(this.input,'awesomplete-close',a||{}))},open:function(){this.ul.removeAttribute('hidden'),this.isOpened=!0,this.status.removeAttribute('hidden'),this.autoFirst&&-1===this.index&&this.goto(0),d.fire(this.input,'awesomplete-open')},destroy:function(){if(d.unbind(this.input,this._events.input),d.unbind(this.input.form,this._events.form),!this.options.container){var a=this.container.parentNode;a.insertBefore(this.input,this.container),a.removeChild(this.container)}this.input.removeAttribute('autocomplete'),this.input.removeAttribute('aria-autocomplete');var b=g.all.indexOf(this);-1!==b&&g.all.splice(b,1)},next:function(){var a=this.ul.children.length;this.goto(this.index<a-1?this.index+1:a?0:-1)},previous:function(){var a=this.ul.children.length,b=this.index-1;this.goto(this.selected&&-1!=b?b:a-1)},goto:function(a){var b=this.ul.children;this.selected&&b[this.index].setAttribute('aria-selected','false'),this.index=a,-1<a&&0<b.length&&(b[a].setAttribute('aria-selected','true'),this.status.textContent=b[a].textContent+', list item '+(a+1)+' of '+b.length,this.input.setAttribute('aria-activedescendant',this.ul.id+'_item_'+this.index),this.ul.scrollTop=b[a].offsetTop-this.ul.clientHeight+b[a].clientHeight,d.fire(this.input,'awesomplete-highlight',{text:this.suggestions[this.index]}))},select:function(a,b){if(a?this.index=d.siblingIndex(a):a=this.ul.children[this.index],a){var c=this.suggestions[this.index],e=d.fire(this.input,'awesomplete-select',{text:c,origin:b||a});e&&(this.replace(c),this.close({reason:'select'}),d.fire(this.input,'awesomplete-selectcomplete',{text:c}))}},evaluate:function(){var a=this,c=this.input.value;c.length>=this.minChars&&this._list&&0<this._list.length?(this.index=-1,this.ul.innerHTML='',this.suggestions=this._list.map(function(d){return new b(a.data(d,c))}).filter(function(b){return a.filter(b,c)}),!1!==this.sort&&(this.suggestions=this.suggestions.sort(this.sort)),this.suggestions=this.suggestions.slice(0,this.maxItems),this.suggestions.forEach(function(b,d){a.ul.appendChild(a.item(b,c,d))}),0===this.ul.children.length?(this.status.textContent='No results found',this.close({reason:'nomatches'})):(this.open(),this.status.textContent=this.ul.children.length+' results found')):(this.close({reason:'nomatches'}),this.status.textContent='No results found')}},g.all=[],g.FILTER_CONTAINS=function(a,b){return RegExp(d.regExpEscape(b.trim()),'i').test(a)},g.FILTER_STARTSWITH=function(a,b){return RegExp('^'+d.regExpEscape(b.trim()),'i').test(a)},g.SORT_BYLENGTH=function(c,a){return c.length===a.length?c<a?-1:1:c.length-a.length},g.CONTAINER=function(a){return d.create('div',{className:'awesomplete',around:a})},g.ITEM=function(a,b,c){var e=''===b.trim()?a:a.replace(RegExp(d.regExpEscape(b.trim()),'gi'),'<mark>$&</mark>');return d.create('li',{innerHTML:e,"aria-selected":'false',id:'awesomplete_list_'+this.count+'_item_'+c})},g.REPLACE=function(a){this.input.value=a.value},g.DATA=function(a){return a},Object.defineProperty(b.prototype=Object.create(String.prototype),'length',{get:function(){return this.label.length}}),b.prototype.toString=b.prototype.valueOf=function(){return''+this.label};var h=Array.prototype.slice;return d.create=function(a,b){var c=document.createElement(a);for(var e in b){var f=b[e];if('inside'==e)d(f).appendChild(c);else if('around'==e){var g=d(f);g.parentNode.insertBefore(c,g),c.appendChild(g),null!=g.getAttribute('autofocus')&&g.focus()}else e in c?c[e]=f:c.setAttribute(e,f)}return c},d.bind=function(a,b){if(a)for(var c in b){var d=b[c];c.split(/\s+/).forEach(function(b){a.addEventListener(b,d)})}},d.unbind=function(a,b){if(a)for(var c in b){var d=b[c];c.split(/\s+/).forEach(function(b){a.removeEventListener(b,d)})}},d.fire=function(a,b,c){var d=document.createEvent('HTMLEvents');for(var e in d.initEvent(b,!0,!0),c)d[e]=c[e];return a.dispatchEvent(d)},d.regExpEscape=function(a){return a.replace(/[-\\^$*+?.()|[\]{}]/g,'\\$&')},d.siblingIndex=function(a){for(var b=0;a=a.previousElementSibling;b++);return b},'undefined'!=typeof self&&(self.Awesomplete=g),'undefined'!=typeof Document&&('loading'===document.readyState?document.addEventListener('DOMContentLoaded',f):f()),g.$=d,g.$$=e,'object'==typeof a&&a.exports&&(a.exports=g),g})()},function(){},function(a){a.exports='tpl/default/img/../img/apple-touch-icon.png'},function(a){a.exports='tpl/default/img/../img/favicon.png'},function(a){a.exports='tpl/default/img/../img/sad_star.png'}]);
\ No newline at end of file diff --git a/js/thumbnails.min.js b/js/thumbnails.min.js new file mode 100644 index 0000000..bca3c65 --- /dev/null +++ b/js/thumbnails.min.js @@ -0,0 +1,5 @@ +(function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=0)})([function(a,b,c){'use strict';var d=c(1),e=function(a){return a&&a.__esModule?a:{default:a}}(d);(function(){new e.default})()},function(a,b,c){var d,e;/*! + hey, [be]Lazy.js - v1.8.2 - 2016.10.25 + A fast, small and dependency free lazy load script (https://github.com/dinbror/blazy) + (c) Bjoern Klinggaard - @bklinggaard - http://dinbror.dk/blazy +*/(function(f,g){d=g,e='function'==typeof d?d.call(b,c,b,a):d,!(e!==void 0&&(a.exports=e))})(this,function(){'use strict';function a(a){var c=a._util;c.elements=o(a.options),c.count=c.elements.length,c.destroyed&&(c.destroyed=!1,a.options.container&&t(a.options.container,function(a){q(a,'scroll',c.validateT)}),q(window,'resize',c.saveViewportOffsetT),q(window,'resize',c.validateT),q(window,'scroll',c.validateT)),b(a)}function b(a){for(var b,d=a._util,e=0;e<d.count;e++)b=d.elements[e],(c(b,a.options)||m(b,a.options.successClass))&&(a.load(b),d.elements.splice(e,1),d.count--,e--);0===d.count&&a.destroy()}function c(a,b){var c=a.getBoundingClientRect();if(b.container&&y){var e=a.closest(b.containerClass);if(e){var f=e.getBoundingClientRect();if(d(f,w)){var g=f.top-b.offset,h=f.right+b.offset,i=f.bottom+b.offset,j=f.left-b.offset,k={top:g>w.top?g:w.top,right:h<w.right?h:w.right,bottom:i<w.bottom?i:w.bottom,left:j>w.left?j:w.left};return d(c,k)}return!1}}return d(c,w)}function d(a,b){return a.right>=b.left&&a.bottom>=b.top&&a.left<=b.right&&a.top<=b.bottom}function e(a,b,c){if(!m(a,c.successClass)&&(b||c.loadInvisible||0<a.offsetWidth&&0<a.offsetHeight)){var d=j(a,v)||j(a,c.src);if(d){var e=d.split(c.separator),i=e[x&&1<e.length?1:0],k=j(a,c.srcset),o=l(a,'img'),p=a.parentNode,u=p&&l(p,'picture');if(o||a.src===void 0){var w=new Image,y=function(){c.error&&c.error(a,'invalid'),n(a,c.errorClass),r(w,'error',y),r(w,'load',A)},A=function(){o?!u&&h(a,i,k):a.style.backgroundImage='url("'+i+'")',f(a,c),r(w,'load',A),r(w,'error',y)};u&&(w=a,t(p.getElementsByTagName('source'),function(a){g(a,z,c.srcset)})),q(w,'error',y),q(w,'load',A),h(w,i,k)}else a.src=i,f(a,c)}else l(a,'video')?(t(a.getElementsByTagName('source'),function(a){g(a,s,c.src)}),a.load(),f(a,c)):(c.error&&c.error(a,'missing'),n(a,c.errorClass))}}function f(a,b){n(a,b.successClass),b.success&&b.success(a),k(a,b.src),k(a,b.srcset),t(b.breakpoints,function(b){k(a,b.src)})}function g(a,b,c){var d=j(a,c);d&&(i(a,b,d),k(a,c))}function h(a,b,c){c&&i(a,z,c),a.src=b}function i(a,b,c){a.setAttribute(b,c)}function j(a,b){return a.getAttribute(b)}function k(a,b){a.removeAttribute(b)}function l(a,b){return a.nodeName.toLowerCase()===b}function m(a,b){return-1!==(' '+a.className+' ').indexOf(' '+b+' ')}function n(a,b){m(a,b)||(a.className+=' '+b)}function o(a){for(var b=[],c=a.root.querySelectorAll(a.selector),d=c.length;d--;b.unshift(c[d]));return b}function p(a){w.bottom=(window.innerHeight||document.documentElement.clientHeight)+a,w.right=(window.innerWidth||document.documentElement.clientWidth)+a}function q(a,b,c){a.attachEvent?a.attachEvent&&a.attachEvent('on'+b,c):a.addEventListener(b,c,{capture:!1,passive:!0})}function r(a,b,c){a.detachEvent?a.detachEvent&&a.detachEvent('on'+b,c):a.removeEventListener(b,c,{capture:!1,passive:!0})}function t(a,b){if(a&&b)for(var c=a.length,d=0;d<c&&!1!==b(a[d],d);d++);}function u(a,b,c){var d=0;return function(){var e=+new Date;e-d<b||(d=e,a.apply(c,arguments))}}var v,w,x,y,s='src',z='srcset';return function(c){if(!document.querySelectorAll){var d=document.createStyleSheet();document.querySelectorAll=function(b,e,c,f,g){for(g=document.all,e=[],b=b.replace(/\[for\b/gi,'[htmlFor').split(','),c=b.length;c--;){for(d.addRule(b[c],'k:v'),f=g.length;f--;)g[f].currentStyle.k&&e.push(g[f]);d.removeRule(0)}return e}}var f=this,g=f._util={};g.elements=[],g.destroyed=!0,f.options=c||{},f.options.error=f.options.error||!1,f.options.offset=f.options.offset||100,f.options.root=f.options.root||document,f.options.success=f.options.success||!1,f.options.selector=f.options.selector||'.b-lazy',f.options.separator=f.options.separator||'|',f.options.containerClass=f.options.container,f.options.container=!!f.options.containerClass&&document.querySelectorAll(f.options.containerClass),f.options.errorClass=f.options.errorClass||'b-error',f.options.breakpoints=f.options.breakpoints||!1,f.options.loadInvisible=f.options.loadInvisible||!1,f.options.successClass=f.options.successClass||'b-loaded',f.options.validateDelay=f.options.validateDelay||25,f.options.saveViewportOffsetDelay=f.options.saveViewportOffsetDelay||50,f.options.srcset=f.options.srcset||'data-srcset',f.options.src=v=f.options.src||'data-src',y=Element.prototype.closest,x=1<window.devicePixelRatio,w={},w.top=0-f.options.offset,w.left=0-f.options.offset,f.revalidate=function(){a(f)},f.load=function(a,b){var c=this.options;a&&a.length===void 0?e(a,b,c):t(a,function(a){e(a,b,c)})},f.destroy=function(){var a=f._util;f.options.container&&t(f.options.container,function(b){r(b,'scroll',a.validateT)}),r(window,'scroll',a.validateT),r(window,'resize',a.validateT),r(window,'resize',a.saveViewportOffsetT),a.count=0,a.elements.length=0,a.destroyed=!0},g.validateT=u(function(){b(f)},f.options.validateDelay,f),g.saveViewportOffsetT=u(function(){p(f.options.offset)},f.options.saveViewportOffsetDelay,f),p(f.options.offset),t(f.options.breakpoints,function(a){if(a.width>=window.screen.width)return v=a.src,!1}),setTimeout(function(){a(f)})}})}]);
\ No newline at end of file diff --git a/js/thumbnails_update.min.js b/js/thumbnails_update.min.js new file mode 100644 index 0000000..b64847b --- /dev/null +++ b/js/thumbnails_update.min.js @@ -0,0 +1 @@ +(function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a['default']}:function(){return a};return b.d(c,'a',c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p='',b(b.s=2)})({2:function(){'use strict';function a(b,c,d){var e=new XMLHttpRequest;e.open('POST','?do=ajax_thumb_update'),e.setRequestHeader('Content-Type','application/x-www-form-urlencoded'),e.responseType='json',e.onload=function(){if(200!==e.status)alert('An error occurred. Return code: '+e.status);else{var f=e.response;c+=1,d.progressBar.style.width=100*c/b.length+'%',d.current.innerHTML=c,d.title.innerHTML=f.title,!1!==f.thumbnail&&(d.thumbnail.innerHTML='<img src="'+f.thumbnail+'">'),c<b.length&&a(b,c,d)}},e.send('id='+b[c])}(function(){var b=document.getElementsByName('ids')[0].value.split(','),c={progressBar:document.querySelector('.progressbar > div'),current:document.querySelector('.progress-current'),thumbnail:document.querySelector('.thumbnail-placeholder'),title:document.querySelector('.thumbnail-link-title')};a(b,0,c)})()}});
\ No newline at end of file |