Chromium Code Reviews| Index: chrome/browser/resources/ntp4/synthetic_middleclick.js |
| diff --git a/chrome/browser/resources/ntp4/synthetic_middleclick.js b/chrome/browser/resources/ntp4/synthetic_middleclick.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5ee4fab4a1c358e4a141f86f141f03d03dfddd83 |
| --- /dev/null |
| +++ b/chrome/browser/resources/ntp4/synthetic_middleclick.js |
| @@ -0,0 +1,16 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
|
Lei Zhang
2016/05/10 19:01:42
no (c)
Navid Zolghadr
2016/05/10 19:28:26
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
|
Lei Zhang
2016/05/10 19:01:42
add blank line after.
Navid Zolghadr
2016/05/10 19:28:26
Done.
|
| +var middleButtonMouseDownTarget = null; |
| +document.addEventListener('mousedown', function(e) { |
| + if (e.button == 1) { |
| + middleButtonMouseDownTarget = e.target; |
| + } |
| +}, true); |
| +document.addEventListener('mouseup', function(e) { |
| + if (e.button == 1) { |
| + if (e.target == middleButtonMouseDownTarget) |
| + e.target.dispatchEvent(new MouseEvent('click', e)); |
| + middleButtonMouseDownTarget = null; |
| + } |
| +}, true); |