Skip to content

Commit

Permalink
fix hash check to look for any groups in the url. also adjust the way…
Browse files Browse the repository at this point in the history
… prev_anchor is set to avoid bugs related to hitting back/forward on files in a group
  • Loading branch information
justinsteele committed Jan 30, 2015
1 parent 2a2d4b8 commit 5b364d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ $(document).ready(function() {
width: "95%",
height: "95%",
onLoad: function() {
if (prev_anchor) {
prev_anchor = jQuery.url.attr('anchor');
}
prev_anchor = curr_anchor ? curr_anchor : jQuery.url.attr('anchor');
curr_anchor = this.href.split('#')[1];
window.location.hash = curr_anchor;
},
Expand All @@ -65,8 +63,9 @@ $(document).ready(function() {
});

window.onpopstate = function(event){
if (location.hash == "#_AllFiles") {
if (location.hash.substring(0,2) == "#_") {
$.colorbox.close();
curr_anchor = jQuery.url.attr('anchor');
} else {
if ($('#colorbox').is(':hidden')) {
$('a.src_link[href="'+location.hash+'"]').colorbox({ open: true });
Expand Down
7 changes: 3 additions & 4 deletions public/application.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b364d9

Please sign in to comment.