-
- 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) {
- $('#document-list a:first').click();
- }
-
- setTimeout(checkHash, 500);
- };
-
- checkHash();