forked from giambaJ/jChat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
37 lines (30 loc) · 691 Bytes
/
Copy pathutils.js
File metadata and controls
37 lines (30 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function encodeQueryData(data) {
const ret = [];
for (let d in data) {
if (!Object.prototype.hasOwnProperty.call(data, d)) {
continue;
}
const value = data[d];
if (
value === false ||
value === null ||
value === undefined ||
value === ""
) {
continue;
}
ret.push(encodeURIComponent(d) + "=" + encodeURIComponent(value));
}
return ret.join("&");
}
function appendCSS(type, name) {
$("<link/>", {
rel: "stylesheet",
type: "text/css",
class: `preview_${type}`,
href: `styles/${type}_${name}.css`,
}).appendTo("head");
}
function removeCSS(type) {
$(`link[class="preview_${type}"]`).remove();
}