{"action":"created","comment":{"url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/comments/42221604","id":42221604,"diff_hunk":"@@ -114,58 +93,78 @@ function router (controller, routes, options) {\n \n     wrappedSignal.getUrl = function(payload){\n       var url = getUrl(route, payload);\n-      return options.baseUrl ? options.baseUrl + url : url;\n+      return options.baseUrl + url;\n     };\n \n     return wrappedRoutes;\n \n   }, {});\n \n+  function stripUrl (url){\n+    // Ensure full url before strip :)\n+    // TODO: remove after christianalfoni/addressbar/issues/5 resolved\n+    if (url.indexOf(location.origin) === -1) {\n+      url = location.origin + url;\n+    }\n+\n+    // return stripped url only if it should be routed\n+    if (url.indexOf(location.origin + options.baseUrl) === 0) {\n+      url = url.replace(location.origin + options.baseUrl, '');\n+      return (!options.onlyHash || url.indexOf('/#') === 0) && url;\n+    }\n+  }\n+\n   addressbar.on('change', function (event) {\n \n     if (controller.store.isRemembering()) {\n       return;\n     }\n \n-    if (!options.onlyHash || event.target.value === location.origin + '/' || (options.onlyHash && event.target.value.indexOf('#') >= 0)) {\n+    var url = stripUrl(event.target.value);\n+    if (url) {\n       event.preventDefault();\n-      var url = event.target.value.replace(location.origin, '');\n-      url = options.baseUrl && url.substr(0, options.baseUrl.length) === options.baseUrl ? url.replace(options.baseUrl, '') : url;\n       urlMapper(url, wrappedRoutes);\n     }\n \n   });\n \n-  controller.on('change', function () {\n-    var url = controller.get(urlStorePath) || (options.onlyHash ? '/#/' : '/');\n-    addressbar.value = options.baseUrl ? options.baseUrl + url : url;\n-  });\n+  router.start = router.trigger = function () {","path":"index.js","position":143,"original_position":143,"commit_id":"924ce4129c9ca1417c127cf3613c4706fbbde368","original_commit_id":"924ce4129c9ca1417c127cf3613c4706fbbde368","user":{"login":"Guria","id":36270,"avatar_url":"https://avatars.githubusercontent.com/u/36270?v=3","gravatar_id":"","url":"https://api.github.com/users/Guria","html_url":"https://github.com/Guria","followers_url":"https://api.github.com/users/Guria/followers","following_url":"https://api.github.com/users/Guria/following{/other_user}","gists_url":"https://api.github.com/users/Guria/gists{/gist_id}","starred_url":"https://api.github.com/users/Guria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Guria/subscriptions","organizations_url":"https://api.github.com/users/Guria/orgs","repos_url":"https://api.github.com/users/Guria/repos","events_url":"https://api.github.com/users/Guria/events{/privacy}","received_events_url":"https://api.github.com/users/Guria/received_events","type":"User","site_admin":false},"body":"`router.trigger` no more available to import from module separately","created_at":"2015-10-16T08:56:49Z","updated_at":"2015-10-16T08:56:49Z","html_url":"https://github.com/christianalfoni/cerebral-router/pull/45#discussion_r42221604","pull_request_url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/comments/42221604"},"html":{"href":"https://github.com/christianalfoni/cerebral-router/pull/45#discussion_r42221604"},"pull_request":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45","id":47766769,"html_url":"https://github.com/christianalfoni/cerebral-router/pull/45","diff_url":"https://github.com/christianalfoni/cerebral-router/pull/45.diff","patch_url":"https://github.com/christianalfoni/cerebral-router/pull/45.patch","issue_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/45","number":45,"state":"open","locked":false,"title":"[wip] prepare new release","user":{"login":"Guria","id":36270,"avatar_url":"https://avatars.githubusercontent.com/u/36270?v=3","gravatar_id":"","url":"https://api.github.com/users/Guria","html_url":"https://github.com/Guria","followers_url":"https://api.github.com/users/Guria/followers","following_url":"https://api.github.com/users/Guria/following{/other_user}","gists_url":"https://api.github.com/users/Guria/gists{/gist_id}","starred_url":"https://api.github.com/users/Guria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Guria/subscriptions","organizations_url":"https://api.github.com/users/Guria/orgs","repos_url":"https://api.github.com/users/Guria/repos","events_url":"https://api.github.com/users/Guria/events{/privacy}","received_events_url":"https://api.github.com/users/Guria/received_events","type":"User","site_admin":false},"body":"* use path-to-regexp in getUrl method (resolves #42, resolves #35, related #34)\r\n* [wip] redirect should replace state by default (resolves #14)","created_at":"2015-10-15T10:06:51Z","updated_at":"2015-10-16T08:56:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c5830e2379eba16c8d8dae5bedad994c7dc9200","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45/commits","review_comments_url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45/comments","review_comment_url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/comments{/number}","comments_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/45/comments","statuses_url":"https://api.github.com/repos/christianalfoni/cerebral-router/statuses/924ce4129c9ca1417c127cf3613c4706fbbde368","head":{"label":"christianalfoni:next","ref":"next","sha":"924ce4129c9ca1417c127cf3613c4706fbbde368","user":{"login":"christianalfoni","id":3956929,"avatar_url":"https://avatars.githubusercontent.com/u/3956929?v=3","gravatar_id":"","url":"https://api.github.com/users/christianalfoni","html_url":"https://github.com/christianalfoni","followers_url":"https://api.github.com/users/christianalfoni/followers","following_url":"https://api.github.com/users/christianalfoni/following{/other_user}","gists_url":"https://api.github.com/users/christianalfoni/gists{/gist_id}","starred_url":"https://api.github.com/users/christianalfoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianalfoni/subscriptions","organizations_url":"https://api.github.com/users/christianalfoni/orgs","repos_url":"https://api.github.com/users/christianalfoni/repos","events_url":"https://api.github.com/users/christianalfoni/events{/privacy}","received_events_url":"https://api.github.com/users/christianalfoni/received_events","type":"User","site_admin":false},"repo":{"id":41587340,"name":"cerebral-router","full_name":"christianalfoni/cerebral-router","owner":{"login":"christianalfoni","id":3956929,"avatar_url":"https://avatars.githubusercontent.com/u/3956929?v=3","gravatar_id":"","url":"https://api.github.com/users/christianalfoni","html_url":"https://github.com/christianalfoni","followers_url":"https://api.github.com/users/christianalfoni/followers","following_url":"https://api.github.com/users/christianalfoni/following{/other_user}","gists_url":"https://api.github.com/users/christianalfoni/gists{/gist_id}","starred_url":"https://api.github.com/users/christianalfoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianalfoni/subscriptions","organizations_url":"https://api.github.com/users/christianalfoni/orgs","repos_url":"https://api.github.com/users/christianalfoni/repos","events_url":"https://api.github.com/users/christianalfoni/events{/privacy}","received_events_url":"https://api.github.com/users/christianalfoni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christianalfoni/cerebral-router","description":"An opinionated URL change handler for Cerebral","fork":false,"url":"https://api.github.com/repos/christianalfoni/cerebral-router","forks_url":"https://api.github.com/repos/christianalfoni/cerebral-router/forks","keys_url":"https://api.github.com/repos/christianalfoni/cerebral-router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christianalfoni/cerebral-router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christianalfoni/cerebral-router/teams","hooks_url":"https://api.github.com/repos/christianalfoni/cerebral-router/hooks","issue_events_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/events{/number}","events_url":"https://api.github.com/repos/christianalfoni/cerebral-router/events","assignees_url":"https://api.github.com/repos/christianalfoni/cerebral-router/assignees{/user}","branches_url":"https://api.github.com/repos/christianalfoni/cerebral-router/branches{/branch}","tags_url":"https://api.github.com/repos/christianalfoni/cerebral-router/tags","blobs_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/refs{/sha}","trees_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christianalfoni/cerebral-router/statuses/{sha}","languages_url":"https://api.github.com/repos/christianalfoni/cerebral-router/languages","stargazers_url":"https://api.github.com/repos/christianalfoni/cerebral-router/stargazers","contributors_url":"https://api.github.com/repos/christianalfoni/cerebral-router/contributors","subscribers_url":"https://api.github.com/repos/christianalfoni/cerebral-router/subscribers","subscription_url":"https://api.github.com/repos/christianalfoni/cerebral-router/subscription","commits_url":"https://api.github.com/repos/christianalfoni/cerebral-router/commits{/sha}","git_commits_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/commits{/sha}","comments_url":"https://api.github.com/repos/christianalfoni/cerebral-router/comments{/number}","issue_comment_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/comments{/number}","contents_url":"https://api.github.com/repos/christianalfoni/cerebral-router/contents/{+path}","compare_url":"https://api.github.com/repos/christianalfoni/cerebral-router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christianalfoni/cerebral-router/merges","archive_url":"https://api.github.com/repos/christianalfoni/cerebral-router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christianalfoni/cerebral-router/downloads","issues_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues{/number}","pulls_url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls{/number}","milestones_url":"https://api.github.com/repos/christianalfoni/cerebral-router/milestones{/number}","notifications_url":"https://api.github.com/repos/christianalfoni/cerebral-router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christianalfoni/cerebral-router/labels{/name}","releases_url":"https://api.github.com/repos/christianalfoni/cerebral-router/releases{/id}","created_at":"2015-08-29T09:10:30Z","updated_at":"2015-10-15T13:29:34Z","pushed_at":"2015-10-16T01:54:48Z","git_url":"git://github.com/christianalfoni/cerebral-router.git","ssh_url":"git@github.com:christianalfoni/cerebral-router.git","clone_url":"https://github.com/christianalfoni/cerebral-router.git","svn_url":"https://github.com/christianalfoni/cerebral-router","homepage":null,"size":370,"stargazers_count":14,"watchers_count":14,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":7,"forks":2,"open_issues":7,"watchers":14,"default_branch":"master"}},"base":{"label":"christianalfoni:master","ref":"master","sha":"96a72d465825cc53fd9368ecb69634b863cd5778","user":{"login":"christianalfoni","id":3956929,"avatar_url":"https://avatars.githubusercontent.com/u/3956929?v=3","gravatar_id":"","url":"https://api.github.com/users/christianalfoni","html_url":"https://github.com/christianalfoni","followers_url":"https://api.github.com/users/christianalfoni/followers","following_url":"https://api.github.com/users/christianalfoni/following{/other_user}","gists_url":"https://api.github.com/users/christianalfoni/gists{/gist_id}","starred_url":"https://api.github.com/users/christianalfoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianalfoni/subscriptions","organizations_url":"https://api.github.com/users/christianalfoni/orgs","repos_url":"https://api.github.com/users/christianalfoni/repos","events_url":"https://api.github.com/users/christianalfoni/events{/privacy}","received_events_url":"https://api.github.com/users/christianalfoni/received_events","type":"User","site_admin":false},"repo":{"id":41587340,"name":"cerebral-router","full_name":"christianalfoni/cerebral-router","owner":{"login":"christianalfoni","id":3956929,"avatar_url":"https://avatars.githubusercontent.com/u/3956929?v=3","gravatar_id":"","url":"https://api.github.com/users/christianalfoni","html_url":"https://github.com/christianalfoni","followers_url":"https://api.github.com/users/christianalfoni/followers","following_url":"https://api.github.com/users/christianalfoni/following{/other_user}","gists_url":"https://api.github.com/users/christianalfoni/gists{/gist_id}","starred_url":"https://api.github.com/users/christianalfoni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianalfoni/subscriptions","organizations_url":"https://api.github.com/users/christianalfoni/orgs","repos_url":"https://api.github.com/users/christianalfoni/repos","events_url":"https://api.github.com/users/christianalfoni/events{/privacy}","received_events_url":"https://api.github.com/users/christianalfoni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christianalfoni/cerebral-router","description":"An opinionated URL change handler for Cerebral","fork":false,"url":"https://api.github.com/repos/christianalfoni/cerebral-router","forks_url":"https://api.github.com/repos/christianalfoni/cerebral-router/forks","keys_url":"https://api.github.com/repos/christianalfoni/cerebral-router/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christianalfoni/cerebral-router/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christianalfoni/cerebral-router/teams","hooks_url":"https://api.github.com/repos/christianalfoni/cerebral-router/hooks","issue_events_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/events{/number}","events_url":"https://api.github.com/repos/christianalfoni/cerebral-router/events","assignees_url":"https://api.github.com/repos/christianalfoni/cerebral-router/assignees{/user}","branches_url":"https://api.github.com/repos/christianalfoni/cerebral-router/branches{/branch}","tags_url":"https://api.github.com/repos/christianalfoni/cerebral-router/tags","blobs_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/refs{/sha}","trees_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christianalfoni/cerebral-router/statuses/{sha}","languages_url":"https://api.github.com/repos/christianalfoni/cerebral-router/languages","stargazers_url":"https://api.github.com/repos/christianalfoni/cerebral-router/stargazers","contributors_url":"https://api.github.com/repos/christianalfoni/cerebral-router/contributors","subscribers_url":"https://api.github.com/repos/christianalfoni/cerebral-router/subscribers","subscription_url":"https://api.github.com/repos/christianalfoni/cerebral-router/subscription","commits_url":"https://api.github.com/repos/christianalfoni/cerebral-router/commits{/sha}","git_commits_url":"https://api.github.com/repos/christianalfoni/cerebral-router/git/commits{/sha}","comments_url":"https://api.github.com/repos/christianalfoni/cerebral-router/comments{/number}","issue_comment_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/comments{/number}","contents_url":"https://api.github.com/repos/christianalfoni/cerebral-router/contents/{+path}","compare_url":"https://api.github.com/repos/christianalfoni/cerebral-router/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christianalfoni/cerebral-router/merges","archive_url":"https://api.github.com/repos/christianalfoni/cerebral-router/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christianalfoni/cerebral-router/downloads","issues_url":"https://api.github.com/repos/christianalfoni/cerebral-router/issues{/number}","pulls_url":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls{/number}","milestones_url":"https://api.github.com/repos/christianalfoni/cerebral-router/milestones{/number}","notifications_url":"https://api.github.com/repos/christianalfoni/cerebral-router/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christianalfoni/cerebral-router/labels{/name}","releases_url":"https://api.github.com/repos/christianalfoni/cerebral-router/releases{/id}","created_at":"2015-08-29T09:10:30Z","updated_at":"2015-10-15T13:29:34Z","pushed_at":"2015-10-16T01:54:48Z","git_url":"git://github.com/christianalfoni/cerebral-router.git","ssh_url":"git@github.com:christianalfoni/cerebral-router.git","clone_url":"https://github.com/christianalfoni/cerebral-router.git","svn_url":"https://github.com/christianalfoni/cerebral-router","homepage":null,"size":370,"stargazers_count":14,"watchers_count":14,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":7,"forks":2,"open_issues":7,"watchers":14,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45"},"html":{"href":"https://github.com/christianalfoni/cerebral-router/pull/45"},"issue":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/45"},"comments":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/christianalfoni/cerebral-router/statuses/924ce4129c9ca1417c127cf3613c4706fbbde368"}}}}