-
Notifications
You must be signed in to change notification settings - Fork 10
/
RGBcopy.hta
174 lines (156 loc) · 4.55 KB
/
RGBcopy.hta
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<html>
<head>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="RGB"
BORDER="dialog"
BORDERSTYLE="static"
CAPTION="yes"
CONTEXTMENU="no"
ICON=""
INNERBORDER="no"
MAXIMIZEBUTTON="no"
MINIMIZEBUTTON="no"
NAVIGABLE="no"
SCROLL="no"
SCROLLFLAT="no"
SELECTION="no"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="no"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="normal"/>
<title>RGB Palette</title>
<style>
body {
background-color: #CCCCCC;
font-family: Verdana;
margin: 0;
}
#Sample {
border: 3 inset;
font-family: Verdana;
font-weight: bold;
text-align: center;
width: 210;
}
.RGBValue {
background-color: #FFFFFF;
border: 1 inset #000000;
font-family: "Courier New";
font-size: 12;
width: 100%;
}
.btnCopy {
border: 1 inset #000000;
font-family: "Courier New";
font-size: 10;
width: 100%;
}
</style>
<script type="text/javascript" language="javascript">
function InitWin() {
if (oHTA.applicationName === "RGB") with (window.screen) {
var w = 220, h = 280;
moveTo((width - w) / 2, (height - h) / 2);
resizeTo(w, h);
}
};
function InitScrollBar(c, v) {
document.write("<TD WIDTH=25>"
+ "<OBJECT CLASSID=\"CLSID:DFD181E0-5E2F-11CE-A449-00AA004A803D\""
+ "NAME=" + c + "Bar ID=" + c + "Bar HEIGHT=100 WIDTH=100%>"
+ "<PARAM NAME=Min VALUE=255>"
+ "<PARAM NAME=Max VALUE=0>"
+ "<PARAM NAME=LargeChange VALUE=15>"
+ "<PARAM NAME=Orientation VALUE=0>"
+ "<PARAM NAME=Position VALUE=" + v + ">"
+ "</OBJECT>"
+ "</TD>");
};
function InitIndicator(c, t) {
document.write("<TD COLSPAN=3 WIDTH=50%>" + t
+ "<SPAN CLASS=RGBValue ID=" + c + "RGBValue></SPAN>"
+ "<INPUT TYPE=button CLASS=btnCopy VALUE=\"Copy " + t + "\" ONCLICK=\"CopyColor(" + c + "RGBValue)\">"
+ "</TD>");
};
function InitRGB() {
rgbHex.checked = true;
SetRGB();
};
function leftPad(x) { return (x.length < 2) ? "0" + x : x; };
function Hex(x) { return leftPad(x.toString(0x10).toUpperCase()); };
function GetRGBValue(r, g, b) {
return (rgbHex.checked)
? Hex(r.Value) + Hex(g.Value) + Hex(b.Value)
: r.Value + "," + g.Value + "," + b.Value;
};
function SetRGBValue() {
FRGBValue.innerText = GetRGBValue(FRBar, FGBar, FBBar);
BRGBValue.innerText = GetRGBValue(BRBar, BGBar, BBBar);
};
function GetRGBColor(r, g, b) {
return "rgb(" + r.Value + "," + g.Value + "," + b.Value + ")";
};
function SetRGB() {
SetRGBValue();
Sample.style.color = GetRGBColor(FRBar, FGBar, FBBar);
Sample.style.backgroundColor = GetRGBColor(BRBar, BGBar, BBBar);
};
function GetMSIEVersion() {
var browser_name_start = navigator.appVersion.indexOf("MSIE");
return parseInt(navigator.appVersion.substr(browser_name_start + 5, 1));
};
// originally got from decompiled `php_manual_en.chm`
function CopyColor(obj) {
if (GetMSIEVersion() < 5) {
alert("MS Internet Explorer 5+ is required.");
} else {
BodyRange = document.body.createTextRange();
BodyRange.moveToElementText(obj);
BodyRange.execCommand("Copy");
}
};
</script>
</head>
<body
oncontextmenu="
window.event.returnValue = false;
"
onkeydown="
if (window.event.keyCode == 116) window.event.returnValue = false;
if (window.event.keyCode == 27) window.close();
"
onload="
InitWin();
InitRGB();
">
<div style="margin: 0; padding: 0; text-align: center;">
<div id=Sample>TEXT</div>
<table align=center border=0 cellpadding=0 cellspacing=5 width=210>
<tr align=center><script>
InitIndicator("F", "color");
InitIndicator("B", "bgcolor");
</script></tr>
<tr align=center><script>
InitScrollBar("FR", 0x00);
InitScrollBar("FG", 0x00);
InitScrollBar("FB", 0x00);
InitScrollBar("BR", 0xFF);
InitScrollBar("BG", 0xFF);
InitScrollBar("BB", 0xFF);
</script></tr>
<tr><td align=center colspan=6><input type=radio name=RGBSel id=rgbDec onclick="SetRGBValue();"><label for="rgbDec">Dec</label></td></tr>
<tr><td align=center colspan=6><input type=radio name=RGBSel id=rgbHex onclick="SetRGBValue();"><label for="rgbHex">Hex</label></td></tr>
</script>
</table>
</div>
<script type="text/javascript" language="javascript">
function FRBar::change() { SetRGB(); this.blur(); };
function FGBar::change() { SetRGB(); this.blur(); };
function FBBar::change() { SetRGB(); this.blur(); };
function BRBar::change() { SetRGB(); this.blur(); };
function BGBar::change() { SetRGB(); this.blur(); };
function BBBar::change() { SetRGB(); this.blur(); };
</script>
</body>
</html>