diff --git a/assets/Test.ts b/assets/Test.ts index f6d33ca..ff0a0e4 100644 --- a/assets/Test.ts +++ b/assets/Test.ts @@ -10,13 +10,13 @@ export default class NewClass extends cc.Component { onLoad(): void { // this.EditBox = this.node.getChildByName("EditBox").getComponent(cc.EditBox); // this.EditBox.node.on("text-changed", this.Voice, this); - let url: string = "https://code.responsivevoice.org/responsivevoice.js?key=8LG4XCOk"; - cc.assetManager.loadRemote(url, (err: Error, res: cc.JsonAsset) => { - if (err) { - console.error(`[Error] ${url}載入失敗 err: ${err}`); - return; - } - }); + // let url: string = "https://code.responsivevoice.org/responsivevoice.js?key=8LG4XCOk"; + // cc.assetManager.loadRemote(url, (err: Error, res: cc.JsonAsset) => { + // if (err) { + // console.error(`[Error] ${url}載入失敗 err: ${err}`); + // return; + // } + // }); } start(): void { @@ -25,7 +25,7 @@ export default class NewClass extends cc.Component { let url: string = window.location.search; let request: object = []; if (url.indexOf("?") !== -1) { - let str: string = url.substr(1); + let str: string = url.substring(1); let strs: string[] = str.split("&"); for (let i: number = 0; i < strs.length; i++) { request[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]); diff --git a/assets/Test_20210305.fire b/assets/Test_20210305.fire index 7d9fcec..fcc45f2 100644 --- a/assets/Test_20210305.fire +++ b/assets/Test_20210305.fire @@ -88,9 +88,6 @@ }, { "__id__": 20 - }, - { - "__id__": 21 } ], "_prefab": null, @@ -740,7 +737,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 244.68, + "width": 0, "height": 126 }, "_anchorPoint": { @@ -854,16 +851,6 @@ "_originalHeight": 0, "_id": "07dWEKk6NLVIJLgVc2R2cY" }, - { - "__type__": "189e4lIAWlCMrm8kZs8JruY", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 2 - }, - "_enabled": false, - "_id": "d3qfNxVj5LFpFPf1fqqKtH" - }, { "__type__": "3c3b9oxLOFFYZATYissZ8Bu", "_name": "", diff --git a/assets/responsivevoice.js b/assets/responsivevoice.js deleted file mode 100644 index 21babac..0000000 --- a/assets/responsivevoice.js +++ /dev/null @@ -1,699 +0,0 @@ -if (typeof rvAgentPlayer !== 'undefined') { - throw new Error('ResponsiveVoice Website Agent is already running'); -} - -var rvAgentPlayer = { version : 1 }; -var rvApiKey = '8LG4XCOk'; -var rvApiEndpoint = 'https://texttospeech.responsivevoice.org/v1/text:synthesize'; - -if (typeof responsiveVoice === 'undefined') { - -/* - ResponsiveVoice JS v1.8.2 - - (c) 2015-2021 LearnBrite - - License: https://responsivevoice.org/license -*/ -'use strict';Array.from||(Array.from=function(){var w=Object.prototype.toString,y=function(p){return"function"===typeof p||"[object Function]"===w.call(p)},C=Math.pow(2,53)-1;return function(p){var a=Object(p);if(null==p)throw new TypeError("Array.from requires an array-like object - not null or undefined");var q=1a.VOICESUPPORT_ATTEMPTLIMIT&&(clearInterval(b),null!=window.speechSynthesis?a.iOS?(a.iOS11plus?a.systemVoicesReady(a.cache_ios11_voices):a.iOS10?a.systemVoicesReady(a.cache_ios10_voices):a.iOS9?a.systemVoicesReady(a.cache_ios9_voices):a.systemVoicesReady(a.cache_ios_voices),console.log("RV: Voice support ready (cached)")):(console.log("RV: speechSynthesis present but no system voices found"),a.enableFallbackMode()):a.enableFallbackMode()))},100)},100);(a.iOS||a.is_android|| -a.is_safari)&&a.enableWindowClickHook();a.Dispatch("OnLoad")};a.systemVoicesReady=function(b){a.systemvoices=b;a.mapRVs();null!=a.OnVoiceReady&&a.OnVoiceReady.call();a.Dispatch("OnReady");window.hasOwnProperty("dispatchEvent")&&window.dispatchEvent(new Event("ResponsiveVoice_OnReady"))};a.enableFallbackMode=function(){a.fallbackMode=!0;a.forcedFallbackMode=!0;console.log("RV: Enabling fallback mode");a.mapRVs();null!=a.OnVoiceReady&&a.OnVoiceReady.call();a.Dispatch("OnReady");window.hasOwnProperty("dispatchEvent")&& -window.dispatchEvent(new Event("ResponsiveVoice_OnReady"));a.Dispatch("OnServiceSwitched")};a.getVoices=function(){for(var b=[],c=0;ca.CHARACTER_LIMIT){for(var f=b=w(b);f.length>a.CHARACTER_LIMIT;){e=f.search(/([\u3002:!\u00a1?\u00bf;\(\)\[\]\u2014\u00ab\u00bb\n]+|\.[^0-9]+)/);var l="";if(-1==e||e>=a.CHARACTER_LIMIT)e=f.search(/,[^0-9]+/);if((-1==e||e>=a.CHARACTER_LIMIT)&&-1!=f.search(" ")){var u=f.split(" ");for(e=0;ea.CHARACTER_LIMIT){u[e].length>=a.CHARACTER_LIMIT&&(l+=u[e].substr(0,a.CHARACTER_LIMIT-l.length-1));break}l+=(0!=e?" ":"")+u[e]}}else{if(-1==e||e>=a.CHARACTER_LIMIT)e=a.CHARACTER_LIMIT-1;l=f.substr(0,e+1)}f=f.substr(l.length,f.length-l.length);k.push(l)}0=d||(a.timeoutId=setTimeout(c,a.getEstimatedTimeLength(b,d)),a.log("Timeout ID: "+a.timeoutId))};a.checkAndCancelTimeout=function(){null!=a.timeoutId&&(clearTimeout(a.timeoutId),a.timeoutId= -null)};a.speech_timedout=function(){a.cancel();a.cancelled=!1;a.speech_onend()};a.speech_onend=function(){a.checkAndCancelTimeout();!0===a.cancelled?a.cancelled=!1:(a.log("on end fired"),null!=a.msgparameters&&null!=a.msgparameters.onend&&1!=a.msgparameters.onendcalled&&(a.log("Speech on end called -"+a.msgtext),a.msgparameters.onendcalled=!0,a.msgparameters.onend()))};a.speech_onstart=function(){if(!a.onstartFired&&(a.onstartFired=!0,a.log("Speech start"),a.enableEstimationTimeout&&a.useTimer&& -(a.fallbackMode||a.startTimeout(a.msgtext,a.speech_timedout)),a.msgparameters.onendcalled=!1,null!=a.msgparameters&&null!=a.msgparameters.onstart))a.msgparameters.onstart()};a.fallback_startPart=function(){0==a.fallbackChunkIndex&&a.speech_onstart();a.fallback_updateChunksBuffer();a.fallback_audio=a.fallbackChunks[a.fallbackChunkIndex].audio;null==a.fallback_audio?a.log("RV: Fallback Audio is not available"):(function(){var b=a.fallback_audio;setTimeout(function(){b.playbackRate=a.fallback_playbackrate}, -50);b.onloadedmetadata=function(){b.playbackRate=a.fallback_playbackrate};var c=function(h){setTimeout(function(){if(0==h.currentTime){a.log("Audio chunk not playing. Trying to recover. Disabling time estimation");a.enableEstimationTimeout=!1;a.checkAndCancelTimeout();h.load();var e=function(){h.play();h.removeEventListener("canplaythrough",e)};h.addEventListener("canplaythrough",e,!1)}},700)};if(2<=b.readyState)b.play(),c(b);else{var d=function(){b.play();b.removeEventListener("canplaythrough",d)}; -b.addEventListener("canplaythrough",d,!1)}}(),a.fallback_audio.onerror=function(b){function c(){if(this.readyState==this.DONE&&200!==this.status)switch(this.status){case 400:console.error("ResponsiveVoice audio could not be loaded. Invalid parameters.");break;case 403:console.error("ResponsiveVoice invalid API key. See https://responsivevoice.org/register?devtools="+encodeURIComponent(window.location.href));break;default:console.error("ResponsiveVoice audio could not be loaded. There is an issue connecting your browser to the API endpoint.")}} -switch(b.target.error.code){case b.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:var d=new XMLHttpRequest;d.open("GET",b.target.src,!0);d.send();d.onreadystatechange=c;break;default:console.error("ResponsiveVoice: an unknown error occurred.")}},a.fallback_audio.addEventListener("ended",a.fallback_finishPart),a.enableEstimationTimeout&&a.useTimer&&a.startTimeout(a.multipartText[a.fallbackChunkIndex],a.fallback_finishPart))};a.isFallbackAudioPlaying=function(){var b;for(b=0;b 0"):1.5a[g])&&clearTimeout(a[e])},50));return!1};a.AddEventListener=function(b,c){a.hasOwnProperty(b+"_callbacks")||(a[b+"_callbacks"]=[]);a[b+"_callbacks"].push(c)};a.addEventListener=a.AddEventListener;a.RemoveEventListener=function(b,c){a[b+"_callbacks"]&&-1!=a[b+"_callbacks"].indexOf(c)&&a[b+"_callbacks"].splice(a[b+"_callbacks"].indexOf(c),1)};a.clickEvent=function(){a.log("Click event");a.click_event_detected=!0;a.initializePermissionsTimeout= -setTimeout(a.initializePermissions,5);a.userInteractionEvents.forEach(function(b){window.removeEventListener(b,a.clickEvent,!1)});a.Dispatch("OnClickEvent")};a.initializePermissions=function(){if(a.iOS&&!a.iOS_initialized){a.log("Initializing iOS click event");if("undefined"!==typeof speechSynthesis){var b=new SpeechSynthesisUtterance(" ");speechSynthesis.speak(b)}a.iOS_initialized=!0}a.is_android&&!a.android_initialized&&(a.log("Initializing Android click event"),"undefined"!==typeof speechSynthesis&& -(b=new SpeechSynthesisUtterance(" "),speechSynthesis.speak(b)),a.android_initialized=!0);a.initFallbackPool()};a.isPlaying=function(){return a.fallbackMode?null!=a.fallback_audio&&!a.fallback_audio.ended&&!a.fallback_audio.paused:"undefined"!=typeof speechSynthesis?speechSynthesis.speaking:!1};a.clearFallbackPool=function(){for(var b=0;bb;b++){var c=b,d=document.createElement("AUDIO");d.preload="auto";a.is_android&&(d.src="data:audio/mpeg;base64,/+NIxAAAAAAAAAAAAFhpbmcAAAAPAAAAEwAACZAAIiIiIiIqKioqKjMzMzMzRERERERETExMTExdXV1dXWZmZmZmd3d3d3d3gICAgICRkZGRkZmZmZmZqqqqqqqqs7Ozs7PExMTExMzMzMzM3d3d3d3d5ubm5ub39/f39///////AAAAUExBTUUzLjEwMAQoAAAAAAAAAAAVCCQCQCEAAeAAAAmQ/qJL7wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+NIxAAGkAJAGAAAAABn///////////////6w//L/IeGCGc//+U61QAP/4LmWycNjPzmXtEL0VxbXSoQaadV7pSNs2X6hJ3Ok1a9yNRtf7ddPJrLR2nyP/p/30b0OdF6Su29GKp9Ls6LORkWRJ1sOsGr4mUADf9n/P+9v/FR5t08rK1UubPiChtJS2Yoop4MH48ec+PjR01tJJOmX8O3Mvmf//nf6s7pnCzO5wl8y7aVyzX5lLGdCKJYgd6S33q26FtBZVczczydHIbM6oMQuaUADf9n/9v//js/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vEQQh4ViYhGFC/59/vG+MdJtVsaBhUV3+FHcKDf/EVLf/6KCeBWWK2STEFNRTMu/+MYxPIaLG44eAGHLDEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/+MoxMQVRE48eADFKaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/+MYxPELK54oGABHoaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", -d.load(),9==c&&(a.log("Android HTML audio initialized"),a.android_initialized=!0));a.iOS&&(d.src="data:audio/mpeg;base64,/+NIxAAAAAAAAAAAAFhpbmcAAAAPAAAAEwAACZAAIiIiIiIqKioqKjMzMzMzRERERERETExMTExdXV1dXWZmZmZmd3d3d3d3gICAgICRkZGRkZmZmZmZqqqqqqqqs7Ozs7PExMTExMzMzMzM3d3d3d3d5ubm5ub39/f39///////AAAAUExBTUUzLjEwMAQoAAAAAAAAAAAVCCQCQCEAAeAAAAmQ/qJL7wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/+NIxAAGkAJAGAAAAABn///////////////6w//L/IeGCGc//+U61QAP/4LmWycNjPzmXtEL0VxbXSoQaadV7pSNs2X6hJ3Ok1a9yNRtf7ddPJrLR2nyP/p/30b0OdF6Su29GKp9Ls6LORkWRJ1sOsGr4mUADf9n/P+9v/FR5t08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KKw6Zmxn++StD2qiVTXJhRFSftxQ4s7mwjZjKC1IcjKvv8xXov/77EeQqjPV3az/vqlNe6XVJFSs7UVlR7oxnY/eeRFcis7KrkJGMgtyc+lMAFWYnvEQQh4ViYhGFC/59/vG+MdJtVsaBhUV3+FHcKDf/EVLf/6KCeBWWK2STEFNRTMu/+MYxPIaLG44eAGHLDEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/+MoxMQVRE48eADFKaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq/+MYxPELK54oGABHoaqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", -d.load(),9==c&&(a.log("iOS HTML audio initialized"),a.iOS_initialized=!0));a.fallback_audiopool.push(d)}a.fallback_audiopool_index=0}};a.allowSpeechClicked=function(b){a.allowSpeechDiv.parentNode.removeChild(a.allowSpeechDiv);a.allowSpeechDiv=null;if(a.speechAllowedByUser=b)a.clickEvent(),a.scheduledSpeak&&(a.speak(a.scheduledSpeak.text,a.scheduledSpeak.voicename,a.scheduledSpeak.parameters),a.scheduledSpeak=null);a.Dispatch("OnAllowSpeechClicked")};a.checkSpeechAllowed=function(b){if(0==a.speechAllowedByUser)return!1; -var c=a.is_android||a.iOS,d=a.is_safari&&(a.fallbackMode||a.forcedFallbackMode);if(!0!==a.disablePermissionPopup&&(!0===a.allowPermissionPopupEverywhere||c||d||!0===a.speechSynthesisNotAllowedError)&&!a.click_event_detected){if(a.allowSpeechDiv)return;a.allowSpeechDiv_appearances=null==a.allowSpeechDiv_appearances?1:++a.allowSpeechDiv_appearances;if(2'+(void 0!=b.urlOverride?b.urlOverride:window.location.hostname)+" "+(void 0!=b.textOverride?b.textOverride:"wants to play speech")+'
DENY
ALLOW
'; -document.body.appendChild(a.allowSpeechDiv);return!1}return!0};a.fallback_audioPool_getAudio=function(){a.initFallbackPool();a.fallback_audiopool_index>=a.fallback_audiopool.length&&(a.fallback_audiopool_index=0);return a.fallback_audiopool[a.fallback_audiopool_index++]};a.fallback_updateChunksBuffer=function(){for(var b=a.fallbackChunkIndex;be&&(g=c*(h+50*d));a.log("Estimated time length: "+g+" ms, words: ["+b+"], charsCount: "+d);return g};a.validateParameters=function(b,c){if("undefined"===typeof b[c])return b[c];switch(c){case "rate":case "pitch":case "volume":var d=Number(b[c]);isNaN(d)&&console.warn("ResponsiveVoice: the parameter "+c+' has a wrong value "'+b[c]+'". Defaults were used.');b[c]=isNaN(d)?"1":b[c]}return b[c]};a.services= -{NATIVE_TTS:0,FALLBACK_AUDIO:1};a.servicesPriority=[0,1];a.servicesEnabled=[];a.setServiceEnabled=function(b,c){a.servicesEnabled[b]=c};a.getServiceEnabled=function(b){return a.servicesEnabled[b]||!1};a.setServiceEnabled(a.services.NATIVE_TTS,!0);a.setServiceEnabled(a.services.FALLBACK_AUDIO,!0);a.forceFallbackMode=function(b){a.forcedFallbackMode=b;a.fallbackMode=b;a.mapRVs();a.Dispatch("OnServiceSwitched")};a.enableWindowClickHook=function(){a.userInteractionEvents.forEach(function(b){window.addEventListener(b, -a.clickEvent,!1)})};a.setTextReplacements=function(b){if(null==b)q=null;else{q=[];for(var c=0;c -var _wla = _wla || []; -_wla.push(['trackPageView']); -//_wla.setCountPrerender(true); -_wla.push(['enableLinkTracking']); -(function() { - var u="//ai.learnbrite.com/"; - _wla.push(['setTrackerUrl', u+'analytics.php']); - _wla.push(['setSiteId', 75]); - var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; - g.type='text/javascript'; - g.async=true; g.defer=true; g.src=u+'analytics.js.php'; s.parentNode.insertBefore(g,s); })(); */ - -var splitTestEnabled = config.abTesting || false; -var splitTest_useGS = (Math.random() < 0.5); - -function GetRandomMsg(text) { - var texts = text.split("|"); - return texts[Math.floor(Math.random() * texts.length)]; -} - -function getHiddenProp(){ - var prefixes = ['webkit', 'moz', 'ms', 'o']; - - // if 'hidden' is natively supported just return it - if ('hidden' in document) return 'hidden'; - - // otherwise loop over all the known prefixes until we find one - for (var i = 0; i < prefixes.length; i++) { - if ((prefixes[i] + 'Hidden') in document) - return prefixes[i] + 'Hidden'; - } - - // otherwise it's not supported - return null; -} - -function getVisibilityState() { - var prefixes = ['webkit', 'moz', 'ms', 'o']; - - // if 'visibilityState' is natively supported just return it - if ('visibilityState' in document) return 'visibilityState'; - - // otherwise loop over all the known prefixes until we find one - for (var i = 0; i < prefixes.length; i++) { - if ((prefixes[i] + 'VisibilityState') in document) - return prefixes[i] + 'VisibilityState'; - } - // otherwise it's not supported - return null; -} - -function isHidden() { - var prop = getHiddenProp(); - if (!prop) return false; - - return document[prop]; -} - -function isPrerendered() { - var prop = getVisibilityState(); - //console.log(prop); - if (!prop) return false; - //console.log(document[prop]); - if (document[prop] != "prerender") return false; - return document[prop]; -} -console.log("isHidden: " + isHidden()); -console.log("Prerender: " + isPrerendered()); - -//Analytics - - - - -//Search Message - -var prerenderUsed = false; - -if (isPrerendered() && !prerenderUsed) { - prerenderUsed = true; - setTimeout(function () { - - if (!splitTestEnabled || (splitTestEnabled && splitTest_useGS)) { - var txt = GetRandomMsg(''); - if (txt != null && txt != "") { - console.log("Launching search message"); - responsiveVoice.speak("According to Voicebrite, " + txt, ''); - } - } - - //Search Message Split Test - Impression - if (splitTestEnabled) { - if (splitTest_useGS) { - trackEvent('searchMessage', 'impressionAB', 'true'); - } else { - trackEvent('searchMessage', 'impressionAB', 'false'); - } - } else { - trackEvent('searchMessage', 'impression'); - } - - }, 1500); - -} - -window.addEventListener('load', function() { -//We came from prerender - var smessInterval = null; - if (prerenderUsed) { - smessInterval = setInterval(function () { - if (!isPrerendered()) { - - clearInterval(smessInterval); - - //Search Message Split Test - Impression - if (splitTestEnabled) { - if (splitTest_useGS) { - trackEvent('searchMessage', 'visitAB', 'true'); - } else { - trackEvent('searchMessage', 'visitAB', 'false'); - } - } else { - trackEvent('searchMessage', 'visit'); - } - } - }, 1000); - } - - console.log("Configuring"); - - //Speak links - var _allLinks = document.getElementsByTagName('a') - Array.prototype.forEach.call(_allLinks, function(el) { - hoverintent(el, - function () { - if (config.speakLinks) { - //responsiveVoice.cancel(); - responsiveVoice.speak(el.textContent, ''); - trackEvent('agentFeature', 'spokenLink'); - } - }, function () { - } - ); - }); - - - //Speak selected text - var selectedText = ""; - var last_selectedText = ""; - - function getSelectionText() { - var text = ""; - if (window.getSelection) { - text = window.getSelection().toString(); - } else if (document.selection && document.selection.type != "Control") { // for Internet Explorer 8 and below - text = document.selection.createRange().text; - } - return text; - } - - if (config.speakSelectedText) { - attachToElements( document.querySelectorAll("PRE,DIV"), ['mouseup', 'touchend'], onMouseUp); - } - - function attachToElements(elements, events, callback){ - if(elements.length > 0){ - for(var i = 0; i < elements.length; i++){ - events.forEach(function(event){ - elements[i].addEventListener(event, function(e){ - callback(); - }); - }); - } - } - } - - function onMouseUp() { - selectedText = getSelectionText(); - console.log("Selected text *" + selectedText + "*"); - if (selectedText != last_selectedText && selectedText != "") { - last_selectedText = selectedText; - - responsiveVoice.cancel(); // stop anything currently being spoken - responsiveVoice.speak(selectedText, ''); //speak the text as returned by getSelectionText - trackEvent('agentFeature', 'highlightText'); - } - } - - //Speak welcome message. Will only play if user didn't came from google. - var welcomeMessageLaunched = false; - if (config.welcomeMessage && (!config.welcomeMessageTime || oneTimeTest("welcomeMessage")) && !isPrerendered() && !prerenderUsed) { - welcomeMessageLaunched = true; - setTimeout(function () { - if (config.text_welcomeMessage != null && config.text_welcomeMessage != "") { - console.log("Launching welcome message"); - responsiveVoice.speak(GetRandomMsg(config.text_welcomeMessage), ''); - trackEvent('agentFeature', 'welcomeMessage'); - } - }, 1500); - } - - //Speak welcome message when user came from Google. Won't play if default message played - var welcomeMessage2Launched = false; - var welcomeMessage2Interval = null; - if (!welcomeMessageLaunched && config.welcomeMessage2 && (!config.welcomeMessageTime || oneTimeTest("welcomeMessage2")) - && config.text_welcomeMessage2 != null && config.text_welcomeMessage2 != "") { - //Wait until we're visible and launch message - - welcomeMessage2Interval = setInterval(function () { - console.log("Welcome Message from Google Waiting"); - if (!isPrerendered() && !welcomeMessage2Launched) { - console.log("Welcome Message from Google launched"); - - welcomeMessage2Launched = true; - responsiveVoice.speak(GetRandomMsg(config.text_welcomeMessage2), ''); - trackEvent('agentFeature', 'welcomeMessage2'); - clearInterval(welcomeMessage2Interval); - } - - }, 1000); - } - - //Speak when scroll end - function bindScroll() { - if ((window.innerHeight + window.pageYOffset) >= document.body.offsetHeight - 100 && config.text_speakEndPage != null && config.text_speakEndPage != "") { - console.log("bottom"); - window.removeEventListener('scroll', bindScroll); - - responsiveVoice.speak(GetRandomMsg(config.text_speakEndPage), ''); - trackEvent('agentFeature', 'scrollEnd'); - } - } - - if (config.speakEndPage) { - window.addEventListener('scroll', bindScroll); - } - - //Inactivity - var idleTime = 0; - if (config.speakInactivity) { - setInterval(timerIncrement, 1000); - - window.addEventListener('mousemove', function() { - idleTime = 0; - }); - - window.addEventListener('keyup', function() { - idleTime = 0; - }); - } - - function timerIncrement() { - idleTime += 1000; - - if (idleTime >= 30000) { - responsiveVoice.speak(GetRandomMsg(config.text_speakInactivity), ''); - trackEvent('agentFeature', 'inactivity'); - idleTime = 0; - } - } - - //Exit intent - if (config.speakInactivity) { - console.info("setting up exit intent"); - document.addEventListener('mouseout', exitIntent); - } - - function exitIntent(e) { - if (e.clientY < 0) { - responsiveVoice.speak(GetRandomMsg(config.text_exitIntent), ''); - trackEvent('agentFeature', 'exitIntent'); - } - } - - //Tab and ctrl to speak - Accessibility Navigation - var started = 0; - if (config.accesibilityNavigation) { - console.log("accesibilityNavigation"); - - document.addEventListener('keyup',function(e){ - console.log('keyup called'); - - var code = e.keyCode || e.which; - - if(e.target){ - switch(e.target.tagName){ - case 'A': - if (code == '9') { - responsiveVoice.speak('Link 2 ' + e.target.text, ''); - trackEvent('agentFeature', 'accesibilityNavigation', 'tab'); - } - break; - - case 'BUTTON': - if (code == '9') { - setTimeout(responsiveVoice.speak( e.target.textContent + ' button', ''), 1000); - trackEvent('agentFeature', 'accesibilityNavigation', 'tab'); - } - break; - - case 'TEXTAREA': - if (code == '9') { - responsiveVoice.speak('Text Input ' + document.querySelectorAll(':focus')[0].getAttribute('placeholder'), ''); - trackEvent('agentFeature', 'accesibilityNavigation', 'tab'); - } - break; - } - } - }); - } - - if (config.accesibilityNavigation2) { - - document.addEventListener('keyup',function(e){ - console.log('keyup called'); - - var code = e.keyCode || e.which; - - if (code == '40' && e.ctrlKey) { - console.log('ctrl + down arrow'); - - responsiveVoice.speak(document.querySelectorAll('p')[started].textContent, ''); - trackEvent('agentFeature', 'accesibilityNavigation', 'ctrl-arrow'); - document.querySelectorAll('p')[started].scrollIntoView(false); - started = started + 1; - } - if (code == '38' && e.ctrlKey) { - console.log('ctrl + up arrow'); - - responsiveVoice.speak(document.querySelectorAll('p')[started].textContent, ''); - trackEvent('agentFeature', 'accesibilityNavigation', 'ctrl-arrow'); - document.querySelectorAll('p')[started].scrollIntoView(false); - started = started - 1; - if(started < 1){ - started = 0; - } - } - }); - } -}); - - -function createCookie(name, value, days) { - if (days) { - var date = new Date(); - date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); - var expires = "; expires=" + date.toGMTString(); - } else var expires = ""; - document.cookie = name + "=" + value + expires + "; path=/"; -} - -function readCookie(name) { - var nameEQ = name + "="; - var ca = document.cookie.split(';'); - for (var i = 0; i < ca.length; i++) { - var c = ca[i]; - while (c.charAt(0) == ' ') c = c.substring(1, c.length); - if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); - } - return null; -} - -function eraseCookie(name) { - createCookie(name, "", -1); -} - -function getOrCreateTest(name, prob, days) { - - var c = readCookie(name); - - if (c == null) { - console.log("Cookie set"); - var v = (Math.random() < (prob != null ? prob : 0.5)); - //1 hour - createCookie(name, v.toString(), (days != null ? days : (1 / 24))); - return v; - } - console.log("Cookie read"); - return c == (true).toString(); - -} - -function oneTimeTest(name, days) { - - var c = readCookie(name); - - if (c == null) { - console.log("Cookie set - one time True"); - //1 hour - createCookie(name, (false).toString(), (days != null ? days : (0.5 / 24))); - return true; - } - console.log("Cookie read - one time False"); - return false; - -} - -function trackEvent(category, action, name, value) { - - if (config.trackEvents != true) return; - - console.log("Track " + category + "," + action + "," + name); - - var url = 'https://ai.learnbrite.com/analytics.php'; - var postArray = []; - - var data = { - idsite: config.analytics_id, - rec: 1, - url: window.location.href, - rand: Math.floor(Math.random() * 1000000000), - e_c: category, - e_a: action, - e_n: name, - e_v: value - }; - - for (var property in data){ - postArray.push( encodeURI(property + '=' + data[property])); - } - - var xhttp = new XMLHttpRequest(); - - xhttp.open("POST", url, true); - xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); - xhttp.send( postArray.join('&') ); - - xhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - console.log("Tracking Success"); - console.log(data); - } - }; -} diff --git a/assets/responsivevoice.js.meta b/assets/responsivevoice.js.meta deleted file mode 100644 index 465da93..0000000 --- a/assets/responsivevoice.js.meta +++ /dev/null @@ -1,9 +0,0 @@ -{ - "ver": "1.0.8", - "uuid": "d9dfdfa3-96f3-49df-8284-780650f793be", - "isPlugin": true, - "loadPluginInWeb": true, - "loadPluginInNative": true, - "loadPluginInEditor": false, - "subMetas": {} -} \ No newline at end of file