Skip to content

Commit

Permalink
Updated shrink and grow
Browse files Browse the repository at this point in the history
  • Loading branch information
Emperor42 committed Jul 15, 2024
1 parent 1772ca9 commit 14e3b5b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
18 changes: 1 addition & 17 deletions index.html → vici.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,7 @@
</details>
</header>
<section id="platform-content">
<!--Below is an example, should be commented later-->
<article id="form-core-1" style="left:10rem;top:10rem;z-index:1;">
<form style="width:25rem;height:6rem;">
<input type="text" name="head" value="head"/>
<input type="text" name="body" value="body"/>
<input type="text" name="tail" value="tail"/>
</form>
<!--This is the below element which includes buttons to do different keyu elements-->
<details>
<summary>Options</summary>
<button name="form-core-1" onclick="moveRecord(this.name)">Move</button>
<button name="form-core-1" onclick="saveRecord(this.name)">Sync</button>
<button name="form-core-1" onclick="killRecord(this.name)">Delete</button>
<button name="form-core-1" onclick="pullRecord(this.name)">Front</button>
<button name="form-core-1" onclick="pushRecord(this.name)">Back</button>
</details>
</article>
<!--JS will import these-->
</section>
<footer id="platform-footer">
<!--Generic footer for setttings and tools and search, not 100% sure what should go here-->
Expand Down
34 changes: 33 additions & 1 deletion vici.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ function createOptionsForCards(coreId){
const mainDetail = document.createElement("details");
const summaryElement = document.createElement('summary');
summaryElement.appendChild(document.createTextNode("Options"));
mainDetail.appendChild(summaryElement);
const moveId = coreId;
const saveId = coreId;
const killId = coreId;
const pullId = coreId;
const pushId = coreId;
const moreId = coreId;
const lessId = coreId;
const moveButton = document.createElement("button");
moveButton.appendChild(document.createTextNode("Move"));
moveButton.name = moveId;
Expand All @@ -34,7 +37,16 @@ function createOptionsForCards(coreId){
pushButton.name = pushId;
pushButton.setAttribute("onclick", "pushRecord(this.name)");
mainDetail.appendChild(pushButton);
mainDetail.appendChild(summaryElement);
const moreButton = document.createElement("button");
moreButton.appendChild(document.createTextNode("Grow"));
moreButton.name = moreId;
moreButton.setAttribute("onclick", "moreRecord(this.name)");
mainDetail.appendChild(moreButton);
const lessButton = document.createElement("button");
lessButton.appendChild(document.createTextNode("Shrink"));
lessButton.name = lessId;
lessButton.setAttribute("onclick", "lessRecord(this.name)");
mainDetail.appendChild(lessButton);
return mainDetail;
}

Expand Down Expand Up @@ -262,6 +274,26 @@ function pushRecord(event){
console.log(event);
document.getElementById(event).style.zIndex--;
}
/**
* Function to bring the record forward
* @param {*} event
*/
function moreRecord(event){
console.log("pullRecord");
console.log(event);
let widthValue= parseInt(document.getElementById(event).children[0].style.width);
document.getElementById(event).children[0].style.width = (widthValue+1)+"rem";
}
/**
* Function to bring the record back
* @param {*} event
*/
function lessRecord(event){
console.log("pullRecord");
console.log(event);
let widthValue= parseInt(document.getElementById(event).children[0].style.width);
document.getElementById(event).children[0].style.width = (widthValue-1)+"rem";
}
/**
* On change operation for the given fields
* @param {*} event
Expand Down

0 comments on commit 14e3b5b

Please sign in to comment.