]> git.joonet.de Git - adminer.git/commitdiff
Open form to a new window on Ctrl+click or Shift+click
authorJakub Vrana <jakub@vrana.cz>
Tue, 4 Sep 2012 22:40:57 +0000 (15:40 -0700)
committerJakub Vrana <jakub@vrana.cz>
Tue, 4 Sep 2012 22:40:57 +0000 (15:40 -0700)
adminer/include/design.inc.php
adminer/static/functions.js
changes.txt

index 6bbcf564f698a6d36bd1a81b019307677ac2fe15..fb13af2dc329b03b97c34fa2f0788b23cde0ed56 100644 (file)
@@ -32,7 +32,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
 <?php } ?>
 <?php } ?>
 
-<body class="<?php echo lang('ltr'); ?> nojs" onkeydown="bodyKeydown(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
+<body class="<?php echo lang('ltr'); ?> nojs" onkeydown="bodyKeydown(event);" onclick="bodyClick(event);" onload="bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info, 0, 3) : ""); ?>');<?php echo (isset($_COOKIE["adminer_version"]) ? "" : " verifyVersion();"); ?>">
 <script type="text/javascript">
 document.body.className = document.body.className.replace(/ nojs/, ' js');
 </script>
index df574a4d67b4016be9439112396b4b28f911cabd..7dd950d99276792e39901485b1179a7bd1178023 100644 (file)
@@ -312,6 +312,20 @@ function bodyKeydown(event, button) {
        return true;
 }
 
+/** Open form to a new window on Ctrl+click or Shift+click
+* @param MouseEvent
+*/
+function bodyClick(event) {
+       var target = event.target || event.srcElement;
+       if ((event.ctrlKey || event.shiftKey) && target.type == 'submit' && /input/i.test(target.tagName)) {
+               target.form.target = '_blank';
+               setTimeout(function () {
+                       // if (event.ctrlKey) { focus(); } doesn't work
+                       target.form.target = '';
+               }, 0);
+       }
+}
+
 
 
 /** Change focus by Ctrl+Up or Ctrl+Down
index 12cc41fb86e120fca43b6b06fac69a0326ab6d1d..4755b9f754f46f17502c8baf3e126cb56366c8f1 100644 (file)
@@ -4,6 +4,7 @@ Edit strings with \n in textarea
 Time out long running database list and select count
 Use VALUES() in INSERT+UPDATE export
 Style logout button as link
+Ctrl+click and Shift+click on button opens form to a blank window
 selectQueryBuild() method (customization)
 Serbian translation