From 180a41ce16df70a69d2dc4bb66044590fe851c72 Mon Sep 17 00:00:00 2001 From: Tailszefox Date: Tue, 28 Jan 2014 18:52:15 +0100 Subject: [PATCH] Prevent user from making a fusion with the same pony --- index.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/index.php b/index.php index b24f873..baa3ec5 100644 --- a/index.php +++ b/index.php @@ -186,8 +186,17 @@ else function getNewFusion() { + $("#to").find("option").removeAttr("disabled"); + $("#from").find("option").removeAttr("disabled"); + var from = $("#from").val(); var to = $("#to").val(); + var fromSelected = $("#from")[0].selectedIndex; + var toSelected = $("#to")[0].selectedIndex; + + $("#to")[0].options[fromSelected].disabled = true; + + $("#from")[0].options[toSelected].disabled = true; jQuery.get('fusion_ajax.php', {from: from, to: to}, function(data, textStatus, xhr) { $("#resultDivContent").html(data); @@ -197,6 +206,9 @@ else function randomizePonies(which) { + $("#to").find("option").removeAttr("disabled"); + $("#from").find("option").removeAttr("disabled"); + var nbPonies = $("#from option").size(); if(which == 0) @@ -245,6 +257,9 @@ else }); $("#buttonSwap").click(function (e) { + $("#to").find("option").removeAttr("disabled"); + $("#from").find("option").removeAttr("disabled"); + var from = $("#from").val(); var to = $("#to").val();