Szerkesztő:Hunyadym2 (elbirtokolt)/vector.js

A Wikipédiából, a szabad enciklopédiából

Megjegyzés: közzététel után frissítened kell a böngésződ gyorsítótárát, hogy lásd a változásokat.

  • Firefox / Safari: tartsd lenyomva a Shift gombot és kattints a Frissítés gombra a címsorban, vagy használd a Ctrl–F5 vagy Ctrl–R (Macen ⌘–R) billentyűkombinációt
  • Google Chrome: használd a Ctrl–Shift–R (Macen ⌘–Shift–R) billentyűkombinációt
  • Internet Explorer / Edge: tartsd nyomva a Ctrl-t, és kattints a Frissítés gombra, vagy nyomj Ctrl–F5-öt
  • Opera: Nyomj Ctrl–F5-öt
//<source lang="JavaScript">
mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Mr.Z-man/refToolbar_2.0.js&action=raw&ctype=text/javascript;');
popupFixRedirs = true;
popupFixDabs = true;

function webcitebutton() {

     mw.util.addPortletLink('p-cactions', 'javascript:webciteEverything()', "Web cite", "ca-websiteeverything", "Külső linkek tároltatása a Web Cite-tal");
  
}
$(webcitebutton);
function webciteEverything() {
    for (var i in document.links) {
 if (document.links[i].href.indexOf('wikipedia') == -1) {
 if (document.links[i].href.indexOf('mediawiki.org') == -1) {
 if (document.links[i].href.indexOf('wikimedia') == -1) {
 if (document.links[i].href.indexOf('javascript:') == -1) {
 if (document.links[i].href.indexOf('creativecommons.org') == -1) {
window.open('http://www.webcitation.org/archive?url='+escape(document.links[i].href)+'&email=bdamokos@gmail.com&returnxml=true' ); }
    }}}}}
}

function addLocalEditToolbarItems() {
    if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {

	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		'sections': { 'templates': { 'type': 'booklet', 'label': 'Sablonok és egyebek',  'deferLoad': true,
		    'pages': {
			'general-templates': {
				'layout': 'characters', 'label': 'Általános',
				'characters': [{ 'label': "aláírás", 'action': { 'type': 'encapsulate', 'options': { 'pre': "–~~", 'post': "~~" } } }, '–', '{{források}}', '{{törlés}}', 'azonnali',
        { 'label': "nowiki", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<nowiki>", 'post': "</nowiki>" } } },
{ 'label': "átirányítás", 'action': { 'type': 'encapsulate', 'options': { 'pre': "#átirányítás[[", 'post': "]]" } } },
{ 'label': "„”", 'action': { 'type': 'encapsulate', 'options': { 'pre': "„", 'post': "”" } } },
{ 'label': "nem törő szóköz", 'action': { 'type': 'encapsulate', 'options': { 'pre': "&", 'post': "nbsp;" } } },
{ 'label': "sablon", 'action': { 'type': 'encapsulate', 'options': { 'pre': "{{", 'post': "}}" } } },
{ 'label': "belső link", 'action': { 'type': 'encapsulate', 'options': { 'pre': "[[", 'post': "]]" } } },
        { 'label': "noinclude", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<noinclude>", 'post': "</noinclude>" } } },
        { 'label': "includeonly", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<includeonly>", 'post': "</includeonly>" } } },
        { 'label': "pre", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<pre>", 'post': "</pre>" } } },
        { 'label': "megjegyzés", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<!-- ", 'post': " -->" } } },
        { 'label': "br", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<br />", 'post': "" } } },
        { 'label': "small", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<small>", 'post': "</small>" } } },
        { 'label': "s", 'action': { 'type': 'encapsulate', 'options': { 'pre': "<s>", 'post': "</s>" } } },
                               ]
			}
                    }
		}
             }
	} );
    }
}
if ( typeof $ != 'undefined' ) $(document).ready(addLocalEditToolbarItems);

var sectionsInToolbar=new Array ();
var groupsInSection=new Array ();
 
function existsEditToolbarSection ( sectionName ) {
  // set up if empty
  if ( sectionsInToolbar.length == 0 ) {
      var count=0;
      possibleSections = document.getElementsByTagName('div');
      for (i = 0; i<possibleSections.length; i++) {
          if (possibleSections[i].className.indexOf('booklet section section-') == 0 ||
              possibleSections[i].className.indexOf('toolbar section section-' ) == 0 ) {
             sectionsInToolbar[count] = possibleSections[i].className.substring(24);
             possibleGroups = possibleSections[i].getElementsByTagName('div');
             var groupcount = 0;
             groupsInSection[count]=new Array ();
             for (j=0; j< possibleGroups.length; j++) {
                if (possibleGroups[j].className.indexOf('group group-') == 0) {
                   // μόνο το όνομα, όχι το 'group group-'
                   groupsInSection[count][groupcount++] = possibleGroups[j].className.substring(12);
                }
             }
             count++;
          }
      }
  }
  for (i=0; i<sectionsInToolbar.length; i++) {
       if (sectionsInToolbar[i] == sectionName) {
          return true;
       }
  }
  return false;
}
 
function existsEditToolbarGroup (sectionName, groupName) {
    for (i=0; i<sectionsInToolbar.length; i++) {
       if (sectionsInToolbar[i] == sectionName) {
          for (j=0; j<groupsInSection[i].length; j++) {
              if (groupsInSection[i][j] == groupName) {
                  return true;
              }
          }
       }
    }
    return false;
}
 
function addGroupNameToSectionNameList (sectionName, groupName) {
    for (i=0; i<sectionsInToolbar.length; i++) {
       if (sectionsInToolbar[i] == sectionName) {
          for (j=0; j<groupsInSection[i].length; j++) {
              if (groupsInSection[i][j] == groupName) {
                  return;
              }
          }
          groupsInSection[i][groupsInSection[i].length] = groupName;
          return;
       }
    }
    return;
}

/*
 παράμετροι:
 imageFile: URL προς το εικονίδιο (22x22 px)
 speedTip: το κείμενο που φαίνεται όταν βάλεις τον κέρσορα πάνω στο εικονίδιο
 textToEnter: το κείμενο που εισάγεται όταν πατήσεις το κουμπί
 toolbarSectionName: το όνομα που εμφανίζεται στη μπάρα δίπλα στα άλλα τμήματα (Προχωρημένα, Τοπικά κλπ.)
                     αν βάλεις όνομα ενός υπάρχοντος τμήματος κουμπιών, τα δικά σου κουμπιά θα προστεθούν
                     σε αυτό· αν βάλεις όνομα καινούριου τμήματος, θα δημιουργηθεί
*/
function addCustomButtonToLocalVectorToolbarButtons(imageFile, speedTip, textToEnter, toolbarSectionName) {
    if ( typeof $ != 'undefined' && typeof $.fn.wikiEditor != 'undefined' ) {
        if ( toolbarSectionName === undefined ) {
           toolbarSectionName = 'local';
           toolbarSectionLabel = 'Toπικά';
        }
        else {
           toolbarSectionLabel = toolbarSectionName;
        }
        // υπάρχει ήδη το τμήμα; 
        if ( ! existsEditToolbarSection( toolbarSectionName ) ) {
            // δημιουργούμε τμήμα με το ορισμένο όνομα και με ομάδα misc
            var sectionObject = {};
            sectionObject[toolbarSectionName] = { 'type': 'toolbar', 'label': toolbarSectionLabel };
            $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': sectionObject } );
            sectionsInToolbar[sectionsInToolbar.length] = toolbarSectionName;
            groupsInSection[sectionsInToolbar.length - 1] = new Array();
        }
        // υπάρχει η ομάδα μέσα σε αυτό το τμήμα; 
        if (! existsEditToolbarGroup( toolbarSectionName, 'misc' ) ) {
            $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
	        'section': toolbarSectionName,
		'groups': { 'misc': { 'label': 'Διάφορα' } }
	    } );
            addGroupNameToSectionNameList(toolbarSectionName,'misc');
        }
	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
		'section': toolbarSectionName, 'group': 'misc',
		'tools': {
			'category': {
				label: speedTip, type: 'button',
				icon: imageFile,
				action: { type: 'encapsulate',
					options: { pre: textToEnter }
				}
			}
		}
	} );
    }
}
//</source>