diff --git a/index.html b/index.html index 382d642d..7bf890b8 100644 --- a/index.html +++ b/index.html @@ -78,7 +78,7 @@ - + diff --git a/js/main.js b/js/main.js index 6b1727cc..c0b3c584 100644 --- a/js/main.js +++ b/js/main.js @@ -8,6 +8,7 @@ $(document).ready(function() { var variants = ["color", "black", "icon", "white"]; var iconDefault = "black"; var iconHover = "color"; + var url = 'https://api.coinmarketcap.com/v1/ticker/?limit=0' // ------------------------------ @@ -26,40 +27,43 @@ $(document).ready(function() { // ------------------------------ // Get list of icons in manifest // ------------------------------ - $.getJSON(dataJson, function(data) { + $.get(url, function(coins){ + $.getJSON(dataJson, function(data) { + var icons = ""; + var count = 0; + data.icons.forEach(function(icon) { + var coin = coins.find(function(coin){ + return coin.symbol.toLowerCase() === icon + }) + var name = coin ? coin.name.toLowerCase() : icon + // Construct icon + if (icons.indexOf("data-icon=\"" + icon + "\"") === -1) { + icons += "
"; + icons += ""; + icons += "\""" + icon; + icons += ""; + icons += "
"; + count++; + } + }); - var icons = ""; - var count = 0; - $.each(data.icons, function(key, val) { + // Display + $(".row.icons").html(icons); - // Construct icon - if (icons.indexOf("data-icon=\"" + val + "\"") == -1) { - icons += "
"; - icons += ""; - icons += "\""" + val; - icons += ""; - icons += "
"; - count++; - } + // Hover + $(".icon").hover(function() { + changeFolder($(this), iconDefault, iconHover); + }); + + // Mouseleave + $(".icon").mouseleave(function() { + changeFolder($(this), iconHover, iconDefault ); + }); + + // Count icons + $(".count-cryptos").text(count); }); - - // Display - $(".row.icons").html(icons); - - // Hover - $(".icon").hover(function() { - changeFolder($(this), iconDefault, iconHover); - }); - - // Mouseleave - $(".icon").mouseleave(function() { - changeFolder($(this), iconHover, iconDefault ); - }); - - // Count icons - $(".count-cryptos").text(count); - }); @@ -167,6 +171,7 @@ $(document).ready(function() { // Filter icons $(".icon").css("display", "none"); $("a[data-icon*='" + $(target).val().toLowerCase() + "']").parent().css("display", "block"); + $("a[data-name*='" + $(target).val().toLowerCase() + "']").parent().css("display", "block"); // Close $("
").insertAfter(target); diff --git a/js/main.min.js b/js/main.min.js index a6b761b7..8b137891 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1 +1 @@ -function error(t){$(t).parent().parent().remove()}$(document).ready(function(){function t(t,e,o){var t=$(t).find("img"),a=$(t).attr("src").replace(e,o);$(t).attr("src",a)}function e(t){$(t).val().length>0?($(".icon").css("display","none"),$("a[data-icon*='"+$(t).val().toLowerCase()+"']").parent().css("display","block"),$('').insertAfter(t),$(".close-search").click(function(){o(t)})):o(t)}function o(t){$(".close-search").remove(),$(".icon").css("display","block"),$(t).val("")}var a=["svg","128","32","32@2x"],c=["color","black","icon","white"];$("form .search").on("input",function(){e($(this))}),$("form").submit(function(t){t.preventDefault(),e($("form .search"))}),$.getJSON("manifest.json",function(e){var o="",a=0;$.each(e.icons,function(t,e){-1==o.indexOf('data-icon="'+e+'"')&&(o+='
',o+='',o+=''+e+''+e,o+="",o+="
",a++)}),$(".row.icons").html(o),$(".icon").hover(function(){t($(this),"black","color")}),$(".icon").mouseleave(function(){t($(this),"color","black")}),$(".count-cryptos").text(a)}),$("#infoIcon").on("show.bs.modal",function(t){var e=$(t.relatedTarget),o=$(this),n=e.data("icon"),r="",i=0,l=0;for(r+='',r+="",r+="",r+='";c[l];){s=a[i].replace("@","-");r+='",l++}for(l=0,r+="",r+="",r+="";a[i];){var s;if(r+="",r+='","svg"==a[i])d=".svg";else if("32@2x"==a[i])d="@2x.png";else var d=".png";for(;c[l];)r+='",l++;l=0,i++,r+=""}r+="",r+="
'+n+"
'+c[l]+"
'+a[i]+"',r+=''+n+'',r+="
",o.find(".modal-title").text(n),o.find(".modal-body").html(r)})}); \ No newline at end of file + diff --git a/manifest.json b/manifest.json index 7a4cc1bb..f0dc6b7a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,297 +1,296 @@ { - "icons": { - "act": "act", - "ada": "ada", - "adx": "adx", - "ae": "ae", - "agi": "agi", - "agrs": "agrs", - "aion": "aion", - "amb": "amb", - "amp": "amp", - "ant": "ant", - "appc": "appc", - "ardr": "ardr", - "ark": "ark", - "arn": "arn", - "ast": "ast", - "atm": "atm", - "bat": "bat", - "bay": "bay", - "bcc": "bcc", - "bcd": "bcd", - "bch": "bch", - "bcn": "bcn", - "bco": "bco", - "bcpt": "bcpt", - "bdl": "bdl", - "bela": "bela", - "bix": "bix", - "blcn": "blcn", - "blk": "blk", - "block": "block", - "blz": "blz", - "bnb": "bnb", - "bnt": "bnt", - "bnty": "bnty", - "bpt": "bpt", - "bq": "bq", - "bqx": "bqx", - "brd": "brd", - "btc": "btc", - "btcd": "btcd", - "btcz": "btcz", - "btg": "btg", - "btm": "btm", - "bts": "bts", - "btx": "btx", - "burst": "burst", - "cdn": "cdn", - "cdt": "cdt", - "clam": "clam", - "cloak": "cloak", - "cmt": "cmt", - "cnd": "cnd", - "cnx": "cnx", - "cny": "cny", - "cob": "cob", - "cred": "cred", - "crpt": "crpt", - "cvc": "cvc", - "dash": "dash", - "dat": "dat", - "data": "data", - "dbc": "dbc", - "dcn": "dcn", - "dcr": "dcr", - "dent": "dent", - "dew": "dew", - "dgb": "dgb", - "dgd": "dgd", - "dlt": "dlt", - "dnt": "dnt", - "doge": "doge", - "drgn": "drgn", - "dta": "dta", - "dtr": "dtr", - "ebst": "ebst", - "edg": "edg", - "edo": "edo", - "edoge": "edoge", - "elf": "elf", - "ella": "ella", - "elix": "elix", - "emc": "emc", - "emc2": "emc2", - "eng": "eng", - "enj": "enj", - "equa": "equa", - "eos": "eos", - "etc": "etc", - "eth": "eth", - "ethos": "ethos", - "etn": "etn", - "etp": "etp", - "eur": "eur", - "evx": "evx", - "exmo": "exmo", - "exp": "exp", - "fair": "fair", - "fct": "fct", - "fil": "fil", - "fldc": "fldc", - "flo": "flo", - "ftc": "ftc", - "fuel": "fuel", - "fun": "fun", - "game": "game", - "gas": "gas", - "gbp": "gbp", - "gbx": "gbx", - "gbyte": "gbyte", - "gno": "gno", - "gnt": "gnt", - "grc": "grc", - "grs": "grs", - "gto": "gto", - "gvt": "gvt", - "gup": "gup", - "gxs": "gxs", - "hpb": "hpb", - "hsr": "hsr", - "html": "html", - "huc": "huc", - "hush": "hush", - "icn": "icn", - "icx": "icx", - "ignis": "ignis", - "ink": "ink", - "ins": "ins", - "ion": "ion", - "iop": "iop", - "iost": "iost", - "iot": "miota", - "iota": "miota", - "jnt": "jnt", - "jpy": "jpy", - "kcs": "kcs", - "kin": "kin", - "kmd": "kmd", - "knc": "knc", - "krb": "krb", - "lbc": "lbc", - "lend": "lend", - "link": "link", - "lkk": "lkk", - "lrc": "lrc", - "lsk": "lsk", - "ltc": "ltc", - "lun": "lun", - "maid": "maid", - "mana": "mana", - "mcap": "mcap", - "mco": "mco", - "mds": "mds", - "med": "med", - "miota": "miota", - "mkr": "mkr", - "mln": "mln", - "mnx": "mnx", - "mona": "mona", - "mth": "mth", - "mtl": "mtl", - "music": "music", - "nano": "nano", - "nav": "nav", - "nas": "nas", - "nebl": "nebl", - "neo": "neo", - "neos": "neos", - "ndz": "ndz", - "ngc": "ngc", - "nlc2": "nlc2", - "nlg": "nlg", - "nmc": "nmc", - "nuls": "nuls", - "nxs": "nxs", - "nxt": "nxt", - "oax": "oax", - "omg": "omg", - "omni": "omni", - "ost": "ost", - "ox": "ox", - "pac": "pac", - "part": "part", - "pasl": "pasl", - "pay": "pay", - "pink": "pink", - "pirl": "pirl", - "pivx": "pivx", - "plr": "plr", - "poe": "poe", - "poly": "poly", - "pot": "pot", - "powr": "powr", - "ppc": "ppc", - "ppp": "ppp", - "ppt": "ppt", - "prl": "prl", - "pura": "pura", - "qash": "qash", - "qiwi": "qiwi", - "qlc": "qlc", - "qrl": "qrl", - "qsp": "qsp", - "qtum": "qtum", - "r": "r", - "rads": "rads", - "rcn": "rcn", - "rdd": "rdd", - "rdn": "rdn", - "rep": "rep", - "req": "req", - "rhoc": "rhoc", - "ric": "ric", - "rise": "rise", - "rlc": "rlc", - "rpx": "rpx", - "rub": "rub", - "salt": "salt", - "san": "san", - "sbd": "sbd", - "sberbank": "sberbank", - "sc": "sc", - "sky": "sky", - "sls": "sls", - "smart": "smart", - "sngls": "sngls", - "snm": "sonm", - "snt": "snt", - "spank": "spank", - "sphtx": "sphtx", - "srn": "srn", - "start": "start", - "steem": "steem", - "storj": "storj", - "storm": "storm", - "strat": "strat", - "sub": "sub", - "sys": "sys", - "taas": "taas", - "tau": "tau", - "tel": "tel", - "theta": "theta", - "tix": "tix", - "tkn": "tkn", - "tnb": "tnb", - "tnc": "tnc", - "tnt": "tnt", - "trig": "trig", - "trx": "trx", - "tzc": "tzc", - "ubq": "ubq", - "unity": "unity", - "usd": "usd", - "usdt": "usdt", - "utk": "utk", - "ven": "ven", - "veri": "veri", - "via": "via", - "vibe": "vibe", - "vivo": "vivo", - "vrc": "vrc", - "vtc": "vtc", - "wabi": "wabi", - "waves": "waves", - "wax": "wax", - "wgr": "wgr", - "wpr": "wpr", - "wtc": "wtc", - "xas": "xas", - "xbc": "xbc", - "xby": "xby", - "xcp": "xcp", - "xdn": "xdn", - "xem": "xem", - "xlm": "xlm", - "xmg": "xmg", - "xmr": "xmr", - "xmy": "xmy", - "xp": "xp", - "xpa": "xpa", - "xpm": "xpm", - "xrb": "nano", - "xrp": "xrp", - "xtz": "xtz", - "xuc": "xuc", - "xvc": "xvc", - "xvg": "xvg", - "xzc": "xzc", - "yoyow": "yoyow", - "zcl": "zcl", - "zec": "zec", - "zen": "zen", - "zil": "zil", - "zrx": "zrx" - } + "icons": [ + "act", + "ada", + "adx", + "ae", + "agi", + "agrs", + "aion", + "amb", + "amp", + "ant", + "appc", + "ardr", + "ark", + "arn", + "ast", + "atm", + "bat", + "bay", + "bcc", + "bcd", + "bch", + "bcn", + "bco", + "bcpt", + "bdl", + "bela", + "bix", + "blcn", + "blk", + "block", + "blz", + "bnb", + "bnt", + "bnty", + "bpt", + "bq", + "bqx", + "brd", + "btc", + "btcd", + "btcz", + "btg", + "btm", + "bts", + "btx", + "burst", + "cdn", + "cdt", + "clam", + "cloak", + "cmt", + "cnd", + "cnx", + "cny", + "cob", + "cred", + "crpt", + "cvc", + "dash", + "dat", + "data", + "dbc", + "dcn", + "dcr", + "dent", + "dew", + "dgb", + "dgd", + "dlt", + "dnt", + "doge", + "drgn", + "dta", + "dtr", + "ebst", + "edg", + "edo", + "edoge", + "elf", + "ella", + "elix", + "emc", + "emc2", + "eng", + "enj", + "equa", + "eos", + "etc", + "eth", + "ethos", + "etn", + "etp", + "eur", + "evx", + "exmo", + "exp", + "fair", + "fct", + "fil", + "fldc", + "flo", + "ftc", + "fuel", + "fun", + "game", + "gas", + "gbp", + "gbx", + "gbyte", + "gno", + "gnt", + "grc", + "grs", + "gto", + "gvt", + "gup", + "gxs", + "hpb", + "hsr", + "html", + "huc", + "hush", + "icn", + "icx", + "ignis", + "ink", + "ins", + "ion", + "iop", + "iost", + "iot", + "miota", + "jnt", + "jpy", + "kcs", + "kin", + "kmd", + "knc", + "krb", + "lbc", + "lend", + "link", + "lkk", + "lrc", + "lsk", + "ltc", + "lun", + "maid", + "mana", + "mcap", + "mco", + "mds", + "med", + "miota", + "mkr", + "mln", + "mnx", + "mona", + "mth", + "mtl", + "music", + "nano", + "nav", + "nas", + "nebl", + "neo", + "neos", + "ndz", + "ngc", + "nlc2", + "nlg", + "nmc", + "nuls", + "nxs", + "nxt", + "oax", + "omg", + "omni", + "ost", + "ox", + "pac", + "part", + "pasl", + "pay", + "pink", + "pirl", + "pivx", + "plr", + "poe", + "poly", + "pot", + "powr", + "ppc", + "ppp", + "ppt", + "prl", + "pura", + "qash", + "qiwi", + "qlc", + "qrl", + "qsp", + "qtum", + "r", + "rads", + "rcn", + "rdd", + "rdn", + "rep", + "req", + "rhoc", + "ric", + "rise", + "rlc", + "rpx", + "rub", + "salt", + "san", + "sbd", + "sberbank", + "sc", + "sky", + "sls", + "smart", + "sngls", + "snt", + "spank", + "sphtx", + "srn", + "start", + "steem", + "storj", + "storm", + "strat", + "sub", + "sys", + "taas", + "tau", + "tel", + "theta", + "tix", + "tkn", + "tnb", + "tnc", + "tnt", + "trig", + "trx", + "tzc", + "ubq", + "unity", + "usd", + "usdt", + "utk", + "ven", + "veri", + "via", + "vibe", + "vivo", + "vrc", + "vtc", + "wabi", + "waves", + "wax", + "wgr", + "wpr", + "wtc", + "xas", + "xbc", + "xby", + "xcp", + "xdn", + "xem", + "xlm", + "xmg", + "xmr", + "xmy", + "xp", + "xpa", + "xpm", + "nano", + "xrp", + "xtz", + "xuc", + "xvc", + "xvg", + "xzc", + "yoyow", + "zcl", + "zec", + "zen", + "zil", + "zrx" + ] }