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' ) )); }(jQuery, mediaWiki));

//Section:AdvanceEditor (function ($, mw) {   var action = mw.config.get("wgAction");    console.log("Action: "+action);

if (action == "edit") { var interval = setInterval(function { //check until found            if ($("#cke_21").length) {                console.log("run");                $("#cke_21").click(function  { enabletextareatab; console.log("ok"); });               clearInterval(interval);            }        },1000); }   console.log("AdvanceEditor loaded"); function enabletextareatab(selector) { if(!selector) {selector = 'textarea';} $("textarea").css("-moz-tab-size",'4'); $("textarea").css("-o-tab-size",'4'); $("textarea").css("tab-size",'4'); $(selector).bind('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 linecount = text.length;                for(var i = 0;i<text.length;i++) {                    text[i] = "\t"+text[i];                }                text = text.join("\n");                console.log(text);                $(this).val($(this).val.substring(0, start) //before selection + text //selection + $(this).val.substring(end)); //after selection               // put caret at right position again                $(this).get(0).selectionStart = start;                $(this).get(0).selectionEnd = end + linecount;            }        }); } }(jQuery, mediaWiki));

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