Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/**
 * ToolKit v1.0
 */
function addToolKit()
{
    e = document.createElement ("input");
    e.setAttribute ("type", "button");
    e.setAttribute ("class", "oo-ui-inputWidget-input oo-ui-buttonElement-button");
    e.setAttribute ("title", "ಖಾಲಿ ಜಾಗ, ಚುಟುಕು, ಉದ್ದ ಕೊಂಡಿ, ವಿಕಿ ಲಿಂಕ್ ಮತ್ತು ಅನುಸ್ವಾರ ಬದಲಾವಣೆ");
    e.setAttribute ("value", "ಟೂಲ್ ಕಿಟ್");
    e.setAttribute ("onclick", "toolKit()");
    b = document.getElementById ('wpDiff');
    if(b)b.parentNode.insertBefore (e, b.nextSibling);
}

function toolKit()
{
    spaceEdit();  // Remove leading whitespaces
    minorEdit();  // Add ಚುಟುಕು
    knLink();     // ಕನ್ನಡ ವಿಕಿಪೀಡಿಯದ ಉದ್ದ ಕೊಂಡಿಗಳನ್ನು wiki markupಗೆ ಬದಲಾಯಿಸು
    linkEdit();   // Correct wiki links
    ZeroEdit();   // Correct ೦ (Zero) to ಂ
    summary();
}

function spaceEdit()
{
    tb = document.getElementById ("wpTextbox1");
    tb.value = tb.value.replace (/^\s*/g, "");
    tb.value = tb.value.replace (/(\n+)\s*/g, "$1");
}

function minorEdit()
{
    tb = document.getElementById ("wpTextbox1");
    if( (tb.value.length < 3000) && (null == tb.value.match("{{ಚುಟುಕು}}")) )
    {
    tb.value = "{{ಚುಟುಕು}}"+ "\n" +  tb.value + "\n[[ವರ್ಗ:ಚುಟುಕು]]";
    }
}

function knLink()
{
    tb=document.getElementById("wpTextbox1");
    tb.value=tb.value.replace(/\[\s*http:\/\/kn.wikipedia.org\/wiki\/([^\s]*) \s*(.+)\]/g,"[[$1|$2]]");
}

// ZeroEdit
function ZeroEdit()
{
    tb = document.getElementById ("wpTextbox1");
    tb.value = tb.value.replace (/([ಂ-ೣ])೦/g, "$1ಂ");
}

// LinkEdit
function linkEdit()
{
    tb = document.getElementById ("wpTextbox1");
    tb.value = tb.value.replace (/\[\[ *([^|\]]*?) *\| *\1 *\]\]/g, "[[$1]]");
    tb.value = tb.value.replace (/\[\[ *([^|\]]*?)\u0ccd *\]\]([\u0c80-\u0cff]+)/g, "[[$1\u0ccd|$1\u0ccd\u200c$2]]");
    tb.value = tb.value.replace (/\[\[ *([^|\]]*?) *\]\]([\u0c80-\u0cff]+)/g, "[[$1|$1$2]]");
}

function summary()
{
    s = document.getElementById ("wpSummary");
    if(null == s.value.match("SpaceEdit"))
    {
        s.value += "ಟೂಲ್ ಕಿಟ್ ಉಪಯೋಗಿಸಿ ಲೇಖನವನ್ನು ತಿದ್ದಲಾಗಿದೆ";
    }
}

addToolKit();
void (0);