1 line
24 KiB
JavaScript
1 line
24 KiB
JavaScript
"use strict";$(document).ready(function(){xmobile.afterReady()});var xmobile=new function(){this.filterActive=false;this.searchActive=false;this.panDirection=false;this.panActionBoxes=false;this.actionRowOpen=false;this.clearSelectionOnPopupHide=false;this.panRefreshAllowed=false;this.contentElements=false;this.legacy=false;this.afterReady=function(){if(typeof skinRunOnReadyBefore=="function"){skinRunOnReadyBefore()}bw.mobile=false;bw.iphone=false;bw.ipad=false;bw.touch=false;if($("div.minwidth").length){this.legacy=true}$("body").removeClass("noscroll");xmobile.contentElements=$("#main-menu, #mainscreen, #planner_controls_container, #planner_items, #filter_bar, #notes, div.minwidth");this.setupGestureMessageView();this.setupGestureRefresh();this.setupXCloud();this.setupXSidebar();this.setupXCalendar();this.setupPopupBoxes();$("a.firstpage, a.prevpage,"+"a.nextpage, a.lastpage,"+"a.listbutton.add span.inner,"+"a.listbutton.delete span.inner,"+"a.listbutton.removegroup span.inner").text("");$("#interface-options a").on("click",function(ev){xmobile.popupHide(ev)});$("#attachment-list .delete").html("");if($("#messagelistcontainer").length){$("#messagelistcontainer").before("<div id='current-folder'><span></span></div>");xmobile.updateCurrentFolder()}$("#mailboxlist li a").click(function(ev){xmobile.updateCurrentFolder();xmobile.popupHide(ev)});if($("#rcmlistfilter").length){this.filterActive=$("#rcmlistfilter").val()!="ALL";this.updateFunnel()}if($("#messagelistcontainer").length){xmobile.setMailTimeout()}if($("#messagecontent .rightcol").length){$("#messagecontent .leftcol").after($("#messagecontent .rightcol"))}rcmail.addEventListener("aftermove",function(ev){xmobile.addFolderSelectorHeader()});rcmail.addEventListener("aftercopy",function(ev){xmobile.addFolderSelectorHeader()});if($(".btn-sectionslist").length){setTimeout(function(){rcmail.section_select(new settingsLoader("general"))},500)}if($("#compose-contacts .boxfooter a").length){$("#compose-contacts .boxfooter a").on("click",function(ev){xmobile.popupHide(ev)})}if($("#header h5 select.deco").length){$("#header h5 select.deco").on("click",function(ev){ev.stopPropagation()})}if($(".remotehint")){setTimeout(function(){$(".remotehint").fadeOut()},3e3)}$(".calendar-page #sectionslist .boxtitle.ui-widget-header a").on("click",function(){xmobile.showCalendarOld("calendar")});if($("#groupoptionslink span.inner").length){$("#groupoptionslink span.inner").html("")}if($("#keyoptionslink span.inner").length){$("#keyoptionslink span.inner").html("")}if(typeof skinRunOnReadyAfter=="function"){skinRunOnReadyAfter()}if($("#composeoptions").length){$("#composeoptions select[name=editorSelector]").parents("span.composeoption").hide()}if($("#plugin-ident_switch-account").length){$("#plugin-ident_switch-account").prependTo("#taskbar").show()}if(this.legacy){this.setupLegacy()}};this.addFolderSelectorHeader=function(){if(!$("#folder-selector h5").length){xmobile.addPopupTitle($("#folder-selector"),rcmail.gettext("folders"));xmobile.addPopupCloseButtonBar($("#folder-selector"));$("#folder-selector").on("mouseup",function(ev){xmobile.popupHide(ev)})}};this.setupPopupBoxes=function(){this.makePopup($("#header"),false);this.makePopup($("#mailview-left"),false);this.makePopup($("#quicksearchbar"),false);this.makePopup($("#mailtoolbar"),false);this.makePopup($("#messagetoolbar"));this.makePopup($("#settings-sections"),false);this.makePopup($("#addressbooktoolbar"));this.makePopup($("#composeview-left"),false);this.makePopup($("#groupoptions"),false);this.makePopup($("#mailboxmenu"),false);this.makePopup($("#listselectmenu"),false);this.makePopup($("#filtersetmenu-menu"));this.makePopup($("#filtermenu-menu"));$("#filtersetmenulink").attr("onclick","xmobile.popup(event, 'filtersetmenu-menu')");$("#filtermenulink").attr("onclick","xmobile.popup(event, 'filtermenu-menu')");$("#filtersetslistbox a.add").text($("#filtersetslistbox a.add").attr("title")).appendTo("#filtersetmenu-menu");$("#filterslistbox a.add").text($("#filterslistbox a.add").attr("title")).appendTo("#filtermenu-menu");$("#quicksearchbar").appendTo("body");$("#mailview-left").appendTo("body");$("#messagetoolbar").appendTo("body");if($("#mailboxmenulink").length){$("#mailboxmenulink").attr("onclick","xmobile.popup(event, 'mailboxmenu')");this.addPopupTitle($("#mailboxmenu"),$("#mailboxmenulink").attr("title").replace("...",""))}this.addPopupTitle($("#listselectmenu"),$("#listselectmenulink").text());this.addPopupTitle($("#markmessagemenu"),$("#markmessagemenulink").text());this.addPopupTitle($("#messagemenu"),$("#messagemenulink").text());this.addPopupTitle($("#replyallmenu"),$(".button.reply").text());this.addPopupTitle($("#forwardmenu"),$(".button.forward").text());this.addPopupTitle($("#mailview-left"),rcmail.gettext("folders"));this.addPopupTitle($("#header"),$("#topline .username").html());this.addPopupTitle($("#quicksearchbar"),rcmail.gettext("search"));this.addPopupTitle($("#attachmentmenu"),rcmail.gettext("attachment"));this.addPopupTitle($("#settings-sections"),rcmail.gettext("section"));this.addPopupTitle($("#mailtoolbar"),rcmail.gettext("options"));this.addPopupTitle($("#composeview-left"),$("#composeview-left h2.boxtitle").text());this.addPopupTitle($("#responsesmenu"),$("#responsesmenu li.separator:first label").text());this.addPopupTitle($("#addressbooktoolbar"),rcmail.gettext("options"));this.addPopupTitle($("#groupoptions"),$("#aria-label-groupoptions").text());this.addPopupTitle($("#keyoptions"),$("#keyoptionslink").attr("title"));this.addPopupTitle($("#enigmamenu"),$(".button.enigma").text());if($("a#spellmenulink").length){this.addPopupTitle($("#spellmenu"),$("a#spellmenulink").text())}else{this.addPopupTitle($("#spellmenu"),$("#mailtoolbar a.spellcheck").attr("title"))}if($(".calendar-page").length){this.addPopupTitle($("#messagetoolbar"),rcmail.gettext("options"))}else{this.addPopupTitle($("#messagetoolbar"),$("#taskbar .button-mail .button-inner").text())}$(".popupmenu").addClass("popup-box");if($("#groupoptionslink").length){$("#groupoptionslink").attr("onclick","xmobile.popup(event, 'groupoptions')")}if($("#keyoptionslink").length){$("#keyoptionslink").attr("onclick","xmobile.popup(event, 'keyoptions')")}if($("#attachment-list a.drop").length){setTimeout(function(){$("#attachment-list a.drop").off("click").attr("onclick","xmobile.popup(event, 'attachmentmenu')")},0)}$("#popup-funnel").append("<a id='button-selectmenu' href='javascript:void(0)' onclick='xmobile.popup(event, \"listselectmenu\")'>"+"<span>"+$("#listselectmenu h5").text()+"</span>"+"</a>"+"<a id='button-mailboxmenu' href='javascript:void(0)' onclick='xmobile.popup(event, \"mailboxmenu\")'>"+"<span>"+$("#mailboxmenu h5").text()+"</span>"+"</a>"+"<a id='button-listoptions' href='javascript:void(0)' onclick='return rcmail.command(\"menu-open\", \"messagelistmenu\", this, event);'>"+"<span>"+$("#listoptions h2").text()+"</span>"+"</a>");$(".popup-box a").each(function(){var element=$(this);var onclick=element.attr("onclick");if(typeof onclick!="undefined"&&(onclick.indexOf("toggle_popup")!=-1||onclick.indexOf("show_popup")!=-1||onclick.indexOf("command('move'")!=-1||onclick.indexOf("command('copy'")!=-1||onclick.indexOf("enigmamenu")!=-1)){element.on("click",function(ev){xmobile.popupDisappear(ev);setTimeout(function(){$(".popupmenu").addClass("popup-box");if(!$("#spellmenu").hasClass("processed")){$("#spellmenu").addClass("processed");$("#spellmenu a").on("click",function(ev){xmobile.popupHide(ev)})}},0)})}});$(".button-interface-options").on("click",function(ev){xmobile.popupDisappear(ev)});this.addPopupCloseButtonBar($(".popup-box"));if($(".login-page #header").length){$("#login-form").after("<a id='login-menu-button' href='javascript:void(0)' onclick='xmobile.popup(event, \"header\")'></a>")}if($("#composebody").length){var toolbarName=$("#mailtoolbar").length?"mailtoolbar":"messagetoolbar";$("#main-menu").append("<a id='button-toolbar' href='javascript:void(0)' onclick='xmobile.popup(event, \""+toolbarName+"\")'><span></span></a>");$("#popup-compose-settings").append($("#composeheaders .formlinks").html());$("#composeheaders .formlinks").html("");$("#popup-compose-settings a").each(function(){$(this).attr("onclick",$(this).attr("onclick").replace("UI.show_header_row","xmobile.toggleCC"))});$("#popup-compose-settings").append($(".compose-headers a.iconlink.edit"))}var filterSelect=false;if($("#rcmlistfilter").length){filterSelect="#rcmlistfilter"}else if($("#searchfilter").length){filterSelect="#searchfilter"}if(filterSelect){$(filterSelect+" option").each(function(){$("#popup-filter").append("<a href='javascript:void(0)' onclick='xmobile.applyFilter(event, \""+$(this).val()+"\")'>"+$(this).text()+"</a>")})}if($("#quicksearchbar").length){$("#quicksearchbar form").after($("#searchmenu ul"));$("#quicksearchbar ul").after("<a class='search-apply' href='javascript:void(0)' onclick='xmobile.applySearch(event, this)'>"+rcmail.gettext("search")+"</a>"+"<a class='search-reset' href='javascript:void(0)' onclick='xmobile.resetSearch(event, this)'>"+$("#searchreset").attr("title")+"</a>");$("#quicksearchbar form").attr("onsubmit","xmobile.applySearch(event); return false;")}$(".popupmenu").addClass("click-close");$(".popup-box.click-close").on("click",function(ev){xmobile.popupHide(ev)});$(".popup-box select, .popup-box input[type='checkbox']").on("click",function(ev){ev.stopPropagation()});$("#interface-options select").on("mouseup",function(ev){ev.stopPropagation()});if($("#summarytable").length){$("#summarytable").html($("#summarytable").html().replace(/ /g,""))}if($("#enigmakeyslist").length){$("#keyoptions ul.toolbarmenu").append($("<li>").append($("#keystoolbar a.import")));$("#keyoptions ul.toolbarmenu").append($("#exportmenu-menu li"))}if($("#countcontrols").length){$("#pagejumper").appendTo("#countcontrols")}};this.setupLegacy=function(){$("div.minwidth .popup-box").each(function(){$("body").append($(this))});$("#markmessagemenu a").each(function(){$(this).on("click",function(){xmobile.popupHide()})})};this.setupXCalendar=function(){xmobile.makePopup($("#xcalendar-toolbar"));xmobile.makePopup($("#add-calendar-menu"));xmobile.makePopup($("#event-options"));xmobile.makePopup($("#remove-options"));$("#calendar-list-container .boxtitle button").attr("onclick","xmobile.popup(event, 'add-calendar-menu')");$("#event-preview .button-options").attr("onclick","xmobile.popup(event, 'event-options')");$("#event-preview .button-remove-repeated").attr("onclick","xmobile.popup(event, 'remove-options')");xmobile.addPopupTitle($("#xcalendar-toolbar"),rcmail.gettext("options"));xmobile.addPopupTitle($("#add-calendar-menu"),rcmail.gettext("options"));xmobile.addPopupTitle($("#event-options"),rcmail.gettext("options"));xmobile.addPopupTitle($("#remove-options"),rcmail.gettext("options"))};this.setupXCloud=function(){$(".xcloud-compose-button input, .xcloud-compose-button a.button").each(function(){var menu=$(this).parent().attr("id").replace("button","menu");xmobile.makePopup($("#"+menu),false);xmobile.addPopupTitle($("#"+menu),$(this).is("a")?$(this).text():$(this).attr("value"));$(this).attr("onclick","xmobile.popup(event, '"+menu+"')")})};this.setupXSidebar=function(){$("#xsidebar .box-wrap").each(function(){xmobile.makePopup($(this),false);$(this).addClass("sidebar-popup overlay-popup");$("<a>").attr("href","javascript:void(0)").attr("onclick","xmobile.popup(event, '"+$(this).attr("id")+"')").text($(this).find(".boxtitle").text()).insertBefore(".button-logout")})};this.makePopup=function(element,clickClose,popupId){if(!element.length){return}if(typeof clickClose==="undefined"){clickClose=true}element.removeClass().addClass("popup-box");element.removeClass("toolbar");if(clickClose){element.addClass("click-close")}if(typeof popupId!="undefined"){element.attr("id",popupId)}element.appendTo("body")};this.addPopupCloseButtonBar=function(element){if(element.length){element.prepend("<div class='popup-close'>"+"<a href='javascript:void(0)' onclick='xmobile.popupHide(event, true, this)'></a>"+"</div>")}};this.addPopupTitle=function(element,title){if(!element.length){return}var code="<h5>"+title+"</h5>";if(element.find(".popup-close").length){element.find(".popup-close").after(code)}else{element.prepend(code)}};this.popup=function(ev,id,onready){if($("#"+id+":visible").length){this.popupHide(ev,true);return}if(id=="messagetoolbar"){if($("#markmessagemenu-menu li a:first").attr("aria-disabled")=="true"){$("#markmessagemenulink, #messagemenulink").addClass("disabled")}else{$("#markmessagemenulink, #messagemenulink").removeClass("disabled")}}var box=$("#"+id);if($(".popup-box:visible").length){if(!box.hasClass("overlay-popup")){$(".popup-box").fadeOut()}box.fadeIn();return}$(".popup-box").hide();setTimeout(function(){box.show();$("body").addClass("popup-visible");var partialWidth=105;var width=xmobile.contentElements.outerWidth();xmobile.contentElements.addClass("moved-container").animate({left:width-partialWidth,right:(width-partialWidth)*-1},300,"swing",onready)},0)};this.popupHide=function(ev,slide,closeButton){slide=typeof slide!=="undefined"?slide:false;if(typeof ev!=="undefined"){ev.stopPropagation()}var popup=typeof closeButton!=="undefined"?$(closeButton).parents(".popup-box"):false;if($(".popup-box:visible").length>1&&popup){popup.hide();return}$("body").removeClass("popup-visible");if(slide){xmobile.contentElements.removeClass("moved-container").animate({left:0,right:0},300,"swing",function(){$(".popup-box").hide()})}else{xmobile.contentElements.removeClass("moved-container").css("left",0).css("right",0);$(".popup-box").hide()}};this.popupDisappear=function(ev){$(ev.target).parents(".popup-box").hide();ev.stopPropagation()};this.setMailTimeout=function(){xmobile.mailTimer=setTimeout("xmobile.mailTimout()",1e3)};this.mailTimout=function(){xmobile.fixMessageList();xmobile.setMailTimeout()};this.fixMessageList=function(){var firstRow=$("#messagelist tr.message:first");if(!firstRow.length||firstRow.hasClass("processed")){return}firstRow.addClass("processed");var newListFormat=$("#aria-label-messagelist").length;$("#messagelist tr.message").each(function(){if(newListFormat){var rowId=$(this).attr("id");var uid=rcmail.message_list.list.rows[rowId].uid;rcmail.message_list.list.rows[rowId].onmousedown=null;rcmail.message_list.list.rows[rowId].onmouseup=null;$(this).removeAttr("onmouseup").removeAttr("onmousedown").unbind();rcmail.message_list.list.rows[rowId].onclick=function(e){rcmail.message_list.select_row(uid,CONTROL_KEY,true)};xmobile.setupGestureMessageActions(rowId)}else{var uid=$(this).attr("id").substr(6);$(this).removeAttr("onmouseup").removeAttr("onmousedown").unbind().click(function(){rcmail.message_list.select_row(uid,CONTROL_KEY,true)})}if(!$(this).find(".subject a").length){var subject=$(this).find(".subject");subject.hide();subject.html(subject.html().replace("</span>","</span><a href='./?_task=mail&_action=show&_mbox="+rcmail.env.mailbox+"&_uid="+uid+"'>")+"</a>");subject.show()}if($(this).find(".fromto").length){$(this).find(".from").remove();$(this).find(".to").remove()}else if($(this).find(".from").length){$(this).find(".to").remove()}});$("#messagelist .subject a").removeAttr("onclick");$("#messagelist .subject a").removeAttr("onmouseover");$("#messagelist .subject a").on("click",function(e){e.stopPropagation()});var search_mods=rcmail.env.search_mods[rcmail.env.mailbox]?rcmail.env.search_mods[rcmail.env.mailbox]:rcmail.env.search_mods["*"];for(var n in search_mods){$("#s_mod_"+n).attr("checked",true)}$("#messagelistcontainer").append($("#countcontrols"))};this.updateFunnel=function(){$("#button-funnel").toggleClass("active",this.searchActive||this.filterActive);$(".funnel-filter").toggleClass("active",this.filterActive);$(".funnel-search").toggleClass("active",this.searchActive);if(this.searchActive||this.filterActive){this.blink($("#button-funnel span"))}};this.applySearch=function(ev,element){this.searchActive=true;rcmail.command("search","",element);xmobile.updateFunnel(true);xmobile.popupHide(ev)};this.resetSearch=function(ev,element){this.searchActive=false;rcmail.command("reset-search","",element,ev);xmobile.updateFunnel();xmobile.popupHide(ev)};this.applyFilter=function(ev,value){this.filterActive=value!="ALL";rcmail.filter_mailbox(value);xmobile.updateFunnel();xmobile.popupHide(ev)};this.blink=function(element){element.fadeOut("slow",function(){element.fadeIn("slow",function(){element.fadeOut("slow",function(){element.fadeIn("slow")})})})};this.updateCurrentFolder=function(){$("#current-folder span").html($("#mailboxcontainer li.selected a").html())};this.toggleCC=function(rowType){var style=$("#compose-"+rowType).attr("style");if(typeof style=="undefined"||style=="display: none;"){UI.show_header_row(rowType)}else{UI.hide_header_row(rowType)}};this.setupGestureRefresh=function(){if(!$("#messagelist").length||!$("#mainscreencontent").length){return}var limit=50;var target=$("#mainscreencontent");var screen=$("#mainscreen");var scroll=$("#messagelistcontainer");var hm=new Hammer(document.getElementById("mainscreencontent"));hm.on("hammer.input",function(ev){if(ev.direction!=Hammer.DIRECTION_NONE&&ev.direction!=Hammer.DIRECTION_UP&&ev.direction!=Hammer.DIRECTION_DOWN){return}var delta=ev.deltaY;if(delta>limit){delta=limit}if(delta<0){delta=0}if(ev.isFirst){if(!scroll.scrollTop()){xmobile.panRefreshAllowed=true}return}if(ev.isFinal){if(!xmobile.panRefreshAllowed){return}var restore=function restore(){target.css("top",0).removeClass("gesture-refresh");screen.removeClass("refresh").removeClass("ready");scroll.css("overflow-y","auto");$(window).unbind("touchmove");xmobile.panRefreshAllowed=false};if(delta>=limit){rcmail.command("checkmail","",this,ev);setTimeout(restore,400)}else{setTimeout(restore,0)}return}if(ev.direction==Hammer.DIRECTION_DOWN){if(!xmobile.panRefreshAllowed){return}$(window).bind("touchmove",function(e){e.preventDefault()});screen.addClass("refresh");if(delta==limit){screen.addClass("ready")}scroll.css("overflow-y","hidden");target.addClass("gesture-refresh");target.css("top",delta);return}if(ev.direction==Hammer.DIRECTION_UP){if(!xmobile.panRefreshAllowed){return}target.css("top",delta);if(delta<limit){screen.removeClass("ready")}return}})};this.setupGestureMessageView=function(){if(!$("#messagecontent").length){return}var readyThreshold=70;var content=$("#mainscreencontent");var target=$("#messageheader");var background=$("#mailview-right");var screen=$("#mainscreen");target.hammer({direction:Hammer.DIRECTION_HORIZONTAL,threshold:10}).bind("pan",function(ev){if(ev.gesture.offsetDirection==Hammer.DIRECTION_LEFT){var direction="prev"}else if(ev.gesture.offsetDirection==Hammer.DIRECTION_RIGHT){var direction="next"}else{return}var disabled=direction=="prev"&&$(".prevpage").hasClass("disabled")||direction=="next"&&$(".nextpage").hasClass("disabled");background.addClass("gesture-pan");var delta=ev.gesture.deltaX;if(delta>readyThreshold){delta=readyThreshold}if(delta<readyThreshold*-1){delta=readyThreshold*-1}if(ev.gesture.isFinal){if(!disabled&&Math.abs(delta)==readyThreshold){content.fadeOut(200,function(){screen.addClass("progress");setTimeout(function(){rcmail.command(direction=="prev"?"previousmessage":"nextmessage","",this,"click")},100)});return}target.css("left",0);target.css("right",0);background.removeClass("gesture-pan");return}if(direction=="prev"){background.removeClass("next")}else{background.removeClass("prev")}background.addClass(direction);if(disabled){background.addClass("disabled")}else{background.removeClass("disabled");if(Math.abs(delta)==readyThreshold){background.addClass("ready")}else{background.removeClass("ready")}}target.css("left",delta);target.css("right",delta*-1)})};this.selectMessage=function(ev,rowId){rcmail.message_list.select_row(rcmail.message_list.list.rows[rowId].uid,"",true)};this.deleteMessage=function(ev,rowId){xmobile.selectMessage(ev,rowId);rcmail.command("delete","",this,ev);rcmail.message_list.clear_selection();$("#mal-"+rowId).hide()};this.flagMessage=function(ev,rowId){this.selectMessage(ev,rowId);rcmail.command("mark","flagged",this,ev);rcmail.message_list.clear_selection();$("#mal-"+rowId).addClass("flagged");this.hideMessageActions(rowId)};this.unflagMessage=function(ev,rowId){this.selectMessage(ev,rowId);rcmail.command("mark","unflagged",this,ev);rcmail.message_list.clear_selection();$("#mal-"+rowId).removeClass("flagged");this.hideMessageActions(rowId)};this.markMessageAsRead=function(ev,rowId){this.selectMessage(ev,rowId);rcmail.command("mark","read",this,ev);rcmail.message_list.clear_selection()};this.markMessageAsUnread=function(ev,rowId){this.selectMessage(ev,rowId);rcmail.command("mark","unread",this,ev);rcmail.message_list.clear_selection()};this.showMoreOnMessage=function(ev,rowId){this.selectMessage(ev,rowId);this.clearSelectionOnPopupHide=true;this.hideMessageActions(rowId);xmobile.popup(ev,"messagetoolbar")};this.hideMessageActions=function(rowId){$("#"+rowId).animate({width:$("#messagelist").width()},300)};this.setupGestureMessageActions=function(rowId){var row=$("#"+rowId);var leftBox=$("<div />").addClass("message-action-read").attr("id","mar-"+rowId);var rightBox=$("<div class='message-action-links'>"+"<a class='mal-more' href='javascript:void(0)' onclick='xmobile.showMoreOnMessage(event, \""+rowId+"\")'></a>"+"<a class='mal-flag' href='javascript:void(0)' onclick='xmobile.flagMessage(event, \""+rowId+"\")'></a>"+"<a class='mal-unflag' href='javascript:void(0)' onclick='xmobile.unflagMessage(event, \""+rowId+"\")'></a>"+"<a class='mal-delete' href='javascript:void(0)' onclick='xmobile.deleteMessage(event, \""+rowId+"\")'></a>"+"</div>").attr("id","mal-"+rowId);if(row.hasClass("flagged")){rightBox.addClass("flagged")}if(row.hasClass("unread")){leftBox.addClass("unread")}row.before(rightBox);row.before(leftBox);row.hammer({direction:Hammer.DIRECTION_HORIZONTAL,threshold:30}).bind("pan",function(ev){var fullWidth=$("#messagelist").width();if(ev.gesture.offsetDirection==Hammer.DIRECTION_LEFT){var direction="right"}else if(ev.gesture.offsetDirection==Hammer.DIRECTION_RIGHT){var direction="left"}else{return}if(!xmobile.panDirection){xmobile.panDirection=direction;if(fullWidth==row.width()&&xmobile.panDirection=="right"){xmobile.panActionBoxes="left";$("#mar-"+rowId).show()}else{xmobile.panActionBoxes="right";$("#mal-"+rowId).show()}}var delta=ev.gesture.deltaX;var boxWidth=xmobile.panActionBoxes=="left"?60:180;if(xmobile.panDirection=="left"&&delta<boxWidth*-1){delta=boxWidth*-1}if(xmobile.panDirection=="right"&&delta>boxWidth){delta=boxWidth}if(xmobile.panDirection=="left"&&delta>0||xmobile.panDirection=="right"&&delta<0){delta=0}if(ev.gesture.isFinal){if(xmobile.panActionBoxes=="left"){if(delta>50){if($("#mar-"+rowId).hasClass("unread")){xmobile.markMessageAsRead(ev,rowId);row.animate({"margin-left":0},100,"swing",function(){$("#mar-"+rowId).removeClass("unread")})}else{xmobile.markMessageAsUnread(ev,rowId);row.animate({"margin-left":0},100,"swing",function(){$("#mar-"+rowId).addClass("unread")})}}else{row.animate({"margin-left":0},100)}}else{if(direction=="left"){if(row.width()<fullWidth-boxWidth*.3){if(xmobile.actionRowOpen&&xmobile.actionRowOpen!=rowId){xmobile.hideMessageActions(xmobile.actionRowOpen)}xmobile.actionRowOpen=rowId;row.animate({width:fullWidth-boxWidth},100)}else{row.animate({width:fullWidth},100,"swing",function(){row.css("width","100%")});$("#mal-"+rowId).hide()}}else{if(row.width()>fullWidth-boxWidth*.7){row.animate({width:fullWidth},100,"swing",function(){row.css("width","100%")});xmobile.actionRowOpen=false;$("#mal-"+rowId).hide()}else{row.animate({width:fullWidth-boxWidth},100)}}}xmobile.panDirection=false;xmobile.panActionBoxes=false;return}if(xmobile.panActionBoxes=="left"){row.css("margin-left",delta+"px")}else{if(xmobile.panDirection=="left"){if(row.width()>fullWidth-boxWidth){row.width(fullWidth+delta)}}else{if(row.width()<fullWidth){row.width(fullWidth-boxWidth+delta)}}}})}};function settingsLoader(value){this.value=value;this.get_single_selection=function(){return this.value}} |