Difference between revisions 238172 and 238837 on ptwikibooks/** * TemplateScript * Adds a menu of configurable templates and scripts to the sidebar * @author: [[m:user:Pathoschild]] ([[meta:User:Pathoschild/Scripts/TemplateScript]]) * @author: [[User:Helder.wiki]] (this configuration file) * @tracking: [[Special:GlobalUsage/User:Helder.wiki/Tools/TemplateScript.js]] ([[File:User:Helder.wiki/Tools/TemplateScript.js]]) */ /*global jQuery, mediaWiki, LanguageConverter, pathoschild */ /*jslint browser: true, white: true, devel: true, regexp: true, continue: true, plusplus: true, todo: true */ ( function ( mw, $ ) { 'use strict'; var bookName = mw.config.get( 'wgPageName' ).replace(/_/g,' '), // Maiúsculas e minúsculas usadas em português LETRA = 'A-Za-zÁÀÂÃÇÉÊÍÓÒÔÕÚáàâãçéêíóòôõú', dictionaries = 'Wikisource:Modernização/Dicionário/pt-PT|Wikisource:Modernização/Dicionário/pt-BR', oldText = null, list = []; function showDiff(){ var $button = $('#wpDiffLive'); // FIXME: Only do a diff if the text was changed // Maybe use bit operators: MINOR & DIFF & SAVE & ... if($button.length){ $button = $('#wpDiff'); } $button.click(); }⏎ ⏎ function regex(context, regexList, summary, pos ) { var text = context.$target.val(), i, l, rule; for( i = 0, l = regexList.length; i < l; i++ ) { rule = regexList[i]; text = text.replace( rule.find, rule.replace ); } if (text !== oldText) { pos = pos || 'after'; (contracted; show full) reOldSign = /\[\[(([^:]+:)?[^:]+:)?Us(er|uário):Heldergeovane\|('''|[)?Helder('''|])?(geovane)?\]\](\s*\(\[\[(Usuário Discussão|User talk):Heldergeovane\|.+?\]\]\))?/gi; newSign = '[[' + proj + lang + 'User:Helder.wiki|Helder]]'; regex( context, [{ find: reOldSign, replace: newSign }], 'Fixing links (my user account was renamed)' ); // FIXME: Only do a diff if the text was changed // Maybe use bit operators: MINOR & DIFF & SAVE & ... $('#wpDiff').clickshowDiff(); } function createAutoNav( context ){ var list = context.$target.val().split('\n'), previous = [], next = [], i; (contracted; show full) }); regex( context, list, 'Correção de OCR' + ( totalAnchorsBefore < context.$target.val().split( '{{âncora' ).length ? '; Adição de {{âncora}}' : '' ) ); // FIXME: Only do a diff if the text was changed // Maybe use bit operators: MINOR & DIFF & SAVE & ... $('#wpshowDiff').click(); } /** Latex2wiki ** * Este script é uma adaptação para javascript feita por [[User:Helder.wiki]]: * (1) Do código de Marc Poulhiès <[email protected]>, que era baseado na * ideia original de Maxime Biais <[email protected]>; (contracted; show full) fixMath(c); usingRegex(c); formatHeadings(c); break; default: } // FIXME: Only do a diff if the text was changed // Maybe use bit operators: MINOR & DIFF & SAVE & ... $('#wpDiff').clickshowDiff(); } function loadMyRegexTools(){ pathoschild.TemplateScript.AddWith({ forActions: 'edit' },[{ name: '[Editar]', (contracted; show full) script: usingRegex }); } } $.getScript( '//meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/TemplateScript/dev.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400', loadMyRegexTools ); }( mediaWiki, jQuery ) ); All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://pt.wikibooks.org/w/index.php?diff=prev&oldid=238837.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|