aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-04-24 01:14:01 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-04-24 01:14:01 +0200
commit0f68a47403884f575a1112ca0c790f37bfc0fc18 (patch)
treefed45c8bdb70f415926564138abb9a31466ce1a3
parentIntroduce component date-jump. (diff)
downloadcalp-0f68a47403884f575a1112ca0c790f37bfc0fc18.tar.gz
calp-0f68a47403884f575a1112ca0c790f37bfc0fc18.tar.xz
Dead code removal.
-rw-r--r--module/calp/html/components.scm9
-rw-r--r--static/input_list.js110
-rw-r--r--static/script.ts37
3 files changed, 0 insertions, 156 deletions
diff --git a/module/calp/html/components.scm b/module/calp/html/components.scm
index 78142914..47436c87 100644
--- a/module/calp/html/components.scm
+++ b/module/calp/html/components.scm
@@ -156,12 +156,3 @@
(@ (for ,id))
(span (@ (class "plus")) "+")
(span (@ (class "minus")) "-"))))
-
-;; (define-once timespan-generator-id (gensym "timespan-generator"))
-;; (define-public (input-timespan-generator)
-;; `((div (@ (class "template")
-;; (id ,timespan-generator-id))
-;; ,(input-timespan))
-;; (script
-;; "function make_timespan_input() {\n"
-;; "return document.getElementsById(" ,timespan-generator-id ").cloneNode(true);")))
diff --git a/static/input_list.js b/static/input_list.js
deleted file mode 100644
index a7a446f3..00000000
--- a/static/input_list.js
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- ∀ children('.input-list') => 'unit' ∈ classList(child)
-
- <div class="input-list">
- <div class="unit"><input/></div>
- <div class="unit final"><input/></div>
- </div>
-
-*/
-
-
-/* private */
-function transferListeners(old_unit, new_unit) {
- for (let [o, n] of zip([old_unit, ...old_unit.querySelectorAll("*")],
- [new_unit, ...new_unit.querySelectorAll("*")])) {
- for (const key in o.listeners) {
- if (! o.listeners.hasOwnProperty(key)) continue;
- for (let proc of o.listeners[key]) {
- n.addEventListener(key, proc);
- }
- }
- }
-}
-
-
-/* private */
-function advance_final(input_list) {
- let old_unit = input_list.unit;
- let new_unit = old_unit.cloneNode(true);
- new_unit.classList.add('final');
- transferListeners(old_unit, new_unit);
- input_list.appendChild(new_unit);
-}
-
-
-/* private */
-function update_inline_list () {
-
- /* can target self */
- let unit = this.closest('.unit');
-
- let lst = this.closest('.input-list');
-
- if (unit.classList.contains("final")) {
- if (this.value !== '') {
- unit.classList.remove('final');
- advance_final(lst);
- }
- } else {
- /* TODO all significant fields empty, instead of just current */
- if (this.value === '') {
- let sibling = unit.previousElementSibling || unit.nextElementSibling;
- unit.remove();
- if (sibling.tagName !== 'input')
- sibling = sibling.querySelector('input');
- sibling.focus();
- }
- }
-}
-
-/* run this from window.onload (or similar) */
-function init_input_list() {
-
- for (let lst of document.getElementsByClassName('input-list')) {
-
- for (let el of lst.getElementsByTagName('input')) {
- el.addEventListener('input', update_inline_list);
- }
-
- let oldUnit = lst.querySelector('.final.unit')
- let unit = oldUnit.cloneNode(true);
-
- transferListeners(oldUnit, unit);
-
- lst.unit = unit;
-
- if (lst.dataset.bindby) {
- lst.get_value = lst.dataset.bindby;
- } else if (lst.dataset.joinby) {
- lst.get_value = get_get_value(lst.dataset.joinby);
- } else {
- lst.get_value = get_get_value();
- }
-
- /* Propagate add event listener downwards */
- lst._addEventListener = lst.addEventListener;
- lst.addEventListener = function(type, proc) {
- switch (type) {
- case 'input':
- for (let el of lst.getElementsByTagName('input')) {
- el.addEventListener('input', proc);
- }
- default:
- lst._addEventListener(type, proc);
- }
- };
- }
-}
-
-/* -------------------------------------------------- */
-
-/* different function forms since we want to capture one self */
-const get_get_value = (join=',') => function () {
- return [...this.querySelectorAll('input')]
- .map(x => x.value)
- .filter(x => x != '');
- // .join(join);
-}
-
-/* -------------------------------------------------- */
diff --git a/static/script.ts b/static/script.ts
index 865c005e..650a5aa0 100644
--- a/static/script.ts
+++ b/static/script.ts
@@ -1,6 +1,5 @@
import { VEvent, xml_to_vcal } from './vevent'
import { SmallcalCellHighlight, Timebar } from './clock'
-import { makeElement } from './lib'
import { vcal_objects, event_calendar_mapping } from './globals'
import { EventCreator } from './event-creator'
import { PopupElement, setup_popup_element } from './components/popup-element'
@@ -111,20 +110,6 @@ window.addEventListener('load', function() {
the whole page scroll there.
*/
el.parentElement!.removeAttribute("href");
-
- let popup = document.getElementById("popup" + el.id);
- // popup.getElementsByClassName("edit-form")[0].onsubmit = function () {
- // create_event(el);
- // return false; /* stop default */
- // }
-
- /* Bind all vcomponent properties into javascript. */
- // if (el.closest(".longevents")) {
- // new VComponent(el, true);
- // } else {
- // new VComponent(el, false);
- // }
-
}
document.onkeydown = function(evt) {
@@ -139,28 +124,6 @@ window.addEventListener('load', function() {
/* ---------------------------------------- */
- /* needs to be called AFTER bind_properties, but BEFORE init_input_list
- After bind_properties since that initializes categories to a possible field
- Before init_input_list since we need this listener to be propagated to clones.
- [CATEGORIES_BIND]
- */
- // TODO fix this
- // for (let lst of document.querySelectorAll(".input-list[data-property='categories']")) {
- // let f = function() {
- // console.log(lst, lst.closest('.popup-container'));
- // let event = event_from_popup(lst.closest('.popup-container'))
- // event.properties.categories = lst.get_value();
- // };
-
- // for (let inp of lst.querySelectorAll('input')) {
- // inp.addEventListener('input', f);
- // }
- // }
-
- // init_arbitary_kv();
-
- // init_input_list();
-
document.addEventListener('keydown', function(event) {
/* Physical key position, names are what that key would
be in QWERTY */