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 addClass(node, class) { | |
if (!node.length) node = [node]; | |
for (var n = 0, m = node.length; n < m; n++) { | |
if ((" " + node[n].className + " ").indexOf(" "+class+" ") >= 0) { | |
node.className += " " + class; | |
} | |
} | |
} | |
// apply myclass to all nodes | |
addClass(document.getElementById("myelement"), "myclass"); |
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 events = (function(){ | |
var topics = {}; | |
return { | |
subscribe: function(topic, listener) { | |
if(!topics[topic]) topics[topic] = { | |
queue: [] | |
}; |
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 (context) { | |
var createKontxt = function (nameStr, baseLine) { | |
var x, j, r, baseKnTxt, name; | |
var wdgts = nameStr.split('.'); | |
j = baseKnTxt = baseLine ? baseLine : (Function('return this')()); | |
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
// make a blob | |
var blob = new Blob(['blobyJo'], { | |
type: 'text/plain' | |
}); | |
try { | |
var store = db.transaction(['buckets'], 'readwrite') | |
.objectStore('buckets'); | |
var fngr = store.put(blob, 'blob'); |
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
<!Doctype html> | |
<meta name="viewport" content="width=620" /> | |
<title>KnD-MApPA</title> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
<article> | |
<p>Finding You...: <span id="status">Checking...</span> | |
</p> | |
</article> | |
<script> | |
var map = "", |
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
// programatic entry point for the server // | |
var router = require('./router.js'), | |
requestHandlers = require('./requestHandlers.js'), | |
webServer = require('./server.js'), | |
handle = {}; | |
// Unary referencing... each function maps -to- a specific request/params/method etc... // | |
handle['/'] = handle['/home'] = handle['/Home'] = handle['/index.html'] = handle['/Index.html'] = requestHandlers.startRoot; |
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
// caching script fetcher // | |
var futrs = {}; | |
var ajaxFetch = function( url, cBak ) { | |
if ( !futrs[ url ] ) { | |
futrs[ url ] = $.Deferred(function( defer ) { | |
$.getScript( url ) | |
.then( defer.resolve, defer.reject ); |
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
// GTRX geolocator | |
(function GTRX(window) { | |
var wndw = window, | |
var startG = function() { | |
if (wndw.navigator.geolocation) { | |
var trxLST = [], pID = "", cnt = 0, ipAddrs = ""; |
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
// figure out which click is left or right | |
$(element).live('click', function(e) { | |
if( (!$.browser.msie && e.button == 0) || ($.browser.msie && e.button == 1) ) { | |
alert("Left Button"); | |
} | |
else if(e.button == 2) | |
alert("Right Button"); | |
}); |
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
// see what key was pressed | |
$(function() { | |
$(document).keypress(function(e){ | |
switch(e.which){ | |
// "ENTER" | |
case 13: | |
alert('enter pressed'); | |
break; | |