Created
March 13, 2012 04:35
-
-
Save simonista/2026775 to your computer and use it in GitHub Desktop.
limescript for bip backlog timestamp translation
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
# remove the timestamp that bip inserts in a backlog message and set the time | |
# of the span element that limechat uses | |
bind 'line', (line) -> | |
# see if out message matches 'hh:mm:ss>' | |
html = line.innerHTML | |
regex = /(\d{2}:\d{2}):\d{2}>/ | |
matches = html.match regex | |
return unless matches | |
# remove that timestamp from the message | |
message = line.querySelector('.message') | |
html = message.innerHTML | |
html = html.replace regex, "" | |
message.innerHTML = html | |
# and add hh:mm to the .time span | |
# for some reason replacing the html wasn't working, so I'm removing the | |
# element and creating a new one instead | |
$(line).find('.time').remove() | |
$(line).prepend('<span class="time">' + matches[1] + '</span>') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment