assets/js/romo/modal.js in romo-0.14.3 vs assets/js/romo/modal.js in romo-0.14.4

- old
+ new

@@ -6,24 +6,30 @@ var RomoModal = function(element) { this.elem = $(element); this.doInitPopup(); this.romoInvoke = this.elem.romoInvoke()[0]; + this.romoInvoke.doUnBindInvoke(); // disable auto invoke on click - this.elem.unbind('click'); - this.elem.on('click', $.proxy(this.onToggleClick, this)); + if (this.elem.data('romo-modal-disable-click-invoke') !== true) { + this.elem.unbind('click'); + this.elem.on('click', $.proxy(this.onToggleClick, this)); + } this.elem.on('modal:triggerToggle', $.proxy(this.onToggleClick, this)); this.elem.on('modal:triggerPopupOpen', $.proxy(this.onPopupOpen, this)); this.elem.on('modal:triggerPopupClose', $.proxy(this.onPopupClose, this)); this.elem.on('invoke:loadStart', $.proxy(function(e, invoke) { this.doLoadBodyStart(); + return false; }, this)); this.elem.on('invoke:loadSuccess', $.proxy(function(e, data, invoke) { this.doLoadBodySuccess(data); + return false; }, this)); this.elem.on('invoke:loadError', $.proxy(function(e, xhr, invoke) { this.doLoadBodyError(xhr); + return false; }, this)); this.doBindElemKeyUp(); this.doInit(); @@ -162,10 +168,15 @@ }, this), 100); } } RomoModal.prototype.doPopupOpen = function() { - this.romoInvoke.doInvoke(); + if (this.elem.data('romo-modal-content-elem') !== undefined) { + this.doLoadBodySuccess($(this.elem.data('romo-modal-content-elem')).html()) + } else { + this.romoInvoke.doInvoke(); + } + this.popupElem.addClass('romo-modal-open'); this.doPlacePopupElem(); // bind an event to close the popup when clicking away from the // popup. Bind on a timeout to allow time for any toggle