MediaWiki: Common.js: Unterschied zwischen den Versionen
Aus Semantic CorA
(Die Seite wurde neu angelegt: „→Das folgende JavaScript wird für alle Benutzer geladen.: “) |
|||
Zeile 1: | Zeile 1: | ||
/* Das folgende JavaScript wird für alle Benutzer geladen. */ | /* Das folgende JavaScript wird für alle Benutzer geladen. */ | ||
+ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
+ | // <source lang="javascript"> | ||
+ | // This JavaScript will be loaded for all users on every page load. | ||
+ | // Except for additions at the end, imported from en.wikipedia.org and modified (parts removed). | ||
+ | // for authors see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history | ||
+ | |||
+ | $j.jI18n = { // resource string dictionary | ||
+ | en: { | ||
+ | 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", | ||
+ | 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", | ||
+ | iconCloseWindow : "http://upload.wikimedia.org/wikipedia/commons/8/87/Close_icon_default.jpg", | ||
+ | iconCloseWindowHover : "http://upload.wikimedia.org/wikipedia/commons/d/d0/Close_icon_hover.jpg", | ||
+ | historyActiveOn : "http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/20px-Symbol_support_vote.svg.png", | ||
+ | historyActiveOff : "http://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Symbol_partial_support_vote.svg/20px-Symbol_partial_support_vote.svg.png", | ||
+ | playerStart1st : "Step-by-step identification", | ||
+ | playerStartNew : "Start new identification", | ||
+ | playerOverview : "Key overview (printable)", | ||
+ | playerResume : "Resume", | ||
+ | coupletContinue : " Continue ", | ||
+ | editorEdit : "Edit Key", | ||
+ | editorSave : "Save", | ||
+ | certaintyLabel : "Flag decision above as uncertain", | ||
+ | certaintyHint : "(check, then make your next decision)", | ||
+ | tryAllAlternatives : "Undecided: Try all alternatives", | ||
+ | mainResultMsg : "You identified: ", | ||
+ | historyHeading : "Previous decisions", | ||
+ | historyConfirmable : "Confirmable decisions:", | ||
+ | historyNested : "Alternative", | ||
+ | historyResult : "Result: ", | ||
+ | historyConfirm : "confirm", | ||
+ | historyRevise : "revise", | ||
+ | historyUncertainFlag : "(uncertain)", | ||
+ | toolTipIsActivePath : "Currently active identification path (multiple alternatives are being followed)", | ||
+ | imageMetadataLink : "(Information about Creator, License and Copyright)", | ||
+ | collapseCaption : " (show less) ", | ||
+ | expandCaption : " (more...) ", | ||
+ | expandAll : "Show all extras", | ||
+ | toolTipClose : "Click to close", | ||
+ | toolTipImageZooming : "Images can be enlarged by clicking on it", | ||
+ | zoomNotPossible : "(The enlargement function is currently not available for this image)" | ||
+ | }, | ||
+ | de: { | ||
+ | playerStart1st : "Interaktive Bestimmung", | ||
+ | playerStartNew : "Neue Bestimmung", | ||
+ | playerOverview : "Übersichtsdarstellung (druckbar)", | ||
+ | playerResume : "Bestimmung fortsetzen", | ||
+ | coupletContinue : " Weiter ", | ||
+ | editorEdit : "Bearbeiten", | ||
+ | editorSave : "Speichern", | ||
+ | certaintyLabel : "Markiere obige Entscheidung als unsicher", | ||
+ | certaintyHint : "(markieren, dann nächste Entscheidung fällen)", | ||
+ | tryAllAlternatives : "Nicht entscheidbar: Verfolge alle Alternativen", | ||
+ | mainResultMsg : "Ergebnis: ", | ||
+ | historyHeading : "Bisherige Entscheidungen", | ||
+ | historyConfirmable : "Entscheidungen in Überprüfung:", | ||
+ | historyResult : "Ergebnis: ", | ||
+ | historyConfirm : "bestätigen", | ||
+ | historyRevise : "überarbeiten", | ||
+ | historyUncertainFlag : "(unsicher)", | ||
+ | toolTipIsActivePath : "Derzeit aktiver Bestimmungsweg (mehrere Alternativen werden verfolgt)", | ||
+ | imageMetadataLink : "(Informationen zu Autor, Lizenz und Copyright)", | ||
+ | collapseCaption : " (weniger anzeigen) ", | ||
+ | expandCaption : " (mehr...) ", | ||
+ | expandAll : "Alle Zusatzinformationen zeigen", | ||
+ | toolTipClose : "Zum Schließen klicken", | ||
+ | toolTipImageZooming : "Bilder können durch Anklicken vergrößert betrachtet werden", | ||
+ | zoomNotPossible : "(Die Vergrößerungsfunktion ist zur Zeit für dieses Bild nicht verfügbar)" | ||
+ | }, | ||
+ | it: { | ||
+ | playerStart1st : "Esegui passo-dopo-passo", | ||
+ | playerStartNew : "Nuova identificazione", | ||
+ | playerOverview : "Sintesi completa (stampabile)", | ||
+ | playerResume : "Ricomincia l’identificazione", | ||
+ | coupletContinue : " Continua ", | ||
+ | editorEdit : "Modifica", | ||
+ | editorSave : "Salva", | ||
+ | certaintyLabel : "Segna scelta come insicura", //REVISE | ||
+ | certaintyHint : "(click, then make your next decision)", //TRANSLATE | ||
+ | mainResultMsg : "Il risultato dell'identificazione è: ", | ||
+ | historyHeading : "Scelte precedenti", | ||
+ | historyConfirmable : "Scelta confermabile:", | ||
+ | historyResult : "Risultato: ", | ||
+ | historyConfirm : "conferma", | ||
+ | historyRevise : "correggi", | ||
+ | historyUncertainFlag : "(incerta)", | ||
+ | toolTipIsActivePath : "Percorso di identificazione attualmente attivo (vengono seguite alternative multiple)", | ||
+ | imageMetadataLink : "(Informazione sull'Autore, Licenza e Copyright)", | ||
+ | collapseCaption : " (mostra di meno) ", | ||
+ | expandCaption : " (più...) ", | ||
+ | expandAll : "Mostra tutti informazione", //REVISE | ||
+ | toolTipClose : "Clicca per chiudere", | ||
+ | toolTipImageZooming : "Le immagini possono essere ingrandite cliccandoci sopra", | ||
+ | zoomNotPossible : "(Al momento non è possibilie ingrandire questa immagine)" | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | |||
+ | /* Import more specific scripts if necessary */ | ||
+ | if (wgAction == "edit" || wgAction == "submit" || wgPageName == "Special:Upload") { //scripts specific to editing pages | ||
+ | importScript("MediaWiki:Common.js/edit.js"); | ||
+ | } | ||
+ | |||
+ | |||
+ | /* Scripts specific to Internet Explorer */ | ||
+ | if (navigator.appName == "Microsoft Internet Explorer") { | ||
+ | /** Internet Explorer bug fix ************************************************** | ||
+ | * Description: Fixes IE horizontal scrollbar bug | ||
+ | * Maintainers: [[User:Tom-]]? | ||
+ | */ | ||
+ | var oldWidth; | ||
+ | var docEl = document.documentElement; | ||
+ | |||
+ | function fixIEScroll() { | ||
+ | if (!oldWidth || docEl.clientWidth > oldWidth) | ||
+ | doFixIEScroll(); | ||
+ | else | ||
+ | setTimeout(doFixIEScroll, 1); | ||
+ | oldWidth = docEl.clientWidth; | ||
+ | } | ||
+ | |||
+ | function doFixIEScroll() { | ||
+ | docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : ""; | ||
+ | } | ||
+ | |||
+ | document.attachEvent("onreadystatechange", fixIEScroll); | ||
+ | document.attachEvent("onresize", fixIEScroll); | ||
+ | |||
+ | // In print IE (7?) does not like line-height | ||
+ | appendCSS( '@media print { sup, sub, p, .documentDescription { line-height: normal; }}'); | ||
+ | |||
+ | //Import scripts specific to Internet Explorer 6 | ||
+ | // THIS IS A PNG transparency FIX, here commented out: | ||
+ | // if (navigator.appVersion.substr(22, 1) == "6") { | ||
+ | // importScript("MediaWiki:Common.js/IE60Fixes.js"); | ||
+ | // } | ||
+ | } // END "Microsoft Internet Explorer" | ||
+ | |||
+ | /** | ||
+ | * ImageAnnotator | ||
+ | * Globally enabled per | ||
+ | * http://commons.wikimedia.org/?title=Commons:Village_pump&oldid=26818359#New_interface_feature | ||
+ | * Maintainer: [[User:Lupo]] | ||
+ | */ | ||
+ | // Not on Special pages, and only if viewing the page | ||
+ | //if (wgNamespaceNumber != -1 && jQuery.inArray(mw.config.get('wgAction'), ['view', 'purge']) != -1 ) { | ||
+ | // if (typeof ImageAnnotator_disable == 'undefined' || !ImageAnnotator_disable) { | ||
+ | // Don't even import it if it's disabled. | ||
+ | // importScript('MediaWiki:Gadget-ImageAnnotator.js'); | ||
+ | // } | ||
+ | //} | ||
+ | |||
+ | if (wgNamespaceNumber != -1) importScript ('MediaWiki:Gadget-ImageAnnotator.js'); | ||
+ | |||
+ | /** Table sorting fixes | ||
+ | * Description: Disables code in table sorting routine to set classes on even/odd rows | ||
+ | */ | ||
+ | ts_alternate_row_colors = false; | ||
+ | |||
+ | |||
+ | /** | ||
+ | * sort event-tables according to column 3. | ||
+ | */ | ||
+ | function presort() { | ||
+ | var table = document.getElementById("event-table"); | ||
+ | if (table != null && table != 'undefined') { | ||
+ | var sortLink = table.rows[0].cells[2].lastChild; | ||
+ | ts_resortTable(sortLink); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /* | ||
+ | * 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) | ||
+ | */ | ||
+ | $j.resource = function (resourceKey) { | ||
+ | var lang = wgContentLanguage.split("-")[0]; // language: "pt-BR", "de-formal", etc. | ||
+ | return ($j.jI18n[lang] && $j.jI18n[lang][resourceKey] ? | ||
+ | $j.jI18n[lang][resourceKey] : | ||
+ | ($j.jI18n.en[resourceKey]) ? $j.jI18n.en[resourceKey] : "MISSING RESOURCE"); | ||
+ | }; | ||
+ | |||
+ | |||
+ | /** | ||
+ | * Semantic Forms quit formtable class on edit | ||
+ | */ | ||
+ | function initHideFirstTemplate(){ | ||
+ | var jTrHiddenFormTexts = $j( | ||
+ | // select only input type text from formtable | ||
+ | ".lemmata-body" | ||
+ | ); | ||
+ | jTrHiddenFormTexts | ||
+ | .parents('table:eq(0)') | ||
+ | .css({'display': 'none'}); | ||
+ | } | ||
+ | |||
+ | //moveable TOCs | ||
+ | importScript('MediaWiki:MoveTOC.js'); | ||
+ | |||
+ | // collapsible parts: div and tr → Template:Hidden | ||
+ | // may be fused later with toggleCollapse | ||
+ | // main difference: initCollapsebox() uses a switcher defined by the Wikitemplate | ||
+ | // and is not using a javascript resource title | ||
+ | function initCollapsebox() { | ||
+ | /* is nested in: div.collapsebox | ||
+ | └ div.switcher | ||
+ | └ div.collapsecontent */ | ||
+ | jQuery("div.collapsebox div.switcher").live('click', | ||
+ | function() { | ||
+ | jQuery(this).nextAll("div.collapsecontent:first").slideToggle(250); | ||
+ | /* $(this).toggle() does not work in live as toggle is a bind() | ||
+ | therefore toggle must be bound to a different DOM element */ | ||
+ | jQuery(this).find(".show, .hide").toggle(); | ||
+ | }); | ||
+ | /* is in a table: tr.collapsebox | ||
+ | └ div.switcher | ||
+ | tr.collapsecontent */ | ||
+ | jQuery("tr.collapsebox div.switcher").live('click', | ||
+ | function() { | ||
+ | jQuery(this).closest("tr.collapsebox").nextAll("tr.collapsecontent:first").toggle(); | ||
+ | jQuery(this).find(".show, .hide").toggle(); | ||
+ | }); | ||
+ | }// END initCollapsebox() | ||
+ | |||
+ | /////////////////////////////////// | ||
+ | // confirm deletion using SMW forms | ||
+ | // does not work in IE 6 | ||
+ | ////////////////////////////////// | ||
+ | function initConfirmDeleteSubform() { | ||
+ | $j.extend(true, $j.jI18n, { | ||
+ | en: { | ||
+ | message : "'Delete this sub form irreversibly?'" | ||
+ | }, | ||
+ | de: { | ||
+ | message : "'Dieses Teilformular unwiderruflich löschen?'" | ||
+ | } | ||
+ | }); | ||
+ | // default buttons: <input type="button" ... class="remove"/> | ||
+ | $j("input.remove").attr("onClick", function() {// case sensitive not: onclick | ||
+ | //typeof this.onclick → function | ||
+ | var currentClickHandlerString = this.getAttributeNode('onclick').value; | ||
+ | // add a confirm | ||
+ | return "var removethis = confirm("+$j.resource('message')+"); if(removethis) {return " + currentClickHandlerString + "};"; | ||
+ | }); | ||
+ | /* added delete buttons by the SMW-form: <input type="button" /> | ||
+ | add onclick handling */ | ||
+ | $j("input.addAnother").click(function () { | ||
+ | // just new generated div#div_gen_1 | ||
+ | $j("div") | ||
+ | .filter(function() { return this.id.match(/div_gen_\d+/); }) | ||
+ | .find(":button") | ||
+ | .attr("onClick",function() {// case sensitive not: onclick | ||
+ | // add a confirm | ||
+ | return "var removethis = confirm("+$j.resource('message')+"); if(removethis) {$j('#' + String($j(this).parent().attr('id'))).remove();} else {return false;};"; | ||
+ | }); | ||
+ | }); | ||
+ | }// end initConfirmDeleteSubform() | ||
+ | |||
+ | /* | ||
+ | /////////////////////////////////// | ||
+ | // indicate hidden inputs created | ||
+ | // from template:Hidden | ||
+ | ////////////////////////////////// | ||
+ | structure of template:Hidden: | ||
+ | |||
+ | div.collapsebox | ||
+ | ├ div.switcher (float) | ||
+ | ├ div.collapsetitle | ||
+ | └ div.collapsecontent | ||
+ | |||
+ | tr.collapsebox | ||
+ | └ th/td | ||
+ | ├ div.switcher (float) | ||
+ | └ div.collapsetitle | ||
+ | tr.collapsecontent | ||
+ | */ | ||
+ | function initMarkHiddenInputs(){ | ||
+ | var jDivHiddenFormTexts = $j( | ||
+ | // select only input type text + textarea with values | ||
+ | "div.collapsecontent.indicateHiddenInputs * :text[value!=]" | ||
+ | +", div.collapsecontent.indicateHiddenInputs * textarea[value!=]" | ||
+ | ); | ||
+ | var jTrHiddenFormTexts = $j( | ||
+ | // select only input type text + textarea with values | ||
+ | "tr.collapsecontent.indicateHiddenInputs *:not(.collapsecontent) :text[value!=]" | ||
+ | +", tr.collapsecontent.indicateHiddenInputs *:not(.collapsecontent) textarea[value!=]" | ||
+ | ); | ||
+ | // <div> | ||
+ | jDivHiddenFormTexts | ||
+ | .parents(".collapsebox") | ||
+ | .css({'border-left':'2px solid #ce5c00'}); | ||
+ | //indicate the fields itself | ||
+ | jDivHiddenFormTexts | ||
+ | .css({'background-color':'#fcdeb1'}); //pale orange | ||
+ | // <tr> | ||
+ | //indicate the fields itself | ||
+ | jTrHiddenFormTexts | ||
+ | .css({'background-color':'#fcdeb1'}); //pale orange | ||
+ | //indicate current level | ||
+ | jTrHiddenFormTexts | ||
+ | .closest(".collapsebox") | ||
+ | .css({'border-left':'2px solid #ce5c00'}); | ||
+ | // to ?upermost level | ||
+ | jTrHiddenFormTexts | ||
+ | .parents(".collapsecontent") | ||
+ | .prev(".collapsebox") | ||
+ | .css({'border-left':'2px solid #ce5c00'}); | ||
+ | }// END initMarkHiddenInputs() | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | //$(window).bind('load', function() | ||
+ | |||
+ | $(window).load(function() { | ||
+ | // I changed rearranger image(by Adrian) | ||
+ | |||
+ | jQuery('img.rearrangerImage').attr('src','http://smw-cora.org/upload/Rearranger.png'); | ||
+ | |||
+ | |||
+ | // I changed dull-blue-circle.png (from blue to orange) (by Adrian) | ||
+ | |||
+ | jQuery('img.timeline-copyright').attr('src','http://smw-cora.org/upload/Copyright-vertical.png'); | ||
+ | jQuery('div.timeline-band-layer-inner > div > img').attr('src','http://smw-cora.org/upload/Dull-blue-circle.png'); | ||
+ | |||
+ | //I changed the slim bottom lines (in fact it is border color left) from blue to orange (by Adrian) | ||
+ | jQuery('div.timeline-band-layer-inner > div').each(function(){ | ||
+ | if(jQuery(this).css('border-left-color') == 'rgb(88, 160, 220)') { | ||
+ | jQuery(this).css('border-left-color','rgb(247,102,0)'); | ||
+ | } | ||
+ | }); | ||
+ | // I changed icon for resize image (by Adrian) | ||
+ | // jQuery('#buttondecreaseimagesize').attr('src','http://smw-cora.org/upload/Minus_size.png'); | ||
+ | // jQuery('#buttonincreaseimagesize').attr('src','http://smw-cora.org/upload/Plus_size.png'); | ||
+ | |||
+ | |||
+ | // Eliminated <---Resize---> (by Adrian) | ||
+ | |||
+ | // $("#SIAresizeDiv").contents().filter(function(){ | ||
+ | // return (this.nodeType == 3); | ||
+ | // }).remove(); | ||
+ | }); | ||
+ | |||
+ | addOnloadHook(presort); | ||
+ | jQuery(document).ready(function() { | ||
+ | var $j = jQuery.noConflict; | ||
+ | // try to add the toolbar on uploading | ||
+ | var aa= jQuery('<a/>') | ||
+ | .attr("href", "http://smw-cora.org/index.php/Main_Page").attr("id","poweredbyCora"); | ||
+ | jQuery("#footer-poweredbyico").append(aa); | ||
+ | var img = jQuery('<img />').attr({ 'id': 'poc', 'src': 'http://smw-cora.org/upload/SC_Credit.png', 'alt':'Powered by CorA Project' }).appendTo(jQuery('#poweredbyCora')); | ||
+ | |||
+ | |||
+ | /*jQuery('.smwtimeline').find('img').each(function () { | ||
+ | var curSrc = jQuery(this).attr('src'); | ||
+ | var class = jQuery(this).attr('class'); | ||
+ | alert("yes"); | ||
+ | if ( class === '' ) { | ||
+ | jQuery(this).attr('src', 'http://smw-cora.org/upload/dull-blue-circle.png'); | ||
+ | } | ||
+ | if ( class === 'timeline-copyright' ) { | ||
+ | jQuery(this).attr('src', 'http://example.com/brown.gif'); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | jQuery('.smwtimeline').on('DOMNodeInserted ', 'img', function(){ | ||
+ | alert("insert"); | ||
+ | jQuery(this).html('<b>yaay!</b>'); | ||
+ | });*/ | ||
+ | |||
+ | //Adrian - BEGIN - setting min-height of div.content - for push down #footer | ||
+ | |||
+ | jQuery('#content').css('min-height', Math.max(jQuery('#content').height(), jQuery('#mw-panel').height())); | ||
+ | |||
+ | //Adrian - END - setting height of div.content | ||
+ | |||
+ | |||
+ | // edit tools update | ||
+ | // upload new icons for tools | ||
+ | if(wgAction == "edit"){ | ||
+ | jQuery('#mw-editbutton-bold').attr('src','http://smw-cora.org/upload/Button_bold.png'); | ||
+ | jQuery('#mw-editbutton-italic').attr('src','http://smw-cora.org/upload/Button_italic.png'); | ||
+ | jQuery('#mw-editbutton-link').attr('src','http://smw-cora.org/upload/Button_link.png'); | ||
+ | jQuery('#mw-editbutton-extlink').attr('src','http://smw-cora.org/upload/Button_extlink.png'); | ||
+ | jQuery('#mw-editbutton-headline').attr('src','http://smw-cora.org/upload/Button_headline.png'); | ||
+ | jQuery('#mw-editbutton-image').attr('src','http://smw-cora.org/upload/Button_image.png'); | ||
+ | jQuery('#mw-editbutton-media').attr('src','http://smw-cora.org/upload/Button_media.png'); | ||
+ | jQuery('#mw-editbutton-nowiki').attr('src','http://smw-cora.org/upload/Button_nowiki.png'); | ||
+ | jQuery('#mw-editbutton-signature').attr('src','http://smw-cora.org/upload/Button_sig.png'); | ||
+ | jQuery('#mw-editbutton-hr').attr('src','http://smw-cora.org/upload/Button_hr.png'); | ||
+ | |||
+ | } | ||
+ | if(wgPageName == "Special:Upload" && wgUserName){ | ||
+ | $j("textarea#wpUploadDescription").before('<div id="toolbar"></div>'); | ||
+ | } | ||
+ | // initmovingTOC(); // TOC CSS position fixed or static → MediaWiki:Gadget-moveTOC.js | ||
+ | initCollapsebox();//collapsable parts | ||
+ | // page specific | ||
+ | if(wgAction == "formedit" || wgPageName == "Special:FormEdit"){ | ||
+ | initConfirmDeleteSubform(); | ||
+ | initMarkHiddenInputs(); | ||
+ | initHideFirstTemplate(); | ||
+ | } | ||
+ | if(wgCanonicalSpecialPageName === "Browse"){ | ||
+ | // alert("browse"); | ||
+ | |||
+ | jQuery(".smwb-propvalue td").each(function(){ | ||
+ | var data = []; | ||
+ | var kids = jQuery(this).children(".smwb-value"); | ||
+ | if(kids.length>1){ | ||
+ | for(var i=0; i<kids.length; i++){ | ||
+ | data.push(kids[i].outerHTML); | ||
+ | } | ||
+ | // alert('xx '+data); | ||
+ | var stories = jQuery('.story-body'); | ||
+ | kids.detach(); | ||
+ | jQuery(this).empty(); | ||
+ | var x=data.join("<br/>"); | ||
+ | jQuery(x).appendTo(this); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | /* if(wgPageName == "Special:OfflineImportLexicon"){ | ||
+ | importScript('MediaWiki:OIL_Constants.js'); | ||
+ | importScript('MediaWiki:jquery.ezpz_tooltip.min.js'); | ||
+ | importScript('MediaWiki:OfflineImportLexicon.js'); | ||
+ | importScript('MediaWiki:OfflineImportLexiconSecond.js'); | ||
+ | }*/ | ||
+ | if (wgNamespaceNumber != -1 && jQuery.inArray(mw.config.get('wgAction'), ['view']) != -1 ){ | ||
+ | // importScript('MediaWiki:AQE-Constants.js'); | ||
+ | // importScript('MediaWiki:Jquery.tools.min.js'); | ||
+ | // importScript('MediaWiki:AnalysisQueryEditor.js'); | ||
+ | // importScript('MediaWiki:AnalysisQueryEditorSecond.js'); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | importScript('MediaWiki:Multilingual description.js'); | ||
+ | |||
+ | // </source> |
Version vom 4. März 2014, 21:46 Uhr
/* Das folgende JavaScript wird für alle Benutzer geladen. */
/* Any JavaScript here will be loaded for all users on every page load. */
// <source lang="javascript">
// This JavaScript will be loaded for all users on every page load.
// Except for additions at the end, imported from en.wikipedia.org and modified (parts removed).
// for authors see http://en.wikipedia.org/w/index.php?title=MediaWiki:Common.js&action=history
$j.jI18n = { // resource string dictionary
en: {
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",
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",
iconCloseWindow : "http://upload.wikimedia.org/wikipedia/commons/8/87/Close_icon_default.jpg",
iconCloseWindowHover : "http://upload.wikimedia.org/wikipedia/commons/d/d0/Close_icon_hover.jpg",
historyActiveOn : "http://upload.wikimedia.org/wikipedia/commons/thumb/9/94/Symbol_support_vote.svg/20px-Symbol_support_vote.svg.png",
historyActiveOff : "http://upload.wikimedia.org/wikipedia/commons/thumb/3/37/Symbol_partial_support_vote.svg/20px-Symbol_partial_support_vote.svg.png",
playerStart1st : "Step-by-step identification",
playerStartNew : "Start new identification",
playerOverview : "Key overview (printable)",
playerResume : "Resume",
coupletContinue : " Continue ",
editorEdit : "Edit Key",
editorSave : "Save",
certaintyLabel : "Flag decision above as uncertain",
certaintyHint : "(check, then make your next decision)",
tryAllAlternatives : "Undecided: Try all alternatives",
mainResultMsg : "You identified: ",
historyHeading : "Previous decisions",
historyConfirmable : "Confirmable decisions:",
historyNested : "Alternative",
historyResult : "Result: ",
historyConfirm : "confirm",
historyRevise : "revise",
historyUncertainFlag : "(uncertain)",
toolTipIsActivePath : "Currently active identification path (multiple alternatives are being followed)",
imageMetadataLink : "(Information about Creator, License and Copyright)",
collapseCaption : " (show less) ",
expandCaption : " (more...) ",
expandAll : "Show all extras",
toolTipClose : "Click to close",
toolTipImageZooming : "Images can be enlarged by clicking on it",
zoomNotPossible : "(The enlargement function is currently not available for this image)"
},
de: {
playerStart1st : "Interaktive Bestimmung",
playerStartNew : "Neue Bestimmung",
playerOverview : "Übersichtsdarstellung (druckbar)",
playerResume : "Bestimmung fortsetzen",
coupletContinue : " Weiter ",
editorEdit : "Bearbeiten",
editorSave : "Speichern",
certaintyLabel : "Markiere obige Entscheidung als unsicher",
certaintyHint : "(markieren, dann nächste Entscheidung fällen)",
tryAllAlternatives : "Nicht entscheidbar: Verfolge alle Alternativen",
mainResultMsg : "Ergebnis: ",
historyHeading : "Bisherige Entscheidungen",
historyConfirmable : "Entscheidungen in Überprüfung:",
historyResult : "Ergebnis: ",
historyConfirm : "bestätigen",
historyRevise : "überarbeiten",
historyUncertainFlag : "(unsicher)",
toolTipIsActivePath : "Derzeit aktiver Bestimmungsweg (mehrere Alternativen werden verfolgt)",
imageMetadataLink : "(Informationen zu Autor, Lizenz und Copyright)",
collapseCaption : " (weniger anzeigen) ",
expandCaption : " (mehr...) ",
expandAll : "Alle Zusatzinformationen zeigen",
toolTipClose : "Zum Schließen klicken",
toolTipImageZooming : "Bilder können durch Anklicken vergrößert betrachtet werden",
zoomNotPossible : "(Die Vergrößerungsfunktion ist zur Zeit für dieses Bild nicht verfügbar)"
},
it: {
playerStart1st : "Esegui passo-dopo-passo",
playerStartNew : "Nuova identificazione",
playerOverview : "Sintesi completa (stampabile)",
playerResume : "Ricomincia l’identificazione",
coupletContinue : " Continua ",
editorEdit : "Modifica",
editorSave : "Salva",
certaintyLabel : "Segna scelta come insicura", //REVISE
certaintyHint : "(click, then make your next decision)", //TRANSLATE
mainResultMsg : "Il risultato dell'identificazione è: ",
historyHeading : "Scelte precedenti",
historyConfirmable : "Scelta confermabile:",
historyResult : "Risultato: ",
historyConfirm : "conferma",
historyRevise : "correggi",
historyUncertainFlag : "(incerta)",
toolTipIsActivePath : "Percorso di identificazione attualmente attivo (vengono seguite alternative multiple)",
imageMetadataLink : "(Informazione sull'Autore, Licenza e Copyright)",
collapseCaption : " (mostra di meno) ",
expandCaption : " (più...) ",
expandAll : "Mostra tutti informazione", //REVISE
toolTipClose : "Clicca per chiudere",
toolTipImageZooming : "Le immagini possono essere ingrandite cliccandoci sopra",
zoomNotPossible : "(Al momento non è possibilie ingrandire questa immagine)"
}
};
/* Import more specific scripts if necessary */
if (wgAction == "edit" || wgAction == "submit" || wgPageName == "Special:Upload") { //scripts specific to editing pages
importScript("MediaWiki:Common.js/edit.js");
}
/* Scripts specific to Internet Explorer */
if (navigator.appName == "Microsoft Internet Explorer") {
/** Internet Explorer bug fix **************************************************
* Description: Fixes IE horizontal scrollbar bug
* Maintainers: [[User:Tom-]]?
*/
var oldWidth;
var docEl = document.documentElement;
function fixIEScroll() {
if (!oldWidth || docEl.clientWidth > oldWidth)
doFixIEScroll();
else
setTimeout(doFixIEScroll, 1);
oldWidth = docEl.clientWidth;
}
function doFixIEScroll() {
docEl.style.overflowX = (docEl.scrollWidth - docEl.clientWidth < 4) ? "hidden" : "";
}
document.attachEvent("onreadystatechange", fixIEScroll);
document.attachEvent("onresize", fixIEScroll);
// In print IE (7?) does not like line-height
appendCSS( '@media print { sup, sub, p, .documentDescription { line-height: normal; }}');
//Import scripts specific to Internet Explorer 6
// THIS IS A PNG transparency FIX, here commented out:
// if (navigator.appVersion.substr(22, 1) == "6") {
// importScript("MediaWiki:Common.js/IE60Fixes.js");
// }
} // END "Microsoft Internet Explorer"
/**
* ImageAnnotator
* Globally enabled per
* http://commons.wikimedia.org/?title=Commons:Village_pump&oldid=26818359#New_interface_feature
* Maintainer: [[User:Lupo]]
*/
// Not on Special pages, and only if viewing the page
//if (wgNamespaceNumber != -1 && jQuery.inArray(mw.config.get('wgAction'), ['view', 'purge']) != -1 ) {
// if (typeof ImageAnnotator_disable == 'undefined' || !ImageAnnotator_disable) {
// Don't even import it if it's disabled.
// importScript('MediaWiki:Gadget-ImageAnnotator.js');
// }
//}
if (wgNamespaceNumber != -1) importScript ('MediaWiki:Gadget-ImageAnnotator.js');
/** Table sorting fixes
* Description: Disables code in table sorting routine to set classes on even/odd rows
*/
ts_alternate_row_colors = false;
/**
* sort event-tables according to column 3.
*/
function presort() {
var table = document.getElementById("event-table");
if (table != null && table != 'undefined') {
var sortLink = table.rows[0].cells[2].lastChild;
ts_resortTable(sortLink);
}
}
/*
* 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)
*/
$j.resource = function (resourceKey) {
var lang = wgContentLanguage.split("-")[0]; // language: "pt-BR", "de-formal", etc.
return ($j.jI18n[lang] && $j.jI18n[lang][resourceKey] ?
$j.jI18n[lang][resourceKey] :
($j.jI18n.en[resourceKey]) ? $j.jI18n.en[resourceKey] : "MISSING RESOURCE");
};
/**
* Semantic Forms quit formtable class on edit
*/
function initHideFirstTemplate(){
var jTrHiddenFormTexts = $j(
// select only input type text from formtable
".lemmata-body"
);
jTrHiddenFormTexts
.parents('table:eq(0)')
.css({'display': 'none'});
}
//moveable TOCs
importScript('MediaWiki:MoveTOC.js');
// collapsible parts: div and tr → Template:Hidden
// may be fused later with toggleCollapse
// main difference: initCollapsebox() uses a switcher defined by the Wikitemplate
// and is not using a javascript resource title
function initCollapsebox() {
/* is nested in: div.collapsebox
└ div.switcher
└ div.collapsecontent */
jQuery("div.collapsebox div.switcher").live('click',
function() {
jQuery(this).nextAll("div.collapsecontent:first").slideToggle(250);
/* $(this).toggle() does not work in live as toggle is a bind()
therefore toggle must be bound to a different DOM element */
jQuery(this).find(".show, .hide").toggle();
});
/* is in a table: tr.collapsebox
└ div.switcher
tr.collapsecontent */
jQuery("tr.collapsebox div.switcher").live('click',
function() {
jQuery(this).closest("tr.collapsebox").nextAll("tr.collapsecontent:first").toggle();
jQuery(this).find(".show, .hide").toggle();
});
}// END initCollapsebox()
///////////////////////////////////
// confirm deletion using SMW forms
// does not work in IE 6
//////////////////////////////////
function initConfirmDeleteSubform() {
$j.extend(true, $j.jI18n, {
en: {
message : "'Delete this sub form irreversibly?'"
},
de: {
message : "'Dieses Teilformular unwiderruflich löschen?'"
}
});
// default buttons: <input type="button" ... class="remove"/>
$j("input.remove").attr("onClick", function() {// case sensitive not: onclick
//typeof this.onclick → function
var currentClickHandlerString = this.getAttributeNode('onclick').value;
// add a confirm
return "var removethis = confirm("+$j.resource('message')+"); if(removethis) {return " + currentClickHandlerString + "};";
});
/* added delete buttons by the SMW-form: <input type="button" />
add onclick handling */
$j("input.addAnother").click(function () {
// just new generated div#div_gen_1
$j("div")
.filter(function() { return this.id.match(/div_gen_\d+/); })
.find(":button")
.attr("onClick",function() {// case sensitive not: onclick
// add a confirm
return "var removethis = confirm("+$j.resource('message')+"); if(removethis) {$j('#' + String($j(this).parent().attr('id'))).remove();} else {return false;};";
});
});
}// end initConfirmDeleteSubform()
/*
///////////////////////////////////
// indicate hidden inputs created
// from template:Hidden
//////////////////////////////////
structure of template:Hidden:
div.collapsebox
├ div.switcher (float)
├ div.collapsetitle
└ div.collapsecontent
tr.collapsebox
└ th/td
├ div.switcher (float)
└ div.collapsetitle
tr.collapsecontent
*/
function initMarkHiddenInputs(){
var jDivHiddenFormTexts = $j(
// select only input type text + textarea with values
"div.collapsecontent.indicateHiddenInputs * :text[value!=]"
+", div.collapsecontent.indicateHiddenInputs * textarea[value!=]"
);
var jTrHiddenFormTexts = $j(
// select only input type text + textarea with values
"tr.collapsecontent.indicateHiddenInputs *:not(.collapsecontent) :text[value!=]"
+", tr.collapsecontent.indicateHiddenInputs *:not(.collapsecontent) textarea[value!=]"
);
// <div>
jDivHiddenFormTexts
.parents(".collapsebox")
.css({'border-left':'2px solid #ce5c00'});
//indicate the fields itself
jDivHiddenFormTexts
.css({'background-color':'#fcdeb1'}); //pale orange
// <tr>
//indicate the fields itself
jTrHiddenFormTexts
.css({'background-color':'#fcdeb1'}); //pale orange
//indicate current level
jTrHiddenFormTexts
.closest(".collapsebox")
.css({'border-left':'2px solid #ce5c00'});
// to ?upermost level
jTrHiddenFormTexts
.parents(".collapsecontent")
.prev(".collapsebox")
.css({'border-left':'2px solid #ce5c00'});
}// END initMarkHiddenInputs()
//$(window).bind('load', function()
$(window).load(function() {
// I changed rearranger image(by Adrian)
jQuery('img.rearrangerImage').attr('src','http://smw-cora.org/upload/Rearranger.png');
// I changed dull-blue-circle.png (from blue to orange) (by Adrian)
jQuery('img.timeline-copyright').attr('src','http://smw-cora.org/upload/Copyright-vertical.png');
jQuery('div.timeline-band-layer-inner > div > img').attr('src','http://smw-cora.org/upload/Dull-blue-circle.png');
//I changed the slim bottom lines (in fact it is border color left) from blue to orange (by Adrian)
jQuery('div.timeline-band-layer-inner > div').each(function(){
if(jQuery(this).css('border-left-color') == 'rgb(88, 160, 220)') {
jQuery(this).css('border-left-color','rgb(247,102,0)');
}
});
// I changed icon for resize image (by Adrian)
// jQuery('#buttondecreaseimagesize').attr('src','http://smw-cora.org/upload/Minus_size.png');
// jQuery('#buttonincreaseimagesize').attr('src','http://smw-cora.org/upload/Plus_size.png');
// Eliminated <---Resize---> (by Adrian)
// $("#SIAresizeDiv").contents().filter(function(){
// return (this.nodeType == 3);
// }).remove();
});
addOnloadHook(presort);
jQuery(document).ready(function() {
var $j = jQuery.noConflict;
// try to add the toolbar on uploading
var aa= jQuery('<a/>')
.attr("href", "http://smw-cora.org/index.php/Main_Page").attr("id","poweredbyCora");
jQuery("#footer-poweredbyico").append(aa);
var img = jQuery('<img />').attr({ 'id': 'poc', 'src': 'http://smw-cora.org/upload/SC_Credit.png', 'alt':'Powered by CorA Project' }).appendTo(jQuery('#poweredbyCora'));
/*jQuery('.smwtimeline').find('img').each(function () {
var curSrc = jQuery(this).attr('src');
var class = jQuery(this).attr('class');
alert("yes");
if ( class === '' ) {
jQuery(this).attr('src', 'http://smw-cora.org/upload/dull-blue-circle.png');
}
if ( class === 'timeline-copyright' ) {
jQuery(this).attr('src', 'http://example.com/brown.gif');
}
});
jQuery('.smwtimeline').on('DOMNodeInserted ', 'img', function(){
alert("insert");
jQuery(this).html('<b>yaay!</b>');
});*/
//Adrian - BEGIN - setting min-height of div.content - for push down #footer
jQuery('#content').css('min-height', Math.max(jQuery('#content').height(), jQuery('#mw-panel').height()));
//Adrian - END - setting height of div.content
// edit tools update
// upload new icons for tools
if(wgAction == "edit"){
jQuery('#mw-editbutton-bold').attr('src','http://smw-cora.org/upload/Button_bold.png');
jQuery('#mw-editbutton-italic').attr('src','http://smw-cora.org/upload/Button_italic.png');
jQuery('#mw-editbutton-link').attr('src','http://smw-cora.org/upload/Button_link.png');
jQuery('#mw-editbutton-extlink').attr('src','http://smw-cora.org/upload/Button_extlink.png');
jQuery('#mw-editbutton-headline').attr('src','http://smw-cora.org/upload/Button_headline.png');
jQuery('#mw-editbutton-image').attr('src','http://smw-cora.org/upload/Button_image.png');
jQuery('#mw-editbutton-media').attr('src','http://smw-cora.org/upload/Button_media.png');
jQuery('#mw-editbutton-nowiki').attr('src','http://smw-cora.org/upload/Button_nowiki.png');
jQuery('#mw-editbutton-signature').attr('src','http://smw-cora.org/upload/Button_sig.png');
jQuery('#mw-editbutton-hr').attr('src','http://smw-cora.org/upload/Button_hr.png');
}
if(wgPageName == "Special:Upload" && wgUserName){
$j("textarea#wpUploadDescription").before('<div id="toolbar"></div>');
}
// initmovingTOC(); // TOC CSS position fixed or static → MediaWiki:Gadget-moveTOC.js
initCollapsebox();//collapsable parts
// page specific
if(wgAction == "formedit" || wgPageName == "Special:FormEdit"){
initConfirmDeleteSubform();
initMarkHiddenInputs();
initHideFirstTemplate();
}
if(wgCanonicalSpecialPageName === "Browse"){
// alert("browse");
jQuery(".smwb-propvalue td").each(function(){
var data = [];
var kids = jQuery(this).children(".smwb-value");
if(kids.length>1){
for(var i=0; i<kids.length; i++){
data.push(kids[i].outerHTML);
}
// alert('xx '+data);
var stories = jQuery('.story-body');
kids.detach();
jQuery(this).empty();
var x=data.join("<br/>");
jQuery(x).appendTo(this);
}
});
}
/* if(wgPageName == "Special:OfflineImportLexicon"){
importScript('MediaWiki:OIL_Constants.js');
importScript('MediaWiki:jquery.ezpz_tooltip.min.js');
importScript('MediaWiki:OfflineImportLexicon.js');
importScript('MediaWiki:OfflineImportLexiconSecond.js');
}*/
if (wgNamespaceNumber != -1 && jQuery.inArray(mw.config.get('wgAction'), ['view']) != -1 ){
// importScript('MediaWiki:AQE-Constants.js');
// importScript('MediaWiki:Jquery.tools.min.js');
// importScript('MediaWiki:AnalysisQueryEditor.js');
// importScript('MediaWiki:AnalysisQueryEditorSecond.js');
}
});
importScript('MediaWiki:Multilingual description.js');
// </source>