| | 149 | parseHash: function(){ |
| | 150 | var hash = window.location.hash; |
| | 151 | if (hash == "") { |
| | 152 | return; |
| | 153 | } |
| | 154 | var tab = hash.replace('#', '').split('_'); |
| | 155 | var observerId = tab[0]; |
| | 156 | var sectionId = tab[1]; |
| | 157 | var uriId = tab[2]; |
| | 158 | var messageId = tab[3]; |
| | 159 | |
| | 160 | var scroller = new Fx.Scroll(document, {duration: 0}); |
| | 161 | |
| | 162 | var observerIndex = W3C.Observers.getProperty('id').indexOf(observerId); |
| | 163 | if (observerIndex == -1) { |
| | 164 | W3C.setHash(''); |
| | 165 | return; |
| | 166 | } |
| | 167 | var observer = W3C.Observers[observerIndex]; |
| | 168 | W3C.closeAllObserversBut(observer, false); |
| | 169 | |
| | 170 | if (!sectionId) { |
| | 171 | scroller.toElement(observer); |
| | 172 | return; |
| | 173 | } |
| | 174 | var sectionIndex = observer.getElements('.section').getProperty('id').indexOf(observerId + '_' + sectionId); |
| | 175 | if (sectionIndex == -1) { |
| | 176 | W3C.setHash(observerId); |
| | 177 | return; |
| | 178 | } |
| | 179 | var section = observer.getElements('.section')[sectionIndex]; |
| | 180 | W3C.closeAllSectionsBut(observer, section, false); |
| | 181 | |
| | 182 | |
| | 183 | if (!uriId) { |
| | 184 | scroller.toElement(observer); |
| | 185 | return; |
| | 186 | } |
| | 187 | var uriIndex = section.getElements('td.uri').getProperty('id').indexOf(observerId + '_' + sectionId + '_' + uriId); |
| | 188 | if (uriIndex == -1) { |
| | 189 | W3C.setHash(observerId + '_' + sectionId); |
| | 190 | return; |
| | 191 | } |
| | 192 | var uriTd = section.getElements('td.uri')[uriIndex]; |
| | 193 | |
| | 194 | if (!messageId) { |
| | 195 | scroller.toElement(uriTd); |
| | 196 | return; |
| | 197 | } |
| | 198 | |
| | 199 | W3C.setHash(hash); |
| | 200 | |
| | 201 | }, |
| | 202 | |
| | 203 | updateHash: function(){ |
| | 204 | var tab = W3C.Forms[W3C.SelectedTab].getProperty('id'); |
| | 205 | var task = '+task_' + W3C.TaskOptions[W3C.SelectedTask].getProperty('value'); |
| | 206 | var withOptions = W3C.WithOptions ? '+with_options' : ''; |
| | 207 | |
| | 208 | W3C.setHash(tab + task + withOptions); |
| | 209 | }, |
| | 210 | |
| | 211 | cleanHash: function(){ |
| | 212 | var hash = window.location.hash; |
| | 213 | if (hash.match('^#validate-by')) |
| | 214 | W3C.setHash(''); |
| | 215 | }, |
| | 216 | |