Spaces:
Running
Running
File size: 11,056 Bytes
8086c81 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
(window["webpackJsonpGUI"] = window["webpackJsonpGUI"] || []).push([["addon-entry-clones"],{
/***/ "./node_modules/css-loader/index.js!./src/addons/addons/clones/style.css":
/*!**********************************************************************!*\
!*** ./node_modules/css-loader!./src/addons/addons/clones/style.css ***!
\**********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var escape = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/url/escape.js */ "./node_modules/css-loader/lib/url/escape.js");
exports = module.exports = __webpack_require__(/*! ../../../../node_modules/css-loader/lib/css-base.js */ "./node_modules/css-loader/lib/css-base.js")(false);
// imports
// module
exports.push([module.i, ".clone-container-container {\n display: none;\n align-items: center;\n padding: 0.25rem;\n user-select: none;\n color: #a065ff;\n}\n\n.clone-container {\n font-size: 0.625rem;\n font-weight: bold;\n font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n white-space: nowrap;\n}\n\n.clone-icon {\n margin: 0.25rem;\n display: inline-block;\n background-image: url(" + escape(__webpack_require__(/*! ./cat.svg */ "./src/addons/addons/clones/cat.svg")) + ");\n height: 16px;\n width: 16px;\n}\n\n.clone-container-container[data-count=\"none\"] {\n display: none;\n}\n\n.clone-container-container[data-count=\"full\"] {\n color: #ff6680;\n}\n\n.clone-container-container[data-count=\"full\"] .clone-icon {\n background-image: url(" + escape(__webpack_require__(/*! ./300cats.svg */ "./src/addons/addons/clones/300cats.svg")) + ");\n}\n\n.clone-count::after {\n content: attr(data-str);\n}\n\n.sa-clones-small .clone-container-container {\n display: none !important;\n}\n", ""]);
// exports
/***/ }),
/***/ "./node_modules/url-loader/dist/cjs.js!./src/addons/addons/clones/300cats.svg":
/*!************************************************************************************!*\
!*** ./node_modules/url-loader/dist/cjs.js!./src/addons/addons/clones/300cats.svg ***!
\************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTS0xLTFoODAydjYwMkgtMXoiLz48ZyBmaWxsPSIjZmZkMWQ4Ij48Y2lyY2xlIGN5PSI4LjQ4NCIgY3g9IjcuNDE0IiByPSI0LjczMyIvPjxwYXRoIGQ9Im0zLjg0MyA2LjEuMjk2LTQuODMgMi4yMzYgNC4yNjVtMS40MTEtLjEwOEw5LjQuODY2bC45NzUgNC43MTYiIGZpbGwtb3BhY2l0eT0ibnVsbCIvPjwvZz48ZyBmaWxsPSIjZmY5MWEzIj48Y2lyY2xlIGN5PSI5LjEwNCIgY3g9IjcuOTg3IiByPSI0LjczMyIvPjxwYXRoIGQ9Im00LjQxNSA2LjcyLjI5Ni00LjgzIDIuMjM3IDQuMjY1bTEuNDEtLjEwOCAxLjYxNi00LjU2Ljk3NCA0LjcxNSIgZmlsbC1vcGFjaXR5PSJudWxsIi8+PC9nPjxnIGZpbGw9IiNmZjY2ODAiPjxjaXJjbGUgY3k9IjkuNDg2IiBjeD0iOC45NDEiIHI9IjQuNzMzIi8+PHBhdGggZD0ibTUuMzcgNy4xMDIuMjk1LTQuODMgMi4yMzcgNC4yNjVtMS40MS0uMTA3IDEuNjE2LTQuNTYyLjk3NCA0LjcxNiIgZmlsbC1vcGFjaXR5PSJudWxsIi8+PC9nPjwvc3ZnPg==");
/***/ }),
/***/ "./node_modules/url-loader/dist/cjs.js!./src/addons/addons/clones/cat.svg":
/*!********************************************************************************!*\
!*** ./node_modules/url-loader/dist/cjs.js!./src/addons/addons/clones/cat.svg ***!
\********************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony default export */ __webpack_exports__["default"] = ("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTS0xLTFoODAydjYwMkgtMXoiLz48ZyBmaWxsPSIjZGNjOWZmIj48Y2lyY2xlIGN5PSI4LjQ4NCIgY3g9IjcuNDE0IiByPSI0LjczMyIvPjxwYXRoIGQ9Im0zLjg0MyA2LjEuMjk2LTQuODMgMi4yMzYgNC4yNjVtMS40MTEtLjEwOEw5LjQuODY2bC45NzUgNC43MTYiIGZpbGwtb3BhY2l0eT0ibnVsbCIvPjwvZz48ZyBmaWxsPSIjYmM5NmZmIj48Y2lyY2xlIGN5PSI5LjEwNCIgY3g9IjcuOTg3IiByPSI0LjczMyIvPjxwYXRoIGQ9Im00LjQxNSA2LjcyLjI5Ni00LjgzIDIuMjM3IDQuMjY1bTEuNDEtLjEwOCAxLjYxNi00LjU2Ljk3NCA0LjcxNSIgZmlsbC1vcGFjaXR5PSJudWxsIi8+PC9nPjxnIGZpbGw9IiNhMDY1ZmYiPjxjaXJjbGUgY3k9IjkuNDg2IiBjeD0iOC45NDEiIHI9IjQuNzMzIi8+PHBhdGggZD0ibTUuMzcgNy4xMDIuMjk1LTQuODMgMi4yMzcgNC4yNjVtMS40MS0uMTA3IDEuNjE2LTQuNTYyLjk3NCA0LjcxNiIgZmlsbC1vcGFjaXR5PSJudWxsIi8+PC9nPjwvc3ZnPg==");
/***/ }),
/***/ "./src/addons/addons/clones/300cats.svg":
/*!**********************************************!*\
!*** ./src/addons/addons/clones/300cats.svg ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__.p + "static/assets/60fb267c5ab0c6f4ed9ab4a891ca7dd5.svg";
/***/ }),
/***/ "./src/addons/addons/clones/_runtime_entry.js":
/*!****************************************************!*\
!*** ./src/addons/addons/clones/_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/clones/userscript.js");
/* harmony import */ var _css_loader_style_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! css-loader!./style.css */ "./node_modules/css-loader/index.js!./src/addons/addons/clones/style.css");
/* harmony import */ var _css_loader_style_css__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_style_css__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _url_loader_300cats_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! url-loader!./300cats.svg */ "./node_modules/url-loader/dist/cjs.js!./src/addons/addons/clones/300cats.svg");
/* harmony import */ var _url_loader_cat_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! url-loader!./cat.svg */ "./node_modules/url-loader/dist/cjs.js!./src/addons/addons/clones/cat.svg");
/* generated by pull.js */
const resources = {
"userscript.js": _userscript_js__WEBPACK_IMPORTED_MODULE_0__["default"],
"style.css": _css_loader_style_css__WEBPACK_IMPORTED_MODULE_1___default.a,
"300cats.svg": _url_loader_300cats_svg__WEBPACK_IMPORTED_MODULE_2__["default"],
"cat.svg": _url_loader_cat_svg__WEBPACK_IMPORTED_MODULE_3__["default"]
};
/***/ }),
/***/ "./src/addons/addons/clones/cat.svg":
/*!******************************************!*\
!*** ./src/addons/addons/clones/cat.svg ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__.p + "static/assets/8a30520407ffdf5b0e7e06e490db9c1d.svg";
/***/ }),
/***/ "./src/addons/addons/clones/userscript.js":
/*!************************************************!*\
!*** ./src/addons/addons/clones/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 (_ref) {
let {
addon,
console,
msg
} = _ref;
const vm = addon.tab.traps.vm;
let showIconOnly = addon.settings.get("showicononly");
if (addon.tab.redux.state && addon.tab.redux.state.scratchGui.stageSize.stageSize === "small") {
document.body.classList.add("sa-clones-small");
}
document.addEventListener("click", e => {
if (e.target.closest("[class*='stage-header_stage-button-first']")) {
document.body.classList.add("sa-clones-small");
} else if (e.target.closest("[class*='stage-header_stage-button-last']")) {
document.body.classList.remove("sa-clones-small");
}
}, {
capture: true
});
let countContainerContainer = document.createElement("div");
addon.tab.displayNoneWhileDisabled(countContainerContainer);
let countContainer = document.createElement("div");
let count = document.createElement("span");
let icon = document.createElement("span");
countContainerContainer.className = "clone-container-container";
countContainer.className = "clone-container";
count.className = "clone-count";
icon.className = "clone-icon";
countContainerContainer.appendChild(icon);
countContainerContainer.appendChild(countContainer);
countContainer.appendChild(count);
let lastChecked = 0;
const cache = Array(301).fill().map((_, i) => msg("clones", {
cloneCount: i
}));
function doCloneChecks(force) {
const v = vm.runtime._cloneCounter;
// performance
if (v === lastChecked && !force) return;
lastChecked = v;
if (v === 0) {
countContainerContainer.dataset.count = "none";
} else if (v >= vm.runtime.runtimeOptions.maxClones) {
countContainerContainer.dataset.count = "full";
} else {
countContainerContainer.dataset.count = "";
}
if (showIconOnly) {
count.dataset.str = v;
} else {
count.dataset.str = cache[v] || msg("clones", {
cloneCount: v
});
}
if (v === 0) countContainerContainer.style.display = "none";else countContainerContainer.style.display = "flex";
}
addon.settings.addEventListener("change", () => {
showIconOnly = addon.settings.get("showicononly");
doCloneChecks(true);
});
const oldStep = vm.runtime._step;
vm.runtime._step = function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
const ret = oldStep.call(this, ...args);
doCloneChecks();
return ret;
};
/*
if (addon.self.enabledLate) {
// Clone count might be inaccurate if the user deleted sprites
// before enabling the addon
let count = 0;
for (let target of vm.runtime.targets) {
if (!target.isOriginal) ++count;
}
vm.runtime._cloneCounter = count;
}
*/
while (true) {
await addon.tab.waitForElement('[class*="controls_controls-container"]', {
markAsSeen: true,
reduxEvents: ["scratch-gui/mode/SET_PLAYER", "fontsLoaded/SET_FONTS_LOADED", "scratch-gui/locales/SELECT_LOCALE"]
});
if (addon.tab.editorMode === "editor" || addon.tab.redux.state.scratchGui.mode.isEmbedded) {
addon.tab.appendToSharedSpace({
space: "afterStopButton",
element: countContainerContainer,
order: 2
});
}
}
});
/***/ })
}]);
//# sourceMappingURL=addon-entry-clones.js.map |