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