Dienstag, 4. Mai 2010

JQuery Plugin Visual Studio Item Template

Here's a JQuery Plugin Item Template for Visual Studio (2010 but I guess it works with the older versions too - btw upgrade! :-))



1. Download file from above
2. Import template in Visual Studio
2.1 Drink a beer.
2.2 Copy the Zip File to: C:\Users\\Documents\Visual Studio 2010\Templates\ItemTemplates

Have fun.

BTW. The content of the added js file looks like this:

// Template generated by Daenu Probst http://codebrewery.blogspot.com/
// Based upon the excellent article http://www.learningjquery.com/2007/10/a-plugin-development-pattern
// Icon by http://jyrik.deviantart.com/

(function ($) {
    $.fn.pluginName = function (options) {
        var opts = $.extend({}, $.fn.pluginName.defaults, options);

        // iterate and reformat each matched element
        return this.each(function () {
            var obj = $(this);

            // ... Put your fancy JQuery_Plugin1 code here ...
        });
    };

    // private functions
    function myPrivateFunction(param1, param2) {
        // private function code
    };

    // public functions
    $.fn.pluginName.myPublicFunction = function (param1, param2) {
        // public function code
    };

    // public variables
    $.fn.pluginName.myPublicVariable = 'value1';

    // public accessible defaults
    // access with: $.fn.pluginName.defaults.option1 = 'value3';
    $.fn.pluginName.defaults = {
        option1: 'value1',
        option2: 'value2'
    };
})(jQuery);

Keine Kommentare:

Kommentar veröffentlichen

Socialize!