Author | zPlus <zplus@peers.community> 2018-11-18 13:46:46 |
Committer | zPlus <zplus@peers.community> 2018-11-18 13:46:46 |
Commit | a9475ad (patch) |
Tree | b06624e |
Parent(s) |
-rwxr-xr-x | freepost/static/javascript/freepost.js | 26 | ||
-rwxr-xr-x | freepost/static/stylus/freepost.styl | 40 | ||
-rw-r--r-- | freepost/templates/layout.html | 3 | ||
-rwxr-xr-x | freepost/templates/vote.html | 10 |
index 8e08258..62fd1ad | |||
old size: 5K - new size: 5K | |||
@@ -38,27 +38,27 @@ var pressed_key = []; | |||
38 | 38 | /** | |
39 | 39 | * Change arrows class when voting. | |
40 | 40 | */ | |
41 | - | function vote (action, dom_element) | |
41 | + | function vote (action, vote_dom) | |
42 | 42 | { | |
43 | - | var arrow_up = dom_element.querySelector ('button[title="upvote"]'); | |
44 | - | var vote_counter = dom_element.querySelector ('.count') | |
45 | - | var arrow_down = dom_element.querySelector ('button[title="downvote"]'); | |
43 | + | var arrow_up = vote_dom.querySelector ('button[title="upvote"]'); | |
44 | + | var vote_counter = vote_dom.querySelector ('.count') | |
45 | + | var arrow_down = vote_dom.querySelector ('button[title="downvote"]'); | |
46 | 46 | ||
47 | 47 | // Voted/Upvoted | |
48 | 48 | var current_status = 0; | |
49 | 49 | ||
50 | - | if (arrow_up.classList.contains('upvoted')) | |
50 | + | if (vote_dom.classList.contains('upvoted')) | |
51 | 51 | current_status = 1; | |
52 | 52 | ||
53 | - | if (arrow_down.classList.contains('downvoted')) | |
53 | + | if (vote_dom.classList.contains('downvoted')) | |
54 | 54 | current_status = -1; | |
55 | 55 | ||
56 | 56 | // Current vote | |
57 | 57 | var current_vote = Number (vote_counter.textContent); | |
58 | 58 | ||
59 | - | // Remove class from arrows | |
60 | - | arrow_up.classList.remove ('upvoted'); | |
61 | - | arrow_down.classList.remove ('downvoted'); | |
59 | + | // Remove any existing upvoted/downvoted class | |
60 | + | vote_dom.classList.remove ('upvoted'); | |
61 | + | vote_dom.classList.remove ('downvoted'); | |
62 | 62 | ||
63 | 63 | // Toggle upvote class for arrow | |
64 | 64 | if ("up" == action) | |
@@ -66,11 +66,11 @@ function vote (action, dom_element) | |||
66 | 66 | { | |
67 | 67 | case -1: | |
68 | 68 | vote_counter.textContent = current_vote + 2; | |
69 | - | arrow_up.classList.add ('upvoted'); | |
69 | + | vote_dom.classList.add ('upvoted'); | |
70 | 70 | break; | |
71 | 71 | case 0: | |
72 | 72 | vote_counter.textContent = current_vote + 1; | |
73 | - | arrow_up.classList.add ('upvoted'); | |
73 | + | vote_dom.classList.add ('upvoted'); | |
74 | 74 | break; | |
75 | 75 | case 1: | |
76 | 76 | vote_counter.textContent = current_vote - 1; | |
@@ -86,11 +86,11 @@ function vote (action, dom_element) | |||
86 | 86 | break; | |
87 | 87 | case 0: | |
88 | 88 | vote_counter.textContent = current_vote - 1; | |
89 | - | arrow_down.classList.add ('downvoted'); | |
89 | + | vote_dom.classList.add ('downvoted'); | |
90 | 90 | break; | |
91 | 91 | case 1: | |
92 | 92 | vote_counter.textContent = current_vote - 2; | |
93 | - | arrow_down.classList.add ('downvoted'); | |
93 | + | vote_dom.classList.add ('downvoted'); | |
94 | 94 | break; | |
95 | 95 | } | |
96 | 96 | } |
index 822f400..5360cae | |||
old size: 10K - new size: 10K | |||
@@ -100,45 +100,47 @@ body | |||
100 | 100 | line-height 1.5em | |
101 | 101 | ||
102 | 102 | .vote | |
103 | - | margin 0 | |
103 | + | margin 0 1rem 0 0 | |
104 | + | padding 0 .5rem | |
104 | 105 | ||
105 | 106 | form | |
106 | 107 | display inline-block | |
108 | + | margin 0 | |
109 | + | padding 0 | |
107 | 110 | ||
108 | 111 | > button | |
109 | 112 | background transparent | |
110 | 113 | border 0 | |
111 | - | color #9a9a9a | |
112 | 114 | cursor pointer | |
113 | 115 | display inline-block | |
114 | - | font-family "Courier New", Courier, monospace | |
115 | - | font-size 1rem | |
116 | 116 | margin 0 | |
117 | 117 | overflow hidden | |
118 | 118 | padding 0 | |
119 | 119 | text-decoration none | |
120 | 120 | vertical-align middle | |
121 | - | ||
122 | - | /* Arrow style if already upvoted (green) */ | |
123 | - | &.upvoted | |
124 | - | border-radius 999rem | |
125 | - | color #00e313 | |
126 | - | font-weight bolder | |
127 | - | height 1rem | |
128 | - | width 1rem | |
129 | 121 | ||
130 | - | /* Arrow style if already upvoted (red) */ | |
131 | - | &.downvoted | |
132 | - | border-radius 999rem | |
133 | - | color #f00 | |
134 | - | font-weight bolder | |
135 | - | height 1rem | |
136 | - | width 1rem | |
122 | + | > img | |
123 | + | height .8rem | |
124 | + | width .8rem | |
137 | 125 | ||
138 | 126 | /* Votes counter */ | |
139 | 127 | > .count | |
140 | 128 | margin 0 .5rem | |
141 | 129 | ||
130 | + | .upvoted | |
131 | + | background-color #d1ffd5 | |
132 | + | border 1px dashed | |
133 | + | border-radius .5rem | |
134 | + | border-color #00e313 | |
135 | + | color #00a200 | |
136 | + | font-weight bolder | |
137 | + | ||
138 | + | .downvoted | |
139 | + | background-color #fcc | |
140 | + | border-radius 999rem | |
141 | + | color #f00 | |
142 | + | font-weight bolder | |
143 | + | ||
142 | 144 | /* Home page */ | |
143 | 145 | .posts | |
144 | 146 |
index 107327b..208fff8 | |||
old size: 5K - new size: 5K | |||
@@ -96,6 +96,7 @@ | |||
96 | 96 | <li> | |
97 | 97 | <img alt="Peers" title="" src="/images/peers.png" /> | |
98 | 98 | <a href="http://peers.community">Peers</a> | |
99 | + | <a href="https://dokk.org/The_Peers_Community">Community</a> | |
99 | 100 | </li> | |
100 | 101 | <li> | |
101 | 102 | <img alt="RSS" title="" src="/images/rss.png" /> | |
@@ -108,7 +109,7 @@ | |||
108 | 109 | </li> | |
109 | 110 | <li> | |
110 | 111 | <img alt="TuxFamily" title="" src="/images/tuxfamily.png" /> | |
111 | - | Hosted at <a href="https://tuxfamily.org">TuxFamily</a> | |
112 | + | Hosted at <a href="https://dokk.org/TuxFamily">TuxFamily</a> | |
112 | 113 | </li> | |
113 | 114 | </ul> | |
114 | 115 | </footer> |
index bb0f191..6e22d7d | |||
old size: 2K - new size: 2K | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | 9 | {% macro vote (target, item, user) %} | |
10 | 10 | ||
11 | - | <span class="vote"> | |
11 | + | <span class="vote {{ 'upvoted' if item.user_vote == 1 else '' }} {{ 'downvoted' if item.user_vote == -1 else '' }}"> | |
12 | 12 | ||
13 | 13 | {% if user %} | |
14 | 14 | ||
@@ -17,8 +17,8 @@ | |||
17 | 17 | <input type="hidden" name="{{ target }}" value="{{ item.hashId }}" /> | |
18 | 18 | <input type="hidden" name="updown" value="up" /> | |
19 | 19 | ||
20 | - | <button title="upvote" class="{{ 'upvoted' if item.user_vote == 1 else '' }}"> | |
21 | - | ⯅ | |
20 | + | <button title="upvote" class=""> | |
21 | + | <img src="{{ url ('static', filename='images/upvote.png') }}" /> | |
22 | 22 | </button> | |
23 | 23 | </form> | |
24 | 24 | ||
@@ -30,8 +30,8 @@ | |||
30 | 30 | <input type="hidden" name="{{ target }}" value="{{ item.hashId }}" /> | |
31 | 31 | <input type="hidden" name="updown" value="down" /> | |
32 | 32 | ||
33 | - | <button title="downvote" class="{{ 'downvoted' if item.user_vote == -1 else '' }}"> | |
34 | - | ⯆ | |
33 | + | <button title="downvote" class=""> | |
34 | + | <img src="{{ url ('static', filename='images/downvote.png') }}" /> | |
35 | 35 | </button> | |
36 | 36 | </form> | |
37 | 37 |