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
//http://javascriptissexy.com/javascript-objects-in-detail/ | |
//everything in javascript is objects. | |
//except number, strings & boolean | |
//objects are key/value pairs | |
//anything ends with () is a function | |
//in that way; new Object() is also a function | |
//and it has methods like create() | |
// and hasOwnProperty() |
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 d, h, m, s, | |
ms = $newDate - $currentDate; | |
s = Math.floor(ms / 1000); | |
m = Math.floor(s / 60); | |
s = s % 60; | |
h = Math.floor(m / 60); | |
m = m % 60; | |
d = Math.floor(h / 24); | |
h = h % 24; |
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
$(document).keydown(function (e) { | |
if (e.keyCode == 27) | |
{ $(".box_tube,.over_wrapper").fadeOut(500); } | |
}); |
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 upTo(element, myclassName) { | |
do { | |
element = element.parentNode; | |
if (element.className.indexOf(myclassName) > -1) { | |
return element; | |
} | |
} while (element); | |
return null; | |
} | |
upTo(this, "level-dt"); |
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 log_this_and_message = function (message) { | |
console.log(message+this.name); | |
}; | |
var thing = { | |
name: 'Big Hairy Thing' | |
}; | |
log_this_and_message.call(thing, 'Hello!'); |
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
$(".accord_table").on("change",'.currentTable :checkbox',function(event){ | |
var group = $(this).closest(".currentTable").find(":checkbox"); | |
group.not($(this)).removeProp("checked"); | |
}) |
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
@media screen and (-webkit-min-device-pixel-ratio:0) { // for chrome | |
} |
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
//Invocation as a function | |
//this refers to window | |
function creep() { | |
return this; | |
} | |
console.log(creep() === window, "Creeping in the window"); | |
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
//Invocation as a constructor | |
//Ninja is a Constructor | |
//should start with Capital letter | |
//creates a emply object{} | |
function Ninja() { | |
this.skulk = 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
//Invocation with the apply() and call() methods | |
// create a plain function | |
function juggle() { | |
var result = 0; | |
for (var n = 0; n < arguments.length; n++) { | |
result += arguments[n]; | |
} | |
//this.result = result; | |
console.log(result) |