|
(window["webpackJsonpGUI"] = window["webpackJsonpGUI"] || []).push([["addon-entry-editor-sounds"],{ |
|
|
|
"./src/addons/addons/editor-sounds/_runtime_entry.js": |
|
|
|
|
|
|
|
|
|
(function(module, __webpack_exports__, __webpack_require__) { |
|
|
|
"use strict"; |
|
__webpack_require__.r(__webpack_exports__); |
|
__webpack_require__.d(__webpack_exports__, "resources", function() { return resources; }); |
|
var _userscript_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./src/addons/addons/editor-sounds/userscript.js"); |
|
|
|
|
|
const resources = { |
|
"userscript.js": _userscript_js__WEBPACK_IMPORTED_MODULE_0__["default"] |
|
}; |
|
|
|
}), |
|
|
|
"./src/addons/addons/editor-sounds/userscript.js": |
|
|
|
|
|
|
|
|
|
(function(module, __webpack_exports__, __webpack_require__) { |
|
|
|
"use strict"; |
|
__webpack_require__.r(__webpack_exports__); |
|
__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); |
|
}; |
|
|
|
|
|
injectCurrent(); |
|
|
|
|
|
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); |
|
}); |
|
|
|
}) |
|
|
|
}]); |
|
|