Add mobile device detection to project. Improved Messages app when used on a mobile device.

This commit is contained in:
Nate
2018-12-21 23:29:20 -07:00
parent 8b55c90b73
commit 463a94f537
16 changed files with 3128 additions and 12 deletions

View File

@@ -76,7 +76,12 @@
echo " display: block;\n";
echo " background-color: #fff;\n";
echo " padding: 20px 30px;\n";
echo " margin: auto 30%;\n";
if (is_mobile() && !is_tablet()) {
echo " margin: 0;\n";
}
else {
echo " margin: auto 30%;\n";
}
echo " text-align: left;\n";
echo " -webkit-box-shadow: 0px 1px 20px #888;\n";
echo " -moz-box-shadow: 0px 1px 20px #888;\n";
@@ -110,7 +115,7 @@
echo " <td class='vncell'>".$text['label-message_from']."</td>\n";
echo " <td class='vtable'>\n";
if (is_array($destinations) && sizeof($destinations) != 0) {
echo " <select class='formfld' name='message_from' id='message_new_from'>\n";
echo " <select class='formfld' name='message_from' id='message_new_from' onchange=\" $('#message_new_to').focus();\">\n";
foreach ($destinations as $destination) {
echo " <option value='".$destination."'>".format_phone($destination)."</option>\n";
}
@@ -163,7 +168,7 @@
echo " <td width='50%' align='left' nowrap='nowrap'><b>".$text['title-messages']."</b><br><br></td>\n";
echo " <form method='get' action=''>\n";
echo " <td width='50%' style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['label-new_message']."' onclick=\"$('#message_new_layer').fadeIn(200); $('#message_new_to').focus();\" value='".$text['label-new_message']."'>\n";
echo " <input type='button' class='btn' name='' alt='".$text['label-new_message']."' onclick=\"$('#message_new_layer').fadeIn(200); unload_thread();\" value='".$text['label-new_message']."'>\n";
/*
if (permission_exists('message_all')) {
if ($_GET['show'] == 'all') {
@@ -217,21 +222,30 @@
echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome
echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others
//note: the order of the above two lines matters!
echo " if ($('#message_new_layer').is(':hidden')) {\n";
echo " $('#message_text').focus();\n";
echo " }\n";
if (!is_mobile()) {
echo " if ($('#message_new_layer').is(':hidden')) {\n";
echo " $('#message_text').focus();\n";
echo " }\n";
}
echo " timer_thread = setTimeout(refresh_thread_start, thread_refresh, number);\n";
echo " });\n";
echo " }\n";
echo " function unload_thread() {\n";
echo " clearTimeout(timer_thread);\n";
echo " $('#thread').html('...');\n";
echo " }\n";
echo " function refresh_thread(number, onsent) {\n";
echo " $('#thread_messages').load('messages_thread.php?refresh=true&number=' + encodeURIComponent(number), function(){\n";
echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome
echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others
//note: the order of the above two lines matters!
echo " if ($('#message_new_layer').is(':hidden')) {\n";
echo " $('#message_text').focus();\n";
echo " }\n";
if (!is_mobile()) {
echo " if ($('#message_new_layer').is(':hidden')) {\n";
echo " $('#message_text').focus();\n";
echo " }\n";
}
echo " if (onsent != 'true') {\n";
echo " timer_thread = setTimeout(refresh_thread, thread_refresh, number);\n";
echo " }\n";

View File

@@ -208,7 +208,7 @@
echo " data: $('#message_compose').serialize(),\n";
echo " success: function(){\n";
echo " document.getElementById('message_compose').reset();\n";
echo " if ($('#message_new_layer').is(':hidden')) {\n";
echo " if ($('#message_new_layer').is(':hidden') && !is_mobile()) {\n";
echo " $('#message_text').focus();\n";
echo " }\n";
echo " refresh_thread('".$number."','true');\n";