Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified for google sheets and slides #10

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
30 changes: 19 additions & 11 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ chrome.runtime.onMessage.addListener(function (command) {
update_acc = "u/" + account_num
}

// Google Doc
const doc_regex = "https:\/\/docs.google.com\/document\/u\/[0-9].*";
// Google Doc, slides and sheets
const doc_regex = "https:\/\/docs.google.com\/(document|presentation|spreadsheets)\/u\/[0-9].*";
if (current_url.match(doc_regex)) {
update_url_regex = RegExp("u\/[0-9]");
update_acc = "u/" + account_num
Expand Down Expand Up @@ -95,16 +95,24 @@ chrome.runtime.onMessage.addListener(function (command) {
update_url_regex = RegExp("authuser=[0-9]");
update_acc = "authuser=" + account_num
}

// Google Keep
const keep_regex = "https:\/\/keep.google.com\/u\/[0-9].*";
console.log(current_url, keep_regex)
if (current_url.match(keep_regex)) {
update_url_regex = RegExp("u\/[0-9]");
update_acc = "u/" + account_num
}

if (update_acc && update_url_regex) {
// Google Keep
const keep_regex = "https:\/\/keep.google.com\/u\/[0-9].*";
console.log(current_url, keep_regex)
if (current_url.match(keep_regex)) {
update_url_regex = RegExp("u\/[0-9]");
update_acc = "u/" + account_num
}

// Google contacts
const jamboard_regex = "https:\/\/contacts.google.com\/u\/[0-9].*";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const jamboard_regex = "https:\/\/contacts.google.com\/u\/[0-9].*";
const contacts_regex = "https:\/\/contacts.google.com\/u\/[0-9].*";

console.log(current_url, jamboard_regex)
if (current_url.match(jamboard_regex)) {
update_url_regex = RegExp("u\/[0-9]");
update_acc = "u/" + account_num
}

if (update_acc && update_url_regex) {
current_url = current_url.replace(update_url_regex, update_acc);
console.log(current_url)
if(command.substring(0,command.length - 1)=="alt"){
Expand Down