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
<!-- html5 new tags --> | |
<article> New - Defines an article | |
<aside> New - Defines content aside from the page content | |
<audio> New - Defines sound content | |
<canvas> New - Defines graphics | |
<command> New - Defines a command button | |
<datalist> New - Defines a dropdown list | |
<details> New - Defines details of an element | |
<embed> New - Defines external interactive content or plugin | |
<figcaption> New - Defines the caption of a figure element |
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 getSelectionHtml() { | |
var html = ""; | |
if (typeof window.getSelection != "undefined") { | |
var sel = window.getSelection(); | |
if (sel.rangeCount) { | |
var container = document.createElement("div"); | |
for (var i = 0, len = sel.rangeCount; i < len; ++i) { | |
container.appendChild(sel.getRangeAt(i).cloneContents()); | |
} | |
html = container.innerHTML; |
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 loadScript(path, callback) { | |
var done = false; | |
var scr = document.createElement('script'); | |
scr.onload = handleLoad; |
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
if(jQuery.browser.mobile) | |
{ | |
console.log('You are using a mobile device!'); | |
} | |
else | |
{ | |
console.log('You are not using a mobile device!'); | |
} | |
var isiPad = /ipad/i.test(navigator.userAgent.toLowerCase()); |
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($) { | |
$.fn.stripHtml = function() { | |
var regexp = /<("[^"]*"|'[^']*'|[^'">])*>/gi; | |
this.each(function() { | |
$(this).html( | |
$(this).html().replace(regexp,"") | |
); | |
}); | |
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
$('#theImage').attr('src', 'image.jpg').load(function() { | |
alert('This Image Has Been Loaded'); | |
}); |
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
MY_OBJECT = | |
{ | |
cache: {}, | |
init: function() | |
{ | |
this.cache.c = $('#container'); | |
this.cache.n = this.cache.c.find('.nested'); | |
this.cache.s = this.cache.c.find('#status'); | |
} |
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
//iPAD Support | |
$.fn.addTouch = function(){ | |
this.each(function(i,el){ | |
$(el).bind('touchstart touchmove touchend touchcancel',function(){ | |
//we pass the original event object because the jQuery event | |
//object is normalized to w3c specs and does not provide the TouchList | |
handleTouch(event); | |
}); | |
}); |
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
jQuery.fn.center = function() { | |
return this.each(function() { | |
var t = $(this); | |
t.css({ | |
'position': 'absolute', | |
'top': (t.parent().height() - t.height()) / 2 + t.parent().scrollTop() + "px", | |
'left': (t.parent().width() - t.width()) / 2 + t.parent().scrollLeft() + "px" | |
}).parent().css('position', 'relative'); | |
}); | |
}; |
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 url = $(location).attr('href'); //get current url | |
//OR | |
var url = 'folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes'; //or specify one | |
var decodedUrl = decodeURIComponent(url); | |
console.log(decodedUrl); | |
//outputs folder/index.html?param=#23dd&noob=yes | |
---------------------------------------------------------------------------------- |