Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. /**
  2. * Class Prototype ${USER} ${DATE}
  3. */
  4. /* global Utils */
  5. 'use strict';
  6.  
  7.  
  8. (function ($, context) {
  9. var ${className} = context.${className} = function () {
  10. this.init.apply(this, arguments);
  11. };
  12.  
  13. ${className}.prototype = {
  14. constructor: ${className}.prototype.constructor,
  15. options: {
  16.  
  17. },
  18.  
  19. /**
  20. * Constructor
  21. */
  22. init: function (element, options) {
  23. this.options = $.extend(true, {}, this.options, options, Utils.getOptionsFromDom('${className.toLowerCase()}', element));
  24. this.${DS}element = $(element);
  25. this.create();
  26. this.events();
  27. },
  28.  
  29. /**
  30. * Create dom and init dom references to this
  31. */
  32. create: function () {
  33. },
  34.  
  35. /**
  36. * Init all events
  37. */
  38. events: function () {
  39. }
  40. };
  41.  
  42. //jquery plugin implementation
  43. $.fn.${className.substring(0,1).toLowerCase()}${className.substring(1)} = function(options) {
  44. return this.each(function() {
  45. if(!$(this).data('${className}-plugin')) {
  46. $(this).data('${className}-plugin', new ${className}(this, options));
  47. }
  48. });
  49. };
  50. })(jQuery, window);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement