MediaWiki:Common.js
Aus MitsuWiki
Hinweis: Leere nach dem Speichern den Browser-Cache, um die Änderungen sehen zu können.
- Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
- Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
- Internet Explorer: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
- Opera: Extras → Internetspuren löschen … → Individuelle Auswahl → Den kompletten Cache löschen
/* Das folgende JavaScript wird für alle Benutzer geladen. */ // Editing-page-specific: see also below JKeyWikiEditorHelp.js if (mw.config.get('wgAction') === "edit" || mw.config.get('wgAction') === "submit" || mw.config.get('wgCanonicalSpecialPageName') === "Upload") { if (typeof EditTools === 'undefined') { importScript('MediaWiki:Edittools.js'); } if (typeof $.wikiEditor === 'undefined') { importScript("MediaWiki:Common.js/edit.js"); // TODO remove or adjust? AP 2011-08-25 } } $.jI18n = {/* resource string dictionary Note: Commons uses collapse/expand ▲/▼, but this looks better in strict box layouts that in the free-wrapping key statements Nomenclature proposal: if an extra plugin is used, strings can be designated as “plugin_toolTipSomthing” otherwise just “toolTipSomthing” (global string). So it’s more clear if somebody wants to deactivate a plugin and remove strings from the resource dictionary. */ en: { captionCollapse : " (show less) ", captionExpand : " (more...) ", expandAll : "Show all extras", iconCloseWindowHover : "http://upload.wikimedia.org/wikipedia/commons/d/d0/Close_icon_hover.jpg", iconCloseWindow : "http://upload.wikimedia.org/wikipedia/commons/8/87/Close_icon_default.jpg", iconOverview : "http://upload.wikimedia.org/wikipedia/commons/thumb/2/22/View-pause_Gion_simple.svg/20px-View-pause_Gion_simple.svg.png", iconResume : "http://upload.wikimedia.org/wikipedia/commons/thumb/4/49/View-playback_Gion_simple.svg/20px-View-playback_Gion_simple.svg.png", iconStart1st : "http://upload.wikimedia.org/wikipedia/commons/thumb/4/49/View-playback_Gion_simple.svg/20px-View-playback_Gion_simple.svg.png", iconStartNew : "http://upload.wikimedia.org/wikipedia/commons/thumb/0/05/View-refresh_Gion_simple.svg/20px-View-refresh_Gion_simple.svg.png", imageMetadataLink : "(Information about Creator, License and Copyright)", newWindow : "(New Window …)", toolTipClose : "Click to close", toolTipCollapse : "(click to hide information below)", toolTipExpand : "(click to show more information below)", toolTipImageZooming : "Images can be enlarged by clicking on it", toolTipNavigatePagetop : "Top of page", toolTipNewWindow : "(click to open content in a new window or tab)", toolTipFloatleft : "floating on the left side", toolTipFloatright: "floating on the right side", toolTipUnfloat: "back to default position", toolTipNoContentLoadable:"<i>No content could be loaded</i>", toolTipHeadingLink: "Click to show (permanent) link to this headline", // MediaWiki:Gadget-HeadingLink toolTipHeadingLinkHelp: "(1) Normal link to this head line or (2) the permanent link with version number:",// MediaWiki:Gadget-HeadingLink zoomNotPossible : "(This image can not be further enlarged)", // see MediaWiki:zoomImage.js ZoomImage_iconMagnifier: "http://www.species-id.net/o/media/f/f7/Iviewer.zoom_in.gif", ZoomImage_iconMagnifierHover: "http://www.species-id.net/o/media/5/5c/Iviewer.zoom_out.gif", ZoomImage_iconLoader: "http://upload.wikimedia.org/wikipedia/commons/d/de/Ajax-loader.gif", ZoomImage_toolTipLoad : "(click to load largest available image; this may take considerable time to load)", ZoomImage_textZoomOrig: "Zooming facility" }, de: { captionCollapse : " (weniger anzeigen) ", captionExpand : " (mehr...) ", expandAll : "Alle Zusatzinformationen zeigen", imageMetadataLink : "(Informationen zu Autor, Lizenz und Copyright)", newWindow : "(Neues Fenster …)", toolTipClose : "Zum Schließen klicken", toolTipCollapse : "(klicken um Zusatzinformationen zu verbergen)", toolTipExpand : "(klicken um Zusatzinformationen anzuzeigen)", toolTipHeadingLink: "Klicken um (permanenten) Link dieser Überschrift anzuzeigen",// MediaWiki:Gadget-HeadingLink toolTipHeadingLinkHelp: "(1) Link zu dieser Überschrift oder (2) Link mit Versionsnummer:",// MediaWiki:Gadget-HeadingLink toolTipImageZooming : "Bilder können durch Anklicken vergrößert betrachtet werden", toolTipNavigatePagetop : "Zum Seitenanfang", toolTipNewWindow : "(klicken um Inhalt in neuem Fenster oder Reiter zu öffnen)", toolTipFloatleft : "Links schwebend", toolTipFloatright: "Rechts schwebend", toolTipUnfloat: "Zurück zur Normalposition", toolTipNoContentLoadable:"<i>Leider konnte der Inhalt nicht geladen werden.</i>", zoomNotPossible : "(Dieses Bild kann nicht weiter vergrößert werden)", // see MediaWiki:zoomImage.js ZoomImage_toolTipLoad : "(klicken um Originalbild nachzuladen; bei großen Bildern kann dies u. U. langsam sein)", ZoomImage_textZoomOrig: "Vergrößerungsfunktion" }, it: { captionCollapse : " (mostra di meno) ", captionExpand : " (più...) ", expandAll : "Mostra tutti informazione", //REVISE imageMetadataLink : "(Informazione sull'Autore, Licenza e Copyright)", toolTipClose : "Clicca per chiudere", toolTipImageZooming : "Le immagini possono essere ingrandite cliccandoci sopra", zoomNotPossible : "(Al momento non è possibilie ingrandire questa immagine)" // TODO translation see en version } }; /* * Description: Get resource string (text, image URLs) for a given language, based on a string-key * If no resource is defined in a given language for a resource key, the resource for "en" will be returned, if this is missing as well an error message. * resourceKey: key for the resource (string) */ $.resource = function (resourceKey) { var lang = wgUserLanguage.split("-")[0]; // language: "pt-BR", "de-formal", etc. return ($.jI18n[lang] && $.jI18n[lang][resourceKey] ? $.jI18n[lang][resourceKey] : ($.jI18n.en[resourceKey]) ? $.jI18n.en[resourceKey] : "MISSING RESOURCE: no $.jI18n.en." + resourceKey + " defined."); }; /////////////////////// // Table Filter/Sort // /////////////////////// // specific to http://offene-naturfuehrer.de // TODO ?replace by jQuery plugin datatable? function initTableFilterSort(){ // see MediaWiki:SortTableFilter.js /* Note: problem is auto-inserted <tbody></tbody> by the browser: must be removed and replaced by thead + tbody. jQuery.unwrap() was not successful */ // add possibly more classes from http://www.javascripttoolbox.com/lib/table/documentation.php // Note: only applies to non-nested tables var jAutotables = $('table.table-autosort, table.table-autofilter, table-autostripe,table-sorted-asc,table-sorted-desc, table-filtered'); if (jAutotables.length) { // Note: in MediaWiki:SortTableFilter.js 'InputFilterTitle' was not recognized $.extend(true, $.jI18n, { en: { AutoSortTitle : 'Click to sort', FilterAllLabel: 'Filter: All', InputFilterTitle: 'Filter text (case sensitive, uses reg. expressions)' }, de: { AutoSortTitle : 'Zum Sortieren klicken', FilterAllLabel: 'Zeige: alle', InputFilterTitle: 'Text filtern (GROß/klein!, nutzt reg. Ausdrücke)' } }); // get sortable/filterable here already otherwise multiple th-filters $.getScript(mw.config.get( 'wgServer' ) + mw.config.get( 'wgScript' ) + "?title=MediaWiki:SortTableFilter.js&action=raw&ctype=text/javascript", function(){return true;}); // modify tables to introduce thead structure jAutotables.each(function(index){ //TODO simplify code? if()… // There may or may not be a tbody around tr. NOTE: $.unwrap() does not work here! // Memo: find('tr th') finds th, .parent() retrieves tr! .wrapAll will wrap inside DOM, not in return value! .detach() returns detached // OK in FF 3.6 and IE 7-8, not in IE6 (like the old code) // FURTHER WORK: Ideally, all normal tr td should remain in a tbody. var jThis = $(this), jThead = jThis.find('tr th').parent().detach(), jTfoot = jThis.find('tr[class=tfoot] td').parent().detach(),// remove it from the DOM jTbody = jThis.find('tbody:first'); if (jTbody.length===0) { jThis.children().wrapAll('<tbody/>'); jTbody = jThis.find('tbody:first'); } jTbody.before($("<thead/>").append(jThead)); if (jTfoot.length) { jTbody.after($("<tfoot/>").append(jTfoot)); } // th with class="input" gives an input field instead of selections $(this).find('th[class=input]').append('<input name="filter" title="'+$.resource('InputFilterTitle')+'" size="8" onkeyup="Table.filter(this,this)">'); });// end each() } // END if any autotable } /* mediaWiki.loader.state({"site":"ready"}); is appended and takes care of the document ready event. If $(document).ready() is used, for forms $ is then unknown. Scope or closure problem? (AP 2011-02-20) */ // When document is completely loaded $(document).ready(function() { // initImageZooming(); // initTargetHighlighting(); // page-internal jumps // initmoveTOC(); // TOC CSS position fixed or static // specific to http://offene-naturfuehrer.de initTableFilterSort(); // tests internally whether table with corresponding classes exist }); // end $(document).ready() // ***** CAN initCollapseButtons BE DELETED? // TEST: COMMENTED OUT // initCollapseButtons(); // strongly changes page layout: execute first // initCluetips(); // page specific if(mw.config.get( 'wgAction' )==="formedit" || mw.config.get( 'wgCanonicalSpecialPageName' )==="FormEdit"){ // initConfirmDeleteSubform(); // initMarkAllFilledFormElements(); } // specific to http://offene-naturfuehrer.de // initCollapsebox(); //collapsible parts // </source>