130 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			130 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| <?xml version="1.0" encoding="UTF-8"?>
 | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 | |
| <plist version="1.0">
 | |
| <dict>
 | |
| 	<key>content</key>
 | |
| 	<string>// jQuery ${1:pluginName} Plugin
 | |
| (function( \$ ) {
 | |
|   var settings = {
 | |
|     ${30:}
 | |
|   };
 | |
| 
 | |
|   var methods = {
 | |
|     init: function( options ) {
 | |
| 
 | |
|       this.each(function() {
 | |
|         var data, dataId, opts,
 | |
|             ${10:\$this} = $(this);
 | |
| 
 | |
|         $10.$1('options', options);
 | |
|         data = $10.data('$1') || {};
 | |
|         opts = data.options;
 | |
| 
 | |
|         // If the plugin hasn't been initialized yet
 | |
|         if ( !data.$1 ) {
 | |
|           dataId = +new Date;
 | |
| 
 | |
|           data = {
 | |
|             cluetip: $1,
 | |
|             options: opts,
 | |
|             id: dataId
 | |
|           };
 | |
| 
 | |
|           $10.data('$1', data);
 | |
|           ${14:
 | |
|           // create element and append to body
 | |
|           var $1 = \$('<div />', {
 | |
|             'class': '$1'
 | |
|           \}).appendTo( 'body' );
 | |
| 
 | |
|           $1.data( '$1', {target: $10, id: dataId\} );
 | |
| }
 | |
| 
 | |
|         } // !data.$1
 | |
| 
 | |
|         $0
 | |
| 
 | |
|       });
 | |
| 
 | |
|       return this;
 | |
|     },
 | |
|     destroy: function( ) {
 | |
| 
 | |
|       this.each(function() {
 | |
| 
 | |
|         var $10 = \$(this),
 | |
|             data = $10.data( '$1' );
 | |
| 
 | |
|         // Remove created elements, unbind namespaced events, and remove data
 | |
|         \$(document).unbind( '.$1' );
 | |
|         data.$1.remove();
 | |
|         $10.unbind( '.$1' )
 | |
|         .removeData( '$1' );
 | |
| 
 | |
|       });
 | |
| 
 | |
|       return this;
 | |
|     },
 | |
|     options: function( options ) {
 | |
| 
 | |
|       this.each(function() {
 | |
|         var $10 = \$(this),
 | |
|             // don't use our getData() function here
 | |
|             // because we want an object regardless
 | |
|             data = $10.data( '$1' ) || {},
 | |
|             opts = data.options || {};
 | |
| 
 | |
|         // deep extend (merge) default settings, per-call options, and options set with:
 | |
|         // html10 data-$1 options JSON and \$('selector').$1( 'options', {} );
 | |
|         opts = \$.extend( true, {}, \$.fn.cluetip.defaults, opts, options || {} );
 | |
|         data.options = opts;
 | |
|         \$.data( this, '$1', data );
 | |
|       });
 | |
| 
 | |
|       return this;
 | |
|     }${20/(.+)/(?1:,
 | |
|     :)/}${20:someOtherMethod}${20/(.+)/(?1:\: function\(\) {
 | |
| 
 | |
|     }:)/}
 | |
|   };
 | |
| 
 | |
|   var protoSlice = Array.prototype.slice;
 | |
| 
 | |
|   \$.fn.$1 = function( method ) {
 | |
| 
 | |
|     if ( methods[method] ) {
 | |
|       return methods[method].apply( this, protoSlice.call( arguments, 1 ) );
 | |
|     } else if ( typeof method === 'object' || ! method ) {
 | |
|       return methods.init.apply( this, arguments );
 | |
|     } else {
 | |
|       \$.error( 'Method ' +  method + ' does not exist on jQuery.fn.$1' );
 | |
|     }
 | |
| 
 | |
|   };
 | |
| 
 | |
|   \$.extend(\$.fn.$1, {
 | |
|     defaults: settings
 | |
|   });
 | |
| 
 | |
|   function getData(el) {
 | |
|     var $1, opts,
 | |
|         $10 = \$(el),
 | |
|         data = $10.data( '$1' ) || {};
 | |
| 
 | |
|     if (!data.$1) { return false; }
 | |
| 
 | |
|     return data;
 | |
|   }
 | |
| 
 | |
| })( jQuery );</string>
 | |
| 	<key>name</key>
 | |
| 	<string>plugin (method extras)</string>
 | |
| 	<key>scope</key>
 | |
| 	<string>source.js</string>
 | |
| 	<key>tabTrigger</key>
 | |
| 	<string>plugin</string>
 | |
| 	<key>uuid</key>
 | |
| 	<string>39192EFA-D490-4E52-B7F8-D68584397A41</string>
 | |
| </dict>
 | |
| </plist>
 |