Created
April 11, 2017 07:52
-
-
Save mschnitzler/0eace328ce9cc57bcbce660198f5e55b to your computer and use it in GitHub Desktop.
crowd timestamp converter
This file contains hidden or 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 Crowd Timestamp Converter | |
// @namespace http://your.homepage/ | |
// @version 0.2 | |
// @description enter something useful | |
// @author Michael Schnitzler | |
// @match https://crowd*/console/secure/user/* | |
// @grant none | |
// ==/UserScript== | |
function timeConverter(UNIX_timestamp){ | |
var a = new Date(UNIX_timestamp*1); | |
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; | |
var year = a.getFullYear(); | |
var month = months[a.getMonth()]; | |
var date = a.getDate(); | |
var hour = "0" + a.getHours(); | |
var min = "0" + a.getMinutes(); | |
var sec = "0" + a.getSeconds(); | |
var time = date + ' ' + month + ' ' + year + ' ' + hour.substr(-2) + ':' + min.substr(-2) + ':' + sec.substr(-2) ; | |
return time; | |
} | |
var lastActiveElem = document.getElementsByName("lastActive1")[0]; | |
var passwordLastChangedElem = document.getElementsByName("passwordLastChanged1")[0]; | |
var lastAuthenticatedElem = document.getElementsByName("lastAuthenticated1")[0]; | |
if (lastActiveElem != null) { | |
var lactFormattedNode = document.createElement("b"); | |
var lactFormattedTextNode = document.createTextNode(timeConverter(lastActiveElem.value)); | |
lactFormattedNode.appendChild(lactFormattedTextNode); | |
lastActiveElem.parentNode.appendChild(lactFormattedNode); | |
} | |
if (passwordLastChangedElem != null) { | |
var pwlcFormattedNode = document.createElement("b"); | |
var pwlcFormattedTextNode = document.createTextNode(timeConverter(passwordLastChangedElem.value)); | |
pwlcFormattedNode.appendChild(pwlcFormattedTextNode); | |
passwordLastChangedElem.parentNode.appendChild(pwlcFormattedNode); | |
} | |
if (lastAuthenticatedElem != null) { | |
var lauthFormattedNode = document.createElement("b"); | |
var lauthFormattedTextNode = document.createTextNode(timeConverter(lastAuthenticatedElem.value)); | |
lauthFormattedNode.appendChild(lauthFormattedTextNode); | |
lastAuthenticatedElem.parentNode.appendChild(lauthFormattedNode); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment