Benutzer:J*/vector.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
J* (Diskussion | Beiträge) (+fiese Regexp) |
J* (Diskussion | Beiträge) |
||
Zeile 53: | Zeile 53: | ||
if (summaryWarnState > 11) | if (summaryWarnState > 11) | ||
clearInterval(summaryWarnInterval); | clearInterval(summaryWarnInterval); | ||
+ | } | ||
+ | |||
+ | |||
+ | /* Zeug für die Buschtrommel */ | ||
+ | function serializeKamelBox() | ||
+ | { | ||
+ | function _serialize(num,o) | ||
+ | { | ||
+ | var $o = jQuery(o); | ||
+ | |||
+ | if( $o[0].tagName == null) | ||
+ | { | ||
+ | return $o[0].textContent; | ||
+ | } | ||
+ | |||
+ | |||
+ | var $list = $o.contents() | ||
+ | |||
+ | var inner = []; | ||
+ | |||
+ | for (var i=0; i<$list.length; i++) | ||
+ | { | ||
+ | inner.push(_serialize(i,$list[i])); | ||
+ | } | ||
+ | |||
+ | switch( $o.css("display") ) | ||
+ | { | ||
+ | case "block": | ||
+ | return inner.join("")+"\n" | ||
+ | break; | ||
+ | |||
+ | case "table-row": | ||
+ | return inner.join("")+"//\n" | ||
+ | break; | ||
+ | |||
+ | case "table-cell": | ||
+ | return inner.join("")+"|" | ||
+ | break; | ||
+ | |||
+ | case "inline": | ||
+ | switch ($o[0].tagName) | ||
+ | { | ||
+ | case "I": | ||
+ | return "''"+inner.join("")+"''"; | ||
+ | break; | ||
+ | |||
+ | case "B": | ||
+ | return "'''"+inner.join("")+"'''"; | ||
+ | |||
+ | default: | ||
+ | return inner.join(""); | ||
+ | } | ||
+ | break; | ||
+ | |||
+ | default: | ||
+ | return inner.join("") | ||
+ | break; | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | return _serialize(0,"#buschtrommel-list") | ||
} | } |
Version vom 10. Dezember 2010, 13:41 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);
}
/* Zeug für die Buschtrommel */
function serializeKamelBox()
{
function _serialize(num,o)
{
var $o = jQuery(o);
if( $o[0].tagName == null)
{
return $o[0].textContent;
}
var $list = $o.contents()
var inner = [];
for (var i=0; i<$list.length; i++)
{
inner.push(_serialize(i,$list[i]));
}
switch( $o.css("display") )
{
case "block":
return inner.join("")+"\n"
break;
case "table-row":
return inner.join("")+"//\n"
break;
case "table-cell":
return inner.join("")+"|"
break;
case "inline":
switch ($o[0].tagName)
{
case "I":
return "''"+inner.join("")+"''";
break;
case "B":
return "'''"+inner.join("")+"'''";
default:
return inner.join("");
}
break;
default:
return inner.join("")
break;
}
}
return _serialize(0,"#buschtrommel-list")
}