Skip to content

Commit

Permalink
Add support of floor structure in fslabel
Browse files Browse the repository at this point in the history
Now when  users double click the label in previous floor, it would correctly write at next floor and redirect to it
  • Loading branch information
Paiiimannnoitla committed Mar 25, 2023
1 parent a639319 commit 63708df
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions log.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Stembase
File tagging system

---
## 2023.03.25 version 0.4.7
-- Function implementation
# Added
1. Add fully functional support in fslabel redirecting
-- finished
---
## 2023.03.25 version 0.4.6.1
-- Bug fix
Expand Down
16 changes: 11 additions & 5 deletions template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ let floorNum = 'fs-floor-0'
let floorCheckIn = floorDist = 0
const maxFloor = 5

const fsgetPath = (v=0)=>{
const fsgetPath = (isDetour=false)=>{
const pathset = document.querySelectorAll('.fs-path-part')
const pathArr = []
for(var i=0;i<pathset.length;i++){
let pathLen = pathset.length
if(isDetour){
pathLen = Array.prototype.indexOf.call(pathset,document.querySelector('.this-floor')) +1
console.log(pathLen)
}
for(var i=0;i<pathLen;i++){
pathArr[i] = pathset[i].innerHTML
}
console.log(pathArr)
const path=pathArr.join('')
return path
}
Expand Down Expand Up @@ -46,7 +52,7 @@ const fsfuncPath = (v=0)=>{
target.style.background = ''
})
let isExec = false

//Floor Jump or Rebuild
part.addEventListener('mousedown',()=>{
target.style.background = 'rgb(255,221,158)'
const currFloor = +floorNum[floorNum.length-1]
Expand Down Expand Up @@ -174,7 +180,7 @@ const fsfunc = async (v=false,isDrive=false) => {
const fslabelset = document.querySelectorAll('#' + floorNum +' .fs-data-label')
fslabelset.forEach(e =>{
e.addEventListener('dblclick',async() =>{
const floortype = await window.fs.type(fsgetPath()+e.firstChild.innerHTML)
const floortype = await window.fs.type(fsgetPath(true)+e.firstChild.innerHTML)
const nextFloor = +floorNum.match(/.$/,'')+1
const floorset = document.querySelectorAll('.fs-floor')
if(floortype){
Expand All @@ -192,7 +198,7 @@ const fsfunc = async (v=false,isDrive=false) => {
}else{
floorNum = 'fs-floor-' + nextFloor
}
fsfunc(fsgetPath() + e.firstChild.innerHTML)
fsfunc(fsgetPath(true) + e.firstChild.innerHTML)
}else{
// Open it when double clicking
await window.fs.openfile(fsgetPath() + e.firstChild.innerHTML)
Expand Down

0 comments on commit 63708df

Please sign in to comment.