GamePortrait/node_modules/.cache/babel-loader/6d21a6163eb5e2b20723d748049087cda6a9fd03bdcded8a9c1247d73efc7d98.json

1 line
8.7 KiB
JSON

{"ast":null,"code":"/* eslint-disable */\nimport $store from \"@/store\";\nconst volume = $store.state.config.volume;\nlet Mp3List = [],\n num = 0;\nfunction getBlob(key) {\n const soundList = $store.state.config.soundList;\n const language = $store.state.config.$Type == \"cn\" || $store.state.config.$Type == \"tw\" ? \"cn\" : \"en\";\n let blob = \"\";\n try {\n blob = soundList[`${language}_${key}`];\n blob = window.webkitURL.createObjectURL(blob) || URL.createObjectURL(blob);\n } catch (err) {\n console.warn(err, key);\n }\n return blob;\n}\nlet audio = null;\nconst audioElement = document.getElementById(\"Audio\");\nconst sourceElement = document.getElementById(\"audioSourceAside\");\naudio = audioElement;\naudio.addEventListener(\"ended\", () => {\n nextAudio(audio, sourceElement);\n});\nfunction audioMp3(mp3List) {\n const effectsVolume = $store.state.config.effectsVolume;\n // const audioElement = document.createElement(\"audio\")\n // const sourceElement = document.createElement(\"source\")\n // audio.appendChild(sourceElement)\n // audio.volume = volume.effects / 100\n audio.muted = !effectsVolume;\n Mp3List = mp3List;\n var mp3 = new Object();\n mp3.mp3List = mp3List;\n mp3.auto_play = false;\n mp3.loop = false;\n mp3.Play = function () {\n if (this.mp3List[0]) {\n sourceElement.src = getBlob(this.mp3List[0]);\n sourceElement.type = \"audio/mpeg\";\n audio.pause();\n audio.load();\n setTimeout(() => {\n audio.play().catch(err => {\n console.log(err);\n }, 200);\n });\n }\n };\n mp3.Pause = function () {\n audio.pause();\n };\n mp3.Muted = function () {\n audio.muted ? audio.muted = false : audio.muted = true;\n };\n mp3.volumeAdd = function () {\n if (audio.volume.toFixed(1) >= 1) {\n audio.volume = 1;\n } else {\n audio.volume = audio.volume + 0.1;\n }\n };\n mp3.volumeMinus = function () {\n if (audio.volume.toFixed(1) <= 0) {\n audio.volume = 0;\n } else {\n audio.volume = audio.volume - 0.1;\n }\n };\n return mp3;\n}\nfunction nextAudio(audio, sourceElement) {\n num += 1;\n // console.log(Mp3List, num)\n if (Mp3List && num < Mp3List.length) {\n sourceElement.src = getBlob(Mp3List[num]);\n sourceElement.type = \"audio/mpeg\";\n audio.load();\n setTimeout(() => {\n audio.play().catch(err => {\n console.log(err);\n }, 500);\n });\n } else {\n audio.pause();\n audio.currentTime = 0.0;\n num = 0;\n audio.removeEventListener(\"ended\", () => {});\n }\n}\nexport { audioMp3 };","map":{"version":3,"names":["$store","volume","state","config","Mp3List","num","getBlob","key","soundList","language","$Type","blob","window","webkitURL","createObjectURL","URL","err","console","warn","audio","audioElement","document","getElementById","sourceElement","addEventListener","nextAudio","audioMp3","mp3List","effectsVolume","muted","mp3","Object","auto_play","loop","Play","src","type","pause","load","setTimeout","play","catch","log","Pause","Muted","volumeAdd","toFixed","volumeMinus","length","currentTime","removeEventListener"],"sources":["/Users/li/Desktop/work/work2/OG/GamePortrait/src/assets/js/sound.js"],"sourcesContent":["/* eslint-disable */\nimport $store from \"@/store\"\nconst volume = $store.state.config.volume\nlet Mp3List = [],\n num = 0\n\nfunction getBlob(key) {\n const soundList = $store.state.config.soundList\n const language =\n $store.state.config.$Type == \"cn\" || $store.state.config.$Type == \"tw\"\n ? \"cn\"\n : \"en\"\n let blob = \"\"\n try {\n blob = soundList[`${language}_${key}`]\n blob = window.webkitURL.createObjectURL(blob) || URL.createObjectURL(blob)\n } catch (err) {\n console.warn(err, key)\n }\n return blob\n}\n\nlet audio = null\nconst audioElement = document.getElementById(\"Audio\")\nconst sourceElement = document.getElementById(\"audioSourceAside\")\naudio = audioElement\naudio.addEventListener(\"ended\", () => {\n nextAudio(audio, sourceElement)\n})\n\nfunction audioMp3(mp3List) {\n const effectsVolume = $store.state.config.effectsVolume\n // const audioElement = document.createElement(\"audio\")\n // const sourceElement = document.createElement(\"source\")\n // audio.appendChild(sourceElement)\n // audio.volume = volume.effects / 100\n audio.muted = !effectsVolume\n\n Mp3List = mp3List\n var mp3 = new Object()\n mp3.mp3List = mp3List\n mp3.auto_play = false\n mp3.loop = false\n mp3.Play = function () {\n if (this.mp3List[0]) {\n sourceElement.src = getBlob(this.mp3List[0])\n sourceElement.type = \"audio/mpeg\"\n audio.pause()\n audio.load()\n setTimeout(() => {\n audio.play().catch((err) => {\n console.log(err)\n }, 200)\n })\n }\n }\n mp3.Pause = function () {\n audio.pause()\n }\n mp3.Muted = function () {\n audio.muted ? (audio.muted = false) : (audio.muted = true)\n }\n mp3.volumeAdd = function () {\n if (audio.volume.toFixed(1) >= 1) {\n audio.volume = 1\n } else {\n audio.volume = audio.volume + 0.1\n }\n }\n mp3.volumeMinus = function () {\n if (audio.volume.toFixed(1) <= 0) {\n audio.volume = 0\n } else {\n audio.volume = audio.volume - 0.1\n }\n }\n return mp3\n}\nfunction nextAudio(audio, sourceElement) {\n num += 1\n // console.log(Mp3List, num)\n if (Mp3List && num < Mp3List.length) {\n sourceElement.src = getBlob(Mp3List[num])\n sourceElement.type = \"audio/mpeg\"\n audio.load()\n setTimeout(() => {\n audio.play().catch((err) => {\n console.log(err)\n }, 500)\n })\n } else {\n audio.pause()\n audio.currentTime = 0.0\n num = 0\n audio.removeEventListener(\"ended\", () => {})\n }\n}\n\nexport { audioMp3 }\n"],"mappings":"AAAA;AACA,OAAOA,MAAM,MAAM,SAAS;AAC5B,MAAMC,MAAM,GAAGD,MAAM,CAACE,KAAK,CAACC,MAAM,CAACF,MAAM;AACzC,IAAIG,OAAO,GAAG,EAAE;EACdC,GAAG,GAAG,CAAC;AAET,SAASC,OAAOA,CAACC,GAAG,EAAE;EACpB,MAAMC,SAAS,GAAGR,MAAM,CAACE,KAAK,CAACC,MAAM,CAACK,SAAS;EAC/C,MAAMC,QAAQ,GACZT,MAAM,CAACE,KAAK,CAACC,MAAM,CAACO,KAAK,IAAI,IAAI,IAAIV,MAAM,CAACE,KAAK,CAACC,MAAM,CAACO,KAAK,IAAI,IAAI,GAClE,IAAI,GACJ,IAAI;EACV,IAAIC,IAAI,GAAG,EAAE;EAC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