Skip to content

Instantly share code, notes, and snippets.

@adamwdraper
Last active February 11, 2024 22:23

Revisions

  1. adamwdraper revised this gist Feb 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@
    (function (factory) {
    if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['jQuery'], factory);
    define(['jquery'], factory);
    } else {
    // Browser globals
    factory(jQuery);
  2. adamwdraper created this gist Jun 18, 2012.
    63 changes: 63 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,63 @@
    // Uses AMD or browser globals to create a jQuery plugin.

    /**
    * Name - jQuery Plugin
    *
    * Version: 0.0.1 (5/25/2012)
    * Requires: jQuery v1.7+
    *
    * Copyright (c) 2011 User - http://github.com/username
    * Under MIT and GPL licenses:
    * http://www.opensource.org/licenses/mit-license.php
    * http://www.gnu.org/licenses/gpl.html
    */
    (function (factory) {
    if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['jQuery'], factory);
    } else {
    // Browser globals
    factory(jQuery);
    }
    }(function ($) {
    var $this;

    var methods = {
    init : function( options ) {
    return this.each(function(){
    var $this = $(this),
    data = $this.data('initialized');

    if ( ! data ) {
    $this = $(this);
    $this.data('initialized', true);

    }
    });
    },

    value: function() {

    },

    set: function(value) {

    },

    reset: function() {

    }
    };

    $.fn.inputGrid = function( method ) {

    if ( methods[method] ) {
    return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
    } else if ( typeof method === 'object' || ! method ) {
    return methods.init.apply( this, arguments );
    } else {
    $.error( 'Method ' + method + ' does not exist on jQuery.plugin' );
    }

    };
    }));