Permalink
Browse files

Get hostname into share link via window.location.origin

  • Loading branch information...
1 parent 6ca070b commit c081aa586934f0e4103afa905128c8bd137797b8 @jonmagic committed Mar 23, 2012
Showing with 6 additions and 6 deletions.
  1. +2 −2 application.js
  2. +4 −4 scripts/application.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -68,9 +68,10 @@ class Results
@showError()
addShareLink: (expression_url, test_strings_url) ->
- url = window.location.protocol+window.location.pathname+"#"
+ url = window.location.origin+"/#"
url += expression_url + encodeURIComponent("||||") + test_strings_url
- $("#share_link").attr("href",url)
+ window.
+ $("#share_link").attr("href", url)
matchResults: (value, matches) ->
return unless matches
@@ -138,8 +139,7 @@ class App
@test_strings = new TestStrings(el: '#test_strings')
@results = new Results(@expression, @test_strings)
$('#example').bind 'click', @loadExample
- if window.location.hash != ''
- @loadFromHash()
+ @loadFromHash() if window.location.hash != ''
loadFromHash: () =>
[regex, option, test_strings_from_url] = decodeURIComponent(window.location.hash.substr(1)).split("||||")

0 comments on commit c081aa5

Please sign in to comment.