MediaWiki:Centralnotice-template-AR2016 ipd short
<style> /* For IE9 */ @media screen {
#centralNotice { display: block !important; }
}
/* Hide when editing */ .action-edit #centralNotice, .ve-activated #centralNotice {
display: none !important;
}
/* Clearfix */
- frbanner .cf:before,
- frbanner .cf:after {
content: ""; display: table;
}
- frbanner .cf:after { clear: both; }
.ie7 #frbanner .cf { zoom: 1; }
/* Border-Box */
- frbanner *,
- frbanner *:before,
- frbanner *:after {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
/* --- Main banner wrapper --- */
- frbanner3 {
display: table; margin: 1em 0; position: relative; border: 1px solid #a2a9b1; border-radius: 2px; box-shadow: 0 0.15em 0 0 rgba(0, 0, 0, 0.15);
}
div#{{{banner}}} {
width: 100%; display: none; position: relative; z-index: 110; background: transparent;
}
/* --- Close Options --- */
- frbanner-close-options {
display: inline-block; position: absolute; right: .5em; top: .5em; z-index: 999; font-size: .8em; text-transform: uppercase;
}
/* --- Close button --- */
- frbanner-close {
display: inline-block; cursor: pointer; opacity: .5; z-index: 999;
}
- frbanner-close:hover { opacity: 1; }
- frbanner-close-x {
background: url('//upload.wikimedia.org/wikipedia/donate/3/32/Close-thin.png') no-repeat center center; width: 9px; height: 9px; float: right; display: block; margin: .35em .4em;
}
/* -------------- Message -------------- */
.frbanner-message {
text-align: center; font-family: serif; font-size: 1em; color: #000; position: relative; padding: 1.3em .5em .5em .5em; line-height: 1.4;
}
@media (min-width : 740px) {
.frbanner-message { font-size: 1.1em; }
}
.frbanner-message .frbanner-thankyou {
font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.frbanner-message p {
margin: 0.25em 0;
}
/* --- Common Button Styles --- */
.frbanner-btn {
display: inline-block; color: #0063bf; padding: .3em; font-size: 1em; outline: 0; text-align: center; line-height: 1; cursor: pointer; font-family: inherit; font-weight: 500; transition: color 100ms; font-family: Montserrat, "Helvetica Neue", Helvetica, Arial, sans-serif; cursor: pointer;
} .frbanner-btn:hover {
color: black; text-decoration: none;
}
/* --- Remind me by email --- */
.rml-wrapper {
display: inline-block;
}
.frbanner-email-reminder {
display: none; position: absolute; padding: 1em; top: 107%; left: 50%; -moz-transform: translateX(-50%); -ms-transform: translateX(-50%); -webkit-transform: translateX(-50%); transform: translateX(-50%); width: 100%; background: #fff; border: 1px solid #aaa; border-radius: 2px; box-shadow: 0 0.15em 0 0 rgba(0, 0, 0, 0.15); text-transform: none; font-size: .9em; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
.frbanner-email-reminder * {
-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box;
}
.frbanner-email-reminder-anchor {
display: block; position: absolute; top: -10px; left: 50%; background-repeat: no-repeat;
}
.frbanner-email-reminder-anchor:before, .frbanner-email-reminder-anchor:after {
content: ""; position: absolute; width: 0; height: 0; border-style: solid; border-color: transparent; border-top: 0;
}
.frbanner-email-reminder-anchor:before {
bottom: -10px; left: -9px; border-bottom-color: #888888; border-width: 10px
}
.frbanner-email-reminder-anchor:after {
bottom: -10px; left: -8px; border-bottom-color: #ffffff; border-width: 9px;
}
.frbanner-email-reminder input {
direction: ltr; background: #fff; width: 100%; font-size: 1.15em; display: block; padding: 0.5em; margin: .5em 0 0 0; font-size: inherit; font-family: inherit; color: #000; border: 1px solid #9aa0a7; border-radius: 2px;
} .frbanner-email-reminder input:focus {
outline: 0; border-color: #3366cc; box-shadow: inset 0 0 0 1px #3366cc;
} .frbanner-email-reminder input.error {
border-color: #ff0000; box-shadow: inset 0 0 0 0.1em #ff0000;
}
.frbanner-email-reminder .frbanner-btn {
width: 100%; color: #fff; background-color: #3366cc; border-color: #3366cc; padding: .5em; margin: .5em 0 .25em; font-size: 1.15em; height: auto;
} .frbanner-email-reminder .frbanner-btn:hover {
background-color: #447ff5; border-color: #447ff5;
} .frbanner-email-reminder .frbanner-btn:active {
background-color: #2a4b8d; border-color: #2a4b8d; box-shadow: none;
} .frbanner-email-reminder .frbanner-btn:focus {
border-color: #3366cc; box-shadow: inset 0 0 0 1px #3366cc, inset 0 0 0 2px #ffffff;
}
.frbanner-email-reminder #errorMessageContainerId {
color: #ff0000;
}
.frbanner-email-reminder-done {
background: #eaecf0; padding: .7em; margin-top: .5em; display: block;
} </style>
<script> var fundraisingBanner = fundraisingBanner || {};
fundraisingBanner.showInlineBanner = function() {
// Place frbanner3 in article, before first
or at top var $inArticleBanner = $('#frbanner3'); var $firstParas = $('#mw-content-text > div > p:first-of-type'); if ( $firstParas.length > 0 && !mw.config.get('wgIsMainPage') ) { $firstParas.first().before( $inArticleBanner ); } else { $('#mw-content-text').prepend( $inArticleBanner ); } $('#frbanner3').show(); }; fundraisingBanner.initBannerInfoForm = function() { $(".frbanner-email-reminder-form input[name=bannerInfo_country]").val(Geo.country); $(".frbanner-email-reminder-form input[name=bannerInfo_language]").val(mw.config.get('wgUserLanguage')); $(".frbanner-email-reminder-form input[name=bannerInfo_submitDate]").val(fundraisingBanner.getCurrentDate()); $(".frbanner-email-reminder-form input[name=bannerInfo_segment]").val(Math.floor((Math.random() * 100) + 1)); $("body").on("click", ".frbanner-email-reminder-link", function() { $('.frbanner-email-reminder').toggle(); $('#control_EMAIL').focus(); }); $("body").on("click", ".frbanner-email-reminder-form button", function() { if ( mw.util.validateEmail( $(".frbanner-email-reminder-form form input[name='Email']").val() ) ) { fundraisingBanner.postReminderForm(); $(".frbanner-email-reminder-link").hide(); $('.frbanner-email-reminder').hide(); $(".frbanner-email-reminder-done").show(); mw.centralNotice.hideBanner(); // Hide future banners for 7 days return false; } else { $(".frbanner-email-reminder-form form input[name='Email']").addClass("error"); $(".frbanner-email-reminder-form #errorMessageContainerId").show(); $('#control_EMAIL').focus(); return false; } }); }; fundraisingBanner.postReminderForm = function() { // Create the iframe for the form and use it as the form's target var frameName = "remindFrame"; var $form = $(".frbanner-email-reminder-form form"); if ($("iframe[name=" + frameName + "]").length == 0) { var $iframe = $('<iframe style="display: none;" name="' + frameName + '"></iframe>'); $form.attr("target", $iframe.attr("name")); $form.after($iframe); } $form[0].submit(); }; fundraisingBanner.getCurrentDate = function() { var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! var yyyy = today.getFullYear(); if(dd<10) { dd='0'+dd; } if(mm<10) { mm='0'+mm; } today = mm+'/'+dd+'/'+yyyy; return today; }; fundraisingBanner.countryNames = { 'US' : 'the U.S.', 'CA' : 'Canada', 'GB' : 'the UK', 'IE' : 'Ireland', 'AU' : 'Australia', 'NZ' : 'New Zealand', 'IT' : 'Italy', 'FR' : 'France' }; $(document).ready(function() { $('.frbanner-replace-country').text( fundraisingBanner.countryNames[Geo.country] ); fundraisingBanner.initBannerInfoForm(); $("#frbanner-close").click(function(e) { $("#frbanner3").hide(); }); /* Hide banner outside of main namespace (and Main Page, for sites where that isn't in main namespace) */ if ( mw.config.get('wgNamespaceNumber') > 0 && !mw.config.get('wgIsMainPage') ) { mw.centralNotice.bannerData.hideResult = true; mw.centralNotice.bannerData.hideReason = 'namespace'; } if (!mw.centralNotice.bannerData.hideResult) { fundraisingBanner.showInlineBanner(); } }); /** Provides alterImpressionData hook for CentralNotice * This info will be sent back with Special:RecordImpression */ mediaWiki.centralNotice.bannerData.alterImpressionData = function( impressionData ) { // Returning true from this function indicates the banner was shown if (mediaWiki.centralNotice.bannerData.hideReason) { impressionData.reason = mediaWiki.centralNotice.bannerData.hideReason; } if (mediaWiki.centralNotice.bannerData.cookieCount) { impressionData.banner_count = mediaWiki.centralNotice.bannerData.cookieCount; } return !mediaWiki.centralNotice.bannerData.hideResult; }; </script>