Created
March 15, 2012 15:59
-
-
Save tsvetomir/2044945 to your computer and use it in GitHub Desktop.
Local time in Campfire chats
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
// ==UserScript== | |
// @name Campfire local time | |
// @namespace http://tsonev.net/campfire/localtime | |
// @version 0.2 | |
// @description Converts time stamps to local time in Campfire chats. Tested in Chrome. | |
// @match https://XXXXXX.campfirenow.com/room/* | |
// ==/UserScript== | |
var TIME_ZONE = "CDT"; | |
function convertTimes() { | |
var dates = document.querySelectorAll(".date span"); | |
var times = document.querySelectorAll(".time div"); | |
for (var i = 0; i < dates.length; i++) { | |
if (!times[i]._converted) { | |
var timestamp = new Date(dates[i].innerHTML + " " + times[i].innerHTML + " " + TIME_ZONE); | |
times[i].innerHTML = timestamp.toLocaleTimeString(); | |
times[i]._converted = true; | |
} | |
} | |
} | |
window.addEventListener("load", function(e) { | |
setInterval(convertTimes, 500); | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment