Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Unified Diff: tools/chrome_extensions/open_my_editor/ext/cs-content.js

Issue 2720793005: Add Open my editor (Closed)
Patch Set: add owners and change to py2 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 });
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698