diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-22 10:05:12 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2020-04-29 16:39:29 +0200 |
commit | e101052afc69efb18c413776e39a0281576c4ca4 (patch) | |
tree | 4f2fce3cd458d11f62b6db55eff6ac5b445db019 /app/Resources/static | |
parent | 0914a6f2fd33aeda6100e4d94c3ea3cec942f5f0 (diff) | |
download | wallabag-e101052afc69efb18c413776e39a0281576c4ca4.tar.gz wallabag-e101052afc69efb18c413776e39a0281576c4ca4.tar.zst wallabag-e101052afc69efb18c413776e39a0281576c4ca4.zip |
First draft
Diffstat (limited to 'app/Resources/static')
-rwxr-xr-x | app/Resources/static/themes/material/index.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/app/Resources/static/themes/material/index.js b/app/Resources/static/themes/material/index.js index d8f5628c..185ac1e0 100755 --- a/app/Resources/static/themes/material/index.js +++ b/app/Resources/static/themes/material/index.js | |||
@@ -120,4 +120,30 @@ $(document).ready(() => { | |||
120 | }); | 120 | }); |
121 | }); | 121 | }); |
122 | } | 122 | } |
123 | |||
124 | $('.markasread').on('click', () => { | ||
125 | const article = document.getElementById('article'); | ||
126 | const link = document.getElementById('link-archive'); | ||
127 | const articleId = article.dataset.id; | ||
128 | const xhr = new XMLHttpRequest(); | ||
129 | |||
130 | xhr.onload = function toggleArchive() { | ||
131 | if (xhr.status === 200) { | ||
132 | const previousStatus = document.getElementById('archive-icon').innerHTML; | ||
133 | let status = link.dataset.iconUnread; | ||
134 | let label = link.dataset.labelUnread; | ||
135 | if (previousStatus === 'unarchive') { | ||
136 | status = link.dataset.iconRead; | ||
137 | label = link.dataset.labelRead; | ||
138 | } | ||
139 | document.getElementById('archive-icon').innerHTML = status; | ||
140 | document.getElementById('archive-label').innerHTML = label; | ||
141 | window.Materialize.toast(xhr.responseText, 4000); | ||
142 | } | ||
143 | }; | ||
144 | |||
145 | const url = `${Routing.generate('archive_entry', { id: articleId })}?some_var_name=true`; | ||
146 | xhr.open('GET', url, false); | ||
147 | xhr.send(null); | ||
148 | }); | ||
123 | }); | 149 | }); |