Spaces:
Running
Running
(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__) { | |
; | |
__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__) { | |
; | |
__webpack_require__.r(__webpack_exports__); | |
/* harmony default export */ __webpack_exports__["default"] = (async function (_ref) { | |
let { | |
addon, | |
console | |
} = _ref; | |
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 () { | |
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | |
args[_key] = arguments[_key]; | |
} | |
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 |