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

Aus Shadowhelix
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(28 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 3: Zeile 3:
customHighlightFarbe = 'lightgrey';
customHighlightFarbe = 'lightgrey';


// importScript('Benutzer:Loki/universalimpressumOverviewHighlight.js');
// mw.loader.load('Benutzer:Loki/universalimpressumOverviewHighlight.js');
importScript('Benutzer:Loki/refDisplay.js');
mw.loader.load('Benutzer:Loki/refDisplay.js');
importScript('Benutzer:Loki/vorlageUhr.js');
mw.loader.load('Benutzer:Loki/vorlageUhr.js');
importScript('Benutzer:Loki/vorlageButton.js');
mw.loader.load('Benutzer:Loki/vorlageButton.js');


function testFunktionen () {
function testFunktionen () {
     addPortletLink('p-cactions', 'javascript:alert(document.location.href)', 'URL', 'ca-last', 'url');
     mw.util.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');
     mw.util.addPortletLink('p-cactions', 'javascript:alert(document.location.href.length)', 'URL-Laenge', 'ca-last', 'url laenge');
}
}


// addOnloadHook( testFunktionen );
// $( testFunktionen );


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


// ----------------------------------------------------------
if ( mw.toolbar ) {
 
     mw.toolbar.addButton( {
/* Ergänzung der Editierzeile mit zusätzlichen Buttons */
         imageFile: 'http://shadowhelix.de/images/b/b9/Button_E.png',
 
         speedTip: 'Artikelende',
if (mwCustomEditButtons) {
         tagOpen: '<!-- Ende des Artikelinhalts - Metainformationen -->',
 
         tagClose: '',
     mwCustomEditButtons[mwCustomEditButtons.length] = {
         sampleText: ''
         "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] = {
     mw.toolbar.addButton( {
         "imageFile": "http://shadowhelix.de/images/3/3e/Button_STD.png",
         imageFile: 'http://shadowhelix.de/images/b/b0/Button_trash.png',
         "speedTip": "Standardartikel",
         speedTip: 'Löschantrag',
         "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==Endnoten==\n\n===Quellenangabe===\n<references/>\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*[[Romane#|Roman:]] \{\{+idx}}\n*\{\{Romanquelle||\{\{+idx}}}}\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n{{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
         tagOpen: '\{\{Löschantrag||}}',
         "tagClose": "",
         tagClose: '',
         "sampleText": ""};
         sampleText: ''
    } );


     mwCustomEditButtons[mwCustomEditButtons.length] = {
     mw.toolbar.addButton( {
         "imageFile": "http://shadowhelix.de/images/b/ba/Button_Stub.png",
         imageFile: 'http://shadowhelix.de/images/3/3e/Button_STD.png',
         "speedTip": "Stubartikel",
         speedTip: 'Standardartikel',
         "tagOpen": '\{\{stub}}\n\'\'\'\'\'\'\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Quellenindex==\n\{\{IdxTab\n|\n*\{\{Qde|}} \{\{+idx}}\n|\n*\{\{Qen|}} \{\{+idx}}\n}}\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==Endnoten==\n\n===Quellenangabe===\n<references/>\n\n===Erläuterungen===\n<references group=\"E\"/>\n\n===Widersprüche===\n<references group=\"W\"/>\n\n==Index==\n\{\{IdxTab\n|\n*\{\{Qde|}} \{\{+idx}}\n|\n*\{\{Qen|}} \{\{+idx}}\n}}\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n{{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
         "tagClose": "",
         tagClose: '',
         "sampleText": ""};
         sampleText: ''
    } );


     mwCustomEditButtons[mwCustomEditButtons.length] = {
     mw.toolbar.addButton( {
         "imageFile": "http://shadowhelix.de/images/8/84/Button_Redirect.png",
         imageFile: 'http://shadowhelix.de/images/b/ba/Button_Stub.png',
         "speedTip": "Weiterleitung",
         speedTip: 'Stubartikel',
         "tagOpen": '#WEITERLEITUNG [[',
         tagOpen: '\{\{stub}}\n\'\'\'\'\'\'\n\n<!-- Ende des Artikelinhalts - Metainformationen -->\n\n==Index==\n\{\{IdxTab\n|\n*\{\{Qde|}} \{\{+idx}}\n|\n*\{\{Qen|}} \{\{+idx}}\n}}\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n\{\{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
         "tagClose": "]]",
         tagClose: '',
         "sampleText": ""};
         sampleText: ''
    } );


     mwCustomEditButtons[mwCustomEditButtons.length] = {
     mw.toolbar.addButton( {
         "imageFile": "http://shadowhelix.de/images/9/9d/Button_Person.png",
         imageFile: 'http://shadowhelix.de/images/8/84/Button_Redirect.png',
         "speedTip": "Vorlage:Person",
         speedTip: 'Weiterleitung',
         "tagOpen": '\{\{Person\n|GESCHLECHT=\n|METATYP=\n|MAGISCH=\n}}',
         tagOpen: '#WEITERLEITUNG [[',
         "tagClose": "",
         tagClose: ']]',
         "sampleText": ""};
         sampleText: ''
    } );


     mwCustomEditButtons[mwCustomEditButtons.length] = {
     mw.toolbar.addButton( {
         "imageFile": "http://shadowhelix.de/images/8/8e/Button_Stadt.png",
         imageFile: 'http://shadowhelix.de/images/9/9d/Button_Person.png',
         "speedTip": "Vorlage:Stadt",
         speedTip: 'Vorlage:Person',
         "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|}}',
         tagOpen: '\{\{Person\n|GESCHLECHT=\n|METATYP=\n|MAGISCH=\n}}',
         "tagClose": "",
         tagClose: '',
         "sampleText": ""};
         sampleText: ''
    } );


     mwCustomEditButtons[mwCustomEditButtons.length] = {
     mw.toolbar.addButton( {
         "imageFile": "http://shadowhelix.de/images/a/a1/Button_adhoc.png",
         imageFile: 'http://shadowhelix.de/images/8/8e/Button_Stadt.png',
         "speedTip": "adhoc",
         speedTip: 'Vorlage:Stadt',
         "tagOpen": '==Detailinformationen==\n*\[\[Quelle, : /Abbildungsverzeichnis\|Abbildungsverzeichnis\]\]\n*\[\[Quelle, : /Credits\|Credits\]\]\n*\[\[Quelle, : /Index\|Index\]\]\n*\[\[Quelle, : /Inhaltsverzeichnis\|Inhaltsverzeichnis\]\]\n*\[\[Quelle, : /Produktbeschreibung\|Produktbeschreibung\]\]\n*\[\[Quelle, : /Wiki-Index\|Wiki-Index\]\]\n\n<!-- _ _ _SR -->\n\n\{\{DEFAULTSORT:\}\}\n\[\[Kategorie:Quellen/\]\]\n\[\[Kategorie:!Suchmarker\|\]\]',
         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: ''
    } );


    mw.toolbar.addButton( {
        imageFile: 'http://shadowhelix.de/images/a/a1/Button_adhoc.png',
        speedTip: 'adhoc',
        tagOpen: '==Detailinformationen==\n*\[\[Quelle, : /Abbildungsverzeichnis\|Abbildungsverzeichnis\]\]\n*\[\[Quelle, : /Credits\|Credits\]\]\n*\[\[Quelle, : /Index\|Index\]\]\n*\[\[Quelle, : /Inhaltsverzeichnis\|Inhaltsverzeichnis\]\]\n*\[\[Quelle, : /Produktbeschreibung\|Produktbeschreibung\]\]\n*\[\[Quelle, : /Wiki-Index\|Wiki-Index\]\]\n\n<!-- _ _ _SR -->\n\n\{\{DEFAULTSORT:\}\}\n\[\[Kategorie:Quellen/\]\]\n\[\[Kategorie:!Suchmarker\|\]\]',
        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 );
 
function formatLinksQuellenkategorie() {
 
    if ( document.location.href.search('/Kategorie:Quellen') != -1 ) {
 
        var objects = document.getElementsByTagName( "a" );
        for ( var i = 0; i < objects.length; i++ ) {   
            objects[i].innerHTML = objects[i].innerHTML.replace(/Quelle, (de|en|es|fr|he|hu|it|ja|pl|pt):/,"<tt><small>Quelle</small>, $1:</tt>").replace(/, (de|en):/,", <span style=\"font-style:italic; color:green;\">$1</span>:").replace(/, (es|fr|he|hu|it|ja|pl|pt):/,", <span style=\"font-style:italic; color:purple;\">$1</span>:");
        }
    }
}
 
addOnloadHook( formatLinksQuellenkategorie );

Aktuelle Version vom 29. April 2018, 22:33 Uhr

/* Skriptimport */

customHighlightFarbe = 'lightgrey';

// mw.loader.load('Benutzer:Loki/universalimpressumOverviewHighlight.js');
mw.loader.load('Benutzer:Loki/refDisplay.js');
mw.loader.load('Benutzer:Loki/vorlageUhr.js');
mw.loader.load('Benutzer:Loki/vorlageButton.js');

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

// $( testFunktionen );

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

if ( mw.toolbar ) {
    mw.toolbar.addButton( {
        imageFile: 'http://shadowhelix.de/images/b/b9/Button_E.png',
        speedTip: 'Artikelende',
        tagOpen: '<!-- Ende des Artikelinhalts - Metainformationen -->',
        tagClose: '',
        sampleText: ''
    } );

    mw.toolbar.addButton( {
        imageFile: 'http://shadowhelix.de/images/b/b0/Button_trash.png',
        speedTip: 'Löschantrag',
        tagOpen: '\{\{Löschantrag||}}',
        tagClose: '',
        sampleText: ''
    } );

    mw.toolbar.addButton( {
        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==Endnoten==\n\n===Quellenangabe===\n<references/>\n\n===Erläuterungen===\n<references group=\"E\"/>\n\n===Widersprüche===\n<references group=\"W\"/>\n\n==Index==\n\{\{IdxTab\n|\n*\{\{Qde|}} \{\{+idx}}\n|\n*\{\{Qen|}} \{\{+idx}}\n}}\n\n==Weblinks==\n*[[wp:|Wikipedia: ]]\n\n{{DEFAULTSORT:}}\n\{\{KatSchema|schema=}}\n\{\{KatSort|cat=|}}\n[[Kategorie:]]',
        tagClose: '',
        sampleText: ''
    } );

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

    mw.toolbar.addButton( {
        imageFile: 'http://shadowhelix.de/images/8/84/Button_Redirect.png',
        speedTip: 'Weiterleitung',
        tagOpen: '#WEITERLEITUNG [[',
        tagClose: ']]',
        sampleText: ''
    } );

    mw.toolbar.addButton( {
        imageFile: 'http://shadowhelix.de/images/9/9d/Button_Person.png',
        speedTip: 'Vorlage:Person',
        tagOpen: '\{\{Person\n|GESCHLECHT=\n|METATYP=\n|MAGISCH=\n}}',
        tagClose: '',
        sampleText: ''
    } );

    mw.toolbar.addButton( {
        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: ''
    } );

    mw.toolbar.addButton( {
        imageFile: 'http://shadowhelix.de/images/a/a1/Button_adhoc.png',
        speedTip: 'adhoc',
        tagOpen: '==Detailinformationen==\n*\[\[Quelle, : /Abbildungsverzeichnis\|Abbildungsverzeichnis\]\]\n*\[\[Quelle, : /Credits\|Credits\]\]\n*\[\[Quelle, : /Index\|Index\]\]\n*\[\[Quelle, : /Inhaltsverzeichnis\|Inhaltsverzeichnis\]\]\n*\[\[Quelle, : /Produktbeschreibung\|Produktbeschreibung\]\]\n*\[\[Quelle, : /Wiki-Index\|Wiki-Index\]\]\n\n<!-- _ _ _SR -->\n\n\{\{DEFAULTSORT:\}\}\n\[\[Kategorie:Quellen/\]\]\n\[\[Kategorie:!Suchmarker\|\]\]',
        tagClose: '',
        sampleText: ''
    } );
}

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