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
function format(date, format) { | |
if (!date || !format) { | |
return; | |
} | |
if (format.toLowerCase() === "short") { | |
format = "dd-MM-yyyy"; | |
} | |
if (format.toLowerCase() === "medium") { | |
format = "dd-MM-yyyy hh:mm:ss"; | |
} |
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
/* Attribution: http://techslides.com/how-to-parse-and-search-json-in-javascript */ | |
//return an array of objects according to key, value, or key and value matching | |
function getObjects(obj, key, val) { | |
var objects = []; | |
for (var i in obj) { | |
if (!obj.hasOwnProperty(i)) continue; | |
if (typeof obj[i] == 'object') { | |
objects = objects.concat(getObjects(obj[i], key, val)); | |
} else |
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
var button = document.createElement('button'); | |
button.textContent = 'Push'; | |
document.body.appendChild(button); | |
var x, title; | |
if (!history.state) { | |
x = 0; | |
title = document.title; | |
// Without this we can loose the initial page's title on browser navigation |
OlderNewer