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(){ | |
| $("a").each(function(){ | |
| if ($(this).attr("href") == window.location.pathname){ | |
| $(this).addClass("selected"); | |
| } | |
| }); | |
| }); |
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 kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65"; | |
| $(document).keydown(function(e) { | |
| kkeys.push( e.keyCode ); | |
| if ( kkeys.toString().indexOf( konami ) >= 0 ) { | |
| $(document).unbind('keydown',arguments.callee); | |
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
| //using async loading | |
| // Only do anything if jQuery isn't defined | |
| if (typeof jQuery == 'undefined') { | |
| if (typeof $ == 'function') { | |
| // warning, global var | |
| thisPageUsingOtherJSLibrary = true; | |
| } | |
| function getScript(url, success) { |
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 labelID; | |
| $('label').click(function() { | |
| labelID = $(this).attr('for'); | |
| $('#'+labelID).trigger('click'); | |
| }); | |
| //All browsers except IE will do this when you code it this way below: | |
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
| // Scroll to specific values | |
| // scrollTo is the same | |
| window.scroll({ | |
| top: 2500, | |
| left: 0, | |
| behavior: 'smooth' | |
| }); | |
| // Scroll certain amounts from current position | |
| window.scrollBy({ |
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
| Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html | |
| Redirect 301 /oldpage2.html http://www.yoursite.com/folder/ | |
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
| $(window).bind("load", function() { | |
| // code here | |
| }); |
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
| $('#button1').click(function() { | |
| var url = "http:www.your-url.com?ID=" + Math.random(); //create random number | |
| setTimeout(function() { | |
| $("#elementName").load(url+" #elementName>*",""); | |
| }, 1000); //wait one second to run function | |
| }); |
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
| $('#pass').keyup(function(e) { | |
| var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g"); | |
| var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g"); | |
| var enoughRegex = new RegExp("(?=.{6,}).*", "g"); | |
| if (false == enoughRegex.test($(this).val())) { | |
| $('#passstrength').html('More Characters'); | |
| } else if (strongRegex.test($(this).val())) { | |
| $('#passstrength').className = 'ok'; | |
| $('#passstrength').html('Strong!'); | |
| } else if (mediumRegex.test($(this).val())) { |