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 a = document.createElement('a'); | |
| a.href = url; | |
| // any property of window.location works here: | |
| document.write('The hostname of ' + url + ' is ' + a.hostname); |
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
| html="<a href='"+url+"'>"+text+"</a>" // before | |
| html=text.link(url) // after |
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
| String.prototype.addSlashes = function() | |
| {return this.replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0');}; | |
| String.prototype.stripSlashes = function() | |
| {return this.replace(/\\(.?)/g, function (s, n1){switch (n1){case '\\':return '\\';case '0':return '\u0000';case '':return '';default:return n1;}});}; |
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
| HTMLAudioElement.prototype.stop=function(){this.pause();this.currentTime=0}; |
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 MD5 = function (string) { | |
| function RotateLeft(lValue, iShiftBits) { | |
| return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits)); | |
| } | |
| function AddUnsigned(lX,lY) { | |
| var lX4,lY4,lX8,lY8,lResult; | |
| lX8 = (lX & 0x80000000); | |
| lY8 = (lY & 0x80000000); |
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
| /** | |
| * Array.prototype.[method name] allows you to define/overwrite an objects method | |
| * needle is the item you are searching for | |
| * this is a special variable that refers to "this" instance of an Array. | |
| * returns true if needle is in the array, and false otherwise | |
| */ | |
| Array.prototype.contains = function ( needle ) { | |
| for (i in this) { | |
| if (this[i] == needle) return true; | |
| } |
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 randomColor = Math.floor(Math.random()*16777215).toString(16); | |
| var ramdomColor = '#'+Math.round(0xffffff * Math.random()).toString(16); |
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 htmlEntities(str) { | |
| return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); | |
| } |
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
| #spinner { | |
| top:50%; | |
| left:50%; | |
| width:32px; | |
| height:0; | |
| margin:-16px 0 0 -16px; | |
| padding-top:32px; | |
| position:absolute; | |
| overflow:hidden; | |
| * { |
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 (window.matchMedia('only screen and (max-device-width: 480px)').matches) { | |
| // Asynchronously load iphone.js | |
| } else if (window.matchMedia('only screen and (min-device-width: 481px) and ' + | |
| '(max-device-width: 1024px) and ' + | |
| '(orientation: portrait)').matches) { | |
| // Asynchronously load ipad-portrait.js | |
| } | |