Template:Optin/Default: Difference between revisions
Content deleted Content added
add hidden error message (show with javascript) |
new confirmation behaviour from Template:Optin/ConfirmNo (Caitlin just wanted to make this default) |
||
Line 14:
</li>
</ul>
<div class="optin-no-prompt">
<div class="optin-no-prompt__no"></div>
<div class="optin-no-prompt__yes"></div>
</div>
<div class="optin-smallprint links-in-new-tab">
</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>
Line 20 ⟶ 24:
<style>
/* --- Opt-in --- */
.optin-options ul {
list-style: none;
Line 62 ⟶ 65:
padding: 4px;
}
</style></html>▼
.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;
}
<script>
/* Called by Common.js */
function initOptin() {
var language = mw.config.get('wgUserLanguage');
var optinNoPrompts = {
'en' : {
'no' : "😔 Are you sure? We don't email often. You can change your mind anytime.",
'yes' : "😍 Thanks for changing your mind! We'll respect your inbox."
}
};
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>
|