User:Chomtana/global.js

importArticles({   type: "script",    articles: [        'User:Chomtana/AdvanceEditor.js'        //'w:c:dev:HTMLNoLimit/code.js'    ] });

importScriptPage('PurgeButton/code.js', 'dev');

(function ($, mw) {   'use strict';

console.log("Chomtana Private Init Script Executed"); console.log(encodeURIComponent( mw.config.get( 'wgPageName' ) ));

$("textarea").keydown(function (e) {   var keyCode = e.keyCode || e.which;    if (keyCode == 9) {        e.preventDefault;        var start = $(this).get(0).selectionStart;        var end = $(this).get(0).selectionEnd;        var text = $(this).val.substring(start, end).split("\n"); //selection text        var linenum = text.length;        for(var i = 0;i<text.length;i++) {            text[i] = "\t"+text[i];        }        text = text.join("\n");        console.log(text);        // set textarea value to: text before caret + tab + text after caret

$(this).val($(this).val.substring(0, start)                   + text                    + $(this).val.substring(end)); // put caret at right position again $(this).get(0).selectionStart = start + 1; $(this).get(0).selectionEnd = end + linenum; } }); }(jQuery, mediaWiki));

/*(function ($, mw) {	$('.html').each(function(index) { $(this).html(); $(this).append($(this).attr("data-html")); }); }(jQuery, mediaWiki));*/