MediaWiki:Centralnotice-template-spatton enIN anon script

From Meta, a Wikimedia project coordination wiki

<style> /* Hide when editing */ .action-edit .ceb, .ve-activated .ceb {

   display: none !important;

} .heading-holder {

   overflow: visible;

}

  1. centralNotice.collapsed .ceb {
   display: none;

}

/* z-index override for #siteNotice now having .mw-body-content class [1] */

  1. siteNotice {
   z-index: auto;

}

/* z-index override for German Wikipedia */ .mw-body {

   z-index: auto;

}

/* Box-sizing */ .ceb, .ceb *, .ceb *:before, .ceb *:after {

   -moz-box-sizing: border-box;
   -webkit-box-sizing: border-box;
   box-sizing: border-box;

}

/* Inline banner styles


*/

/*Reset focus outlines*/ .ceb-inline-main:focus, .ceb-inline-close:focus, .ceb-rml-email:focus, .ceb-btn-submit:focus {

   outline: 0;

}

.ceb {

   position: relative;
   margin-bottom: 24px;

}

/*Default style is grey*/ .ceb-inline-main, .ceb-inline-main:visited {

   color: #222;

}

.ceb-inline-main {

   text-align: center;
   width: 100%;
   font-family: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
   width: 100%;
   padding: 8px 10px;
   border: 3px solid #36c;
   border-radius: 2px;

}

.ceb-inline-table {

   display: block;

}

@media all and (min-width: 640px) {

   .ceb-inline-table {
       display: table;
   }

}

.ceb-inline-main:hover {

   text-decoration: none;

}

.ceb-inline-main:hover .ceb-btn-submit, .ceb-inline-main:focus .ceb-btn-submit {

   background-color: #447ff5;
   border: 1px solid #447ff5;

}

.ceb-inline-main:focus .ceb-btn-submit {

   box-shadow: inset 0 0 0 1px #447ff5, inset 0 0 0 2px #FFFFFF;

}

/*Green Theme*/ .ceb-inline-main--green {

   background-color: #d5fdf4;
   border-color: #14866d;

}

.ceb-inline-main--green .ceb-btn-submit {

   background-color: #14866d;
   border-color: #14866d;

}

.ceb-inline-main--green:hover .ceb-btn-submit, .ceb-inline-main--green:focus .ceb-btn-submit {

   background-color: #00af89;
   border-color: #00af89;

}

.ceb-inline-main--green:focus .ceb-btn-submit {

   box-shadow: inset 0 0 0 1px #00af89, inset 0 0 0 2px #FFFFFF;

}

.ceb-inline-main--green .ceb-inline-message-title-icon-circle {

   fill: #14866d;

}

/*Red Theme*/ .ceb-inline-main--red {

   background-color: #fee7e6;
   border-color: #b32424;

}

.ceb-inline-main--red .ceb-btn-submit {

   background-color: #b32424;
   border-color: #b32424;

}

.ceb-inline-main--red:hover .ceb-btn-submit, .ceb-inline-main--red:focus .ceb-btn-submit {

   background-color: #d33;
   border-color: #d33;

}

.ceb-inline-main--red:focus .ceb-btn-submit {

   box-shadow: inset 0 0 0 1px #d33, inset 0 0 0 2px #FFFFFF;

}

.ceb-inline-main--red .ceb-inline-message-title-icon-circle {

   fill: #b32424;

}

.ceb-inline-main, .ceb-inline-message, .ceb-inline-title, .ceb-btn-submit {

   display: inline-block;

}

.ceb-inline-main, .ceb-inline-message, .ceb-inline-title {

   width: 100%;

}

.ceb-inline-title {

   margin-bottom: 5px;
   font-size: 18px;
   line-height: 1.125; /*27px @24px*/
   font-weight: bold;

}

@media all and (min-width: 960px) {

   .ceb-inline-title {
       font-size: 22px;
       line-height: 1.2; /*30px @25px*/
   }

}

.ceb-inline-message {

   margin-bottom: 10px;
   font-size: 15px;
   line-height: 1.3333333333; /*20px @15px*/

}

@media all and (min-width: 960px) {

   .ceb-inline-message {
       margin-bottom: 10px;
       font-size: 17px;
       line-height: 1.3157894737; /*25px @19px*/
   }

}

.ceb-inline-title-icon {

   width: 1em;
   height: 1em;
   margin-bottom: -0.12em;
   margin-right: 0.08em;

}

/* --- Close button --- */

.ceb-inline-close {

   position: absolute;
   top: -20px;
   right: -20px;
   padding: 8px;
   cursor: pointer;

}

.ceb-inline-close .ceb-icon-close path {

   stroke: #222;

}

.ceb-inline-close .ceb-icon-close circle {

   fill: #fff;

}

.ceb-inline-close:hover .ceb-icon-close circle, .ceb-inline-close:focus .ceb-icon-close circle {

   stroke: #36c;

}

.ceb-inline-close:hover .ceb-icon-close path, .ceb-inline-close:focus .ceb-icon-close path {

   stroke: #36c;

}

.ceb-icon-close {

   width: 28px;
   height: 28px;

}

.ceb-btn-submit {

   margin: 0 auto;
   min-height: 30px;
   padding: 5px 15px 5px;
   background-color: #36c;
   border: 1px solid #36c;
   text-align: center;
   font-size: 15px;
   font-weight: 600;
   line-height: 1; /*17px @17px*/
   border-radius: 2px;
   cursor: pointer;
   color: #fff;

}

.ceb-btn-table {

   display: table;

}

.ceb-btn-cell {

   display: table-cell;
   vertical-align: middle;

}

.ceb-btn-icon {

   margin-right: 8px;

} </style>

<script> var ceb = ceb || {};

// Check in user language first, then fall back to English ceb.countryNames = {

   'en' : {
       'US' : 'the U.S.',
       'BD' : 'Bangladesh',
       'IN' : 'India',
   }

};

ceb.dayNames = {

   'en' : [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],

};

ceb.iPadTranslations = {

   'en' : 'iPad'

};

ceb.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;

};

ceb.insertInlineBanner = function() {

   var $inlineBanner = $('#ceb-inline');
   if ( window.location.href.indexOf('m.wikipedia') > -1 ) {
       $('.pre-content').prepend( $inlineBanner );
   } else {
       $('#siteNotice').prepend($('#centralNotice'));
   }
   $inlineBanner.css('display', 'block');

};

$(function() {

   var language = mw.centralNotice.data.uselang;
   var country  = mw.centralNotice.data.country;
   // Country name
   var countryName;
   if ( ceb.countryNames[language] ) {
       countryName = ceb.countryNames[language][country] || ceb.countryNames.en[country];
   } else {
       countryName = ceb.countryNames.en[country];
   }
   $('.ceb-replace-countryname').html( countryName );
   // Day of week
   var now = new Date();
   var dayNumber = now.getDay();
   if ( $('.ceb-replace-dayofweek').length > 0 ) {
       if ( ceb.dayNames[language] ) {
           $('.ceb-replace-dayofweek').html( ceb.dayNames[language][dayNumber] );
       } else {
           console.log('Warning: banner should contain a day of the week, but no translations found.');
       }
   }
   // Replace device with iPad if needed
   var ua = navigator.userAgent;
   if ( ua.match( /ipad/i ) ) {
       $('.ceb-replace-device').html( ceb.iPadTranslations[language] || ceb.iPadTranslations.en );
   }
   // Close top banner on click or return
   $('.ceb-inline-close').on('click keypress', function(e) {
       if (e.which === 13 || e.type === 'click') {
           $('#ceb-inline').hide();
           mw.centralNotice.hideBanner();
           e.stopPropagation();
       }
   });
   /* 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) {
       ceb.insertInlineBanner();
   }
   // Adjustments for mobile
   if ( window.location.href.indexOf('m.wikipedia') > -1 ) {
       $('.ceb').addClass('ceb--is-mobile');
   }

}); </script>