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
//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 | |
//if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not) | |
if (i == key && obj[i] == val || i == key && val == '') { // |
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
if(navigator.vendor != null && navigator.vendor.match(/Apple Computer, Inc./) && navigator.userAgent.match(/iPhone/i) || (navigator.userAgent.match(/iPod/i))) | |
{ | |
// Device is an iPhone or iPod | |
} |
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
function removejscssfile(filename, filetype){ | |
var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none" //determine element type to create nodelist from | |
var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none" //determine corresponding attribute to test for | |
var allsuspects=document.getElementsByTagName(targetelement) | |
for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove | |
if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1) | |
allsuspects[i].parentNode.removeChild(allsuspects[i]) //remove element by calling parentNode.removeChild() | |
} | |
} |
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
function parseURL(url) { | |
var a = document.createElement('a'); | |
a.href = url; | |
return { | |
source: url, | |
protocol: a.protocol.replace(':',''), | |
host: a.hostname, | |
port: a.port, | |
query: a.search, | |
params: (function(){ |
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
function activateDarkMode() { | |
const rootElement = document.querySelector(':root') | |
const darkTheme = { | |
'--background-color': '#1e1e1e', | |
'--primary-color': '#157efb', | |
'--font-color': '#dedede', | |
'--subtle-primary-color': '#151513', | |
'--block-background-color': '#323232', | |
'--menu-item-color': '#dedede', | |
'--menu-item-hover-color': '#157efb', |
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
:root { | |
--background-color: #fff; | |
--page-width: 70em; | |
--primary-color: #151513; | |
--font-color: #151513; | |
--subtle-primary-color: #151513; | |
--block-background-color: #f1f3f4; | |
--menu-item-color: #000; | |
--menu-item-hover-color: #000; | |
--menu-item-alert-bg: #ffffff; |
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
<nav id="test"> | |
<li><a href="/1">1</a></li> | |
<li><a href="/2">2</a></li> | |
<li><a href="/3" id="qs1">3</a></li> | |
<li><a href="/4">4</a></li> | |
</nav> | |
<nav id="test2"> | |
<li><a href="/1">1</a></li> | |
<li><a href="/2">2</a></li> | |
<li><a href="/3" id="qs2">3</a></li> |
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
.logo { | |
display: block; | |
margin: 0; | |
width: 272px; | |
height: auto; | |
overflow: hidden; | |
text-decoration: none; | |
} | |
.logo img { |
OlderNewer