Skip to content

Instantly share code, notes, and snippets.

@simonista
Created March 13, 2012 04:35
Show Gist options
  • Save simonista/2026775 to your computer and use it in GitHub Desktop.
Save simonista/2026775 to your computer and use it in GitHub Desktop.
limescript for bip backlog timestamp translation
# 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