Skip to content

Commit

Permalink
Only look at 10 (sec) and 13 (ms) character timestamps (#7)
Browse files Browse the repository at this point in the history
These are the most requested features in the Chrome Web Store reviews.
  • Loading branch information
lachesis authored and drautb committed Aug 30, 2018
1 parent 61ef383 commit d6dfe98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions selection.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ $(document).ready(function() {
function processSelection(e) {
var text = getSelectedText();

if ($.isNumeric(text)) {
var humanReadableDate = convertTimestamp(text);
showBubble(e, humanReadableDate);
if ((text.length == 10 || text.length == 13) && $.isNumeric(text)) {
if (text.length == 13) { // Handle millisecond timestamps
text = text / 1000;
}
var humanReadableDate = convertTimestamp(text);
showBubble(e, humanReadableDate);
}
}

function getSelectedText() {
Expand Down

0 comments on commit d6dfe98

Please sign in to comment.