diff --git a/data/coins.js b/data/coins.js index 6d073535..f2bdcff8 100644 --- a/data/coins.js +++ b/data/coins.js @@ -1,910 +1,927 @@ -const coinJSON = [ - // A - 9 - { - "Name": "Cardano", - "Ticker": "ADA", - "Icon": "ADA-alt", - "Colour": "386FCC" - }, - { - "Name": "AudioCoin", - "Ticker": "ADC", - "Icon": "ADC", - "Colour": "5DADDE" - }, - { - "Name": "AeonCoin", - "Ticker": "AEON", - "Icon": "AEON-alt", - "Colour": "383E47" - }, - { - "Name": "Synereo", - "Ticker": "AMP", - "Icon": "AMP", - "Colour": "4FA9DD" - }, - { - "Name": "Anoncoin", - "Ticker": "ANC", - "Icon": "ANC", - "Colour": "A6A6A6" - }, - { - "Name": "ArchCoin", - "Ticker": "ARCH", - "Icon": "ARCH", - "Colour": "#071F40" - }, - { - "Name": "Ardor", - "Ticker": "ARDR", - "Icon": "ARDR-alt", - "Colour": "4F87C2" - }, - { - "Name": "ARK", - "Ticker": "ARK", - "Icon": "ARK-alt", - "Colour": "4B96C0" - }, - { - "Name": "Aurora Coin", - "Ticker": "AUR", - "Icon": "AUR-alt", - "Colour": "80B17C" - }, - // B - 15, 2 custom - { - "Name": "BANX", - "Ticker": "BANX", - "Icon": "BANX", - "Colour": "FFFFFF" - }, - { - "Name": "BAT", - "Ticker": "BAT", - "Icon": "BAT-alt", - "Colour": "912D61" - }, - { - "Name": "BitBay", - "Ticker": "BAY", - "Icon": "BAY-alt", - "Colour": "449DDD" - }, - { - "Name": "BC", - "Ticker": "BC", - "Icon": "BC", - "Colour": "FFFFFF" - }, - { - "Name": "Bitcoin Cash", - "Ticker": "BCH", - "Icon": "BCH-alt", - "Colour": "719734" - }, - { - "Name": "Bitcoin Gold", - "Ticker": "BTG", - "Icon": "../../../img/temp/btg", - "Colour": "D29C3D" - }, - { - "Name": "Bitconnect", - "Ticker": "BCCOIN", - "Icon": "../../../img/temp/bcc", - "Colour": "EC8C37" - }, - { - "Name": "ByteCoin", - "Ticker": "BCN", - "Icon": "BCN", - "Colour": "DE5185" - }, - { - "Name": "BFT", - "Ticker": "BFT", - "Icon": "BFT", - "Colour": "FFFFFF" - }, - { - "Name": "BreakoutCoin", - "Ticker": "BRK", - "Icon": "BRK-alt", - "Colour": "3060B6" - }, - { - "Name": "Breakout Stake", - "Ticker": "BRX", - "Icon": "BRX-alt", - "Colour": "92A934" - }, - { - "Name": "BitSend", - "Ticker": "BSD", - "Icon": "BSD-alt", - "Colour": "3B86E0" - }, - { - "Name": "Bata", - "Ticker": "BTA", - "Icon": "BTA", - "Colour": "3E45C4" - }, - { - "Name": "Bitcoin", - "Ticker": "BTC", - "Icon": "BTC", - "Colour": "F38208" - }, - { - "Name": "BitcoinDark", - "Ticker": "BTCD", - "Icon": "BTCD", - "Colour": "ED6E2E" - }, - { - "Name": "BitMark", - "Ticker": "BTM", - "Icon": "BTM-alt", - "Colour": "2E0B62" - }, - { - "Name": "Bitshares", - "Ticker": "BTS", - "Icon": "BTS", - "Colour": "2D6C92" - }, - // C - 2 - { - "Name": "CLAMS", - "Ticker": "CLAM", - "Icon": "CLAM-alt", - "Colour": "BAC5C0" - }, - { - "Name": "CloakCoin", - "Ticker": "CLOAK", - "Icon": "CLOAK-alt", - "Colour": "CD4D32" - }, - // D - 9 - { - "Name": "Dash", - "Ticker": "DASH", - "Icon": "DASH", - "Colour": "3875B7" - }, - { - "Name": "DAO", - "Ticker": "DAO", - "Icon": "DAO-alt", - "Colour": "FFFFFF" - }, - { - "Name": "Decred", - "Ticker": "DCR", - "Icon": "DCR-alt", - "Colour": "69D4A6" - }, - { - "Name": "Decent", - "Ticker": "DCT", - "Icon": "DCT-alt", - "Colour": "3F8E73" - }, - { - "Name": "DigiByte", - "Ticker": "DGB", - "Icon": "DGB-alt", - "Colour": "2E67BF" - }, - { - "Name": "Digix DAO", - "Ticker": "DGD", - "Icon": "DGD", - "Colour": "173747" - }, - { - "Name": "DGX", - "Ticker": "DGX", - "Icon": "DGX", - "Colour": "FFFFFF" - }, - { - "Name": "Diamond", - "Ticker": "DMD", - "Icon": "DMD", - "Colour": "D8E4E7" - }, - { - "Name": "Dogecoin", - "Ticker": "DOGE", - "Icon": "DOGE", - "Colour": "B4A146" - }, - // E - 5 - { - "Name": "Emercoin", - "Ticker": "EMC", - "Icon": "EMC-alt", - "Colour": "BAAACF" - }, - { - "Name": "EOS", - "Ticker": "EOS", - "Icon": "EOS-alt", - "Colour": "828282" - }, - { - "Name": "ERC", - "Ticker": "ERC", - "Icon": "ERC", - "Colour": "FFFFFF" - }, - { - "Name": "Ethereum", - "Ticker": "ETH", - "Icon": "ETH", - "Colour": "8B92AF" - }, - { - "Name": "Ethereum Classic", - "Ticker": "ETC", - "Icon": "ETC-alt", - "Colour": "4E7840" - }, - // F - 5 - { - "Name": "Fuel2Coin", - "Ticker": "FC2", - "Icon": "FC2", - "Colour": "9FA1A3" - }, - { - "Name": "Factoids", - "Ticker": "FCT", - "Icon": "FCT-alt", - "Colour": "50789E" - }, - { - "Name": "FlorinCoin", - "Ticker": "FLO", - "Icon": "FLO-alt", - "Colour": "BCBDBE" - }, - { - "Name": "Franko", - "Ticker": "FRK", - "Icon": "FRK", - "Colour": "1040D0" - }, - { - "Name": "FeatherCoin", - "Ticker": "FTC", - "Icon": "FTC", - "Colour": "F5F5F5" - }, - // G - 10 - { - "Name": "Gamecredits", - "Ticker": "GAME", - "Icon": "GAME-alt", - "Colour": "A0BD43" - }, - { - "Name": "Byteball", - "Ticker": "GBYTE", - "Icon": "GBYTE-alt", - "Colour": "A0BD43" - }, - { - "Name": "GrandCoin", - "Ticker": "GDC", - "Icon": "GDC-alt", - "Colour": "F4B53F" - }, - { - "Name": "Gemz Social", - "Ticker": "GEMZ", - "Icon": "GEMZ", - "Colour": "E17673" - }, - { - "Name": "GoldCoin", - "Ticker": "GLD", - "Icon": "GLD-alt", - "Colour": "D1993B" - }, - { - "Name": "Gnosis", - "Ticker": "GNO", - "Icon": "GNO-alt", - "Colour": "49A4C1" - }, - { - "Name": "GNT", - "Ticker": "GNT", - "Icon": "GNT-alt", - "Colour": "62A0BC" - }, - { - "Name": "Golos", - "Ticker": "GOLOS", - "Icon": "GOLOS-alt", - "Colour": "3A6CB0" - }, - { - "Name": "GridCoin", - "Ticker": "GRC", - "Icon": "GRC-alt", - "Colour": "544D44" - }, - { - "Name": "Groestlcoin", - "Ticker": "GRS", - "Icon": "GRS", - "Colour": "39849B" - }, - // H - 1 - { - "Name": "Heat Ledger", - "Ticker": "HEAT", - "Icon": "HEAT-alt", - "Colour": "EA4125" - }, - // I - 5 - { - "Name": "Iconomi", - "Ticker": "ICN", - "Icon": "ICN-alt", - "Colour": "4A9076" - }, - { - "Name": "Infinite Coin", - "Ticker": "IFC", - "Icon": "IFC", - "Colour": "F4B44B" - }, - { - "Name": "Incent", - "Ticker": "INCNT", - "Icon": "INCNT-alt", - "Colour": "F3B356" - }, - { - "Name": "IOCoin", - "Ticker": "IOC", - "Icon": "IOC", - "Colour": "7FBEEB" - }, - { - "Name": "IOTA", - "Ticker": "IOT", - "Icon": "IOTA-alt", - "Colour": "647782" - }, - // J - 1 - { - "Name": "JumBucks Coin", - "Ticker": "JBS", - "Icon": "JBS-alt", - "Colour": "2E71B6" - }, - // K - 3 - { - "Name": "Komodo", - "Ticker": "KMD", - "Icon": "KMD-alt", - "Colour": "5C7D7D" - }, - { - "Name": "KoboCoin", - "Ticker": "KOBO", - "Icon": "KOBO", - "Colour": "90BF57" - }, - { - "Name": "Kore", - "Ticker": "KORE", - "Icon": "KORE", - "Colour": "DD5539" - }, - // L - 4 - { - "Name": "LBRY Credits", - "Ticker": "LBC", - "Icon": "LBC-alt", - "Colour": "2F5C4E" - }, - { - "Name": "LiteDoge", - "Ticker": "LDOGE", - "Icon": "LDOGE", - "Colour": "F7CC48" - }, - { - "Name": "Lisk", - "Ticker": "LSK", - "Icon": "LSK-alt", - "Colour": "326792" - }, - { - "Name": "Litecoin", - "Ticker": "LTC", - "Icon": "LTC", - "Colour": "BEBEBE" - }, - // M - 8 - { - "Name": "MaidSafe Coin", - "Ticker": "MAID", - "Icon": "MAID", - "Colour": "9FBDE2" - }, - { - "Name": "Monaco", - "Ticker": "MCO", - "Icon": "MCO-alt", - "Colour": "DE715C" - }, - { - "Name": "MintCoin", - "Ticker": "MINT", - "Icon": "MINT-alt", - "Colour": "A1C681" - }, - { - "Name": "MonaCoin", - "Ticker": "MONA", - "Icon": "MONA-alt", - "Colour": "A9966A" - }, - { - "Name": "MRC", - "Ticker": "MRC", - "Icon": "MRC", - "Colour": "FFFFFF" - }, - { - "Name": "MasterCoin", - "Ticker": "MSC", - "Icon": "MSC", - "Colour": "235787" - }, - { - "Name": "MTR", - "Ticker": "MTR", - "Icon": "MTR", - "Colour": "8E2721" - }, - { - "Name": "MonetaryUnit", - "Ticker": "MUE", - "Icon": "MUE", - "Colour": "FAEB4F" - }, - // N - 9 - { - "Name": "NuBits", - "Ticker": "NBT", - "Icon": "NBT", - "Colour": "F5BC43" - }, - { - "Name": "NEO", - "Ticker": "NEO", - "Icon": "NEO-alt", - "Colour": "B6D746" - }, - { - "Name": "NeosCoin", - "Ticker": "NEOS", - "Icon": "NEOS-alt", - "Colour": "F1E65B" - }, - { - "Name": "Neumark", - "Ticker": "NEU", - "Icon": "NEU-alt", - "Colour": "D8E04B" - }, - { - "Name": "Gulden", - "Ticker": "NLG", - "Icon": "NLG-alt", - "Colour": "153E77" - }, - { - "Name": "NameCoin", - "Ticker": "NMC", - "Icon": "NMC", - "Colour": "668FBD" - }, - { - "Name": "Dnotes", - "Ticker": "NOTE", - "Icon": "NOTE", - "Colour": "92EBFC" - }, - { - "Name": "NovaCoin", - "Ticker": "NVC", - "Icon": "NVC-alt", - "Colour": "BF9249" - }, - { - "Name": "Nxt", - "Ticker": "NXT", - "Icon": "NXT", - "Colour": "3D8EB7" - }, - // O - 4 - { - "Name": "OKCash", - "Ticker": "OK", - "Icon": "OK-alt", - "Colour": "29659F" - }, - { - "Name": "OmiseGo", - "Ticker": "OMG", - "Icon": "OMG-alt", - "Colour": "2858E7" - }, - { - "Name": "Omni", - "Ticker": "OMNI", - "Icon": "OMNI-alt", - "Colour": "25468B" - }, - { - "Name": "OpalCoin", - "Ticker": "OPAL", - "Icon": "OPAL", - "Colour": "020429" - }, - // P - 6 - { - "Name": "Particl", - "Ticker": "PART", - "Icon": "PART-alt", - "Colour": "6AE4B4" - }, - { - "Name": "Piggy Coin", - "Ticker": "PIGGY", - "Icon": "PIGGY-alt", - "Colour": "EDB1B4" - }, - { - "Name": "PinkCoin", - "Ticker": "PINK", - "Icon": "PINK-alt", - "Colour": "E68EB4" - }, - { - "Name": "PIVX", - "Ticker": "PIVX", - "Icon": "PIVX-alt", - "Colour": "594D78" - }, - { - "Name": "PotCoin", - "Ticker": "POT", - "Icon": "POT", - "Colour": "29572F" - }, - { - "Name": "PeerCoin", - "Ticker": "PPC", - "Icon": "PPC-alt", - "Colour": "#5FAD5E" - }, - // Q - 2 - { - "Name": "QuarkCoin", - "Ticker": "QRK", - "Icon": "QRK", - "Colour": "4B635A" - }, - { - "Name": "QTUM", - "Ticker": "QTUM", - "Icon": "QTUM-alt", - "Colour": "558FB5" - }, - // R - 7 - { - "Name": "Radium", - "Ticker": "RADS", - "Icon": "RADS-alt", - "Colour": "553488" - }, - { - "Name": "Rubies", - "Ticker": "RBIES", - "Icon": "RBIES-alt", - "Colour": "C62927" - }, - { - "Name": "Rimbit", - "Ticker": "RBT", - "Icon": "RBT-alt", - "Colour": "214A82" - }, - { - "Name": "RubyCoin", - "Ticker": "RBY", - "Icon": "RBY-alt", - "Colour": "C23430" - }, - { - "Name": "ReddCoin", - "Ticker": "RDD", - "Icon": "RDD-alt", - "Colour": "E33932" - }, - { - "Name": "Augur", - "Ticker": "REP", - "Icon": "REP-alt", - "Colour": "5A2D51" - }, - { - "Name": "Rise", - "Ticker": "RISE", - "Icon": "RISE-alt", - "Colour": "64B693" - }, - // S - 16 - { - "Name": "Salt Lending", - "Ticker": "SALT", - "Icon": "SALT-alt", - "Colour": "61A495" - }, - { - "Name": "SARCoin", - "Ticker": "SAR", - "Icon": "SAR-alt", - "Colour": "F8CF47" - }, - { - "Name": "Scotcoin", - "Ticker": "SCOT", - "Icon": "SCOT-alt", - "Colour": "4B83BF" - }, - { - "Name": "ShadowCash", - "Ticker": "SDC", - "Icon": "SDC", - "Colour": "D33740" - }, - { - "Name": "SIA", - "Ticker": "SIA", - "Icon": "SIA-alt", - "Colour": "FFFFFF" - }, - { - "Name": "StorjCoin", - "Ticker": "SJCX", - "Icon": "SJCX-alt", - "Colour": "387FC3" - }, - { - "Name": "SterlingCoin", - "Ticker": "SLG", - "Icon": "SLG-alt", - "Colour": "FFFFFF" - }, - { - "Name": "SaluS", - "Ticker": "SLS", - "Icon": "SLS-alt", - "Colour": "979A9B" - }, - { - "Name": "Synergy", - "Ticker": "SNRG", - "Icon": "SNRG-alt", - "Colour": "A37270" - }, - { - "Name": "StartCoin", - "Ticker": "START", - "Icon": "START", - "Colour": "4CADEA" - }, - { - "Name": "Steem", - "Ticker": "STEEM", - "Icon": "STEEM-alt", - "Colour": "295194" - }, - { - "Name": "Stellas Lumens", - "Ticker": "XLM", - "Icon": "STR", - "Colour": "FFFFFF" - }, - { - "Name": "Stratis", - "Ticker": "STRAT", - "Icon": "STRAT-alt", - "Colour": "4EA2E0" - }, - { - "Name": "BitSwift", - "Ticker": "SWIFT", - "Icon": "SWIFT-alt", - "Colour": "5CA7EF" - }, - { - "Name": "SyncCoin", - "Ticker": "SYNC", - "Icon": "SYNC-alt", - "Colour": "3070A7" - }, - { - "Name": "SysCoin", - "Ticker": "SYS", - "Icon": "SYS-alt", - "Colour": "3C8BC4" - }, - // T - 2 - { - "Name": "Trigger", - "Ticker": "TRIG", - "Icon": "TRIG-alt", - "Colour": "53A8CA" - }, - { - "Name": "Transfer", - "Ticker": "TX", - "Icon": "TX-alt", - "Colour": "4673B2" - }, - // U - 3 - { - "Name": "Ubiq", - "Ticker": "UBQ", - "Icon": "UBQ-alt", - "Colour": "6BE698" - }, - { - "Name": "SuperNET", - "Ticker": "UNITY", - "Icon": "UNITY", - "Colour": "E78B48" - }, - { - "Name": "Tether", - "Ticker": "USDT", - "Icon": "USDT-alt", - "Colour": "4F9E7D" - }, - // V - 5 - { - "Name": "ViorCoin", - "Ticker": "VIOR", - "Icon": "VIOR", - "Colour": "3A86C3" - }, - { - "Name": "Vanilla Coin", - "Ticker": "VNL", - "Icon": "VNL-alt", - "Colour": "424449" - }, - { - "Name": "VPN", - "Ticker": "VPN", - "Icon": "VPN", - "Colour": "FFFFFF" - }, - { - "Name": "VeriCoin", - "Ticker": "VRC", - "Icon": "VRC", - "Colour": "568EC7" - }, - { - "Name": "VertCoin", - "Ticker": "VTC", - "Icon": "VTC", - "Colour": "2F5A33" - }, - // W - 1 - { - "Name": "Waves", - "Ticker": "WAVES", - "Icon": "WAVES-alt", - "Colour": "5DB1D0" - }, - // X - 10 - { - "Name": "SapienceCoin", - "Ticker": "XAI", - "Icon": "XAI", - "Colour": "397323" - }, - { - "Name": "Bitstake", - "Ticker": "XBS", - "Icon": "XBS", - "Colour": "4C9D6C" - }, - { - "Name": "CounterParty", - "Ticker": "XCP", - "Icon": "XCP", - "Colour": "D93554" - }, - { - "Name": "NEM", - "Ticker": "XEM", - "Icon": "XEM", - "Colour": "6DCB85" - }, - { - "Name": "Monero", - "Ticker": "XMR", - "Icon": "XMR", - "Colour": "ED6C2D" - }, - { - "Name": "PrimeCoin", - "Ticker": "XPM", - "Icon": "XPM", - "Colour": "F8D14A" - }, - { - "Name": "Ripple", - "Ticker": "XRP", - "Icon": "XRP", - "Colour": "3E90C5" - }, - { - "Name": "Tezos", - "Ticker": "XTZ", - "Icon": "XTZ-alt", - "Colour": "275F93" - }, - { - "Name": "Verge", - "Ticker": "XVG", - "Icon": "XVG-alt", - "Colour": "5AC8F9" - }, - { - "Name": "ZCoin", - "Ticker": "XZC", - "Icon": "XZC-alt", - "Colour": "58B15E" - }, - // Y - 1 - { - "Name": "YbCoin", - "Ticker": "YBC", - "Icon": "YBC", - "Colour": "DEB354" - }, - // Z - 2 - { - "Name": "ZCash", - "Ticker": "ZEC", - "Icon": "ZEC-alt", - "Colour": "E2B258" - }, - { - "Name": "ZeitCoin", - "Ticker": "ZEIT", - "Icon": "ZEIT-alt", - "Colour": "001AC9" - } -] +const coinJSON = function() { + return [ + // A - 9 + { + "Name": "Cardano", + "Ticker": "ADA", + "Icon": "ADA-alt", + "Colour": "386FCC", + "ShowDefault": true + }, + { + "Name": "AudioCoin", + "Ticker": "ADC", + "Icon": "ADC", + "Colour": "5DADDE" + }, + { + "Name": "AeonCoin", + "Ticker": "AEON", + "Icon": "AEON-alt", + "Colour": "383E47" + }, + { + "Name": "Synereo", + "Ticker": "AMP", + "Icon": "AMP", + "Colour": "4FA9DD" + }, + { + "Name": "Anoncoin", + "Ticker": "ANC", + "Icon": "ANC", + "Colour": "A6A6A6" + }, + { + "Name": "ArchCoin", + "Ticker": "ARCH", + "Icon": "ARCH", + "Colour": "#071F40" + }, + { + "Name": "Ardor", + "Ticker": "ARDR", + "Icon": "ARDR-alt", + "Colour": "4F87C2" + }, + { + "Name": "ARK", + "Ticker": "ARK", + "Icon": "ARK-alt", + "Colour": "4B96C0" + }, + { + "Name": "Aurora Coin", + "Ticker": "AUR", + "Icon": "AUR-alt", + "Colour": "80B17C" + }, + // B - 15, 2 custom + { + "Name": "BANX", + "Ticker": "BANX", + "Icon": "BANX", + "Colour": "FFFFFF" + }, + { + "Name": "BAT", + "Ticker": "BAT", + "Icon": "BAT-alt", + "Colour": "912D61" + }, + { + "Name": "BitBay", + "Ticker": "BAY", + "Icon": "BAY-alt", + "Colour": "449DDD" + }, + { + "Name": "BC", + "Ticker": "BC", + "Icon": "BC", + "Colour": "FFFFFF" + }, + { + "Name": "Bitcoin Cash", + "Ticker": "BCH", + "Icon": "BCH-alt", + "Colour": "719734", + "ShowDefault": true + }, + { + "Name": "Bitcoin Gold", + "Ticker": "BTG", + "Icon": "../../../img/temp/btg", + "Colour": "D29C3D", + "ShowDefault": true + }, + { + "Name": "Bitconnect", + "Ticker": "BCCOIN", + "Icon": "../../../img/temp/bcc", + "Colour": "EC8C37" + }, + { + "Name": "ByteCoin", + "Ticker": "BCN", + "Icon": "BCN", + "Colour": "DE5185" + }, + { + "Name": "BFT", + "Ticker": "BFT", + "Icon": "BFT", + "Colour": "FFFFFF" + }, + { + "Name": "BreakoutCoin", + "Ticker": "BRK", + "Icon": "BRK-alt", + "Colour": "3060B6" + }, + { + "Name": "Breakout Stake", + "Ticker": "BRX", + "Icon": "BRX-alt", + "Colour": "92A934" + }, + { + "Name": "BitSend", + "Ticker": "BSD", + "Icon": "BSD-alt", + "Colour": "3B86E0" + }, + { + "Name": "Bata", + "Ticker": "BTA", + "Icon": "BTA", + "Colour": "3E45C4" + }, + { + "Name": "Bitcoin", + "Ticker": "BTC", + "Icon": "BTC", + "Colour": "F38208", + "ShowDefault": true + }, + { + "Name": "BitcoinDark", + "Ticker": "BTCD", + "Icon": "BTCD", + "Colour": "ED6E2E" + }, + { + "Name": "BitMark", + "Ticker": "BTM", + "Icon": "BTM-alt", + "Colour": "2E0B62" + }, + { + "Name": "Bitshares", + "Ticker": "BTS", + "Icon": "BTS", + "Colour": "2D6C92" + }, + // C - 2 + { + "Name": "CLAMS", + "Ticker": "CLAM", + "Icon": "CLAM-alt", + "Colour": "BAC5C0" + }, + { + "Name": "CloakCoin", + "Ticker": "CLOAK", + "Icon": "CLOAK-alt", + "Colour": "CD4D32" + }, + // D - 9 + { + "Name": "Dash", + "Ticker": "DASH", + "Icon": "DASH", + "Colour": "3875B7", + "ShowDefault": true + }, + { + "Name": "DAO", + "Ticker": "DAO", + "Icon": "DAO-alt", + "Colour": "FFFFFF" + }, + { + "Name": "Decred", + "Ticker": "DCR", + "Icon": "DCR-alt", + "Colour": "69D4A6" + }, + { + "Name": "Decent", + "Ticker": "DCT", + "Icon": "DCT-alt", + "Colour": "3F8E73" + }, + { + "Name": "DigiByte", + "Ticker": "DGB", + "Icon": "DGB-alt", + "Colour": "2E67BF" + }, + { + "Name": "Digix DAO", + "Ticker": "DGD", + "Icon": "DGD", + "Colour": "173747" + }, + { + "Name": "DGX", + "Ticker": "DGX", + "Icon": "DGX", + "Colour": "FFFFFF" + }, + { + "Name": "Diamond", + "Ticker": "DMD", + "Icon": "DMD", + "Colour": "D8E4E7" + }, + { + "Name": "Dogecoin", + "Ticker": "DOGE", + "Icon": "DOGE", + "Colour": "B4A146" + }, + // E - 5 + { + "Name": "Emercoin", + "Ticker": "EMC", + "Icon": "EMC-alt", + "Colour": "BAAACF" + }, + { + "Name": "EOS", + "Ticker": "EOS", + "Icon": "EOS-alt", + "Colour": "828282", + "ShowDefault": true + }, + { + "Name": "ERC", + "Ticker": "ERC", + "Icon": "ERC", + "Colour": "FFFFFF" + }, + { + "Name": "Ethereum", + "Ticker": "ETH", + "Icon": "ETH", + "Colour": "8B92AF", + "ShowDefault": true + }, + { + "Name": "Ethereum Classic", + "Ticker": "ETC", + "Icon": "ETC-alt", + "Colour": "4E7840" + }, + // F - 5 + { + "Name": "Fuel2Coin", + "Ticker": "FC2", + "Icon": "FC2", + "Colour": "9FA1A3" + }, + { + "Name": "Factoids", + "Ticker": "FCT", + "Icon": "FCT-alt", + "Colour": "50789E" + }, + { + "Name": "FlorinCoin", + "Ticker": "FLO", + "Icon": "FLO-alt", + "Colour": "BCBDBE" + }, + { + "Name": "Franko", + "Ticker": "FRK", + "Icon": "FRK", + "Colour": "1040D0" + }, + { + "Name": "FeatherCoin", + "Ticker": "FTC", + "Icon": "FTC", + "Colour": "F5F5F5" + }, + // G - 10 + { + "Name": "Gamecredits", + "Ticker": "GAME", + "Icon": "GAME-alt", + "Colour": "A0BD43" + }, + { + "Name": "Byteball", + "Ticker": "GBYTE", + "Icon": "GBYTE-alt", + "Colour": "A0BD43" + }, + { + "Name": "GrandCoin", + "Ticker": "GDC", + "Icon": "GDC-alt", + "Colour": "F4B53F" + }, + { + "Name": "Gemz Social", + "Ticker": "GEMZ", + "Icon": "GEMZ", + "Colour": "E17673" + }, + { + "Name": "GoldCoin", + "Ticker": "GLD", + "Icon": "GLD-alt", + "Colour": "D1993B" + }, + { + "Name": "Gnosis", + "Ticker": "GNO", + "Icon": "GNO-alt", + "Colour": "49A4C1" + }, + { + "Name": "GNT", + "Ticker": "GNT", + "Icon": "GNT-alt", + "Colour": "62A0BC" + }, + { + "Name": "Golos", + "Ticker": "GOLOS", + "Icon": "GOLOS-alt", + "Colour": "3A6CB0" + }, + { + "Name": "GridCoin", + "Ticker": "GRC", + "Icon": "GRC-alt", + "Colour": "544D44" + }, + { + "Name": "Groestlcoin", + "Ticker": "GRS", + "Icon": "GRS", + "Colour": "39849B" + }, + // H - 1 + { + "Name": "Heat Ledger", + "Ticker": "HEAT", + "Icon": "HEAT-alt", + "Colour": "EA4125" + }, + // I - 5 + { + "Name": "Iconomi", + "Ticker": "ICN", + "Icon": "ICN-alt", + "Colour": "4A9076" + }, + { + "Name": "Infinite Coin", + "Ticker": "IFC", + "Icon": "IFC", + "Colour": "F4B44B" + }, + { + "Name": "Incent", + "Ticker": "INCNT", + "Icon": "INCNT-alt", + "Colour": "F3B356" + }, + { + "Name": "IOCoin", + "Ticker": "IOC", + "Icon": "IOC", + "Colour": "7FBEEB" + }, + { + "Name": "IOTA", + "Ticker": "IOT", + "Icon": "IOTA-alt", + "Colour": "647782", + "ShowDefault": true + }, + // J - 1 + { + "Name": "JumBucks Coin", + "Ticker": "JBS", + "Icon": "JBS-alt", + "Colour": "2E71B6" + }, + // K - 3 + { + "Name": "Komodo", + "Ticker": "KMD", + "Icon": "KMD-alt", + "Colour": "5C7D7D" + }, + { + "Name": "KoboCoin", + "Ticker": "KOBO", + "Icon": "KOBO", + "Colour": "90BF57" + }, + { + "Name": "Kore", + "Ticker": "KORE", + "Icon": "KORE", + "Colour": "DD5539" + }, + // L - 4 + { + "Name": "LBRY Credits", + "Ticker": "LBC", + "Icon": "LBC-alt", + "Colour": "2F5C4E" + }, + { + "Name": "LiteDoge", + "Ticker": "LDOGE", + "Icon": "LDOGE", + "Colour": "F7CC48" + }, + { + "Name": "Lisk", + "Ticker": "LSK", + "Icon": "LSK-alt", + "Colour": "326792" + }, + { + "Name": "Litecoin", + "Ticker": "LTC", + "Icon": "LTC", + "Colour": "BEBEBE", + "ShowDefault": true + }, + // M - 8 + { + "Name": "MaidSafe Coin", + "Ticker": "MAID", + "Icon": "MAID", + "Colour": "9FBDE2" + }, + { + "Name": "Monaco", + "Ticker": "MCO", + "Icon": "MCO-alt", + "Colour": "DE715C" + }, + { + "Name": "MintCoin", + "Ticker": "MINT", + "Icon": "MINT-alt", + "Colour": "A1C681" + }, + { + "Name": "MonaCoin", + "Ticker": "MONA", + "Icon": "MONA-alt", + "Colour": "A9966A" + }, + { + "Name": "MRC", + "Ticker": "MRC", + "Icon": "MRC", + "Colour": "FFFFFF" + }, + { + "Name": "MasterCoin", + "Ticker": "MSC", + "Icon": "MSC", + "Colour": "235787" + }, + { + "Name": "MTR", + "Ticker": "MTR", + "Icon": "MTR", + "Colour": "8E2721" + }, + { + "Name": "MonetaryUnit", + "Ticker": "MUE", + "Icon": "MUE", + "Colour": "FAEB4F" + }, + // N - 9 + { + "Name": "NuBits", + "Ticker": "NBT", + "Icon": "NBT", + "Colour": "F5BC43" + }, + { + "Name": "NEO", + "Ticker": "NEO", + "Icon": "NEO-alt", + "Colour": "B6D746", + "ShowDefault": true + }, + { + "Name": "NeosCoin", + "Ticker": "NEOS", + "Icon": "NEOS-alt", + "Colour": "F1E65B" + }, + { + "Name": "Neumark", + "Ticker": "NEU", + "Icon": "NEU-alt", + "Colour": "D8E04B" + }, + { + "Name": "Gulden", + "Ticker": "NLG", + "Icon": "NLG-alt", + "Colour": "153E77" + }, + { + "Name": "NameCoin", + "Ticker": "NMC", + "Icon": "NMC", + "Colour": "668FBD" + }, + { + "Name": "Dnotes", + "Ticker": "NOTE", + "Icon": "NOTE", + "Colour": "92EBFC" + }, + { + "Name": "NovaCoin", + "Ticker": "NVC", + "Icon": "NVC-alt", + "Colour": "BF9249" + }, + { + "Name": "Nxt", + "Ticker": "NXT", + "Icon": "NXT", + "Colour": "3D8EB7" + }, + // O - 4 + { + "Name": "OKCash", + "Ticker": "OK", + "Icon": "OK-alt", + "Colour": "29659F" + }, + { + "Name": "OmiseGo", + "Ticker": "OMG", + "Icon": "OMG-alt", + "Colour": "2858E7" + }, + { + "Name": "Omni", + "Ticker": "OMNI", + "Icon": "OMNI-alt", + "Colour": "25468B" + }, + { + "Name": "OpalCoin", + "Ticker": "OPAL", + "Icon": "OPAL", + "Colour": "020429" + }, + // P - 6 + { + "Name": "Particl", + "Ticker": "PART", + "Icon": "PART-alt", + "Colour": "6AE4B4" + }, + { + "Name": "Piggy Coin", + "Ticker": "PIGGY", + "Icon": "PIGGY-alt", + "Colour": "EDB1B4" + }, + { + "Name": "PinkCoin", + "Ticker": "PINK", + "Icon": "PINK-alt", + "Colour": "E68EB4" + }, + { + "Name": "PIVX", + "Ticker": "PIVX", + "Icon": "PIVX-alt", + "Colour": "594D78" + }, + { + "Name": "PotCoin", + "Ticker": "POT", + "Icon": "POT", + "Colour": "29572F" + }, + { + "Name": "PeerCoin", + "Ticker": "PPC", + "Icon": "PPC-alt", + "Colour": "#5FAD5E" + }, + // Q - 2 + { + "Name": "QuarkCoin", + "Ticker": "QRK", + "Icon": "QRK", + "Colour": "4B635A" + }, + { + "Name": "QTUM", + "Ticker": "QTUM", + "Icon": "QTUM-alt", + "Colour": "558FB5", + "ShowDefault": true + }, + // R - 7 + { + "Name": "Radium", + "Ticker": "RADS", + "Icon": "RADS-alt", + "Colour": "553488" + }, + { + "Name": "Rubies", + "Ticker": "RBIES", + "Icon": "RBIES-alt", + "Colour": "C62927" + }, + { + "Name": "Rimbit", + "Ticker": "RBT", + "Icon": "RBT-alt", + "Colour": "214A82" + }, + { + "Name": "RubyCoin", + "Ticker": "RBY", + "Icon": "RBY-alt", + "Colour": "C23430" + }, + { + "Name": "ReddCoin", + "Ticker": "RDD", + "Icon": "RDD-alt", + "Colour": "E33932" + }, + { + "Name": "Augur", + "Ticker": "REP", + "Icon": "REP-alt", + "Colour": "5A2D51" + }, + { + "Name": "Rise", + "Ticker": "RISE", + "Icon": "RISE-alt", + "Colour": "64B693" + }, + // S - 16 + { + "Name": "Salt Lending", + "Ticker": "SALT", + "Icon": "SALT-alt", + "Colour": "61A495" + }, + { + "Name": "SARCoin", + "Ticker": "SAR", + "Icon": "SAR-alt", + "Colour": "F8CF47" + }, + { + "Name": "Scotcoin", + "Ticker": "SCOT", + "Icon": "SCOT-alt", + "Colour": "4B83BF" + }, + { + "Name": "ShadowCash", + "Ticker": "SDC", + "Icon": "SDC", + "Colour": "D33740" + }, + { + "Name": "SIA", + "Ticker": "SIA", + "Icon": "SIA-alt", + "Colour": "FFFFFF" + }, + { + "Name": "StorjCoin", + "Ticker": "SJCX", + "Icon": "SJCX-alt", + "Colour": "387FC3" + }, + { + "Name": "SterlingCoin", + "Ticker": "SLG", + "Icon": "SLG-alt", + "Colour": "FFFFFF" + }, + { + "Name": "SaluS", + "Ticker": "SLS", + "Icon": "SLS-alt", + "Colour": "979A9B" + }, + { + "Name": "Synergy", + "Ticker": "SNRG", + "Icon": "SNRG-alt", + "Colour": "A37270" + }, + { + "Name": "StartCoin", + "Ticker": "START", + "Icon": "START", + "Colour": "4CADEA" + }, + { + "Name": "Steem", + "Ticker": "STEEM", + "Icon": "STEEM-alt", + "Colour": "295194" + }, + { + "Name": "Stellas Lumens", + "Ticker": "XLM", + "Icon": "STR", + "Colour": "FFFFFF", + "ShowDefault": true + }, + { + "Name": "Stratis", + "Ticker": "STRAT", + "Icon": "STRAT-alt", + "Colour": "4EA2E0" + }, + { + "Name": "BitSwift", + "Ticker": "SWIFT", + "Icon": "SWIFT-alt", + "Colour": "5CA7EF" + }, + { + "Name": "SyncCoin", + "Ticker": "SYNC", + "Icon": "SYNC-alt", + "Colour": "3070A7" + }, + { + "Name": "SysCoin", + "Ticker": "SYS", + "Icon": "SYS-alt", + "Colour": "3C8BC4" + }, + // T - 2 + { + "Name": "Trigger", + "Ticker": "TRIG", + "Icon": "TRIG-alt", + "Colour": "53A8CA" + }, + { + "Name": "Transfer", + "Ticker": "TX", + "Icon": "TX-alt", + "Colour": "4673B2" + }, + // U - 3 + { + "Name": "Ubiq", + "Ticker": "UBQ", + "Icon": "UBQ-alt", + "Colour": "6BE698" + }, + { + "Name": "SuperNET", + "Ticker": "UNITY", + "Icon": "UNITY", + "Colour": "E78B48" + }, + { + "Name": "Tether", + "Ticker": "USDT", + "Icon": "USDT-alt", + "Colour": "4F9E7D" + }, + // V - 5 + { + "Name": "ViorCoin", + "Ticker": "VIOR", + "Icon": "VIOR", + "Colour": "3A86C3" + }, + { + "Name": "Vanilla Coin", + "Ticker": "VNL", + "Icon": "VNL-alt", + "Colour": "424449" + }, + { + "Name": "VPN", + "Ticker": "VPN", + "Icon": "VPN", + "Colour": "FFFFFF" + }, + { + "Name": "VeriCoin", + "Ticker": "VRC", + "Icon": "VRC", + "Colour": "568EC7" + }, + { + "Name": "VertCoin", + "Ticker": "VTC", + "Icon": "VTC", + "Colour": "2F5A33" + }, + // W - 1 + { + "Name": "Waves", + "Ticker": "WAVES", + "Icon": "WAVES-alt", + "Colour": "5DB1D0" + }, + // X - 10 + { + "Name": "SapienceCoin", + "Ticker": "XAI", + "Icon": "XAI", + "Colour": "397323" + }, + { + "Name": "Bitstake", + "Ticker": "XBS", + "Icon": "XBS", + "Colour": "4C9D6C" + }, + { + "Name": "CounterParty", + "Ticker": "XCP", + "Icon": "XCP", + "Colour": "D93554" + }, + { + "Name": "NEM", + "Ticker": "XEM", + "Icon": "XEM", + "Colour": "6DCB85", + "ShowDefault": true + }, + { + "Name": "Monero", + "Ticker": "XMR", + "Icon": "XMR", + "Colour": "ED6C2D", + "ShowDefault": true + }, + { + "Name": "PrimeCoin", + "Ticker": "XPM", + "Icon": "XPM", + "Colour": "F8D14A" + }, + { + "Name": "Ripple", + "Ticker": "XRP", + "Icon": "XRP", + "Colour": "3E90C5", + "ShowDefault": true + }, + { + "Name": "Tezos", + "Ticker": "XTZ", + "Icon": "XTZ-alt", + "Colour": "275F93" + }, + { + "Name": "Verge", + "Ticker": "XVG", + "Icon": "XVG-alt", + "Colour": "5AC8F9" + }, + { + "Name": "ZCoin", + "Ticker": "XZC", + "Icon": "XZC-alt", + "Colour": "58B15E" + }, + // Y - 1 + { + "Name": "YbCoin", + "Ticker": "YBC", + "Icon": "YBC", + "Colour": "DEB354" + }, + // Z - 2 + { + "Name": "ZCash", + "Ticker": "ZEC", + "Icon": "ZEC-alt", + "Colour": "E2B258" + }, + { + "Name": "ZeitCoin", + "Ticker": "ZEIT", + "Icon": "ZEIT-alt", + "Colour": "001AC9" + } + ] +}; \ No newline at end of file diff --git a/index.html b/index.html index b162a42b..fd0ddf4a 100644 --- a/index.html +++ b/index.html @@ -22,12 +22,10 @@ - - - + - + @@ -79,15 +77,14 @@

A tool to build crytpo currency widgets for Apple's tou

- Crypto Currencies(with icon) + Crypto Currencies (icons available for some)
-
Loading coins...

- Add Other Coins(no icon) + Add Other Coins @@ -162,7 +159,7 @@

Additional Options

- + Refresh Interval: Seconds diff --git a/js/crypto.js b/js/crypto.js index a71d8666..af766909 100644 --- a/js/crypto.js +++ b/js/crypto.js @@ -360,22 +360,35 @@ function loadData() { var count = 0; var input = jsonData.Data; - for ( property in input) - { - if(input.hasOwnProperty(property)) - { - dynCoinArr.push({ - value : input[property].Symbol, - label : input[property].CoinName, - selected : false - }); - count++; + for ( property in input) { + if(input.hasOwnProperty(property)) { + var customProperties = { + "icon": 'img/TODO.svg', + "color": '6CAAE5' + }; + var showTopX = false; + var customData = getSelectedValue(new coinJSON(), 'Ticker', input[property].Symbol)[0]; + if (customData) { + if (customData.ShowDefault) showTopX = true; + customProperties = { + "icon": 'node_modules/cryptocoins-icons/SVG/' + customData.Icon + '.svg', + "color": customData.Colour + } + } + dynCoinArr.push({ + "value" : input[property].Symbol, + "label" : input[property].CoinName, + "customProperties" : customProperties, + "selected" : showTopX + }); + count++; } } var genericExamples = new Choices('#dynamic-coinlist', { placeholderValue: 'Search for a CryptoCurrency ('+count+') supported', searchPlaceholderValue: 'Search for a CryptoCurrency ('+count+') supported', + noResultsText: 'Search returned no results', choices: dynCoinArr, searchResultLimit: 15, shouldSort: true, @@ -397,12 +410,6 @@ function loadData() { slider = document.getElementById('refreshSlider'), output = document.getElementById('refreshInterval'); - - // Populate popular coins from coins.js - coinJSON.forEach((coin) => { - coin.Icon = 'node_modules/cryptocoins-icons/SVG/' + coin.Icon + '.svg'; - addCoin(coin); - }); dropdown.addEventListener('change', updatePreviewFiat); new fiatJSON().forEach((currency) => { @@ -438,17 +445,14 @@ function loadData() { output.innerHTML = event.target.value; }); - // Hide loading text - document.getElementById('loading').style.display = 'none'; - // events for on change of searchbox input var dynamicCoinList = document.getElementById('dynamic-coinlist'); dynamicCoinList.addEventListener('addItem', function(event) { let customCoin = { - "Colour" : '6CAAE5', + "Colour" : event.detail.customProperties.color, "Name" : event.detail.label, "Ticker" : event.detail.value, - "Icon" : 'img/TODO.svg' + "Icon" : event.detail.customProperties.icon }; addCoin(customCoin); }); diff --git a/js/thirdparty/choices-PR325/choices.min.css b/js/thirdparty/choices-PR325/choices.min.css new file mode 100644 index 00000000..42f6ad17 --- /dev/null +++ b/js/thirdparty/choices-PR325/choices.min.css @@ -0,0 +1 @@ +.choices{position:relative;margin-bottom:24px;font-size:16px}.choices:focus{outline:none}.choices:last-child{margin-bottom:0}.choices.is-disabled .choices__inner,.choices.is-disabled .choices__input{background-color:#eaeaea;cursor:not-allowed;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.choices.is-disabled .choices__item{cursor:not-allowed}.choices[data-type*=select-one]{cursor:pointer}.choices[data-type*=select-one] .choices__inner{padding-bottom:7.5px}.choices[data-type*=select-one] .choices__input{display:block;width:100%;padding:10px;border-bottom:1px solid #ddd;background-color:#fff;margin:0}.choices[data-type*=select-one] .choices__button{background-image:url(cross-inverse.svg);padding:0;background-size:8px;position:absolute;top:50%;right:0;margin-top:-10px;margin-right:25px;height:20px;width:20px;border-radius:10em;opacity:.5}.choices[data-type*=select-one] .choices__button:focus,.choices[data-type*=select-one] .choices__button:hover{opacity:1}.choices[data-type*=select-one] .choices__button:focus{box-shadow:0 0 0 2px #00bcd4}.choices[data-type*=select-one]:after{content:"";height:0;width:0;border-style:solid;border-color:#333 transparent transparent transparent;border-width:5px;position:absolute;right:11.5px;top:50%;margin-top:-2.5px;pointer-events:none}.choices[data-type*=select-one].is-open:after{border-color:transparent transparent #333 transparent;margin-top:-7.5px}.choices[data-type*=select-one][dir=rtl]:after{left:11.5px;right:auto}.choices[data-type*=select-one][dir=rtl] .choices__button{right:auto;left:0;margin-left:25px;margin-right:0}.choices[data-type*=select-multiple] .choices__inner,.choices[data-type*=text] .choices__inner{cursor:text}.choices[data-type*=select-multiple] .choices__button,.choices[data-type*=text] .choices__button{position:relative;display:inline-block;margin:0 -4px 0 8px;padding-left:16px;border-left:1px solid #008fa1;background-image:url(cross.svg);background-size:8px;width:8px;line-height:1;opacity:.75}.choices[data-type*=select-multiple] .choices__button:focus,.choices[data-type*=select-multiple] .choices__button:hover,.choices[data-type*=text] .choices__button:focus,.choices[data-type*=text] .choices__button:hover{opacity:1}.choices__inner{display:inline-block;vertical-align:top;width:100%;background-color:#f9f9f9;padding:7.5px 7.5px 3.75px;border:1px solid #ddd;border-radius:2.5px;font-size:14px;min-height:44px;overflow:hidden}.is-focused .choices__inner,.is-open .choices__inner{border-color:#b7b7b7}.is-open .choices__inner{border-radius:2.5px 2.5px 0 0}.is-flipped.is-open .choices__inner{border-radius:0 0 2.5px 2.5px}.choices__list{margin:0;padding-left:0;list-style:none}.choices__list--single{display:inline-block;padding:4px 16px 4px 4px;width:100%}[dir=rtl] .choices__list--single{padding-right:4px;padding-left:16px}.choices__list--single .choices__item{width:100%}.choices__list--multiple{display:inline}.choices__list--multiple .choices__item{display:inline-block;vertical-align:middle;border-radius:20px;padding:4px 10px;font-size:12px;font-weight:500;margin-right:3.75px;margin-bottom:3.75px;background-color:#00bcd4;border:1px solid #00a5bb;color:#fff;word-break:break-all}.choices__list--multiple .choices__item[data-deletable]{padding-right:5px}[dir=rtl] .choices__list--multiple .choices__item{margin-right:0;margin-left:3.75px}.choices__list--multiple .choices__item.is-highlighted{background-color:#00a5bb;border:1px solid #008fa1}.is-disabled .choices__list--multiple .choices__item{background-color:#aaa;border:1px solid #919191}.choices__list--dropdown{display:none;z-index:1;position:absolute;width:100%;background-color:#fff;border:1px solid #ddd;top:100%;margin-top:-1px;border-bottom-left-radius:2.5px;border-bottom-right-radius:2.5px;overflow:hidden;word-break:break-all}.choices__list--dropdown.is-active{display:block}.is-open .choices__list--dropdown{border-color:#b7b7b7}.is-flipped .choices__list--dropdown{top:auto;bottom:100%;margin-top:0;margin-bottom:-1px;border-radius:.25rem .25rem 0 0}.choices__list--dropdown .choices__list{position:relative;max-height:300px;overflow:auto;-webkit-overflow-scrolling:touch;will-change:scroll-position}.choices__list--dropdown .choices__item{position:relative;padding:10px;font-size:14px}[dir=rtl] .choices__list--dropdown .choices__item{text-align:right}@media (min-width:640px){.choices__list--dropdown .choices__item--selectable{padding-right:100px}.choices__list--dropdown .choices__item--selectable:after{content:attr(data-select-text);font-size:12px;opacity:0;position:absolute;right:10px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}[dir=rtl] .choices__list--dropdown .choices__item--selectable{text-align:right;padding-left:100px;padding-right:10px}[dir=rtl] .choices__list--dropdown .choices__item--selectable:after{right:auto;left:10px}}.choices__list--dropdown .choices__item--selectable.is-highlighted{background-color:#f2f2f2}.choices__list--dropdown .choices__item--selectable.is-highlighted:after{opacity:.5}.choices__item{cursor:default}.choices__item--selectable{cursor:pointer}.choices__item--disabled{cursor:not-allowed;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:.5}.choices__heading{font-weight:600;font-size:12px;padding:10px;border-bottom:1px solid #f7f7f7;color:gray}.choices__button{text-indent:-9999px;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;background-color:transparent;background-repeat:no-repeat;background-position:center;cursor:pointer}.choices__button:focus{outline:none}.choices__input{display:inline-block;vertical-align:baseline;background-color:#f9f9f9;font-size:14px;margin-bottom:5px;border:0;border-radius:0;max-width:100%;padding:4px 0 4px 2px}.choices__input:focus{outline:0}[dir=rtl] .choices__input{padding-right:2px;padding-left:0}.choices__placeholder{opacity:.5} \ No newline at end of file diff --git a/js/thirdparty/choices-PR325/choices.min.js b/js/thirdparty/choices-PR325/choices.min.js new file mode 100644 index 00000000..1e919514 --- /dev/null +++ b/js/thirdparty/choices-PR325/choices.min.js @@ -0,0 +1,5 @@ +/*! choices.js v3.0.3 | (c) 2018 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Choices=t():e.Choices=t()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return e[n].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var i={};return t.m=e,t.c=i,t.p="/assets/scripts/dist/",t(0)}([function(e,t,i){e.exports=i(1)},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function s(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function o(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,e),(0,v.isType)("String",t)){var n=document.querySelectorAll(t);if(n.length>1)for(var s=1;s"'+e+'"'},maxItemText:function(e){return"Only "+e+" values can be added."},uniqueItemText:"Only unique values can be added.",classNames:{containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"},fuseOptions:{include:"score"},callbackOnInit:null,callbackOnCreateTemplates:null};if(this.idNames={itemChoice:"item-choice"},this.config=(0,v.extend)(a,i),"auto"!==this.config.renderSelectedChoices&&"always"!==this.config.renderSelectedChoices&&(this.config.silent||console.warn("renderSelectedChoices: Possible values are 'auto' and 'always'. Falling back to 'auto'."),this.config.renderSelectedChoices="auto"),this.store=new f.default(this.render),this.initialised=!1,this.currentState={},this.prevState={},this.currentValue="",this.element=t,this.passedElement=(0,v.isType)("String",t)?document.querySelector(t):t,!this.passedElement)return void(this.config.silent||console.error("Passed element not found"));this.isTextElement="text"===this.passedElement.type,this.isSelectOneElement="select-one"===this.passedElement.type,this.isSelectMultipleElement="select-multiple"===this.passedElement.type,this.isSelectElement=this.isSelectOneElement||this.isSelectMultipleElement,this.isValidElementType=this.isTextElement||this.isSelectElement,this.isIe11=!(!navigator.userAgent.match(/Trident/)||!navigator.userAgent.match(/rv[ :]11/)),this.isScrollingOnIe=!1,this.config.shouldSortItems===!0&&this.isSelectOneElement&&(this.config.silent||console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false.")),this.highlightPosition=0,this.canSearch=this.config.searchEnabled,this.placeholder=!1,this.isSelectOneElement||(this.placeholder=!!this.config.placeholder&&(this.config.placeholderValue||this.passedElement.getAttribute("placeholder"))),this.presetChoices=this.config.choices,this.presetItems=this.config.items,this.passedElement.value&&(this.presetItems=this.presetItems.concat(this.passedElement.value.split(this.config.delimiter))),this.baseId=(0,v.generateId)(this.passedElement,"choices-"),this.render=this.render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this.wasTap=!0;var c="classList"in document.documentElement;c||this.config.silent||console.error("Choices: Your browser doesn't support Choices");var l=(0,v.isElement)(this.passedElement)&&this.isValidElementType;if(l){if("active"===this.passedElement.getAttribute("data-choice"))return;this.init()}else this.config.silent||console.error("Incompatible input passed")}return a(e,[{key:"init",value:function(){if(this.initialised!==!0){var e=this.config.callbackOnInit;this.initialised=!0,this._createTemplates(),this._createInput(),this.store.subscribe(this.render),this.render(),this._addEventListeners(),e&&(0,v.isType)("Function",e)&&e.call(this)}}},{key:"destroy",value:function(){if(this.initialised!==!1){this._removeEventListeners(),this.passedElement.classList.remove(this.config.classNames.input,this.config.classNames.hiddenState),this.passedElement.removeAttribute("tabindex");var e=this.passedElement.getAttribute("data-choice-orig-style");Boolean(e)?(this.passedElement.removeAttribute("data-choice-orig-style"),this.passedElement.setAttribute("style",e)):this.passedElement.removeAttribute("style"),this.passedElement.removeAttribute("aria-hidden"),this.passedElement.removeAttribute("data-choice"),this.passedElement.value=this.passedElement.value,this.containerOuter.parentNode.insertBefore(this.passedElement,this.containerOuter),this.containerOuter.parentNode.removeChild(this.containerOuter),this.clearStore(),this.config.templates=null,this.initialised=!1}}},{key:"renderGroups",value:function(e,t,i){var n=this,s=i||document.createDocumentFragment(),o=this.config.sortFilter;return this.config.shouldSort&&e.sort(o),e.forEach(function(e){var i=t.filter(function(t){return n.isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&!t.selected});if(i.length>=1){var o=n._getTemplate("choiceGroup",e);s.appendChild(o),n.renderChoices(i,s,!0)}}),s}},{key:"renderChoices",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=t||document.createDocumentFragment(),r=this.config,a=r.renderSelectedChoices,c=r.searchResultLimit,l=r.renderChoiceLimit,h=this.isSearching?v.sortByScore:this.config.sortFilter,u=function(e){var t="auto"!==a||(i.isSelectOneElement||!e.selected);if(t){var n=i._getTemplate("choice",e);s.appendChild(n)}},d=e;"auto"!==a||this.isSelectOneElement||(d=e.filter(function(e){return!e.selected}));var f=d.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),p=f.placeholderChoices,m=f.normalChoices;(this.config.shouldSort||this.isSearching)&&m.sort(h);var g=d.length,y=[].concat(o(p),o(m));this.isSearching?g=c:l>0&&!n&&(g=l);for(var b=0;b1&&void 0!==arguments[1]?arguments[1]:null,n=i||document.createDocumentFragment();if(this.config.shouldSortItems&&!this.isSelectOneElement&&e.sort(this.config.sortFilter),this.isTextElement){var s=this.store.getItemsReducedToValues(e),o=s.join(this.config.delimiter);this.passedElement.setAttribute("value",o),this.passedElement.value=o}else{var r=document.createDocumentFragment();e.forEach(function(e){var i=t._getTemplate("option",e);r.appendChild(i)}),this.passedElement.innerHTML="",this.passedElement.appendChild(r)}return e.forEach(function(e){var i=t._getTemplate("item",e);n.appendChild(i)}),n}},{key:"render",value:function(){if(!this.store.isLoading()&&(this.currentState=this.store.getState(),this.currentState!==this.prevState)){if((this.currentState.choices!==this.prevState.choices||this.currentState.groups!==this.prevState.groups||this.currentState.items!==this.prevState.items)&&this.isSelectElement){var e=this.store.getGroupsFilteredByActive(),t=this.store.getChoicesFilteredByActive(),i=document.createDocumentFragment();this.choiceList.innerHTML="",this.config.resetScrollPosition&&(this.choiceList.scrollTop=0),e.length>=1&&this.isSearching!==!0?i=this.renderGroups(e,t,i):t.length>=1&&(i=this.renderChoices(t,i));var n=this.store.getItemsFilteredByActive(),s=this._canAddItem(n,this.input.value);if(i.childNodes&&i.childNodes.length>0)s.response?(this.choiceList.appendChild(i),this._highlightChoice()):this.choiceList.appendChild(this._getTemplate("notice",s.notice));else{var o=void 0,r=void 0;this.isSearching?(r=(0,v.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,o=this._getTemplate("notice",r,"no-results")):(r=(0,v.isType)("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,o=this._getTemplate("notice",r,"no-choices")),this.choiceList.appendChild(o)}}if(this.currentState.items!==this.prevState.items){var a=this.store.getItemsFilteredByActive();if(this.itemList.innerHTML="",a&&a){var c=this.renderItems(a);c.childNodes&&this.itemList.appendChild(c)}}this.prevState=this.currentState}}},{key:"highlightItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this;var i=e.id,n=e.groupId,s=n>=0?this.store.getGroupById(n):null;return this.store.dispatch((0,p.highlightItem)(i,!0)),t&&(s&&s.value?(0,v.triggerEvent)(this.passedElement,"highlightItem",{id:i,value:e.value,label:e.label,groupValue:s.value}):(0,v.triggerEvent)(this.passedElement,"highlightItem",{id:i,value:e.value,label:e.label})),this}},{key:"unhighlightItem",value:function(e){if(!e)return this;var t=e.id,i=e.groupId,n=i>=0?this.store.getGroupById(i):null;return this.store.dispatch((0,p.highlightItem)(t,!1)),n&&n.value?(0,v.triggerEvent)(this.passedElement,"unhighlightItem",{id:t,value:e.value,label:e.label,groupValue:n.value}):(0,v.triggerEvent)(this.passedElement,"unhighlightItem",{id:t,value:e.value,label:e.label}),this}},{key:"highlightAll",value:function(){var e=this,t=this.store.getItems();return t.forEach(function(t){e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this,t=this.store.getItems();return t.forEach(function(t){e.unhighlightItem(t)}),this}},{key:"removeItemsByValue",value:function(e){var t=this;if(!e||!(0,v.isType)("String",e))return this;var i=this.store.getItemsFilteredByActive();return i.forEach(function(i){i.value===e&&t._removeItem(i)}),this}},{key:"removeActiveItems",value:function(e){var t=this,i=this.store.getItemsFilteredByActive();return i.forEach(function(i){i.active&&e!==i.id&&t._removeItem(i)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.store.getItemsFilteredByActive();return i.forEach(function(i){i.highlighted&&i.active&&(e._removeItem(i),t&&e._triggerChange(i.value))}),this}},{key:"showDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=document.body,i=document.documentElement,n=Math.max(t.scrollHeight,t.offsetHeight,i.clientHeight,i.scrollHeight,i.offsetHeight);this.containerOuter.classList.add(this.config.classNames.openState),this.containerOuter.setAttribute("aria-expanded","true"),this.dropdown.classList.add(this.config.classNames.activeState),this.dropdown.setAttribute("aria-expanded","true");var s=this.dropdown.getBoundingClientRect(),o=Math.ceil(s.top+window.scrollY+this.dropdown.offsetHeight),r=!1;return"auto"===this.config.position?r=o>=n:"top"===this.config.position&&(r=!0),r&&this.containerOuter.classList.add(this.config.classNames.flippedState),e&&this.canSearch&&document.activeElement!==this.input&&this.input.focus(),(0,v.triggerEvent)(this.passedElement,"showDropdown",{}),this}},{key:"hideDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.containerOuter.classList.contains(this.config.classNames.flippedState);return this.containerOuter.classList.remove(this.config.classNames.openState),this.containerOuter.setAttribute("aria-expanded","false"),this.dropdown.classList.remove(this.config.classNames.activeState),this.dropdown.setAttribute("aria-expanded","false"),t&&this.containerOuter.classList.remove(this.config.classNames.flippedState),e&&this.canSearch&&document.activeElement===this.input&&this.input.blur(),(0,v.triggerEvent)(this.passedElement,"hideDropdown",{}),this}},{key:"toggleDropdown",value:function(){var e=this.dropdown.classList.contains(this.config.classNames.activeState);return e?this.hideDropdown():this.showDropdown(!0),this}},{key:"getValue",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.store.getItemsFilteredByActive(),n=[];return i.forEach(function(i){e.isTextElement?n.push(t?i.value:i):i.active&&n.push(t?i.value:i)}),this.isSelectOneElement?n[0]:n}},{key:"setValue",value:function(e){var t=this;if(this.initialised===!0){var i=[].concat(o(e)),n=function(e){var i=(0,v.getType)(e);if("Object"===i){if(!e.value)return;t.isTextElement?t._addItem(e.value,e.label,e.id,void 0,e.customProperties,e.placeholder):t._addChoice(e.value,e.label,!0,!1,-1,e.customProperties,e.placeholder)}else"String"===i&&(t.isTextElement?t._addItem(e):t._addChoice(e,e,!0,!1,-1,null))};i.length>1?i.forEach(function(e){n(e)}):n(i[0])}return this}},{key:"setValueByChoice",value:function(e){var t=this;if(!this.isTextElement){var i=this.store.getChoices(),n=(0,v.isType)("Array",e)?e:[e];n.forEach(function(e){var n=i.find(function(t){return t.value===e});n?n.selected?t.config.silent||console.warn("Attempting to select choice already selected"):t._addItem(n.value,n.label,n.id,n.groupId,n.customProperties,n.placeholder,n.keyCode):t.config.silent||console.warn("Attempting to select choice that does not exist")})}return this}},{key:"setChoices",value:function(e,t,i){var n=this,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(this.initialised===!0&&this.isSelectElement){if(!(0,v.isType)("Array",e)||!t)return this;s&&this._clearChoices(),this._setLoading(!0),e&&e.length&&(this.containerOuter.classList.remove(this.config.classNames.loadingState),e.forEach(function(e){e.choices?n._addGroup(e,e.id||null,t,i):n._addChoice(e[t],e[i],e.selected,e.disabled,void 0,e.customProperties,e.placeholder)})),this._setLoading(!1)}return this}},{key:"clearStore",value:function(){return this.store.dispatch((0,p.clearAll)()),this}},{key:"clearInput",value:function(){return this.input.value&&(this.input.value=""),this.isSelectOneElement||this._setInputWidth(),!this.isTextElement&&this.config.searchEnabled&&(this.isSearching=!1,this.store.dispatch((0,p.activateChoices)(!0))),this}},{key:"enable",value:function(){if(this.initialised){this.passedElement.disabled=!1;var e=this.containerOuter.classList.contains(this.config.classNames.disabledState);e&&(this._addEventListeners(),this.passedElement.removeAttribute("disabled"),this.input.removeAttribute("disabled"),this.containerOuter.classList.remove(this.config.classNames.disabledState),this.containerOuter.removeAttribute("aria-disabled"),this.isSelectOneElement&&this.containerOuter.setAttribute("tabindex","0"))}return this}},{key:"disable",value:function(){if(this.initialised){this.passedElement.disabled=!0;var e=!this.containerOuter.classList.contains(this.config.classNames.disabledState);e&&(this._removeEventListeners(),this.passedElement.setAttribute("disabled",""),this.input.setAttribute("disabled",""),this.containerOuter.classList.add(this.config.classNames.disabledState),this.containerOuter.setAttribute("aria-disabled","true"),this.isSelectOneElement&&this.containerOuter.setAttribute("tabindex","-1"))}return this}},{key:"ajax",value:function(e){var t=this;return this.initialised===!0&&this.isSelectElement&&(requestAnimationFrame(function(){t._handleLoadingState(!0)}),e(this._ajaxCallback())),this}},{key:"_triggerChange",value:function(e){e&&(0,v.triggerEvent)(this.passedElement,"change",{value:e})}},{key:"_handleButtonAction",value:function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var i=t.parentNode.getAttribute("data-id"),n=e.find(function(e){return e.id===parseInt(i,10)});this._removeItem(n),this._triggerChange(n.value),this.isSelectOneElement&&this._selectPlaceholderChoice()}}},{key:"_selectPlaceholderChoice",value:function(){var e=this.store.getPlaceholderChoice();e&&(this._addItem(e.value,e.label,e.id,e.groupId,null,e.placeholder),this._triggerChange(e.value))}},{key:"_handleItemAction",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&t&&this.config.removeItems&&!this.isSelectOneElement){var s=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(s,10)||e.highlighted?n||e.highlighted&&i.unhighlightItem(e):i.highlightItem(e)}),document.activeElement!==this.input&&this.input.focus()}}},{key:"_handleChoiceAction",value:function(e,t){if(e&&t){var i=t.getAttribute("data-id"),n=this.store.getChoiceById(i),s=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.classList.contains(this.config.classNames.activeState);if(n.keyCode=s,(0,v.triggerEvent)(this.passedElement,"choice",{choice:n}),n&&!n.selected&&!n.disabled){var r=this._canAddItem(e,n.value);r.response&&(this._addItem(n.value,n.label,n.id,n.groupId,n.customProperties,n.placeholder,n.keyCode),this._triggerChange(n.value))}this.clearInput(),o&&this.isSelectOneElement&&(this.hideDropdown(),this.containerOuter.focus())}}},{key:"_handleBackspace",value:function(e){if(this.config.removeItems&&e){var t=e[e.length-1],i=e.some(function(e){return e.highlighted});this.config.editItems&&!i&&t?(this.input.value=t.value,this._setInputWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_canAddItem",value:function(e,t){var i=!0,n=(0,v.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;(this.isSelectMultipleElement||this.isTextElement)&&this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(i=!1,n=(0,v.isType)("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),this.isTextElement&&this.config.addItems&&i&&this.config.regexFilter&&(i=this._regexFilter(t));var s=!e.some(function(e){return(0,v.isType)("String",t)?e.value===t.trim():e.value===t});return s||this.config.duplicateItems||this.isSelectOneElement||!i||(i=!1,n=(0,v.isType)("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText),{response:i,notice:n}}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.querySelector("."+this.config.classNames.placeholder);e?(this.containerOuter.classList.add(this.config.classNames.loadingState),this.containerOuter.setAttribute("aria-busy","true"),this.isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.appendChild(t)):this.input.placeholder=this.config.loadingText):(this.containerOuter.classList.remove(this.config.classNames.loadingState),this.isSelectOneElement?t.innerHTML=this.placeholder||"":this.input.placeholder=this.placeholder||"")}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,i,n){if(t&&i){var s=(0,v.isType)("Object",t)?[t]:t;s&&(0,v.isType)("Array",s)&&s.length?(e._handleLoadingState(!1),e._setLoading(!0),s.forEach(function(t){if(t.choices){var s=t.id||null;e._addGroup(t,s,i,n)}else e._addChoice(t[i],t[n],t.selected,t.disabled,void 0,t.customProperties,t.placeholder)}),e._setLoading(!1),e.isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1),e.containerOuter.removeAttribute("aria-busy")}}}},{key:"_searchChoices",value:function(e){var t=(0,v.isType)("String",e)?e.trim():e,i=(0,v.isType)("String",this.currentValue)?this.currentValue.trim():this.currentValue;if(t.length>=1&&t!==i+" "){var n=this.store.getSearchableChoices(),s=t,o=(0,v.isType)("Array",this.config.searchFields)?this.config.searchFields:[this.config.searchFields],r=Object.assign(this.config.fuseOptions,{keys:o}),a=new l.default(n,r),c=a.search(s);return this.currentValue=t,this.highlightPosition=0,this.isSearching=!0,this.store.dispatch((0,p.filterChoices)(c)),c.length}return 0}},{key:"_handleSearch",value:function(e){if(e){var t=this.store.getChoices(),i=t.some(function(e){return!e.active});if(this.input===document.activeElement)if(e&&e.length>=this.config.searchFloor){var n=0;this.config.searchChoices&&(n=this._searchChoices(e)),(0,v.triggerEvent)(this.passedElement,"search",{value:e,resultCount:n})}else i&&(this.isSearching=!1,this.store.dispatch((0,p.activateChoices)(!0)))}}},{key:"_addEventListeners",value:function(){document.addEventListener("keyup",this._onKeyUp),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("click",this._onClick),document.addEventListener("touchmove",this._onTouchMove),document.addEventListener("touchend",this._onTouchEnd),document.addEventListener("mousedown",this._onMouseDown),document.addEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.addEventListener("focus",this._onFocus),this.containerOuter.addEventListener("blur",this._onBlur)),this.input.addEventListener("input",this._onInput),this.input.addEventListener("paste",this._onPaste),this.input.addEventListener("focus",this._onFocus),this.input.addEventListener("blur",this._onBlur)}},{key:"_removeEventListeners",value:function(){document.removeEventListener("keyup",this._onKeyUp),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("click",this._onClick),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),document.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.removeEventListener("focus",this._onFocus),this.containerOuter.removeEventListener("blur",this._onBlur)),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("paste",this._onPaste),this.input.removeEventListener("focus",this._onFocus),this.input.removeEventListener("blur",this._onBlur)}},{key:"_setInputWidth",value:function(){this.placeholder?this.input.value&&this.input.value.length>=this.placeholder.length/1.25&&(this.input.style.width=(0,v.getWidthOfInput)(this.input)):this.input.style.width=(0,v.getWidthOfInput)(this.input)}},{key:"_onKeyDown",value:function(e){var t,i=this;if(e.target===this.input||this.containerOuter.contains(e.target)){var n=e.target,o=this.store.getItemsFilteredByActive(),r=this.input===document.activeElement,a=this.dropdown.classList.contains(this.config.classNames.activeState),c=this.itemList&&this.itemList.children,l=String.fromCharCode(e.keyCode),h=46,u=8,d=13,f=65,p=27,m=38,g=40,y=33,b=34,E=e.ctrlKey||e.metaKey;this.isTextElement||!/[a-zA-Z0-9-_ ]/.test(l)||a||this.showDropdown(!0),this.canSearch=this.config.searchEnabled;var _=function(){E&&c&&(i.canSearch=!1,i.config.removeItems&&!i.input.value&&i.input===document.activeElement&&i.highlightAll())},S=function(){if(i.isTextElement&&n.value){var t=i.input.value,s=i._canAddItem(o,t);s.response&&(a&&i.hideDropdown(),i._addItem(t),i._triggerChange(t),i.clearInput())}if(n.hasAttribute("data-button")&&(i._handleButtonAction(o,n),e.preventDefault()),a){e.preventDefault();var r=i.dropdown.querySelector("."+i.config.classNames.highlightedState);r&&(o[0]&&(o[0].keyCode=d),i._handleChoiceAction(o,r))}else i.isSelectOneElement&&(a||(i.showDropdown(!0),e.preventDefault()))},I=function(){a&&(i.toggleDropdown(),i.containerOuter.focus())},w=function(){if(a||i.isSelectOneElement){a||i.showDropdown(!0),i.canSearch=!1;var t=e.keyCode===g||e.keyCode===b?1:-1,n=e.metaKey||e.keyCode===b||e.keyCode===y,s=void 0;if(n)s=t>0?Array.from(i.dropdown.querySelectorAll("[data-choice-selectable]")).pop():i.dropdown.querySelector("[data-choice-selectable]");else{var o=i.dropdown.querySelector("."+i.config.classNames.highlightedState);s=o?(0,v.getAdjacentEl)(o,"[data-choice-selectable]",t):i.dropdown.querySelector("[data-choice-selectable]")}s&&((0,v.isScrolledIntoView)(s,i.choiceList,t)||i._scrollToChoice(s,t),i._highlightChoice(s)),e.preventDefault()}},T=function(){!r||e.target.value||i.isSelectOneElement||(i._handleBackspace(o),e.preventDefault())},C=(t={},s(t,f,_),s(t,d,S),s(t,p,I),s(t,m,w),s(t,y,w),s(t,g,w),s(t,b,w),s(t,u,T),s(t,h,T),t);C[e.keyCode]&&C[e.keyCode]()}}},{key:"_onKeyUp",value:function(e){if(e.target===this.input){var t=this.input.value,i=this.store.getItemsFilteredByActive(),n=this._canAddItem(i,t);if(this.isTextElement){var s=this.dropdown.classList.contains(this.config.classNames.activeState);if(t){if(n.notice){var o=this._getTemplate("notice",n.notice);this.dropdown.innerHTML=o.outerHTML}n.response===!0?s||this.showDropdown():!n.notice&&s&&this.hideDropdown()}else s&&this.hideDropdown()}else{var r=46,a=8;e.keyCode!==r&&e.keyCode!==a||e.target.value?this.canSearch&&n.response&&this._handleSearch(this.input.value):!this.isTextElement&&this.isSearching&&(this.isSearching=!1,this.store.dispatch((0,p.activateChoices)(!0)))}this.canSearch=this.config.searchEnabled}}},{key:"_onInput",value:function(){this.isSelectOneElement||this._setInputWidth()}},{key:"_onTouchMove",value:function(){this.wasTap===!0&&(this.wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=e.target||e.touches[0].target,i=this.dropdown.classList.contains(this.config.classNames.activeState);this.wasTap===!0&&this.containerOuter.contains(t)&&(t!==this.containerOuter&&t!==this.containerInner||this.isSelectOneElement||(this.isTextElement?document.activeElement!==this.input&&this.input.focus():i||this.showDropdown(!0)),e.stopPropagation()),this.wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target;if(t===this.choiceList&&this.isIe11&&(this.isScrollingOnIe=!0),this.containerOuter.contains(t)&&t!==this.input){var i=void 0,n=this.store.getItemsFilteredByActive(),s=e.shiftKey;(i=(0,v.findAncestorByAttrName)(t,"data-button"))?this._handleButtonAction(n,i):(i=(0,v.findAncestorByAttrName)(t,"data-item"))?this._handleItemAction(n,i,s):(i=(0,v.findAncestorByAttrName)(t,"data-choice"))&&this._handleChoiceAction(n,i),e.preventDefault()}}},{key:"_onClick",value:function(e){var t=e.target,i=this.dropdown.classList.contains(this.config.classNames.activeState),n=this.store.getItemsFilteredByActive();if(this.containerOuter.contains(t))t.hasAttribute("data-button")&&this._handleButtonAction(n,t),i?this.isSelectOneElement&&t!==this.input&&!this.dropdown.contains(t)&&this.hideDropdown(!0):this.isTextElement?document.activeElement!==this.input&&this.input.focus():this.canSearch?this.showDropdown(!0):(this.showDropdown(),this.containerOuter.focus());else{var s=n.some(function(e){return e.highlighted});s&&this.unhighlightAll(),this.containerOuter.classList.remove(this.config.classNames.focusState),i&&this.hideDropdown()}}},{key:"_onMouseOver",value:function(e){(e.target===this.dropdown||this.dropdown.contains(e.target))&&e.target.hasAttribute("data-choice")&&this._highlightChoice(e.target)}},{key:"_onPaste",value:function(e){e.target!==this.input||this.config.paste||e.preventDefault()}},{key:"_onFocus",value:function(e){var t=this,i=e.target;if(this.containerOuter.contains(i)){var n=this.dropdown.classList.contains(this.config.classNames.activeState),s={text:function(){i===t.input&&t.containerOuter.classList.add(t.config.classNames.focusState)},"select-one":function(){t.containerOuter.classList.add(t.config.classNames.focusState),i===t.input&&(n||t.showDropdown())},"select-multiple":function(){i===t.input&&(t.containerOuter.classList.add(t.config.classNames.focusState),n||t.showDropdown(!0))}};s[this.passedElement.type]()}}},{key:"_onBlur",value:function(e){var t=this,i=e.target;if(this.containerOuter.contains(i)&&!this.isScrollingOnIe){var n=this.store.getItemsFilteredByActive(),s=this.dropdown.classList.contains(this.config.classNames.activeState),o=n.some(function(e){return e.highlighted}),r={text:function(){i===t.input&&(t.containerOuter.classList.remove(t.config.classNames.focusState),o&&t.unhighlightAll(),s&&t.hideDropdown())},"select-one":function(){t.containerOuter.classList.remove(t.config.classNames.focusState),i===t.containerOuter&&s&&!t.canSearch&&t.hideDropdown(),i===t.input&&s&&t.hideDropdown()},"select-multiple":function(){i===t.input&&(t.containerOuter.classList.remove(t.config.classNames.focusState),s&&t.hideDropdown(),o&&t.unhighlightAll())}};r[this.passedElement.type]()}else this.isScrollingOnIe=!1,this.input.focus()}},{key:"_regexFilter",value:function(e){if(!e)return!1;var t=this.config.regexFilter,i=new RegExp(t.source,"i");return i.test(e)}},{key:"_scrollToChoice",value:function(e,t){var i=this;if(e){var n=this.choiceList.offsetHeight,s=e.offsetHeight,o=e.offsetTop+s,r=this.choiceList.scrollTop+n,a=t>0?this.choiceList.scrollTop+o-r:e.offsetTop,c=function e(){var n=4,s=i.choiceList.scrollTop,o=!1,r=void 0,c=void 0;t>0?(r=(a-s)/n,c=r>1?r:1,i.choiceList.scrollTop=s+c,s1?r:1,i.choiceList.scrollTop=s-c,s>a&&(o=!0)),o&&requestAnimationFrame(function(i){e(i,a,t)})};requestAnimationFrame(function(e){c(e,a,t)})}}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=Array.from(this.dropdown.querySelectorAll("[data-choice-selectable]")),n=t;if(i&&i.length){var s=Array.from(this.dropdown.querySelectorAll("."+this.config.classNames.highlightedState));s.forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),n?this.highlightPosition=i.indexOf(n):(n=i.length>this.highlightPosition?i[this.highlightPosition]:i[i.length-1],n||(n=i[0])),n.classList.add(this.config.classNames.highlightedState),n.setAttribute("aria-selected","true"),this.containerOuter.setAttribute("aria-activedescendant",n.id)}}},{key:"_addItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=(0,v.isType)("String",e)?e.trim():e,c=r,l=this.store.getItems(),h=t||a,u=parseInt(i,10)||-1,d=n>=0?this.store.getGroupById(n):null,f=l?l.length+1:1;return this.config.prependValue&&(a=this.config.prependValue+a.toString()),this.config.appendValue&&(a+=this.config.appendValue.toString()),this.store.dispatch((0,p.addItem)(a,h,f,u,n,s,o,c)), +this.isSelectOneElement&&this.removeActiveItems(f),d&&d.value?(0,v.triggerEvent)(this.passedElement,"addItem",{id:f,value:a,label:h,customProperties:s,groupValue:d.value,keyCode:c}):(0,v.triggerEvent)(this.passedElement,"addItem",{id:f,value:a,label:h,customProperties:s,keyCode:c}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,v.isType)("Object",e))return this;var t=e.id,i=e.value,n=e.label,s=e.choiceId,o=e.groupId,r=o>=0?this.store.getGroupById(o):null;return this.store.dispatch((0,p.removeItem)(t,s)),r&&r.value?(0,v.triggerEvent)(this.passedElement,"removeItem",{id:t,value:i,label:n,groupValue:r.value}):(0,v.triggerEvent)(this.passedElement,"removeItem",{id:t,value:i,label:n}),this}},{key:"_addChoice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;if("undefined"!=typeof e&&null!==e){var c=this.store.getChoices(),l=t||e,h=c?c.length+1:1,u=this.baseId+"-"+this.idNames.itemChoice+"-"+h;this.store.dispatch((0,p.addChoice)(e,l,h,s,n,u,o,r,a)),i&&this._addItem(e,l,h,void 0,o,r,a)}}},{key:"_clearChoices",value:function(){this.store.dispatch((0,p.clearChoices)())}},{key:"_addGroup",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"label",o=(0,v.isType)("Object",e)?e.choices:Array.from(e.getElementsByTagName("OPTION")),r=t?t:Math.floor((new Date).valueOf()*Math.random()),a=!!e.disabled&&e.disabled;o?(this.store.dispatch((0,p.addGroup)(e.label,r,!0,a)),o.forEach(function(e){var t=e.disabled||e.parentNode&&e.parentNode.disabled;i._addChoice(e[n],(0,v.isType)("Object",e)?e[s]:e.innerHTML,e.selected,t,r,e.customProperties,e.placeholder)})):this.store.dispatch((0,p.addGroup)(e.label,e.id,!1,e.disabled))}},{key:"_getTemplate",value:function(e){if(!e)return null;for(var t=this.config.templates,i=arguments.length,n=Array(i>1?i-1:0),s=1;s
\n ')},containerInner:function(){return(0,v.strToEl)('\n
\n ')},itemList:function(){var i,n=(0,u.default)(t.list,(i={},s(i,t.listSingle,e.isSelectOneElement),s(i,t.listItems,!e.isSelectOneElement),i));return(0,v.strToEl)('\n
\n ')},placeholder:function(e){return(0,v.strToEl)('\n
\n '+e+"\n
\n ")},item:function(i){var n,o=(0,u.default)(t.item,(n={},s(n,t.highlightedState,i.highlighted),s(n,t.itemSelectable,!i.highlighted),s(n,t.placeholder,i.placeholder),n));if(e.config.removeItemButton){var r;return o=(0,u.default)(t.item,(r={},s(r,t.highlightedState,i.highlighted),s(r,t.itemSelectable,!i.disabled),s(r,t.placeholder,i.placeholder),r)),(0,v.strToEl)('\n \n "+i.label+'\n Remove item\n \n \n ")}return(0,v.strToEl)('\n \n "+i.label+"\n \n ")},choiceList:function(){return(0,v.strToEl)('\n \n \n ")},choiceGroup:function(e){var i=(0,u.default)(t.group,s({},t.itemDisabled,e.disabled));return(0,v.strToEl)('\n \n
'+e.value+"
\n \n ")},choice:function(i){var n,o=(0,u.default)(t.item,t.itemChoice,(n={},s(n,t.itemDisabled,i.disabled),s(n,t.itemSelectable,!i.disabled),s(n,t.placeholder,i.placeholder),n));return(0,v.strToEl)('\n 0?'role="treeitem"':'role="option"')+"\n >\n "+i.label+"\n \n ")},input:function(){var e=(0,u.default)(t.input,t.inputCloned);return(0,v.strToEl)('\n \n ')},dropdown:function(){var e=(0,u.default)(t.list,t.listDropdown);return(0,v.strToEl)('\n