-
Notifications
You must be signed in to change notification settings - Fork 0
/
head.js
27 lines (23 loc) · 896 Bytes
/
head.js
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
var scripts = document.getElementsByTagName('script');
var myScript = scripts[scripts.length - 1];
var queryString = myScript.src.replace(/^[^\?]+\??/, '');
var params = parseQuery(queryString);
function parseQuery(query) {
var Params = {};
if (!query) return Params; // return empty object
var Pairs = query.split(/[;&]/);
for (var i = 0; i < Pairs.length; i++) {
var KeyVal = Pairs[i].split('=');
if (!KeyVal || KeyVal.length != 2) continue;
var key = unescape(KeyVal[0]);
var val = unescape(KeyVal[1]);
val = val.replace(/\+/g, ' ');
Params[key] = val;
}
return Params;
}
document.write('\
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\
<meta name=viewport content="width=device-width, initial-scale=1">\
<link rel="shortcut icon" href="'+params["prefix"]+'images/favicon.ico">\
');