"मीडियाविकि:Common.js/watchlist.js" इत्यस्य संस्करणे भेदः
Content deleted Content added
imported>Remember the dot moved from MediaWiki:Common.js |
updated code, from testwiki:MediaWiki:Common.js/watchlist.js |
||
पङ्क्तिः १:
//<source lang="JavaScript">
/** Add dismiss
*
* Description:
* Note: HTML is backwards compatible with old version, new version ignores old syntax, except for dismissed IDs.
* Maintainers: [[User:Ruud Koot|Ruud Koot]], [[User:MZMcBride|MZMcBride]]
*/
function addDismissButton() {
var watchItems = getElementsByClassName(docobj, 'div', 'watchlist-message');
if(watchItems.length == 0) return
var watchlistCookieID = watchlistMessage.className.replace(/cookie\-ID\_/ig,'');▼
for(var i=0;i<watchItems.length;i++) {
▲ var watchlistCookieID =
if ( document.cookie.indexOf( "hidewatchlistmessage-" + watchlistCookieID + "=yes" ) != -1 ) {▼
if(isNaN(watchlistCookieID)) continue
watchlistMessage.style.display = "none";▼
▲ if
continue;
}
▲ var Button = document.createElement( "span" );
ButtonLink.setAttribute(
▲ var ButtonLink = document.createElement( "a" );
▲ var ButtonText = document.createTextNode( "dismiss" );
▲ ButtonLink.setAttribute( "id", "dismissButton" );
▲ ButtonLink.setAttribute( "href", "javascript:dismissWatchlistMessage();" );
Button.appendChild(document.createTextNode(']'));
▲ ButtonLink.setAttribute( "title", "Hide this message for one week" );
}
}▼
function dismissWatchlistMessage(num,cid) {▼
▲ Button.appendChild( document.createTextNode( "[" ) );
var docobj = document.getElementById('bodyContent') || document.getElementById('content') || document
▲ Button.appendChild( ButtonLink );
var watchItems = getElementsByClassName(docobj, 'div', 'watchlist-message');
▲ Button.appendChild( document.createTextNode( "]" ) );
}
▲function dismissWatchlistMessage() {
▲ var e = new Date();
▲ e.setTime( e.getTime() + (7*24*60*60*1000) );
▲ document.cookie = "hidewatchlistmessage-" + watchlistCookieID + "=yes; expires=" + e.toGMTString() + "; path=/";
▲ watchlistMessage.style.display = "none";
▲}
▲addOnloadHook( addDismissButton );
/** Geo-targeted watchlist notice *******************************************************
Line ५० ⟶ ५२:
*/
if (wgPageName == "Special:Watchlist") {
addOnloadHook
}
//</source>
|