Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*socialFeed plugin*/
- (function ($) {
- //$.fn.socialFeed = function( method ) {
- var plugin_prototype = {
- status: { facebook: null,
- twitter: null},
- ids: { facebook: null,
- twitter: null},
- name: '',
- feed: [],
- options: {},
- //instance: null,
- element: false,
- _init:function(){
- var instance = this;
- var $el = $(instance.element);
- $el.data('something',$el.attr('class'));
- instance.name += $el.attr('class');
- }
- }, defaults = {};
- var pluginName = 'derpyDerp3';
- // The actual plugin constructor
- function Plugin(element, options) {
- this.element = element;
- this.options = $.extend({}, defaults, options);
- this._init();
- } // Plugin()
- // extend that object into Plugin.prototype
- $.extend(Plugin.prototype, plugin_prototype);
- // -------------------------------------------------------
- // attach it to $.fn, and make the plugin voodoo happen:
- $.fn[pluginName] = function (options) {
- if ($(this).length === 0) {
- return false;
- }
- var isMethodCall = (typeof options === 'string'),
- args = Array.prototype.slice.call(arguments, 1);
- // prevent calls to internal methods
- if (isMethodCall && options.substring(0, 1) === '_') {
- return this;
- }
- // handle initialization and non-getter methods
- return this.each(function (z,el) {
- console.log("mmm");
- var instance = $(this).data(pluginName),
- // constructor
- a = (!instance && !isMethodCall && $(this).data(pluginName, new Plugin(el, options))),
- // method call
- b = (instance && isMethodCall && $.isFunction(instance[options]) && instance[options].apply(instance, args));
- });
- };
- })(jQuery);
- var $el = $('.socialFeed')
- $el.derpyDerp3();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement