User:WOSlinkerBot/collab-science.js
Appearance
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", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:WOSlinkerBot/collab-science. |
function collab_queryString(p) {
var re = RegExp('[&?]' + p + '=([^&]*)');
var matches;
if (matches = re.exec(document.location)) {
try {
return decodeURI(matches[1]);
} catch (e) { }
}
return null;
}
//Add a 'collab edit' tab
if(mw.config.get('wgArticleId') != 0 ) {
$( function collabEditButton() {
mw.util.addPortletLink('p-cactions',
mw.util.getUrl(null,{action:'edit',collabedit:true}),
'collab',
'p-collab',
'collab edit');
}
)}
if(mw.config.get('wgAction') == 'edit' && collab_queryString('collabedit') == 'true') {
$(function collab() {
var myContent = document.getElementById('wpTextbox1').value;
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* August 2006) \(UTC\)/g,'[[Hydrogen]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* September 2006) \(UTC\)/g,'[[Human genome]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* October 2006) \(UTC\)/g,'[[Karyotype]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* November 2006) \(UTC\)/g,'[[Antioxidant]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* December 2006) \(UTC\)/g,'[[Gene]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* January 2007) \(UTC\)/g,'[[Supernova]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* February 2007) \(UTC\)/g,'[[Natural selection]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* March 2007) \(UTC\)/g,'[[Oxygen]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* April 2007) \(UTC\)/g,'[[Infrared]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* May 2007) \(UTC\)/g,'[[X-ray crystallography]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* June 2007) \(UTC\)/g,'[[Nuclear magnetic resonance]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* July 2007) \(UTC\)/g,'[[Biotechnology]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* August 2007) \(UTC\)/g,'[[Photosynthesis]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* September 2007) \(UTC\)/g,'[[Biology]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* October 2007) \(UTC\)/g,'[[Laser]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* November 2007) \(UTC\)/g,'[[Rainbow]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* December 2007) \(UTC\)/g,'[[Atom]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* January 2008) \(UTC\)/g,'[[Prion]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* February 2008) \(UTC\)/g,'[[Genetic pollution]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* March 2008) \(UTC\)/g,'[[Surface science]]$1\n|}\n$2 (UTC)');
myContent = myContent.replace(/\{\{Collab\-science\}\}(.*?)\n\|\}\n(.*? \d\d\:\d\d\, \d* May 2008) \(UTC\)/g,'[[Carbon]]$1\n|}\n$2 (UTC)');
if(document.getElementById('wpTextbox1').value != myContent) {
if(document.getElementById('wpTextbox1').value != myContent) {
document.getElementById('wpTextbox1').value=myContent;
document.getElementById('wpSummary').value='substitute {{collab-science}} template with time relevant contents';
document.getElementById('wpMinoredit').checked = true;
}
}
}
)}