client/tags: improve copying tag list

- Don't copy tag count
- Don't copy × button
- Copy spaces between tags
This commit is contained in:
rr- 2016-07-30 20:06:38 +02:00
parent 72072db078
commit 245ce258a9
5 changed files with 28 additions and 16 deletions

View file

@ -1,3 +1,4 @@
@import mixins
@import colors @import colors
form form
@ -252,7 +253,7 @@ div.tag-input
color: $inactive-link-color color: $inactive-link-color
margin-left: 0.7em margin-left: 0.7em
font-size: 90% font-size: 90%
unselectable()
ul.compact-tags ul.compact-tags
line-height: 130% line-height: 130%
@ -265,6 +266,7 @@ ul.compact-tags
color: $inactive-link-color color: $inactive-link-color
margin-left: 0.7em margin-left: 0.7em
font-size: 90% font-size: 90%
unselectable()
div.tag-relations div.tag-relations
font-size: 80% font-size: 80%

View file

@ -1,4 +1,5 @@
@import colors @import colors
@import mixins
/* latin */ /* latin */
@font-face @font-face
@ -214,3 +215,8 @@ a .access-key
background: white background: white
padding: 0 1em padding: 0 1em
z-index: 2 z-index: 2
/* hack to prevent text from being copied */
[data-pseudo-content]:before {
content: attr(data-pseudo-content)
}

6
client/css/mixins.styl Normal file
View file

@ -0,0 +1,6 @@
unselectable()
-webkit-user-select: none
-moz-user-select: none
-ms-user-select: none
-o-user-select: none
user-select: none

View file

@ -76,11 +76,11 @@
--><% if (ctx.canListPosts) { %><!-- --><% if (ctx.canListPosts) { %><!--
--><a href='/posts/query=<%- encodeURIComponent(tag) %>' class='<%= ctx.makeCssName(ctx.getTagCategory(tag), 'tag') %>'><!-- --><a href='/posts/query=<%- encodeURIComponent(tag) %>' class='<%= ctx.makeCssName(ctx.getTagCategory(tag), 'tag') %>'><!--
--><% } %><!-- --><% } %><!--
--><%- tag %><!-- --><%- tag %>&#32;<!--
--><% if (ctx.canListPosts) { %><!-- --><% if (ctx.canListPosts) { %><!--
--></a><!-- --></a><!--
--><% } %><!-- --><% } %><!--
--><span class='append'><%- ctx.getTagUsages(tag) %></span><!-- --><span class='append' data-pseudo-content='<%- ctx.getTagUsages(tag) %>'></span><!--
--></li><!-- --></li><!--
--><% } %><!-- --><% } %><!--
--></ul> --></ul>

View file

@ -296,7 +296,7 @@ class TagInputControl extends events.EventTarget {
} }
searchLinkNode.setAttribute( searchLinkNode.setAttribute(
'href', '/posts/query=' + encodeURIComponent(tagName)); 'href', '/posts/query=' + encodeURIComponent(tagName));
searchLinkNode.textContent = tagName; searchLinkNode.textContent = tagName + ' ';
searchLinkNode.addEventListener('click', e => { searchLinkNode.addEventListener('click', e => {
e.preventDefault(); e.preventDefault();
if (actualTag) { if (actualTag) {
@ -307,17 +307,15 @@ class TagInputControl extends events.EventTarget {
} }
}); });
const usagesNode = views.htmlToDom( const usagesNode = document.createElement('span');
views.makeNonVoidElement( usagesNode.classList.add('append');
'span', usagesNode.setAttribute(
{class: 'append'}, 'data-pseudo-content', actualTag ? actualTag.usages : 0);
actualTag ? actualTag.usages : 0));
const removalLinkNode = views.htmlToDom( const removalLinkNode = document.createElement('a');
views.makeNonVoidElement( removalLinkNode.classList.add('append');
'a', removalLinkNode.setAttribute('href', '#');
{href: '#', class: 'append'}, removalLinkNode.setAttribute('data-pseudo-content', '×');
'×'));
removalLinkNode.addEventListener('click', e => { removalLinkNode.addEventListener('click', e => {
e.preventDefault(); e.preventDefault();
this.deleteTag(tagName); this.deleteTag(tagName);
@ -390,12 +388,12 @@ class TagInputControl extends events.EventTarget {
const weightNode = document.createElement('span'); const weightNode = document.createElement('span');
weightNode.classList.add('tag-weight'); weightNode.classList.add('tag-weight');
weightNode.classList.add('append'); weightNode.classList.add('append');
weightNode.textContent = weight; weightNode.setAttribute('data-pseudo-content', weight);
const removeLinkNode = document.createElement('a'); const removeLinkNode = document.createElement('a');
removeLinkNode.classList.add('remove-tag'); removeLinkNode.classList.add('remove-tag');
removeLinkNode.classList.add('append'); removeLinkNode.classList.add('append');
removeLinkNode.textContent = '×'; removeLinkNode.setAttribute('data-pseudo-content', '×');
removeLinkNode.setAttribute('href', '#'); removeLinkNode.setAttribute('href', '#');
removeLinkNode.addEventListener('click', e => { removeLinkNode.addEventListener('click', e => {
e.preventDefault(); e.preventDefault();