OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // For cs.chromium.org |
| 6 |
| 7 let line = 0; |
| 8 |
| 9 document.addEventListener('mousedown', (event) => { |
| 10 // right click |
| 11 if (event.button == 2) { |
| 12 let element = event.target; |
| 13 while (element != null && element.tagName == 'SPAN') { |
| 14 if (element.className == 'stx-line') { |
| 15 line = parseInt(element.id.split('_')[1]); |
| 16 break; |
| 17 } else { |
| 18 element = element.parentElement; |
| 19 } |
| 20 } |
| 21 } |
| 22 }, true); |
| 23 |
| 24 chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { |
| 25 if (request == 'getLine') { |
| 26 sendResponse({line: line}); |
| 27 } |
| 28 }); |
OLD | NEW |