KKeine Bearbeitungszusammenfassung |
KKeine Bearbeitungszusammenfassung |
||
| Zeile 36: | Zeile 36: | ||
$('.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.'); | ||
var | var dialing=false; | ||
var counter=0; | var counter=0; | ||
var address=[]; | var address=[]; | ||
$('.DHDGlyph').click(function(){ | $('.DHDGlyph').click(function(){ | ||
var GNum=$(this).attr('id').substr(4,2); | if(counter<9){ | ||
var GNum=$(this).attr('id').substr(4,2); | |||
if($.inArray(GNum, address)!==-1){ | |||
alert( | alert("Du hast dieses Symbol schon ausgewählt - es kann nicht zwei Mal in einer Stargate-Adresse vorkommen!"); | ||
}else{ | }else{ | ||
counter++; | counter++; | ||
if(! | if(!dialing){ | ||
$('.DHDResult').text("Du musst sieben | $('.DHDResult').text("Du musst sieben bis neun Symbole anwählen und dann mit der roten Mittelscheibe bestätigen. Ausgewählte Symbole:"); | ||
$(".DHDResList").css("display","block"); | $(".DHDResList").css("display","block"); | ||
dialing=true; | |||
} | } | ||
$(".DHDResList li:nth-child("+counter+")").text(GNum+" ").append($("<span>").addClass("DHDDButton").css('cursor','pointer').attr('id','DHDDButton'+counter).text("(Löschen)")); | $(".DHDResList li:nth-child("+counter+")").text(GNum+" ").append($("<span>").addClass("DHDDButton").css('cursor','pointer').css('color','#0645AD').attr('id','DHDDButton'+counter).text("(Löschen)")); | ||
address.push(GNum); | address.push(GNum); | ||
} | } | ||
}else{ | }else{ | ||
alert(" | alert("Whoa, whoa, nicht so viel... Eine Stargate-Adresse kann nur bis zu neun Symbolen haben!"); | ||
} | } | ||
}); | }); | ||
$('.DHDDButton').click(function(){ | $('.DHDDButton').click(function(){ | ||
var elemId=$(this).attr('id').substr(11,1); | var elemId=$(this).attr('id').substr(11,1); | ||
$("li:nth-child("+elemId+")").text(""); | $(".DHDResList li:nth-child("+elemId+")").text(""); | ||
counter--; | counter--; | ||
address[elemId]=null; | address[elemId-1]=null; | ||
}); | }); | ||
$('.DHDConfirm').click(function(){ | $('.DHDConfirm').click(function(){ | ||