aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src')
-rw-r--r--juick-www/src/main/static/scripts.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/juick-www/src/main/static/scripts.js b/juick-www/src/main/static/scripts.js
index dc7745a9..22a75fac 100644
--- a/juick-www/src/main/static/scripts.js
+++ b/juick-www/src/main/static/scripts.js
@@ -1,6 +1,7 @@
require('whatwg-fetch');
require('element-closest');
require('classlist.js');
+require('url-search-params-polyfill');
let killy = require('killy');
let Awesomplete = require('awesomplete');
@@ -15,6 +16,9 @@ if (!('remove' in Element.prototype)) { // Firefox <23
NodeList.prototype.forEach = Array.prototype.forEach;
HTMLCollection.prototype.forEach = Array.prototype.forEach;
+NodeList.prototype.filter = Array.prototype.filter;
+HTMLCollection.prototype.filter = Array.prototype.filter;
+
Element.prototype.selectText = function () {
let d = document;
if (d.body.createTextRange) {
@@ -615,6 +619,11 @@ function getTags() {
return false;
}
+function addTag(tag) {
+ document.forms['postmsg'].body.value='*'+tag+' '+document.forms['postmsg'].body.value;
+ return false;
+}
+
/******************************************************************************/
function ready(fn) {
@@ -677,6 +686,19 @@ ready(function () {
}
}
+ var postmsg = document.getElementById('postmsg');
+ if (postmsg) {
+ document.querySelectorAll('a').filter(t => t.href.indexOf('?') >=0).forEach(t => {
+ t.addEventListener('click', e => {
+ let params = new URLSearchParams(t.href.slice(t.href.indexOf('?') + 1));
+ if (params.has('tag')) {
+ addTag(params.get('tag'));
+ e.preventDefault();
+ }
+ });
+ });
+ }
+
document.querySelectorAll('.msg-menu').forEach(function (el) {
el.addEventListener('click', function (e) {
var reply = e.target.closest('li');