Skip to content

Instantly share code, notes, and snippets.

@PavelLaptev
Last active June 26, 2016 13:11
Show Gist options
  • Save PavelLaptev/49da909ddcbc54733a0adf361eff5d3d to your computer and use it in GitHub Desktop.
Save PavelLaptev/49da909ddcbc54733a0adf361eff5d3d to your computer and use it in GitHub Desktop.
#Text replacer
replacer = (place, oldString, newString) ->
string = place.text()
newText = string.replace(oldString, newString)
place.text(newText)
#Style replacer in text
replacer = (place, oldString, newString) ->
string = place.html()
newText = string.replace(oldString, newString)
place.html(newText)
replacer(place, /строка/g, "<span style='color:tomato'>другой цвет строки</span>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment