You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
886 B

  1. openerp.mail_recovery = function (session) {
  2. var mail = session.mail;
  3. mail.ThreadComposeMessage = mail.ThreadComposeMessage.extend({
  4. bind_events: function () {
  5. var self = this;
  6. this.$('textarea').on('focus', self.on_focus_textarea);
  7. this.$('textarea').on('keyup', self.on_keyup_textarea);
  8. this._super();
  9. },
  10. on_focus_textarea: function(event) {
  11. var $input = $(event.target);
  12. if (!$input.val()) {
  13. $input.val(window.localStorage['message_storage']);
  14. }
  15. },
  16. on_keyup_textarea: function(event) {
  17. window.localStorage['message_storage'] = $(event.target).val();
  18. },
  19. on_message_post: function (event) {
  20. window.localStorage['message_storage'] = '';
  21. return this._super(event);
  22. },
  23. });
  24. };