popup.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // XXX This event list should be abstracted somewhere else.
  2. var endTransitionEvents = [
  3. 'webkitTransitionEnd',
  4. 'otransitionend',
  5. 'oTransitionEnd',
  6. 'msTransitionEnd',
  7. 'transitionend'
  8. ].join(' ');
  9. Popup.template.events({
  10. click: function(evt) {
  11. if (evt.originalEvent) {
  12. evt.originalEvent.clickInPopup = true;
  13. }
  14. },
  15. 'click .js-back-view': function() {
  16. Popup.back();
  17. },
  18. 'click .js-close-pop-over': function() {
  19. Popup.close();
  20. },
  21. 'click .js-confirm': function() {
  22. this.__afterConfirmAction.call(this);
  23. }
  24. });
  25. // When a popup content is removed (ie, when the user press the "back" button),
  26. // we need to wait for the container translation to end before removing the
  27. // actual DOM element. For that purpose we use the undocumented `_uihooks` API.
  28. Popup.template.onRendered(function() {
  29. var container = this.find('.content-container');
  30. container._uihooks = {
  31. removeElement: function(node) {
  32. $(node).addClass('no-height');
  33. $(container).one(endTransitionEvents, function() {
  34. node.parentNode.removeChild(node);
  35. });
  36. }
  37. };
  38. });