Last active
April 7, 2016 15:19
-
-
Save f1h0/674b8b211a1f9faea9a4 to your computer and use it in GitHub Desktop.
This file contains 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
/* | |
Функция из URL извлекает pathname | |
после указываем условия при котором идет и поиск совпадения | |
lastIndexOf() ищет значние в индексе, выводить на экран все после "/"" | |
*/ | |
function () { | |
var pagePath = location.pathname; | |
if (pagePath.indexOf("/search/") === 0) { | |
var searchString = pagePath.substring(pagePath.lastIndexOf("/") + 1); | |
return searchString; | |
} | |
else { | |
return "none"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment