You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2021/04/08 14:18:35 UTC
[myfaces-tobago] branch master updated: refactor: cleanup unused
code
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
The following commit(s) were added to refs/heads/master by this push:
new 3c2265f refactor: cleanup unused code
3c2265f is described below
commit 3c2265f2cc2ab44184c64053d418a1040a3c2c44
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Apr 8 16:17:51 2021 +0200
refactor: cleanup unused code
---
.../tobago-theme-standard/src/main/js/tobago.js | 45 -----------------
.../src/main/js/tobago.js.map | 2 +-
.../src/main/js/tobago.min.js | 4 +-
.../src/main/js/tobago.min.js.map | 2 +-
.../tobago-theme-standard/src/main/ts/tobago-in.ts | 57 ----------------------
5 files changed, 4 insertions(+), 106 deletions(-)
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
index c914e92..bbe1cc3 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js
@@ -11462,51 +11462,6 @@
window.customElements.define("tobago-in", In);
}
});
- // XXX regexp example only - blueprint
- class RegExpTest {
- constructor(element) {
- this.element = element;
- this.regexp = new RegExp(this.element.dataset.regexp);
- console.debug("constructor: '%s'", element.id);
- this.element.addEventListener("change", this.checkValue.bind(this));
- }
- // todo: use "custom-elements" instead of this init listener
- static init(element) {
- for (const input of RegExpTest.selfOrElementsByClassName(element, "tobago-in")) { // todo only for data-regexp
- new RegExpTest(input);
- }
- }
- /**
- * Find all elements (and also self) which have the class "className".
- * @param element Starting element in DOM to collect.
- * @param className Class of elements to find.
- */
- static selfOrElementsByClassName(element, className) {
- const result = new Array();
- if (!element) {
- element = document.documentElement;
- }
- if (element.classList.contains(className)) {
- result.push(element);
- }
- const list = element.getElementsByClassName(className);
- for (let i = 0; i < list.length; i++) {
- result.push(list.item(i));
- }
- return result;
- }
- checkValue(event) {
- console.debug("changed: check if '%s' is okay!", this.regexp.toString());
- if (!this.regexp.test(this.element.value)) {
- this.element.classList.add("border-danger");
- }
- else {
- this.element.classList.remove("border-danger");
- }
- }
- }
- Listener.register(RegExpTest.init, Phase.DOCUMENT_READY);
- Listener.register(RegExpTest.init, Phase.AFTER_UPDATE);
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
index 03aebdd..b125d2c 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.js","sources":["../ts/tobago-listener.ts","../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../../node_modules/vanillajs-datepicker/js/i18n/base-locales.js","../../../../nod [...]
\ No newline at end of file
+{"version":3,"file":"tobago.js","sources":["../ts/tobago-listener.ts","../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../../node_modules/vanillajs-datepicker/js/i18n/base-locales.js","../../../../nod [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js
index db3b549..ec065b0 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js
@@ -1,8 +1,8 @@
-!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e,t;!function(e){e[e.DOCUMENT_READY=0]="DOCUMENT_READY",e[e.WINDOW_LOAD=1]="WINDOW_LOAD",e[e.BEFORE_SUBMIT=2]="BEFORE_SUBMIT",e[e.AFTER_UPDATE=3]="AFTER_UPDATE",e[e.BEFORE_UNLOAD=4]="BEFORE_UNLOAD",e[e.BEFORE_EXIT=5]="BEFORE_EXIT"}(e||(e={})),function(e){e[e.EARLIER=0]="EARLIER",e[e.EARLY=1]="EARLY",e[e.NORMAL=2]="NORMAL",e[e.LATE=3]="LATE",e[e.LATER=4]="LATER"}(t||(t={}));class s{constructor() [...]
+!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";var e,t;!function(e){e[e.DOCUMENT_READY=0]="DOCUMENT_READY",e[e.WINDOW_LOAD=1]="WINDOW_LOAD",e[e.BEFORE_SUBMIT=2]="BEFORE_SUBMIT",e[e.AFTER_UPDATE=3]="AFTER_UPDATE",e[e.BEFORE_UNLOAD=4]="BEFORE_UNLOAD",e[e.BEFORE_EXIT=5]="BEFORE_EXIT"}(e||(e={})),function(e){e[e.EARLIER=0]="EARLIER",e[e.EARLY=1]="EARLY",e[e.NORMAL=2]="NORMAL",e[e.LATE=3]="LATE",e[e.LATER=4]="LATER"}(t||(t={}));class s{constructor() [...]
/*!
* Bootstrap v5.0.0-beta3 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
-const Es="transitionend",Ls=e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e},Ss=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s="#"+s.split("#")[1]),t=s&&"#"!==s?s.trim():null}return t},xs=e=>{const t=Ss(e);return t&&document.querySelector(t)?t:null},ks=e=>{const t=Ss(e);return t?document.querySelector(t):null},As=e=>{i [...]
+const Es="transitionend",Ls=e=>{do{e+=Math.floor(1e6*Math.random())}while(document.getElementById(e));return e},Ss=e=>{let t=e.getAttribute("data-bs-target");if(!t||"#"===t){let s=e.getAttribute("href");if(!s||!s.includes("#")&&!s.startsWith("."))return null;s.includes("#")&&!s.startsWith("#")&&(s="#"+s.split("#")[1]),t=s&&"#"!==s?s.trim():null}return t},xs=e=>{const t=Ss(e);return t&&document.querySelector(t)?t:null},ks=e=>{const t=Ss(e);return t?document.querySelector(t):null},As=e=>{i [...]
//# sourceMappingURL=tobago.min.js.map
diff --git a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map
index bcd81df..73859bb 100644
--- a/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map
+++ b/tobago-theme/tobago-theme-standard/src/main/js/tobago.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"tobago.min.js","sources":["../ts/tobago-listener.ts","../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../../node_modules/vanillajs-datepicker/js/i18n/base-locales.js","../../../.. [...]
\ No newline at end of file
+{"version":3,"file":"tobago.min.js","sources":["../ts/tobago-listener.ts","../ts/tobago-utils.ts","../ts/tobago-bar.ts","../ts/tobago-dropdown.ts","../../../../node_modules/vanillajs-datepicker/js/lib/utils.js","../../../../node_modules/vanillajs-datepicker/js/lib/date.js","../../../../node_modules/vanillajs-datepicker/js/lib/date-format.js","../../../../node_modules/vanillajs-datepicker/js/lib/event.js","../../../../node_modules/vanillajs-datepicker/js/i18n/base-locales.js","../../../.. [...]
\ No newline at end of file
diff --git a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-in.ts b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-in.ts
index 27895d6..0e3095d 100644
--- a/tobago-theme/tobago-theme-standard/src/main/ts/tobago-in.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/ts/tobago-in.ts
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-import {Listener, Phase} from "./tobago-listener";
import {Focus} from "./tobago-focus";
import {Suggest} from "./tobago-suggest";
@@ -43,59 +42,3 @@ document.addEventListener("tobago.init", function (event: Event): void {
window.customElements.define("tobago-in", In);
}
});
-
-// XXX regexp example only - blueprint
-class RegExpTest {
-
- private readonly element: HTMLInputElement;
- private readonly regexp: RegExp;
-
- // todo: use "custom-elements" instead of this init listener
- static init(element: HTMLElement): void {
- for (const input of RegExpTest.selfOrElementsByClassName(element, "tobago-in")) { // todo only for data-regexp
- new RegExpTest(input as HTMLInputElement);
- }
- }
-
- /**
- * Find all elements (and also self) which have the class "className".
- * @param element Starting element in DOM to collect.
- * @param className Class of elements to find.
- */
- static selfOrElementsByClassName(element: HTMLElement, className: string): Array<HTMLElement> {
- const result: Array<HTMLElement> = new Array<HTMLElement>();
- if (!element) {
- element = document.documentElement;
- }
- if (element.classList.contains(className)) {
- result.push(element);
- }
- const list = element.getElementsByClassName(className);
- for (let i = 0; i < list.length; i++) {
- result.push(list.item(i) as HTMLElement);
- }
- return result;
- }
-
- constructor(element: HTMLInputElement) {
-
- this.element = element;
- this.regexp = new RegExp(this.element.dataset.regexp);
-
- console.debug("constructor: '%s'", element.id);
-
- this.element.addEventListener("change", this.checkValue.bind(this));
- }
-
- checkValue(event: TextEvent): void {
- console.debug("changed: check if '%s' is okay!", this.regexp.toString());
- if (!this.regexp.test(this.element.value)) {
- this.element.classList.add("border-danger");
- } else {
- this.element.classList.remove("border-danger");
- }
- }
-}
-
-Listener.register(RegExpTest.init, Phase.DOCUMENT_READY);
-Listener.register(RegExpTest.init, Phase.AFTER_UPDATE);