-
Notifications
You must be signed in to change notification settings - Fork 106
/
index.html
495 lines (430 loc) · 28.4 KB
/
index.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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<head>
<title>PayPal Accessibility Tool - Home</title>
<meta charset="utf-8">
<link href="/css/lib/bootstrap.min.css" rel="stylesheet">
<link href="/css/lib/bootstrap-accessibility.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="print" href="/css/home-print.css">
<link rel="stylesheet" type="text/css" href="/css/home.css">
<style>
.inline{display: inline ; margin-left:10px;}
</style>
<script>
function showImg(url){
var imgDiv = document.getElementById('shot');
imgDiv.innerHTML= '<img src="/' + url + '" border="0">';
}
function getImg(url){
var imgDiv = document.getElementById('shot');
imgDiv.innerHTML= 'Getting screenshot';
$.get( url, function( data ) {
imgDiv.innerHTML = data
});
}
function showProgress(){
var $progDiv = $('#progress');
$progDiv.toggleClass('hide');
$progDiv.prepend('<h3>Loading results. Please wait...... ')
}
</script>
</head>
<body>
<div id="test-area">
<div class="container">
<div class="" style="position: relative; ">
<div style="">
<img src="/img/AATT_a11y-edge_sticker.png" height="100" width="100px" border="0" alt="PayPal Opensource">
</div>
<div style="position: absolute; bottom: 0;left:1020px">
<a id="loginButton" data-toggle="modal" href="#myModal" style="text-decoration:underline;font-size: 16px;">Login</a>
<a id="logoutButton" href="./logout" style="text-decoration:underline;font-size: 16px;">Log Out</a>
<a href="./help" style="text-decoration:underline;font-size: 16px; ">Help</a>
</div>
</div>
<hr>
<div class="test-area-body">
<h2>Automated Accessibility Testing Tool (AATT)</h2>
<p>Checks code for conformance to the Web Content Accessibility Guidelines (WCAG) 2.0, A, AA </p>
</div>
<p> Test results will be shown below.</p>
<div class="tabSection">
<ul id="myTab" class="nav nav-tabs" role="tablist">
<li class="active" role="presentation">
<a id="hometab" href="#home" data-toggle="tab" role="tab" aria-controls="home" aria-selected="true" aria-expanded="true" tabindex="0">
Page URL
</a>
</li>
<li role="presentation">
<a id="sniffHTMLTab" href="#sniffHTMLTabPanel" data-toggle="tab" role="tab" aria-controls="sniffHTMLTabPanel" tabindex="-1">
Test HTML
</a>
</li>
</ul>
</div>
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade in active" id="home" role="tabpanel" tabIndex="0" aria-labelledby="hometab" aria-hidden="false">
<div class="code-input">
<form id="requestURL" method="post" action="/sniffURL">
<div class="row">
<div class="col-xs-6 col-md-12">
<div class="form-group form-inline">
<label for="textURL" class="textURL" style="display:inline;padding-left:10px;">Page URL</label>
<input id="textURL" type="text" class="form-control" name="textURL" value="http://localhost:3000/test/Fails.html" size="100"/>
<input type="hidden" id="user" name="userName" value="{{{userName}}}"/>
</div>
</div>
</div> <!-- row1-->
<div class="row">
<div class="col-xs-6 col-md-12">
<div class="right">
<ul>
<li>
<input type="radio" id="axe" name="engine" value="axe" checked>
<label for="axe">Axe</label>
</li>
<li>
<input type="radio" id="chrome" name="engine" value="chrome">
<label for="chrome">Chrome</label>
</li>
<!-- <li>
<input type="radio" id="htmlcs" name="engine" value="htmlcs">
<label for="htmlcs">Html Code Sniffer</label>
</li> -->
</ul>
</div>
</div>
</div> <!-- row2-->
<div id="htmlcsopts" class="hide">
<div class="row">
<div class="col-xs-6 col-md-12">
<div class="form-group form-inline">
<input type="checkbox" style="font-size: 50px;" class="chkbox" id="scrshot" name="scrshot">
<label for="scrshot" class="inline">Screenshot </label>
</div>
</div>
</div> <!-- row2-->
<div class="row">
<div class="col-xs-6 col-md-12">
<div class="form-group form-inline" style="padding-left:10px;">
<strong> Show </strong>
<input type="checkbox" style="font-size: 50px;" class="chkbox" id="msgErr" name="msgErr" checked="true">
<label for="msgErr" class="inline">Errors </label>
<input type="checkbox" style="font-size: 50px;" class="chkbox" id="msgWarn" name="msgWarn">
<label for="msgWarn" class="inline">Warnings</label>
<input type="checkbox" style="font-size: 50px;" class="chkbox" id="msgNotice" name="msgNotice">
<label for="msgNotice" class="inline">Notices </label>
</div>
</div>
</div> <!-- row3-->
</div>
<div class="row">
<div class="col-xs-6 col-md-12">
<button type="submit" id="submitButton" class="btn btn-primary btn-medium" style="margin-left:10px;">Test Page</button>
</div>
</div> <!-- row4-->
</form>
</div> <!--code-input-->
</div> <!--tab-pane -->
<div class="tab-pane fade" id="sniffHTMLTabPanel" role="tabpanel" tabIndex="-1" aria-labelledby="sniffHTMLTab" aria-hidden="true">
<form id="sniff" method="post" action="/sniffHTML">
<div class="code-input">
<div class="row">
<div class="col-xs-6 col-md-12">
<div class="right">
<textarea name="source" id="source" cols="100" rows="20" title="Enter the source code to be sniffed" id="source"></textarea>
</div>
</div>
</div> <!-- row1-->
<br>
<div class="row">
<div class="col-xs-6 col-md-12">
<div class="right">
<ul>
<li>
<input type="radio" id="SHaxe" name="SHengine" value="axe" checked>
<label for="SHaxe">Axe</label>
</li>
<li>
<input type="radio" id="SHchrome" name="SHengine" value="chrome">
<label for="SHchrome">Chrome</label>
</li>
<li>
<input type="radio" id="SHhtmlcs" name="SHengine" value="htmlcs">
<label for="SHhtmlcs">Html Code Sniffer</label>
</li>
</ul>
</div>
</div>
</div> <!-- row2-->
<br/>
<button type="submit" class="btn btn-primary btn-medium">Test Content</button>
</div>
</form>
</div>
</div> <!-- close my TabContent -->
<div id="progress" class="hide" role="alert">
<h3> Loading.... Please Wait.... </h3>
<div id="rotatingDiv" class="show"></div>
<img id="rotatingImg" src="/img/logo_347x50_PPa11y.png" border="0" class="actionImage" alt="Loading Please wait">
<p class="note">If this page appears for more than 50 seconds, <a href="/getURL">click here to reload.</a></p>
</div>
<div id="test-results">
{{data}}
</div>
<!-- example modal -->
<div id="myModal" class="modal fade " tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form id="loginForm" method="post" action="/login">
<div class="modal-header">
<h3 id="myModalLabel">Stage Login Details</h3>
</div>
<div class="modal-body">
<label for="userName">User Name</label>
<input id="userName" type="text" name="userName" placeholder="stage user name" title="Enter the user name" />
<label for="password">Password</label>
<input id="password" type="password" name="password" placeholder="stage password" title="Enter the password"/>
<label for="stageName">Stage/Domain Name</label>
<input id="stageName" type="text" name="stageName" placeholder="stage2qa.paypal.com"/>
<input type="hidden" id="server" name="server" value="paypal">
<!--label for="server">Server</label>
<select id="server" name="server">
<option value="paypal" selected>PayPal</option>
<option value="ebay">eBay</option>
<option value="paypaladmin">PayPal Admin</option>
<option value="paypalmerchant">PayPal Merchant</option>
<option value="paypalpartner">PayPal Partner</option>
</select-->
<div id="partnerDiv" class="hide" style="">
<label for="partner">Parter Name</label>
<input id="partner" type="text" name="partner" placeholder="Partner Name"/>
</div>
<div id="merchantDiv" class="hide" style="">
<label for="merchant">Merchant Login</label>
<input id="merchant" type="text" name="merchant" placeholder="Merchant Login / Vendor Name"/>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">Close</button>
<input class="btn btn-primary" type="submit" id="saveSubmit" value="Login"/>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!-- Modal -->
<div class="modal fade" id="screenshot" tabindex="-1" role="alertdialog" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-body" id="shot">
<img src="https://www.google.com/images/srpr/logo11w.png" alt="Google logo as placeholder">
</div>
</div>
</div>
</div>
<hr style="height: 1px;">
<footer>
<a href="http://paypal.github.io" alt="PayPal Open Source">PayPal Open Source</a>
</footer>
<script src="/js/lib/jquery.js"></script>
<script src="/js/lib/bootstrap.min.js"></script>
<script src="/js/lib/bootstrap-accessibility.min.js"></script>
<script src="/js/validation.js"></script>
<script type="text/javascript" src="/js/lib/__jquery.tablesorter.js"></script>
<script src="/js/lib/table2CSV.js"></script>
<script type="text/javascript">
var string = "" + unescape(location.search)
, string = string.substring(string.indexOf("?")+1,string.length)
if(string!='')
{
var tab = string.split('&'), nameVal = new Array();
// console.log($('#' + tab[0]))
$('#' + tab[0]).tab('show')
}
(function($) {
var constructOrig = $.fn.tablesorter;
$.fn.extend({
tablesorter: function(options) {
var $headers =$($.find('th'));
if ( $headers.length>0 ){
$headers[0].setAttribute('tabIndex','0');
$headers[0].setAttribute('aria-sort','ascending')
$headers.keydown(function(e) {
var k = e.which || e.keyCode
, $this= $(this)
if (!/(13|32|37|39)/.test(k)) return
index = $headers.index(this)
if (k == 37) index--
if (k == 39) index++
if(index < 0) index = $headers.length -1
if(index == $headers.length) index = 0
if(k == 37 || k === 39){
this.setAttribute('tabIndex','-1');
$headers[index].setAttribute('tabIndex','0');
$headers[index].focus();
}
//console.log(this, $headers, index);
if( k === 32 || k === 13) {
$this.click()
setTimeout(function(){
// console.log($this.attr('class'))
if($this.hasClass('headerSortUp')) $this.attr('aria-sort','descending')
if($this.hasClass('headerSortDown')) $this.attr('aria-sort','ascending')
} , 200)
}
});
}
constructOrig.apply(this, arguments);
}
})
})(jQuery);
$(function() {
$("#test-results-table").tablesorter({sortList: [[0,0]], headers: {2:{sorter: false}, 3:{sorter: false}, 4:{sorter: false}}});
});
$("#export").on('click', function (event) {
$('#test-results-table').table2CSV({delivery:'download'}, event);
});
var $scrmodal= $('#screenshot'); //get a common instance
$( "#sniff" ).submit(function( event ) {
event.preventDefault();
$( "#test-results" ).attr('aria-busy', 'true');
document.getElementById('shot').innerHTML = document.getElementById('progress').innerHTML;
$scrmodal.modal('show');
var $form = $( this ),
source = document.getElementById('source').value,
url = $form.attr( "action" ),
SHengine = $('input[name="SHengine"]:checked').val();
var posting = $.post( url, { source: source, engine: SHengine } );
posting.done(function( data ) {
$scrmodal.modal('hide');
$( "#test-results" ).empty().append( data ).attr('aria-busy', 'false');
setTimeout(function(){
$("#export").on('click', function (event) {
$('#test-results-table').table2CSV({delivery:'download'}, event);
});
$(function() {
$("#test-results-table").tablesorter({sortList: [[0,0]], headers: {2:{sorter: false}, 3:{sorter: false}, 4:{sorter: false}, 5:{sorter: false} }});
});
},100)
})
})
$('input[name="engine"]').change(function(){
var engine = $('input[name="engine"]:checked').val();
var opts = '#' + engine+ 'opts';
$(opts).addClass('show');
})
$( "#requestURL" ).submit(function( event ) {
event.preventDefault();
$( "#test-results" ).attr('aria-busy', 'true');
document.getElementById('shot').innerHTML = document.getElementById('progress').innerHTML;
$scrmodal.modal('show');
var
textURL = document.getElementById('textURL').value,
url = $(this).attr( "action" ),
scrshot = $("#scrshot").is(":checked"),
msgErr = $("#msgErr").is(":checked"),
msgWarn = $("#msgWarn").is(":checked"),
msgNotice = $("#msgNotice").is(":checked"),
engine = $('input[name="engine"]:checked').val();
if(engine === 'chrome'){
var params = {
textURL: textURL,
engine: engine
}
}
else if(engine === 'axe') {
var params = {
textURL: textURL,
engine: engine
}
}
else {
var params = {
textURL: textURL,
engine: engine,
scrshot: scrshot,
msgErr: msgErr,
msgWarn: msgWarn,
msgNotice: msgNotice
}
}
var posting = $.post( url, params);
posting.done(function( data ) {
// console.log(data)
$scrmodal.modal('hide');
if ( engine === "axe" ) {
data.data = data.data.replace(/(<td.+?>)(.+?)(<\/td>)/g, function() {
return arguments[1] + arguments[2].replace(/</g,'<').replace(/>/g,'>') + arguments[3];
});
}
$( "#test-results" ).empty().append( data.data ).attr('aria-busy', 'false');
setTimeout(function(){
$("#export").on('click', function (event) {
$('#test-results-table').table2CSV({delivery:'download'}, event);
});
$(function() {
$("#test-results-table").tablesorter({sortList: [[0,0]], headers: {2:{sorter: false}, 3:{sorter: false}, 4:{sorter: false}, 5:{sorter: false} }});
});
},100)
})
})
$('#server').change(function( event ) {
var server= this.value;
if(this.value === 'paypalmerchant') {
$('#partnerDiv').removeClass('hide')
$('#merchantDiv').removeClass('hide')
}else if(this.value ==='paypalpartner'){
$('#partnerDiv').removeClass('hide')
$('#merchantDiv').addClass('hide')
}
else {
$('#partnerDiv').addClass('hide')
$('#merchantDiv').addClass('hide')
}
})
$( "#loginForm" ).submit(function( event ) {
event.preventDefault();
// $( "#test-results" ).attr('aria-busy', 'true');
document.getElementById('shot').innerHTML = '<h3> Logging in .. Please wait </h3><div id="rotatingDiv" class="show"></div><img id="rotatingImg" src="/img/logo_347x50_PPa11y.png" border="0" class="actionImage" alt="Loading Please wait">';
$scrmodal.modal('show');
var
userName = document.getElementById('userName').value,
password = document.getElementById('password').value,
stageName = document.getElementById('stageName').value,
server = document.getElementById('server').value,
partner = document.getElementById('partner').value,
merchant = document.getElementById('merchant').value,
url = $(this).attr( "action" );
// console.log('partner', partner, 'merchant', merchant)
if( server === 'paypalmerchant' || server === 'paypalpartner') {
var posting = $.post( url, {
userName: userName,
password: password,
stageName:stageName,
server:server,
partner:partner,
merchant:merchant
}
);
}else{
var posting = $.post( url, { userName: userName , password: password, stageName:stageName, server:server } );
}
// console.log(textURL);
posting.done(function( data ) {
// console.log('logged in userName', data.userName)
document.getElementById('shot').innerHTML = '';
document.getElementById('shot').innerHTML = '<h3>Logged In......</h3>';
setTimeout(function(){
$scrmodal.modal('hide');
$('#myModal').modal('hide');
$("#loginButton").addClass("hideLoginButton");
$("#logoutButton").addClass("showLogoutButton").focus();
},3000)
})
})
</script>
</body>
</html>