Benutzer:Loki/monobook.js: Unterschied zwischen den Versionen

Aus Shadowhelix
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(126 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 5: Zeile 5:
importScript('Benutzer:Loki/universalimpressumOverviewHighlight.js');
importScript('Benutzer:Loki/universalimpressumOverviewHighlight.js');
importScript('Benutzer:Loki/shadowtalkDisplay.js');
importScript('Benutzer:Loki/shadowtalkDisplay.js');
importScript('Benutzer:Loki/refDisplay.js');
importScript('Benutzer:Loki/vorlageUhr.js');
importScript('Benutzer:Loki/vorlageUhr.js');
importScript('Benutzer:Loki/vorlageButton.js');
importScript('Benutzer:Loki/vorlageButton.js');
importScript('Benutzer:Loki/jahresartikelSelektor.js');


function testFunktionen () {
function testFunktionen () {
Zeile 15: Zeile 15:


// addOnloadHook( testFunktionen );
// addOnloadHook( testFunktionen );
// ----------------------------------------------------------
// ----------------------------------------------------------


/* Ergänzung der Editierzeile mit zusätzlichen Buttons */
/* Ergänzung der Editierzeile mit zusätzlichen Buttons */
Zeile 37: Zeile 41:
         "imageFile": "http://shadowhelix.de/images/3/3e/Button_STD.png",
         "imageFile": "http://shadowhelix.de/images/3/3e/Button_STD.png",
         "speedTip": "Standardartikel",
         "speedTip": "Standardartikel",
         "tagOpen": '\{\{stub}}\n\{\{+quelle}}\n\'\'\'\'\'\'\n<ref></ref>\n<ref group=\"E\"></ref>\n<ref group=\"W\"></ref>\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Erläuterungen==\n<references group=\"E\"/>\n\n==Widersprüche==\n<references group=\"W\"/>\n\n==Quellenindex==\n*[[ (Quelle, englisch)| ]] \{\{+idx}}\n*[[ (Quelle)| ]] \{\{+idx}}\n*\{\{Quelle||\{\{+idx}}}}\n*[[Romane#|Roman:]] \{\{+idx}}\n*\{\{Romanquelle||\{\{+idx}}}}\n\n==Quellenangabe==\n<references/>\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n{{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
         "tagOpen": '\{\{stub}}\n\{\{+quelle}}\n\'\'\'\'\'\'\n<ref></ref>\n<ref group=\"E\"></ref>\n<ref group=\"W\"></ref>\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Erläuterungen==\n<references group=\"E\"/>\n\n==Widersprüche==\n<references group=\"W\"/>\n\n==Quellenindex==\n\{\{IdxTab\n|\n*\{\{Qde|}} \{\{+idx}}\n|\n*\{\{Qen|}} \{\{+idx}}\n}}\n\n==Quellenangabe==\n<references/>\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n{{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
         "tagClose": "",
         "tagClose": "",
         "sampleText": ""};
         "sampleText": ""};
Zeile 44: Zeile 48:
         "imageFile": "http://shadowhelix.de/images/b/ba/Button_Stub.png",
         "imageFile": "http://shadowhelix.de/images/b/ba/Button_Stub.png",
         "speedTip": "Stubartikel",
         "speedTip": "Stubartikel",
         "tagOpen": '\{\{stub}}\n\'\'\'\'\'\'\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Quellenindex==\n*\{\{Quelle||\{\{+idx}}}}\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n\{\{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
         "tagOpen": '\{\{stub}}\n\'\'\'\'\'\'\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Quellenindex==\n*\{\{Qde|}} \{\{+idx}}\n*\{\{Qen|}} \{\{+idx}}\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n\{\{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
         "tagClose": "",
         "tagClose": "",
         "sampleText": ""};
         "sampleText": ""};
Zeile 50: Zeile 54:
     mwCustomEditButtons[mwCustomEditButtons.length] = {
     mwCustomEditButtons[mwCustomEditButtons.length] = {
         "imageFile": "http://shadowhelix.de/images/8/84/Button_Redirect.png",
         "imageFile": "http://shadowhelix.de/images/8/84/Button_Redirect.png",
         "speedTip": "Redirect",
         "speedTip": "Weiterleitung",
         "tagOpen": '#REDIRECT [[',
         "tagOpen": '#WEITERLEITUNG [[',
         "tagClose": "]]",
         "tagClose": "]]",
         "sampleText": ""};
         "sampleText": ""};
Zeile 65: Zeile 69:
         "imageFile": "http://shadowhelix.de/images/8/8e/Button_Stadt.png",
         "imageFile": "http://shadowhelix.de/images/8/8e/Button_Stadt.png",
         "speedTip": "Vorlage:Stadt",
         "speedTip": "Vorlage:Stadt",
         "tagOpen": '\{\{Stadt\n|STAND=?\n|STATUS=\n|KOORD=\{\{Koord||kbs=1|zGM=|zOSM=}} \{\{KoordTransform|}}\n}}',
         "tagOpen": '\{\{Stadt\n|STAND=?\n|STATUS=\n|KOORD_DISPLAY=1\n|KOORD_LAENGE=\n|KOORD_BREITE=\n|KOORD_KBS=1\n|KOORD_ZGM=\n|POSITIONSKARTE=\n|POS_LABEL=\n}} \{\{KoordTransform|}}',
         "tagClose": "",
         "tagClose": "",
         "sampleText": ""};
         "sampleText": ""};
Zeile 72: Zeile 76:
         "imageFile": "http://shadowhelix.de/images/a/a1/Button_adhoc.png",
         "imageFile": "http://shadowhelix.de/images/a/a1/Button_adhoc.png",
         "speedTip": "adhoc",
         "speedTip": "adhoc",
         "tagOpen": '',
         "tagOpen": '\| align=\"center\" style=\"height:120px; background-color:white;\" \| \[\[\|80px\]\]',
         "tagClose": "",
         "tagClose": "",
         "sampleText": ""};
         "sampleText": ""};
Zeile 80: Zeile 84:
/***********************************************************************/
/***********************************************************************/


/* Countdown */
function testButton() {


function pause(delay) {
    var Selection = document.getElementsByClassName( "jsFunctionButton" );
var start = new Date();
while ((new Date()) - start <= delay) {}
}


function updateCountdown () {
    for ( var i = Selection.length - 1; i >= 0 ; i-- ) {


    if (( document.location.href.search('Benutzer:Loki') != -1 &&
        var input = Selection[i].id.split("_");
          document.location.href.length == '35' ) ||
        var jsFunction = input.shift();
        document.location.href.search('Vorlage:Countdown') != -1 ) {


        var Countdown = document.getElementsByTagName( "div" );
        var Button = document.createElement( "a" );


        for ( var i = 0; i < Countdown.length; i++ ) {
        var inputString = "";
        for ( var j = 0; j < input.length; j++ ) {
              inputString = inputString + "'"+input[j];
              if (j != input.length - 1) {
                  inputString = inputString + "',";
              } else {
                  inputString = inputString + "'";
              }
        }


            // div mit class="countdown" raussuchen
        Button.setAttribute( "href", "javascript:"+jsFunction+"("+inputString+")" );
            if ( hasClass( Countdown[i], "countdown" ) ) {


                // div wird geleert
//       Button.style.color = Selection[i].style.color;
                while(Countdown[i].hasChildNodes()){
//      Button.style.fontSize = Selection[i].style.fontSize;
                    Countdown[i].removeChild(Countdown[i].lastChild);
                }


                var targetTime = new Date("December 24, 2011 00:00:00");
        Button.appendChild( Selection[i].childNodes[0] );
                var currentTime = new Date ();


                var differenceTime = new Date(targetTime - currentTime);
        $(Selection[i]).replaceWith( Button );


                var Brk = document.createElement( "br" );
    }


                if (differenceTime > 0 && false) {
}
 
                    var days = (Math.floor(differenceTime/(86400*1000))).toString();
 
                    var hours = (Math.floor(differenceTime/(3600*1000)) % 24).toString();
                    if (hours < 10) {hours = "0"+hours}
 
                    var minutes = (Math.floor(differenceTime/(60*1000)) % 60).toString();
                    if (minutes < 10) {minutes = "0"+minutes}
 
                    var seconds = (Math.floor(differenceTime/1000) % 60).toString();
                    if (seconds < 10) {seconds = "0"+seconds}
 
                    var centiseconds = (Math.floor(differenceTime/10) % 100).toString();
                    if (centiseconds < 10) {centiseconds = "0"+centiseconds}
 
                    var CountdownText1 = document.createTextNode( "Countdown to the Sixth World");
                    var CountdownText2 = document.createTextNode( days+" Tage "+hours+":"+minutes+":"+seconds+":"+centiseconds );
 
                    // einfügen in div
                    Countdown[i].insertBefore( CountdownText2, Countdown[i].childNodes[0] );
                    Countdown[i].insertBefore( Brk, Countdown[i].childNodes[0] );
                    Countdown[i].insertBefore( CountdownText1, Countdown[i].childNodes[0] );
 
                    // reset der lineHeight notwendig
                    Countdown[i].style.lineHeight = "1.5em";
 
                    // nächster aufruf von updateCountdown() nach 100ms
                    setTimeout('updateCountdown();',10);
 
                } else {
 
//                    var lines = new Array('AAAAAAAA',
//                                          'BBBBBBBB',
//                                          'CCCCCCCC');


                    insertAfter( Countdown[i].lastChild, document.createTextNode('AAA') );
function toggleVisibility( targetClass, targetID ) {
//                    Countdown[i].style.fontFamily = "monospace";
//                    Countdown[i].style.lineHeight = "1em";
//                    Countdown[i].style.textAlign = "left";


//                    pause(2000);
    var objects = document.getElementsByClassName( targetClass );


//                    insertAfter( Countdown[i].childNodes[0], Brk );
    for ( var i = 0; i < objects.length; i++ ) {    
//                    insertAfter( Countdown[i].childNodes[0], document.createTextNode('BBBB') );
 
 
//                    for (var j=0; j < lines.length; j++) {
//                        var line = lines[i];
//                        for (var k=0; k < line.length; k++) {
 
//                        }
 
//                    }
 
 
                } //else
 
            }


        if (objects[i].id != targetID) {
                objects[i].style.display = 'none';
        } else {
                objects[i].style.display = '';
         }
         }
     }
     }
}
}


function insertAfter( existingNode, newFollowingNode )
// addOnloadHook( testButton );
{
    existingNode.parentNode.insertBefore( newFollowingNode, existingNode.nextSibling );
}
 
addOnloadHook( updateCountdown );

Aktuelle Version vom 19. April 2017, 18:55 Uhr

/* Skriptimport */

customHighlightFarbe = 'lightgrey';

importScript('Benutzer:Loki/universalimpressumOverviewHighlight.js');
importScript('Benutzer:Loki/shadowtalkDisplay.js');
importScript('Benutzer:Loki/refDisplay.js');
importScript('Benutzer:Loki/vorlageUhr.js');
importScript('Benutzer:Loki/vorlageButton.js');

function testFunktionen () {
    addPortletLink('p-cactions', 'javascript:alert(document.location.href)', 'URL', 'ca-last', 'url');
    addPortletLink('p-cactions', 'javascript:alert(document.location.href.length)', 'URL-Laenge', 'ca-last', 'url laenge');
}

// addOnloadHook( testFunktionen );

// ----------------------------------------------------------

// ----------------------------------------------------------

/* Ergänzung der Editierzeile mit zusätzlichen Buttons */

if (mwCustomEditButtons) {

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/b/b9/Button_E.png",
        "speedTip": "Artikelende",
        "tagOpen": "<!-- Ende des Artikelinhalts - Metainformationen -->",
        "tagClose": "",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/b/b0/Button_trash.png",
        "speedTip": "Löschantrag",
        "tagOpen": "\{\{Löschantrag||}}",
        "tagClose": "",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/3/3e/Button_STD.png",
        "speedTip": "Standardartikel",
        "tagOpen": '\{\{stub}}\n\{\{+quelle}}\n\'\'\'\'\'\'\n<ref></ref>\n<ref group=\"E\"></ref>\n<ref group=\"W\"></ref>\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Erläuterungen==\n<references group=\"E\"/>\n\n==Widersprüche==\n<references group=\"W\"/>\n\n==Quellenindex==\n\{\{IdxTab\n|\n*\{\{Qde|}} \{\{+idx}}\n|\n*\{\{Qen|}} \{\{+idx}}\n}}\n\n==Quellenangabe==\n<references/>\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n{{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
        "tagClose": "",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/b/ba/Button_Stub.png",
        "speedTip": "Stubartikel",
        "tagOpen": '\{\{stub}}\n\'\'\'\'\'\'\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Quellenindex==\n*\{\{Qde|}} \{\{+idx}}\n*\{\{Qen|}} \{\{+idx}}\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n\{\{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
        "tagClose": "",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/8/84/Button_Redirect.png",
        "speedTip": "Weiterleitung",
        "tagOpen": '#WEITERLEITUNG [[',
        "tagClose": "]]",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/9/9d/Button_Person.png",
        "speedTip": "Vorlage:Person",
        "tagOpen": '\{\{Person\n|GESCHLECHT=\n|METATYP=\n|MAGISCH=\n}}',
        "tagClose": "",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/8/8e/Button_Stadt.png",
        "speedTip": "Vorlage:Stadt",
        "tagOpen": '\{\{Stadt\n|STAND=?\n|STATUS=\n|KOORD_DISPLAY=1\n|KOORD_LAENGE=\n|KOORD_BREITE=\n|KOORD_KBS=1\n|KOORD_ZGM=\n|POSITIONSKARTE=\n|POS_LABEL=\n}} \{\{KoordTransform|}}',
        "tagClose": "",
        "sampleText": ""};

    mwCustomEditButtons[mwCustomEditButtons.length] = {
        "imageFile": "http://shadowhelix.de/images/a/a1/Button_adhoc.png",
        "speedTip": "adhoc",
        "tagOpen": '\| align=\"center\" style=\"height:120px; background-color:white;\" \| \[\[\|80px\]\]',
        "tagClose": "",
        "sampleText": ""};

}

/***********************************************************************/

function testButton() {

    var Selection = document.getElementsByClassName( "jsFunctionButton" );

    for ( var i = Selection.length - 1; i >= 0 ; i-- ) {

         var input = Selection[i].id.split("_");
         var jsFunction = input.shift();

         var Button = document.createElement( "a" );

         var inputString = "";
         for ( var j = 0; j < input.length; j++ ) {
              inputString = inputString + "'"+input[j];
              if (j != input.length - 1) {
                   inputString = inputString + "',";
              } else {
                   inputString = inputString + "'";
              }
         }

         Button.setAttribute( "href", "javascript:"+jsFunction+"("+inputString+")" );

//       Button.style.color = Selection[i].style.color;
//       Button.style.fontSize = Selection[i].style.fontSize;

         Button.appendChild( Selection[i].childNodes[0] );

         $(Selection[i]).replaceWith( Button );

    }

}

function toggleVisibility( targetClass, targetID ) {

    var objects = document.getElementsByClassName( targetClass );

    for ( var i = 0; i < objects.length; i++ ) {     

        if (objects[i].id != targetID) {
                objects[i].style.display = 'none';
        } else {
                objects[i].style.display = '';
        }
    }
}

// addOnloadHook( testButton );