diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/_locales/az_AZ/messages.json b/_locales/az_AZ/messages.json old mode 100644 new mode 100755 diff --git a/_locales/de_DE/messages.json b/_locales/de_DE/messages.json old mode 100644 new mode 100755 diff --git a/_locales/en_US/messages.json b/_locales/en_US/messages.json old mode 100644 new mode 100755 index 01bc01c..ea22f50 --- a/_locales/en_US/messages.json +++ b/_locales/en_US/messages.json @@ -1,6 +1,6 @@ { "badgeTooltip": { - "message": "1 bitcoin is worth $1 today", + "message": "1 bitcoin is worth $1", "description": "Text that shows up when the mouse is hovering over the add-on's button in the browser's toolbar." }, "extensionDescription": { diff --git a/_locales/es_ES/messages.json b/_locales/es_ES/messages.json old mode 100644 new mode 100755 diff --git a/_locales/fa_IR/messages.json b/_locales/fa_IR/messages.json old mode 100644 new mode 100755 diff --git a/_locales/fr_FR/messages.json b/_locales/fr_FR/messages.json old mode 100644 new mode 100755 diff --git a/_locales/id_ID/messages.json b/_locales/id_ID/messages.json old mode 100644 new mode 100755 diff --git a/_locales/it_IT/messages.json b/_locales/it_IT/messages.json old mode 100644 new mode 100755 diff --git a/_locales/kk_KZ/messages.json b/_locales/kk_KZ/messages.json old mode 100644 new mode 100755 diff --git a/_locales/nl_NL/messages.json b/_locales/nl_NL/messages.json old mode 100644 new mode 100755 diff --git a/_locales/pt_BR/messages.json b/_locales/pt_BR/messages.json old mode 100644 new mode 100755 diff --git a/_locales/ru_RU/messages.json b/_locales/ru_RU/messages.json old mode 100644 new mode 100755 diff --git a/_locales/uk_UA/messages.json b/_locales/uk_UA/messages.json old mode 100644 new mode 100755 diff --git a/crowdin.yml b/crowdin.yml old mode 100644 new mode 100755 diff --git a/icons/icon-128.png b/icons/icon-128.png old mode 100644 new mode 100755 diff --git a/icons/icon-16.png b/icons/icon-16.png old mode 100644 new mode 100755 diff --git a/icons/icon-32.png b/icons/icon-32.png old mode 100644 new mode 100755 diff --git a/icons/icon-48.png b/icons/icon-48.png old mode 100644 new mode 100755 diff --git a/icons/icon-64.png b/icons/icon-64.png old mode 100644 new mode 100755 diff --git a/icons/icon.svg b/icons/icon.svg old mode 100644 new mode 100755 diff --git a/manifest.json b/manifest.json old mode 100644 new mode 100755 index 890b20a..a998490 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "Yet Another Bitcoin Price Ticker", "short_name": "YABPT", - "version": "1.5.3", + "version": "1.5.5", "description": "__MSG_extensionDescription__", "icons": { "16": "icons/icon-16.png", diff --git a/options/css/countrySelect.min.css b/options/css/countrySelect.min.css old mode 100644 new mode 100755 diff --git a/options/css/options.css b/options/css/options.css old mode 100644 new mode 100755 diff --git a/options/images/flags.png b/options/images/flags.png old mode 100644 new mode 100755 diff --git a/options/js/countrySelect.js b/options/js/countrySelect.js old mode 100644 new mode 100755 diff --git a/options/js/jquery-3.3.1.slim.min.js b/options/js/jquery-3.3.1.slim.min.js old mode 100644 new mode 100755 diff --git a/options/js/options.js b/options/js/options.js old mode 100644 new mode 100755 index 38aa389..2122bb9 --- a/options/js/options.js +++ b/options/js/options.js @@ -8,15 +8,23 @@ var currencies = $.fn.countrySelect.getCountryData(); function saveOptions() { - setOption('currency', $('#currency').countrySelect('getSelectedCountryData').currency); - } + var option = { + currency: $('#currency').countrySelect('getSelectedCountryData').currency, + frequency: document.getElementById('frequency').value, + upperLimit: document.getElementById('upperLimit').value, + lowerLimit: document.getElementById('lowerLimit').value + } + + setOption(option); - function setOption(option, value) { - var yabpt = {}; - yabpt[option] = value; + } + function setOption(option) { chrome.storage.local.set({ - yabpt: yabpt + currency: option['currency'], + frequency: option['frequency'], + upperLimit: option['upperLimit'], + lowerLimit: option['lowerLimit'] }); } @@ -32,20 +40,29 @@ desc.text(chrome.i18n.getMessage('option_' + pref + '_summary')); }); - chrome.storage.local.get('yabpt', function (res) { + chrome.storage.local.get('currency', function (res) { var selectedCountry = 'us'; for (var i = 0; i < currencies.length; i++) { var item = currencies[i]; - if (res.yabpt.currency == item.currency) { + if (res.currency == item.currency) { selectedCountry = item.iso2; } } $('#currency').countrySelect('selectCountry', selectedCountry); }); + chrome.storage.local.get(function (res) { + document.getElementById('frequency').value = res.frequency; + document.getElementById('upperLimit').value = res.upperLimit; + document.getElementById('lowerLimit').value = res.lowerLimit; + }); + } document.addEventListener('DOMContentLoaded', restoreOptions); $('#currency').change(function () { saveOptions(); }); + $('input').change(function () { + saveOptions(); + }); })(); diff --git a/options/options.html b/options/options.html old mode 100644 new mode 100755 index 37f228c..f17b63c --- a/options/options.html +++ b/options/options.html @@ -18,6 +18,15 @@
Display current Bitcoin price in selected currency +
+ Refresh frequency: every Seconds +
+
+ Upper limit notice: reaching $ per bitcoin +
+
+ Lower limit notice: reaching $ per bitcoin +
diff --git a/package.json b/package.json old mode 100644 new mode 100755 diff --git a/src/background.js b/src/background.js old mode 100644 new mode 100755 index adb3b71..161e7c4 --- a/src/background.js +++ b/src/background.js @@ -2,17 +2,23 @@ (function () { // Easy access to settings var settings = { - currency: 'USD' + currency: 'USD', + frequency: '6', + upperLimit: '0', + lowerLimit: '0' }; + var intervals = []; + + // Formats the price into currency suffixes function formatPrice(price) { var ranges = [ - { divider: 1e15, suffix: 'Q' }, - { divider: 1e12, suffix: 'T' }, - { divider: 1e9, suffix: 'B' }, - { divider: 1e6, suffix: 'M' }, - { divider: 1e3, suffix: 'K' } + { divider: 1e15, suffix: 'Q' }, + { divider: 1e12, suffix: 'T' }, + { divider: 1e9, suffix: 'B' }, + { divider: 1e6, suffix: 'M' }, + { divider: 1e3, suffix: 'K' } ]; for (var i = 0; i < ranges.length; i++) { @@ -27,11 +33,11 @@ var integerDigits = Math.floor(Math.log(intResult) * Math.LOG10E + 1); switch (integerDigits) { case 1: - return (Math.floor(10 * result) / 10).toFixed(1) + ranges[i].suffix; + return (Math.floor(10 * result) / 10).toFixed(1) + ranges[i].suffix; case 2: case 3: default: - return Math.round(result) + ranges[i].suffix; + return Math.round(result) + ranges[i].suffix; } } } @@ -39,18 +45,26 @@ } function updateBadgeText(price) { + var refreshTime = getNowFormatDate(); var badgeText = formatPrice(price); + if (price>settings.upperLimit&&settings.upperLimit!='0') { + browser.tabs.create({url: "https://blockchain.info/"}); + } else if (price= 1 && month <= 9) { +         month = "0" + month; +     } + if (hours >= 1 && hours <= 9) { +         hours = "0" + hours; +     } + if (minutes >= 1 && minutes <= 9) { +         minutes = "0" + minutes; +     } + if (seconds >= 1 && seconds <= 9) { +         seconds = "0" + seconds; +     } +     if (strDate >= 0 && strDate <= 9) { +         strDate = "0" + strDate; +     } +     var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate +             + " " + hours + seperator2 + minutes +             + seperator2 + seconds; +     return currentdate; + } + setupBadge(); setupStorage(); - getCurrencyFromStorage(); - setupInterval(); })(); diff --git a/web-ext-config.js b/web-ext-config.js old mode 100644 new mode 100755