protected function renderHEAD() { parent::renderHEAD(); }
protected function renderHEAD() { parent::renderHEAD(); ?> <script type="text/javascript" src="helper.js"></script> <script type="text/javascript"><!-- function update() { // highlights $("input:not([readonly])").each( function() { $(this).css("background", isNaN(parseInt($(this).val())) ? "white" : "greenyellow"); } ); // production updateProduction(); } function updateComparison(mineralConsumption, gasConsumption) { // resources mined var mineralMined = $("#mineralMined").html(); var gasMined = $("#gasMined").html(); // calculate consumed / mined var mineralRatio = mineralConsumption / mineralMined * 100; if(mineralConsumption == 0 && mineralMined == 0) { mineralRatio = 0; } var gasRatio = gasConsumption / gasMined * 100; if(gasConsumption == 0 && gasMined == 0) { gasRatio = 0; } $("#mineralRatio").html(mineralRatio.toFixed(0) + "%"); $("#gasRatio").html(gasRatio.toFixed(0) + "%"); // calculate surplus var surplus = []; if(mineralConsumption == 0 && mineralMined == 0) { } else if(mineralRatio == Number.POSITIVE_INFINITY) { surplus = surplus.concat("infinitely more minerals"); } else { surplus = surplus.concat(Math.abs(mineralRatio - 100).toFixed(0) + "% " + (mineralRatio > 100 ? "more" : "less") + " minerals"); } if(gasConsumption == 0 && gasMined == 0) { } else if(gasRatio == Number.POSITIVE_INFINITY) { surplus = surplus.concat("infinitely more gas"); } else { surplus = surplus.concat(Math.abs(gasRatio - 100).toFixed(0) + "% " + (gasRatio > 100 ? "more" : "less") + " gas"); } $(".surplus").html(surplus.join(" and ")); // calculate absolute surplus var mineralSurplus = mineralMined - mineralConsumption; var gasSurplus = gasMined - gasConsumption; $(".mineralSurplus").html(mineralSurplus.toFixed(2)); $(".gasSurplus").html(gasSurplus.toFixed(2)); } $(function() { // monitor input $("input").change(update); update(); }); //--></script> <script type="text/javascript"><!-- var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-18765033-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); //--></script> <?php }
/** * Render the page head. */ protected function renderHEAD() { parent::renderHEAD(); ?> <link rel="stylesheet" type="text/css" href="../datatables.css"/> <script type="text/javascript" src="../jquery.autogrowtextarea.js"></script> <script type="text/javascript" src="../jquery.datatables.js"></script> <script type="text/javascript"><!-- $(function() { $("textarea").corner("8px keep"); $("code.p").corner("8px"); $("table.code tr.first td:first-child").corner("8px top"); $("table.code tr.last td:first-child").corner("8px bottom"); $("textarea").autogrow().focus(); $(".update").click(function() { $.get("update.php", { buildOrder: $("#buildOrder").val()}, function(response) { $("#timing").html(response); $("#timing").effect("highlight", {}, 1500); $(".display td:last-child").addClass("last"); $(".display").dataTable({ bFilter: false, bPaginate: false, bInfo: false, aaSorting: [[0, "asc"]], fnRowCallback: function(nRow, aData, iDisplayIndex) { if(iDisplayIndex == 0) { $(nRow).addClass("first"); } else { $(nRow).removeClass("first"); } return nRow; } }); }); }); $("#1010gate").click(function() { $("#buildOrder").val("10 Pylon\n" + "10 Gateway [2]\n" + "12 Zealot* [3]\n" + "18 Pylon"); $("#buildOrder").trigger("change"); }); $("#4gate").click(function() { $("#buildOrder").val( "9 Pylon\n" + "10 Probe*\n" + "12 Gateway and scout\n" + "12 Probe*\n" + "14 Assimilator, then put 3 probes on gas (2 seconds)\n" + "16 Pylon\n" + "18 Cybernetics Core\n" + "19 Zealot\n" + "23 Pylon\n" + "24 Stalker\n" + "26 Warpgate**\n" + "27 Gateway\n" + "28 Sentry\n" + "30 Gateway [2], then Transform to Warpgate [4]\n" + "31 Pylon"); $("#buildOrder").trigger("change"); }); $("#1gatestar").click(function() { $("#buildOrder").val( "9 Pylon\n" + "10 Probe*\n" + "12 Gateway\n" + "12 Probe*\n" + "14 Assimilator, then put 3 probes on gas (2 seconds)\n" + "15 Probe*\n" + "16 Pylon\n" + "18 Cybernetics Core\n" + "18 Assimilator, then put 3 probes on gas (2 seconds)\n" + "18 Probe*\n" + "21 Stalker\n" + "23 Probe*\n" + "24 Stargate\n" + "24 Pylon\n" + "25 Warpgate\n" + "26 Stalker\n" + "29 Void Ray**\n"); $("#buildOrder").trigger("change"); }); $("#111").click(function() { $("#buildOrder").val( "10 Supply Depot\n" + "12 Barracks\n" + "13 Refinery, then put 3 SCVs on gas (2 seconds)\n" + "15 Orbital Command, then constant Calldown: MULE\n" + "15 Refinery, then put 3 SCVs on gas (2 seconds)\n" + "15 Marine\n" + "16 Supply Depot and Marine [2]\n" + "19 Factory\n" + "20 Reactor on Barracks\n" + "21 Starport\n" + "22 Tech Lab on Factory\n" + "23 Swap Tech Lab on Factory to Starport\n"); $("#buildOrder").trigger("change"); }); $("#3raxstim").click(function() { $("#buildOrder").val( "10 Supply Depot\n" + "12 Barracks\n" + "14 Refinery, then put 3 SCVs on gas (2 seconds)\n" + "16 Orbital Command, then constant Calldown: MULE\n" + "17 Barracks, then Tech Lab on Barracks, then Stimpack\n" + "18 Barracks, then Reactor on Barracks\n"); $("#buildOrder").trigger("change"); }); $("#6pool").click(function() { $("#buildOrder").val( "6 Spawning Pool\n" + "7 Zergling [3]\n" + "10 Overlord\n" + "10 Queen\n" + "12 Zergling\n"); $("#buildOrder").trigger("change"); }); $("#14pool15hatch").click(function() { $("#buildOrder").val( "9 Overlord\n" + "14 Spawning Pool (send @175 minerals)\n" + "15 Hatchery, then transfer 8 drones (10 seconds lost)\n" + "16 Extractor, then transfer 3 drones (2 seconds lost)\n" + "16 Queen, then Spawn Larvae\n" + "18 Overlord\n"); $("#buildOrder").trigger("change"); }); <?php if (strlen($this->buildOrder) > 0) { ?> $(".update").trigger("click"); <?php } ?> }); //--></script> <?php }
protected function renderHEAD() { parent::renderHEAD(); ?> <script type="text/javascript"><!-- $(function() { $("table.code tr.first td:first-child").corner("8px top"); $("table.code tr.last td:first-child").corner("8px bottom"); $("dl").corner("8px"); $("a[href^=\"#\"]").click(function() { var name = $(this).attr("href").substring(1); var anchor = $("a[name=\"" + name + "\"]"); $("h2", anchor).effect("highlight", {}, 1500); }); }); //--></script> <?php }