-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathalt_text_tool.html
More file actions
155 lines (132 loc) · 5.7 KB
/
alt_text_tool.html
File metadata and controls
155 lines (132 loc) · 5.7 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
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
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var locationValue = 0;
var autoexecValue = 0;
var healthValue = 0;
var clickURLType = 0;
var hideFreeReadyButtonValue = 0;
</script>
</head>
<body>
<b><h2>Alt Text generator tool</b></h2></br>
<b>Location:</b> This chooses the ad inventory the alt text is being generated for
<form name="loc">
<Input type = radio name = r1 value = "0" checked onclick="locationValue = 0">Featured Torrent<br>
<Input type = radio name = r1 value = "1" onclick="locationValue = 1">LREC<br>
<Input type = radio name = r1 value = "2" onclick="locationValue = 2; GenerateFTCompanion();">Featured Torrent Companion
</form>
<br>
<b>AutoExec:</b>
This chooses whether to autoexecute or not.
<form name="autoexec">
<Input type = radio name = r2 value = "0" checked onclick="autoexecValue = 0">Off<br>
<Input type = radio name = r2 value = "1" onclick="autoexecValue = 1">On<br>
</form>
<br>
<b>Positioning:</b> This places the hotspot around the info button
<form name="pos">
<Input type = text name = p1 value = "0">Top<br>
<Input type = text name = p2 value = "0">Bottom<br>
<Input type = text name = p3 value = "0">Left<br>
<Input type = text name = p4 value = "0">Right<br>
</form>
<br>
<b>hideFreeReady:</b> This hides the free and ready button.
<form name="hidefr">
<Input type = radio name = r5 value = "0" checked onclick="hideFreeReadyButtonValue = 0">Show [Default]<br>
<Input type = radio name = r5 value = "1" onclick="hideFreeReadyButtonValue = 1">Hide<br>
</form>
<br>
<b>Additional info:</b> This adds any additional information not touched upon above
<form name="additional">
<Input type = text name = a1 value = "0">Background Color (HEX)<br>
<Input type = text name = a2 value = "0">Clickthrough URL<br>
<Input type = text name = a3 value = "0">Title<br>
<Input type = text name = a4 value = "0">Size of Torrent<br>
<Input type = text name = a5 value = "0">Rating<br>
</form>
<br>
<b>Health:</b> This sets the torrent health
<form name="hlh">
<Input type = radio name = r3 value = "0" checked onclick="healthValue = 0">0<br>
<Input type = radio name = r3 value = "1" onclick="healthValue = 1">1<br>
<Input type = radio name = r3 value = "2" onclick="healthValue = 2">2<br>
<Input type = radio name = r3 value = "3" onclick="healthValue = 3">3<br>
<Input type = radio name = r3 value = "4" onclick="healthValue = 4">4<br>
</form>
<br>
<b>Click URL Type:</b> Toggles between downloading a torrent file and popping an HTML window
<form name="clkURL">
<Input type = radio name = r4 value = "0" checked onclick="clickURLType = 0">Torrent<br>
<Input type = radio name = r4 value = "1" onclick="clickURLType = 1">In-client HTML<br>
<Input type = radio name = r4 value = "2" onclick="clickURLType = 2">External HTML<br>
</form>
<br>
<script type="text/javascript">
function validateRating() {
var rating = document.forms["additional"].elements["a5"].value;
if(rating < 0 || rating > 5) {
alert("Rating must be a number between 1 and 5.")
}
else {
// get the value
var input = rating;
regex = /(^\d{0,1}$|^\d{0,2}[.]\d$)/;
if(regex.test(input)) {
var matches = input.match(regex);
for(var match in matches) {
Generate();
break;
}
} else {
alert("Rating should be in the format x.x");
}
}
return false;
}
</script>
<script type="text/javascript">
function GenerateFTCompanion() {
var locationValue = 2;
//sets the location and clickURL type and displays it on screen when set to featured torrent companion banner.
var valuesFTC = "{\\\"loc\\\":" + locationValue + ",\\\"clickUrlType\\\":" + clickURLType + "}";
document.body.innerHTML += valuesFTC;
}
</script>
<script type="text/javascript">
function Generate() {
// get page elements and set them as variables
var bgcolor = document.forms["additional"].elements["a1"].value;
var topPos = document.forms["pos"].elements["p1"].value;
var bottomPos = document.forms["pos"].elements["p2"].value;
var leftPos = document.forms["pos"].elements["p3"].value;
var rightPos = document.forms["pos"].elements["p4"].value;
var clickURL = document.forms["additional"].elements["a2"].value;
var titleText = document.forms["additional"].elements["a3"].value;
var torrentSize = document.forms["additional"].elements["a4"].value;
var ratingv = document.forms["additional"].elements["a5"].value;
//if (bgcolor.length < 6 || bgcolor.length > 6) {
// alert("Background " + bgcolor + " is an invalid length. Please enter another value.");
// }
else {
if (topPos < 0 || topPos > 4000 ) {
alert("Top position " + topPos + " is not valid. Please enter another value.");
}
else {
var colorR = parseInt((bgcolor).substring(0,2), 16);
var colorG = parseInt((bgcolor).substring(2,4), 16);
var colorB = parseInt((bgcolor).substring(4,6), 16);
var colorbgrDec = (colorB * 65536) + (colorG * 256) + colorR;
var values = "{\\\"loc\\\":" + locationValue + ", \\\"autoexec\\\":" + autoexecValue + ", \\\"hideFreeReadyButton\\\":" + hideFreeReadyButtonValue + ", \\\"info\\\": {" + " \\\"top\\\":" + topPos + ", \\\"bottom\\\":" + bottomPos + ", \\\"left\\\":" + leftPos + ", \\\"right\\\":" + rightPos + " }, \\\"title\\\":\\\"" + titleText + "\\\",\\\"torsize\\\":\\\"" + torrentSize + "\\\", \\\"rating\\\":\\\"" + ratingv + "\\\",\\\"health\\\":" + healthValue + ",\\\"clickUrlType\\\":" + clickURLType + ",\\\"bkgrdcolor\\\":" + colorbgrDec + "}";
document.body.innerHTML += values;
}
// }
}
</script>
<form>
<input type="button" value="Generate alt text!" onclick="validateRating();">
</form>
</body>
</html>