Skip to content

Commit

Permalink
Huge update!
Browse files Browse the repository at this point in the history
  • Loading branch information
dtinth committed Apr 3, 2020
1 parent 2d6b5a5 commit edb3e60
Show file tree
Hide file tree
Showing 20 changed files with 20,850 additions and 237 deletions.
9 changes: 0 additions & 9 deletions .github/main.workflow

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ Icon
.Spotlight-V100
.Trashes

.idea
.idea
tmp
3 changes: 3 additions & 0 deletions background.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<script src="vendor/mobx-5.13.0.umd.js"></script>
<script src="vendor/lodash-4.17.15-core.js"></script>
<script type="module" src="src/VXBackgroundPage.js"></script>
46 changes: 0 additions & 46 deletions background.js

This file was deleted.

30 changes: 30 additions & 0 deletions content-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
if (!window.vxframe) {
const css = String.raw
const frame = document.createElement('iframe')
frame.setAttribute(
'style',
css`
position: fixed;
top: 0px;
left: 0px;
width: calc(100vw);
height: 200px;
margin: 0;
padding: 0;
border: 0;
background: transcript;
z-index: 999999999;
pointer-events: none;
`,
)
frame.src = chrome.runtime.getURL('popup.html')
document.body.appendChild(frame)
window.vxframe = frame
chrome.runtime.onMessage.addListener(message => {
if (message.disposeOverlay) {
window.vxframe = null
frame.remove()
}
})
chrome.runtime.sendMessage({ overlayInjected: true })
}
10 changes: 6 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"manifest_version": 2,
"name": "vxchrome",
"version": "0.1",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
"commands": {
"listen1": {
"description": "Listen [first language]",
Expand All @@ -17,16 +18,17 @@
}
},
"background": {
"scripts": ["settings.js", "background.js"]
"page": "background.html"
},
"permissions": ["clipboardWrite", "notifications", "storage"],
"permissions": ["clipboardWrite", "notifications", "storage", "activeTab"],

"browser_action": {
"default_icon": "icon.png"
},

"options_ui": {
"page": "options.html",
"open_in_tab": false
}
"open_in_tab": true
},
"web_accessible_resources": ["popup.html"]
}
2 changes: 1 addition & 1 deletion options.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<br />
<button id="btn_save">save</button>
<div id="status"></div>
<script src="settings.js"></script>
<script src="VXDefaultSettings.js"></script>
<script src="options.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"devDependencies": {
"@types/chrome": "^0.0.103"
}
}
77 changes: 55 additions & 22 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,58 @@
<title>vxchrome</title>
<style>
body {
background: #353433;
background: transparent;
color: #e9e8e7;
font: 18px Arimo, sans-serif;
}
.full body {
background: #353433;
padding: 8px 24px;
}
#log {
font: 16px Cousine, Menlo, monospace;
min-height: 100vh;
#vxchrome .box {
position: absolute;
z-index: 2147483647;
top: 40px;
left: 40px;
margin-right: 40px;
background: #0008;
font: bold 24px Arimo, Noto Sans Thai, sans-serif;
border-radius: 8px;
padding: 8px 16px;
color: #fff;
text-shadow: 0 2px 8px #000;
border: 2px solid #8b8685;
box-shadow: 0 4px 16px #000;
transition: 0.2s all;
line-height: 36px;
transform-origin: 0 28px;
transform: scale(0.95);
}
#text {
margin: 0;
font: bold 32px Arimo, Noto Sans Thai, sans-serif;
min-height: 100vh;
#vxchrome .box[data-status='listening'] {
border-color: #bef;
}
#final {
color: #d7fc70;
#vxchrome .box[data-status='listening'][data-final='true'] {
border-color: #d7fc70;
transform: scale(1);
}
#listening {
#vxchrome .box[data-status='ended'] {
transform: scale(1);
}
#vxchrome .initial {
color: #8b8685;
font-weight: normal;
font-size: 0.5em;
}
#vxchrome .final {
color: #d7fc70;
}
#actions {
display: none;
position: fixed;
bottom: 16px;
right: 16px;
}
.full #actions {
display: block;
}
#actions button {
border: 0;
background: transparent;
Expand All @@ -46,11 +71,22 @@
</style>
</head>
<body>
<p id="text">
<span id="interim"></span>
<span id="final"></span>
<span id="listening" hidden>(listening)</span>&nbsp;
</p>
<div id="app">
<div id="vxchrome">
<template v-if="data">
<div
class="box"
v-if="data.showing"
:data-status="data.status"
:data-final="data.finalTranscript ? 'true' : 'false'"
>
<span class="initial">&gt;&gt;&gt;</span>
<span class="final">{{ data.finalTranscript }}</span>
<span class="interim">{{ data.interimTranscript }}</span>
</div>
</template>
</div>
</div>
<p id="actions">
<button id="open-options-button">
<svg
Expand All @@ -67,10 +103,7 @@
</svg>
</button>
</p>

<pre id="log"></pre>
<script src="vendor/microsoft.cognitiveservices.speech.sdk.bundle.js"></script>
<script src="microsoft-speech.js"></script>
<script src="vendor/vue-2.6.11.js"></script>
<script src="popup.js"></script>
</body>
</html>
Loading

0 comments on commit edb3e60

Please sign in to comment.