KKeine Bearbeitungszusammenfassung |
KKeine Bearbeitungszusammenfassung |
||
| (5 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 2: | Zeile 2: | ||
* JS-Skript für interaktives DHD | * JS-Skript für interaktives DHD | ||
* Für Import des Skripts einfach folgende Zeile (ohne den Stern am Anfang natürlich) in der eigenen Common.js einfügen: | * Für Import des Skripts einfach folgende Zeile (ohne den Stern am Anfang natürlich) in der eigenen Common.js einfügen: | ||
* if(mw.config.get('wgPageName')==="Benutzer:Col._o'neill/ | * if(mw.config.get('wgPageName')==="Benutzer:Col._o'neill/Tools") importScript("Benutzer:Col. o'neill/DHD.js"); | ||
**/ | **/ | ||
//TODO: | //TODO: ausgewählte Symbole bei SGU in Fernbedienungsfeld? Symbole & Mittelknopf evtl auf mouseover & click highlighten (shadow) | ||
function iLink(l,t){ | function iLink(l,t){ | ||
return $('<a>').attr('href','http://stargate-wiki.de/wiki/'+encodeURI(l)).attr('title',l).text(t||l); | return $('<a>').attr('href','http://stargate-wiki.de/wiki/'+encodeURI(l)).attr('title',l).text(t||l); | ||
| Zeile 74: | Zeile 74: | ||
{'name':'die '+iLink('Erde'),'addr':'10,15,20,26,28,13,18,06,30'} | {'name':'die '+iLink('Erde'),'addr':'10,15,20,26,28,13,18,06,30'} | ||
], | ], | ||
stock: | stock: null, | ||
init: function(){ | init: function(){ | ||
DHD. | DHD.stock = DHD.stockSG1; | ||
$('.DHDGlyph,.DHDConfirm').css('cursor','pointer'); | $('.DHDGlyph,.DHDConfirm').css('cursor','pointer'); | ||
$('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | $('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | ||
| Zeile 91: | Zeile 88: | ||
$('#DHDSGA,#DHDSGU').css('display','none'); | $('#DHDSGA,#DHDSGU').css('display','none'); | ||
$('#DHDSG1').css('display','block'); | $('#DHDSG1').css('display','block'); | ||
DHD.w.off(); | if(DHD.w) DHD.w.off(); | ||
$('#DHDSGU').off('mouseup').off('mousemove'); | $('#DHDSGU').off('mouseup').off('mousemove'); | ||
DHD.address=0; | DHD.address=0; | ||
DHD.address=[]; | DHD.address=[]; | ||
DHD.dialing=false; | DHD.dialing=false; | ||
$('#DHDResList | $('#DHDResList').empty(); | ||
$('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | $('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | ||
$('#DHDReset').css('display','none'); | $('#DHDReset').css('display','none'); | ||
| Zeile 106: | Zeile 102: | ||
$('#DHDSG1,#DHDSGU').css('display','none'); | $('#DHDSG1,#DHDSGU').css('display','none'); | ||
$('#DHDSGA').css('display','block'); | $('#DHDSGA').css('display','block'); | ||
DHD.w.off(); | if(DHD.w) DHD.w.off(); | ||
$('#DHDSGU').off('mouseup').off('mousemove'); | $('#DHDSGU').off('mouseup').off('mousemove'); | ||
DHD.counter=0; | DHD.counter=0; | ||
DHD.address=[]; | DHD.address=[]; | ||
DHD.dialing=false; | DHD.dialing=false; | ||
$('#DHDResList | $('#DHDResList').empty(); | ||
$('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | $('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | ||
$('#DHDReset').css('display','none'); | $('#DHDReset').css('display','none'); | ||
| Zeile 121: | Zeile 116: | ||
$('#DHDSG1,#DHDSGA').css('display','none'); | $('#DHDSG1,#DHDSGA').css('display','none'); | ||
$('#DHDSGU').css('display','block'); | $('#DHDSGU').css('display','block'); | ||
if(!DHD.w){ | |||
DHD.w=$('#DHDSGU-wheel'); | |||
DHD.w.css('cursor','grab'); | |||
DHD.cX = DHD.w.offset().left + 220; | |||
DHD.cY = DHD.w.offset().top + 220; | |||
} | |||
DHD.w.on('mousedown', function(e){ | DHD.w.on('mousedown', function(e){ | ||
DHD.dragging = true; | DHD.dragging = true; | ||
| Zeile 149: | Zeile 150: | ||
DHD.address=[]; | DHD.address=[]; | ||
DHD.dialing=false; | DHD.dialing=false; | ||
$('#DHDResList | $('#DHDResList').empty(); | ||
$('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | $('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | ||
$('#DHDReset').css('display','none'); | $('#DHDReset').css('display','none'); | ||
| Zeile 164: | Zeile 164: | ||
DHD.counter++; | DHD.counter++; | ||
if(!DHD.dialing){ | if(!DHD.dialing){ | ||
$('#DHDResult').text('Du musst sieben bis neun Symbole anwählen und dann mit der | $('#DHDResult').text('Du musst sieben bis neun Symbole anwählen und dann mit der Mittelscheibe bestätigen. Ausgewählte Symbole:'); | ||
$('#DHDReset').css('display','inline'); | $('#DHDReset').css('display','inline'); | ||
DHD.dialing=true; | DHD.dialing=true; | ||
} | } | ||
$(' | $(this).children("img").clone().removeAttr('width').attr('height', '38px').css({'width': '', 'height': '38px', 'margin-right': '5px'}).appendTo('#DHDResList'); | ||
DHD.address.push(gNum); | DHD.address.push(gNum); | ||
} | } | ||
| Zeile 190: | Zeile 188: | ||
$('#DHDResult').text('Du hast ').append(DHD.found).append(' angewählt. Stelle Dir nun einen ').append(iLink('Kawoosh')).append(' vor. :D'); | $('#DHDResult').text('Du hast ').append(DHD.found).append(' angewählt. Stelle Dir nun einen ').append(iLink('Kawoosh')).append(' vor. :D'); | ||
}else{ | }else{ | ||
$('#DHDResult').text('Zu Deinen angewählten Symbolen | $('#DHDResult').text('Zu Deinen angewählten Symbolen konnte keine passende Adresse gefunden werden. Versuch es nochmal - Du findest eine Liste aller bekannten Toradressen unter ').append(iLink('Liste von Toradressen')).append('.'); | ||
} | } | ||
DHD.counter=0; | DHD.counter=0; | ||
| Zeile 204: | Zeile 202: | ||
DHD.address=[]; | DHD.address=[]; | ||
DHD.dialing=false; | DHD.dialing=false; | ||
$('#DHDResList | $('#DHDResList').empty(); | ||
$('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | $('#DHDResult').text('Du hast noch kein Symbol angewählt.'); | ||
$('#DHDReset').css('display','none'); | $('#DHDReset').css('display','none'); | ||
| Zeile 211: | Zeile 208: | ||
}, | }, | ||
}; | }; | ||
$(DHD.init); | |||