NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Text to Speech Ebook Reader
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Text to speech ebook reader using public TTS API
// @author programator@azet.sk
// @match https://www.ivona.com/
// @grant none
// ==/UserScript==
/* jshint -W097 */
'use strict';
var div = document.createElement ('div'); div.style.cssText="position:fixed;z-index:2000;width:50%;height:100%;left:50%;background:white";
var text = document.createElement ('textarea'); text.style.cssText="position:absolute;width:100%;height:100%";
var txt2,btn2,lbl,audio,all='' ; function gi(o) { return document.getElementById(o); }
function start(){ div.appendChild (text); document.body.appendChild (div); setInterval(checkplaybackready,100);}
var playing=0;
if(document.location.hostname=='www.ivona.com') {
txt2 = "VoiceTesterForm_text";
btn2 = "voiceTesterLogicpbut";
lbl = "voiceTesterLogicpbuttext";
start();
}
function checkplaybackready(){
var l=gi(lbl);
if (l.textContent=='Play' && text.value.length && text.value.indexOf('.')!=-1) {
l.textContent='Stop2';
//debugger;
var block = text.value.substring(0,250); var len=0,p;
p=block.lastIndexOf('.'); if(p>len) len=p+1;
if(!len) len=block.length;
block = block.substring(0,len);
gi(txt2).value=block; gi(btn2).click();
text.value=text.value.substring(len,text.value.length);
}
}