forked from ozten/Perfidies-of-the-Web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtester.html
executable file
·105 lines (95 loc) · 3.74 KB
/
tester.html
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><title>Perfidies Plugindir Tester</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset/reset-min.css">
<link href="tools/screen.css" media="all" rel="stylesheet" type="text/css" />
<script src="lib/jquery-1.3.2.min.js"></script>
<script src="lib/browserdetect.js"></script>
<script src="lib/plugindetect.js"></script>
<script src="lib/jquery.jsonp-1.1.0.js"></script>
<script src="perfidies.js"></script>
<script src="messages.js"></script>
<script src="modern_browser.js"></script>
<script src="plugincheck_ui.js"></script>
<script src="tools/json2.js"></script>
<script>
Pfs.$(document).ready(function(){
var incrementalCallbackFn = function(data) {
Pfs.i('callback', data);
Pfs.$('#status-display').text(Pfs.$('#status-display').text() + data.status);
Pfs.$('#output-display').text(JSON.stringify(data));
};
var successFn = incrementalCallbackFn;
var errorFn = incrementalCallbackFn;
var finishedCallbackFn = function(data) {
Pfs.i('callbacks finished', data);
}
var aHash = window.location.hash.substring(1);
var paramsParts = aHash.split('&');
window.testmimes = '';
for (var i=0; i < paramsParts.length; i++) {
var eachParts = paramsParts[i].split('=');
if ('mimes' === eachParts[0]) {
window.testmimes = unescape(eachParts[1]);
}
}
Pfs.endpoint = Pfs.$('select[name=endpoint]').val();
Pfs.$('textarea[name=mimes]').val(testmimes);
Pfs.$('form').submit(function() {
var args = Pfs.$.extend({}, Pfs.UI.browserInfo(), {detection: Pfs.$('select[name=detection]').val(), mimetype: Pfs.$('textarea[name=mimes]').val()});
Pfs.i(Pfs.endpoint);
var requestOptions = {
cache: false,
callbackParameter: "callback",
data: args,
error: function(xOptions, textStatus){
Pfs.e("it DID not worked: " + textStatus);
Pfs.e(JSON.stringify(xOptions));
},
retry: 3,
success: function(data){
var output = JSON.stringify(data);
Pfs.$('#output-display').val(output);
},
timeout: Pfs.TIMEOUT,
url: Pfs.endpoint
};
window.ro = requestOptions;
Pfs.$.jsonp(requestOptions);
return false;
}).trigger('submit');
});//document.ready
</script>
<style>
</style>
</head>
<body>
<div>
<h1 class="offset-by-one-half">Perfidies Plugindir Tester</h1>
<div class="panel offset-by-one-half">
<h2>Input</h2>
<form class="six">
<label for="endpoint">plugindir server:</label>
<select name="endpoint">
<option value="http://plugindir.ubuntu/en-us/pfs/v2">Dev Haskwhal</option>
<option value="http://plugins.stage.mozilla.com/en-us/pfs/v2">Staging</option>
<option value="http://plugins.mozilla.com/en-us/pfs/v2">Production</option>
</select>
<select name="detection">
<option value="original" selected>Original</option>
<option value="version_available">Version Available</option>
</select>
<textarea name="mimes" cols="30" rows="8" class="code" spellcheck="false"></textarea>
<br /><input type="submit" value="Test" /> or <a href="debug.html">Back to the Debug page</a>
</form>
</div>
<div class="panel five offset-by-one">
<h2>Output</h2>
<p><strong>Status:</strong><span id="status-display"></span>
<textarea id="output-display" cols="60" rows="20" class="code" spellcheck="false"></textarea>
</p>
</div>
</div>
</body>
</html>