/** * 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 n,e=this.env.uid?[this.env.uid]:this.message_list.get_selection();e&&(n=this.set_busy(!0,"loading"),this.http_post("plugin.markasjunk."+(a?"junk":"not_junk"),this.selection_post_data({_uid:e}),n))},rcube_webmail.prototype.markasjunk_move=function(a,n){var e=this.env.uid;this.message_list&&1==n.length&&!this.message_list.in_selection(n[0])&&(this.env.uid=n[0]),a?this.move_messages(a):1==this.env.markasjunk_permanently_remove?this.permanently_remove_messages():this.delete_messages(),this.env.uid=e},rcube_webmail.prototype.markasjunk_toggle_button=function(){var m=$("a.junk"),s=$("a.notjunk"),t={spam:!0,ham:!0};this.env.markasjunk_spam_only?t.ham=!1:!this.is_multifolder_listing()&&this.env.markasjunk_spam_mailbox&&(this.env.mailbox!=this.env.markasjunk_spam_mailbox?t.ham=!1:t.spam=!1),$.each(m,function(a){var n=m.eq(a),e=s.eq(a),i=m.eq(a).index();0e.index()&&e.insertAfter(n))})},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