Fix #197: use URI.js for calculation of relative url

Use bower for client dependencies
This commit is contained in:
Samy Pessé
2014-05-04 15:15:18 +02:00
parent 756629b91d
commit f7fe976c7e
6 changed files with 47 additions and 58 deletions
+4 -4
View File
@@ -1,6 +1,6 @@
define([
"jQuery",
"utils/path",
"utils/url",
"core/events",
"core/state",
"core/search",
@@ -8,15 +8,15 @@ define([
"core/exercise",
"core/quiz",
"core/loading"
], function($, path, events, state, search, progress, exercises, quiz, loading) {
], function($, URL, events, state, search, progress, exercises, quiz, loading) {
var prev, next;
var githubCountStars, githubCountWatch;
var usePushState = (typeof history.pushState !== "undefined");
var handleNavigation = function(relativeUrl, push) {
var url = path.isAbsolute(relativeUrl) ? relativeUrl : path.join(path.dirname(window.location.pathname), relativeUrl);
console.log("navigate to ", url, "baseurl="+relativeUrl);
var url = URL.join(window.location.pathname, relativeUrl);
console.log("navigate to ", url, "baseurl="+relativeUrl, "current="+window.location.pathname);
if (!usePushState) {
// Refresh the page to the new URL if pushState not supported