Skip to content

Commit f6affc6

Browse files
Fixes for the Want page to remove Twitter, etc.
1 parent 2cda19d commit f6affc6

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

_includes/assets/css/inline.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ button,
391391
border-radius: .5rem;
392392
font-size: 1rem;
393393
font-family: inherit;
394-
padding: .5em 3em;
394+
padding: .5em 1em;
395395
transform: translateX(0) translateY(0);
396396
box-shadow: none;
397397
transition: transform .25s, box-shadow .25s, background-color .5s;

_includes/layouts/want.njk

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ javascript:
7070
</dd>
7171
</dl>
7272

73+
<dl class="want__votes">
74+
<dt>Votes</dt>
75+
<dd>{{ webmentions.children | votesForWant( absoluteUrl ) }}
76+
<br>
77+
<small><a href="/voting">What are votes for and how are they tallied?</a></small>
78+
</dd>
79+
</dl>
80+
7381
{% if ( eventData[id] ) and ( eventData[id].pitched.length > 0 ) %}
7482
<dl class="want__presented_at" id="events">
7583
<dt>This was presented at</dt>
@@ -95,36 +103,26 @@ javascript:
95103
<dl class="want__share">
96104
<dt>Do you want this too? Share it!</dt>
97105
<script>
98-
var $want__share = document.querySelector('.want__share');
99-
var url = '{{ absoluteUrl }}';
100-
var title = '{{ title | urlencode }}';
101-
var text = '{{ description | striptags | truncate( 140 ) | urlencode }}';
102-
var $button = document.createElement('button');
103-
$button.className = 'button button--share';
104-
$button.onlick = function() {
105-
navigator.share({
106-
title: title,
107-
text: text,
108-
url: url
106+
var $share = document.querySelector('.want__share');
107+
if ( "share" in navigator ) {
108+
var url = '{{ absoluteUrl }}';
109+
var title = "{{ title }}";
110+
var $button = document.createElement('button');
111+
$button.className = 'button--share';
112+
$button.innerText = "Share this want";
113+
$button.addEventListener("click", function() {
114+
navigator.share({
115+
title,
116+
url
117+
});
109118
});
119+
$share.appendChild($button);
120+
} else {
121+
$share.parentNode.removeChild($share);
110122
}
111-
$want__share.appendChild($button);
112123
</script>
113124
</dl>
114125

115-
<dl class="want__votes">
116-
<dt>Votes</dt>
117-
<dd>{{ webmentions.children | votesForWant( absoluteUrl ) }}
118-
<br>
119-
<a class="button button--vote" href="https://twitter.com/intent/tweet?original_referer={{ absoluteUrl }}&amp;source=tweetbutton&amp;url={{ absoluteUrl }}&amp;text={{ title }}&amp;via=webwewantfyi">
120-
<svg class="button__icon" xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 28 28"><path d="M24.253 8.756C24.69 17.08 18.297 24.182 9.97 24.62c-3.122.162-6.22-.646-8.86-2.32 2.702.18 5.375-.648 7.507-2.32-2.072-.248-3.818-1.662-4.49-3.64.802.13 1.62.077 2.4-.154-2.482-.466-4.312-2.586-4.412-5.11.688.276 1.426.408 2.168.387-2.135-1.65-2.73-4.62-1.394-6.965C5.574 7.816 9.54 9.84 13.802 10.07c-.842-2.738.694-5.64 3.434-6.48 2.018-.624 4.212.043 5.546 1.682 1.186-.213 2.318-.662 3.33-1.317-.386 1.256-1.248 2.312-2.4 2.942 1.048-.106 2.07-.394 3.02-.85-.458 1.182-1.343 2.15-2.48 2.71z"></path></svg>
121-
<b class="button__text">Vote by sharing on Twitter</b>
122-
</a>
123-
<br>
124-
<small><a href="/voting">What are votes for and how are they tallied?</a></small>
125-
</dd>
126-
</dl>
127-
128126
</aside>
129127

130128
<div class="pagination">

0 commit comments

Comments
 (0)