Skip to content

Commit

Permalink
Merge pull request #11 from vivek-nexus/v2.1.1
Browse files Browse the repository at this point in the history
v2.1.1
  • Loading branch information
vivek-nexus authored May 9, 2024
2 parents 530f9dd + 654349a commit 8feb85b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
20 changes: 10 additions & 10 deletions extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ function downloadTranscript() {
lines.push(`${entry.personName} (${entry.timeStamp})`)
lines.push(entry.personTranscript)
// Add an empty line between entries
lines.push('')
lines.push("")
})
lines.push('')
lines.push('')
lines.push("")
lines.push("")

if (result.chatMessages.length > 0) {
// Iterate through the chat messages array and format each entry
Expand All @@ -49,11 +49,11 @@ function downloadTranscript() {
lines.push(`${entry.personName} (${entry.timeStamp})`)
lines.push(entry.chatMessageText)
// Add an empty line between entries
lines.push('')
lines.push("")
})
lines.push("")
lines.push("")
}
lines.push('')
lines.push('')

// Add branding
lines.push("---------------")
Expand All @@ -62,10 +62,10 @@ function downloadTranscript() {


// Join the lines into a single string, replace "You" with userName from storage
const textContent = lines.join('\n').replace(/You/g, result.userName)
const textContent = lines.join("\n").replace(/You \(/g, result.userName + " (")

// Create a blob containing the text content
const blob = new Blob([textContent], { type: 'text/plain' })
const blob = new Blob([textContent], { type: "text/plain" })

// Read the blob as a data URL
const reader = new FileReader()
Expand All @@ -78,15 +78,15 @@ function downloadTranscript() {
chrome.downloads.download({
url: dataUrl,
filename: fileName,
conflictAction: 'uniquify'
conflictAction: "uniquify"
}).then(() => {
console.log("Transcript downloaded to TranscripTonic directory")
}).catch((error) => {
console.log(error)
chrome.downloads.download({
url: dataUrl,
filename: "TranscripTonic/Transcript.txt",
conflictAction: 'uniquify'
conflictAction: "uniquify"
})
console.log("Invalid file name. Transcript downloaded to TranscripTonic directory with simple file name.")
})
Expand Down
13 changes: 11 additions & 2 deletions extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ checkExtensionStatus().then(() => {
userName = document.querySelector(".awLEm").textContent
if (userName || hasMeetingStarted) {
clearInterval(captureUserNameInterval)
overWriteChromeStorage(["userName"], false)
// Prevent overwriting default "You" where element is found, but valid userName is not available
if (userName != "")
overWriteChromeStorage(["userName"], false)
}
}, 100)
})
Expand All @@ -75,7 +77,7 @@ checkExtensionStatus().then(() => {
// **** TRANSCRIPT ROUTINES **** //
// CRITICAL DOM DEPENDENCY
const captionsButton = contains(".material-icons-extended", "closed_caption_off")[0]
const chatMessagesButton = contains(".google-material-icons", "chat")[0]


// Click captions icon for non manual operation modes. Async operation.
chrome.storage.sync.get(["operationMode"], function (result) {
Expand All @@ -87,6 +89,12 @@ checkExtensionStatus().then(() => {

// CRITICAL DOM DEPENDENCY. Grab the transcript element. This element is present, irrespective of captions ON/OFF, so this executes independent of operation mode.
const transcriptTargetNode = document.querySelector('.a4cQT')
// Attempt to dim down the transcript
try {
transcriptTargetNode.firstChild.style.opacity = 0.2
} catch (error) {
console.error(error)
}

// Create transcript observer instance linked to the callback function. Registered irrespective of operation mode, so that any visible transcript can be picked up during the meeting, independent of the operation mode.
const transcriptObserver = new MutationObserver(transcriber)
Expand All @@ -95,6 +103,7 @@ checkExtensionStatus().then(() => {
transcriptObserver.observe(transcriptTargetNode, mutationConfig)

// **** CHAT MESSAGES ROUTINES **** //
const chatMessagesButton = contains(".google-material-icons", "chat")[0]
// Force open chat messages to make the required DOM to appear. Otherwise, the required chatMessages DOM element is not available.
chatMessagesButton.click()
let chatMessagesObserver
Expand Down
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TranscripTonic",
"version": "2.1.0",
"version": "2.1.1",
"manifest_version": 3,
"description": "Simple Google Meet transcripts. Private and open source.",
"action": {
Expand Down

0 comments on commit 8feb85b

Please sign in to comment.