|
@@ -125,12 +125,25 @@ Manage.prototype.loadAudio = function() {
|
|
|
this.switchBgmState(true);
|
|
|
});
|
|
|
|
|
|
- $("#volume")
|
|
|
- .find("a")
|
|
|
+ window.addEventListener('themechange', (e) => {
|
|
|
+ if ($("#bg-music-btn")[0].src.indexOf(`bgm_off_`) > -1) {
|
|
|
+ setTimeout(() => {
|
|
|
+ let theme = ''
|
|
|
+ if($('#app')[0]) {
|
|
|
+ theme = $('#app')[0].className.substring(5)
|
|
|
+ } else {
|
|
|
+ theme = 'huyangjin'
|
|
|
+ }
|
|
|
+ $("#bg-music-btn").attr("src", `../static/images/bgm_off_${theme}.png`);
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ $("#bg-music-btn")
|
|
|
.on("click", () => {
|
|
|
- if ($("#volume img")[0].src.indexOf("btn_on.png") > -1) {
|
|
|
+ if ($("#bg-music-btn")[0].src.indexOf("bgm_on.png") > -1) {
|
|
|
this.switchBgmState(true);
|
|
|
- } else if ($("#volume img")[0].src.indexOf("btn_off.png") > -1) {
|
|
|
+ } else if ($("#bg-music-btn")[0].src.indexOf(`bgm_off_`) > -1) {
|
|
|
this.switchBgmState(false);
|
|
|
}
|
|
|
});
|
|
@@ -140,18 +153,25 @@ Manage.prototype.switchBgmState = function(state) {
|
|
|
if (!g_bgAudio || !g_bgAudio.src) return;
|
|
|
|
|
|
var played = function() {
|
|
|
- console.log("begin play bgm");
|
|
|
g_play = 1;
|
|
|
g_playAudio = g_bgAudio;
|
|
|
- $("#volume a img").attr("src", "./images/Volume btn_off.png");
|
|
|
- $("#volume").attr("title", "关闭声音");
|
|
|
+
|
|
|
+ let theme = ''
|
|
|
+ if($('#app')[0]) {
|
|
|
+ theme = $('#app')[0].className.substring(5)
|
|
|
+ } else {
|
|
|
+ theme = 'huyangjin'
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#bg-music-btn").attr("src", `../static/images/bgm_off_${theme}.png`);
|
|
|
+ $("#bg-music-btn").attr("title", "关闭声音");
|
|
|
g_tourAudio && g_tourAudio.pause();
|
|
|
};
|
|
|
var paused = function() {
|
|
|
g_play = 0;
|
|
|
g_playAudio == g_bgAudio && (g_playAudio = null);
|
|
|
- $("#volume a img").attr("src", "./images/Volume btn_on.png");
|
|
|
- $("#volume").attr("title", "打开声音");
|
|
|
+ $("#bg-music-btn").attr("src", "../static/images/bgm_on.png");
|
|
|
+ $("#bg-music-btn").attr("title", "打开声音");
|
|
|
};
|
|
|
|
|
|
if (state) {
|