User:Gamedezyner/Unfollow.js

function apiQuery(parameters) { var get = new XMLHttpRequest; get.open("GET", wgServer+"/api.php?action=query&" + parameters + "&format=json", false); get.send( null ); return $.parseJSON(get.responseText); }; function unfollow { mywatchlist = apiQuery("list=watchlistraw&wrlimit=500").watchlistraw; i = 0; var clearWatchlistInterval = setInterval(function{       if (i<mywatchlist.length) {            unwatchPage(mywatchlist[i].title,i,mywatchlist.length)            i++        };    },1000); }; function unwatchPage(target, number, total) { var post = new XMLHttpRequest; url = wgServer + "/api.php?action=watch&title=" + encodeURIComponent(target) + "&unwatch=1&format=json&token=" + encodeURIComponent(mw.user.tokens.get("watchToken")); post.open("POST", url); post.send; result = [number, total-number, target, url]; console.log(result); };