-
- var lastHash = null;
-
- function checkHash() {
- if (document.location.hash != lastHash) {
- lastHash = document.location.hash;
- var documentLink = $('#document-list a[data-hash=' + document.location.hash + ']');
- if (!documentLink.hasClass('active')) {
- $('#document-list a').removeClass('active');
- documentLink.addClass('active');
- };
-
- if ($('#document-detail').attr('data-hash') != lastHash) {
- $('#document-detail')
- .attr('data-hash', lastHash)
- .load(documentLink.attr('href'));
- };
- } else if (!document.location.hash) {
- $first = $('#document-list a:first');
- $first.addClass('active');
- location.replace($first.attr('data-hash'));
- }
-
- setTimeout(checkHash, 500);
- };
-
- checkHash();