See also ebooksgratis.com: no banners, no cookies, totally FREE.

CLASSICISTRANIERI HOME PAGE - YOUTUBE CHANNEL
Privacy Policy Cookie Policy Terms and Conditions
Utilisateur:Stef48/wlunwatch.js - Wikipédia

Utilisateur:Stef48/wlunwatch.js

Un article de Wikipédia, l'encyclopédie libre.

Note : Après avoir publié la page, vous devrez forcer son rechargement pour voir les changements : Mozilla / Konqueror / Firefox : Shift-Ctrl-R, Internet Explorer / Opera : Ctrl-F5, Safari : Cmd-R.

var wlUnwatch = new function(){
 
var unWatchLinks = [];
var watchMsg = window.wgAjaxWatch ? wgAjaxWatch.watchMsg : 'Watch';
var unwatchMsg = window.wgAjaxWatch ? wgAjaxWatch.unwatchMsg : 'Unwatch';
var wlForm;
var inProgress = null;
var timeoutID = null;
 
this.onLoad = function() { //public method
	if (!(wlForm = document.forms[0]) || !wlForm.namespace) return;
	var links = document.getElementById('content').getElementsByTagName('a');
	for (var i = 0; i < links.length; i++){ //append (x) links after history links
		if (!links[i].href.match(/[?&]action=history([&#]|$)/)) continue;
		var unwatch = document.createElement('a');
		unwatch.href = wgServer+wgScript+'?action=unwatch&title='+encodeURIComponent(links[i].title);
		unwatch.onclick = onClick;
		unWatchLinks.push(unwatch);
		var nextEl = links[i].nextSibling.nextSibling; //item after )
		nextEl.parentNode.insertBefore(document.createTextNode(' ('), nextEl);
		nextEl.parentNode.insertBefore(unwatch, nextEl);
		nextEl.parentNode.insertBefore(document.createTextNode(') '), nextEl);
		setUnwatchLink(unwatch, false);
	}
}
 
 
function setUnwatchLink (unwatchLink, state) {
	unwatchLink.innerHTML = state ? '+' : 'x';
	unwatchLink.title = state ? watchMsg : unwatchMsg;
}
 
function getPgName (unwatchLink){
	return decodeURIComponent(unwatchLink.href.match(/&title=(.+)/)[1]);
}
 
 
 function onClick(e) {
	if (inProgress) return false;
	if (!e) var e = window.event;
	if (e.target) var targ = e.target; else if (e.srcElement) var targ = e.srcElement;
	inProgress = getPgName(targ);
	timeoutID = window.setTimeout(	function() {inProgress = null},	10000	); 
	//call server
	var action = (targ.innerHTML == 'x') ? 'u' : 'w';
	sajax_do_call('wfAjaxWatch', [inProgress, action], showResult);
	return false;
}
 
 
function showResult (request) {
	if (timeoutID) window.clearTimeout(timeoutID);
	var response = request.responseText;
	if (window.wlUnwatchShowMsg) jsMsg (response.substr(4), 'watch');
	var name = inProgress, name2 = name, state, prefix, idx, ns = 0, pg, i, el; 
	inProgress = null;
	if (response.match(/^<u#>/))  
		state = true
	else if (response.match(/^<w#>/))
		state = false
	else return; //unrecognized response
	//find the name of "other page"
	if ((idx = name.indexOf(':')) != -1){ //not main namespace
		prefix = name.substring(0,idx);
		name2 = name.substring(idx + 1)
		for (i=2; i < wlForm.namespace.options.length; i++)
			if (wlForm.namespace.options[i].text == prefix)
				ns = i - 1;
		if (ns == 0) name2 = name; // guess : was a  part of the page name
	}
	if (ns % 2)	ns--; else ns++; //switch to  "other" namespace
	if (ns > 0) name2 = wlForm.namespace.options[ns+1].text + ':' +  name2;
	//now mark all pages that are either name or name2
	for (i=0; i<unWatchLinks.length; i++)
		if ((pg = getPgName(unWatchLinks[i])) && (pg==name || pg==name2)) {
			setUnwatchLink (unWatchLinks[i], state);
			el = unWatchLinks[i]; //now mark the whole line
			while ((el=el.previousSibling) && (el.nodeName!='DIV') && (el.nodeName!='BR')) 
				if (el.style) el.style.textDecoration = state ? 'line-through' : '';
		}
}
 
}//obj
 
 
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view') {
	if (doneOnloadHook) wlUnwatch.onLoad(); //if imported dynamically
	else addOnloadHook (wlUnwatch.onLoad)
}


aa - ab - af - ak - als - am - an - ang - ar - arc - as - ast - av - ay - az - ba - bar - bat_smg - bcl - be - be_x_old - bg - bh - bi - bm - bn - bo - bpy - br - bs - bug - bxr - ca - cbk_zam - cdo - ce - ceb - ch - cho - chr - chy - co - cr - crh - cs - csb - cu - cv - cy - da - de - diq - dsb - dv - dz - ee - el - eml - en - eo - es - et - eu - ext - fa - ff - fi - fiu_vro - fj - fo - fr - frp - fur - fy - ga - gan - gd - gl - glk - gn - got - gu - gv - ha - hak - haw - he - hi - hif - ho - hr - hsb - ht - hu - hy - hz - ia - id - ie - ig - ii - ik - ilo - io - is - it - iu - ja - jbo - jv - ka - kaa - kab - kg - ki - kj - kk - kl - km - kn - ko - kr - ks - ksh - ku - kv - kw - ky - la - lad - lb - lbe - lg - li - lij - lmo - ln - lo - lt - lv - map_bms - mdf - mg - mh - mi - mk - ml - mn - mo - mr - mt - mus - my - myv - mzn - na - nah - nap - nds - nds_nl - ne - new - ng - nl - nn - no - nov - nrm - nv - ny - oc - om - or - os - pa - pag - pam - pap - pdc - pi - pih - pl - pms - ps - pt - qu - quality - rm - rmy - rn - ro - roa_rup - roa_tara - ru - rw - sa - sah - sc - scn - sco - sd - se - sg - sh - si - simple - sk - sl - sm - sn - so - sr - srn - ss - st - stq - su - sv - sw - szl - ta - te - tet - tg - th - ti - tk - tl - tlh - tn - to - tpi - tr - ts - tt - tum - tw - ty - udm - ug - uk - ur - uz - ve - vec - vi - vls - vo - wa - war - wo - wuu - xal - xh - yi - yo - za - zea - zh - zh_classical - zh_min_nan - zh_yue - zu -