1
1
2
- /* URI */
2
+ /* Configuration */
3
+
3
4
4
- var check_phrase = "Enter a http:// URI to check" ;
5
- if ( redbot_uri ) {
6
- $ ( "#uri" ) . val ( redbot_uri ) ;
7
- } else if ( ! $ ( "#uri" ) . val ( ) ) {
8
- $ ( "#uri" ) . val ( check_phrase ) ;
9
- $ ( "#uri" ) . css ( { 'color' : '#ccc' } ) ;
5
+
6
+ function get_config ( ) {
7
+ var scripts = document . getElementsByTagName ( 'script' ) ;
8
+ var myScript = scripts [ scripts . length - 1 ] ;
9
+ var frag = unescape ( myScript . src . replace ( / ^ [ ^ \# ] + \# ? / , '' ) ) ;
10
+ return jQuery . parseJSON ( frag ) ;
10
11
}
12
+ var config = get_config ( ) ;
11
13
12
- $ ( "#uri" ) . focus ( function ( ) {
13
- if ( $ ( this ) . val ( ) == check_phrase ) {
14
- $ ( this ) . val ( "" ) ;
15
- $ ( "#uri" ) . css ( { 'color' : '#111' } ) ;
16
- }
17
- } ) ;
14
+ /* URI */
18
15
19
- /* catch enter to work around IE8 */
20
- $ ( "input" ) . keypress ( function ( e ) {
21
- if ( e . which == 13 ) {
22
- $ ( "#request_form" ) . submit ( ) ;
23
- }
24
- } ) ;
25
-
26
-
27
- /* single response display */
28
-
29
- var hidden_list = $ ( "#hidden_list" ) ;
30
-
31
- $ ( "span.hdr" ) . hoverPopup (
32
- function ( e ) {
33
- var name = $ ( this ) . attr ( 'name' ) ;
34
- return $ ( "li#" + name , hidden_list ) . html ( ) ;
35
- } ,
36
- function ( e ) {
37
- var name = $ ( this ) . attr ( 'name' ) ;
38
- $ ( "span." + name ) . css ( { "font-weight" : "bold" , "color" : "white" } ) ;
39
- $ ( "li.msg:not(." + name + ")" ) . fadeTo ( 100 , 0.15 ) ;
40
- $ ( "li.msg." + name ) . fadeTo ( 50 , 1.0 ) ;
41
- } ,
42
- function ( e ) {
43
- var name = $ ( this ) . attr ( 'name' ) ;
44
- $ ( "span." + name ) . css ( { "font-weight" : "normal" , "color" : "#ddd" } ) ;
45
- $ ( "li.msg" ) . fadeTo ( 100 , 1.0 ) ;
16
+ $ ( document ) . ready ( function ( ) {
17
+
18
+ var check_phrase = "Enter a http:// URI to check" ;
19
+ if ( config . redbot_uri ) {
20
+ $ ( "#uri" ) . val ( config . redbot_uri ) ;
21
+ } else if ( ! $ ( "#uri" ) . val ( ) ) {
22
+ $ ( "#uri" ) . val ( check_phrase ) ;
23
+ $ ( "#uri" ) . css ( { 'color' : '#ccc' } ) ;
46
24
}
47
- ) ;
48
-
49
- $ ( "li.msg span" ) . hoverPopup (
50
- function ( e ) {
51
- return $ ( "li#" + $ ( this ) . parent ( ) . attr ( 'name' ) , hidden_list ) . html ( ) ;
52
- } ,
53
- function ( e ) {
54
- var classes = $ ( this ) . parent ( ) . attr ( "class" ) . split ( " " ) ;
55
- for ( var i = 0 ; i < classes . length ; i ++ ) {
56
- var c = classes [ i ] ;
57
- $ ( "span.hdr[name='" + c + "']" )
58
- . css ( { "font-weight" : "bold" , "color" : "white" } ) ;
25
+
26
+ $ ( "#uri" ) . focus ( function ( ) {
27
+ if ( $ ( this ) . val ( ) == check_phrase ) {
28
+ $ ( this ) . val ( "" ) ;
29
+ $ ( "#uri" ) . css ( { 'color' : '#111' } ) ;
59
30
}
60
- } ,
61
- function ( e ) {
62
- var classes = $ ( this ) . parent ( ) . attr ( "class" ) . split ( " " ) ;
63
- for ( var i = 0 ; i < classes . length ; i ++ ) {
64
- var c = classes [ i ] ;
65
- $ ( "span.hdr[name='" + c + "']" )
66
- . css ( { "font-weight" : "normal" , "color" : "#ddd" } ) ;
31
+ } ) ;
32
+
33
+ /* catch enter to work around IE8 */
34
+ $ ( "input" ) . keypress ( function ( e ) {
35
+ if ( e . which == 13 ) {
36
+ $ ( "#request_form" ) . submit ( ) ;
67
37
}
68
- }
69
- ) ;
38
+ } ) ;
70
39
71
- $ ( "h3" ) . click ( function ( ) {
72
- $ ( this ) . next ( ) . slideToggle ( "normal" ) ;
73
- } ) ;
74
40
75
- $ ( "#body_view" ) . toggle ( function ( ) {
76
- $ ( "#details" ) . fadeOut ( 'fast' , function ( ) {
77
- $ ( "#body" ) . fadeIn ( 'fast' ) ;
78
- prettyPrint ( ) ;
79
- $ ( "#body_view" ) . text ( "show messages" ) ;
41
+ /* single response display */
42
+
43
+ var hidden_list = $ ( "#hidden_list" ) ;
44
+
45
+ $ ( "span.hdr" ) . hoverPopup (
46
+ function ( e ) {
47
+ var name = $ ( this ) . attr ( 'name' ) ;
48
+ return $ ( "li#" + name , hidden_list ) . html ( ) ;
49
+ } ,
50
+ function ( e ) {
51
+ var name = $ ( this ) . attr ( 'name' ) ;
52
+ $ ( "span." + name ) . css ( { "font-weight" : "bold" , "color" : "white" } ) ;
53
+ $ ( "li.msg:not(." + name + ")" ) . fadeTo ( 100 , 0.15 ) ;
54
+ $ ( "li.msg." + name ) . fadeTo ( 50 , 1.0 ) ;
55
+ } ,
56
+ function ( e ) {
57
+ var name = $ ( this ) . attr ( 'name' ) ;
58
+ $ ( "span." + name ) . css ( { "font-weight" : "normal" , "color" : "#ddd" } ) ;
59
+ $ ( "li.msg" ) . fadeTo ( 100 , 1.0 ) ;
60
+ }
61
+ ) ;
62
+
63
+ $ ( "li.msg span" ) . hoverPopup (
64
+ function ( e ) {
65
+ return $ ( "li#" + $ ( this ) . parent ( ) . attr ( 'name' ) , hidden_list ) . html ( ) ;
66
+ } ,
67
+ function ( e ) {
68
+ var classes = $ ( this ) . parent ( ) . attr ( "class" ) . split ( " " ) ;
69
+ for ( var i = 0 ; i < classes . length ; i ++ ) {
70
+ var c = classes [ i ] ;
71
+ $ ( "span.hdr[name='" + c + "']" )
72
+ . css ( { "font-weight" : "bold" , "color" : "white" } ) ;
73
+ }
74
+ } ,
75
+ function ( e ) {
76
+ var classes = $ ( this ) . parent ( ) . attr ( "class" ) . split ( " " ) ;
77
+ for ( var i = 0 ; i < classes . length ; i ++ ) {
78
+ var c = classes [ i ] ;
79
+ $ ( "span.hdr[name='" + c + "']" )
80
+ . css ( { "font-weight" : "normal" , "color" : "#ddd" } ) ;
81
+ }
82
+ }
83
+ ) ;
84
+
85
+ $ ( "h3" ) . click ( function ( ) {
86
+ $ ( this ) . next ( ) . slideToggle ( "normal" ) ;
80
87
} ) ;
81
- return false ;
82
- } , function ( ) {
83
- $ ( "#body" ) . fadeOut ( 'fast' , function ( ) {
84
- $ ( "#details" ) . fadeIn ( 'fast' ) ;
85
- $ ( "#body_view" ) . text ( "show body" ) ;
88
+
89
+ $ ( "#body_view" ) . toggle ( function ( ) {
90
+ $ ( "#details" ) . fadeOut ( 'fast' , function ( ) {
91
+ $ ( "#body" ) . fadeIn ( 'fast' ) ;
92
+ prettyPrint ( ) ;
93
+ $ ( "#body_view" ) . text ( "show messages" ) ;
94
+ } ) ;
95
+ return false ;
96
+ } , function ( ) {
97
+ $ ( "#body" ) . fadeOut ( 'fast' , function ( ) {
98
+ $ ( "#details" ) . fadeIn ( 'fast' ) ;
99
+ $ ( "#body_view" ) . text ( "show body" ) ;
100
+ } ) ;
101
+ return false ;
86
102
} ) ;
87
- return false ;
88
- } ) ;
89
103
90
- $ ( "#save" ) . click ( function ( ) {
91
- $ ( "#save_form" ) . submit ( ) ;
92
- } )
104
+ $ ( "#save" ) . click ( function ( ) {
105
+ $ ( "#save_form" ) . submit ( ) ;
106
+ } )
93
107
94
108
95
- /* multiple result display */
109
+ /* multiple result display */
96
110
97
- $ ( "tr.droid" ) . hoverIntent ( function ( ) {
98
- var classes = this . className . split ( " " ) ;
99
- $ ( "li.msg" ) . fadeTo ( 100 , 0.15 ) ;
100
- for ( var i = 0 ; i < classes . length ; i ++ ) {
101
- var c = classes [ i ] ;
102
- if ( c != 'droid' ) {
103
- $ ( "li.msg:eq(" + c + ")" ) . fadeTo ( 50 , 1.0 ) ;
111
+ $ ( "tr.droid" ) . hoverIntent ( function ( ) {
112
+ var classes = this . className . split ( " " ) ;
113
+ $ ( "li.msg" ) . fadeTo ( 100 , 0.15 ) ;
114
+ for ( var i = 0 ; i < classes . length ; i ++ ) {
115
+ var c = classes [ i ] ;
116
+ if ( c != 'droid' ) {
117
+ $ ( "li.msg:eq(" + c + ")" ) . fadeTo ( 50 , 1.0 ) ;
118
+ }
104
119
}
105
- }
106
- if ( tid != false ) {
107
- clearTimeout ( tid ) ;
108
- tid = false ;
109
- }
110
- } , function ( ) {
111
- tid = setTimeout ( function ( ) {
112
- $ ( "li.msg" ) . fadeTo ( 50 , 1.0 ) ;
113
- } , 100 ) ;
114
- } ) ;
115
-
116
- $ ( "span.prob_num" ) . hoverPopup ( function ( e ) {
117
- return $ ( this ) . children ( ".hidden" ) . html ( ) ;
118
- } ) ;
119
-
120
- $ ( "a.preview" ) . hoverPopup ( function ( e ) {
121
- var link = ( this . title != "" ) ? this . title : this . href ;
122
- return "<img src='" + link + "'/><br />" + link ;
123
- } ) ;
120
+ if ( tid != false ) {
121
+ clearTimeout ( tid ) ;
122
+ tid = false ;
123
+ }
124
+ } , function ( ) {
125
+ tid = setTimeout ( function ( ) {
126
+ $ ( "li.msg" ) . fadeTo ( 50 , 1.0 ) ;
127
+ } , 100 ) ;
128
+ } ) ;
129
+
130
+ $ ( "span.prob_num" ) . hoverPopup ( function ( e ) {
131
+ return $ ( this ) . children ( ".hidden" ) . html ( ) ;
132
+ } ) ;
133
+
134
+ $ ( "a.preview" ) . hoverPopup ( function ( e ) {
135
+ var link = ( this . title != "" ) ? this . title : this . href ;
136
+ return "<img src='" + link + "'/><br />" + link ;
137
+ } ) ;
138
+
139
+ } ) ;
0 commit comments