Add files via upload
This commit is contained in:
parent
6143d6853c
commit
f7b0a8c045
1 changed files with 20 additions and 369 deletions
389
elastic2022/ui.min.js
vendored
389
elastic2022/ui.min.js
vendored
|
@ -11,17 +11,6 @@
|
|||
* @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
log = function() { return Function.prototype.bind.call(console.log, console);}();
|
||||
warn = function() { return Function.prototype.bind.call(console.warn, console);}();
|
||||
error = function() { return Function.prototype.bind.call(console.error, console);}();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
"use strict";
|
||||
|
||||
function rcube_elastic_ui()
|
||||
|
@ -59,7 +48,7 @@ function rcube_elastic_ui()
|
|||
},
|
||||
buttons = {
|
||||
menu: $('a.task-menu-button'),
|
||||
//back_sidebar: $('a.back-sidebar-button'),
|
||||
back_sidebar: $('a.back-sidebar-button'),
|
||||
back_list: $('a.back-list-button'),
|
||||
back_content: $('a.back-content-button'),
|
||||
};
|
||||
|
@ -80,7 +69,7 @@ function rcube_elastic_ui()
|
|||
this.searchmenu = searchmenu;
|
||||
this.headersmenu = headersmenu;
|
||||
this.header_reset = header_reset;
|
||||
// this.compose_status = compose_status;
|
||||
this.compose_status = compose_status;
|
||||
this.attachmentmenu = attachmentmenu;
|
||||
this.mailtomenu = mailtomenu;
|
||||
this.recipient_selector = recipient_selector;
|
||||
|
@ -95,7 +84,7 @@ function rcube_elastic_ui()
|
|||
this.pretty_select = pretty_select;
|
||||
this.datepicker_init = datepicker_init;
|
||||
this.bootstrap_style = bootstrap_style;
|
||||
//this.toggle_list_selection = toggle_list_selection;
|
||||
this.toggle_list_selection = toggle_list_selection;
|
||||
this.get_screen_mode = get_screen_mode;
|
||||
this.is_mobile = is_mobile;
|
||||
this.is_touch = is_touch;
|
||||
|
@ -153,11 +142,8 @@ function rcube_elastic_ui()
|
|||
});
|
||||
|
||||
// menu/sidebar/list button
|
||||
//buttons.menu.on('click', function() { app_menu(true); return false; });
|
||||
//buttons.back_sidebar.on('click', function() { show_sidebar(); return false; });
|
||||
|
||||
buttons.menu.on('click', function() { show_sidebar(); return false; });
|
||||
|
||||
buttons.menu.on('click', function() { app_menu(true); return false; });
|
||||
buttons.back_sidebar.on('click', function() { show_sidebar(); return false; });
|
||||
buttons.back_list.on('click', function() { show_list(); return false; });
|
||||
buttons.back_content.on('click', function() { show_content(true); return false; });
|
||||
|
||||
|
@ -183,7 +169,6 @@ function rcube_elastic_ui()
|
|||
}
|
||||
|
||||
// Add content frame toolbar in the footer, for content buttons and navigation
|
||||
/*
|
||||
if (!is_framed && layout.content.length && !layout.content.is('.no-navbar')
|
||||
&& !layout.content.children('.frame-content').length
|
||||
) {
|
||||
|
@ -193,28 +178,8 @@ function rcube_elastic_ui()
|
|||
.append($('<span class="buttons">'))
|
||||
.append($('<a class="button next">')
|
||||
.append($('<span class="inner"></span>').text(rcmail.gettext('next'))))
|
||||
|
||||
.appendTo(layout.content);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
console.log(mode)
|
||||
console.log(UI)
|
||||
console.log(document.URL)
|
||||
*/
|
||||
|
||||
//console.log(rcmail.env.action)
|
||||
if(rcmail.env.action=="preview")
|
||||
{
|
||||
setTimeout(function() {
|
||||
var mode = UI.get_screen_mode()
|
||||
if (mode == 'small' || mode == 'phone') {$('.sebmenu', window.parent.document).hide();}
|
||||
else $('.sebmenu', window.parent.document).show();
|
||||
}, 1);
|
||||
}
|
||||
|
||||
|
||||
// Move some buttons to the frame footer toolbar
|
||||
$('a[data-content-button]').each(function() {
|
||||
|
@ -516,9 +481,10 @@ if(rcmail.env.action=="preview")
|
|||
.addEventListener('enable-command', enable_command_handler)
|
||||
.addEventListener('destroy-entity-selector', function(o) { menu_destroy(o.name); })
|
||||
.addEventListener('clonerow', pretty_checkbox_fix)
|
||||
.addEventListener('init', init)
|
||||
.addEventListener('init', init);
|
||||
|
||||
if (layout.list.length || layout.content.length) {
|
||||
// Create floating action button(s)
|
||||
if ((layout.list.length || layout.content.length) && is_mobile()) {
|
||||
var fabuttons = [];
|
||||
|
||||
$('[data-fab]').each(function() {
|
||||
|
@ -575,19 +541,17 @@ if(rcmail.env.action=="preview")
|
|||
// Enable checkbox selection on list widgets
|
||||
rcmail[list].enable_checkbox_selection();
|
||||
|
||||
//if (get_pref('list-selection') === true) {
|
||||
if (get_pref('list-selection') === true) {
|
||||
table.addClass('withselection');
|
||||
//}
|
||||
}
|
||||
|
||||
// Add Select button to the list navigation bar
|
||||
if (!button) {
|
||||
/*
|
||||
button = $('<a>').attr({'class': 'button selection disabled', role: 'button', title: rcmail.gettext('select')})
|
||||
.on('click', function() { UI.toggle_list_selection(this, table.attr('id')); })
|
||||
.append($('<span class="inner">').text(rcmail.gettext('select')));
|
||||
*/
|
||||
if (toolbar.is(
|
||||
'.menu')) {
|
||||
|
||||
if (toolbar.is('.menu')) {
|
||||
button.prependTo(toolbar).wrap('<li role="menuitem">');
|
||||
|
||||
// Add a button to the content toolbar menu too
|
||||
|
@ -620,7 +584,6 @@ if(rcmail.env.action=="preview")
|
|||
button.removeClass('active').addClass('disabled').attr('tabindex', -1);
|
||||
}
|
||||
}
|
||||
listupdate_go_msgs()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -725,7 +688,6 @@ if(rcmail.env.action=="preview")
|
|||
});
|
||||
|
||||
// Update compose status bar on attachments list update
|
||||
/*
|
||||
if (window.MutationObserver) {
|
||||
var observer, list = $('#attachment-list'),
|
||||
status_callback = function() { compose_status('attach', list.children().length > 0); };
|
||||
|
@ -734,7 +696,6 @@ if(rcmail.env.action=="preview")
|
|||
observer.observe(list[0], {childList: true});
|
||||
status_callback();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
// In compose/preview window we do not provide "Back" button, instead
|
||||
|
@ -811,12 +772,8 @@ if(rcmail.env.action=="preview")
|
|||
}
|
||||
|
||||
// We deliberately use only cookies here, not local storage
|
||||
|
||||
var pref = rcmail.get_cookie('colorMode')
|
||||
|
||||
if(!pref) {pref = "dark";rcmail.set_cookie('colorMode', "dark", false);} // first connexion
|
||||
|
||||
var color_scheme = window.matchMedia('(prefers-color-scheme: dark)'),
|
||||
var pref = rcmail.get_cookie('colorMode'),
|
||||
color_scheme = window.matchMedia('(prefers-color-scheme: dark)'),
|
||||
reset_cookie = function() {
|
||||
rcmail.set_cookie('colorMode', '', new Date()); // delete the cookie
|
||||
},
|
||||
|
@ -829,14 +786,10 @@ if(rcmail.env.action=="preview")
|
|||
switch_color_mode = function() {
|
||||
if (color_mode == 'dark') {
|
||||
$('#taskmenu a.theme').removeClass('dark').addClass('light').find('span').text(rcmail.gettext('lightmode'));
|
||||
$('.click_change_theme').removeClass('dark').addClass('light').find('span')
|
||||
$('.sebicon_contrast_txt').text(rcmail.gettext('lightmode'));
|
||||
$('html').addClass('dark-mode');
|
||||
}
|
||||
else {
|
||||
$('#taskmenu a.theme').removeClass('light').addClass('dark').find('span').text(rcmail.gettext('darkmode'));
|
||||
$('.click_change_theme').removeClass('light').addClass('dark').find('span')
|
||||
$('.sebicon_contrast_txt').text(rcmail.gettext('darkmode'));
|
||||
$('html').removeClass('dark-mode');
|
||||
}
|
||||
|
||||
|
@ -858,13 +811,6 @@ if(rcmail.env.action=="preview")
|
|||
switch_color_mode();
|
||||
rcmail.set_cookie('colorMode', color_mode, false);
|
||||
});
|
||||
|
||||
$('.click_change_theme').on('click', function() {
|
||||
color_mode = $(this).is('.dark') ? 'dark' : 'light';
|
||||
switch_color_mode();
|
||||
rcmail.set_cookie('colorMode', color_mode, false);
|
||||
});
|
||||
|
||||
|
||||
// Note: this does not work in IE and Safari
|
||||
color_scheme.addListener(function(e) {
|
||||
|
@ -1573,10 +1519,8 @@ if(rcmail.env.action=="preview")
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
function toggle_list_selection(obj, list_id)
|
||||
{
|
||||
|
||||
if ($(obj).is('.active')) {
|
||||
set_pref(
|
||||
'list-selection',
|
||||
|
@ -1584,7 +1528,7 @@ if(rcmail.env.action=="preview")
|
|||
);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handler for some Roundcube core popups
|
||||
*/
|
||||
|
@ -1847,10 +1791,6 @@ if(rcmail.env.action=="preview")
|
|||
{
|
||||
screen_resize_small_all();
|
||||
app_menu(true);
|
||||
|
||||
if (layout.list.length) {
|
||||
$('.header > ul.menu', layout.list).addClass('popupmenu');
|
||||
}
|
||||
};
|
||||
|
||||
function screen_resize_normal()
|
||||
|
@ -1870,7 +1810,9 @@ if(rcmail.env.action=="preview")
|
|||
app_menu(true);
|
||||
screen_resize_small_none();
|
||||
|
||||
|
||||
if (layout.list.length) {
|
||||
$('.header > ul.menu', layout.list).addClass('popupmenu');
|
||||
}
|
||||
};
|
||||
|
||||
function screen_resize_large()
|
||||
|
@ -1931,27 +1873,8 @@ if(rcmail.env.action=="preview")
|
|||
env.last_selected = layout.content[0];
|
||||
};
|
||||
|
||||
|
||||
function show_sidebar(sticky)
|
||||
{
|
||||
|
||||
// show sidebar and hide list
|
||||
// layout.list.addClass('hidden');
|
||||
// layout.sidebar.removeClass('hidden');
|
||||
|
||||
if (sticky) {
|
||||
// layout.sidebar.addClass('layout-sticky');
|
||||
}
|
||||
|
||||
screen_resize_headers();
|
||||
// env.last_selected = layout.sidebar[0];
|
||||
click_menu()
|
||||
};
|
||||
|
||||
/*
|
||||
function show_sidebar(sticky)
|
||||
{
|
||||
click_menu()
|
||||
// show sidebar and hide list
|
||||
layout.list.addClass('hidden');
|
||||
layout.sidebar.removeClass('hidden');
|
||||
|
@ -1967,7 +1890,7 @@ if(rcmail.env.action=="preview")
|
|||
screen_resize_headers();
|
||||
env.last_selected = layout.sidebar[0];
|
||||
};
|
||||
*/
|
||||
|
||||
function show_list(scroll)
|
||||
{
|
||||
if (!layout.list.length && !layout.sidebar.length) {
|
||||
|
@ -1994,7 +1917,6 @@ if(rcmail.env.action=="preview")
|
|||
|
||||
function hide_content()
|
||||
{
|
||||
$('.sebmenu').show();
|
||||
// show sidebar or list, hide content frame
|
||||
env.last_selected = layout.list[0] || layout.sidebar[0];
|
||||
screen_resize();
|
||||
|
@ -2061,7 +1983,6 @@ if(rcmail.env.action=="preview")
|
|||
*/
|
||||
function alert_style(object, type, wrap)
|
||||
{
|
||||
|
||||
var tmp, classes = 'ui alert',
|
||||
addicon = !$(object).is('.noicon'),
|
||||
map = {
|
||||
|
@ -2091,7 +2012,6 @@ if(rcmail.env.action=="preview")
|
|||
}
|
||||
|
||||
$(object).addClass(classes);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -3024,7 +2944,6 @@ if(rcmail.env.action=="preview")
|
|||
/**
|
||||
* Add/remove item to/from compose options status bar
|
||||
*/
|
||||
/*
|
||||
function compose_status(id, status)
|
||||
{
|
||||
var bar = $('#composestatusbar'), ico = bar.find('a.button.icon.' + id);
|
||||
|
@ -3038,7 +2957,7 @@ if(rcmail.env.action=="preview")
|
|||
.appendTo(bar);
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attachment menu
|
||||
*/
|
||||
|
@ -4140,7 +4059,6 @@ if(rcmail.env.action=="preview")
|
|||
$(obj).removeClass('expanded');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Create a splitter (resizing) element on a layout column
|
||||
|
@ -4311,8 +4229,6 @@ if(rcmail.env.action=="preview")
|
|||
|
||||
return meta.touch;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get preference stored in browser
|
||||
|
@ -4407,268 +4323,3 @@ if ($ && $.datepicker) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* pulltorefreshjs v0.1.22
|
||||
* (c) Rafael Soto
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).PullToRefresh=t()}
|
||||
(this,function(){"use strict";var e={pullStartY:null,pullMoveY:null,handlers:[],styleEl:null,events:null,dist:0,state:"pending",timeout:null,distResisted:0,supportsPassive:!1,supportsPointerEvents:"undefined"!=typeof window&&!!window.PointerEvent};
|
||||
try{window.addEventListener("test",null,{get passive(){e.supportsPassive=!0}})}catch(e){}var t,n={setupDOM:function(t){if(!t.ptrElement){var n=document.createElement("div");
|
||||
t.mainElement!==document.body?t.mainElement.parentNode.insertBefore(n,t.mainElement):document.body.insertBefore(n,document.body.firstChild),n.classList.add(t.classPrefix+"ptr"),n.innerHTML=t.getMarkup().replace(/__PREFIX__/g,t.classPrefix),
|
||||
t.ptrElement=n,"function"==typeof t.onInit&&t.onInit(t),e.styleEl||(e.styleEl=document.createElement("style"),e.styleEl.setAttribute("id","pull-to-refresh-js-style"),document.head.appendChild(e.styleEl)),e.styleEl.textContent=t.getStyles().replace(/__PREFIX__/g,t.classPrefix).replace(/\s+/g," ")}
|
||||
return t},onReset:function(t){t.ptrElement&&(t.ptrElement.classList.remove(t.classPrefix+"refresh"),t.ptrElement.style[t.cssProp]="0px",setTimeout(function(){t.ptrElement&&t.ptrElement.parentNode&&(t.ptrElement.parentNode.removeChild(t.ptrElement),t.ptrElement=null),e.state="pending"},
|
||||
t.refreshTimeout))},update:function(t){var n=t.ptrElement.querySelector("."+t.classPrefix+"icon"),s=t.ptrElement.querySelector("."+t.classPrefix+"text");
|
||||
n&&("refreshing"===e.state?n.innerHTML=t.iconRefreshing:n.innerHTML=t.iconArrow),s&&("releasing"===e.state&&(s.innerHTML=t.instructionsReleaseToRefresh),"pulling"!==e.state&&"pending"!==e.state||(s.innerHTML=t.instructionsPullToRefresh),"refreshing"===e.state&&(s.innerHTML=t.instructionsRefreshing))}},s=function(t){return e.pointerEventsEnabled&&e.supportsPointerEvents?t.screenY:t.touches[0].screenY},r=function(){var r;
|
||||
function i(t){var i=e.handlers.filter(function(e){return e.contains(t.target)})[0];e.enable=!!i,i&&"pending"===e.state&&(r=n.setupDOM(i),i.shouldPullToRefresh()&&(e.pullStartY=s(t)),clearTimeout(e.timeout),n.update(i))}
|
||||
function o(t){r&&r.ptrElement&&e.enable&&(e.pullStartY?e.pullMoveY=s(t):r.shouldPullToRefresh()&&(e.pullStartY=s(t)),"refreshing"!==e.state?("pending"===e.state&&(r.ptrElement.classList.add(r.classPrefix+"pull"),e.state="pulling",n.update(r)),e.pullStartY&&e.pullMoveY&&(e.dist=e.pullMoveY-e.pullStartY),e.distExtra=e.dist-r.distIgnore,e.distExtra>0&&(t.cancelable&&t.preventDefault(),r.ptrElement.style[r.cssProp]=e.distResisted+"px",e.distResisted=r.resistanceFunction(e.distExtra/r.distThreshold)*Math.min(r.distMax,e.distExtra),"pulling"===e.state&&e.distResisted>r.distThreshold&&(r.ptrElement.classList.add(r.classPrefix+"release"),e.state="releasing",n.update(r)),"releasing"===e.state&&e.distResisted<r.distThreshold&&(r.ptrElement.classList.remove(r.classPrefix+"release"),e.state="pulling",n.update(r)))):t.cancelable&&r.shouldPullToRefresh()&&e.pullStartY<e.pullMoveY&&t.preventDefault())}
|
||||
function l(){if(r&&r.ptrElement&&e.enable){if(clearTimeout(t),t=setTimeout(function(){r&&r.ptrElement&&"pending"===e.state&&n.onReset(r)},500),"releasing"===e.state&&e.distResisted>r.distThreshold)e.state="refreshing",r.ptrElement.style[r.cssProp]=r.distReload+"px",r.ptrElement.classList.add(r.classPrefix+"refresh"),e.timeout=setTimeout(function(){var e=r.onRefresh(function(){return n.onReset(r)});e&&"function"==typeof e.then&&e.then(function(){return n.onReset(r)}),e||r.onRefresh.length||n.onReset(r)},r.refreshTimeout);else{if("refreshing"===e.state)return;r.ptrElement.style[r.cssProp]="0px",e.state="pending"}n.update(r),r.ptrElement.classList.remove(r.classPrefix+"release"),r.ptrElement.classList.remove(r.classPrefix+"pull"),e.pullStartY=e.pullMoveY=null,e.dist=e.distResisted=0}}
|
||||
function a(){r&&r.mainElement.classList.toggle(r.classPrefix+"top",r.shouldPullToRefresh())}var d=e.supportsPassive?{passive:e.passive||!1}:void 0;return e.pointerEventsEnabled&&e.supportsPointerEvents?(window.addEventListener("pointerup",l),window.addEventListener("pointerdown",i),window.addEventListener("pointermove",o,d)):(window.addEventListener("touchend",l),window.addEventListener("touchstart",i),window.addEventListener("touchmove",o,d)),window.addEventListener("scroll",a),{onTouchEnd:l,onTouchStart:i,onTouchMove:o,onScroll:a,destroy:function(){e.pointerEventsEnabled&&e.supportsPointerEvents?(window.removeEventListener("pointerdown",i),window.removeEventListener("pointerup",l),window.removeEventListener("pointermove",o,d)):(window.removeEventListener("touchstart",i),
|
||||
window.removeEventListener("touchend",l),window.removeEventListener("touchmove",o,d)),window.removeEventListener("scroll",a)}}},i={distThreshold:60,distMax:80,distReload:80,distIgnore:0,mainElement:"body",triggerElement:"body",ptrElement:".ptr",classPrefix:"ptr--",cssProp:"min-height",iconArrow:"⇣",iconRefreshing:"…",instructionsPullToRefresh:"Pull down to refresh",instructionsReleaseToRefresh:"Release to refresh",instructionsRefreshing:"Refreshing",refreshTimeout:500,
|
||||
getMarkup:function(){return'\n<div class="__PREFIX__box">\n <div class="__PREFIX__content">\n <div class="__PREFIX__text"></div>\n </div>\n</div>\n'},
|
||||
getStyles:function(){return"\n.__PREFIX__ptr {\n pointer-events: none;\n font-size: 0.85em;\n font-weight: bold;\n height: 0;\n transition: height 0.3s, min-height 0.3s;\n text-align: center;\n width: 100%;\n overflow: hidden;\n display: flex;\n align-items: flex-end;\n align-content: stretch;\n}\n\n.__PREFIX__box {\n padding: 10px;\n flex-basis: 100%;\n}\n\n.__PREFIX__pull {\n transition: none;\n}\n\n.__PREFIX__text {\n margin-top: .33em;\n}\n\n.__PREFIX__icon {\n transition: transform .3s;\n}\n\n/*\nWhen at the top of the page, disable vertical overscroll so passive touch\nlisteners can take over.\n*/\n.__PREFIX__top {\n touch-action: pan-x pan-down pinch-zoom;\n}\n\n.__PREFIX__release .__PREFIX__icon {\n transform: rotate(180deg);\n}\n"},
|
||||
onInit:function(){},onRefresh:function(){return location.reload()},resistanceFunction:function(e){return Math.min(1,e/2.5)},shouldPullToRefresh:function(){return!window.scrollY}},o=["mainElement","ptrElement","triggerElement"],l=function(t){var n={};return Object.keys(i).forEach(function(e){n[e]=t[e]||i[e]}),n.refreshTimeout="number"==typeof t.refreshTimeout?t.refreshTimeout:i.refreshTimeout,o.forEach(function(e){"string"==typeof n[e]&&(n[e]=document.querySelector(n[e]))}),e.events||(e.events=r()),n.contains=function(e){return n.triggerElement.contains(e)},n.destroy=function(){clearTimeout(e.timeout);var t=e.handlers.indexOf(n);e.handlers.splice(t,1)},n};return{setPassiveMode:function(t){e.passive=t},setPointerEventsMode:function(t){e.pointerEventsEnabled=t},destroyAll:function(){e.events&&(e.events.destroy(),e.events=null),e.handlers.forEach(function(e){e.destroy()})},init:function(t){void 0===t&&(t={});var n=l(t);return e.handlers.push(n),n},_:{setupHandler:l,setupEvents:r,setupDOM:n.setupDOM,onReset:n.onReset,update:n.update}}});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(UI.get_screen_mode()=="phone"||UI.get_screen_mode()=="small")
|
||||
{
|
||||
const ptr = PullToRefresh.init({
|
||||
mainElement: '#messagelist-content',
|
||||
onRefresh: function () {
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(function () { UI_pull_to_refresh(resolve); }, 0);
|
||||
});
|
||||
},
|
||||
shouldPullToRefresh: function(){
|
||||
|
||||
if(document.querySelector("#greydiv"))
|
||||
{
|
||||
if(document.querySelector("#greydiv").classList.contains("fadeoff70create"))
|
||||
return false;
|
||||
}
|
||||
return !this.mainElement.scrollTop;
|
||||
},
|
||||
refreshTimeout:50,
|
||||
instructionsPullToRefresh:'<i class="sebicon iconrefresh icon_pulltorefresh" style="font-size:24px"></i>',
|
||||
instructionsRefreshing:'<i class="sebicon iconrefresh icon_pulltorefresh anim_rotatepulltorefresh" style="font-size:24px"></i>',
|
||||
instructionsReleaseToRefresh:'<i class="sebicon iconrefresh icon_pulltorefresh" style="font-size:24px"></i>'
|
||||
});
|
||||
}
|
||||
|
||||
function refresh_mail_anim()
|
||||
{
|
||||
|
||||
var but = document.getElementsByClassName('refresh')[0]
|
||||
but.classList.add("anim_rotate");
|
||||
but.classList.add("disabled");
|
||||
|
||||
|
||||
var stop_anim=function(){but.classList.remove("anim_rotate");but.classList.remove("disabled");}
|
||||
UI_pull_to_refresh(stop_anim);
|
||||
|
||||
document.getElementById("checkmail_input").focus()
|
||||
}
|
||||
|
||||
|
||||
var r = document.getElementsByClassName('refresh')
|
||||
if(r.length)
|
||||
{
|
||||
r[0].setAttribute( "onClick", "refresh_mail_anim()" ); //refresh anim
|
||||
}
|
||||
|
||||
|
||||
// function in IFRAME
|
||||
if(document.documentElement.classList.contains('iframe'))
|
||||
{
|
||||
var header = document.querySelector(".header-content")
|
||||
if(header)
|
||||
{
|
||||
set_onclick_to_class(header,".flag","return parent.rcmail.command('mark','flagged','',this,event)")
|
||||
set_onclick_to_class(header,".unread","return parent.rcmail.command('mark','unread',this,event)")
|
||||
set_onclick_to_class(header,".delete","return parent.rcmail.command('delete','',this,event)")
|
||||
}
|
||||
|
||||
|
||||
if(parent.rcmail.env.archive_folder) // Archive plugin
|
||||
{
|
||||
// Big button
|
||||
var h = document.getElementById("message-header")
|
||||
|
||||
var delete_icon = h.querySelector('.delete')
|
||||
|
||||
var ab = document.createElement("a");
|
||||
ab.className="button archive"
|
||||
ab.onclick= function(event){return parent.rcmail.command('plugin.archive','',this,event)};
|
||||
ab.innerHTML="<span class='inner'>"+parent.rcmail.labels['archive.buttontext'] +"</span>"
|
||||
delete_icon.parentElement.insertBefore(ab,delete_icon);
|
||||
|
||||
//menu
|
||||
var li_prev = document.getElementById("message-menu-small").querySelector('.unread').parentNode
|
||||
var li = document.createElement("li");
|
||||
|
||||
li.onclick= function(event){return parent.rcmail.command('plugin.archive','',this,event)};
|
||||
li.innerHTML='<a class="archive" id="" role="button" tabindex="0" aria-disabled="false" href="#" onclick="return parent.rcmail.command(\'plugin.archive\',\'\',this,event)" title=""><span class="inner">'+parent.rcmail.labels['archive.buttontext'] +'</span></a>'
|
||||
li_prev.parentElement.insertBefore(li,li_prev);
|
||||
|
||||
//small
|
||||
parent.document.getElementById("header_topmenu_archive").style.display="inline-block"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function set_onclick_to_class(elem,classsearch,func)
|
||||
{
|
||||
var lnks = elem.querySelectorAll(classsearch)
|
||||
for(var i=0;i<lnks.length;i++)
|
||||
lnks[i].setAttribute( "onClick", func );
|
||||
}
|
||||
|
||||
|
||||
|
||||
function UI_pull_to_refresh(resolve)
|
||||
{
|
||||
document.getElementById("messagestack").style.visibility="hidden"
|
||||
rcmail.command('checkmail', '', false, false);
|
||||
UI_pull_to_refresh_check(resolve)
|
||||
}
|
||||
|
||||
function UI_pull_to_refresh_check(resolve)
|
||||
{
|
||||
if($("#messagestack").html())
|
||||
setTimeout(function() { UI_pull_to_refresh_check(resolve); }, 100);
|
||||
else
|
||||
{
|
||||
document.getElementById("messagestack").style.visibility="visible" //return to normal
|
||||
resolve();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function listupdate_go_msgs(){
|
||||
var m = document.getElementById("messagelist")
|
||||
var msgs = m.querySelectorAll(".message")
|
||||
for(var i=0;i<msgs.length;i++)
|
||||
{
|
||||
var tdsel=msgs[i].querySelector(".selection")
|
||||
if(!tdsel.querySelector(".sel_circle"))
|
||||
{
|
||||
tdsel.querySelector("input").style.display="none"
|
||||
|
||||
var d = document.createElement("div");
|
||||
d.className="sel_circle maillogo_no_select"
|
||||
|
||||
d.onclick= function(event){event.preventDefault();};
|
||||
var txt = get_personna_from_mailblock(msgs[i])
|
||||
var c = colors_from_txt(txt)
|
||||
d.style.backgroundColor="#"+c
|
||||
d.innerHTML = txt
|
||||
tdsel.appendChild(d);
|
||||
|
||||
var d = document.createElement("div");
|
||||
d.className="sel_circle maillogo_is_select"
|
||||
d.onclick= function(event){event.preventDefault();};
|
||||
d.style.backgroundColor="#0078D4"
|
||||
d.innerHTML = "<i class='sebicon selecticon' style='color:#fff' onclick='return function(e){e.preventDefault()}'></i>"
|
||||
tdsel.appendChild(d);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_personna_from_mailblock(m)
|
||||
{
|
||||
if(!m.querySelector(".rcmContactAddress")) return ""
|
||||
var txt=m.querySelector(".rcmContactAddress").textContent.trim().replace(/[|&;$%@"<>()+-.,●]/g, "").trim();
|
||||
|
||||
var tab = txt.split(' ');
|
||||
var ret = txt.charAt(0)
|
||||
|
||||
if(tab[1])
|
||||
ret+=tab[1].charAt(0)
|
||||
return ret.toUpperCase();
|
||||
}
|
||||
|
||||
function colors_from_txt(txt)
|
||||
{
|
||||
if(!txt) return "AAA";
|
||||
|
||||
var lst_cols="DF71AE D45345 9877D5 6EB9C2 A47563 E1843B 62BF78 5196D5 EACF47";
|
||||
//var lst_cols="F44336 E91E63 9C27B0 673AB7 3F51B5 2196F3 03A9F4 00BCD4 009688 4CAF50 8BC34A CDDC39 FFEB3B FFC107 FF9800 FF5722 795548 607D8B";
|
||||
var tab = lst_cols.split(' ');
|
||||
|
||||
var n = 0;
|
||||
for(var i=0;i<txt.length;i++)
|
||||
n += txt.charAt(i).charCodeAt(0)+i*255
|
||||
|
||||
return tab[n%tab.length]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function click_menu()
|
||||
{
|
||||
if(!document.querySelector("#greydiv"))
|
||||
{
|
||||
var d = document.createElement("div");
|
||||
d.id="greydiv"
|
||||
d.onclick= function(){close_leftmenu()};
|
||||
document.body.appendChild(d);
|
||||
}
|
||||
document.querySelector("#greydiv").classList.add("fadeoff70create");
|
||||
|
||||
// Pop menu
|
||||
if(!document.querySelector("#menuleft"))
|
||||
{
|
||||
var HTMLmenu="<div id='menuleft'><div> </div><div id='menuleft_cont'></div><div id='menuleft_bottom' style='margin-top:40px;border-top:1px solid #374549'></div></div>"
|
||||
document.querySelector("#greydiv").insertAdjacentHTML('afterend', HTMLmenu);
|
||||
}
|
||||
|
||||
var menuleft = document.querySelector("#menuleft")
|
||||
setTimeout(function() { menuleft.classList.add("menu_marginleft"); }, 0);
|
||||
|
||||
|
||||
//move menu
|
||||
$("#menuleft_cont").append($('#folderlist-content'));
|
||||
|
||||
//Add link to close menu if no done
|
||||
if(menuleft_cont.classList.contains("link_added"))
|
||||
return
|
||||
|
||||
|
||||
document.querySelector("#menuleft_bottom").innerHTML = document.querySelector("#taskmenu").innerHTML
|
||||
|
||||
|
||||
|
||||
$('#mailboxlist a').on('click', function() { close_leftmenu() });
|
||||
$('#menuleft_bottom > .click_change_theme').click(function(){$('#taskmenu .click_change_theme').click()})
|
||||
menuleft_cont.classList.add("link_added");
|
||||
|
||||
}
|
||||
|
||||
function close_leftmenu()
|
||||
{
|
||||
if(!document.querySelector("#greydiv").classList.contains("fadeoff70create"))
|
||||
return
|
||||
|
||||
document.querySelector("#greydiv").classList.remove("fadeoff70create");
|
||||
document.querySelector("#menuleft").classList.remove("menu_marginleft");
|
||||
|
||||
setTimeout(function() { $('#folderlist-content').insertBefore($('.footerseb')); }, 300);
|
||||
}
|
||||
|
||||
|
||||
function dtel(x)
|
||||
{
|
||||
$('#mailboxlist a')[0].text=x
|
||||
}
|
Loading…
Reference in a new issue