Skip to content

Commit affe407

Browse files
authored
Firefox: Current tab's Toolbar theme fix in Mixed Mode (#78)
* Refactor checks for mixed mode; Fixes incorrect toolbar theme in *mixed mode* when toggling search widget; Fixes incorrect toolbar theme in *mixed mode* when rapidly creating tabs;
1 parent 7a66771 commit affe407

4 files changed

Lines changed: 26 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Changelog
22
---
33

44
# Unreleased
5+
# 15.0.3 [Firefox: Theming Bug Fixes]
6+
- Fixes incorrect toolbar theme in *mixed mode* when rapidly creating tabs.([#77](https://github.com/doki-theme/doki-theme-web/issues/77))
7+
- Fixes incorrect toolbar theme in *mixed mode* when toggling search widget.([#77](https://github.com/doki-theme/doki-theme-web/issues/77))
58

69
# 15.0.2 [Firefox History Sidebar Theming]
710

firefoxThemes/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Doki Theme for Firefox",
33
"short_name": "Doki Theme",
4-
"version": "15.0.2",
4+
"version": "15.0.3",
55
"description": "A theme collection of girls from various anime, manga, and visual novels series.",
66
"manifest_version": 2,
77
"icons": {

firefoxThemes/modules/modes/mix.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,21 @@ function setupMixedUpdate(msg) {
121121
});
122122
});
123123
}
124-
124+
/*Checks if tab is added to the local mixedlist.
125+
* If not, then add it in.*/
126+
function localMixedListCheck(tabId,themes){
127+
if (!mixedList.has(tabId)) {
128+
mixedList.set(tabId, getRandomThemeId(themes));
129+
browser.storage.local.set({mixedTabs: mixedList});
130+
}
131+
}
132+
/*Get the Current Tab's Theme from the local mixed list*/
133+
function getCurrentTabTheme(currentThemeId,tabId){
134+
if(currentThemeId !== mixedList.get(tabId)){
135+
browser.storage.local.set({currentThemeId: mixedList.get(tabId)});
136+
}
137+
return mixedList.get(tabId);
138+
}
125139
/*MESSAGE: Send a message to the page to apply theme*/
126140
function pageResponse(msg) {
127141
if (!msg.mixMSG) return;
@@ -135,20 +149,20 @@ function pageResponse(msg) {
135149
showWidget: storage.showWidget,
136150
});
137151
} else {
138-
if (!mixedList.has(msg.pageTab.id)) {
139-
mixedList.set(msg.pageTab.id, getRandomThemeId(storage.waifuThemes.themes));
140-
browser.storage.local.set({mixedTabs: mixedList});
141-
}
152+
localMixedListCheck(msg.pageTab.id,storage.waifuThemes.themes);
142153
browser.tabs.sendMessage(msg.pageTab.id, {
143154
pageMSG: true,
144155
waifuThemes: storage.waifuThemes,
145-
currentThemeId: storage.currentThemeId,
156+
currentThemeId: getCurrentTabTheme(storage.currentThemeId,msg.pageTab.id),
146157
backgroundType: storage.backgroundType,
147158
showWidget: storage.showWidget,
148159
mixedTabs: mixedList,
149160
pageTab: msg.pageTab
150161
});
151-
loadTheme(storage.waifuThemes.themes, mixedList.get(msg.pageTab.id));
162+
//Load theme for active(currently shown) tab only
163+
if(msg.pageTab.active){
164+
loadTheme(storage.waifuThemes.themes, mixedList.get(msg.pageTab.id));
165+
}
152166
}
153167
});
154168
}

firefoxThemes/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "doki-theme-firefox",
3-
"version": "15.0.2",
3+
"version": "15.0.3",
44
"description": "A theme collection of girls from various anime, manga, and visual novels series.",
55
"main": "index.js",
66
"repository": "https://github.com/doki-theme/doki-theme-web",

0 commit comments

Comments
 (0)