-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
caption turn on notification and pageaction added
- Loading branch information
Showing
7 changed files
with
129 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
let ON_CALL = false; | ||
let IS_SUBTITLE_ON = false; | ||
|
||
chrome.storage.sync.set({ | ||
ON_CALL: false, | ||
}) | ||
|
||
chrome.storage.sync.set({ | ||
subtitleWarning: false, | ||
}); | ||
|
||
const docObserver = new MutationObserver(() => { | ||
if (document.body.querySelector("div[jscontroller='kAPMuc']")) { | ||
ON_CALL = true; | ||
// Remove observer | ||
docObserver.disconnect(); | ||
|
||
chrome.runtime.sendMessage({ | ||
todo: "activate" | ||
}); | ||
|
||
chrome.storage.sync.set({ | ||
ON_CALL: true, | ||
}) | ||
|
||
callStarts(); | ||
} | ||
}); | ||
|
||
docObserver.observe(document.body, { | ||
childList: true | ||
}); | ||
|
||
|
||
function whenSubtitleOff() { | ||
chrome.storage.sync.set({ | ||
subtitleWarning: true, | ||
}); | ||
}; | ||
|
||
|
||
function callStarts() { | ||
const subtitleDiv = document.querySelector("div[jscontroller='TEjq6e']"); | ||
|
||
// To notify the first time | ||
IS_SUBTITLE_ON = subtitleDiv.style.display === "none" ? false : true; | ||
if (IS_SUBTITLE_ON) whenSubtitleOn(); | ||
else whenSubtitleOff(); | ||
|
||
const subtitleObserver = new MutationObserver(() => { | ||
IS_SUBTITLE_ON = subtitleDiv.style.display === "none" ? false : true; | ||
if (IS_SUBTITLE_ON) whenSubtitleOn(); | ||
else whenSubtitleOff(); | ||
}); | ||
|
||
subtitleObserver.observe(subtitleDiv, { | ||
attributes: true, | ||
attributeOldValue: true, | ||
attributeFilter: ["style"], | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) { | ||
if (message.todo == "activate") { | ||
chrome.tabs.query({ | ||
active: true, | ||
currentWindow: true | ||
}, function (tabs) { | ||
chrome.pageAction.show(tabs[0].id) | ||
}) | ||
} | ||
}) | ||
|
||
chrome.storage.sync.get(["subtitleWarning"], function (result) { | ||
console.log("caps" + result.subtitleWarning); | ||
if (result.subtitleWarning) { | ||
var notifOption = { | ||
type: "basic", | ||
iconUrl: "icon.png", | ||
title: "Caption Off!", | ||
message: "Please turn on your CAPTIONS!!" | ||
}; | ||
chrome.notifications.create("captionOff", notifOption); | ||
} | ||
}) |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<title></title> | ||
<meta name="description" content=""> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="stylesheet" href=""> | ||
</head> | ||
|
||
<body style="height: fit-content;width: fit-content; "> | ||
|
||
<div style="width: max-content;font-weight: bold;"> | ||
<p>Welcome To GMeet Notes</p> | ||
</div> | ||
<div id="meet-start"></div> | ||
|
||
|
||
<script src="jquery.min.js"></script> | ||
<script src="popup.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
chrome.storage.sync.get(["ON_CALL"], function (result) { | ||
console.log(result); | ||
if (result.ON_CALL) $("#meet-start").html("Meet - Started"); | ||
else $("#meet-start").html("Meet - Not - Started"); | ||
}) |