aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/default
diff options
context:
space:
mode:
Diffstat (limited to 'assets/default')
-rw-r--r--assets/default/js/base.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/assets/default/js/base.js b/assets/default/js/base.js
index 27938823..d9933152 100644
--- a/assets/default/js/base.js
+++ b/assets/default/js/base.js
@@ -10,7 +10,7 @@ import Awesomplete from 'awesomplete';
10 * @returns Found element or null. 10 * @returns Found element or null.
11 */ 11 */
12function findParent(element, tagName, attributes) { 12function findParent(element, tagName, attributes) {
13 const parentMatch = key => attributes[key] !== '' && element.getAttribute(key).indexOf(attributes[key]) !== -1; 13 const parentMatch = (key) => attributes[key] !== '' && element.getAttribute(key).indexOf(attributes[key]) !== -1;
14 while (element) { 14 while (element) {
15 if (element.tagName.toLowerCase() === tagName) { 15 if (element.tagName.toLowerCase() === tagName) {
16 if (Object.keys(attributes).find(parentMatch)) { 16 if (Object.keys(attributes).find(parentMatch)) {
@@ -101,7 +101,7 @@ function updateAwesompleteList(selector, tags, instances) {
101 * @see http://stackoverflow.com/questions/18749591/encode-html-entities-in-javascript 101 * @see http://stackoverflow.com/questions/18749591/encode-html-entities-in-javascript
102 */ 102 */
103function htmlEntities(str) { 103function htmlEntities(str) {
104 return str.replace(/[\u00A0-\u9999<>&]/gim, i => `&#${i.charCodeAt(0)};`); 104 return str.replace(/[\u00A0-\u9999<>&]/gim, (i) => `&#${i.charCodeAt(0)};`);
105} 105}
106 106
107/** 107/**
@@ -194,8 +194,8 @@ function removeClass(element, classname) {
194function init(description) { 194function init(description) {
195 function resize() { 195 function resize() {
196 /* Fix jumpy resizing: https://stackoverflow.com/a/18262927/1484919 */ 196 /* Fix jumpy resizing: https://stackoverflow.com/a/18262927/1484919 */
197 const scrollTop = window.pageYOffset || 197 const scrollTop = window.pageYOffset
198 (document.documentElement || document.body.parentNode || document.body).scrollTop; 198 || (document.documentElement || document.body.parentNode || document.body).scrollTop;
199 199
200 description.style.height = 'auto'; 200 description.style.height = 'auto';
201 description.style.height = `${description.scrollHeight + 10}px`; 201 description.style.height = `${description.scrollHeight + 10}px`;
@@ -490,9 +490,10 @@ function init(description) {
490 }); 490 });
491 }); 491 });
492 492
493 const ids = links.map(item => item.id); 493 const ids = links.map((item) => item.id);
494 window.location = 494 window.location = (
495 `${basePath}/admin/shaare/visibility?token=${token.value}&newVisibility=${visibility}&id=${ids.join('+')}`; 495 `${basePath}/admin/shaare/visibility?token=${token.value}&newVisibility=${visibility}&id=${ids.join('+')}`
496 );
496 }); 497 });
497 }); 498 });
498 } 499 }
@@ -575,7 +576,7 @@ function init(description) {
575 .setAttribute('href', `${basePath}/admin/tags?fromtag=${encodeURIComponent(totag)}`); 576 .setAttribute('href', `${basePath}/admin/tags?fromtag=${encodeURIComponent(totag)}`);
576 577
577 // Refresh awesomplete values 578 // Refresh awesomplete values
578 existingTags = existingTags.map(tag => (tag === fromtag ? totag : tag)); 579 existingTags = existingTags.map((tag) => (tag === fromtag ? totag : tag));
579 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes); 580 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes);
580 } 581 }
581 }; 582 };
@@ -614,7 +615,7 @@ function init(description) {
614 xhr.send(encodeURI(`deletetag=1&fromtag=${tag}&token=${refreshedToken}`)); 615 xhr.send(encodeURI(`deletetag=1&fromtag=${tag}&token=${refreshedToken}`));
615 refreshToken(basePath); 616 refreshToken(basePath);
616 617
617 existingTags = existingTags.filter(tagItem => tagItem !== tag); 618 existingTags = existingTags.filter((tagItem) => tagItem !== tag);
618 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes); 619 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes);
619 } 620 }
620 }); 621 });