diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2013-09-12 11:35:26 +0200 |
---|---|---|
committer | Hugues Hiegel <root@paranoid> | 2013-11-08 17:40:16 +0100 |
commit | 31de4bc5ebf9556817554ae9630ca06e92fd7218 (patch) | |
tree | f98afd42b6f4f818b3f4c489b2e6a7b3912dbb93 /plugins/message_highlight/message_highlight.js | |
parent | ef14bd0d8d58ae0f57aa1969e31a5373aa441dba (diff) |
Updates / Plugins
Diffstat (limited to 'plugins/message_highlight/message_highlight.js')
-rw-r--r-- | plugins/message_highlight/message_highlight.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/message_highlight/message_highlight.js b/plugins/message_highlight/message_highlight.js new file mode 100644 index 000000000..167432d2d --- /dev/null +++ b/plugins/message_highlight/message_highlight.js @@ -0,0 +1,58 @@ +var mh_cur_row; + +$(document).ready(function() { + if(window.rcmail) { + + rcmail.addEventListener('plugin.mh_receive_row', mh_receive_row); + + rcmail.addEventListener('insertrow', function(evt) { + var message = rcmail.env.messages[evt.row.uid]; + + // check if our color info is present + if(message.flags && message.flags.plugin_mh_color) { + $(evt.row.obj).addClass('rcmfd_mh_row'); + evt.row.obj.style.backgroundColor = message.flags.plugin_mh_color; + } + }); + + + $('.mh_delete').live('click', function() { + mh_delete(this); + }); + + $('.mh_add').live('click', function() { + mh_add(this); + }); + } +}); + + +function mh_delete(button) { + if(confirm(rcmail.get_label('message_highlight.deleteconfirm'))) { + $(button).closest('tr', '#prefs-details').remove(); + } +} + +// do an ajax call to get a new row +function mh_add(button) { + mh_cur_row = $(button).closest('tr', '#prefs-details'); + lock = rcmail.set_busy(true, 'loading'); + rcmail.http_request('plugin.mh_add_row', '', lock); +} + +// ajax return call +function mh_receive_row(data) { + var row = data.row; + $(mh_cur_row).after('<tr><td>'+row+'</td></tr>'); + //$('.mh_color_input:last').mColorPicker(); + + $('input[data-mcolorpicker!="true"]').filter(function() { + return ($.fn.mColorPicker.init.replace == '[type=color]')? this.getAttribute("type") == 'color': $(this).is($.fn.mColorPicker.init.replace); + }).mColorPicker({ + imageFolder: 'plugins/message_highlight/colorpicker/images/', + allowTransparency: false, + showLogo: false, + liveEvents: false, + checkRedraw: 'ajaxSuccess' + }); +} |