User:Bugs5382/monobook.js/film.js
< User:Bugs5382 | monobook.js
Jump to navigation Jump to search Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript" or "iusc", take note that this causes you to dynamically load a remote script, which could be changed by others. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. The code will be executed when previewing this page. |
Documentation for this user script can be added at User:Bugs5382/monobook.js/film. |
/* <pre><nowiki> */ var fsection = '0'; var aclass; var iclass; function doQft(iclass) { if (!iclass) { aclass = prompt('Type Class:'); if (!aclass) { return; } } else { aclass = iclass; } /* var nurl = 'http://en.wikipedia.org/w/index.php?title=Talk:' + getPname() + '&action=edit' + '§ion=' + section; document.location = nurl; */ document.getElementById('bodyContent').innerHTML = 'Please wait' + '...'; gml_xmlhttp = HTTPClient(); if (!gml_xmlhttp) { return; } document.getElementById('bodyContent').innerHTML += '<br />Grabbing page...'; gml_xmlhttp.open('GET', 'http://en.wikipedia.org/w/index.php?title=Talk:' + getPname() + '&action=edit' + '§ion=' + fsection + '', true); gml_xmlhttp.onreadystatechange = doQft_more; gml_xmlhttp.send(null); } function doQft_more() { if (gml_xmlhttp.readyState != 4){ document.getElementById('bodyContent').innerHTML += '.'; return } var form, newform, l; doc = gml_XMLParse(gml_xmlhttp.responseText); form = doc.getElementById('editform'); var x; var t = form.wpTextbox1.value; myArray = t.split(" "); var addClass; addClass = false; document.getElementById('bodyContent').innerHTML += '<br />Searching for existing tag...'; var testTag = "{{FilmsWikiProject}}"; for (x in myArray) { myArray2 = myArray[x].split(/\n/); for (y in myArray2) { if (myArray2[y] == testTag) { addClass = true; } } } if (addClass == true) { document.getElementById('bodyContent').innerHTML += '<br />Adding class to FilmsWikiProject tag...'; } else { document.getElementById('bodyContent').innerHTML += '<br />FilmsWikiProject Tag already modified...'; return; } allData = form.wpTextbox1.value; form.wpTextbox1.value = allData.replace(/{{FilmsWikiProject}}/, "{{FilmsWikiProject|class="+aclass+"}}"); //alert("Test Data:" + form.wpTextbox1.value); form.wpSummary.value = 'Changed {{FilmsWikiProject}} tag with a class'; newform = document.createElement('form'); l = form.getElementsByTagName('textarea'); for (i = l.length; i--; ) { var t = document.createElement('input'); t.type = 'hidden'; t.name = l[i].name; t.value = l[i].value; newform.appendChild(t); } l = form.getElementsByTagName('input'); for (i = l.length; i--; ) { if (l[i].name == 'wpSummary') { l[i].value = 'Changed {{FilmsWikiProject}} tag with a class'; } else if (l[i].name == 'wpMinoredit') { l[i].value = '1'; } else if (l[i].name == 'wpWatchthis') { if (!l[i].checked) { continue; } l[i].value = "on"; } else if (l[i].name == 'wpPreview') { continue; } else if (l[i].name == 'wpDiff') { continue; } l[i].type = 'hidden'; newform.appendChild(l[i]); } newform.name = form.name; newform.method = form.method; newform.id = form.id; newform.action = form.action; document.getElementById('bodyContent').innerHTML += '<br />Submitting form...'; document.getElementById('bodyContent').appendChild(newform); // Submit the form newform.submit(); } /* </nowiki></pre> */
No comments:
Post a Comment