Forskel mellem versioner af "MediaWiki:Common.js"
Hp (diskussion | bidrag) |
Hp (diskussion | bidrag) m |
||
(301 mellemliggende versioner af 2 andre brugere ikke vist) | |||
Linje 1: | Linje 1: | ||
/* Javascript inkluderet her vil være aktivt for alle brugere. */ | /* Javascript inkluderet her vil være aktivt for alle brugere. */ | ||
+ | /* Tilføjer WikiEditor-extension med knapper og rulned-menu */ | ||
+ | /* Skal aktiveres i indstillinger eller i LocalSettings som standard */ | ||
− | + | var customizeToolbar = function() { | |
+ | /* Koden indsættes her */ | ||
− | + | /* Overflødige knapper og tegnsæt under Specialtegn fjernes her */ | |
+ | /* eller brug en javascript/php editor og ret i jquery.wikiEditor.toolbar.config.js (i \extensions\WikiEditor\modules mappen)*/ | ||
+ | /* og tilføj nye specialtegn-sæt i WikiEditor.php og WikiEditor.i18n.php (i \extensions\WikiEditor mappen) (virker ikke mere) */ | ||
− | |||
− | + | $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { | |
− | + | 'section': 'main', | |
− | + | 'group': 'insert', | |
− | + | 'tool': 'signature' | |
− | + | }); | |
− | |||
− | |||
− | |||
− | + | $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { | |
− | + | 'section': 'main', | |
− | + | 'group': 'insert', | |
− | + | 'tool': 'file' | |
− | + | }); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { | |
− | + | 'section': 'main', | |
− | + | 'group': 'insert', | |
− | + | 'tool': 'reference' | |
− | + | }); | |
− | |||
− | |||
− | + | $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { | |
− | + | 'section': 'advanced', | |
− | + | 'group': 'format', | |
− | + | 'tool': 'newline' | |
− | + | }); | |
− | + | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', { | |
− | + | 'section': 'advanced', | |
− | + | 'group': 'insert', | |
− | + | 'tool': 'redirect' | |
− | + | }); | |
− | + | ||
− | + | /* Indsæt knapper i topbjælke sektion (main) */ | |
− | + | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'main', | |
− | + | group: 'format', | |
− | + | tools: { | |
− | + | "numero": { | |
− | + | label: 'Indsæt nummer-tegn', | |
− | + | type: 'button', | |
− | + | icon: '//upload.wikimedia.org/wikipedia/commons/2/25/U%2B2116.gif', | |
− | + | action: { | |
− | + | type: 'encapsulate', | |
− | + | options: { | |
− | + | pre: "№ ", | |
− | + | } | |
− | + | } | |
− | + | } | |
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'main', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "sprog": { | ||
+ | label: 'Link til sproget.dk', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/3/3a/Toolbaricon_bold_S.png', | ||
+ | action: { | ||
+ | type: 'replace', | ||
+ | options: { | ||
+ | pre: "{{", | ||
+ | peri: "o", | ||
+ | post: "}}" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'main', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "template": { | ||
+ | label: 'Indsæt skabelon', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/4/4a/Norwegian_template_sign.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "{{", | ||
+ | post: "}}\n" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'main', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "redirect to category": { | ||
+ | label: 'Bøjnings-link til et kategoriord', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Toolbar_category.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "#REDIRECT[[:kategori:", | ||
+ | peri: "Indsæt", | ||
+ | post: "]]\n[[kategori:kategoriord]]" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'main', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "catego": { | ||
+ | label: 'Link til en kategori', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/b/bb/Toolbaricon_italic_C.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "#REDIRECT[[:kategori:", | ||
+ | periMsg: 'wikieditor-toolbar-tool-redirect-example', | ||
+ | post: "]]\n[[kategori:]]" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'main', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "new category": { | ||
+ | label: 'Indsæt skabelon og kategori', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/e/eb/Toolbaricon_regular_C.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "{{", | ||
+ | post: "|-|}}\n\n[[kategori:]]" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'main', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "category": { | ||
+ | label: 'Indsæt kategori', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/2/28/Toolbaricon_category.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "[[kategori:", | ||
+ | post: "]]\n" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | |||
+ | /* Indsæt knapper i Avanceret-'Format' (advanced) */ | ||
+ | |||
+ | $('#wpTextbox1').wikiEditor('addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "strikethrough": { | ||
+ | label: 'Gennemstreget', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<s>", | ||
+ | post: "</s>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "på dansk": { | ||
+ | label: 'Understreget', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Toolbaricon_regular_U_underline.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<u>", | ||
+ | post: "</u>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Venstrestil kursiv tekst med mellemrum', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/8/81/Toolbaricon_justify-left.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<div style='white-space:pre'>''", | ||
+ | post: "''</div>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Centrér tekst', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Format-justify-center.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<center>", | ||
+ | post: "</center>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Højrestil tekst', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/6/6e/Toolbaricon_justify-right.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<div align=right>", | ||
+ | post: "</div>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Centrer kursiv tekst med mellemrum', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/8/8a/Toolbar_user.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<center style='white-space:pre'>''", | ||
+ | post: "''</center>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Citat-afsnit', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<blockquote>", | ||
+ | post: "</blockquote>\n" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'format', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Opdel i 2 kolonner', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/4/4f/Trigramme2637_☷.svg', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<table width=100%>\n<tr valign=top>\n<td width=50%>\n", | ||
+ | post: "\n<td>\n\n</tr>\n</table>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'format', | |
− | + | tools: { | |
− | + | "comment": { | |
− | + | label: 'Fold ud', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/9/9c/A_pair_of_braces_with_a_vertical_line_between.png', | ||
+ | action: { | ||
+ | type: 'replace', | ||
+ | options: { | ||
+ | pre: "| liste1 = {{q|{{{1|}}}|", | ||
+ | post: "" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | /* Indsæt knapper i Avanceret-'Indsæt' */ | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "comment": { | |
− | + | label: 'Miniature-billede til højre', | |
− | + | type: 'button', | |
+ | icon: '//upload.wikimedia.org/wikipedia/commons/6/6f/Toolbar_insert_file.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "[[Fil:", | ||
+ | periMsg: 'wikieditor-toolbar-tool-file-example', | ||
+ | post: "|thumb|100px]]\n" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "nav-cat": { | |
− | + | label: 'Indsæt kategori-link og prik', | |
− | + | type: 'button', | |
− | + | icon: '//upload.wikimedia.org/wikipedia/commons/0/05/Toolbar_microstub.png', | |
− | + | action: { | |
− | + | type: 'encapsulate', | |
− | + | options: { | |
− | + | pre: "[[:kategori:", | |
− | + | post: "|]]{{*}} " | |
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "comment": { | |
− | + | label: 'Omdirigér ord-bøjning', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/7/7b/Tilde_button.PNG', | ||
+ | action: { | ||
+ | type: 'replace', | ||
+ | options: { | ||
+ | pre: "#REDIRECT[[", | ||
+ | peri: "Indsæt", | ||
+ | post: "]]\n[[kategori:Bøjningsform]]" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "village": { | |
− | + | label: 'Link til landsby-kategori', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/d/db/Toolbaricon_regular_L.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "#REDIRECT[[:kategori:", | ||
+ | peri: "Indsæt", | ||
+ | post: "]]\n[[kategori:landsby]]" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "comment": { | |
− | + | label: 'Link til bebyggelse-kategori', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/5/52/Toolbaricon_regular_b.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "#REDIRECT[[:kategori:", | ||
+ | peri: "Indsæt", | ||
+ | post: "]]\n[[kategori:bebyggelse]]" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "disambig": { | |
− | + | label: 'Skibsinfoboks', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/4/41/Toolbaricon_regular_s.png', | ||
+ | action: { | ||
+ | type: 'replace', | ||
+ | options: { | ||
+ | pre: "{{sk\n| k=\n| bia= | bash= | mart= | nok= | shsp= | IMO=", | ||
+ | post: "\n| før=\n| navn=\n| hjem=\n| værft=\n| år=18 | sbib=\n| b= | d= | m=\n| jma=\n| wrs=\n| rosd=Verdande-Aaso.pdf\n| {{gps|}}\n| liv= | død=\n}}" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "disambig": { | |
− | + | label: 'Avisartikel (stranding)', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/c/ce/Toolbaricon_regular_A.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "\nDer afholdtes [[strandauktion]] \n\n{{a|9999}\n* [ „“, ...] - [[Aalborg Stiftstidende]] \n* [ Strandingsauktion]\n<noinclude>\n[[kategori:]]\n[[kategori:]]\n[[kategori:|18", | ||
+ | peri: "", | ||
+ | post: "]]\n[[kategori:Strandauktion|2]]\n[[kategori:Vrag]]\n[[kategori:Ufærdig]]\n</noinclude>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "disambig": { | |
− | + | label: 'Avisartikel', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/c/ce/Toolbaricon_regular_A.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "\n{{a|", | ||
+ | peri: "dato", | ||
+ | post: "}\n\n<noinclude>\n[[kategori:]]\n[[kategori:]]\n[[kategori:]]\n[[kategori:]]\n[[kategori:]]\n</noinclude>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "navb": { | |
− | + | label: 'Navigationsboks', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/9/96/Interpage_icon.png', | ||
+ | action: { | ||
+ | type: 'replace', | ||
+ | options: { | ||
+ | pre: "{{Navboks \n| navn = \n| titel = [[:kategori:", | ||
+ | peri: "", | ||
+ | post: "|]]\n| billede-venstre = \n\n| liste1 = {{q|{{{1|}}}|{{{2|}}}|\n\n}}\n\n<includeonly>|status={{{1|}}}|navbar={{{2|plain}}}</includeonly>}}<noinclude>{{n}}</noinclude>" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "disambig": { | |
− | + | label: 'Fodnote-reference', | |
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/8/81/Wikieditor-reference.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<ref>[", | ||
+ | periMsg: 'wikieditor-toolbar-tool-reference-example', | ||
+ | post: "] - </ref>\n" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
− | + | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |
− | + | section: 'advanced', | |
− | + | group: 'insert', | |
− | + | tools: { | |
− | + | "disambig": { | |
− | + | label: 'Fodnoter vises her', | |
− | + | type: 'button', | |
− | + | icon: '//upload.wikimedia.org/wikipedia/commons/8/8d/Wikieditor-references.png', | |
− | + | action: { | |
− | + | type: 'encapsulate', | |
− | + | options: { | |
− | + | pre: "<references/>\n", | |
− | + | } | |
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Noter og dokumentation', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/c/cf/Toolbar_insert_reference.png', | ||
+ | action: { | ||
+ | type: 'replace', | ||
+ | options: { | ||
+ | pre: "\n== Noter ==\n{{Doku||", | ||
+ | post: "|}}\n\n" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Signatur og tid ved diskussion', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/1/11/Toolbaricon_hiddencomment.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "~~ ~", | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | $( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | ||
+ | section: 'advanced', | ||
+ | group: 'insert', | ||
+ | tools: { | ||
+ | "comment": { | ||
+ | label: 'Usynlig kommentar', | ||
+ | type: 'button', | ||
+ | icon: '//upload.wikimedia.org/wikipedia/commons/a/ac/Norwegian_quote_sign.png', | ||
+ | action: { | ||
+ | type: 'encapsulate', | ||
+ | options: { | ||
+ | pre: "<!-- ", | ||
+ | post: " -->" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } ); | ||
+ | |||
+ | /* Tilpasser værktøjslinjen hvis man er i redigeringstilstand og de nødvendige moduler er til rådighed */ | ||
+ | }; | ||
− | + | if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) { | |
− | + | mw.loader.using( 'user.options', function () { | |
− | + | if ( mw.user.options.get('usebetatoolbar') ) { | |
− | + | mw.loader.using( 'ext.wikiEditor.toolbar', function () { | |
− | + | $(document).ready( customizeToolbar ); | |
− | + | } ); | |
+ | } | ||
+ | } ); | ||
} | } | ||
+ | |||
/** Collapsible tables ********************************************************* | /** Collapsible tables ********************************************************* | ||
Linje 335: | Linje 748: | ||
− | |||
− | |||
− | |||
− | + | ||
− | + | /* Tilføjer Edittools-skrivetavle for neden med rul-ned menu og knapper, kræver CharInsert-extension */ | |
− | + | importScript( 'MediaWiki:Gadget-Edittools.js' ); | |
− | + | ||
− | + | ||
− | + | // [[Wikipedia:Tools/Navigation popups]] | |
− | + | mw.loader.load('https://en.wikipedia.org/w/load.php?modules=ext.gadget.Navigation_popups'); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Nuværende version fra 25. jul 2021, 14:30
/* Javascript inkluderet her vil være aktivt for alle brugere. */
/* Tilføjer WikiEditor-extension med knapper og rulned-menu */
/* Skal aktiveres i indstillinger eller i LocalSettings som standard */
var customizeToolbar = function() {
/* Koden indsættes her */
/* Overflødige knapper og tegnsæt under Specialtegn fjernes her */
/* eller brug en javascript/php editor og ret i jquery.wikiEditor.toolbar.config.js (i \extensions\WikiEditor\modules mappen)*/
/* og tilføj nye specialtegn-sæt i WikiEditor.php og WikiEditor.i18n.php (i \extensions\WikiEditor mappen) (virker ikke mere) */
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert',
'tool': 'signature'
});
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert',
'tool': 'file'
});
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'main',
'group': 'insert',
'tool': 'reference'
});
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'advanced',
'group': 'format',
'tool': 'newline'
});
$( '#wpTextbox1' ).wikiEditor( 'removeFromToolbar', {
'section': 'advanced',
'group': 'insert',
'tool': 'redirect'
});
/* Indsæt knapper i topbjælke sektion (main) */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'format',
tools: {
"numero": {
label: 'Indsæt nummer-tegn',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/25/U%2B2116.gif',
action: {
type: 'encapsulate',
options: {
pre: "№ ",
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'format',
tools: {
"sprog": {
label: 'Link til sproget.dk',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/3/3a/Toolbaricon_bold_S.png',
action: {
type: 'replace',
options: {
pre: "{{",
peri: "o",
post: "}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"template": {
label: 'Indsæt skabelon',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/4a/Norwegian_template_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "{{",
post: "}}\n"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"redirect to category": {
label: 'Bøjnings-link til et kategoriord',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/c4/Toolbar_category.png',
action: {
type: 'encapsulate',
options: {
pre: "#REDIRECT[[:kategori:",
peri: "Indsæt",
post: "]]\n[[kategori:kategoriord]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"catego": {
label: 'Link til en kategori',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/b/bb/Toolbaricon_italic_C.png',
action: {
type: 'encapsulate',
options: {
pre: "#REDIRECT[[:kategori:",
periMsg: 'wikieditor-toolbar-tool-redirect-example',
post: "]]\n[[kategori:]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"new category": {
label: 'Indsæt skabelon og kategori',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/e/eb/Toolbaricon_regular_C.png',
action: {
type: 'encapsulate',
options: {
pre: "{{",
post: "|-|}}\n\n[[kategori:]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'main',
group: 'insert',
tools: {
"category": {
label: 'Indsæt kategori',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/28/Toolbaricon_category.png',
action: {
type: 'encapsulate',
options: {
pre: "[[kategori:",
post: "]]\n"
}
}
}
}
} );
/* Indsæt knapper i Avanceret-'Format' (advanced) */
$('#wpTextbox1').wikiEditor('addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"strikethrough": {
label: 'Gennemstreget',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/6d/Vector_strikeout.png',
action: {
type: 'encapsulate',
options: {
pre: "<s>",
post: "</s>"
}
}
}
}
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"på dansk": {
label: 'Understreget',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/13/Toolbaricon_regular_U_underline.png',
action: {
type: 'encapsulate',
options: {
pre: "<u>",
post: "</u>"
}
}
}
}
});
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Venstrestil kursiv tekst med mellemrum',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/81/Toolbaricon_justify-left.png',
action: {
type: 'encapsulate',
options: {
pre: "<div style='white-space:pre'>''",
post: "''</div>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Centrér tekst',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/7/76/Format-justify-center.png',
action: {
type: 'encapsulate',
options: {
pre: "<center>",
post: "</center>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Højrestil tekst',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/6e/Toolbaricon_justify-right.png',
action: {
type: 'encapsulate',
options: {
pre: "<div align=right>",
post: "</div>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Centrer kursiv tekst med mellemrum',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/8a/Toolbar_user.png',
action: {
type: 'encapsulate',
options: {
pre: "<center style='white-space:pre'>''",
post: "''</center>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Citat-afsnit',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/2/2f/Toolbaricon_quote_1.png',
action: {
type: 'encapsulate',
options: {
pre: "<blockquote>",
post: "</blockquote>\n"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Opdel i 2 kolonner',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/4f/Trigramme2637_☷.svg',
action: {
type: 'encapsulate',
options: {
pre: "<table width=100%>\n<tr valign=top>\n<td width=50%>\n",
post: "\n<td>\n\n</tr>\n</table>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'format',
tools: {
"comment": {
label: 'Fold ud',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/9/9c/A_pair_of_braces_with_a_vertical_line_between.png',
action: {
type: 'replace',
options: {
pre: "| liste1 = {{q|{{{1|}}}|",
post: ""
}
}
}
}
} );
/* Indsæt knapper i Avanceret-'Indsæt' */
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"comment": {
label: 'Miniature-billede til højre',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/6/6f/Toolbar_insert_file.png',
action: {
type: 'encapsulate',
options: {
pre: "[[Fil:",
periMsg: 'wikieditor-toolbar-tool-file-example',
post: "|thumb|100px]]\n"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"nav-cat": {
label: 'Indsæt kategori-link og prik',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/0/05/Toolbar_microstub.png',
action: {
type: 'encapsulate',
options: {
pre: "[[:kategori:",
post: "|]]{{*}} "
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"comment": {
label: 'Omdirigér ord-bøjning',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/7/7b/Tilde_button.PNG',
action: {
type: 'replace',
options: {
pre: "#REDIRECT[[",
peri: "Indsæt",
post: "]]\n[[kategori:Bøjningsform]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"village": {
label: 'Link til landsby-kategori',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/d/db/Toolbaricon_regular_L.png',
action: {
type: 'encapsulate',
options: {
pre: "#REDIRECT[[:kategori:",
peri: "Indsæt",
post: "]]\n[[kategori:landsby]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"comment": {
label: 'Link til bebyggelse-kategori',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/5/52/Toolbaricon_regular_b.png',
action: {
type: 'encapsulate',
options: {
pre: "#REDIRECT[[:kategori:",
peri: "Indsæt",
post: "]]\n[[kategori:bebyggelse]]"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"disambig": {
label: 'Skibsinfoboks',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/4/41/Toolbaricon_regular_s.png',
action: {
type: 'replace',
options: {
pre: "{{sk\n| k=\n| bia= | bash= | mart= | nok= | shsp= | IMO=",
post: "\n| før=\n| navn=\n| hjem=\n| værft=\n| år=18 | sbib=\n| b= | d= | m=\n| jma=\n| wrs=\n| rosd=Verdande-Aaso.pdf\n| {{gps|}}\n| liv= | død=\n}}"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"disambig": {
label: 'Avisartikel (stranding)',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/ce/Toolbaricon_regular_A.png',
action: {
type: 'encapsulate',
options: {
pre: "\nDer afholdtes [[strandauktion]] \n\n{{a|9999}\n* [ „“, ...] - [[Aalborg Stiftstidende]] \n* [ Strandingsauktion]\n<noinclude>\n[[kategori:]]\n[[kategori:]]\n[[kategori:|18",
peri: "",
post: "]]\n[[kategori:Strandauktion|2]]\n[[kategori:Vrag]]\n[[kategori:Ufærdig]]\n</noinclude>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"disambig": {
label: 'Avisartikel',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/ce/Toolbaricon_regular_A.png',
action: {
type: 'encapsulate',
options: {
pre: "\n{{a|",
peri: "dato",
post: "}\n\n<noinclude>\n[[kategori:]]\n[[kategori:]]\n[[kategori:]]\n[[kategori:]]\n[[kategori:]]\n</noinclude>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"navb": {
label: 'Navigationsboks',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/9/96/Interpage_icon.png',
action: {
type: 'replace',
options: {
pre: "{{Navboks \n| navn = \n| titel = [[:kategori:",
peri: "",
post: "|]]\n| billede-venstre = \n\n| liste1 = {{q|{{{1|}}}|{{{2|}}}|\n\n}}\n\n<includeonly>|status={{{1|}}}|navbar={{{2|plain}}}</includeonly>}}<noinclude>{{n}}</noinclude>"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"disambig": {
label: 'Fodnote-reference',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/81/Wikieditor-reference.png',
action: {
type: 'encapsulate',
options: {
pre: "<ref>[",
periMsg: 'wikieditor-toolbar-tool-reference-example',
post: "] - </ref>\n"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"disambig": {
label: 'Fodnoter vises her',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/8/8d/Wikieditor-references.png',
action: {
type: 'encapsulate',
options: {
pre: "<references/>\n",
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"comment": {
label: 'Noter og dokumentation',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/c/cf/Toolbar_insert_reference.png',
action: {
type: 'replace',
options: {
pre: "\n== Noter ==\n{{Doku||",
post: "|}}\n\n"
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"comment": {
label: 'Signatur og tid ved diskussion',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/1/11/Toolbaricon_hiddencomment.png',
action: {
type: 'encapsulate',
options: {
pre: "~~ ~",
}
}
}
}
} );
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
section: 'advanced',
group: 'insert',
tools: {
"comment": {
label: 'Usynlig kommentar',
type: 'button',
icon: '//upload.wikimedia.org/wikipedia/commons/a/ac/Norwegian_quote_sign.png',
action: {
type: 'encapsulate',
options: {
pre: "<!-- ",
post: " -->"
}
}
}
}
} );
/* Tilpasser værktøjslinjen hvis man er i redigeringstilstand og de nødvendige moduler er til rådighed */
};
if ( $.inArray( mw.config.get( 'wgAction' ), ['edit', 'submit'] ) !== -1 ) {
mw.loader.using( 'user.options', function () {
if ( mw.user.options.get('usebetatoolbar') ) {
mw.loader.using( 'ext.wikiEditor.toolbar', function () {
$(document).ready( customizeToolbar );
} );
}
} );
}
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* [[Wikipedia:NavFrame]].
* Maintainers: [[User:R. Koot]]
*/
var autoCollapse = 2;
var collapseCaption = "skjul";
var expandCaption = "vis";
function collapseTable( tableIndex )
{
var Button = document.getElementById( "collapseButton" + tableIndex );
var Table = document.getElementById( "collapsibleTable" + tableIndex );
if ( !Table || !Button ) {
return false;
}
var Rows = Table.rows;
if ( Button.firstChild.data == collapseCaption ) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = "none";
}
Button.firstChild.data = expandCaption;
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = collapseCaption;
}
}
function createCollapseButtons()
{
var tableIndex = 0;
var NavigationBoxes = new Object();
var Tables = document.getElementsByTagName( "table" );
for ( var i = 0; i < Tables.length; i++ ) {
if ( hasClass( Tables[i], "collapsible" ) ) {
/* only add button and increment count if there is a header row to work with */
var HeaderRow = Tables[i].getElementsByTagName( "tr" )[0];
if (!HeaderRow) continue;
var Header = HeaderRow.getElementsByTagName( "th" )[0];
if (!Header) continue;
NavigationBoxes[ tableIndex ] = Tables[i];
Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
var Button = document.createElement( "span" );
var ButtonLink = document.createElement( "a" );
var ButtonText = document.createTextNode( collapseCaption );
Button.style.styleFloat = "right";
Button.style.cssFloat = "right";
Button.style.fontWeight = "normal";
Button.style.textAlign = "right";
Button.style.width = "6em";
ButtonLink.style.color = Header.style.color;
ButtonLink.setAttribute( "id", "collapseButton" + tableIndex );
ButtonLink.setAttribute( "href", "javascript:collapseTable(" + tableIndex + ");" );
ButtonLink.appendChild( ButtonText );
Button.appendChild( document.createTextNode( "[" ) );
Button.appendChild( ButtonLink );
Button.appendChild( document.createTextNode( "]" ) );
Header.insertBefore( Button, Header.childNodes[0] );
tableIndex++;
}
}
for ( var i = 0; i < tableIndex; i++ ) {
if ( hasClass( NavigationBoxes[i], "collapsed" ) || ( tableIndex >= autoCollapse && hasClass( NavigationBoxes[i], "autocollapse" ) ) ) {
collapseTable( i );
}
}
}
addOnloadHook( createCollapseButtons );
/* Test if an element has a certain class **************************************
*
* Description: Uses regular expressions and caching for better performance.
* Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]]
*/
var hasClass = (function () {
var reCache = {};
return function (element, className) {
return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className);
};
})();
/* Tilføjer Edittools-skrivetavle for neden med rul-ned menu og knapper, kræver CharInsert-extension */
importScript( 'MediaWiki:Gadget-Edittools.js' );
// [[Wikipedia:Tools/Navigation popups]]
mw.loader.load('https://en.wikipedia.org/w/load.php?modules=ext.gadget.Navigation_popups');