diff --git a/src/main/resources/lib/credentials/select/select.js b/src/main/resources/lib/credentials/select/select.js
index ba46a696..c4d96191 100644
--- a/src/main/resources/lib/credentials/select/select.js
+++ b/src/main/resources/lib/credentials/select/select.js
@@ -32,6 +32,7 @@ window.credentials.init = function () {
};
window.credentials.add = function (e) {
window.credentials.init();
+ console.log(e);
fetch(e, {
method: 'GET',
headers: crumb.wrap({}),
@@ -127,49 +128,14 @@ window.credentials.addSubmit = function (_) {
}
};
-Behaviour.specify("BUTTON.credentials-add-menu", 'credentials-select', -99, function(e) {
- var btn = e;
- var menu = btn.nextElementSibling;
- while (menu && !menu.matches('DIV.credentials-add-menu-items')) {
- menu = menu.nextElementSibling;
- }
- if (menu) {
- var menuAlign = (btn.getAttribute("menualign") || "tl-bl");
-
- var menuButton = new YAHOO.widget.Button(btn, {
- type: "menu",
- menu: menu,
- menualignment: menuAlign.split("-"),
- menuminscrollheight: 250
- });
- // copy class names
- for (var i = 0; i < btn.classList.length; i++) {
- menuButton._button.classList.add(btn.classList.item(i));
- }
- menuButton._button.setAttribute("suffix", btn.getAttribute("suffix"));
- menuButton.getMenu().clickEvent.subscribe(function (type, args, value) {
- var item = args[1];
- if (item.cfg.getProperty("disabled")) {
- return;
- }
- window.credentials.add(item.srcElement.getAttribute('data-url'));
- });
- // YUI menu will not parse disabled when using DIV-LI only when using SELECT-OPTION
- // but SELECT-OPTION doesn't support images, so we need to catch the rendering and roll our
- // own disabled attribute support
- menuButton.getMenu().beforeShowEvent.subscribe(function(type,args,value){
- var items = this.getItems();
- for (var i = 0; i < items.length; i++) {
- if (items[i].srcElement.getAttribute('disabled')) {
- items[i].cfg.setProperty('disabled', true);
- }
- }
- });
- }
- e=null;
+Behaviour.specify("[data-type='credentials-test-thing']", 'credentials-test-thing', -99, function(e) {
+ e.addEventListener("click", function (event) {
+ window.credentials.add(event.target.dataset.url);
+ });
+ e = null;
});
Behaviour.specify("BUTTON.credentials-add", 'credentials-select', 0, function (e) {
- makeButton(e, e.disabled ? null : window.credentials.add);
+ e.addEventListener("click", window.credentials.add);
e = null; // avoid memory leak
});
Behaviour.specify("DIV.credentials-select-control", 'credentials-select', 100, function (d) {
From 77a5082285398e3f4a2b14a2b13692ee6d9d90c5 Mon Sep 17 00:00:00 2001
From: Jan Faracik <43062514+janfaracik@users.noreply.github.com>
Date: Mon, 15 Jul 2024 23:08:24 +0100
Subject: [PATCH 2/5] Push
---
.../resources/lib/credentials/select.jelly | 50 +++++++++----------
.../lib/credentials/select/select.js | 1 -
2 files changed, 25 insertions(+), 26 deletions(-)
diff --git a/src/main/resources/lib/credentials/select.jelly b/src/main/resources/lib/credentials/select.jelly
index 086054ac..9c69b53e 100644
--- a/src/main/resources/lib/credentials/select.jelly
+++ b/src/main/resources/lib/credentials/select.jelly
@@ -112,36 +112,36 @@
checkMethod="${attrs.checkMethod}"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+