1 /* 2 * code review by Pavel Yaschenko 3 * 4 * 1. No need to save DOM element (this.indicator). We can use id to get dom element. It helps to avoid memory leaks :) 5 * 6 * 2. Name refactoring: change names acceptClass, rejectClass, draggingClass 7 * to more readable names: getAcceptClass, getRejectClass, getDragClass 8 * 9 */ 10 11 (function ($, rf) { 12 13 rf.ui = rf.ui || {}; 14 15 rf.ui.DragIndicator = function(id, options) { 16 $super.constructor.call(this, id); 17 this.attachToDom(id); 18 19 this.indicator = $(document.getElementById(id)); 20 this.options = options; 21 }; 22 23 var defaultOptions = { 24 }; 25 26 rf.BaseComponent.extend(rf.ui.DragIndicator); 27 var $super = rf.ui.DragIndicator.$super; 28 29 $.extend(rf.ui.DragIndicator.prototype, ( function () { 30 return { 31 show : function() { 32 this.indicator.show(); 33 }, 34 35 hide: function() { 36 this.indicator.hide(); 37 }, 38 39 getAcceptClass: function() { 40 return this.options.acceptClass; 41 }, 42 43 getRejectClass: function() { 44 return this.options.rejectClass; 45 }, 46 47 getDraggingClass: function() { 48 return this.options.draggingClass; 49 }, 50 51 getElement: function() { 52 return this.indicator; 53 } 54 } 55 })()); 56 57 })(RichFaces.jQuery, window.RichFaces); 58 59