/** * Mark-as-Junk plugin script * * @licstart The following is the entire license notice for the * JavaScript code in this file. * * Copyright (c) The Roundcube Dev Team * Copyright (C) Philip Weir * * The JavaScript code in this page is free software: you can redistribute it * and/or modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * @licend The above is the entire license notice * for the JavaScript code in this file. */ rcube_webmail.prototype.markasjunk_mark=function(a){var c=this.env.uid?[this.env.uid]:this.message_list.get_selection();if(c){var b=this.set_busy(!0,"loading");this.http_post("plugin.markasjunk."+(a?"junk":"not_junk"),this.selection_post_data({_uid:c}),b)}}; rcube_webmail.prototype.markasjunk_move=function(a,c){var b=this.env.uid;this.message_list&&1==c.length&&!this.message_list.in_selection(c[0])&&(this.env.uid=c[0]);a?this.move_messages(a):1==this.env.markasjunk_permanently_remove?this.permanently_remove_messages():this.delete_messages();this.env.uid=b}; rcube_webmail.prototype.markasjunk_toggle_button=function(){var a=$("a.junk"),c=$("a.notjunk"),b={spam:!0,ham:!0};this.env.markasjunk_spam_only?b.ham=!1:!this.is_multifolder_listing()&&this.env.markasjunk_spam_mailbox&&(this.env.mailbox!=this.env.markasjunk_spam_mailbox?b.ham=!1:b.spam=!1);$.each(a,function(f){var e=a.eq(f),d=c.eq(f);f=a.eq(f).index();0d.index()&&d.insertAfter(e))})};rcube_webmail.prototype.markasjunk_is_spam_mbox=function(){return!this.is_multifolder_listing()&&this.env.mailbox==this.env.markasjunk_spam_mailbox}; window.rcmail&&(rcmail.addEventListener("init",function(){rcmail.register_command("plugin.markasjunk.junk",function(){rcmail.markasjunk_mark(!0)},!rcmail.markasjunk_is_spam_mbox()&&rcmail.env.uid);rcmail.register_command("plugin.markasjunk.not_junk",function(){rcmail.markasjunk_mark(!1)},rcmail.env.uid);rcmail.message_list&&rcmail.message_list.addEventListener("select",function(a){rcmail.enable_command("plugin.markasjunk.junk",!rcmail.markasjunk_is_spam_mbox()&&0