Template:Optin/Default: Difference between revisions

From Donate
Jump to navigation Jump to search
Content deleted Content added
add Italian prompt translations
trying focus method instead
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
<html>
<html>
<fieldset class="optin-options">
<fieldset class="optin-options">
<legend></html>{{Translated|Template:OptinText/Question}}<html></legend>
We value your input. Can we stay in touch?
<span id="error-optin" class="lp-error" style="display: none;">
</html>{{int:donate_interface-error-msg-opt_in}}<html>
</span>
<ul>
<ul>
<li>
<li>
<input class="lp-radio" type="radio" name="opt_in" id="optin-yes" value="1">
<input class="lp-radio" type="radio" name="opt_in" id="optin-yes" value="1">
<label class="lp-radio-label" for="optin-yes"></html>Yes! You can send me email updates and tell me if Wikipedia needs my support or advice in the future.<html></label>
<label class="lp-radio-label" for="optin-yes"></html>{{Translated|Template:OptinText/Yes}}<html></label>
</li>
</li>
<li>
<li>
<input class="lp-radio" type="radio" name="opt_in" id="optin-no" value="0">
<input class="lp-radio" type="radio" name="opt_in" id="optin-no" value="0">
<label class="lp-radio-label" for="optin-no"></html>{{int:donate_interface-donor-opt_in_no}}<html></label>
<label class="lp-radio-label" for="optin-no"></html>{{Translated|Template:OptinText/No}}<html></label>
</li>
</li>
</ul>
</ul>
<div class="optin-no-prompt">
<div class="optin-no-prompt" data-is-translated="</html>{{IsTranslated|Template:OptinText/PromptNo|{{int:lang}}}}<html>">
<div class="optin-no-prompt__no"></div>
<div class="optin-no-prompt__no"></html>{{Translated|Template:OptinText/PromptNo}}<html></div>
<div class="optin-no-prompt__yes"></div>
<div class="optin-no-prompt__yes"></html>{{Translated|Template:OptinText/PromptYes}}<html></div>
</div>
<div id="error-optin" class="lp-error" style="display: none;" tabindex="-1"><!-- tabindex="-1" allows focus with js so it can be announced -->
</html>{{Translated|Template:OptinText/PleaseSelect}}<html>
</div>
</div>
<div class="optin-smallprint links-in-new-tab">
<div class="optin-smallprint links-in-new-tab">
</html>{{Translated|Template:OptinText/Smallprint}}<html>
</html>{{#tag:html|{{int:donate_interface-donor-opt_in_explain|https://foundation.wikimedia.org/wiki/Special:LandingCheck?basic=true&language={{int:lang}}&landing_page=Donor_privacy_policy}}}}<html>
</div>
</div>
</fieldset>
</fieldset>
<style>
/* --- Opt-in --- */
.optin-options ul {
list-style: none;
margin: 0;
}

.optin-options li {
display: table;
}

.lp-radio {
display: table-cell;
vertical-align: top;
height: 18px;
margin: 8px;
cursor: pointer;
}

.lp-radio-label {
display: table-cell;
vertical-align: top;
padding: 4px 0;
white-space: normal;
font-size: 14px;
line-height: 19px;
font-weight: normal;
cursor: pointer;
}

.lp-radio-label:hover,
.lp-radio:focus + .lp-radio-label,
.lp-radio:hover + .lp-radio-label {
color: #36c;
text-decoration: none;
}

.optin-smallprint {
clear: both;
font-size: 12px;
line-height: 14px;
padding: 4px;
}

.optin-no-prompt {
display: none;
margin: 8px;
padding: 6px 6px 7px;
border: 2px solid #900;
border-radius: 2px;
font-size: 14px;
line-height: 1.2857142857; /*18px @14px*/
font-weight: normal;
}

.optin-no-prompt.is-positive {
border-color: #14866d;
font-weight: bold;
}

.optin-no-prompt__yes {
display: none;
}

.optin-no-prompt__no {
display: block;
}

.optin-no-prompt.is-positive .optin-no-prompt__yes {
display: block;
}

.optin-no-prompt.is-positive .optin-no-prompt__no {
display: none;
}
</style>
<script>
/* Called by Common.js */
function initOptin() {
var language = mw.config.get('wgUserLanguage');
var optinNoPrompts = {
'en' : {
'no' : "😔 Sorry to hear that. We don't email often; would you consider changing your mind?",
'yes' : "😍 Thanks for changing your mind! We'll respect your inbox."
},
'it' : {
'no' : "😔 È un vero peccato. Non inviamo e-mail frequentemente; prenderesti in considerazione la possibilità di cambiare idea?",
'yes' : "😍 Grazie per aver cambiato idea! Avremo molto rispetto della tua casella di posta."
}
};
optinNoPrompts['en-gb'] = optinNoPrompts['en'];

// Only do all this if we have translated prompts
if ( optinNoPrompts[language] ) {
$('.optin-no-prompt__no').text( optinNoPrompts[language].no );
$('.optin-no-prompt__yes').text( optinNoPrompts[language].yes );

$('.optin-options').on('click', function(){
if ( $('#optin-no').is(':checked') ) {
$('.optin-no-prompt').removeClass('is-positive');
if ( !$('.optin-no-prompt').is(':visible') ) {
$('.optin-no-prompt').slideDown();
}
} else {
$('.optin-no-prompt').addClass('is-positive');
}
});
}
}
</script>
</html>
</html>

Latest revision as of 19:12, 20 November 2024

Can we stay in touch?
Sorry to hear that. We don't email often; would you consider changing your mind?
Thanks for changing your mind! We'll respect your inbox.