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

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
(jedes mal vergess ichs)
Zeile 2: Zeile 2:
 
function bksp ()
 
function bksp ()
 
{
 
{
    if (wgPageName.indexOf("Projekt:Bürokratenspiel") != -1 )
+
if (wgPageName.indexOf("Projekt:Bürokratenspiel") != -1 )
    {
+
{
        var t = wgTitle.split("/");
+
var t = wgTitle.split("/");
        var e = (wgAction = "edit") ? "$ " : "";
+
var e = (wgAction = "edit") ? "$ " : "";
        document.title = t[t.length-1];
+
document.title = t[t.length-1];
    }
+
}
 
}
 
}
 
addOnloadHook(bksp);
 
addOnloadHook(bksp);
Zeile 13: Zeile 13:
 
/* Zusammenfassungs-Warnung */
 
/* Zusammenfassungs-Warnung */
  
jQuery("#wpSummary, #wpTextbox1").bind("keypress", function() {
+
addOnloadHook( function () {
    jQuery("#wpSummary").css("background-color","#ffffff");
+
jQuery("#wpSummary, #wpTextbox1").bind("keypress", function() {
    try {
+
jQuery("#wpSummary").css("background-color","#ffffff");
        clearInterval(summaryWarnInterval);
+
try {
        summaryWarnInterval = null;
+
clearInterval(summaryWarnInterval);
    }
+
summaryWarnInterval = null;
    catch (e) {}
+
}
    summaryWarnState = -1;
+
catch (e) {}
});
+
summaryWarnState = -1;
 +
});
 +
 
 +
jQuery("#editform").bind("submit", function (e) {
  
jQuery("#editform").bind("submit", function (e) {
+
if ( e.originalEvent.explicitOriginalTarget != jQuery("#wpSave")[0] )
 +
return true;
  
    if ( e.originalEvent.explicitOriginalTarget != jQuery("#wpSave")[0] )
+
if (! jQuery("#wpSummary").val().replace(/^\s+/,"").replace(/\s+$/,"") && summaryWarnState == -1)
        return true;
+
{
 +
summaryWarnInterval = window.setInterval(summaryWarn,70);
 +
return false;
 +
}
  
    if (! jQuery("#wpSummary").val().replace(/^\s+/,"").replace(/\s+$/,"") && summaryWarnState == -1)
+
return true;
    {
+
});
        summaryWarnInterval = window.setInterval(summaryWarn,70);
 
        return false;
 
    }
 
    return true;
 
 
});
 
});
  
Zeile 41: Zeile 44:
 
function summaryWarn()  
 
function summaryWarn()  
 
{
 
{
    summaryWarnState ++;
+
summaryWarnState ++;
    if (summaryWarnState % 2 == 0)
+
if (summaryWarnState % 2 == 0)
        jQuery("#wpSummary").css("background-color","#ff9999");
+
jQuery("#wpSummary").css("background-color","#ff9999");
    else
+
else
        jQuery("#wpSummary").css("background-color","#ffffff");
+
jQuery("#wpSummary").css("background-color","#ffffff");
  
    if (summaryWarnState > 11)
+
if (summaryWarnState > 11)
        clearInterval(summaryWarnInterval);
+
clearInterval(summaryWarnInterval);
 
}
 
}

Version vom 7. Dezember 2010, 14:24 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+$/,"") && summaryWarnState == -1)
		{
			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","#ff9999");
	else
		jQuery("#wpSummary").css("background-color","#ffffff");

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