<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.stoney-cloud.org/w/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-Edittools.js</id>
	<title>MediaWiki:Gadget-Edittools.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stoney-cloud.org/w/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-Edittools.js"/>
	<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=MediaWiki:Gadget-Edittools.js&amp;action=history"/>
	<updated>2026-04-17T11:00:44Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.stoney-cloud.org/w/index.php?title=MediaWiki:Gadget-Edittools.js&amp;diff=4167&amp;oldid=prev</id>
		<title>Tiziano: 1 revision from :mediawikiwiki:MediaWiki:Gadget-Edittools.js</title>
		<link rel="alternate" type="text/html" href="https://wiki.stoney-cloud.org/w/index.php?title=MediaWiki:Gadget-Edittools.js&amp;diff=4167&amp;oldid=prev"/>
		<updated>2014-08-22T09:58:20Z</updated>

		<summary type="html">&lt;p&gt;1 revision from &lt;a href=&quot;http://www.mediawiki.org/wiki/MediaWiki:Gadget-Edittools.js&quot; class=&quot;extiw&quot; title=&quot;mediawikiwiki:MediaWiki:Gadget-Edittools.js&quot;&gt;mediawikiwiki:MediaWiki:Gadget-Edittools.js&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/**&lt;br /&gt;
 * EditTools support: add a selector, change &amp;lt;a&amp;gt; into buttons.&lt;br /&gt;
 * The special characters to insert are defined at [[MediaWiki:Edittools]].&lt;br /&gt;
 *&lt;br /&gt;
 * @author Arnomane, 2006 (on the commons.wikimedia.org/wiki/MediaWiki:Edittools.js)&lt;br /&gt;
 * @author Kaganer, 2007 (adapting to www.mediawiki.org)&lt;br /&gt;
 * @author Krinkle, 2012&lt;br /&gt;
 * @source www.mediawiki.org/wiki/MediaWiki:Gadget-Edittools.js&lt;br /&gt;
 * @revision 2012-02-29&lt;br /&gt;
 */&lt;br /&gt;
/*jslint browser: true*/&lt;br /&gt;
/*global jQuery, mediaWiki*/&lt;br /&gt;
(function ($, mw) {&lt;br /&gt;
	&amp;quot;use strict&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	var conf, editTools, $sections;&lt;br /&gt;
&lt;br /&gt;
	conf = {&lt;br /&gt;
		initialSubset: window.EditTools_initial_subset === undefined ? window.EditTools_initial_subset : 0&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	editTools = {&lt;br /&gt;
&lt;br /&gt;
		/**&lt;br /&gt;
		 * Creates the selector&lt;br /&gt;
		 */&lt;br /&gt;
		setup: function () {&lt;br /&gt;
			var $container, $select, initial;&lt;br /&gt;
&lt;br /&gt;
			$container = $(&amp;#039;#mw-edittools-charinsert&amp;#039;);&lt;br /&gt;
			if (!$container.length) {&lt;br /&gt;
				return;&lt;br /&gt;
			}&lt;br /&gt;
			$sections = $container.find(&amp;#039;.mw-edittools-section&amp;#039;);&lt;br /&gt;
			if ($sections.length &amp;lt;= 1) {&lt;br /&gt;
				// Only care if there is more than one&lt;br /&gt;
				return;&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			$select = $(&amp;#039;&amp;lt;select&amp;gt;&amp;#039;).css(&amp;#039;display&amp;#039;, &amp;#039;inline&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
			initial = conf.initialSubset;&lt;br /&gt;
			if (isNaN(initial) || initial &amp;lt; 0 || initial &amp;gt;= $select.length) {&lt;br /&gt;
				initial = 0;&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			$sections.each(function (i, el) {&lt;br /&gt;
				var $section, sectionTitle, $option;&lt;br /&gt;
&lt;br /&gt;
				$section = $(el);&lt;br /&gt;
				sectionTitle = $section.data(&amp;#039;sectionTitle&amp;#039;);&lt;br /&gt;
&lt;br /&gt;
				$option = $(&amp;#039;&amp;lt;option&amp;gt;&amp;#039;)&lt;br /&gt;
					.text(sectionTitle)&lt;br /&gt;
					.prop(&amp;#039;value&amp;#039;, i)&lt;br /&gt;
					.prop(&amp;#039;selected&amp;#039;, i === initial);&lt;br /&gt;
&lt;br /&gt;
				$select.append($option);&lt;br /&gt;
			});&lt;br /&gt;
&lt;br /&gt;
			$select.change(editTools.handleOnchange);&lt;br /&gt;
			$container.prepend($select);&lt;br /&gt;
&lt;br /&gt;
			editTools.chooseSection(initial);&lt;br /&gt;
		},&lt;br /&gt;
&lt;br /&gt;
		/**&lt;br /&gt;
		 * Handle onchange event of the &amp;lt;select&amp;gt;&lt;br /&gt;
		 *&lt;br /&gt;
		 * @context {Element}&lt;br /&gt;
		 * @param e {jQuery.Event}&lt;br /&gt;
		 */&lt;br /&gt;
		handleOnchange: function () {&lt;br /&gt;
			editTools.chooseSection(Number($(this).val()));&lt;br /&gt;
&lt;br /&gt;
			return true;&lt;br /&gt;
		},&lt;br /&gt;
&lt;br /&gt;
		/**&lt;br /&gt;
		 * Toggle the currently visible section&lt;br /&gt;
		 *&lt;br /&gt;
		 * @param sectionNr {Number}&lt;br /&gt;
		 * @param setFocus {Boolean}&lt;br /&gt;
		 */&lt;br /&gt;
		chooseSection: function (sectionNr) {&lt;br /&gt;
			var $choise = $sections.eq(sectionNr);&lt;br /&gt;
			if ($choise.length !== 1) {&lt;br /&gt;
				return;&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			// Making these buttons is a little slow,&lt;br /&gt;
			// If we made them all at once the browser would hang&lt;br /&gt;
			// for over 2 seconds, so instead we&amp;#039;re doing it on-demand&lt;br /&gt;
			// for each section. No need to do it twice thoguh, so remember&lt;br /&gt;
			// in data whether it was done already&lt;br /&gt;
			if (!$choise.data(&amp;#039;charInsert.buttonsMade&amp;#039;)) {&lt;br /&gt;
				$choise.data(&amp;#039;charInsert.buttonsMade&amp;#039;, true);&lt;br /&gt;
				editTools.makeButtons($choise);&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			$choise.show();&lt;br /&gt;
			$sections.not($choise).hide();&lt;br /&gt;
		},&lt;br /&gt;
&lt;br /&gt;
		/**&lt;br /&gt;
		 * Convert the &amp;lt;a onclick&amp;gt; links to buttons in a given section.&lt;br /&gt;
		 *&lt;br /&gt;
		 * @param $section {jQuery}&lt;br /&gt;
		 */&lt;br /&gt;
		makeButtons: function ($section) {&lt;br /&gt;
			var $links;&lt;br /&gt;
&lt;br /&gt;
			if (!$section.length) {&lt;br /&gt;
				return;&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			$links = $section.find(&amp;#039;a&amp;#039;);&lt;br /&gt;
			$links.each(function (i, a) {&lt;br /&gt;
				var $a, button;&lt;br /&gt;
				$a = $(a);&lt;br /&gt;
				button = document.createElement(&amp;#039;input&amp;#039;);&lt;br /&gt;
				button.type = &amp;#039;button&amp;#039;;&lt;br /&gt;
				button.onclick = a.onclick;&lt;br /&gt;
				button.value = $a.text();&lt;br /&gt;
				$a.replaceWith(button);&lt;br /&gt;
			});&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	$(document).ready(editTools.setup);&lt;br /&gt;
&lt;br /&gt;
}(jQuery, mediaWiki));&lt;/div&gt;</summary>
		<author><name>Tiziano</name></author>
	</entry>
</feed>