Skip to content

Commit

Permalink
components Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Cpano committed May 4, 2022
1 parent 0aaabcd commit a6c5a43
Showing 1 changed file with 116 additions and 1 deletion.
117 changes: 116 additions & 1 deletion public/javascripts/createNameOfComponent.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,118 @@
window.addEventListener("load", function () {
document.querySelectorAll("code").forEach(el => el.innerText = el.innerHTML);
const nameComponentBTN = document.getElementById("createName");
const result = document.getElementById("newComponentsName");
const description = document.getElementById("newComponentsDescription");
const Tags = document.getElementById("newComponentsTags");
const Collections = document.getElementById("newComponentsCollections");

const copyNameBTN = document.getElementById("copyName");
const copyTagBTN = document.getElementById("copyTag");
const copyDescBTN = document.getElementById("copyDescription");

result.style.display = "none";
description.style.display = "none";
Tags.style.display = "none";
Collections.style.display = "none";

copyNameBTN.style.display = "none";
copyTagBTN.style.display = "none";
copyDescBTN.style.display = "none";

let name = result.innerHTML;
let descriptionT = description.innerHTML;
let tagsT = Tags.innerHTML;

nameComponentBTN.addEventListener("click", getName);
function getName() {
const Link = document.getElementById("Link").value;

const Component = document.getElementById("Component").value;
const Template = document.getElementById("Template").value;
const Identifier = document
.getElementById("Identifier")
.value.toUpperCase();
const Position = document.getElementById("Position").value;

console.log(Link);

if (Link == 2) {
name = result.innerHTML =
Identifier + "--" + Template + "--" + Component + "--" + Position;
result.style.display = "block";

descriptionT = description.innerHTML =
"This component( " +
Component +
" ) belongs to the page: " +
Identifier +
". UniqueID: " +
Component +
Template +
Identifier +
Position;
description.style.display = "block";

tagsT = Tags.innerHTML =
Component + "," + Template + "," + Identifier + "," + Position + ",";
Tags.style.display = "block";

Collections.innerHTML = Component + " | " + Template + " | " + Identifier;
Collections.style.display = "block";
} else {
name = result.innerHTML =
Identifier + "--" + Template + "--" + Component + "--LINK--" + Position;
result.style.display = "block";

descriptionT = description.innerHTML =
"This LINK( " +
Component +
" ) belongs to the page: " +
Identifier +
". UniqueID: LINK" +
Component +
Template +
Identifier +
Position;
description.style.display = "block";

tagsT = Tags.innerHTML =
Component +
"," +
Template +
"," +
Identifier +
"," +
Position +
",LINK,";
Tags.style.display = "block";

Collections.innerHTML =
Component + " | " + Template + " | " + Identifier + " | LINK ";
Collections.style.display = "block";
}

copyNameBTN.style.display = "block";
copyTagBTN.style.display = "block";
copyDescBTN.style.display = "block";
}

copyNameBTN.addEventListener("click", copyName, false);
copyTagBTN.addEventListener("click", copyTag, false);
copyDescBTN.addEventListener("click", copyDesc, false);

function copyName() {
console.log("Copied to clipboard: " + name);
/* Copy the text inside the text field */
navigator.clipboard.writeText(name);
}
function copyTag() {
console.log("Copied to clipboard: " + tagsT);
/* Copy the text inside the text field */
navigator.clipboard.writeText(tagsT);
}
function copyDesc() {
console.log("Copied to clipboard: " + descriptionT);
/* Copy the text inside the text field */
navigator.clipboard.writeText(descriptionT);
}
});

0 comments on commit a6c5a43

Please sign in to comment.