-
Notifications
You must be signed in to change notification settings - Fork 23
/
jurlp.html
970 lines (730 loc) · 48.1 KB
/
jurlp.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
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" />
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script>
<script type="text/javascript" src="jurlp.min.js"></script>
<style type="text/css">
.qunitLI
{
position: relative;
}
.qunitLI .tag
{
width: 12px;
min-height: 10px;
position: absolute;
top: 25%;
left: 10px;
height: 50%;
-webkit-border-radius: 3px; /* Saf3-4, iOS 1-3.2, Android =1.6 */
-moz-border-radius: 3px; /* FF1-3.6 */
border-radius: 3px; /* Opera 10.5, IE9, Saf5, Chrome, FF4, iOS 4, Android 2.1+ */
/* useful if you don't want a bg color from leaking outside the border: */
-moz-background-clip: padding;
-webkit-background-clip: padding-box;
background-clip: padding-box;
}
</style>
<script type="text/javascript">
/*
jQuery paging plugin v1.8 06/21/2010
http://www.xarg.org/project/jquery-color-plugin-xcolor/
Copyright (c) 2010, Robert Eisele (robert@xarg.org)
Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function(i,k){function e(a){function d(a,b){var d;k!==a&&(a=parseFloat(a));if(k===b)d=b=255;else if(1===b){if(k===a||1===a)return 1;b=100;d=1}else d=b;return isNaN(a)||a<=0?0:b<a?d:a<1||1===b?1===d?a:a*d|0:a*d/b}function b(a,b,c){function e(a,b,d){d=++d%1;return 6*d<1?a+(b-a)*6*d:2*d<1?b:3*d<2?a+(b-a)*(4-6*d):a}a=d(a,360)/360;b=d(b,1);c=d(c,1);if(0===b)return c=Math.round(255*c),[c,c,c];b=c<0.5?c+c*b:c+b-c*b;c=c+c-b;return[Math.round(255*e(c,b,a+1/3)),Math.round(255*e(c,b,a)),Math.round(255*e(c,
b,a-1/3))]}function c(a,b,c){var a=d(a,360)/60,b=d(b,1),c=d(c,1),e=a|0,m=a-e,a=Math.round(255*c*(1-b)),j=Math.round(255*c*(1-b*m)),b=Math.round(255*c*(1-b*(1-m))),c=Math.round(255*c);switch(e){case 1:return[j,c,a];case 2:return[a,c,b];case 3:return[a,j,c];case 4:return[b,a,c];case 5:return[c,a,j]}return[c,b,a]}this.setColor=function(a){this.c=true;if("number"===typeof a)this.a=(a>>24&255)/255,this.r=a>>16&255,this.g=a>>8&255,this.b=a&255;else{for(;"object"===typeof a;){if(0 in a&&1 in a&&2 in a){this.a=
d(a[3],1);this.r=d(a[0]);this.g=d(a[1]);this.b=d(a[2]);return}else if("r"in a&&"g"in a&&"b"in a){this.a=d(a.a,1);this.r=d(a.r);this.g=d(a.g);this.b=d(a.b);return}else if("h"in a&&"s"in a){var f;if("l"in a)f=b(a.h,a.s,a.l);else if("v"in a)f=c(a.h,a.s,a.v);else if("b"in a)f=c(a.h,a.s,a.b);else break;this.a=d(a.a,1);this.r=f[0];this.g=f[1];this.b=f[2];return}break}if("string"===typeof a){a=a.toLowerCase().replace(/[^a-z0-9,.()#%]/g,"");if("transparent"===a){this.a=this.r=this.g=this.b=0;return}if("rand"===
a){a=Math.random()*16777215|0;this.a=1;this.r=a>>16&255;this.g=a>>8&255;this.b=a&255;return}k!==o[a]&&(a="#"+o[a]);if(f=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/.exec(a)){this.a=1;this.r=parseInt(f[1],16);this.g=parseInt(f[2],16);this.b=parseInt(f[3],16);return}if(f=/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/.exec(a)){this.a=1;this.r=parseInt(f[1]+f[1],16);this.g=parseInt(f[2]+f[2],16);this.b=parseInt(f[3]+f[3],16);return}if(f=/^rgba?\((\d{1,3}),(\d{1,3}),(\d{1,3})(,([0-9.]+))?\)$/.exec(a)){this.a=d(f[5],
1);this.r=d(f[1]);this.g=d(f[2]);this.b=d(f[3]);return}if(f=/^rgba?\(([0-9.]+\%),([0-9.]+\%),([0-9.]+\%)(,([0-9.]+)\%?)?\)$/.exec(a)){this.a=d(f[5],1);this.r=Math.round(2.55*d(f[1],100));this.g=Math.round(2.55*d(f[2],100));this.b=Math.round(2.55*d(f[3],100));return}if(f=/^hs([bvl])a?\((\d{1,3}),(\d{1,3}),(\d{1,3})(,([0-9.]+))?\)$/.exec(a)){a=("l"===f[1]?b:c)(parseInt(f[2],10),parseInt(f[3],10),parseInt(f[4],10));this.a=d(f[6],1);this.r=a[0];this.g=a[1];this.b=a[2];return}if(f=/^(\d{1,3}),(\d{1,3}),(\d{1,3})(,([0-9.]+))?$/.exec(a)){this.a=
d(f[5],1);this.r=d(f[1]);this.g=d(f[2]);this.b=d(f[3]);return}}this.c=false}};this.getColor=function(a){if(k!==a)switch(a.toLowerCase()){case "rgb":return this.getRGB();case "hsv":case "hsb":return this.getHSV();case "hsl":return this.getHSL();case "int":return this.getInt();case "array":return this.getArray();case "fraction":return this.getFraction();case "css":case "style":return this.getCSS();case "name":return this.getName()}return this.getHex()};this.getRGB=function(){return this.c?{r:this.r,
g:this.g,b:this.b,a:this.a}:null};this.getCSS=function(){return this.c?0===this.a?"transparent":1===this.a?"rgb("+this.r+","+this.g+","+this.b+")":p(this.r,this.g,this.b,this.a):null};this.getArray=function(){return this.c?[this.r,this.g,this.b,100*this.a|0]:null};this.getName=function(){if(this.c){var a=null,b,d=o,c=this.getHSL(),m;for(m in d){var j=(new e(d[m])).getHSL(),j=Math.sqrt(0.5*(c.h-j.h)*(c.h-j.h)+0.5*(c.s-j.s)*(c.s-j.s)+(c.l-j.l)*(c.l-j.l));if(null===a||j<a)a=j,b=m}return b}return null};this.getFraction=
function(){return this.c?{r:this.r/255,g:this.g/255,b:this.b/255,a:this.a}:null};this.getHSL=function(){if(this.c){var a=this.r/255,b=this.g/255,d=this.b/255,c=Math.min(a,b,d),e=Math.max(a,b,d),j=e-c,i=(e+c)/2;0===j?c=a=0:(a=a===e?(b-d)/j:b===e?2+(d-a)/j:4+(a-b)/j,c=j/(i<0.5?e+c:2-e-c));return{h:Math.round(60*((6+a)%6)),s:Math.round(100*c),l:Math.round(100*i),a:this.a}}return null};this.getHSV=function(){if(this.c){var a=this.r/255,b=this.g/255,d=this.b/255,c=Math.min(a,b,d),e=Math.max(a,b,d),c=e-c;return{h:Math.round(60*
((6+(0===c?0:a===e?(b-d)/c:b===e?2+(d-a)/c:4+(a-b)/c))%6)),s:Math.round(100*(0===e?0:c/e)),v:Math.round(100*e),a:this.a}}return null};this.getHex=function(){if(this.c){var a=this.r>>4,b=this.g>>4,c=this.b>>4,d=this.r&15,e=this.g&15,j=this.b&15;return 0===(a^d|b^e|c^j)?"#"+"0123456789abcdef".charAt(a)+"0123456789abcdef".charAt(b)+"0123456789abcdef".charAt(c):"#"+"0123456789abcdef".charAt(a)+"0123456789abcdef".charAt(d)+"0123456789abcdef".charAt(b)+"0123456789abcdef".charAt(e)+"0123456789abcdef".charAt(c)+
"0123456789abcdef".charAt(j)}return null};this.getInt=function(a){return this.c?k!==a?(100*this.a|0)<<24^this.r<<16^this.g<<8^this.b:(this.r<<16^this.g<<8^this.b)&16777215:null};this.toString=function(){return this.getHex()};this.setColor(a)}function q(a,d){var b="";do if(b=i.curCSS(a,d),""!==b&&"transparent"!==b&&"rgba(0, 0, 0, 0)"!==b||i.nodeName(a,"body"))break;while(a=a.parentNode);""===b&&(b=i.support.rgba?"transparent":"backgroundColor"===d?"white":"black");return new e(b)}var o={aliceblue:"f0f8ff",
antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",
darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",
greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",
lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",
orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",
steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},p;i.each("color,backgroundColor,borderColor,borderTopColor,borderBottomColor,borderLeftColor,borderRightColor,outlineColor".split(","),function(a,d){i.cssHooks[d]={set:function(a,c){a.style[d]=(new e(c)).getCSS()}};i.fx.step[d]=function(a){if(k===a.xinit){if("string"===typeof a.end&&-1!==a.end.indexOf(";")){var c,
h=a.end.split(";");if(h.length>2){for(c in h)h[c]=-1===h[c].indexOf("native")?new e(h[c]):q(a.elem,d);a.start=null;a.end=h}else a.start=new e(h[0]),a.end=new e(h[1])}else a.start=q(a.elem,d),a.end=new e(a.end);a.xinit=1}c=a.start;var h=a.end,f=a.pos;if(null===c){var i=f*(h.length-1),f=f<1?i|0:h.length-2;c=h[f];h=h[f+1];f=i-f}a.elem.style[d]=p(c.r+f*(h.r-c.r)|0,c.g+f*(h.g-c.g)|0,c.b+f*(h.b-c.b)|0,c.a+f*(h.a-c.a))}});i(function(){var a=document.createElement("div").style;p=function(a,b,c,e){return"rgba("+
a+","+b+","+c+","+e+")"};a.cssText="background-color:rgba(1,1,1,.5)";if(!(i.support.rgba=a.backgroundColor.indexOf("rgba")>-1))p=function(a,b,c){return"rgb("+a+","+b+","+c+")"}});i.xcolor=new function(){this.test=function(a){a=new e(a);return a.c?a:null};this.red=function(a){a=new e(a);return a.c?(a.g=255,a.b=255,a):null};this.blue=function(a){a=new e(a);return a.c?(a.r=255,a.g=255,a):null};this.green=function(a){a=new e(a);return a.c?(a.r=255,a.b=255,a):null};this.sepia=function(a){a=new e(a);if(a.c){var d=
a.r,b=a.g,c=a.b;a.r=Math.round(d*0.393+b*0.769+c*0.189);a.g=Math.round(d*0.349+b*0.686+c*0.168);a.b=Math.round(d*0.272+b*0.534+c*0.131);return a}return null};this.random=function(){return new e([255*Math.random()|0,255*Math.random()|0,255*Math.random()|0])};this.inverse=function(a){a=new e(a);return a.c?(a.r^=255,a.g^=255,a.b^=255,a):null};this.opacity=function(a,d,b){a=new e(a);d=new e(d);return a.c&d.c?(b>1&&(b/=100),b=Math.max(b-1+d.a,0),a.r=Math.round((d.r-a.r)*b+a.r),a.g=Math.round((d.g-a.g)*b+a.g),
a.b=Math.round((d.b-a.b)*b+a.b),a):null};this.greyfilter=function(a,d){var b,c=new e(a);if(c.c){switch(d){case 1:b=0.35+13*(c.r+c.g+c.b)/60;break;case 2:b=(13*(c.r+c.g+c.b)+5355)/60;break;default:b=c.r*0.3+c.g*0.59+c.b*0.11}c.r=c.g=c.b=Math.min(b|0,255);return c}return null};this.webround=function(a){a=new e(a);if(a.c){if((a.r+=51-a.r%51)>255)a.r=255;if((a.g+=51-a.g%51)>255)a.g=255;if((a.b+=51-a.b%51)>255)a.b=255;return a}return null};this.distance=function(a,d){var b=new e(a),c=new e(d);return b.c&c.c?Math.sqrt(3*
(c.r-b.r)*(c.r-b.r)+4*(c.g-b.g)*(c.g-b.g)+2*(c.b-b.b)*(c.b-b.b)):null};this.readable=function(a,d,b){d=new e(d);a=new e(a);b=b||10;return d.c&a.c?(a=a.r*0.299+a.g*0.587+a.b*0.114-d.r*0.299-d.g*0.587-d.b*0.114,!(a<1.5+141.162*Math.pow(0.975,b)&&a>-0.5-154.709*Math.pow(0.99,b))):null};this.combine=function(a,d){var b=new e(a),c=new e(d);return b.c&c.c?(b.r^=c.r,b.g^=c.g,b.b^=c.b,b):null};this.breed=function(a,d){var b=new e(a),c=new e(d),h=0,f=6;if(b.c&c.c){for(;f--;)Math.random()<0.5&&(h|=15<<(f<<2));b.r=b.r&
h>>16&255|c.r&(h>>16&255^255);b.g=b.g&h>>8&255|c.g&(h>>8&255^255);b.b=b.b&h>>0&255|c.b&(h>>0&255^255);return b}return null};this.additive=function(a,d){var b=new e(a),c=new e(d);if(b.c&c.c){if((b.r+=c.r)>255)b.r=255;if((b.g+=c.g)>255)b.g=255;if((b.b+=c.b)>255)b.b=255;return b}return null};this.subtractive=function(a,d){var b=new e(a),c=new e(d);if(b.c&c.c){if((b.r+=c.r-255)<0)b.r=0;if((b.g+=c.g-255)<0)b.g=0;if((b.b+=c.b-255)<0)b.b=0;return b}return null};this.subtract=function(a,d){var b=new e(a),c=new e(d);
if(b.c&c.c){if((b.r-=c.r)<0)b.r=0;if((b.g-=c.g)<0)b.g=0;if((b.b-=c.b)<0)b.b=0;return b}return null};this.multiply=function(a,d){var b=new e(a),c=new e(d);return b.c&c.c?(b.r=b.r/255*c.r|0,b.g=b.g/255*c.g|0,b.b=b.b/255*c.b|0,b):null};this.average=function(a,d){var b=new e(a),c=new e(d);return b.c&c.c?(b.r=b.r+c.r>>1,b.g=b.g+c.g>>1,b.b=b.b+c.b>>1,b):null};this.triad=function(a){a=new e(a);return a.c?[a,new e([a.b,a.r,a.g]),new e([a.g,a.b,a.r])]:null};this.tetrad=function(a){a=new e(a);return a.c?[a,new e([a.b,
a.r,a.b]),new e([a.b,a.g,a.r]),new e([a.r,a.b,a.r])]:null};this.gradientlevel=function(a,d,b,c){k===c&&(c=1);if(b>c)return null;a=new e(a);d=new e(d);return a.c&d.c?(a.r=a.r+(d.r-a.r)/c*b|0,a.g=a.g+(d.g-a.g)/c*b|0,a.b=a.b+(d.b-a.b)/c*b|0,a):null};this.gradientarray=function(a,d,b){if(d>b)return null;var c=d*(a.length-1)/b|0,d=(d-b*c/(a.length-1))/b,b=new e(a[c]),c=new e(a[c+1]);return b.c&c.c?(b.r=b.r+a.length*(c.r-b.r)*d|0,b.g=b.g+a.length*(c.g-b.g)*d|0,b.b=b.b+a.length*(c.b-b.b)*d|0,b):null};this.nearestname=
function(a){a=new e(a);return a.c?a.getName():null};this.darken=function(a,d,b){if(k===d)d=1;else if(d<0)return this.lighten(a,-d,b);k===b&&(b=32);a=new e(a);if(a.c){if((a.r-=b*d)<0)a.r=0;if((a.g-=b*d)<0)a.g=0;if((a.b-=b*d)<0)a.b=0;return a}return null};this.lighten=function(a,d,b){if(k===d)d=1;else if(d<0)return this.darken(a,-d,b);k===b&&(b=32);a=new e(a);if(a.c){if((a.r+=b*d)>255)a.r=255;if((a.g+=b*d)>255)a.g=255;if((a.b+=b*d)>255)a.b=255;return a}return null};this.analogous=function(a,d,b){k===d&&(d=8);
k===b&&(b=30);var c=new e(a);if(c.c){a=c.getHSV();b=360/b;c=[c];for(a.h=(a.h-(b*d>>1)+720)%360;--d;)a.h+=b,a.h%=360,c.push(new e(a));return c}return null};this.complementary=function(a){a=new e(a);return a.c?(a=a.getHSL(),a.h=(a.h+180)%360,new e(a)):null};this.splitcomplement=function(a){var d=new e(a);return d.c?(a=d.getHSV(),d=[d],a.h+=72,a.h%=360,d.push(new e(a)),a.h+=144,a.h%=360,d.push(new e(a)),d):null};this.monochromatic=function(a,d){k===d&&(d=6);var b=new e(a);if(b.c){for(var c=b.getHSV(),b=[b];--d;)c.v+=
20,c.v%=100,b.push(new e(c));return b}return null}};i.fn.readable=function(){var a=this[0],d="",b="";do{if(""===d&&("transparent"===(d=i.curCSS(a,"color"))||"rgba(0, 0, 0, 0)"===d))d="";if(""===b&&("transparent"===(b=i.curCSS(a,"backgroundColor"))||"rgba(0, 0, 0, 0)"===b))b="";if(""!==d&&""!==b||i.nodeName(a,"body"))break}while(a=a.parentNode);""===d&&(d="black");""===b&&(b="white");return i.xcolor.readable(b,d)};i.fn.colorize=function(a,d,b){var c={gradient:function(a,b){return a/b},flip:function(a,
b,c,d){return" "===d?c:!c},pillow:function(a,b){a*=2;return a<=b?a/b:2-a/b}};if("function"!==typeof b)if(void 0===c[b])return;else b=c[b];a=new e(a);d=new e(d);this.each(function(){var c=this.childNodes,e=0,i=0;if(a.c&d.c){for(var k=c.length;k--;e+=c[k].textContent.length);(function j(c){var h=0,k;if(3===c.nodeType){var l=a,r=d,o=e,s,t,n=0,u,q=b;k=c.nodeValue.length;t=document.createElement("span");for(h=0;h<k;++h)s=document.createElement("span"),u=c.nodeValue.charAt(h),n=q(i,o,n,u),s.style.color=
p(l.r+n*(r.r-l.r)|0,l.g+n*(r.g-l.g)|0,l.b+n*(r.b-l.b)|0,l.a+n*(r.a-l.a)),s.appendChild(document.createTextNode(u)),t.appendChild(s),++i;c.parentNode.replaceChild(t,c)}else for(k=c.childNodes.length;h<k;++h)j(c.childNodes[h])})(this)}})}})(jQuery);
</script>
<script>
(function(userOptions){
// get the original module function
var oldModule = window.module;
// set the needed variables
var colorTags = [];
var paletteCount = 0;
var paletteSrc = [ "#BF1534", "#498C37", "#F27B35", "#0367A6", "#DCC50D", "#8F29BF" ];
// default options
var options = {
palette: paletteSrc,
type: "static",
amount: 32,
lighten: 1,
darken: 1
};
// extend the options with userprovided options
if(userOptions){
options = $.extend(options, userOptions);
}
// get the palette
var palette = options.palette || paletteSrc;
// if there are palette options
if(options.type == "random" && $.xcolor){
palette = [];
for(var i = 0; i < options.amount; i++)
{
palette.push($.xcolor.random());
}
}
else if(options.type == "shades" && $.xcolor)
{
var paletteTmp = [];
for(var i = 0; i < palette.length; i++)
{
var j;
for(j = options.lighten; j >= 1 ; j--)
{
paletteTmp = paletteTmp.concat($.xcolor.lighten(palette[i], j, options.amount));
}
paletteTmp.push(palette[i]);
for(j = 1; j < options.darken+1; j++)
{
paletteTmp = paletteTmp.concat($.xcolor.darken(palette[i], j, options.amount));
}
}
palette = paletteTmp;
}
// override the module function
window.module = function(name, color)
{
if(!color)
{
if(palette.length > paletteCount){
color = palette[paletteCount];
paletteCount = (paletteCount+1)%palette.length;
}else{
color = $.xcolor.random();
}
}
colorTags.push({name: name, color: color});
oldModule(name);
};
QUnit.moduleDone(function( result ){
//console.log(result);
for(var i = 0; i < colorTags.length; i++)
{
if(colorTags[i].name == result.name)
{
var parents = $(".module-name").filter(function(){ return ($(this).text() == result.name); }).parents("li").addClass("qunitLI");
var tag = $("<div class='tag'></div>").css("background", colorTags[i].color);
parents.prepend(tag);
}
}
});
}(
));
/* QUnit TagColors Options
// all options are optional
{
palette: ["#FF0000","#00FF00","#0000FF"], // example palette
type: "random" || "shades", // the type of palette
lighten: 1, // only for "shades"
darken: 1, // only for "shades"
amount: 32 // either number of colors for "random", or amount to step for each lighten / darken in "shades"
}
*/
$( document ).ready
(
function ( )
{
/* Ensure the interface is correct */
module ( "Interface test" );
test
(
"Query interface",
function()
{
var interface = $.fn.jurlp ( "interface" );
var expectedInterface =
{
filter : null,
fragment : null,
"goto" : null,
host : null,
initialise : null,
"interface" : null,
password : null,
path : null,
port : null,
proxy : null,
query : null,
restore : null,
scheme : null,
unwatch : null,
url : null,
user : null,
watch : null
};
for ( var method in expectedInterface )
{
ok ( interface [ method ], method );
}
}
);
module ( "Direct URL manipulation" );
test
(
"http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment",
function ( )
{
var urlObject =
{
scheme : "http://",
user : "user",
password : "password",
host : "www.example.com",
port : "8080",
path : "/path/file.name",
query : "?param1=value1¶m2=value2¶m3=value3",
fragment : "#fragment"
};
expect ( 44 );
var urlString = "http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment";
var url = $.jurlp ( urlString );
var expectedInterface =
{
fragment : null,
"goto" : null,
host : null,
password : null,
path : null,
port : null,
proxy : null,
query : null,
scheme : null,
unwatch : null,
url : null,
user : null,
watch : null
};
for ( var method in expectedInterface )
{
ok ( url [ method ], method );
}
var actualUrlObject = url.url ( );
delete actualUrlObject.toString;
/* Get an verify all values */
deepEqual ( actualUrlObject, urlObject, "url.url()" );
equal ( url.url ( ).toString ( ), urlString, "url.url().toString()" );
equal ( url.scheme ( ), urlObject.scheme, "url.scheme()" );
equal ( url.user ( ), urlObject.user, "url.user()" );
equal ( url.password ( ), urlObject.password, "url.password()" );
equal ( url.host ( ), urlObject.host, "url.host()" );
equal ( url.port ( ), urlObject.port, "url.port()" );
equal ( url.path ( ).toString ( ), urlObject.path, "url.path().toString()" );
equal ( url.path ( ).length, 2, "url.path().length" );
equal ( url.path ( ) [ 0 ], "path", "url.path()[0]" );
equal ( url.path ( ) [ 1 ], "file.name", "url.path()[1]" );
equal ( url.query ( ).toString ( ), urlObject.query, "url.query().toString()" );
equal ( url.query ( ).param1, "value1", "url.query().param1" );
equal ( url.query ( ).param2, "value2", "url.query().param2" );
equal ( url.query ( ).param3, "value3", "url.query().param3" );
equal ( url.fragment ( ), urlObject.fragment, "url.fragment()" );
/* Set all posible values */
/* Modify the fragment */
equal ( url.fragment ( "#newfragment" ).url ( ).toString ( ), "http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.fragment(\"#newfragment\")" );
/* Append to the query string */
equal ( url.query ( "newparam1=newvalue1&newparam2=newvalue2&newparam3=newvalue3" ).url ( ).toString ( ), "http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3&newparam1=newvalue1&newparam2=newvalue2&newparam3=newvalue3#newfragment", "url.query(\"newparam1=newvalue1&newparam2=newvalue2&newparam3=newvalue3\")" );
/* Remove/ammend existing parameters */
equal ( url.query ( { "newparam1" : null, "newparam2" : "changed", "newparam3" : null, "newparam4" : "newvalue4" } ).url ( ).toString ( ), "http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3&newparam2=changed&newparam4=newvalue4#newfragment", "url.query({\"newparam1\":null,\"newparam2\":\"changed\",\"newparam3\":null,\"newparam4\":\"newvalue4\"}" );
/* Set the query string */
equal ( url.query ( "?param1=value1¶m2=value2¶m3=value3" ).url ( ).toString ( ), "http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.query(\"?param1=value1¶m2=value2¶m3=value3\")" );
/* Append to the path */
equal ( url.path ( "./something" ).url ( ).toString ( ), "http://user:password@www.example.com:8080/path/file.name/something?param1=value1¶m2=value2¶m3=value3#newfragment", "url.path(\"./something\")" );
/* Remove a path element */
equal ( url.path ( ".." ).url ( ).toString ( ), "http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.path(\"..\")" );
/* Remove and append path element */
equal ( url.path ( "../../newpath/newfile.name" ).url ( ).toString ( ), "http://user:password@www.example.com:8080/newpath/newfile.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.path(\"../../newpath/newfile.name\")" );
/* Set the path */
equal ( url.path ( "/path/file.name" ).url ( ).toString ( ), "http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.path(\"/path/file.name\")" );
/* Set the port */
equal ( url.port ( "443" ).url ( ).toString ( ), "http://user:password@www.example.com:443/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.port(\"443\")" );
equal ( url.host ( "www.newexample.com" ).url ( ).toString ( ), "http://user:password@www.newexample.com:443/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.host(\"www.newexample.com\")" );
equal ( url.user ( "newuser" ).url ( ).toString ( ), "http://newuser:password@www.newexample.com:443/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.user(\"newuser\")" );
equal ( url.password ( "newpassword" ).url ( ).toString ( ), "http://newuser:newpassword@www.newexample.com:443/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.password(\"newpassword\")" );
equal ( url.scheme ( "ftp://" ).url ( ).toString ( ), "ftp://newuser:newpassword@www.newexample.com:443/path/file.name?param1=value1¶m2=value2¶m3=value3#newfragment", "url.scheme(\"ftp://\")" );
equal ( url.scheme ( "https://" ).user ( "user" ).password ( "password" ).host ( "www.example.com" ).port("8080").path ( "/" ).query ( { } ).query ( { "param" : "value" } ).fragment ( "#fragment" ).url ( ).toString ( ), "https://user:password@www.example.com:8080/?param=value#fragment", "url.scheme(\"https://\").user(\"user\").password(\"password\").host(\"www.example.com\").port(\"8080\").path(\"/\").query({}).query({\"param\":\"value\"}).fragment(\"#fragment\").url().toString()" );
url.watch(function(element, selector){
deepEqual ( element.jurlp("url") [ 0 ], url.url(), "$.jurlp(url.host()).watch()" );
});
$("body").append("<a href=\""+url.url().toString()+"\"></a>");
// Stop watching for URLs.
url.unwatch ( );
}
);
var getHref = function ( )
{
var url = this.attr ( "href" ) || this.attr ( "src" ) || document.location.href;
if ( url.substring ( 0, 11 ).toLowerCase ( ) == "javascript:" )
{
url = document.location.href;
}
return url;
};
/* Provide a test function to get/set/parse a URL for a given element */
var getTest = function ( type, element, segment )
{
/* New URL to use for modifying the existing URL */
var newUrl =
{
scheme : "https://",
user : "newusername",
password : "newpassword",
host : "www.newexample.com",
port : "90",
path : "/newpath/newfile.name",
query : "?newparam1=newvalue1&newparam2=newvalue2",
fragment : "#newfragment"
};
/* Get the expected URL object for this element and strip its toString() method */
var expected = element.jurlp ( "url" ) [ 0 ];
delete expected.toString;
/* Return the parse/get/set function */
switch ( type )
{
case "set":
{
return function ( g )
{
/* Preserve the existing href segment value */
var oldVal = element.jurlp ( "url" ) [ 0 ].toString ( );
/* Updated the expected value to contain the new segment value */
expected [ segment ] = newUrl [ segment ];
/* Set the href segment for the element */
element.jurlp ( segment, newUrl [ segment ] );
/* If a username was supplied, then set the password too (as this segment cannot be set alone) */
if ( segment == "user" )
{
expected [ "password" ] = newUrl [ "password" ];
element.jurlp ( "password", newUrl [ "password" ] );
}
/* Retrieve the updated element URL object and remove the toString() method */
var a = element.jurlp ( "url" ) [ 0 ];
delete a.toString;
/* Compare the actual and expected URL objects */
deepEqual ( a, expected, g + " URL object (" + segment + ")" );
/* Restore the element href value */
element.jurlp ( "restore" );
/* Ensure the value was restored properly */
equal ( element.jurlp ( "url" ) [ 0 ].toString ( ), oldVal, "Restoring URL" );
};
}
case "get":
{
return function ( g )
{
/* Get the href segment from the element */
var a = element.jurlp ( segment ) [ 0 ];
/* If it is an object, convert it to a string */
if ( typeof a == "object" && a.toString != null )
{
a = a.toString();
}
/* Compare the actual and expected URL segments */
equal ( a, expected [ segment ], g + " URL object (" + segment + ")" );
};
}
case "parse":
{
return function ( g )
{
/* Get the elements href URL object and convert it to a string */
var url = element.jurlp ( "url" ) [ 0 ].toString ( );
/* Compare the actual and expected href values */
equal ( url, getHref.apply ( element ), g + " URL string" );
};
}
default:
{
return function ( ) { };
}
}
}
/*
Test all pase/get/set functionality for the given element.
*/
function testElement ( theExpected )
{
/* Get this element */
var $this = $( this );
/* Create a new array of test functions */
var func = [ ];
/* Get all test functions */
function ourTest ( group, title, testFunction )
{
func.push ( { g : group, t : title, f: testFunction } );
}
/* Get the elements existing href value */
var url = getHref.apply ( $this );
if ( $this.attr ( "href" ) != null && $this.attr ( "href" ).substring ( 0, 11 ).toLowerCase ( ) == "javascript:" )
{
url = $this.attr ( "href" ).substring ( 11 );
}
/* Get parse tests */
ourTest("Parse", url, getTest("parse",$this));
/* Get get tests */
ourTest("Get", "Scheme "+url, getTest("get",$this,"scheme"));
ourTest("Get", "User "+url, getTest("get",$this,"user"));
ourTest("Get", "Password "+url, getTest("get",$this,"password"));
ourTest("Get", "Host "+url, getTest("get",$this,"host"));
ourTest("Get", "Port "+url, getTest("get",$this,"port"));
ourTest("Get", "Path "+url, getTest("get",$this,"path"));
ourTest("Get", "Query "+url, getTest("get",$this,"query"));
ourTest("Get", "Fragment "+url, getTest("get",$this,"fragment"));
/* Get set tests */
ourTest("Set", "Scheme "+url, getTest("set",$this,"scheme"));
if ( $this [ 0 ].tagName != "img" && $this.is ( "[src]" ) == false )
{
ourTest("Set", "User/password "+url, getTest("set",$this,"user"));
}
//ourTest("Set", "Password "+url, getTest("set",$this,"password"));
ourTest("Set", "Host "+url, getTest("set",$this,"host"));
ourTest("Set", "Path "+url, getTest("set",$this,"path"));
ourTest("Set", "Port "+url, getTest("set",$this,"port"));
ourTest("Set", "Query "+url, getTest("set",$this,"query"));
ourTest("Set", "Fragment "+url, getTest("set",$this,"fragment"));
/* Perform all tests */
test
(
url,
function ( )
{
if ( theExpected != 0 )
{
//expect ( theExpected );
}
/* Iterate through all test functions */
for ( var i = 0; i < func.length; i++ )
{
/* Perform the test */
func [ i ].f ( func [ i ].g );
}
}
);
}
/* Perform all standard document tests */
module ( "Document URL" );
$( document ).each ( testElement );
/* Perform standard anchor element tests */
module ( "Anchor URL" );
$( "a.segment-test" ).each ( testElement );
module ( "Image URL" );
$( "img.segment-test" ).each ( testElement );
module ( "Filter URL" );
test($( "#filter-url" ).attr ( "href" ), function (){
var obj = $( "a.filter-test" );
equal ( obj.length, 1, "Got correct length" );
equal ( obj.attr ( "id" ), "filter-url", "Got correct element" );
var result;
// !=
var val = 0;
var operator = "!=";
result = obj.jurlp("filter", "scheme", "!=", "http://");
equal ( result.length, val, "Discovered URLs by scheme (!=)" );
result = obj.jurlp("filter", "host", "!=", "www.example.com");
equal ( result.length, val, "Discovered URLs by host (!=)" );
result = obj.jurlp("filter", "port", "!=", "8080");
equal ( result.length, val, "Discovered URLs by port (!=)" );
result = obj.jurlp("filter", "path", "!=", "/path/file.name");
equal ( result.length, val, "Discovered URLs by path (!=)" );
result = obj.jurlp("filter", "query", "!=", "?param1=value1¶m2=value2¶m3=value3");
equal ( result.length, val, "Discovered URLs by query (!=)" );
result = obj.jurlp("filter", "fragment", "!=", "#fragment");
equal ( result.length, val, "Discovered URLs by fragment (!=)" );
/* Find element */
// ==
result = obj.jurlp("filter", "host", "==", "www.example.com");
equal ( result.length, 1, "Discovered URLs by host (==)" );
// !=
result = obj.jurlp("filter", "host", "!=", "www.notexample.com");
equal ( result.length, 1, "Discovered URLs by host (!=)" );
// ^=
result = obj.jurlp("filter", "host", "^=", "w");
equal ( result.length, 1, "Discovered URLs by host (^=)" );
// $=
result = obj.jurlp("filter", "host", "$=", "m");
equal ( result.length, 1, "Discovered URLs by host ($=)" );
// *=
result = obj.jurlp("filter", "host", "*=", "ww.example.co");
equal ( result.length, 1, "Discovered URLs by host (*=)" );
// <
result = obj.jurlp("filter", "port", "<", "9999");
equal ( result.length, 1, "Discovered URLs by port (<)" );
// <=
result = obj.jurlp("filter", "port", "<=", "8081");
equal ( result.length, 1, "Discovered URLs by port (<=)" );
// >
result = obj.jurlp("filter", "port", ">", "8079");
equal ( result.length, 1, "Discovered URLs by port (>)" );
// <=
result = obj.jurlp("filter", "port", ">=", "8080");
equal ( result.length, 1, "Discovered URLs by port (>=)" );
// regex
result = obj.jurlp("filter", "host", "regex", /(www)/);
equal ( result.length, 1, "Discovered URLs by host (regex)" );
/* Fail to find element */
// ==
result = obj.jurlp("filter", "host", "==", "www.example1.com");
equal ( result.length, 0, "Discovered URLs by host (==)" );
// !=
result = obj.jurlp("filter", "host", "!=", "www.example1.com");
equal ( result.length, 1, "Discovered URLs by host (!=)" );
// ^=
result = obj.jurlp("filter", "host", "^=", "x");
equal ( result.length, 0, "Discovered URLs by host (^=)" );
// $=
result = obj.jurlp("filter", "host", "$=", "n");
equal ( result.length, 0, "Discovered URLs by host ($=)" );
// *=
result = obj.jurlp("filter", "host", "*=", "ww.example1.co");
equal ( result.length, 0, "Discovered URLs by host (*=)" );
// <
result = obj.jurlp("filter", "port", "<", "8079");
equal ( result.length, 0, "Discovered URLs by port (<)" );
// <=
result = obj.jurlp("filter", "port", "<=", "8079");
equal ( result.length, 0, "Discovered URLs by port (<=)" );
// >
result = obj.jurlp("filter", "port", ">", "8081");
equal ( result.length, 0, "Discovered URLs by port (>)" );
// <=
result = obj.jurlp("filter", "port", ">=", "8081");
equal ( result.length, 0, "Discovered URLs by port (>=)" );
// regex
result = obj.jurlp("filter", "host", "regex", /(wwww)/);
equal ( result.length, 0, "Discovered URLs by host (regex)" );
});
module ( "Watch single element with filter" );
test
(
"div.watch-test",
function ( )
{
$("div.watch-test a:not(example)").jurlp
(
"watch",
function ( element )
{
equal ( true, true, "Found element" );
equal ( element.jurlp ( "url" ).toString(), "http://www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment", "Found element URL" );
}
).jurlp ( "filter", "host", "=", "www.example.com" );
$( ".watch-test" ).append ( "<a href='http://www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment'></a>" );
}
);
module ( "Watch multiple elements with filter/modifications" );
test
(
"div.watch-test",
function ( )
{
$("div.watch-test a:not(example1)").jurlp
(
"watch",
function ( element )
{
equal ( true, true, "Found element 1" );
equal ( element.jurlp ( "url" ).toString(), "https://www.newexample.com:8080/path/newfile.name?param1=value1¶m2=value2¶m3=value3#fragment", "Found element 1 URL" );
}
).jurlp ( "filter", "host", "=", "www.example1.com" ).jurlp ( "scheme", "https://" ).jurlp ( "host", "www.newexample.com" ).jurlp ( "path", "../newfile.name" );
$("div.watch-test a:not(example2)").jurlp
(
"watch",
function ( element )
{
equal ( true, true, "Found element 2" );
equal ( element.jurlp ( "url" ).toString(), "http://www.example2.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment", "Found element 2 URL" );
}
).jurlp ( "filter", "host", "=", "www.example2.com" );
$( ".watch-test" ).append ( "<a href='http://www.example1.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment'></a>" );
$( ".watch-test" ).append ( "<a href='http://www.example2.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment'></a>" );
$( "div.watch-test a:not(example1)" ).jurlp ( "unwatch" );
$( ".watch-test" ).append ( "<a id=\"unwatched\" href='http://www.example1.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment'></a>" );
equal ( $( ".watch-test a#unwatched" ).attr ( "href" ), "http://www.example1.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment", "Unwatched URL" );
}
);
module ( "Find URLs in text" );
test
(
"div.text-test",
function ( )
{
var elements = $( "div.text-test" ).jurlp ( );
//console.log ( elements );
//console.log ( $( "div.text-test" ).html ( ) );
equal ( $( "div.text-test" ).html ( ), $( "div.text-test-result" ).html ( ), "Element HTML" );
}
);
module ( "Anchor JavaScript" );
test
(
$( ".javascript-test" ).attr ( "href" ),
function ( )
{
var urlObject = $( ".javascript-test" ).jurlp ( "url" ) [ 0 ];
equal ( urlObject.toString ( ), $( ".javascript-test" ).attr ( "href" ), "jurlp(\"url\").toString()" );
delete urlObject.javascript;
delete urlObject.toString;
var expectedUrlObject = $.jurlp(document.location.href).url();
delete expectedUrlObject.toString;
deepEqual ( urlObject, expectedUrlObject, "URL string" );
}
);
module ( "Anchor Mailto" );
test
(
$( ".mailto-test" ).attr ( "href" ),
function ( )
{
var urlObject = $( ".mailto-test" ).jurlp ( "url" ) [ 0 ];
equal ( urlObject.toString ( ), $( ".mailto-test" ).attr ( "href" ), "jurlp(\"url\").toString()" );
$( ".mailto-test" ).jurlp ( "user", "newuser" );
equal ( $( ".mailto-test" ).attr ( "href" ), "mailto:newuser@example.com?subject=Subject&body=Body", "jurlp(\"user\",\"newuser\")" );
$( ".mailto-test" ).jurlp ( "host", "newexample.com" );
equal ( $( ".mailto-test" ).attr ( "href" ), "mailto:newuser@newexample.com?subject=Subject&body=Body", "jurlp(\"host\",\"newexample.com\")" );
$( ".mailto-test" ).jurlp ( "query", { subject : "New%20subject", body : "New%20body" } );
equal ( $( ".mailto-test" ).attr ( "href" ), "mailto:newuser@newexample.com?subject=New%20subject&body=New%20body", "jurlp(\"query\",{subject:\"New subject\",body:\"New body\"})" );
}
);
}
);
</script>
</head>
<body>
<h1 id="qunit-header">Jurlp QUnit test suite</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">
<!-- URLs for testing parse/get/set on anchor elements -->
<a id="url1" class="segment-test" href="http://www.example.com/"></a>
<a id="url2" class="segment-test" href="http://www.example.com:8080/"></a>
<a id="url3" class="segment-test" href="http://www.example.com:8080/path/file.name"></a>
<a id="url4" class="segment-test" href="http://www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3"></a>
<a id="url5" class="segment-test" href="http://www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment"></a>
<a id="url6" class="segment-test" href="http://www.example.com:8080/path/file.name#fragment"></a>
<a id="url7" class="segment-test" href="http://www.example.com:8080/?param1=value1¶m2=value2¶m3=value3#fragment"></a>
<a id="url8" class="segment-test" href="http://www.example.com:8080/?param1=value1¶m2=value2¶m3=value3"></a>
<a id="url9" class="segment-test" href="http://www.example.com/"></a>
<a id="url10" class="segment-test" href="http://www.example.com/path/file.name"></a>
<a id="url11" class="segment-test" href="http://www.example.com/path/file.name?param1=value1¶m2=value2¶m3=value3"></a>
<a id="url12" class="segment-test" href="http://www.example.com/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment"></a>
<a id="url13" class="segment-test" href="http://www.example.com/path/file.name#fragment"></a>
<a id="url14" class="segment-test" href="http://www.example.com/?param1=value1¶m2=value2¶m3=value3#fragment"></a>
<a id="url15" class="segment-test" href="http://www.example.com/?param1=value1¶m2=value2¶m3=value3"></a>
<img id="url16" class="segment-test" src="http://www.example.com/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment"/>
<!-- Contains username/password -->
<a id="url17" class="segment-test" href="http://user:password@www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment"></a>
<!-- Contains JavaScript href attribute -->
<a id="url18" class="javascript-test" href="javascript: alert('JavaScript in the href attribute')"></a>
<!-- Contains mailto href attribute -->
<a id="url19" class="mailto-test" href="mailto:user@example.com?subject=Subject&body=Body"></a>
<!-- URL for testing filtering -->
<a id="filter-url" class="filter-test" href="http://www.example.com:8080/path/file.name?param1=value1¶m2=value2¶m3=value3#fragment"></a>
<!-- Container to populate with URLs for the watch test -->
<div class="watch-test"></div>
<!-- Container of arbitrary text containing URLs to convert to anchors for the initialise text test -->
<div class="text-test">
This is text within a div.
<p>
Here is a paragraph of text. It also contains a link to www.example.com.
</p>
This is more text within the div, with a link to www.example2.com.
<p>
<a href="http://www.shouldnotbemodified.com/">www.shouldnotbemodified.com</a>
<img src="http://www.shouldnotbemodified.com/" />
http://www.example.com/
http://www.example.com:8080/
http://www.example.com:8080/path/file.name
http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3
http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3#fragment
http://www.example.com:8080/path/file.name#fragment
http://www.example.com:8080/?param1=value1&param2=value2&param3=value3#fragment
http://www.example.com:8080/?param1=value1&param2=value2&param3=value3
url.com
url-with-dashes.com
www.urlwithprefix.com
127.0.0.1/url.php
http://192.168.0.1
ftp://url.com/path/name/
ftp://user:pass@url.com/path/name/
view-source://url.com/#fragment
http://url.com/#fragment
http://url.com/?query=string&other=value
http://user:pass@url.com/?query=string&other=value
https://user:pass@url.com/?query=string&other=value#fragment
spotify:hepp:happ
skype:hepp:happ
mailto:hepp@happ.com?subject=some%20value
irc://irc.homelien.no
</p>
And a final URL http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3#fragment on the end.
</div>
<div class="text-test-result">
This is text within a div.
<p>
Here is a paragraph of text. It also contains a link to <a href="http://www.example.com/" class="jurlp-no-watch">www.example.com</a>.
</p>
This is more text within the div, with a link to <a href="http://www.example2.com/" class="jurlp-no-watch">www.example2.com</a>.
<p>
<a href="http://www.shouldnotbemodified.com/">www.shouldnotbemodified.com</a>
<img src="http://www.shouldnotbemodified.com/">
<a href="http://www.example.com/" class="jurlp-no-watch">http://www.example.com/</a>
<a href="http://www.example.com:8080/" class="jurlp-no-watch">http://www.example.com:8080/</a>
<a href="http://www.example.com:8080/path/file.name" class="jurlp-no-watch">http://www.example.com:8080/path/file.name</a>
<a href="http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3" class="jurlp-no-watch">http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3</a>
<a href="http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3#fragment" class="jurlp-no-watch">http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3#fragment</a>
<a href="http://www.example.com:8080/path/file.name#fragment" class="jurlp-no-watch">http://www.example.com:8080/path/file.name#fragment</a>
<a href="http://www.example.com:8080/?param1=value1&param2=value2&param3=value3#fragment" class="jurlp-no-watch">http://www.example.com:8080/?param1=value1&param2=value2&param3=value3#fragment</a>
<a href="http://www.example.com:8080/?param1=value1&param2=value2&param3=value3" class="jurlp-no-watch">http://www.example.com:8080/?param1=value1&param2=value2&param3=value3</a>
<a href="http://url.com/" class="jurlp-no-watch">url.com</a>
<a href="http://url-with-dashes.com/" class="jurlp-no-watch">url-with-dashes.com</a>
<a href="http://www.urlwithprefix.com/" class="jurlp-no-watch">www.urlwithprefix.com</a>
<a href="http://127.0.0.1/url.php" class="jurlp-no-watch">127.0.0.1/url.php</a>
<a href="http://192.168.0.1/" class="jurlp-no-watch">http://192.168.0.1</a>
<a href="ftp://url.com/path/name/" class="jurlp-no-watch">ftp://url.com/path/name/</a>
<a href="ftp://user:pass@url.com/path/name/" class="jurlp-no-watch">ftp://user:pass@url.com/path/name/</a>
<a href="view-source://url.com/#fragment" class="jurlp-no-watch">view-source://url.com/#fragment</a>
<a href="http://url.com/#fragment" class="jurlp-no-watch">http://url.com/#fragment</a>
<a href="http://url.com/?query=string&other=value" class="jurlp-no-watch">http://url.com/?query=string&other=value</a>
<a href="http://user:pass@url.com/?query=string&other=value" class="jurlp-no-watch">http://user:pass@url.com/?query=string&other=value</a>
<a href="https://user:pass@url.com/?query=string&other=value#fragment" class="jurlp-no-watch">https://user:pass@url.com/?query=string&other=value#fragment</a>
<a href="spotify:hepp:happ" class="jurlp-no-watch">spotify:hepp:happ</a>
<a href="skype:hepp:happ" class="jurlp-no-watch">skype:hepp:happ</a>
<a href="mailto:hepp@happ.com?subject=some%20value" class="jurlp-no-watch">mailto:hepp@happ.com?subject=some%20value</a>
<a href="irc://irc.homelien.no/" class="jurlp-no-watch">irc://irc.homelien.no</a>
</p>
And a final URL <a href="http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3#fragment" class="jurlp-no-watch">http://www.example.com:8080/path/file.name?param1=value1&param2=value2&param3=value3#fragment</a> on the end.
</div>
</div>
</body>
</html>