Created
December 12, 2012 00:05
-
-
Save mlynch/4263590 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).on "click", "a[href^='/']", (event) -> | |
| href = $(event.currentTarget).attr('href') | |
| # Check if the link matches our route | |
| passThrough = href.indexOf('/dash') != 0 | |
| # Allow shift+click for new tabs, etc. | |
| if !passThrough && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey | |
| event.preventDefault() | |
| # Remove leading slashes and hash bangs (backward compatablility) | |
| url = href.replace(/^\//,'').replace('\#\!\/','') | |
| # Instruct Backbone to trigger routing events | |
| window.Dashboard.router.navigate url, { trigger: true } | |
| return false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment