Benutzer:J*/vector.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
Müsste es nicht so sein?
Markierung: WK: interner Datei-Hotlink
KKeine Bearbeitungszusammenfassung
 
(16 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
/* für's Bürokratenspiel */
/* für's Bürokratenspiel */
function bksp ()
/*function bksp ()
{
{
if (wgPageName.indexOf("Projekt:Bürokratenspiel") != -1 )
if (wgPageName.indexOf("Projekt:Bürokratenspiel") != -1 )
Zeile 9: Zeile 9:
}
}
}
}
addOnloadHook(bksp);
addOnloadHook(bksp);*/


/* Zusammenfassungs-Warnung */
/* Zusammenfassungs-Warnung */
Zeile 55: Zeile 55:
}
}


/* Bt-extras-bibliothek */
function bt_extras_load () {


/* Empfehlungs-Dings */
        console.log("Hallo");
 
/* --- prepare --- */
 
/* dbcheat */
 
if (window.bt_extra_dbcheat == null)
window.bt_extra_dbcheat = false;
 
/* --- add ui --- */
 
jQuery("#buschtrommel-eingabe .options").append("<br/>")
jQuery("#buschtrommel-eingabe .options").append("<span id='bt-extra-dbcheat'>Drumbot austricksen: </span><span id='bt-extra-show-dbcheat'>ein</span> ")
jQuery("#buschtrommel-eingabe .options").append("&nbsp;&nbsp; ")
jQuery("#buschtrommel-eingabe .options").append("<span id='bt-extra-jaja'>Jaja-ich-habs-gesehen</span>")
 
/* --- add functionality --- */
 
/* jaja */
 
jQuery("#bt-extra-jaja").click( function () {
document.title = "–⚑–";
})
 
 
/* dbcheat */
 
var toggleDBCheat = function () {
window.bt_extra_dbcheat = ! window.bt_extra_dbcheat;
jQuery("#bt-extra-show-dbcheat").text(window.bt_extra_dbcheat ?"ein":"aus");
}
 
// init
window.bt_extra_dbcheat = (! window.bt_extra_dbcheat);
toggleDBCheat();
 
jQuery("#bt-extra-dbcheat").click(toggleDBCheat);
 
jQuery("#buschtrommel-form").submit( function() {
if (!window.bt_extra_cheatDrumbot)
return true;
 
var bti = jQuery("#buschtrommel-input")[0];
bti.value = bti.value.replace("o","ο");
return true;
});


var gagapages = new Array ("", "File", "Projekt"); // hierhin die Namensräume, die zur Wahl stehen (Achtung! canonical namespaces!)
// Daumen neben "Versionen/Autoren" reinflanschen (noch suboptimal - sieht etwas beknackt aus)
function createThumb() {
  jQuery('#p-views ul').append('<li id="ca-gaga"><span><a href="javascript:GaGA();" title="Seite empfehlen">'
        + '<img src="http://kamelopedia.mormo.org/images/2/27/Daumen_hoch.png" />'
        + '</a></span></li>');
}
}
 
// Aktuellen Artikel in die Liste Schreiben
//jQuery("body.mw-special-Buschtrommel").load(bt_extras_load);
function GaGA(){
window.setTimeout(bt_extras_load,"3000");
  jQuery.ajaxSetup({ cache: false });
  jQuery.get(wgScript, { title: "Kamel:" + wgUserName + "/Empfehlung", action: "raw" },
    function(data){
      gaga = data.match(/\[\[.*\]\]/g);
      if(wgCanonicalNamespace == "File") {
        gaga.push("[[:" + wgPageName.replace(/_/g, ' ') + "]]"); // Bild hinzufügen
      } else {
        gaga.push("[[" + wgPageName.replace(/_/g, ' ') + "]]"); // Artikel hinzufügen
      }
      k = new Array();
      // doppelte Einträge entfernen + alphabetisch sortieren (Funktioniert nicht mehr richtig, dafür der andere bug jetzt weg)
      for(var i=0; i<gaga.length; i++){
        for(var j=i+1; j<gaga.length; j++){
          if (gaga[i] == gaga[j]) j = ++i;
        }
        k.push(gaga[i]);       
      }
      gaga = k.sort();
      // edit-Token holen
      jQuery.get('/api.php', { action: "query", prop: "info", intoken: "edit", titles: "Kamel:" + wgUserName + "/Empfehlung", format: "xml" },
        function(data){
          edittoken = data.getElementsByTagName('page')[0].getAttribute('edittoken');
          // API aufrufen und gaga in die Empfehlungsliste schreiben
          jQuery.post("/api.php", { action: "edit", title: "Kamel:" + wgUserName + "/Empfehlung", text: "* " + gaga.join("\n* "), summary: "+ [[" + wgPageName.replace(/_/g, ' ') + "]]", token: edittoken },
            function(data){
              alert(wgPageName.replace(/_/g, ' ') + ' wurde eingetragen');
            }
          );
        }, "xml"
      );
    }
  );
};
// Das ganze starten
addOnloadHook(function() {
  if(jQuery.inArray(wgCanonicalNamespace, gagapages ) != -1) {
    createThumb();
  }
})

Aktuelle Version vom 22. Mai 2015, 06:50 Uhr

/* für's Bürokratenspiel */
/*function bksp ()
{
	if (wgPageName.indexOf("Projekt:Bürokratenspiel") != -1 )
	{
		var t = wgTitle.split("/");
		var e = (wgAction = "edit") ? "$ " : "";
		document.title = t[t.length-1];
	}
}
addOnloadHook(bksp);*/

/* Zusammenfassungs-Warnung */

addOnloadHook( function () {
	jQuery("#wpSummary, #wpTextbox1").bind("keypress", function() {
		jQuery("#wpSummary").css("background-color","#ffffff");
		try {
			clearInterval(summaryWarnInterval);
			summaryWarnInterval = null;
		}
		catch (e) {}
		summaryWarnState = -1;
	});

	jQuery("#editform").bind("submit", function (e) {

		if ( e.originalEvent.explicitOriginalTarget != jQuery("#wpSave")[0] )
			return true;

		if (! jQuery("#wpSummary").val().replace(/^\s+/,"").replace(/\s+$/,"").replace(/\/\*.*?\*\//,"") && summaryWarnState == -1)
		{
                        jQuery("#wpSummary").focus();
			summaryWarnInterval = window.setInterval(summaryWarn,70);
			return false;
		}

		return true;
	});
});

summaryWarnState = -1;
summaryWarnInterval = null;

function summaryWarn() 
{
	summaryWarnState ++;
	if (summaryWarnState % 2 == 0)
		jQuery("#wpSummary").css("background-color","#ffff99");
	else
		jQuery("#wpSummary").css("background-color","#ffffff");

	if (summaryWarnState > 11)
		clearInterval(summaryWarnInterval);
}

/* Bt-extras-bibliothek */
function bt_extras_load () {

        console.log("Hallo");

	/* --- prepare --- */

	/* dbcheat */

	if (window.bt_extra_dbcheat == null)
		window.bt_extra_dbcheat = false;

	/* --- add ui --- */

	jQuery("#buschtrommel-eingabe .options").append("<br/>")
	jQuery("#buschtrommel-eingabe .options").append("<span id='bt-extra-dbcheat'>Drumbot austricksen: </span><span id='bt-extra-show-dbcheat'>ein</span> ")
	jQuery("#buschtrommel-eingabe .options").append("&nbsp;&nbsp; ")
	jQuery("#buschtrommel-eingabe .options").append("<span id='bt-extra-jaja'>Jaja-ich-habs-gesehen</span>")

	/* --- add functionality --- */

	/* jaja */

	jQuery("#bt-extra-jaja").click( function () {
		document.title = "–⚑–";
		})


	/* dbcheat */

	var toggleDBCheat = function () {
	window.bt_extra_dbcheat = ! window.bt_extra_dbcheat;
	jQuery("#bt-extra-show-dbcheat").text(window.bt_extra_dbcheat ?"ein":"aus");
	}

	// init
	window.bt_extra_dbcheat = (! window.bt_extra_dbcheat);
	toggleDBCheat();

	jQuery("#bt-extra-dbcheat").click(toggleDBCheat);

	jQuery("#buschtrommel-form").submit( function() {
		if (!window.bt_extra_cheatDrumbot)
			return true;

		var bti = jQuery("#buschtrommel-input")[0];
		bti.value = bti.value.replace("o","ο");
		return true;
	});

}

//jQuery("body.mw-special-Buschtrommel").load(bt_extras_load);
window.setTimeout(bt_extras_load,"3000");