User:Firetrap9254/watchlistDumper.js

//

// Dump your watchlist into an edit page, but with a watch flag in the URL - so you can wipe your

// watch list reload it by opening all of the links.

// All credit to Lupin, as this is nothing but a cheap rip off of his original

// Installation: add // // User:Firetrap9254/watchlistDumper.js // // to your user javascript file.

// Usage: type // // javascript:watchlistDumper.dump // // into the address bar of your browser when editing the relevant page. // // Alternatively, bookmark this as a url for easy access, // or add a link to your toolbox.

watchlistDumper = {

download : function(bundle) { var x = window.XMLHttpRequest ? new XMLHttpRequest : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false; if (x) { x.onreadystatechange=function {x.readyState==4 && watchlistDumper.downloadComplete(x,bundle);}; x.open("GET",bundle.url,true); x.send(null); } },

downloadComplete : function(x,bundle) { x.status==200 && ( bundle.onSuccess && bundle.onSuccess(x,bundle) || true ) || ( bundle.onFailure && bundle.onFailure(x,bundle) || alert(x.statusText)); },

processWatchlist : function(req, bundle) { try { var editbox=document.editform.wpTextbox1; } catch (err) { alert('Please edit the page where you want to dump your watchlist'); return; }	var watchlist=[]; var lines=req.responseText.split('\n'); for (var i=0; i -1) { var article=lines[i].replace(/.*title="(.*?)">.*/, '$1'); article = article.replace(/ /g, '_'); if (/^(Category|Image)/.test(article)) { article = ':' + article; } watchlist.push(article); }	}	if (watchlist.length > 0) { editbox.value += '*+ watchlist.join('&action=watch\n*+ '&action=watch\n'; } 	alert( 'Dumped ' + watchlist.length + ' watched pages' ); },

dump : function { watchlistDumper.download({      url: 'http://en.wikipedia.org/wiki/Special:Watchlist/edit', 			  onSuccess: watchlistDumper.processWatchlist,			  onFailure: function{alert('Watchlist download failed for some reason; please try again.');}	}); } } //