| // ==UserScript==
|
| // @name paidviewpoint
|
| // @namespace https://www.mturkcrowd.com/members/aveline.7/
|
| // @version 1.0.2
|
| // @description Plays TTS alerts for Connect studies paying over a specified hourly.
|
| // @author aveline
|
| // @icon https://i.imgur.com/jsju8Wy.png
|
| // @match https://app.paidviewpoint.com/dashboard*
|
| // @grant GM_setValue
|
| // @grant GM_getValue
|
| // @grant GM_deleteValue
|
| // @grant GM_listValues
|
| // ==/UserScript==
|
|
|
| const settings = {
|
| pageRefreshDelay: 20,
|
| useSpeech: true,
|
| speechVolume: 1.0,
|
| chimeVolume: 2.0
|
| };
|
|
|
| function readText(text) {
|
| const utterance = new SpeechSynthesisUtterance(text);
|
| const voices = window.speechSynthesis.getVoices();
|
|
|
| utterance.voice = voices[0];
|
| utterance.rate = 0.8;
|
| utterance.volume = settings.speechVolume;
|
|
|
| window.speechSynthesis.speak(utterance);
|
| }
|
|
|
| function announce() {
|
| if (settings.useSpeech) {
|
| let text = `paidviewpoint`;
|
| readText(text);
|
| } else {
|
| const chime = new Audio("https://www.meangirlsturk.com/sounds/chime.wav");
|
| chime.volume = settings.chimeVolume;
|
| chime.play();
|
| }
|
| }
|
|
|
| function windowIsOnDashboard() {
|
| return (
|
| window.location.href === 'https://app.paidviewpoint.com/dashboard' ||
|
| window.location.href === 'https://app.paidviewpoint.com/dashboard/'
|
| );
|
| }
|
|
|
| let alerted = false;
|
| function check() {
|
| const noSurvey = document.body.innerHTML.includes("We're preparing your next survey.");
|
|
|
| if (noSurvey == false && alerted == false) {
|
| announce();
|
| alerted = true;
|
| }
|
| }
|
|
|
| setInterval(() => {
|
| if (windowIsOnDashboard()) {
|
| check();
|
|
|
| setTimeout(() => {
|
| if (windowIsOnDashboard() && !alerted) {
|
| window.location.reload();
|
| }
|
| }, settings.pageRefreshDelay * 1000);
|
| }
|
| }, 3000);
|