<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>https://luanti.nashitut.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%3AVa%2FRETF.js</id>
	<title>Участник:Va/RETF.js - История изменений</title>
	<link rel="self" type="application/atom+xml" href="https://luanti.nashitut.ru/index.php?action=history&amp;feed=atom&amp;title=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA%3AVa%2FRETF.js"/>
	<link rel="alternate" type="text/html" href="https://luanti.nashitut.ru/index.php?title=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA:Va/RETF.js&amp;action=history"/>
	<updated>2026-09-12T08:43:38Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://luanti.nashitut.ru/index.php?title=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA:Va/RETF.js&amp;diff=27716&amp;oldid=prev</id>
		<title>Va: Новая страница: «/** https://en.wikipedia.org/w/index.php?title=User:Joeytje50/RETF.js&amp;action=raw&amp;ctype=text/javascript  */ // &lt;nowiki&gt; //This script functions as a small tool that makes it easy to perform typo fixes on any text using JavaScript. /**&lt;nowiki&gt;  * Usage: See User:Joeytje50/RETF.  importScript(&#039;User:Joeytje50/RETF.js&#039;); //backlink: User:Joeytje50/RETF.js RETF.replace(text);   * This will perform all of the replacement rules on the Project:AutoWikiBrowser...»</title>
		<link rel="alternate" type="text/html" href="https://luanti.nashitut.ru/index.php?title=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA:Va/RETF.js&amp;diff=27716&amp;oldid=prev"/>
		<updated>2025-02-07T16:57:05Z</updated>

		<summary type="html">&lt;p&gt;Новая страница: «&lt;span class=&quot;autocomment&quot;&gt;* https://en.wikipedia.org/w/index.php?title=User:Joeytje50/RETF.js&amp;amp;action=raw&amp;amp;ctype=text/javascript: &lt;/span&gt; // &amp;lt;nowiki&amp;gt; //This script functions as a small tool that makes it easy to perform typo fixes on any text using JavaScript. /**&amp;lt;nowiki&amp;gt;  * Usage: See &lt;a href=&quot;/index.php?title=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA:Joeytje50/RETF&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Участник:Joeytje50/RETF (страница не существует)&quot;&gt;User:Joeytje50/RETF&lt;/a&gt;.  importScript(&amp;#039;User:Joeytje50/RETF.js&amp;#039;); //backlink: &lt;a href=&quot;/index.php?title=%D0%A3%D1%87%D0%B0%D1%81%D1%82%D0%BD%D0%B8%D0%BA:Joeytje50/RETF.js&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Участник:Joeytje50/RETF.js (страница не существует)&quot;&gt;User:Joeytje50/RETF.js&lt;/a&gt; RETF.replace(text);   * This will perform all of the replacement rules on the Project:AutoWikiBrowser...»&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;/** https://en.wikipedia.org/w/index.php?title=User:Joeytje50/RETF.js&amp;amp;action=raw&amp;amp;ctype=text/javascript&lt;br /&gt;
 */&lt;br /&gt;
// &amp;lt;nowiki&amp;gt;&lt;br /&gt;
//This script functions as a small tool that makes it easy to perform typo fixes on any text using JavaScript.&lt;br /&gt;
/**&amp;lt;nowiki&amp;gt;&lt;br /&gt;
 * Usage: See [[User:Joeytje50/RETF]].&lt;br /&gt;
&lt;br /&gt;
importScript(&amp;#039;User:Joeytje50/RETF.js&amp;#039;); //backlink: [[User:Joeytje50/RETF.js]]&lt;br /&gt;
RETF.replace(text);&lt;br /&gt;
&lt;br /&gt;
 * This will perform all of the replacement rules on the Project:AutoWikiBrowser/Typos page on wiki it&amp;#039;s run from&lt;br /&gt;
 * on the entered piece of text via the first argument.&lt;br /&gt;
 * To reload the typo list, simply run the following:&lt;br /&gt;
&lt;br /&gt;
RETF.load();&lt;br /&gt;
&lt;br /&gt;
 * @licence&lt;br /&gt;
 * This program is free software; you can redistribute it and/or modify&lt;br /&gt;
 * it under the terms of the GNU General Public License as published by&lt;br /&gt;
 * the Free Software Foundation; either version 2 of the License, or&lt;br /&gt;
 * (at your option) any later version.&lt;br /&gt;
 *&lt;br /&gt;
 * This program is distributed in the hope that it will be useful,&lt;br /&gt;
 * but WITHOUT ANY WARRANTY; without even the implied warranty of&lt;br /&gt;
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the&lt;br /&gt;
 * GNU General Public License for more details.&lt;br /&gt;
 *&lt;br /&gt;
 * You should have received a copy of the GNU General Public License along&lt;br /&gt;
 * with this program; if not, write to the Free Software Foundation, Inc.,&lt;br /&gt;
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.&lt;br /&gt;
 * http://www.gnu.org/copyleft/gpl.html&lt;br /&gt;
 * @version 2.0.0&lt;br /&gt;
 * @author Joeytje50&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
window.RETF = {}; //making a main object to store everything else&lt;br /&gt;
RETF.list = [];&lt;br /&gt;
&lt;br /&gt;
RETF.buildList = function(response) {&lt;br /&gt;
	if (response.query &amp;amp;&amp;amp; response.query.pageids[0] === &amp;#039;-1&amp;#039;) return; //abort if typos page doesn&amp;#039;t exist.&lt;br /&gt;
    var page = response.query.pages[response.query.pageids[0]];&lt;br /&gt;
    var cont = page.revisions[0][&amp;#039;*&amp;#039;];&lt;br /&gt;
	//make sure the string starts with a &amp;lt; by putting &amp;lt;typos&amp;gt;&amp;lt;/typos&amp;gt; around.&lt;br /&gt;
	var $typolists = $(&amp;#039;&amp;lt;typos&amp;gt;&amp;#039;+cont+&amp;#039;&amp;lt;/typos&amp;gt;&amp;#039;).find(&amp;#039;Typo:not([disabled])&amp;#039;).each(function() {&lt;br /&gt;
		if ($(this).attr(&amp;#039;src&amp;#039;) !== undefined) {&lt;br /&gt;
			// Allow &amp;#039;importing&amp;#039; of external typo fixing rules. Format for the URL needs to be exactly like:&lt;br /&gt;
			// https://en.wikipedia.org/w/api.php?action=query&amp;amp;format=json&amp;amp;prop=revisions&amp;amp;rvprop=content&amp;amp;rvlimit=1&amp;amp;indexpageids=true&amp;amp;origin=*&amp;amp;titles=Project%3AAutoWikiBrowser%2FTypos&lt;br /&gt;
			// (changes to the base API url and changes to the page name being allowed); origin=* is important to allow CORS requests.&lt;br /&gt;
			$.get($(this).attr(&amp;#039;src&amp;#039;), RETF.buildList);&lt;br /&gt;
		} else {&lt;br /&gt;
			try {&lt;br /&gt;
				new RegExp($(this).attr(&amp;#039;find&amp;#039;)); // will throw a SyntaxError in browsers not supporting lookbehinds&lt;br /&gt;
				RETF.list.push([$(this).attr(&amp;#039;find&amp;#039;), $(this).attr(&amp;#039;replace&amp;#039;), $(this).attr(&amp;#039;word&amp;#039;)]); //store all typofixes in one big array&lt;br /&gt;
			} catch(e) {&lt;br /&gt;
				// skip rule if it contains lookbehinds.&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	});&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
RETF.load = function() {&lt;br /&gt;
	RETF.list = []; //reset list, in case this is a list refresh.&lt;br /&gt;
	(new mw.Api()).get({&lt;br /&gt;
		action: &amp;#039;query&amp;#039;,&lt;br /&gt;
		prop: &amp;#039;revisions&amp;#039;,&lt;br /&gt;
        titles: &amp;#039;Project:AutoWikiBrowser/Typos&amp;#039;,&lt;br /&gt;
        rvprop: &amp;#039;content&amp;#039;,&lt;br /&gt;
        rvlimit: &amp;#039;1&amp;#039;,&lt;br /&gt;
        indexpageids: true,&lt;br /&gt;
		format: &amp;#039;json&amp;#039;,&lt;br /&gt;
	}).done(RETF.buildList);&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
RETF.replace = function(text) {&lt;br /&gt;
	var rulesList = [];&lt;br /&gt;
	var replaceText = function(match, g1) {&lt;br /&gt;
		//don&amp;#039;t perform replaces when one of the excluded things has been matched (indicated by group 1 not being matched).&lt;br /&gt;
		if (!g1) return match;&lt;br /&gt;
		rulesList.push(RETF.list[i][2]);&lt;br /&gt;
		return g1.replace(new RegExp(RETF.list[i][0], &amp;#039;g&amp;#039;), RETF.list[i][1]);&lt;br /&gt;
	};&lt;br /&gt;
	for (var i=0;i&amp;lt;RETF.list.length;i++) {&lt;br /&gt;
		//checks if the rule matches any wikilink targets.&lt;br /&gt;
		var wikiLinkTarget = new RegExp(&amp;#039;\\[\\[[^\\|\\]]*&amp;#039; + RETF.list[i][0] + &amp;#039;[^\\|\\]]*(\\||\\]\\])&amp;#039;);&lt;br /&gt;
		if (wikiLinkTarget.test(text)) {&lt;br /&gt;
			continue; //ignore this rule&lt;br /&gt;
		}&lt;br /&gt;
		//Regex based on http://stackoverflow.com/a/23589204/1256925.&lt;br /&gt;
		//Rules to skip based on https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos#AutoWikiBrowser_.28AWB.29&lt;br /&gt;
		//Rules are: File:links | templates | &amp;quot;quotes&amp;quot; | text after : or * &lt;br /&gt;
		var exclude = new RegExp(&amp;#039;\\[\\[File:[^\\|\\]]+\\|?|{{.+?}}|&amp;quot;[^&amp;quot;]+&amp;quot;|[:\\*].*|(&amp;#039;+RETF.list[i][0]+&amp;#039;)&amp;#039;, &amp;#039;ig&amp;#039;);&lt;br /&gt;
		text = text.replace(exclude, replaceText);&lt;br /&gt;
	}&lt;br /&gt;
	console.log(&amp;#039;RegEx Typo Fixing: Found rules &amp;#039; + rulesList.join(&amp;#039;, &amp;#039;));&lt;br /&gt;
	return text;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
RETF.load();&lt;br /&gt;
// &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Va</name></author>
	</entry>
</feed>