User:Sentra246/wikia.js

/*** BEGIN TEMPLATES SCRIPT ***/ // /* For help with this script, visit http://runescape.wikia.com/wiki/User:Quarenon/Scripts/Templates */ var toolbarTemplates = []; var toolbarFillSummary = 1; var toolbarFillHeader = 0; // Add custom templates here toolbarTemplates.push({ name: 'Needs Transparency', ns: 'File', open: , close: , sample: '' }); toolbarTemplates.push({ name: 'welcome to the RS wikia!', ns: 'User talk', open: '~', close: , sample:  }); toolbarTemplates.push({ name: 'Happy birthday', ns: 'User talk', open: , close: , sample: '' }); toolbarTemplates.push({ name: 'obsolete image', ns: 'File', open: , close: , sample: '' }); toolbarTemplates.push({ name: 'needs cropping', ns: 'File', open: , close: , sample: '' }); toolbarTemplates.push({ name: 'speedy move', ns: 'File', open: , close: , sample: '' }); toolbarTemplates.push({ name: 'Unnecessary animation', ns: 'File', open: , close: , sample: '' }); toolbarTemplates.push({ name: 'sd image', ns: 'File', open: , close: , sample: '' }); toolbarTemplates.push({ name: 'Thankyou', ns: 'User talk', open: 'sentra246', close: , sample:  }); /* DO NOT EDIT THIS LINE! */ /** * templates.js * * Insert various templates from the edit toolbar. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ $(document).ready(function {	// http://www.netlobo.com/url_query_string_javascript.html	function getParam(name) {		name = name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');		var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); 		var results = regex.exec(window.location.href);		if (results == null) {			return ;		} else {			return decodeURIComponent(results[1]);		}	}	function setCookie(name, value, expires) {		var d = new Date;		d.setDate(d.getDate + expires);		document.cookie = name + '=' + escape(value) + ';path=/';	}	function getCookie(name) {		if (document.cookie.length > 0) {			var start = document.cookie.indexOf(name + '=');			if (start != -1) { 				start = start + name.length + 1; 				var end = document.cookie.indexOf(';', start);				if (end == -1) {					end = document.cookie.length;				}				return unescape(document.cookie.substring(start, end));			} 		}		return ; }	// Needle and haystack should contain strings. Each element in haystack will be trimmed before comparison. function inArray(needle, haystack) { for (var i in haystack) { if (needle == $.trim(haystack[i])) { return true; }		}		return false; }	var toolbarTemplates = (window.toolbarTemplates instanceof Array) ? window.toolbarTemplates : []; toolbarTemplates = toolbarTemplates.concat([		{ name: 'speedy deletion', ns: '|File', open: '\n\n', sample: 'Reason' },		{ name: 'Delete Personal', ns: 'File', open: '\n\n', sample: 'Personal image' },		{ name: 'Blacklist', ns: '|File', open: '\n\n', sample: 'Reason' },		{ name: 'NPOV', ns: , open: , close: '\n\n', sample:  },		{ name: 'Move', ns: , open: '\n\n', sample: 'Page' },		{ name: 'Merge', ns: , open: '\n\n', sample: 'Page' },		{ name: 'Under construction', ns: '|User|Project', open: '\n\n', close: , sample:  },		{ name: 'Disputed', ns: , open: '\n\n', close: , sample:  },		{ name: 'Cleanup', ns: , open: '\n\n', close: , sample:  },		{ name: 'Clarify', ns: , open: , close: , sample:  },		{ name: 'Incomplete', ns: , open: '\n\n', close: , sample:  },		{ name: 'In Use', ns: '|Project', open: '\n\n', close: , sample:  },		{ name: 'Map Nomination', ns: , open: '\n\n', close: , sample: '' }, { name: 'Obsolete', ns: , open: '\n\n', close: , sample: '' }, { name: 'Protect', ns: , open: '\n\n', close: , sample: '' }, { name: 'Too Big', ns: , open: '\n\n', close: , sample: '' }, { name: 'Vote for Deletion', ns: , open: '\n\n', close: , sample: '' }, { name: 'Wikify', ns: '|Update', open: '\n\n', close: , sample:  }, { name: 'Stub', ns: , open: '\n\n', close: , sample: '' }, { name: 'Section Stub', ns: , open: '\n\n', close: , sample: '' }, { name: 'GEMW Incorrect Edit (GEMW 1)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'GEMW Vandalism (GEMW 2)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Charm Log Incorrect Edit (Charm log 1)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Charm Log Vandalism (Charm log 2)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Temporary Block', ns: 'User_talk', open: ' ~', close: , sample:  }, { name: 'Welcome Notice', ns: 'User_talk', open:  + wgUserName + , close: , sample:  }, { name: 'No Personal Images', ns: 'User_talk', open:  + wgUserName + ' ~', close: , sample: '' }, { name: 'No Vandal', ns: 'User_talk', open: ' ~', close: , sample:  }, { name: 'Inaccurate Edit (Error 1)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Inaccurate Edit (Error 2)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Test Edit Warning (Test 1)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Possible Vandalism Warning (Test 2)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Disruption Warning (Test 3)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Final Warning (Test 4)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Deleted User Talk', ns: 'User_talk', open: ' ~', close: , sample:  }, { name: 'Non-Neutral Point of View (POV 1)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Non-Neutral Point of View (POV 2)', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, { name: 'Vandal', ns: 'User_talk', open: '', close: ' ~', sample: 'number of offense' }, { name: 'User Edit', ns: 'User_talk', open:  + wgUserName + ' ~', close: , sample: '' }, { name: 'Don\'t Edit Userpages', ns: 'User_talk', open: '', close: ' ~', sample: '__CONTENTPAGE__' }, ]);	/* Try to keep track of the last visited "content" page. */	if (wgCanonicalNamespace.search(/talk|special/gi) == -1) {		var page = wgPageName.replace(/_/g, ' ');		if (wgCanonicalNamespace == 'File') {			page = ':' + page;		}		setCookie('templatesContentReferrer', page);	}	/* Append template list when editing user talk pages. */	if (wgAction == 'edit' || wgAction == 'submit') {		var haveTemplates = false;		var $select = $(' ').change(function { var i = $(this).val; if (i == '-1') { return; }			var tpl = toolbarTemplates[i]; insertTags(tpl.open, tpl.close, tpl.sample.replace('__CONTENTPAGE__', getCookie('templatesContentReferrer'))); var fillSummary = (typeof(window.toolbarFillSummary) != 'undefined') ? window.toolbarFillSummary : true; var fillHeading = (typeof(window.toolbarFillHeading) != 'undefined') ? window.toolbarFillHeading : true; var newSection = (getParam('section') == 'new'); if ((newSection && fillHeading) || (!newSection && fillSummary)) { var summary = $('#wpSummaryEnhanced').val; if ($.trim(summary.replace(/\/\*.*?\*\//, )) == ) { $('#wpSummaryEnhanced').val(summary + tpl.name); }			}		});		$select.append($(' ').val('-1').text('[Templates]'));		for (var i in toolbarTemplates) {			var tpl = toolbarTemplates[i];			var ns = tpl.ns.toLowerCase;			// normalize namespace list			ns = ns.replace(/ /g, '_').replace(/main/g, '').replace(/image/g, 'file');			if (tpl.ns == '*' || inArray(wgCanonicalNamespace.toLowerCase, ns.split('|'))) {				$select.append($(' ').val(i).text(tpl.name));				haveTemplates = true;			}		}		if (haveTemplates) {			$('#toolbar').prepend($select);		}	} }); // /*** END TEMPLATES SCRIPT ***/