change 'title' attribute of form depending on which share button one clicks to change displayed text per service

lektura
max.mehl 2017-09-04 19:15:17 +02:00
parent 8fd6ba038d
commit a9036d4b45
7 changed files with 19 additions and 4 deletions

View File

@ -120,6 +120,7 @@ DefaultContentLanguage = "en"
promoButtonText = "Get promo material"
promoButtonLink = "https://fsfe.org/promo#pmpc"
shareText = "Tell your friends and followers about Public Code"
defaultSocialText = "If it is public money, it should be public code as well. I support this call for more public code under a Free Software license: "
# Legal Section
@ -218,6 +219,7 @@ DefaultContentLanguage = "en"
promoButtonText = "Promomaterial bestellen"
promoButtonLink = "https://fsfe.org/promo#pmpc"
shareText = "Erzähle Deinen Freunden und Followern von PMPC"
defaultSocialText = "Wenn es mit öffentlichem Geld bezahlt wird, muss es immer öffentlicher Code sein! Ich unterstütze diesen Aufruf, damit es mehr öffentlichen Code unter einer Freie-Software-Lizenz gibt: "
# Legal Section
[Languages.de.legal]
by = "Eine Kampagne der Free Software Foundation Europe"

View File

@ -3,3 +3,5 @@ name: GNU Social
titleBefore: Auf
titleAfter: teilen
userinput: true
# This "customText" shouldn't have more than 115 characters!
customText: "Öffentliches Geld muss öffentlichen Code bedeuten! Ich unterstütze den Aufruf der @fsfe@quitter.no für mehr #publiccode: "

View File

@ -2,3 +2,5 @@ id: twitter
name: Twitter
titleBefore: Auf
titleAfter: teilen
# This "customText" must not have more than 115 characters!
customText: "Öffentliches Geld muss öffentlichen Code bedeuten! Ich unterstütze den Aufruf der @fsfe für mehr #publiccode: "

View File

@ -3,3 +3,5 @@ name: GNU Social
titleBefore: Share on
titleAfter:
userinput: true
# This "customText" shouldn't have more than 115 characters!
customText: "If it is public money, it should be public code as well! I support @fsfe@quitter.no's call for more #publiccode: "

View File

@ -2,3 +2,5 @@ id: twitter
name: Twitter
titleBefore: Share on
titleAfter:
# This "customText" must not have more than 115 characters!
customText: "If it is public money, it should be public code as well! I support @fsfe's call for more #publiccode: "

View File

@ -22,8 +22,8 @@
<form action="/share" method="GET" class="share-buttons spread" target="_blank">
<input name="popup" id="no-share-popup-spread" type="radio" />
<input name="ref" value="pmpc-spread" type="hidden" />
<input name="url" value="{{ .Site.Params.url }}{{ .RelPermalink }}" type="hidden" />
<input name="title" value="Public Money, Public Code!" type="hidden" />
<input name="url" value="{{ .Site.Params.url }}" type="hidden" />
<input id="sharetitle-spread" name="title" value="{{ .Site.Params.spread.defaultSocialText }}" type="hidden" />
<input class="n" name="website" placeholder="Please do not put anything here" />
{{ range $data.share }}
@ -33,14 +33,14 @@
<span class="popup {{ .id }}">
<label for="no-share-popup-spread"></label>
<input name="{{ .id }}pod" value="" placeholder="{{ .name }} URL ({{ .id }}.tld)" type="text" />
<button type="submit" name="service" value="{{ .id }}">OK</button>
<button type="submit" name="service" value="{{ .id }}" onclick="return changeTitle('{{if isset . "customText"}}{{.customText}}{{else}}{{$.Site.Params.spread.defaultSocialText}}{{end}}')">OK</button>
</span>
{{ end }}
{{ end }}
{{ range $data.share }}
{{ if ne .userinput true }}
<button type="submit" name="service" value="{{ .id }}" class="button share-{{ .id }}" title="{{ .titleBefore}} {{ .name }} {{ .titleAfter }}">{{ .name }}</button>
<button type="submit" name="service" value="{{ .id }}" class="button share-{{ .id }}" title="{{ .titleBefore}} {{ .name }} {{ .titleAfter }}" onclick="return changeTitle('{{if isset . "customText"}}{{.customText}}{{else}}{{$.Site.Params.spread.defaultSocialText}}{{end}}')">{{ .name }}</button>
{{ end }}
{{ end }}
</form>

View File

@ -39,3 +39,8 @@
new WOW().init();
})(jQuery); // End of use strict
function changeTitle(val){
document.getElementById('sharetitle-spread').value = val;
return true;
}