Page MenuHomePhabricator
Paste P11883

set hide cookie
ActivePublic

Authored by Ejegg on Jul 14 2020, 2:05 AM.
Referenced Files
F31934577: raw.txt
Jul 14 2020, 3:32 AM
F31934533: raw.txt
Jul 14 2020, 2:36 AM
F31934522: raw.txt
Jul 14 2020, 2:05 AM
if ( location.href.match( /.*wikipedia.org/i ) ) {
mw.loader.using( 'jquery.cookie' ).done( function () {
var date = new Date(),
// This format should be synchronized with setHideCookies() in
// https://phabricator.wikimedia.org/diffusion/ECNO/browse/master/resources/ext.centralNotice.display/hide.js
hideData = {
v: 1,
created: Math.floor( date.getTime() / 1000 ),
reason: 'donate'
},
// Should synchronize this with $wgNoticeCookieDurations['donate']
// in the Mediawiki config repo. Not available on donatewiki because
// we don't have CentralNotice turned on here.
duration = 21600000;
// Re-use the same date object to set the cookie's expiry time
date.setSeconds( date.getSeconds() + duration );
$.cookie(
'centralnotice_hide_fundraising',
JSON.stringify( hideData ),
{ expires: date, path: '/', domain: 'wikipedia.org' }
);
} );
}