„Szerkesztő:Bdamokos/vector.js” változatai közötti eltérés
Megjelenés
Tartalom törölve Tartalom hozzáadva
<source> (kategorizálás megakadályozására) |
Eltávolította a lap teljes tartalmát Címke: Oldal egésze eltávolítva |
||
1. sor: | 1. sor: | ||
//<source lang="JavaScript"> |
|||
importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Mr.Z-man/refToolbar_2.0.js&action=raw&ctype=text/javascript&dontcountme=s;'); |
|||
popupFixRedirs = true; |
|||
popupFixDabs = true; |
|||
function webcitebutton() { |
|||
addPortletLink('p-cactions', 'javascript:webciteEverything()', "Web cite", "ca-websiteeverything", "Külső linkek tároltatása a Web Cite-tal"); |
|||
} |
|||
addOnloadHook(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 protected]&returnxml=true' ); } |
|||
}}}}} |
|||
} |
|||
function addLocalEditToolbarItems() { |
|||
if ( typeof $j != 'undefined' && typeof $j.fn.wikiEditor != 'undefined' ) { |
|||
$j( '#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 $j != 'undefined' ) $j(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 $j != 'undefined' && typeof $j.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 }; |
|||
$j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { 'sections': sectionObject } ); |
|||
sectionsInToolbar[sectionsInToolbar.length] = toolbarSectionName; |
|||
groupsInSection[sectionsInToolbar.length - 1] = new Array(); |
|||
} |
|||
// υπάρχει η ομάδα μέσα σε αυτό το τμήμα; |
|||
if (! existsEditToolbarGroup( toolbarSectionName, 'misc' ) ) { |
|||
$j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { |
|||
'section': toolbarSectionName, |
|||
'groups': { 'misc': { 'label': 'Διάφορα' } } |
|||
} ); |
|||
addGroupNameToSectionNameList(toolbarSectionName,'misc'); |
|||
} |
|||
$j( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { |
|||
'section': toolbarSectionName, 'group': 'misc', |
|||
'tools': { |
|||
'category': { |
|||
label: speedTip, type: 'button', |
|||
icon: imageFile, |
|||
action: { type: 'encapsulate', |
|||
options: { pre: textToEnter } |
|||
} |
|||
} |
|||
} |
|||
} ); |
|||
} |
|||
} |
|||
//</source> |