-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathView All Stylesheet.js
More file actions
46 lines (41 loc) · 1.15 KB
/
View All Stylesheet.js
File metadata and controls
46 lines (41 loc) · 1.15 KB
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
38
39
40
41
42
43
44
45
46
javascript: s = document.getElementsByTagName('STYLE');
ex = document.getElementsByTagName('LINK');
d = window.open().document; /*set base href*/
d.open();
d.close();
b = d.body;
function trim(s) {
return s.replace(/^\s*\n/, '').replace(/\s*$/, '');
};
function iff(a, b, c) {
return b ? a + b + c : '';
}
function add(h) {
b.appendChild(h);
}
function makeTag(t) {
return d.createElement(t);
}
function makeText(tag, text) {
t = makeTag(tag);
t.appendChild(d.createTextNode(text));
return t;
}
add(makeText('style', 'iframe{width:100%;height:18em;border:1px solid;'));
add(makeText('h3', d.title = 'Style sheets in ' + location.href));
for (i = 0; i < s.length; ++i) {
add(makeText('h4', 'Inline style sheet' + iff(' title="', s[i].title, '"')));
add(makeText('pre', trim(s[i].innerHTML)));
}
for (i = 0; i < ex.length; ++i) {
rs = ex[i].rel.split(' ');
for (j = 0; j < rs.length; ++j)
if (rs[j].toLowerCase() == 'stylesheet') {
add(makeText('h4', 'link rel="' + ex[i].rel + '" href="' + ex[i].href + '"' + iff(' title="', ex[i].title, '"')));
iframe = makeTag('iframe');
iframe.src = ex[i].href;
add(iframe);
break;
}
}
void 0