diff options
author | Hugues Hiegel <root@paranoid> | 2014-08-05 16:46:22 +0200 |
---|---|---|
committer | Hugues Hiegel <root@paranoid> | 2014-08-05 16:46:22 +0200 |
commit | 59478e06c25303a790a0840ab2ac30662c4ef781 (patch) | |
tree | 8d5e964a8f94adaef41efebb0597629f11495c42 /plugins/message_highlight/message_highlight.js | |
parent | 7c494b677f9e470ee0d32e62cfa8dc709f39e748 (diff) |
c'est la merde..working
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..f6b0c58ec --- /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.color = 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' + }); +} |