Created
April 17, 2016 17:25
-
-
Save rdbox/5c85ef0f852ebcc7fd53739d35a61561 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