Skip to content

Commit

Permalink
&readouturls / no longer reads out links in tts
Browse files Browse the repository at this point in the history
  • Loading branch information
steveseguin committed Feb 19, 2024
1 parent 3ce485d commit 59fab6a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ chrome.runtime.onMessage.addListener(
data.chatimg = "https://socialstream.ninja/sampleavatar.png";
data.chatname = "Steve";
var score = parseInt(Math.random()* 378);
data.chatmessage = '<img src="https://github.com/steveseguin/social_stream/raw/main/icons/icon-128.png">😁 🇨🇦';
data.chatmessage = '<img src="https://github.com/steveseguin/social_stream/raw/main/icons/icon-128.png">😁 🇨🇦 https://vdo.ninja/';
} else if (Math.random()>0.5){
data.hasDonation = "";
data.nameColor = "#107516";
Expand Down
11 changes: 9 additions & 2 deletions dock.html
Original file line number Diff line number Diff line change
Expand Up @@ -2288,6 +2288,11 @@
fadeout = true;
}

var replaceURLInLink = true;
if (urlParams.has("readouturls")){
replaceURLInLink = false;
}


var hideNumbers = false;
if (urlParams.has("hidenumbers")){
Expand Down Expand Up @@ -2755,6 +2760,10 @@

if (text.startsWith("!")){return;} // do not TTS commands.

if (replaceURLInLink){
text = text.replace(/https?:\/\/[^\s]+/g, 'Link');
}

if (GoogleAPIKey){
if (!premiumQueueActive){
googleTTS(text);
Expand All @@ -2771,9 +2780,7 @@
return;
}


if (!voices && (voices===null)){return;}


if (!voice){
if (!voices || !voices.length){
Expand Down
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,11 @@
var voice = false;
var voices = window.speechSynthesis.getVoices();

var replaceURLInLink = true;
if (urlParams.has("readouturls")){
replaceURLInLink = false;
}

var readDonos = false
if (urlParams.has("ttsdonos")){
readDonos = urlParams.get("ttsdonos") || "en-US";
Expand Down Expand Up @@ -1332,6 +1337,11 @@
function speak(text){
if (!speech){return;}
if (!text){return;}

if (replaceURLInLink){
text = text.replace(/https?:\/\/[^\s]+/g, 'Link');
}

if (GoogleAPIKey){
googleTTS(text);
return;
Expand Down
12 changes: 12 additions & 0 deletions popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,12 @@ <h2 class="streaming_chat_title"><span data-translate="streaming-chat-dockable">
<span class="slider round"></span>
</label><span data-translate="do-not-read-out-chatname-and-someone-says-when-using-tts">🗣️ Do not read out chatname and "someone says" when using TTS.
</span></div>
<div>
<label class="switch">
<input type="checkbox" data-param1="readouturls">
<span class="slider round"></span>
</label><span data-translate="read-out-urls">🗣️ Read out URLs rather than saying "link" instead.
</span></div>
<div>
<label class="switch">
<input type="checkbox" data-param1="skipmessages=3">
Expand Down Expand Up @@ -1674,6 +1680,12 @@ <h2 class="single_message_title"><span data-translate="featured-chat-overlay">Fe
<span class="slider round"></span>
</label><span data-translate="do-not-read-out-chatname-and-someone-says-when-using-tts">🗣️ Do not read out chatname and "someone says" when using TTS.
</span></div>
<div>
<label class="switch">
<input type="checkbox" data-param2="readouturls">
<span class="slider round"></span>
</label><span data-translate="read-out-urls">🗣️ Read out URLs rather than saying "link" instead.
</span></div>
<div>
<label class="switch">
<input type="checkbox" data-param2="alignright">
Expand Down

0 comments on commit 59fab6a

Please sign in to comment.