diff --git a/src/js/src/js/Que.js b/src/js/src/js/Que.js new file mode 100644 index 0000000..ca936e5 --- /dev/null +++ b/src/js/src/js/Que.js @@ -0,0 +1,39 @@ + export const Que = newQue; + Query.prototype = { + get list() {return asList}, + get get() {return asNode}, + get que() {return reQue}, + } + + function Query(selector, base) { + if (base instanceof Query) { + this.origin = base.get(); + } else { + this.origin = base || document; + } + this.raw = this.origin.querySelectorAll(selector); + /* + this.list = asList; + this.get = asNode; + this.que = reQue; + */ + } + + function asList() { + return this.raw; + } + + function asNode() { + if (this.raw.length > 0) { + return this.raw[0]; + } + } + + function newQue(selector, base) { + return new Query(selector, base); + } + + function reQue(selector) { + return new Query(selector, this.get()) + } + diff --git a/src/js/src/main/app.html b/src/js/src/main/app.html index 055905b..74c9ff6 100644 --- a/src/js/src/main/app.html +++ b/src/js/src/main/app.html @@ -79,7 +79,7 @@ - + \ No newline at end of file diff --git a/src/js/src/main/app.js b/src/js/src/main/app.js index 6270a1d..54ad839 100644 --- a/src/js/src/main/app.js +++ b/src/js/src/main/app.js @@ -1,3 +1,5 @@ +import { Que } from "/solitude/resources/js/Que.js" + window.addEventListener('load', main(document)); function main(document) { @@ -7,10 +9,7 @@ if (true || (typeof solitude.style) === 'undefined') { mysolitude = readyWeb(); } - - let Que; - initializeQue(); - + //アプリケーション毎に初期化操作 initializeSolitudeApps(mysolitude.apps) @@ -63,50 +62,7 @@ tab.classList.add("selected"); content.classList.add("selected"); } - - function initializeQue() { - //Queはglobalではない。親スコープで宣言済み。 - Que = newQue; - Query.prototype = { - get list() {return asList}, - get get() {return asNode}, - get que() {return reQue}, - } - - function Query(selector, base) { - if (base instanceof Query) { - this.origin = base.get(); - } else { - this.origin = base || document; - } - this.raw = this.origin.querySelectorAll(selector); - /* - this.list = asList; - this.get = asNode; - this.que = reQue; - */ - } - - function asList() { - return this.raw; - } - - function asNode() { - if (this.raw.length > 0) { - return this.raw[0]; - } - } - - function newQue(selector, base) { - return new Query(selector, base); - } - - function reQue(selector) { - return new Query(selector, this.get()) - } - - } - + function append(kontent) { let logs = Que("#logarea").get().value logs += kontent + "\n"; @@ -169,7 +125,7 @@ } function initializeSolitudeApps(apps) { - appsProto = { + const appsProto = { useMenu: true, useTab: true, autorun: false,