diff --git a/cat.js b/cat.js index 112330e..19d7e38 100644 --- a/cat.js +++ b/cat.js @@ -3241,6 +3241,10 @@ if (isPhone()) { polymorph_core.currentOperator = id; polymorph_core.items._meta.focusedContainer = id; polymorph_core.fire("updateItem", { id: "_meta", sender: this }); + + document.querySelector(".operatorName").parentElement.style.display = "inline"; + document.querySelector(".operatorName").innerText = polymorph_core.items[id]._od.tabbarName; + polymorph_core.containers[id].refresh(); } @@ -4352,7 +4356,7 @@ if (isPhone()) { `)); document.body.appendChild(htmlwrap(`
- Polymorph + Polymorph>
`)); @@ -4725,7 +4729,9 @@ if (!isPhone()) { function updateDBM() { if (localStorage.getItem("__polymorph_debug_flag") == "true") { - dbm.innerText = "Debug Mode (now ON)"; + dbm.children[0].children[0].innerText = "Debug Mode (now ON)"; + } else { + dbm.children[0].children[0].innerText = "Debug Mode"; } } updateDBM(); @@ -9602,16 +9608,36 @@ if (isPhone()) { section: "Layout", mustColdLoad: true }, function(container) { - polymorph_core.operatorTemplate.call(this, container, {}); + let defaultSettings = { + expanded: false + }; + polymorph_core.operatorTemplate.call(this, container, defaultSettings); this.rootdiv.remove(); //nerf the standard rootdiv because of differring naming conventions between rects and operators. this.outerDiv = document.createElement("div"); - //Add div HTML here - this.outerDiv.innerHTML = ``; this.outerDiv.style.cssText = `width:100%; position:relative`; + //////////////////Handle polymorph_core item updates////////////////// + let checkExpanded = () => { + if (this.settings.expanded) { + this.outerDiv.style.display = "none"; + } else { + this.outerDiv.style.display = "block"; + } + } + checkExpanded(); this.refresh = function() { - container.rect.listContainer.querySelector(`[data-containerid='${container.id}']`).appendChild(this.outerDiv); + //Replace the parent container label + let myRectContainerParent = container.rect.listContainer.querySelector(`[data-containerid='${container.id}']`); + myRectContainerParent.innerHTML = ` +

${container.settings.tabbarName} V

`; + myRectContainerParent.children[0].style.margin = 0; + myRectContainerParent.children[0].addEventListener("click", (e) => { + this.settings.expanded = !this.settings.expanded; + checkExpanded(); + e.stopPropagation(); + }) + myRectContainerParent.appendChild(this.outerDiv); polymorph_core.rects[this.rectID].refresh(); } @@ -10325,7 +10351,12 @@ function _itemcluster_extend_svg(me) { // very polymorph_core functions! } let fob = me.itemPointerCache[id].children()[1]; if (fob.width() == 0) { // when container starts invisible, fob does not show. - fob.size(dvd.scrollWidth, tta.scrollHeight); + if (tta.scrollHeight < 1) { + //wait + setTimeout(() => { + fob.size(dvd.scrollWidth, tta.scrollHeight); + }) + } } //add icons if necessary diff --git a/core_modules/core/core.phone.rect.js b/core_modules/core/core.phone.rect.js index 9a59121..d028173 100644 --- a/core_modules/core/core.phone.rect.js +++ b/core_modules/core/core.phone.rect.js @@ -126,6 +126,10 @@ if (isPhone()) { polymorph_core.currentOperator = id; polymorph_core.items._meta.focusedContainer = id; polymorph_core.fire("updateItem", { id: "_meta", sender: this }); + + document.querySelector(".operatorName").parentElement.style.display = "inline"; + document.querySelector(".operatorName").innerText = polymorph_core.items[id]._od.tabbarName; + polymorph_core.containers[id].refresh(); } diff --git a/core_modules/ui/core.main.js b/core_modules/ui/core.main.js index 8126a4b..2b42c4e 100644 --- a/core_modules/ui/core.main.js +++ b/core_modules/ui/core.main.js @@ -210,6 +210,8 @@ if (!isPhone()) { function updateDBM() { if (localStorage.getItem("__polymorph_debug_flag") == "true") { dbm.children[0].children[0].innerText = "Debug Mode (now ON)"; + } else { + dbm.children[0].children[0].innerText = "Debug Mode"; } } updateDBM(); diff --git a/core_modules/ui/core.phone.main.js b/core_modules/ui/core.phone.main.js index 929844f..a34a12c 100644 --- a/core_modules/ui/core.phone.main.js +++ b/core_modules/ui/core.phone.main.js @@ -25,7 +25,7 @@ if (isPhone()) { `)); document.body.appendChild(htmlwrap(`
- Polymorph + Polymorph>
`)); diff --git a/filemanager.js b/filemanager.js index 6c957e1..07ba056 100644 --- a/filemanager.js +++ b/filemanager.js @@ -1,6 +1,6 @@ let fileList = [ "3pt/localforage.min.js", - "manager.js", + "utils.js", "core.js", "core_modules/ui/core.tutorial.js", "core_modules/core/core.docLoading.js", @@ -86,12 +86,13 @@ try { setTimeout(start); } } catch (e) { - console.log(e); + console.log(e); // in case it's actually a browser error. let fs = require("fs"); //this is a compilation script fs.writeFileSync("cat.js", fs.readFileSync(fileList[0])); for (let i = 1; i < fileList.length; i++) { fs.appendFileSync("cat.js", ";\n\n"); // #safe fs.appendFileSync("cat.js", fs.readFileSync(fileList[i])); + console.log("adding file " + fileList[i] + "..."); } } \ No newline at end of file diff --git a/operators/itemList.phone.js b/operators/itemList.phone.js index 6348372..b26013b 100644 --- a/operators/itemList.phone.js +++ b/operators/itemList.phone.js @@ -70,6 +70,10 @@ if (isPhone()) { position:sticky; top:0; } + + .propertyLabel{ + border-top: 1px solid white; + }
+
@@ -129,12 +133,13 @@ if (isPhone()) { props[i].keep = true; } else { props[i] = { - div: htmlwrap(`

${i}

`), + div: htmlwrap(`

${i}

`), keep: true } props[i].div.dataset.prop = i; backDiv.appendChild(props[i].div); } + //if () // special treatment of dates props[i].div.children[1].innerText = polymorph_core.items[id][i] || ""; } for (let i in props) { @@ -146,7 +151,17 @@ if (isPhone()) { } backDiv.addEventListener("input", (e) => { - polymorph_core.items[editingID][e.target.parentElement.dataset.prop] = e.target.innerText; + let currentItem = polymorph_core.items[editingID]; + if (this.settings.phoneProperties[i] == 'date') { + if (!currentItem[e.target.dataset.role]) currentItem[e.target.dataset.role] = {}; + if (!currentItem[e.target.dataset.role].datestring) currentItem[e.target.dataset.role] = { + "datestring": "" + }; + currentItem[e.target.dataset.role].datestring = e.target.value; + currentItem[e.target.dataset.role].date = dateParser.richExtractTime(currentItem[e.target.dataset.role].datestring); + } else { + currentItem[e.target.parentElement.dataset.prop] = e.target.innerText; + } container.fire("updateItem", { id: editingID }); }) diff --git a/operators/itemcluster.svg.js b/operators/itemcluster.svg.js index 4f98cab..d2c27e8 100755 --- a/operators/itemcluster.svg.js +++ b/operators/itemcluster.svg.js @@ -126,7 +126,12 @@ function _itemcluster_extend_svg(me) { // very polymorph_core functions! } let fob = me.itemPointerCache[id].children()[1]; if (fob.width() == 0) { // when container starts invisible, fob does not show. - fob.size(dvd.scrollWidth, tta.scrollHeight); + if (tta.scrollHeight < 1) { + //wait + setTimeout(() => { + fob.size(dvd.scrollWidth, tta.scrollHeight); + }) + } } //add icons if necessary diff --git a/operators/subframe.js b/operators/subframe.js index 0bd520a..c4cb5ec 100755 --- a/operators/subframe.js +++ b/operators/subframe.js @@ -7,16 +7,36 @@ if (isPhone()) { section: "Layout", mustColdLoad: true }, function(container) { - polymorph_core.operatorTemplate.call(this, container, {}); + let defaultSettings = { + expanded: false + }; + polymorph_core.operatorTemplate.call(this, container, defaultSettings); this.rootdiv.remove(); //nerf the standard rootdiv because of differring naming conventions between rects and operators. this.outerDiv = document.createElement("div"); - //Add div HTML here - this.outerDiv.innerHTML = ``; this.outerDiv.style.cssText = `width:100%; position:relative`; + //////////////////Handle polymorph_core item updates////////////////// + let checkExpanded = () => { + if (this.settings.expanded) { + this.outerDiv.style.display = "none"; + } else { + this.outerDiv.style.display = "block"; + } + } + checkExpanded(); this.refresh = function() { - container.rect.listContainer.querySelector(`[data-containerid='${container.id}']`).appendChild(this.outerDiv); + //Replace the parent container label + let myRectContainerParent = container.rect.listContainer.querySelector(`[data-containerid='${container.id}']`); + myRectContainerParent.innerHTML = ` +

${container.settings.tabbarName} V

`; + myRectContainerParent.children[0].style.marginTop = 0; + myRectContainerParent.children[0].addEventListener("click", (e) => { + this.settings.expanded = !this.settings.expanded; + checkExpanded(); + e.stopPropagation(); + }) + myRectContainerParent.appendChild(this.outerDiv); polymorph_core.rects[this.rectID].refresh(); } diff --git a/pwa.js b/pwa.js index 5fb6837..a29ade9 100755 --- a/pwa.js +++ b/pwa.js @@ -32,7 +32,8 @@ Place those scripts in the 'urlsToCache' property and you'll be ready to go. var _pwaManager = (() => { let serviceWorkerSettings = { urlsToCache: [ - "manager.js", + "utils.js", + "filemanager.js", "core.js", "core_modules/ui/core.tutorial.js", "core_modules/core/core.docLoading.js", diff --git a/saveSources/lobby.js b/saveSources/lobby.js index 84414b7..ea45e0e 100644 --- a/saveSources/lobby.js +++ b/saveSources/lobby.js @@ -174,25 +174,23 @@ polymorph_core.registerSaveSource("lobby", function(save_source_data) { // a sam } catch (e) { //ws already closed } - console.log("ws error, reconnecting in 5..."); - setTimeout(this.updateRTstate, 5000); + console.log("ws error, reconnecting..."); + setTimeout(this.updateRTstate); clearInterval(this.wsQueueDigester); }) } else { this.wsQueueDigester = setInterval(() => { toSends = this.RTSyncQueue.slice(0, 5); - if (toSends.length) { - if (this.ws.readyState != WebSocket.OPEN) { - console.log("ws error, reconnecting in 5..."); - setTimeout(this.updateRTstate, 5000); - clearInterval(this.wsQueueDigester); - } else { - this.ws.send(JSON.stringify({ - type: "postUpdate", - data: toSends - })); - this.RTSyncQueue.splice(0, 5); - } + if (this.ws.readyState != WebSocket.OPEN) { + console.log("ws error, reconnecting..."); + setTimeout(this.updateRTstate); + clearInterval(this.wsQueueDigester); + } else if (toSends.length) { + this.ws.send(JSON.stringify({ + type: "postUpdate", + data: toSends + })); + this.RTSyncQueue.splice(0, 5); } }, 1000); } diff --git a/manager.js b/utils.js old mode 100755 new mode 100644 similarity index 100% rename from manager.js rename to utils.js