blob: 814ce299bc5c0ab78aa06e5caef34092c8e6da4b [file] [log] [blame]
Adrià Vilanova Martínez3465e772021-07-11 19:18:41 +02001export function parseUrl(url) {
2 var forum_a = url.match(/forum\/([0-9]+)/i);
3 var thread_a = url.match(/thread\/([0-9]+)/i);
4
5 if (forum_a === null || thread_a === null) {
6 return false;
7 }
8
9 return {
10 'forum': forum_a[1],
11 'thread': thread_a[1],
12 };
13}
14
15export function isEmpty(obj) {
16 return Object.keys(obj).length === 0;
17}
Adrià Vilanova Martíneze7770472021-10-17 00:02:37 +020018
19// Create a link element which isn't handled by the Community Console when
20// clicked. This is done by cancelling the event propagation in the beginning of
21// the bubbling phase.
22export function createImmuneLink() {
23 var a = document.createElement('a');
24 a.addEventListener('click', e => e.stopPropagation(), false);
25 return a;
26}