Skip to content

Commit 42e8e43

Browse files
committed
Add Google Maps search
1 parent b54a76f commit 42e8e43

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

javascripts/Search Google Maps.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"use strict";
2+
var selection;
3+
if (window.getSelection) {
4+
selection = window.getSelection().toString();
5+
} else if (document.selection && document.selection.type !== "Control") {
6+
selection = document.selection.createRange().text;
7+
}
8+
if (selection === undefined) {
9+
window.alert('Select the desired text to search.');
10+
} else {
11+
window.open('https://www.google.com/maps/search/' + encodeURIComponent(selection.trim()), '_blank').focus();
12+
}

0 commit comments

Comments
 (0)