Skip to content

Commit f98de42

Browse files
authored
Update index.js
1 parent c41881d commit f98de42

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

js/index.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const DEFAULTSETTINGS = {
88
settime : false, // Always update time when we connect
99
favourites : ["launch"],
1010
language : "",
11-
appsFavoritedThisSession : [], // list of apps favourited before database was updated
11+
appsfavouritedThisSession : [], // list of apps favourited before database was updated
1212
bleCompat: false, // 20 byte MTU BLE Compatibility mode
1313
sendUsageStats: true, // send usage stats to banglejs.com
1414
alwaysAllowUpdate : false, // Always show "reinstall app" button regardless of the version
@@ -505,10 +505,10 @@ function changeAppFavourite(favourite, app,refresh=true) {
505505

506506

507507
if (favourite) {
508-
SETTINGS.appsFavoritedThisSession.push({"id":app.id,"favs":appSortInfo[app.id]&&appSortInfo[app.id].favourites?appSortInfo[app.id].favourites:0});
508+
SETTINGS.appsfavouritedThisSession.push({"id":app.id,"favs":appSortInfo[app.id]&&appSortInfo[app.id].favourites?appSortInfo[app.id].favourites:0});
509509
SETTINGS.favourites = SETTINGS.favourites.concat([app.id]);
510510
} else {
511-
SETTINGS.appsFavoritedThisSession = SETTINGS.appsFavoritedThisSession.filter(obj => obj.id !== app.id);
511+
SETTINGS.appsfavouritedThisSession = SETTINGS.appsfavouritedThisSession.filter(obj => obj.id !== app.id);
512512
SETTINGS.favourites = SETTINGS.favourites.filter(e => e != app.id);
513513
}
514514

@@ -550,17 +550,17 @@ librarySearchInput.addEventListener('input', evt => {
550550

551551

552552

553-
function getAppFavorites(app){
553+
function getAppfavourites(app){
554554
let info = appSortInfo[app.id] || {};
555555
// start with whatever number we have in the database (may be undefined -> treat as 0)
556556
let appFavourites = (typeof info.favourites === 'number') ? info.favourites : 0;
557-
let favsThisSession = SETTINGS.appsFavoritedThisSession.find(obj => obj.id === app.id);
557+
let favsThisSession = SETTINGS.appsfavouritedThisSession.find(obj => obj.id === app.id);
558558
if (favsThisSession) {
559559
// If the database count changed since we recorded the session-favourite, it means
560560
// the server/db has been updated and our optimistic session entry is stale.
561561
if (typeof info.favourites === 'number' && info.favourites !== favsThisSession.favs) {
562562
// remove stale session entry
563-
SETTINGS.appsFavoritedThisSession = SETTINGS.appsFavoritedThisSession.filter(obj => obj.id !== app.id);
563+
SETTINGS.appsfavouritedThisSession = SETTINGS.appsfavouritedThisSession.filter(obj => obj.id !== app.id);
564564
} else {
565565
// otherwise include our optimistic +1 so the UI updates immediately
566566
appFavourites += 1;
@@ -586,7 +586,7 @@ function getAppHTML(app, appInstalled, forInterface) {
586586
infoTxt.push(`${info.installs} reported installs (${percentText})`);
587587
}
588588
if (info.favourites) {
589-
appFavourites = getAppFavorites(app);
589+
appFavourites = getAppfavourites(app);
590590
let percent=(appFavourites / info.installs * 100).toFixed(0);
591591
let percentText=percent>100?"More than 100% of installs":percent+"% of installs";
592592
if(!info.installs||info.installs<1) {infoTxt.push(`${appFavourites} users favourited`);}
@@ -668,15 +668,15 @@ function refreshSort(){
668668
if(activeSort) sortContainer.querySelector('.chip[sortid="'+activeSort+'"]').classList.add('active');
669669
else sortContainer.querySelector('.chip[sortid]').classList.add('active');
670670
}
671-
function handleFavoriteClick(icon,app,button){
671+
function handlefavouriteClick(icon,app,button){
672672
const favAnimMS = 500; // duration of favourite animation in ms
673673
// clicked: animate and toggle favourite state immediately for instant feedback
674674
let favourite = SETTINGS.favourites.find(e => e == app.id);
675675
changeAppFavourite(!favourite, app,false);
676676
if (icon) icon.classList.toggle("icon-favourite-active", !favourite);
677677
if (icon) icon.classList.add("favoriteAnim");
678678
// update visible count optimistically (always update, even if 0)
679-
let cnt = getAppFavorites(app);
679+
let cnt = getAppfavourites(app);
680680
let txt = (cnt > 999) ? Math.round(cnt/100)/10+"k" : cnt;
681681
let countEl = button.querySelector('.fav-count');
682682
if (countEl) countEl.textContent = String(txt);
@@ -877,7 +877,7 @@ function refreshLibrary(options) {
877877
if (err != "") showToast("Failed, "+err, "error");
878878
});
879879
} else if ( button.classList.contains("btn-favourite")) {
880-
handleFavoriteClick(icon,app,button);
880+
handlefavouriteClick(icon,app,button);
881881
}
882882
});
883883
});
@@ -1156,7 +1156,7 @@ function refreshMyApps() {
11561156
});
11571157
// handle favourites on My Apps page (button has class btn-favourite)
11581158
if (button.classList && button.classList.contains("btn-favourite")) {
1159-
handleFavoriteClick(icon,app,button);
1159+
handlefavouriteClick(icon,app,button);
11601160
}
11611161
});
11621162
});
@@ -1399,7 +1399,7 @@ function loadSettings() {
13991399
console.error("Invalid settings");
14001400
}
14011401
// upgrade old settings
1402-
if(!SETTINGS.appsFavoritedThisSession) SETTINGS.appsFavoritedThisSession = [];
1402+
if(!SETTINGS.appsfavouritedThisSession) SETTINGS.appsfavouritedThisSession = [];
14031403
}
14041404
/// Save settings
14051405
function saveSettings() {

0 commit comments

Comments
 (0)