Created
October 31, 2018 21:01
-
-
Save andersonmadeira/e2cd390de9ed65aa7930bdbdde938646 to your computer and use it in GitHub Desktop.
Corrigir links da página
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
(function(selector, sub) { | |
elems = jQuery(selector); | |
for(i = 0; i < elems.length; i++) { | |
str = jQuery(elems[i]).attr('href'); | |
if (str.endsWith('/')) | |
str = str.slice(0, str.length - 1); | |
index = str.lastIndexOf('/'); | |
jQuery(elems[i]).attr('href', str.substring(0, index) + '/' + sub + str.substring(index) ); | |
} | |
})('.listagem h2 a', 'noticias'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment