From 29be1da5d20086ad6abf34372c9c6dfc0968267e Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 6 Mar 2020 10:38:00 -0700 Subject: [PATCH] Template & Functions: Add keyboard shortcut for Copy action. --- resources/functions.php | 23 ++++++++++++++--------- themes/default/template.php | 19 +++++++++++++++++++ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/resources/functions.php b/resources/functions.php index ef26160d1d..46e7cf651f 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -781,35 +781,35 @@ function format_string ($format, $data) { //get the name of the useragent if (preg_match('/MSIE/i',$user_agent) || preg_match('/Trident/i',$user_agent)) { $browser_name = 'Internet Explorer'; - $browser_shortname = 'MSIE'; + $browser_name_short = 'MSIE'; } elseif (preg_match('/Firefox/i',$user_agent)) { $browser_name = 'Mozilla Firefox'; - $browser_shortname = 'Firefox'; + $browser_name_short = 'Firefox'; } elseif (preg_match('/Chrome/i',$user_agent)) { $browser_name = 'Google Chrome'; - $browser_shortname = 'Chrome'; + $browser_name_short = 'Chrome'; } elseif (preg_match('/Safari/i',$user_agent)) { $browser_name = 'Apple Safari'; - $browser_shortname = 'Safari'; + $browser_name_short = 'Safari'; } elseif (preg_match('/Opera/i',$user_agent)) { $browser_name = 'Opera'; - $browser_shortname = 'Opera'; + $browser_name_short = 'Opera'; } elseif (preg_match('/Netscape/i',$user_agent)) { $browser_name = 'Netscape'; - $browser_shortname = 'Netscape'; + $browser_name_short = 'Netscape'; } else { $browser_name = 'Unknown'; - $browser_shortname = 'Unknown'; + $browser_name_short = 'Unknown'; } //finally get the correct version number - $known = array('Version', $browser_shortname, 'other'); + $known = array('Version', $browser_name_short, 'other'); $pattern = '#(?' . join('|', $known) . ')[/ ]+(?[0-9.|a-zA-Z.]*)#'; if (!preg_match_all($pattern, $user_agent, $matches)) { //we have no matching number just continue @@ -820,7 +820,7 @@ function format_string ($format, $data) { if ($i != 1) { //we will have two since we are not using 'other' argument yet //see if version is before or after the name - if (strripos($user_agent,"Version") < strripos($user_agent,$browser_shortname)) { + if (strripos($user_agent,"Version") < strripos($user_agent,$browser_name_short)) { $version= $matches['version'][0]; } else { @@ -838,6 +838,7 @@ function format_string ($format, $data) { switch ($info) { case "agent": return $user_agent; break; case "name": return $browser_name; break; + case "name_short": return $browser_name_short; break; case "version": return $version; break; case "platform": return $platform; break; case "mobile": return $mobile; break; @@ -846,6 +847,7 @@ function format_string ($format, $data) { return array( 'user_agent' => $user_agent, 'name' => $browser_name, + 'name_short' => $browser_name_short, 'version' => $version, 'platform' => $platform, 'mobile' => $mobile, @@ -1603,6 +1605,9 @@ function number_pad($number,$n) { case 'ctrl+a': $key_code = '(((e.which == 97 || e.which == 65) && (e.ctrlKey || e.metaKey)) || (e.which == 19))'; break; + case 'ctrl+c': + $key_code = '(((e.which == 99 || e.which == 67) && (e.ctrlKey || e.metaKey)) || (e.which == 19))'; + break; case 'ctrl+enter': $key_code = '(((e.which == 13 || e.which == 10) && (e.ctrlKey || e.metaKey)) || (e.which == 19))'; break; diff --git a/themes/default/template.php b/themes/default/template.php index a1a2691bc0..843ff3dbea 100644 --- a/themes/default/template.php +++ b/themes/default/template.php @@ -341,6 +341,25 @@ echo "