mirror of
https://github.com/freeCodeCamp/devdocs
synced 2024-11-16 19:48:10 +01:00
parent
994f8207cd
commit
ce31de5c3f
3 changed files with 6 additions and 3 deletions
|
@ -260,6 +260,9 @@ ESCAPE_REGEXP = /([.*+?^=!:${}()|\[\]\/\\])/g
|
|||
$.escapeRegexp = (string) ->
|
||||
string.replace ESCAPE_REGEXP, "\\$1"
|
||||
|
||||
$.urlDecode = (string) ->
|
||||
decodeURIComponent string.replace(/\+/g, '%20')
|
||||
|
||||
#
|
||||
# Miscellaneous
|
||||
#
|
||||
|
|
|
@ -116,4 +116,4 @@ class app.views.Search extends app.View
|
|||
value
|
||||
|
||||
getHashValue: ->
|
||||
try (new RegExp "##{SEARCH_PARAM}=(.*)").exec(decodeURIComponent location.hash)?[1] catch
|
||||
try (new RegExp "##{SEARCH_PARAM}=(.*)").exec($.urlDecode location.hash)?[1] catch
|
||||
|
|
|
@ -76,9 +76,9 @@ class app.views.SearchScope extends app.View
|
|||
|
||||
extractHashValue: ->
|
||||
if value = @getHashValue()
|
||||
newHash = decodeURIComponent(location.hash).replace "##{SEARCH_PARAM}=#{value} ", "##{SEARCH_PARAM}="
|
||||
newHash = $.urlDecode(location.hash).replace "##{SEARCH_PARAM}=#{value} ", "##{SEARCH_PARAM}="
|
||||
app.router.replaceHash(newHash)
|
||||
value
|
||||
|
||||
getHashValue: ->
|
||||
try (new RegExp "^##{SEARCH_PARAM}=(.+?) .").exec(decodeURIComponent location.hash)?[1] catch
|
||||
try (new RegExp "^##{SEARCH_PARAM}=(.+?) .").exec($.urlDecode location.hash)?[1] catch
|
||||
|
|
Loading…
Reference in a new issue