MediaWiki:Gadget-spellingstyle.js

Da Wikipedia, l'ençiclopedia libara.

Ocio: Daspò ver salvà, podaria esare neçesario snetare ła cache dal propio navegadore web par vedare i canbiamenti.

  • Firefox / Safari: tegner strucà el boton de łe letare grande Shift e schiciare sora Ricarga, o se nò struca Ctrl-F5 o Ctrl-R (⌘-R so Mac)
  • Google Chrome: strucare Ctrl-Shift-R (⌘-Shift-R so on Mac)
  • Internet Explorer / Edge: tegner strucà el boton Ctrl e schiciare so Ajorna, o sinò Ctrl-F5
  • Opera: Va in tel Menu → Inpostasion (Opera → Prefarense so on Mac) e pò in Privacy & sicuresa → Sneta dati del navegadore → Imajini e file in te ła cache.
/*From: https://ang.wikipedia.org/wiki/MediaWiki:Gadget-spellingstyle.js
/*Readapted for vec.wiki:  [[Utente:Fierodelveneto]]
/* ************************************************************************************************ */

function doConv(event) {
    var $ = jQuery;
    if ($("#mw-content-text-clone").length)
        $("#mw-content-text-clone").remove();
/*  if ($("#firstHeading-clone").length)
        $("#firstHeading-clone").remove();  */
    var targetstyle = event.data.outputstyle;
    var contentClone;
/*  var contentCloneHead; */
    $("#mw-content-text").show();
    contentClone = $("#mw-content-text").clone();
    contentClone.attr("id", "mw-content-text-clone");
    convertStyle(contentClone, "Navf", targetstyle);
    convertStyle(contentClone, "Uni", targetstyle);
    convertStyle(contentClone, "Rune", targetstyle);
/*  $("#firstHeading").show();
    contentCloneHead = $("#firstHeading").clone();
    contentCloneHead.attr("id", "firstHeading-clone");
    convertStyle(contentCloneHead, "Navf", targetstyle);
    convertStyle(contentCloneHead, "Uni", targetstyle);  */
    $("#mw-content-text").hide();

/*  $("#firstHeading").hide();  */
    if (targetstyle == "Uni")
        contentClone.addClass("content-Uni");
    if (targetstyle == "Rune")
        contentClone.addClass("content-Rune");
    else
        contentClone.addClass("content-" + targetstyle);
    contentClone.insertAfter("#mw-content-text");
/*  if (targetstyle == "Uni")
        contentCloneHead.addClass("content-Uni");
    else
        contentCloneHead.addClass("content-" + targetstyle);
    contentCloneHead.insertAfter("#firstHeading");  */
    $(".click-Navf").click({"outputstyle": "Navf"}, doConv);
    $(".click-Uni").click({"outputstyle": "Uni"}, doConv);
    $(".click-Rune").click({"outputstyle": "Rune"}, doConv);
}
var Uni_to_Navf = {
    "x": "z",
    "X": "Z",
    "sion": "ssion",
    "ssion": "ssion",
    "ł": "l",
    "Ł": "L",
    "ƚ": "l",
    "ç": "c",
    "infobox": "Infobox",
    "Infobox": "infobox",
    " infobox": "infobox",
    " Infobox": "Infobox",
    " ex": " ex-",
    "extra": "extra ",
    "Extra": "Extra ",
    "extra ": "extra ",
    "Extra ": "Extra ",
    " ex-": " ex-",
    "uncò": "ancoi",
    "ancuò": "ancoi",
    "uncó": "ancoi",
    "ancó": "ancoi",
    "ancoi": "ancoi",
};
var Uni_to_Rune = {
    "uncò": "ancoi",
    "uncó": "ancoi",
    "ancó": "ancoi",
    "ancoi": "ancoi",
    "ugo ": "och ",
    "ogo ": "och ",
    "och ": "och ",
    "ago ": "ach ",
    "ach ": "ach ",
    "ç": "c",
    " i xe": " i è",
    " i xé": " i è",
    " i è": " i è",
    " łe xe": " łe è",
    " łe è": " łe è",
    " ła xé": " ła è",
    " ła xe": " ła è",
    " la xe": " ła è",
    " ła xè": " ła è",
    " ła è": " ła è",
    " el xé": " al'è",
    " el xe": " al'è",
    " al'è": " al'è",
    "ghe xe": "ghe n'è",
    "ghe xé": "ghe n'è",
    "ghè": "ghe n'è",
    "gh'è": "ghe n'è",
    "ghe n'è": "ghe n'è",
    "ato ": "at ",
    "onto ": "ont ",
    "ont ": "ont ",
    "anto ": "ant ",
    "ant ": "ant ",
    "ento ": "ent ",
    "ent ": "ent ",
    "into ": "int ",
    "int ": "int ",
    "unto ": "unt ",
    "unt ": "unt ",
    "ałe ": "al ",
    "al ": "al ",
    "iłe ": "il ",
    "il ": "il ",
    "ełe ": "el ",
    "el ": "el ",
    "eto ": "et ",
    "et ": "et ",
    "ito ": "it ",
    "it ": "it ",
    "eso ": "es ",
    "es ": "es ",
    "aso ": "as ",
    "as ": "as ",
    "eło ": "el ",
    "iso ": "is ",
    "is ": "is ",
    "exe ": "ex ",
    "exo ": "ex ",
    "axe ": "ax ",
    "axo ": "ax ",
    "ax ": "ax ",
    "ołe": "ol",
    "ol": "ol",
    "vùo ": "vesto ",
    "vuo ": "vesto ",
    "vesto ": "vesto ",
    "vua ": "vesta ",
    "vùa ": "vesta ",
    "sua ": "sesta ",
    "sùa ": "sesta ",
    "nua ": "nesta ",
    "nùa ": "nesta ",
    "esto ": "est ",
    "est ": "est ",
    "vesta ": "vesta ",
    "sesta ": "sesta ",
    "nesta ": "nesta ",
    " el ": " al ",
    " al ": " al ",
    " un ": " an ",
    " on ": " an ",
    " an ": " an ",
    " dove ": " aonde ",
    "andove": "aonde",
    "indove": "aonde",
    " aonde ": " aonde ",
    "aonde": "aonde",
    "oco ": "och ",
    "abastansa": "asè",
    "bastansa": "asè",
    " pì ": " piasè ",
    " piu ": " piasè ",
    " pi ": " piasè ",
    " più ": " piasè ",
    " piasè ": " piasè ",
    "asè": "asè",
    " femo ": " fon ",
    " fon ": " fon ",
    " faremo ": " faron ",
    " faron ": " faron ",
    " gavemo ": " gon ",
    " ghemo ": " gon ",
    " gon ": " gon ",
    " gavaremo ": " gavaron ",
    " garemo ": " garon ",
    " ndemo ": " andon ",
    " andon ": " andon ",
    " ndaremo ": " ndaron ",
    " ndaron ": " ndaron ",
    " dixemo ": " dixon ",
    " dixon ": " dixon ",
    " dixaremo ": " dixaron ",
    " dixaron ": " dixaron ",
    " te ghè ": " te à ",
    " te à ": " te à ",
    "distante": "de-ondi",
    "de-ondi": "de-ondi",
};
var myReplace = function(input, regexObj) {
    console.log(input);
    var $ = jQuery, regex = null;

    if (typeof input == "undefined") return;
    if (typeof input !== "string") {
    var node = input[0];
    if (typeof node == "undefined") node = input;
    if (!("nodeType" in node)) return node;
    if (node.nodeType == 3) {
        node.nodeValue = myReplace(node.nodeValue, regexObj);
    } else {
        if ($(node).hasClass("nochange") || node.id == "wpTextbox1") return node;
        if (!("childNodes" in node)) return node;
        for (var i = 0, len = node.childNodes.length; i < len; i++)
           myReplace($(node.childNodes[i]), regexObj);
    }
    return node;
    } else {
    for (var i in regexObj) {
        if (!regexObj.hasOwnProperty(i)) continue;

        regex = new RegExp(i, "g");
        input = input.replace(regex, regexObj[i]);
    }
    return input;
    }

}
function convertStyle(inputhtml, inputstyle, outputstyle) {
    var temp = inputhtml;
    if(typeof Navf_to_Uni === 'undefined') return inputhtml;
    if (inputstyle == outputstyle) return inputhtml;
    if (inputstyle == "Uni" && outputstyle == "Navf") {
        temp = myReplace(temp, Uni_to_Navf);
    } else if (inputstyle == "Navf" && outputstyle == "Uni") {
        temp = myReplace(temp, Navf_to_Uni);
    }
    if (inputstyle == "Uni" && outputstyle == "Rune") {
        temp = myReplace(temp, Uni_to_Rune);
    } else if (inputstyle == "Rune" && outputstyle == "Uni") {
        temp = myReplace(temp, Rune_to_Uni);
    }
    
    return temp;
    }
$(function() {
    $ = jQuery;
    $("#mw-content-text").prepend($("<div class=\"center\"><span class=\"nochange\"><small> Lexi el testo in: <a href=\"javascript:void(0);\" class=\"click-Navf\">Vèneto do Brasil</a> · <a href=\"javascript:void(0);\" class=\"click-Rune\">Vèneto Bełumat</a> · <a href=\"javascript:void(0);\" class=\"click-Uni\">Orixenałe</a> </span> </div>"));
    $(".click-Uni").click({"outputstyle": "Uni"}, doConv);
    $(".click-Navf").click({"outputstyle": "Navf"}, doConv);
    $(".click-Rune").click({"outputstyle": "Rune"}, doConv);
});
Traesto fora da Wikipèdia - L'ençiclopedia łìbara e cołaboradiva in łéngua Vèneta "https://vec.wikipedia.org/w/index.php?title=MediaWiki:Gadget-spellingstyle.js&oldid=961038"