Index: tools/chrome_extensions/open_my_editor/ext/cs-content.js |
diff --git a/tools/chrome_extensions/open_my_editor/ext/cs-content.js b/tools/chrome_extensions/open_my_editor/ext/cs-content.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..23ba7092706ebe01c9889ac1c439d3fd55d458d7 |
--- /dev/null |
+++ b/tools/chrome_extensions/open_my_editor/ext/cs-content.js |
@@ -0,0 +1,30 @@ |
+// Copyright 2017 Google Inc. |
+// |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// For cs.chromium.org |
+ |
+let line = 0; |
+ |
+document.addEventListener("mousedown", (event) => { |
+ //right click |
watk
2017/03/02 23:13:49
Proper punctuation. Space after //.
|
+ if (event.button == 2) { |
+ let element = event.target; |
+ while (element != null && element.tagName == "SPAN") { |
+ if (element.className == "stx-line") { |
+ line = parseInt(element.id.split("_")[1]); |
+ break; |
+ } else { |
+ element = element.parentElement; |
+ } |
+ } |
+ } |
+}, true); |
+ |
+chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { |
+ if (request == "getLine") { |
+ sendResponse({ line: line }); |
+ } |
+}); |