<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-scribunto-console-core.js</id>
	<title>MediaWiki:Gadget-scribunto-console-core.js - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.runerealm.org/index.php?action=history&amp;feed=atom&amp;title=MediaWiki%3AGadget-scribunto-console-core.js"/>
	<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;action=history"/>
	<updated>2026-04-11T05:09:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=42212&amp;oldid=prev</id>
		<title>Alex at 11:06, 20 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=42212&amp;oldid=prev"/>
		<updated>2024-10-20T11:06:20Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;amp;diff=42212&amp;amp;oldid=39082&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=39082&amp;oldid=prev</id>
		<title>Alex at 16:15, 17 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=39082&amp;oldid=prev"/>
		<updated>2024-10-17T16:15:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:15, 17 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/**&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/**&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Gadget that loads a couple of snippets for the console on module &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw.&lt;/del&gt;pages&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Gadget that loads a couple of snippets for the console on module pages&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Authors:&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Authors:&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; ** LapOnTheMoon&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; ** LapOnTheMoon&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=34658&amp;oldid=prev</id>
		<title>Alex at 23:10, 16 October 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=34658&amp;oldid=prev"/>
		<updated>2024-10-16T23:10:37Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:10, 17 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/**&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;/**&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Gadget that loads a couple of snippets for the console on module pages&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Gadget that loads a couple of snippets for the console on module &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mw.&lt;/ins&gt;pages&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Authors:&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; * Authors:&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; ** LapOnTheMoon&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; ** LapOnTheMoon&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
	<entry>
		<id>https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=929&amp;oldid=prev</id>
		<title>Alex: Created page with &quot;/**  * Gadget that loads a couple of snippets for the console on module pages  * Authors:  ** LapOnTheMoon  ** Gaz Lloyd  *   *   * The scribunto console is run by ext.scribunto.edit - https://github.com/wikimedia/mediawiki-extensions-Scribunto/blob/master/modules/ext.scribunto.edit.js */ const FRAME_TEST = [ 	&quot;local frame = {}&quot;, 	&quot;function frame.getParent()&quot;, 	&quot;  local args = {&quot;, 	&quot;    -- Args go here as [&#039;name&#039;] = value,&quot;, 	&quot;  }&quot;, 	&quot;  return { args = args }&quot;, 	&quot;end&quot;,...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.runerealm.org/index.php?title=MediaWiki:Gadget-scribunto-console-core.js&amp;diff=929&amp;oldid=prev"/>
		<updated>2024-10-13T01:03:29Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;*  * Gadget that loads a couple of snippets for the console on module pages  * Authors:  ** LapOnTheMoon  ** Gaz Lloyd  *   *   * The scribunto console is run by ext.scribunto.edit - https://github.com/wikimedia/mediawiki-extensions-Scribunto/blob/master/modules/ext.scribunto.edit.js: &lt;/span&gt; const FRAME_TEST = [ 	&amp;quot;local frame = {}&amp;quot;, 	&amp;quot;function frame.getParent()&amp;quot;, 	&amp;quot;  local args = {&amp;quot;, 	&amp;quot;    -- Args go here as [&amp;#039;name&amp;#039;] = value,&amp;quot;, 	&amp;quot;  }&amp;quot;, 	&amp;quot;  return { args = args }&amp;quot;, 	&amp;quot;end&amp;quot;,...&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/**&lt;br /&gt;
 * Gadget that loads a couple of snippets for the console on module pages&lt;br /&gt;
 * Authors:&lt;br /&gt;
 ** LapOnTheMoon&lt;br /&gt;
 ** Gaz Lloyd&lt;br /&gt;
 * &lt;br /&gt;
 * &lt;br /&gt;
 * The scribunto console is run by ext.scribunto.edit - https://github.com/wikimedia/mediawiki-extensions-Scribunto/blob/master/modules/ext.scribunto.edit.js&lt;br /&gt;
*/&lt;br /&gt;
const FRAME_TEST = [&lt;br /&gt;
	&amp;quot;local frame = {}&amp;quot;,&lt;br /&gt;
	&amp;quot;function frame.getParent()&amp;quot;,&lt;br /&gt;
	&amp;quot;  local args = {&amp;quot;,&lt;br /&gt;
	&amp;quot;    -- Args go here as [&amp;#039;name&amp;#039;] = value,&amp;quot;,&lt;br /&gt;
	&amp;quot;  }&amp;quot;,&lt;br /&gt;
	&amp;quot;  return { args = args }&amp;quot;,&lt;br /&gt;
	&amp;quot;end&amp;quot;,&lt;br /&gt;
	&amp;quot;mw.log( p.main(frame) )&amp;quot;&lt;br /&gt;
],&lt;br /&gt;
FRAME_TEST_TEXT = FRAME_TEST.join(&amp;#039;\n&amp;#039;);&lt;br /&gt;
var $clearBtn, load_attempts = 0, $inp;&lt;br /&gt;
&lt;br /&gt;
function addButtons() {&lt;br /&gt;
	var $addTextBtn = $(&amp;#039;&amp;lt;input class=&amp;quot;console-control console-addFrameText&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Frame text&amp;quot; title=&amp;quot;Load code for a basic frame&amp;quot;&amp;gt;&amp;#039;);&lt;br /&gt;
	$addTextBtn.on(&amp;#039;click&amp;#039;, function() {&lt;br /&gt;
		$inp.val(FRAME_TEST_TEXT).attr(&amp;#039;rows&amp;#039;, FRAME_TEST.length+1);&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	var $prevHistory = $(&amp;#039;&amp;lt;input class=&amp;quot;console-control console-prevHist&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;History &amp;amp;#708;&amp;quot; title=&amp;quot;Load the previous input in your console history, if any&amp;quot;&amp;gt;&amp;#039;);&lt;br /&gt;
	var $nextHistory = $(&amp;#039;&amp;lt;input class=&amp;quot;console-control console-nextHist&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;History &amp;amp;#709;&amp;quot; title=&amp;quot;Load the next in your console history, if any&amp;quot;&amp;gt;&amp;#039;);&lt;br /&gt;
	// send the appropriate keydown events to the input element&lt;br /&gt;
	// (ctrl+up / ctrl+down scrolls history)&lt;br /&gt;
	$prevHistory.on(&amp;#039;click&amp;#039;, function(){&lt;br /&gt;
		$inp.trigger({&lt;br /&gt;
		  type: &amp;#039;keydown&amp;#039;,&lt;br /&gt;
		  keyCode: 38, //UP arrow&lt;br /&gt;
		  ctrlKey: true&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
	$nextHistory.on(&amp;#039;click&amp;#039;, function(){&lt;br /&gt;
		$inp.trigger({&lt;br /&gt;
		  type: &amp;#039;keydown&amp;#039;,&lt;br /&gt;
		  keyCode: 40, //DOWN arrow&lt;br /&gt;
		  ctrlKey: true&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	var $allowEnter = $(&amp;#039;&amp;lt;input class=&amp;quot;console-control console-allowEnter&amp;quot; type=&amp;quot;checkbox&amp;quot; name=&amp;quot;console-allowEnter&amp;quot; id=&amp;quot;console-allowEnter&amp;quot;&amp;gt;&amp;#039;),&lt;br /&gt;
		$allowEnterWrapper = $(&amp;#039;&amp;lt;span title=&amp;quot;Use the Run button or Ctrl+Enter to execute your code, when checked&amp;quot;&amp;gt;&amp;#039;);&lt;br /&gt;
		$allowEnterWrapper.append($allowEnter, &amp;#039;&amp;lt;label for=&amp;quot;console-allowEnter&amp;quot;&amp;gt;Allow normal enter key&amp;lt;/label&amp;gt;&amp;#039;);&lt;br /&gt;
	&lt;br /&gt;
	// don&amp;#039;t actually need to have an event attached to this, we&amp;#039;re just gonna check is(:checked)&lt;br /&gt;
	// BUT we are adding an event to save state to localStorage&lt;br /&gt;
	$allowEnter.prop(&amp;#039;checked&amp;#039;, window.localStorage.getItem(&amp;#039;rsw-scribunto-console-allowEnter&amp;#039;) === &amp;quot;true&amp;quot;); // do this before attaching event, just to be sure we don&amp;#039;t fire it&lt;br /&gt;
	$allowEnter.on(&amp;#039;change&amp;#039;, function(){&lt;br /&gt;
		window.localStorage.setItem(&amp;#039;rsw-scribunto-console-allowEnter&amp;#039;, $allowEnter.is(&amp;#039;:checked&amp;#039;));&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	// attach this to the parent element&lt;br /&gt;
	// capture=true =&amp;gt; this runs before the innermost element&amp;#039;s event&lt;br /&gt;
	document.getElementById(&amp;#039;mw-scribunto-input&amp;#039;).parentElement.addEventListener(&amp;#039;keydown&amp;#039;, function(e){&lt;br /&gt;
		if (e.target.id !== &amp;#039;mw-scribunto-input&amp;#039;) return;&lt;br /&gt;
		if (! (e.keyCode === 13)) return; // enter&lt;br /&gt;
		if (e.ctrlKey || e.shiftKey) return;&lt;br /&gt;
		if ($allowEnter.is(&amp;#039;:checked&amp;#039;)) {&lt;br /&gt;
			e.stopImmediatePropagation();&lt;br /&gt;
			$inp.attr(&amp;#039;rows&amp;#039;, $inp.val().split(/\r?\n/).length+1);&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
	}, true);&lt;br /&gt;
	&lt;br /&gt;
	// enter runs the code&lt;br /&gt;
	// ctrl+enter runs it too, and we&amp;#039;re explicitly excluding ctrl+enter from allowEnter&lt;br /&gt;
	var $run = $(&amp;#039;&amp;lt;input class=&amp;quot;console-control console-runButton&amp;quot; type=&amp;quot;button&amp;quot; value=&amp;quot;Run&amp;quot; title=&amp;quot;Run the current input&amp;quot;&amp;gt;&amp;#039;);&lt;br /&gt;
	$run.on(&amp;#039;click&amp;#039;, function(){&lt;br /&gt;
		$inp.trigger({&lt;br /&gt;
			type: &amp;#039;keydown&amp;#039;,&lt;br /&gt;
			keyCode: 13,&lt;br /&gt;
			ctrlKey: true&lt;br /&gt;
		});&lt;br /&gt;
	});&lt;br /&gt;
	$clearBtn.parent().prepend($run).append($addTextBtn, $prevHistory, $nextHistory, $allowEnterWrapper);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
function init() {&lt;br /&gt;
	$clearBtn = $(&amp;#039;input[type=&amp;quot;button&amp;quot;][value=&amp;quot;Clear&amp;quot;]&amp;#039;);&lt;br /&gt;
	$inp = $(&amp;#039;#mw-scribunto-input&amp;#039;);&lt;br /&gt;
	if ($(&amp;#039;#mw-scribunto-output&amp;#039;).length &amp;amp;&amp;amp; $clearBtn.length &amp;amp;&amp;amp; $inp.length) {&lt;br /&gt;
		$clearBtn.addClass(&amp;#039;console-control console-clearButton&amp;#039;).attr(&amp;#039;title&amp;#039;, &amp;#039;Clear the console (no confirmation!)&amp;#039;);&lt;br /&gt;
		addButtons();&lt;br /&gt;
	} else {&lt;br /&gt;
		load_attempts++;&lt;br /&gt;
		if (load_attempts &amp;gt; 100) return;&lt;br /&gt;
		setTimeout(init, 50);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
init();&lt;/div&gt;</summary>
		<author><name>Alex</name></author>
	</entry>
</feed>