MediaWiki:Common.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 62: | Zeile 62: | ||
//Chronik Toggle Buttons | //Chronik Toggle Buttons | ||
function | function chronikTogglerUpdate() { | ||
var toggles= | var toggles=[]; | ||
$("div.ChronikToggle").each(function(index) { | $("div.ChronikToggle").each(function(index) { | ||
var fullid=this.id; | var fullid=this.id; | ||
Zeile 73: | Zeile 73: | ||
var visible=true; | var visible=true; | ||
var classes=$(this).attr("class").split(' '); | var classes=$(this).attr("class").split(' '); | ||
for(line in classes) { | for(var line in classes) { | ||
if((typeof(toggles[classes[line]])!='undefined')&&(!toggles[classes[line]])) { | if((typeof(toggles[classes[line]])!='undefined')&&(!toggles[classes[line]])) { | ||
visible=false; | visible=false; | ||
Zeile 86: | Zeile 86: | ||
function createChronikTogglerSub(name,title) { | function createChronikTogglerSub(name,title) { | ||
var search=$("div.Chronik"+name); | |||
if(search.length===0) return; | |||
$("div.ChronikToggler").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ChronikToggle dunkel" id="ChronikToggle'+name+'">'+title+'</div>'); | $("div.ChronikToggler").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ChronikToggle dunkel" id="ChronikToggle'+name+'">'+title+'</div>'); | ||
$("#ChronikToggle"+name).click(function() { | $("#ChronikToggle"+name).click(function() { | ||
if($(this).hasClass("hell")) { | if($(this).hasClass("hell")) { | ||
$(this).removeClass("hell"); | $(this).removeClass("hell"); | ||
$(this).addClass("dunkel") | $(this).addClass("dunkel"); | ||
} else { | } else { | ||
$(this).removeClass("dunkel"); | $(this).removeClass("dunkel"); | ||
$(this).addClass("hell") | $(this).addClass("hell"); | ||
} | } | ||
chronikTogglerUpdate(); | |||
}); | }); | ||
} | } | ||
function createChronikToggler() { | function createChronikToggler() { | ||
$("div.ChronikToggler").append('<div style="display:inline-block;width:100px;text-align:right;margin:5px;font-size:0.7em;">Typ:</div>'); | |||
createChronikTogglerSub("Ereignis","Ereignis"); | createChronikTogglerSub("Ereignis","Ereignis"); | ||
createChronikTogglerSub("Herrscher","Herrscher"); | createChronikTogglerSub("Herrscher","Herrscher"); | ||
Zeile 106: | Zeile 109: | ||
createChronikTogglerSub("Traviabund","Traviabund"); | createChronikTogglerSub("Traviabund","Traviabund"); | ||
createChronikTogglerSub("Borontag","Borontag"); | createChronikTogglerSub("Borontag","Borontag"); | ||
$("div.ChronikToggler").append('<br/>< | $("div.ChronikToggler").append('<br/><div style="display:inline-block;width:100px;text-align:right;margin:5px;font-size:0.7em;">Zeit:</div>'); | ||
createChronikTogglerSub("Periode00","Vorzeiten"); | createChronikTogglerSub("Periode00","Vorzeiten"); | ||
createChronikTogglerSub("Periode01","Besiedlungszeit"); | createChronikTogglerSub("Periode01","Besiedlungszeit"); | ||
Zeile 126: | Zeile 129: | ||
mw.hook('wikipage.content').add(createChronikToggler); | mw.hook('wikipage.content').add(createChronikToggler); | ||
//Column Toggle Buttons | |||
function createColumnTogglerSub(count,title) { | |||
$("div.ColumnToggler").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ColumnToggle dunkel" id="ColumnToggle'+count+'">'+title+'</div>'); | |||
$("#ColumnToggle"+count).click(function() { | |||
$("div.ColumnToToggle").css("column-count",count); | |||
}); | |||
} | |||
function createColumnToggler() { | |||
createColumnTogglerSub("1","einspaltig"); | |||
createColumnTogglerSub("2","zweispaltig"); | |||
createColumnTogglerSub("3","dreispaltig"); | |||
} | |||
mw.hook('wikipage.content').add(createColumnToggler); | |||
//Stammbaum Buttons | |||
function createStammbaumButtons() { | |||
$("div.StammbaumButtons").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ColumnToggle dunkel" id="SBAusklappen">Ausklappen</div>'); | |||
$("div.StammbaumButtons").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ColumnToggle dunkel" id="SBEinklappen">Einklappen</div>'); | |||
$("div#SBAusklappen").click(function() { | |||
$("div.fancytree").fancytree("getTree").visit(function(node){ | |||
node.setExpanded(true); | |||
}); | |||
}); | |||
$("div#SBEinklappen").click(function() { | |||
$("div.fancytree").fancytree("getTree").visit(function(node){ | |||
node.setExpanded(false); | |||
}); | |||
}); | |||
} | |||
mw.hook('wikipage.content').add(createStammbaumButtons); |
Version vom 6. März 2018, 16:56 Uhr
var customizeToolbar = function() { $('#wpTextbox1').wikiEditor('addToToolbar', { 'sections': { 'garetienwiki': { 'type': 'toolbar', 'label': 'KoschWiki' } } } ); $('#wpTextbox1').wikiEditor('addToToolbar', { 'section': 'garetienwiki', 'groups': { 'briefspielbuttons': { 'label': 'Briefspiel' } } } ); $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'garetienwiki', group: 'briefspielbuttons', tools: { 'briefspielbuttonshaupt': { label: 'Hautpdarsteller ist', type: 'button', icon: '/images/8/88/Button_Hauptdarstellerist.png', action: { type: 'encapsulate', options: { pre: "Hauptdarsteller ist::" } } } } }); $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'garetienwiki', group: 'briefspielbuttons', tools: { 'briefspielbuttonsneben': { label: 'Nebendarsteller ist', type: 'button', icon: '/images/a/ab/Button_Nebendarstellerist.png', action: { type: 'encapsulate', options: { pre: "Nebendarsteller ist::" } } } } }); $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'garetienwiki', group: 'briefspielbuttons', tools: { 'briefspielbuttonsbrief': { label: 'Briefspieltext mit', type: 'button', icon: '/images/3/36/Button_Briefspieltextmit.png', action: { type: 'encapsulate', options: { pre: "Briefspieltext mit::" } } } } }); $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'garetienwiki', group: 'briefspielbuttons', tools: { 'briefspielbuttonsorthandl': { label: 'Handlungsort ist', type: 'button', icon: '/images/5/51/Button_Handlungsortist.png', action: { type: 'encapsulate', options: { pre: "Handlungsort ist::" } } } } }); $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'garetienwiki', group: 'briefspielbuttons', tools: { 'briefspielbuttonsortnenn': { label: 'Ortsnennung ist', type: 'button', icon: '/images/6/68/Button_Ortsnennungist.png', action: { type: 'encapsulate', options: { pre: "Ortsnennung ist::" } } } } }); $('#wpTextbox1').wikiEditor('addToToolbar', { section: 'garetienwiki', group: 'briefspielbuttons', tools: { 'briefspielbuttonsjahrist': { label: 'Jahr ist', type: 'button', icon: '/images/0/0c/Button_Jahrist.png', action: { type: 'encapsulate', options: { pre: "Jahr ist::" } } } } }); } 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 ); } ); } } ); } //Chronik Toggle Buttons function chronikTogglerUpdate() { var toggles=[]; $("div.ChronikToggle").each(function(index) { var fullid=this.id; var name=fullid.substring(13); toggles["Chronik"+name]=$("#"+fullid).hasClass("dunkel"); }); $("div.ChronikItem").each(function(index) { var wasvisible=$(this).is(":visible"); var visible=true; var classes=$(this).attr("class").split(' '); for(var line in classes) { if((typeof(toggles[classes[line]])!='undefined')&&(!toggles[classes[line]])) { visible=false; } } if((wasvisible)&&(!visible)) $(this).fadeOut(1000); if((!wasvisible)&&(visible)) $(this).fadeIn(1000); }); } function createChronikTogglerSub(name,title) { var search=$("div.Chronik"+name); if(search.length===0) return; $("div.ChronikToggler").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ChronikToggle dunkel" id="ChronikToggle'+name+'">'+title+'</div>'); $("#ChronikToggle"+name).click(function() { if($(this).hasClass("hell")) { $(this).removeClass("hell"); $(this).addClass("dunkel"); } else { $(this).removeClass("dunkel"); $(this).addClass("hell"); } chronikTogglerUpdate(); }); } function createChronikToggler() { $("div.ChronikToggler").append('<div style="display:inline-block;width:100px;text-align:right;margin:5px;font-size:0.7em;">Typ:</div>'); createChronikTogglerSub("Ereignis","Ereignis"); createChronikTogglerSub("Herrscher","Herrscher"); createChronikTogglerSub("Familie","Familie"); createChronikTogglerSub("Tsatag","Tsatag"); createChronikTogglerSub("Traviabund","Traviabund"); createChronikTogglerSub("Borontag","Borontag"); $("div.ChronikToggler").append('<br/><div style="display:inline-block;width:100px;text-align:right;margin:5px;font-size:0.7em;">Zeit:</div>'); createChronikTogglerSub("Periode00","Vorzeiten"); createChronikTogglerSub("Periode01","Besiedlungszeit"); createChronikTogglerSub("Periode02","Altes Reich"); createChronikTogglerSub("Periode03","Reichsgründung"); createChronikTogglerSub("Periode04","Kluge Kaiser"); createChronikTogglerSub("Periode05","Priesterkaiser"); createChronikTogglerSub("Periode06","Rohal / Magierkriege" ); createChronikTogglerSub("Periode07","Frühe Almadaner"); createChronikTogglerSub("Periode08","Späte Almadaner"); createChronikTogglerSub("Periode09","Kaiserlose Zeiten"); createChronikTogglerSub("Periode10","Perval"); createChronikTogglerSub("Periode11","Bardo und Cella"); createChronikTogglerSub("Periode12","Reto"); createChronikTogglerSub("Periode13","Hal"); createChronikTogglerSub("Periode14","Regentschaftsjahre"); createChronikTogglerSub("Periode15","Rohaja"); } mw.hook('wikipage.content').add(createChronikToggler); //Column Toggle Buttons function createColumnTogglerSub(count,title) { $("div.ColumnToggler").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ColumnToggle dunkel" id="ColumnToggle'+count+'">'+title+'</div>'); $("#ColumnToggle"+count).click(function() { $("div.ColumnToToggle").css("column-count",count); }); } function createColumnToggler() { createColumnTogglerSub("1","einspaltig"); createColumnTogglerSub("2","zweispaltig"); createColumnTogglerSub("3","dreispaltig"); } mw.hook('wikipage.content').add(createColumnToggler); //Stammbaum Buttons function createStammbaumButtons() { $("div.StammbaumButtons").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ColumnToggle dunkel" id="SBAusklappen">Ausklappen</div>'); $("div.StammbaumButtons").append('<div style="display:inline-block;width:100px;text-align:center;margin:5px;font-size:0.7em;cursor:pointer;" class="ColumnToggle dunkel" id="SBEinklappen">Einklappen</div>'); $("div#SBAusklappen").click(function() { $("div.fancytree").fancytree("getTree").visit(function(node){ node.setExpanded(true); }); }); $("div#SBEinklappen").click(function() { $("div.fancytree").fancytree("getTree").visit(function(node){ node.setExpanded(false); }); }); } mw.hook('wikipage.content').add(createStammbaumButtons);