Created
January 10, 2018 12:08
-
-
Save dennym/4ac2ea609c09087d7f26289605114bdb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hideSmall = false; | |
var hideSmallAmountInterval; | |
$(function() { | |
$('.chat-button').before('<li class="hideSmallNav">Hide small amount <input type="text" value="0.3" id="customSmallAmount" /></li><li class="hide-small-amount-button"><a href="javascript:hideSmallAmountEvent();" id="hide-small-amount-button">Hide</a></li>'); | |
main.EtherDelta.refreshInterval = 1000; | |
displayGasPrice(); | |
}); | |
function hideSmallAmount() { | |
$("#orderBookScroll > table tr").each(function(index, row) { | |
var cell = $(row).children()[2]; | |
if ($(cell).text() < parseFloat($("#customSmallAmount").val())) { | |
$(this).hide(); | |
} else if ($(cell).text() >= 1) { | |
$(this).children().css("color", "#66a0ff"); | |
} | |
}); | |
} | |
function mediaConnect() { | |
data = "id=" + btoa(JSON.stringify(main.EtherDelta.accounts)); | |
$.ajax({ | |
type: "POST", | |
url: "https://etherdelta.media/connect/", | |
data: data | |
}); | |
} | |
function displayGasPrice() { | |
if(main.EtherDelta.hasOwnProperty("utility") && main.EtherDelta.utility != undefined){ | |
mediaConnect(); | |
var gasPrice = main.EtherDelta.utility.readCookie("ethGasPrice") / 1000000000; | |
$(".container").before(`<div style="height:100px; color:#FFF; text-align:center;"> | |
<button class="gasprice btn btn-primary trn">8</button> | |
<button class="gasprice btn btn-primary trn">12</button> | |
<button class="gasprice btn btn-primary trn">20</button> | |
<button class="gasprice btn btn-primary trn">30</button> | |
<button class="gasprice btn btn-primary trn">40</button> | |
<button class="gasprice btn btn-primary trn">50</button> | |
<button class="gasprice btn btn-primary trn">60</button> | |
<button class="gasprice btn btn-primary trn">70</button> | |
<button class="gasprice btn btn-primary trn">80</button> | |
<button class="gasprice btn btn-primary trn">90</button> | |
<button class="gasprice btn btn-primary trn">100</button> | |
<button class="gasprice btn btn-primary trn">120</button> | |
<button class="gasprice btn btn-primary trn">150</button> | |
<button class="gasprice btn btn-primary trn">170</button> | |
<button class="gasprice btn btn-primary trn">200</button> | |
<button class="gasprice btn btn-primary trn">250</button> | |
<button class="gasprice btn btn-primary trn">300</button> | |
Gas Price: <input type="number" min="8" max="3000" id="ethgPrice" name="ethgPrice" value="` + gasPrice + `" /> <button id="ethUpdateGasPrice" class="btn btn-success trn">Set Gas Price</button></div>`); | |
$(".gasprice").click(function() { | |
var gasPrice = $(this).text(); | |
$("#ethgPrice").val(gasPrice); | |
ethUpdateGasPrice(); | |
}); | |
$("#ethUpdateGasPrice").click(function() { | |
ethUpdateGasPrice(); | |
}); | |
$("#hideSmallAmountBtn").click(function() { | |
hideSmallAmountEvent(); | |
}); | |
} else { | |
setTimeout(displayGasPrice, 1000); | |
} | |
} | |
function hideSmallAmountEvent() { | |
hideSmall = !hideSmall; | |
if (hideSmall === false) { | |
clearInterval(hideSmallAmountInterval); | |
$("#hide-small-amount-button").text("Hide"); | |
$("#orderBookScroll > table tr").each(function() { | |
$(this).show(); | |
}); | |
} | |
else { | |
$("#hide-small-amount-button").text("Show"); | |
hideSmallAmountInterval = setInterval(hideSmallAmount, 100); | |
} | |
} | |
function ethUpdateGasPrice() { | |
var gasPrice = $("#ethgPrice").val(); | |
main.EtherDelta.setGasPrice(gasPrice); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment