Skip to content

Commit

Permalink
Merge pull request #53 from FANMixco/buy-me-a-coffee
Browse files Browse the repository at this point in the history
Split library
  • Loading branch information
FANMixco authored Oct 24, 2021
2 parents f0de778 + 952fb3c commit 44b775e
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.vscode/settings.json
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ <h4 class="hCustom" data-tag="timeMaximum"></h4>
<span data-tag="copyright1"></span><a rel='noreferrer' class="externalLinks" target="_blank" href="https://federiconavarrete.com">Federico Navarrete</a><span data-tag="copyright2"></span><a rel='noreferrer' class="externalLinks" target="_blank" href="https://bit.ly/3uK4lKI">The Leader Ship Toastmasters</a><span id='spanCopyright3' data-tag="copyright3"></span>. <a rel='noreferrer' class="externalLinks" href="https://github.com/sponsors/FANMixco" target="_blank"><span id='sponsorUs' data-tag="sponsorUs"></span></a>.
</footer>

<script data-name="BMC-Widget" data-cfasync="false" src="https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js" data-id="fanmixco" data-description="Support me on Buy me a coffee!" data-message="Help me improve this amazing app! Buy me a coffee!" data-color="#5F7FFF" data-position="Right" data-x_margin="18" data-y_margin="18"></script>
<script src="js/lib/buyMeACoffee.min.js"></script>

<!--Browser ONLY actions-->
<script src="browserSpecific/js/dialog-polyfill.min.js"></script>
Expand Down
64 changes: 64 additions & 0 deletions js/lib/buyMeACoffee.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const supLang = ["en", "es", "pl", "cs", "ru", "it", "de", "nl", "zh"];
const langCoffee = {
"cs": {
"buyMeACoffee": "Podpořte mě na Kupte mi kávu!",
"buyMeACoffeeMsg": "Zmocněte mě k vylepšení této neuvěřitelné aplikace! Kup mi kávu!"
},
"de": {
"buyMeACoffee": "Unterstütze mich bei Kauf mir einen Kaffee!",
"buyMeACoffeeMsg": "Ermächtige mich, diese unglaubliche App zu verbessern! Kauf mir einen Kaffee!"
},
"en": {
"buyMeACoffee": "Support me on Buy me a coffee!",
"buyMeACoffeeMsg": "Empower me to improve this incredible app! Buy me a coffee!"
},
"es": {
"buyMeACoffee": "¡Apóyame en Cómpreme un café!",
"buyMeACoffeeMsg": "Empoderame a mejorar esta increíble aplicación! ¡Cómprame un café!"
},
"it": {
"buyMeACoffee": "Supportami su Comprami un caffè!",
"buyMeACoffeeMsg": "Consentimi di migliorare questa incredibile app! Offrimi un caffè!"
},
"nl": {
"buyMeACoffee": "Steun me op Koop me een koffie!",
"buyMeACoffeeMsg": "Geef me de mogelijkheid om deze ongelooflijke app te verbeteren! Koop een koffie voor me!"
},
"pl": {
"buyMeACoffee": "Wesprzyj mnie na Kup mi kawę!",
"buyMeACoffeeMsg": "Daj mi możliwość ulepszenia tej niesamowitej aplikacji! Kup mi kawę!"
},
"ru": {
"buyMeACoffee": "Поддержи меня на Купи мне кофе!",
"buyMeACoffeeMsg": "Дайте мне возможность улучшить это невероятное приложение! Купи мне кофе!"
},
"zh": {
"buyMeACoffee": "支持我给我买杯咖啡!",
"buyMeACoffeeMsg": "使我能够改进这个令人难以置信的应用程序! 给我买杯咖啡!"
}
};

let lngTemp = navigator.languages
? navigator.languages[0]
: (navigator.language || navigator.userLanguage);

if (lngTemp.includes('-'))
lngTemp = lngTemp.split('-')[0];

if (!supLang.includes(lngTemp))
lngTemp = "en";

let buy_me_coffee = document.createElement('script');

buy_me_coffee.setAttribute('src','https://cdnjs.buymeacoffee.com/1.0.0/widget.prod.min.js');
buy_me_coffee.dataset.name = "BMC-Widget";
buy_me_coffee.dataset.cfasync = "false";
buy_me_coffee.dataset.id = "fanmixco";
buy_me_coffee.dataset.description = langCoffee[lngTemp].buyMeACoffee;
buy_me_coffee.dataset.message = langCoffee[lngTemp].buyMeACoffeeMsg;
buy_me_coffee.dataset.color = "#5F7FFF";
buy_me_coffee.dataset.position = "Right";
buy_me_coffee.dataset.x_margin = "18";
buy_me_coffee.dataset.y_margin = "18";

document.body.appendChild(buy_me_coffee);
1 change: 1 addition & 0 deletions js/lib/buyMeACoffee.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/lib/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let lngObject;

function load() {
let translate = new Translate();
lang = navigator.language || navigator.userLanguage;
lang = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage);

if (lang.includes('-'))
lang = lang.split('-')[0];
Expand Down
2 changes: 1 addition & 1 deletion js/lib/translate.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions js/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ function pauseTimer() {
} else {
fade.to(document.getElementById('bmc-wbtn'), fastTransition, 0.1);
}
document.getElementById('bmc-wbtn').style.pointerEvents = 'none';
} else {
imgRestart.src = "img/icons-svg/restart.svg";
unfadeElements();
Expand All @@ -464,6 +465,7 @@ function unfadeElements() {
fade.to(document.getElementById('controls'), fastTransition, 1.5);
fade.to(document.getElementsByClassName('circle')[0], fastTransition, 1.5);
fade.to(document.getElementById('bmc-wbtn'), fastTransition, 1.5);
document.getElementById('bmc-wbtn').style.pointerEvents = '';
}

function displayTimeLeft(timeLeft) { //displays time on the input
Expand Down
2 changes: 1 addition & 1 deletion js/timer.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dir": "ltr",
"lang": "da",
"name": "Toastmasters Timer",
"version": "2.3.1.4",
"version": "2.3.1.5",
"scope": "/toastmasters-timer-material-design/",
"display": "fullscreen",
"start_url": "https://fanmixco.github.io/toastmasters-timer-material-design/",
Expand Down

0 comments on commit 44b775e

Please sign in to comment.