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 */ | |
| if ( typeof String.prototype.trim !== 'function' ) { | |
| String.prototype.trim = function () { | |
| return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); | |
| }; | |
| } | |
| if (typeof String.prototype.toProperCase !== 'function' ) { | |
| String.prototype.toProperCase = 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
| $.ajaxSetup({ | |
| error: function(jqXHR, exception) { | |
| var msg=''; | |
| if (jqXHR.status === 0) { | |
| msg='Not connected.\n Verify Network Connectivity.'; | |
| } else if (jqXHR.status == 404) { | |
| msg='Requested page not found. [404]'; | |
| } else if (jqXHR.status == 500) { | |
| msg='Internal Server Error [500]'; | |
| } else if (exception === 'parsererror') { |
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
| // IIFE (Immediately Invoked Function Expression) | |
| (function(window, $, undefined){ | |
| // code here.. | |
| })(window, jQuery); |
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
| //PLUGINNAME === Pluginname (UpperCase first letter) | |
| //PLUGIN === pluginname (all lowercase) | |
| var PLUGINNAME = function( $elm, options ) { | |
| this.debug = false; | |
| this.$el = $elm; | |
| this.options = jQuery.extend( true, {}, $.fn.PLUGIN.defaults, options ); | |
| this.$el.data('PLUGINNAME', 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
| var gs = { | |
| /***********************/ | |
| /* Class Manipulation */ | |
| /***********************/ | |
| addClass : function(el, clsName) { | |
| var tmp; |
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 $sel = $("ul"), | |
| list = $sel.find('li').get().reverse(); | |
| $sel.empty().append(list); |
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
| /** | |
| * Protect window.console method calls, e.g. console is not defined on IE | |
| * unless dev tools are open, and IE doesn't define console.debug | |
| */ | |
| (function () { | |
| if (!window.console) { | |
| window.console = {}; | |
| } | |
| // union of Chrome, FF, IE, and Safari console methods | |
| var functionCall = 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
| 'use strict'; | |
| module.exports = function(grunt) { | |
| // Project configuration. | |
| grunt.initConfig({ | |
| // Metadata. | |
| pkg: grunt.file.readJSON('tiny-pubsub.jquery.json'), | |
| banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | |
| '<%= grunt.template.today("yyyy-mm-dd") %>\n' + |
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 randomColors = { | |
| init : function () { | |
| this.elems = document.querySelectorAll("div"); | |
| this.update(); | |
| document.querySelector('#updateColors').addEventListener('click', function() { | |
| randomColors.update(); | |
| }); | |
| }, | |
OlderNewer