-
Notifications
You must be signed in to change notification settings - Fork 0
/
import-theme2.js
126 lines (105 loc) · 3.5 KB
/
import-theme2.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
function importTheme()
{
var themeWindow=window.parent.document;
var body=getRule(themeWindow.styleSheets, "body");
if (body!=null)
{
getRule(document.styleSheets, "body").backgroundColor=body.backgroundColor;
var ss=getRule(document.styleSheets, "td.slides_subtitles");
ss.backgroundColor=body.backgroundColor;
ss.color=body.color;
}
var table=findStyleValue(themeWindow.styleSheets, ".navbar", "background-color");
if (table!=null)
{
var tdn=getRule(document.styleSheets, "table.display-noslides");
tdn.backgroundColor=table.backgroundColor;
tdn.borderColor=table.borderColor;
tdn.color=table.color;
var tdm=getRule(document.styleSheets, "td.messagebox");
tdm.backgroundColor=table.backgroundColor;
tdm.borderColor=table.borderColor;
tdm.color=table.color;
var tdc=getRule(document.styleSheets, "td.controlbarbox");
tdc.backgroundColor=table.backgroundColor;
tdc.borderColor=table.borderColor;
tdc.color=table.color;
var tdv=getRule(document.styleSheets, "td.videocolumn");
tdv.backgroundColor=table.backgroundColor;
tdv.borderColor=table.borderColor;
tdv.color=table.color;
var tmb=getRule(document.styleSheets, "td.messagebox");
tmb.backgroundColor=table.backgroundColor;
tmb.borderColor=table.borderColor;
tmb.color=table.color;
var vidf=getRule(document.styleSheets, "iframe.video");
vidf.backgroundColor=table.backgroundColor;
var vidb=getRule(document.styleSheets, "div.videobak");
vidb.backgroundColor=table.backgroundColor;
getRule(document.styleSheets, "a").color=table.color;
}
/*
var table=findStyleValue(themeWindow.styleSheets, ".navbar", "background-image");
if (table!=null)
{
var tdn=getRule(document.styleSheets, "table.display-noslides");
tdn.backgroundImage=table.backgroundImage;
tdn.borderColor=table.borderColor;
tdn.color=table.color;
var tdm=getRule(document.styleSheets, "td.messagebox");
tdm.backgroundImage=table.backgroundImage;
tdm.borderColor=table.borderColor;
tdm.color=table.color;
var tdc=getRule(document.styleSheets, "td.controlbarbox");
tdc.backgroundImage=table.backgroundImage;
tdc.borderColor=table.borderColor;
tdc.color=table.color;
var tdv=getRule(document.styleSheets, "td.videocolumn");
tdv.backgroundImage=table.backgroundImage;
tdv.borderColor=table.borderColor;
tdv.color=table.color;
var tmb=getRule(document.styleSheets, "td.messagebox");
tmb.backgroundImage=table.backgroundImage;
tmb.borderColor=table.borderColor;
tmb.color=table.color;
var vidf=getRule(document.styleSheets, "iframe.video");
vidf.backgroundImage=table.backgroundImage;
var vidb=getRule(document.styleSheets, "div.videobak");
vidb.backgroundImage=table.backgroundImage;
getRule(document.styleSheets, "a").color=table.color;
}
*/
}
function findStyleValue(sheets, rule, property)
{
for(var loop=sheets.length-1; loop>-1; loop--)
{
var rules=sheets[loop].cssRules? sheets[loop].cssRules: sheets[loop].rules;
for (i=0; i<rules.length; i++)
{
if(rules[i].selectorText!=null && rules[i].selectorText.toLowerCase()==rule)
{
if (rules[i].style.cssText.toLowerCase().indexOf(property)>-1)
{
return rules[i].style;
}
}
}
}
return null;
}
function getRule(sheets, rule, property)
{
for(var loop=sheets.length-1; loop>-1; loop--)
{
var rules=sheets[loop].cssRules? sheets[loop].cssRules: sheets[loop].rules;
for (i=0; i<rules.length; i++)
{
if(rules[i].selectorText!=null && rules[i].selectorText.toLowerCase()==rule)
{
return rules[i].style;
}
}
}
return null;
}