Benutzer:J*/Javascript-Spielwüste.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
Zeile 34: Zeile 34:
 
x.style.margin = "5px";
 
x.style.margin = "5px";
 
x.style.padding = "5px";
 
x.style.padding = "5px";
x.innerHTML = ret.responseText.replace("\\~","~","g").replace("{@{page}@}",wgPageName.replace(":"," Diskussion:"),"g");
+
x.innerHTML = ret.responseText.replace("\\~","~","g").replace("{@{page}@}",wgPageName.replace(":","_Diskussion:"),"g");
 
x.style.backgroundColor = "white";
 
x.style.backgroundColor = "white";
 
x.style.border = "2px blue solid";
 
x.style.border = "2px blue solid";

Version vom 4. März 2010, 23:22 Uhr

addJS("MediaWiki:Prototype.js")
var edittoken;

addOnloadHook( function () {

h = document.getElementById('ca-history');

rate = document.createElement('li');
ratelink = document.createElement('a');
ratelink.appendChild(document.createTextNode('Bewerten'));
rate.appendChild(ratelink);
rate.onclick = openratewindow;
rate.id = "kp_rate_tab";
rate.className = "pseudolink";

h.parentNode.insertBefore(rate,h)

x = new Ajax.Request( "http://kamelopedia.mormo.org/index.php",
    {
        parameters: "title=Kamel:J*/Rate2&action=raw",
        onSuccess: function (trans) { createratewindow(trans); }
    }
);

});

function createratewindow (ret)
{
x = document.createElement("div");
x.style.position = "fixed";
x.style.left = "200px";
x.style.top = "100px";
x.style.width = "600px";
x.style.margin = "5px";
x.style.padding = "5px";
x.innerHTML = ret.responseText.replace("\\~","~","g").replace("{@{page}@}",wgPageName.replace(":","_Diskussion:"),"g");
x.style.backgroundColor = "white";
x.style.border = "2px blue solid";
x.id = "kp_rating";
x.style.display = "none";
document.getElementById("content").appendChild(x);

$("kp_rateform_hide").onclick = function () { kp_rate_abort(); };
$("kp_rateform_submit").onclick = function () { kp_rate(); };

}

function openratewindow ()
{
    document.getElementById("kp_rating").style.display = "block";
    x = new Ajax.Request( "http://kamelopedia.mormo.org/api.php", {
        method: "get",
        parameters: "action=query&prop=info&intoken=edit&titles=Hauptseite&format=json",
        onSuccess: function (trans) { x = trans.responseJSON.query.pages[7].edittoken; $("ed_token").value = x;}

    });
}

function kp_rate()
{
    document.getElementById("kp_rateform_hide").style.display = "none";
    document.getElementById("kp_rateform_submit").style.display = "none";
    document.getElementById("kp_rate_tab").style.display = "none";
    document.getElementById("kp_rateform_pleasewait").style.display = "inline";
        x = new Ajax.Request( "http://kamelopedia.mormo.org/api.php", {
        method: "post",
        parameters: document.getElementById("kp_rateform").serialize(),
        onSuccess: function (trans) {
            document.getElementById("kp_rateform_hide").style.display = "inline";
            document.getElementById("kp_rateform_hide").value = "Schließen";
            document.getElementById("kp_rateform_pleasewait").style.display = "none";
            document.getElementById("kp_rateform_done").style.display = "inline";
        }

    });
}

function kp_rate_abort()
{
    document.getElementById("kp_rating").style.display = "none";
}