Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format JavaScript files with Prettier #123

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
document.addEventListener('DOMContentLoaded', () => {
const removeScriptButtons = document.querySelectorAll(".scriptler-remove-script-form");
removeScriptButtons.forEach(button => button.addEventListener("click", (e) => {
const name = e.currentTarget.getAttribute('data-name');
if (!confirm("Sure you want to delete [" + name + "]?")) {
e.preventDefault();
}
}));
document.addEventListener("DOMContentLoaded", () => {
const removeScriptButtons = document.querySelectorAll(".scriptler-remove-script-form");
removeScriptButtons.forEach((button) =>
button.addEventListener("click", (e) => {
const name = e.currentTarget.getAttribute("data-name");
if (!confirm("Sure you want to delete [" + name + "]?")) {
e.preventDefault();
}
}),
);
});
76 changes: 36 additions & 40 deletions src/main/webapp/lib/scriptler.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,41 @@

function scriptler_initDetailLink(rootURL, referenceTag){
var itemURL = referenceTag.getAttribute('data-item-url');
var selId = referenceTag.value;
var all = new Array();
all = document.getElementsByName('scriptlerScriptId');
for(var i = 0; i < all.length; i++) {
if(referenceTag == all.item(i)){
var detailsLinkTag = document.getElementsByName('showScriptlerDetailLink').item(i);
if(selId.length != 0){
detailsLinkTag .href=rootURL+"/" + itemURL + "scriptler/showScript?id=".concat(selId);
detailsLinkTag .style.display = 'block';
}else{
detailsLinkTag .style.display = 'none';
}
}
}
function scriptler_initDetailLink(rootURL, referenceTag) {
var itemURL = referenceTag.getAttribute("data-item-url");
var selId = referenceTag.value;
var all = new Array();
all = document.getElementsByName("scriptlerScriptId");
for (var i = 0; i < all.length; i++) {
if (referenceTag == all.item(i)) {
var detailsLinkTag = document.getElementsByName("showScriptlerDetailLink").item(i);
if (selId.length != 0) {
detailsLinkTag.href = rootURL + "/" + itemURL + "scriptler/showScript?id=".concat(selId);
detailsLinkTag.style.display = "block";
} else {
detailsLinkTag.style.display = "none";
}
}
}
}


function scriptler_descArguments(referenceTag, params){
var all = new Array();
all = document.getElementsByName('scriptlerScriptId');
for(var i = 0; i < all.length; i++) {
if(referenceTag == all.item(i)){
var desc = "";
for(var j = 0; j < params.length; j++) {
desc += j+": "+ params[j].name +" ";
}
var descriptionTag = document.getElementsByName('scriptlerParameters').item(i);
descriptionTag.innerText = desc;
}
}
function scriptler_descArguments(referenceTag, params) {
var all = new Array();
all = document.getElementsByName("scriptlerScriptId");
for (var i = 0; i < all.length; i++) {
if (referenceTag == all.item(i)) {
var desc = "";
for (var j = 0; j < params.length; j++) {
desc += j + ": " + params[j].name + " ";
}
var descriptionTag = document.getElementsByName("scriptlerParameters").item(i);
descriptionTag.innerText = desc;
}
}
}

function scriptler_showParams(referenceTag, scriptId){
scriptlerBuilderDesc.getParameters(scriptId, function(t) {
var params = t.responseObject();
if(params != null){
scriptler_descArguments(referenceTag, params);
}
});
function scriptler_showParams(referenceTag, scriptId) {
scriptlerBuilderDesc.getParameters(scriptId, function (t) {
var params = t.responseObject();
if (params != null) {
scriptler_descArguments(referenceTag, params);
}
});
}