diff options
author | jan <jan@ruken.pw> | 2016-11-14 17:46:52 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2016-11-14 17:46:52 (UTC) |
commit | 5d4d9935cffa9a7cb8fe2a294e45959b43390ef2 (patch) | |
tree | 23388718005fb0e84fbdebf20ff5c1d827aef5e9 /assets_src/js/lib | |
parent | c735553214400f3af69e516ff41a6da9214449a7 (diff) |
likes funktionieren
Diffstat (limited to 'assets_src/js/lib')
-rw-r--r-- | assets_src/js/lib/ajax.js | 3 | ||||
-rw-r--r-- | assets_src/js/lib/dom.js | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/assets_src/js/lib/ajax.js b/assets_src/js/lib/ajax.js index b189a92..71e3764 100644 --- a/assets_src/js/lib/ajax.js +++ b/assets_src/js/lib/ajax.js | |||
@@ -61,3 +61,6 @@ export async function post(url, body, options) { | |||
61 | export async function del(url, body, options) { | 61 | export async function del(url, body, options) { |
62 | return request('DELETE', url, body, options); | 62 | return request('DELETE', url, body, options); |
63 | } | 63 | } |
64 | export async function put(url, body, options) { | ||
65 | return request('PUT', url, body, options); | ||
66 | } | ||
diff --git a/assets_src/js/lib/dom.js b/assets_src/js/lib/dom.js index 3c2f4d9..82f5dd2 100644 --- a/assets_src/js/lib/dom.js +++ b/assets_src/js/lib/dom.js | |||
@@ -27,6 +27,22 @@ export function withClass(className) { | |||
27 | return arr; | 27 | return arr; |
28 | } | 28 | } |
29 | 29 | ||
30 | export function firstChild(el, fn) { | ||
31 | if (!el) { | ||
32 | return null; | ||
33 | } | ||
34 | |||
35 | for (const child of el.childNodes) { | ||
36 | if (child.nodeName === '#text') { | ||
37 | continue; | ||
38 | } | ||
39 | if (fn(child)) { | ||
40 | return child; | ||
41 | } | ||
42 | } | ||
43 | return null; | ||
44 | } | ||
45 | |||
30 | export function next(el, fn) { | 46 | export function next(el, fn) { |
31 | if (!el) { | 47 | if (!el) { |
32 | return null; | 48 | return null; |