Index: trunk/extensions/MobileFrontend/javascripts/beta_application.js |
— | — | @@ -1,4 +1,3 @@ |
2 | | -document.body.className = "jsEnabled"; |
3 | 2 | var search = document.getElementById( 'search' ); |
4 | 3 | var clearSearch = document.getElementById( 'clearsearch' ); |
5 | 4 | var results = document.getElementById( 'results' ); |
— | — | @@ -10,8 +9,6 @@ |
11 | 10 | var zeroRatedBanner = document.getElementById( 'zero-rated-banner-red' ); |
12 | 11 | } |
13 | 12 | |
14 | | -initClearSearchLink(); |
15 | | - |
16 | 13 | function initClearSearchLink() { |
17 | 14 | clearSearch.setAttribute( 'title','Clear' ); |
18 | 15 | clearSearch.addEventListener( 'mousedown', clearSearchBox, true ); |
— | — | @@ -19,10 +16,6 @@ |
20 | 17 | search.addEventListener( 'keydown', handleDefaultText, false ); |
21 | 18 | } |
22 | 19 | |
23 | | -search.onpaste = function() { |
24 | | - handleDefaultText(); |
25 | | -}; |
26 | | - |
27 | 20 | function navigateToLanguageSelection() { |
28 | 21 | var url; |
29 | 22 | if ( languageSelection ) { |
— | — | @@ -71,26 +64,48 @@ |
72 | 65 | } |
73 | 66 | }; |
74 | 67 | |
75 | | -for ( var a = document.getElementsByTagName( 'a' ), i = 0; i < a.length; i++ ) { |
76 | | - a[i].onclick = function() { |
77 | | - if ( this.hash.indexOf( '#' ) == 0 ) { |
78 | | - wm_reveal_for_hash( this.hash ); |
| 68 | +function init() { |
| 69 | + document.body.className = "jsEnabled"; |
| 70 | + initClearSearchLink(); |
| 71 | + search.onpaste = function() { |
| 72 | + handleDefaultText(); |
| 73 | + }; |
| 74 | + document.getElementById( 'logo' ).addEventListener( 'click', logoClick ); |
| 75 | + var dismissNotification = document.getElementById( 'dismiss-notification' ); |
| 76 | + |
| 77 | + if ( dismissNotification ) { |
| 78 | + var cookieNameZeroVisibility = 'zeroRatedBannerVisibility'; |
| 79 | + var zeroRatedBanner = document.getElementById( 'zero-rated-banner' ); |
| 80 | + var zeroRatedBannerVisibility = readCookie( cookieNameZeroVisibility ); |
| 81 | + |
| 82 | + if ( zeroRatedBannerVisibility === 'off' ) { |
| 83 | + zeroRatedBanner.style.display = 'none'; |
79 | 84 | } |
| 85 | + |
| 86 | + dismissNotification.onclick = function() { |
| 87 | + if ( zeroRatedBanner ) { |
| 88 | + zeroRatedBanner.style.display = 'none'; |
| 89 | + writeCookie( cookieNameZeroVisibility, 'off', 1 ); |
| 90 | + } |
| 91 | + }; |
80 | 92 | } |
81 | | -} |
| 93 | + if ( document.location.hash.indexOf( '#' ) == 0 ) { |
| 94 | + wm_reveal_for_hash( document.location.hash ); |
| 95 | + } |
82 | 96 | |
83 | | -function init() { |
84 | | - document.getElementById( 'logo' ).addEventListener( 'click', logoClick ); |
| 97 | + for ( var a = document.getElementsByTagName( 'a' ), i = 0; i < a.length; i++ ) { |
| 98 | + a[i].onclick = function() { |
| 99 | + if ( this.hash.indexOf( '#' ) == 0 ) { |
| 100 | + wm_reveal_for_hash( this.hash ); |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + |
| 105 | + // Try to scroll and hide URL bar |
| 106 | + window.scrollTo( 0, 1 ); |
85 | 107 | } |
86 | 108 | init(); |
87 | 109 | |
88 | | -if ( document.location.hash.indexOf( '#' ) == 0 ) { |
89 | | - wm_reveal_for_hash( document.location.hash ); |
90 | | -} |
91 | | - |
92 | | -// Try to scroll and hide URL bar |
93 | | -window.scrollTo( 0, 1 ); |
94 | | - |
95 | 110 | function wm_reveal_for_hash( hash ) { |
96 | 111 | var targetel = document.getElementById( hash.substr(1) ); |
97 | 112 | if ( targetel ) { |
— | — | @@ -150,22 +165,3 @@ |
151 | 166 | writeCookie( name, '', -1 ); |
152 | 167 | return null; |
153 | 168 | } |
154 | | - |
155 | | -var dismissNotification = document.getElementById( 'dismiss-notification' ); |
156 | | - |
157 | | -if ( dismissNotification ) { |
158 | | - var cookieNameZeroVisibility = 'zeroRatedBannerVisibility'; |
159 | | - var zeroRatedBanner = document.getElementById( 'zero-rated-banner' ); |
160 | | - var zeroRatedBannerVisibility = readCookie( cookieNameZeroVisibility ); |
161 | | - |
162 | | - if ( zeroRatedBannerVisibility === 'off' ) { |
163 | | - zeroRatedBanner.style.display = 'none'; |
164 | | - } |
165 | | - |
166 | | - dismissNotification.onclick = function() { |
167 | | - if ( zeroRatedBanner ) { |
168 | | - zeroRatedBanner.style.display = 'none'; |
169 | | - writeCookie( cookieNameZeroVisibility, 'off', 1 ); |
170 | | - } |
171 | | - }; |
172 | | -} |
\ No newline at end of file |
Index: trunk/extensions/MobileFrontend/javascripts/application.js |
— | — | @@ -1,11 +1,8 @@ |
2 | | -document.body.className = "jsEnabled"; |
3 | 2 | var search = document.getElementById( 'search' ); |
4 | 3 | var clearSearch = document.getElementById( 'clearsearch' ); |
5 | 4 | var results = document.getElementById( 'results' ); |
6 | 5 | var languageSelection = document.getElementById( 'languageselection' ); |
7 | 6 | |
8 | | -initClearSearchLink(); |
9 | | - |
10 | 7 | function initClearSearchLink() { |
11 | 8 | clearSearch.setAttribute( 'title','Clear' ); |
12 | 9 | clearSearch.addEventListener( 'mousedown', clearSearchBox, true ); |
— | — | @@ -59,27 +56,45 @@ |
60 | 57 | } |
61 | 58 | }; |
62 | 59 | |
63 | | -// And this... |
64 | | -for ( var a = document.getElementsByTagName( 'a' ), i = 0; i < a.length; i++ ) { |
65 | | - a[i].onclick = function() { |
66 | | - if ( this.hash.indexOf( '#' ) == 0 ) { |
67 | | - wm_reveal_for_hash( this.hash ); |
| 60 | +function init() { |
| 61 | + document.body.className = "jsEnabled"; |
| 62 | + initClearSearchLink(); |
| 63 | + document.getElementById( 'logo' ).addEventListener( 'click', logoClick ); |
| 64 | + var dismissNotification = document.getElementById( 'dismiss-notification' ); |
| 65 | + |
| 66 | + if ( dismissNotification ) { |
| 67 | + var cookieNameZeroVisibility = 'zeroRatedBannerVisibility'; |
| 68 | + var zeroRatedBanner = document.getElementById( 'zero-rated-banner' ); |
| 69 | + var zeroRatedBannerVisibility = readCookie( cookieNameZeroVisibility ); |
| 70 | + |
| 71 | + if ( zeroRatedBannerVisibility === 'off' ) { |
| 72 | + zeroRatedBanner.style.display = 'none'; |
68 | 73 | } |
| 74 | + |
| 75 | + dismissNotification.onclick = function() { |
| 76 | + if ( zeroRatedBanner ) { |
| 77 | + zeroRatedBanner.style.display = 'none'; |
| 78 | + writeCookie( cookieNameZeroVisibility, 'off', 1 ); |
| 79 | + } |
| 80 | + }; |
69 | 81 | } |
70 | | -} |
| 82 | + if ( document.location.hash.indexOf( '#' ) == 0 ) { |
| 83 | + wm_reveal_for_hash( document.location.hash ); |
| 84 | + } |
71 | 85 | |
72 | | -function init() { |
73 | | - document.getElementById( 'logo' ).addEventListener( 'click', logoClick ); |
| 86 | + for ( var a = document.getElementsByTagName( 'a' ), i = 0; i < a.length; i++ ) { |
| 87 | + a[i].onclick = function() { |
| 88 | + if ( this.hash.indexOf( '#' ) == 0 ) { |
| 89 | + wm_reveal_for_hash( this.hash ); |
| 90 | + } |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + // Try to scroll and hide URL bar |
| 95 | + window.scrollTo( 0, 1 ); |
74 | 96 | } |
75 | 97 | init(); |
76 | 98 | |
77 | | -if ( document.location.hash.indexOf( '#' ) == 0 ) { |
78 | | - wm_reveal_for_hash( document.location.hash ); |
79 | | -} |
80 | | - |
81 | | -// Try to scroll and hide URL bar |
82 | | -window.scrollTo( 0, 1 ); |
83 | | - |
84 | 99 | function wm_reveal_for_hash( hash ) { |
85 | 100 | var targetel = document.getElementById( hash.substr(1) ); |
86 | 101 | if ( targetel ) { |
— | — | @@ -139,22 +154,3 @@ |
140 | 155 | writeCookie( name, '', -1 ); |
141 | 156 | return null; |
142 | 157 | } |
143 | | - |
144 | | -var dismissNotification = document.getElementById( 'dismiss-notification' ); |
145 | | - |
146 | | -if ( dismissNotification ) { |
147 | | - var cookieNameZeroVisibility = 'zeroRatedBannerVisibility'; |
148 | | - var zeroRatedBanner = document.getElementById( 'zero-rated-banner' ); |
149 | | - var zeroRatedBannerVisibility = readCookie( cookieNameZeroVisibility ); |
150 | | - |
151 | | - if ( zeroRatedBannerVisibility === 'off' ) { |
152 | | - zeroRatedBanner.style.display = 'none'; |
153 | | - } |
154 | | - |
155 | | - dismissNotification.onclick = function() { |
156 | | - if ( zeroRatedBanner ) { |
157 | | - zeroRatedBanner.style.display = 'none'; |
158 | | - writeCookie( cookieNameZeroVisibility, 'off', 1 ); |
159 | | - } |
160 | | - }; |
161 | | -} |
\ No newline at end of file |