User:Dead.rabbit/depot.js

function remPDATA (json) { if (json && json.query) { if (json.query.pages) { var page = null; for (var id in json.query.pages) { page = json.query.pages[id]; break; }				if (page) { if (page.revisions && page.revisions.length > 0) { // Revisions are sorted by revision ID, hence [0] is the one we asked for, and possibly there's a [1] if we're // not on the latest revision (edit conflicts and such). var pageText = page.revisions[0]['*']; var remdata = removepdata(pageText); if (pageText != remdata) { //saveForm(page.title, remdata, page.edittoken, "Persondata has been deprecated by this RfC"); //save(page.title, remdata, page.edittoken, "Persondata has been deprecated by this RfC"); }					}				}			}		}	}	function findPDATA (json) { if (json && json.query) { if (json.query.pages) { var page = null; for (var id in json.query.pages) { page = json.query.pages[id]; break; }				if (page) { if (page.revisions && page.revisions.length > 0) { // Revisions are sorted by revision ID, hence [0] is the one we asked for, and possibly there's a [1] if we're // not on the latest revision (edit conflicts and such). var pageText = page.revisions[0]['*']; var articles = getarticles(pageText);

for(i = 0; i < articles.length; i++){ if (articles[i].indexOf("Category") != 0) { getPage(articles[i], findtext); }						}					}				}			}		}	}	function saveForm (pagename, wikitext, editToken, summary) { var formContainer = make ('div'); formContainer.style.display = 'none'; document.body.appendChild (formContainer); formContainer.innerHTML = '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + ' ';		var commitForm = document.getElementById ('hotcatCommitForm'); commitForm.wpDiff.name = commitForm.wpDiff.value = 'wpSave'; commitForm.wpAutoSummary.value = 'd41d8cd98f00b204e9800998ecf8427e'; // MD5 hash of the empty string commitForm.wpMinoredit.checked = true; commitForm.wpWatchthis.checked = false; commitForm.wpSummary.value = summary; commitForm.wpTextbox1.value = wikitext; commitForm.wpEdittime.value = commitForm.wpStarttime.value = currentTimestamp ; commitForm.wpEditToken.value = editToken;

commitForm.hcCommit.click; }	function findonpage { // detect duplicate links var getarticles = function { var href = $(this).attr('href'); if(href !== undefined && href.indexOf('#') !== 0 && href.indexOf("/wiki/") == 0 && href.indexOf(":") == -1) { var article = href.substring(6).replace("_", " "); // size of "/wiki/" getPage(article, findtext); }           return true; };       // array to keep track of whether we've seen a link before var content = ".mw-content-ltr";

mw.util.$content.find('a').not('.infobox *, .navbox *').each(getarticles); }	function getEditToken { $.getJSON(       	wgScriptPath + '/api.php?',        	{            	action: 'tokens',            	type: 'edit',            	format: 'json'        	},        	function( data ) {            	if ( data.tokens ) {                	wgEditToken = data.tokens.edittoken;                	save('User:Md.altaf.rahman/test.js', 'gangnam style', wgEditToken);            	}        	}    	) }	if((wgNamespaceNumber !== 0) && (wgNamespaceNumber != 2)) { // only check links in mainspace and userspace (for userspace drafts) //return; }   var remPDATAlink = mw.util.addPortletLink('p-tb', '#', 'Remove Persondata', 'ca-rempdata'); $(remPDATAlink).click( function(e) {       e.preventDefault;    	getPage(conf.wgPageName, remPDATA);    }); var findPDATAlink = mw.util.addPortletLink('p-tb', '#', 'Find Persondata', 'ca-findpdata'); $(findPDATAlink).click( function(e) {       e.preventDefault;    	//getPage(conf.wgPageName, findPDATA);    	findonpage;    });

getEditToken; getPage(conf.wgPageName, remPDATA); function getarticles(wikitext){ var s = 0; var i;		var articles = []; while((i=wikitext.indexOf("", s)) != -1) {			e = wikitext.indexOf("", i); var ahref = wikitext.substring(i, e+2); var res = getlinktext(ahref); var link = res[0]; articles.push(link); s = e;		} return articles; }		function getlinktext(str){ if ((bar=str.indexOf("|")) != -1) { link = str.substring(2, bar); text = str.substring(bar+1, str.length-2); } else { link = text = str.substring(2, str.length-2); }		return [link, text]; }