1
0
forked from sent/waves
waves/public/assets/g/turbowarp/main/js/addon-entry-editor-sounds.js
2025-04-09 17:11:14 -05:00

66 lines
2.3 KiB
JavaScript

(window["webpackJsonpGUI"] = window["webpackJsonpGUI"] || []).push([["addon-entry-editor-sounds"],{
/***/ "./src/addons/addons/editor-sounds/_runtime_entry.js":
/*!***********************************************************!*\
!*** ./src/addons/addons/editor-sounds/_runtime_entry.js ***!
\***********************************************************/
/*! exports provided: resources */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resources", function() { return resources; });
/* harmony import */ var _userscript_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./userscript.js */ "./src/addons/addons/editor-sounds/userscript.js");
/* generated by pull.js */
const resources = {
"userscript.js": _userscript_js__WEBPACK_IMPORTED_MODULE_0__["default"]
};
/***/ }),
/***/ "./src/addons/addons/editor-sounds/userscript.js":
/*!*******************************************************!*\
!*** ./src/addons/addons/editor-sounds/userscript.js ***!
\*******************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = (async function ({
addon,
console
}) {
const ScratchBlocks = await addon.tab.traps.getBlockly();
const injectCurrent = () => {
const workspace = Blockly.getMainWorkspace();
const pathToMedia = workspace.options.pathToMedia;
ScratchBlocks.inject.loadSounds_(pathToMedia, workspace);
}; // Add sounds to the current workspace
injectCurrent(); // Add sounds to all future workspaces
const originalInit = ScratchBlocks.init_;
ScratchBlocks.init_ = function (...args) {
const wksp = args[0];
wksp.options.hasSounds = true;
return originalInit.call(this, ...args);
};
addon.self.addEventListener("disabled", () => {
const workspace = Blockly.getMainWorkspace();
const audio = workspace.getAudioManager();
delete audio.SOUNDS_.click;
delete audio.SOUNDS_.delete;
});
addon.self.addEventListener("reenabled", injectCurrent);
});
/***/ })
}]);
//# sourceMappingURL=addon-entry-editor-sounds.js.map