-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto.js
More file actions
78 lines (70 loc) · 1.76 KB
/
auto.js
File metadata and controls
78 lines (70 loc) · 1.76 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
function doApp(applist, appidx) {
if (appidx < applist.length) {
var href = applist[appidx];
location.href = href;
}
}
function doTestCase(test, testidx, appidx, wait) {
var link = document.getElementById(test);
if (link) {
var url = link.href;
url += '&autoindex=' + testidx;
url += '&auto=1';
url += '&autoapp=' + appidx;
url += '&autowait=' + wait;
location.href = url;
} else {
alert('Test case not found: ' + test);
}
}
function replaceParameterValue(url, param, newval) {
var idx = url.indexOf(param + '=');
if (idx == -1) {
var idx2 = url.indexOf('?');
url += idx2 == -1 ? '?' : '&';
return url + param + '=' + newval;
} else {
var chars = 0;
var vstart = idx + param.length + 1;
for (var i=vstart; i<url.length; i++) {
var c = url.charAt(i);
if (c == '&') break;
chars++;
}
var u0 = url.substring(0, vstart);
var u1 = url.substring(vstart + chars);
return u0 + newval + u1;
}
}
function goBackUp(appidx, wait) {
var loc = location.href;
// Strip the parameter string.
var paramstart = loc.indexOf('?');
if (paramstart > -1) {
loc = loc.substring(0, paramstart);
}
var slash = loc.lastIndexOf('/');
var up = loc.substring(0, slash);
// Strip another level if there was a trailing slash.
if (slash == up.length) {
slash = up.lastIndexOf('/');
up = up.substring(0, slash);
}
up += "?auto=1";
up += "&autoapp=" + appidx;
up += "&autowait=" + wait;
location.href = up;
}
function goToPage(url, param, newval) {
if (param) {
url = replaceParameterValue(url, param, newval);
}
//alert(url);
location.href = url;
}
function doTestButton(eltid) {
var btn = document.getElementById(eltid);
if (btn) {
btn.click();
}
}