mirror of
https://github.com/ocogeclub/ocoge.git
synced 2024-11-22 07:39:49 +00:00
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
apptool.blocks_dir = (function () {
|
|
let r = "";
|
|
if (document.currentScript) {
|
|
r = document.currentScript.src;
|
|
} else {
|
|
var scripts = document.getElementsByTagName('script'),
|
|
script = scripts[scripts.length - 1];
|
|
if (script.src) {
|
|
r = script.src;
|
|
}
|
|
}
|
|
return r.replace(/[^/]*$/, '').replace('file://', '')
|
|
})();
|
|
var flyout_contents = [];
|
|
const registerCategory = (category_dir, subcategories) => {
|
|
for (let sbctgr of subcategories) {
|
|
let fname = apptool.blocks_dir + category_dir + '/' + sbctgr;
|
|
let script = document.createElement('script');
|
|
script.type = 'text/javascript';
|
|
script.src = fname;
|
|
script.async = false;
|
|
script.defer = true;
|
|
document.body.appendChild(script);
|
|
}
|
|
}
|
|
|
|
// センサーカテゴリ
|
|
registerCategory('sensors', [ // サブカテゴリファイル名
|
|
"amg8833.js",
|
|
"paj7620.js",
|
|
"bme280.js",
|
|
"ssd1306.js",
|
|
"z-line.js" // フライアウト下端の不可視ライン。フライアウトのアップデートをここで行っているので変更・削除に注意!
|
|
]);
|