aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/default
diff options
context:
space:
mode:
Diffstat (limited to 'assets/default')
-rw-r--r--assets/default/js/base.js29
-rw-r--r--assets/default/scss/shaarli.scss44
2 files changed, 41 insertions, 32 deletions
diff --git a/assets/default/js/base.js b/assets/default/js/base.js
index 27938823..be986ae0 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 }
@@ -554,6 +555,7 @@ function init(description) {
554 } 555 }
555 const refreshedToken = document.getElementById('token').value; 556 const refreshedToken = document.getElementById('token').value;
556 const fromtag = block.getAttribute('data-tag'); 557 const fromtag = block.getAttribute('data-tag');
558 const fromtagUrl = block.getAttribute('data-tag-url');
557 const xhr = new XMLHttpRequest(); 559 const xhr = new XMLHttpRequest();
558 xhr.open('POST', `${basePath}/admin/tags`); 560 xhr.open('POST', `${basePath}/admin/tags`);
559 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 561 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
@@ -563,6 +565,7 @@ function init(description) {
563 location.reload(); 565 location.reload();
564 } else { 566 } else {
565 block.setAttribute('data-tag', totag); 567 block.setAttribute('data-tag', totag);
568 block.setAttribute('data-tag-url', encodeURIComponent(totag));
566 input.setAttribute('name', totag); 569 input.setAttribute('name', totag);
567 input.setAttribute('value', totag); 570 input.setAttribute('value', totag);
568 findParent(input, 'div', { class: 'rename-tag-form' }).style.display = 'none'; 571 findParent(input, 'div', { class: 'rename-tag-form' }).style.display = 'none';
@@ -571,15 +574,18 @@ function init(description) {
571 .querySelector('a.tag-link') 574 .querySelector('a.tag-link')
572 .setAttribute('href', `${basePath}/?searchtags=${encodeURIComponent(totag)}`); 575 .setAttribute('href', `${basePath}/?searchtags=${encodeURIComponent(totag)}`);
573 block 576 block
577 .querySelector('a.count')
578 .setAttribute('href', `${basePath}/add-tag/${encodeURIComponent(totag)}`);
579 block
574 .querySelector('a.rename-tag') 580 .querySelector('a.rename-tag')
575 .setAttribute('href', `${basePath}/admin/tags?fromtag=${encodeURIComponent(totag)}`); 581 .setAttribute('href', `${basePath}/admin/tags?fromtag=${encodeURIComponent(totag)}`);
576 582
577 // Refresh awesomplete values 583 // Refresh awesomplete values
578 existingTags = existingTags.map(tag => (tag === fromtag ? totag : tag)); 584 existingTags = existingTags.map((tag) => (tag === fromtag ? totag : tag));
579 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes); 585 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes);
580 } 586 }
581 }; 587 };
582 xhr.send(`renametag=1&fromtag=${encodeURIComponent(fromtag)}&totag=${encodeURIComponent(totag)}&token=${refreshedToken}`); 588 xhr.send(`renametag=1&fromtag=${fromtagUrl}&totag=${encodeURIComponent(totag)}&token=${refreshedToken}`);
583 refreshToken(basePath); 589 refreshToken(basePath);
584 }); 590 });
585 }); 591 });
@@ -602,6 +608,7 @@ function init(description) {
602 event.preventDefault(); 608 event.preventDefault();
603 const block = findParent(event.target, 'div', { class: 'tag-list-item' }); 609 const block = findParent(event.target, 'div', { class: 'tag-list-item' });
604 const tag = block.getAttribute('data-tag'); 610 const tag = block.getAttribute('data-tag');
611 const tagUrl = block.getAttribute('data-tag-url');
605 const refreshedToken = document.getElementById('token').value; 612 const refreshedToken = document.getElementById('token').value;
606 613
607 if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) { 614 if (confirm(`Are you sure you want to delete the tag "${tag}"?`)) {
@@ -611,10 +618,10 @@ function init(description) {
611 xhr.onload = () => { 618 xhr.onload = () => {
612 block.remove(); 619 block.remove();
613 }; 620 };
614 xhr.send(encodeURI(`deletetag=1&fromtag=${tag}&token=${refreshedToken}`)); 621 xhr.send(`deletetag=1&fromtag=${tagUrl}&token=${refreshedToken}`);
615 refreshToken(basePath); 622 refreshToken(basePath);
616 623
617 existingTags = existingTags.filter(tagItem => tagItem !== tag); 624 existingTags = existingTags.filter((tagItem) => tagItem !== tag);
618 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes); 625 awesomepletes = updateAwesompleteList('.rename-tag-input', existingTags, awesomepletes);
619 } 626 }
620 }); 627 });
diff --git a/assets/default/scss/shaarli.scss b/assets/default/scss/shaarli.scss
index 7ab09d3f..a528adb0 100644
--- a/assets/default/scss/shaarli.scss
+++ b/assets/default/scss/shaarli.scss
@@ -69,20 +69,22 @@ pre {
69 font-family: 'Roboto'; 69 font-family: 'Roboto';
70 font-weight: 400; 70 font-weight: 400;
71 font-style: normal; 71 font-style: normal;
72 src: local('Roboto'), 72 src:
73 local('Roboto-Regular'), 73 local('Roboto'),
74 url('../fonts/Roboto-Regular.woff2') format('woff2'), 74 local('Roboto-Regular'),
75 url('../fonts/Roboto-Regular.woff') format('woff'); 75 url('../fonts/Roboto-Regular.woff2') format('woff2'),
76 url('../fonts/Roboto-Regular.woff') format('woff');
76} 77}
77 78
78@font-face { 79@font-face {
79 font-family: 'Roboto'; 80 font-family: 'Roboto';
80 font-weight: 700; 81 font-weight: 700;
81 font-style: normal; 82 font-style: normal;
82 src: local('Roboto'), 83 src:
83 local('Roboto-Bold'), 84 local('Roboto'),
84 url('../fonts/Roboto-Bold.woff2') format('woff2'), 85 local('Roboto-Bold'),
85 url('../fonts/Roboto-Bold.woff') format('woff'); 86 url('../fonts/Roboto-Bold.woff2') format('woff2'),
87 url('../fonts/Roboto-Bold.woff') format('woff');
86} 88}
87 89
88body, 90body,
@@ -375,7 +377,7 @@ body,
375} 377}
376 378
377@media screen and (max-width: 64em) { 379@media screen and (max-width: 64em) {
378 .header-search , 380 .header-search,
379 .header-search * { 381 .header-search * {
380 visibility: hidden; 382 visibility: hidden;
381 } 383 }
@@ -554,7 +556,6 @@ body,
554 color: $dark-grey; 556 color: $dark-grey;
555 font-size: .9em; 557 font-size: .9em;
556 558
557
558 a { 559 a {
559 display: inline-block; 560 display: inline-block;
560 margin: 3px 0; 561 margin: 3px 0;
@@ -620,7 +621,7 @@ body,
620 &.selected { 621 &.selected {
621 background: var(--main-color); 622 background: var(--main-color);
622 color: $white; 623 color: $white;
623 } 624 }
624 } 625 }
625 626
626 input { 627 input {
@@ -1557,11 +1558,11 @@ form {
1557 text-align: center; 1558 text-align: center;
1558 1559
1559 a { 1560 a {
1561 background: $almost-white;
1560 display: inline-block; 1562 display: inline-block;
1561 margin: 0 15px; 1563 padding: 5px;
1562 text-decoration: none; 1564 text-decoration: none;
1563 color: $white; 1565 color: $dark-grey;
1564 font-weight: bold;
1565 } 1566 }
1566} 1567}
1567 1568
@@ -1609,13 +1610,14 @@ form {
1609 1610
1610 > div { 1611 > div {
1611 border-radius: 10px; 1612 border-radius: 10px;
1612 background: repeating-linear-gradient( 1613 background:
1613 -45deg, 1614 repeating-linear-gradient(
1614 $almost-white, 1615 -45deg,
1615 $almost-white 6px, 1616 $almost-white,
1616 var(--background-color) 6px, 1617 $almost-white 6px,
1617 var(--background-color) 12px 1618 var(--background-color) 6px,
1618 ); 1619 var(--background-color) 12px
1620 );
1619 width: 0%; 1621 width: 0%;
1620 height: 10px; 1622 height: 10px;
1621 } 1623 }