Skip to Content

JavaScript File

URL: https://angradoheroismo.pt/wp-content/plugins/readabler/js/readabler.min.js?ver=1.5.10
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Tue, 26 Sep 2023 08:12:02 GMT
Download Time: Less than a second
Cookies: None
Size: 81 KB
HTTP Headers:  15 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
OK Issues: No issues found

1/*! License information can be found in readabler.js.LICENSE.txt */

2(()=>{"use strict";const e=function(){let e=null,t=!1;function a(e,t){const n=document.createElement("div");return n.classList.add("mdp-readabler-tts-button"),n.innerHTML=e,n.onclick=t,"mdp-readabler-tts-preloader"===n.id?n.style.transition="none":(n.onmouseover=function(){this.style.transform="scale(1.2)"}

3,n.onmouseout=function(){this.style.transform="scale(1)"}

4),n}

5function o(){e&&(e.onended=null,e.stop(0))}

6return function(){const i={gspeak:!0,disable:!1}

7,r={icon:'<svg class="selection__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" enable-background="new 0 0 24 24" width="24" height="24"><path d="M19.3,10.7L9.1,4.2C8.8,4,8.4,4,8.1,4C7,4,7,4.9,7,5.1v13.4c0,0.2,0,1.1,1.1,1.1c0.3,0,0.7,0,1-0.2l10.2-6.5c0.8-0.5,0.7-1.1,0.7-1.1S20.1,11.2,19.3,10.7z"/></svg>',preloader_icon:'<svg class="selection__icon" id="mdp-readabler-tts-preloader" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><rect x="3" y="7" rx="2" ry="2" width="4" height="10"><animate attributeName="y" calcMode="spline" values="7;9;7" keyTimes="0;0.5;1" dur=".6" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/><animate attributeName="height" calcMode="spline" values="10;6;10" keyTimes="0;0.5;1" dur=".6" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/></rect><rect x="8" y="2" rx="2" ry="2" width="4" height="20"><animate attributeName="y" calcMode="spline" values="2;4;2" keyTimes="0;0.5;1" dur=".5" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/><animate attributeName="height" calcMode="spline" values="20;16;20" keyTimes="0;0.5;1" dur=".5" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/></rect><rect x="13" y="4" rx="2" ry="2" width="4" height="16"><animate attributeName="y" calcMode="spline" values="4;7;4" keyTimes="0;0.5;1" dur=".7" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/><animate attributeName="height" calcMode="spline" values="16;10;16" keyTimes="0;0.5;1" dur=".7" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/></rect><rect x="18" y="8" rx="2" ry="2" width="4" height="8"><animate attributeName="y" calcMode="spline" values="8;10;8" keyTimes="0;0.5;1" dur=".8" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/><animate attributeName="height" calcMode="spline" values="8;4;8" keyTimes="0;0.5;1" dur=".8" keySplines="0 0.5 0.5 1;0 0.5 0.5 1" begin="0" repeatCount="indefinite"/></rect></svg>',stop_icon:'<svg class="selection__icon" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M18.001 4.2H6A1.8 1.8 0 0 0 4.2 5.999V18A1.8 1.8 0 0 0 5.999 19.8H18a1.8 1.8 0 0 0 1.799-1.799V6c0-.992-.807-1.799-1.799-1.799z"/></svg>'}

8;let d="",l="",s="",c={}

9,u=52,p=0,m=0;function b(){return new a(r.icon,(function(){if(document.querySelector(".mdp-readabler-tts.stop"))return o(),void g();!function(){const e=document.querySelector(".mdp-readabler-tts .selection__icon"),t=document.createElement("div");t.innerHTML=r.preloader_icon,e.parentNode.replaceChild(t,e);const n=document.querySelector(".mdp-readabler-tts");n.classList.remove("stop"),n.classList.add("loading")}

10();let t=new XMLHttpRequest,a=window.mdpReadablerOptions;t.open("POST",a.textToSpeechAjaxUrl,!0),t.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),t.onload=function(){if(this.status>=200&&this.status<400){if(!n.AudioContext)return void console.warn("Error with creating AudioContext.");n.mdp_readabler_context.decodeAudioData(this.response,(function(t){const a=n.mdp_readabler_context.createBufferSource();a.buffer=t,o(),e=a,a.connect(n.mdp_readabler_context.destination),a.onended=g,a.start(0),function(){const e=document.querySelector(".mdp-readabler-tts .selection__icon"),t=document.createElement("div");t.innerHTML=r.stop_icon,e.parentNode.replaceChild(t,e);const n=document.querySelector(".mdp-readabler-tts");n.classList.remove("loading"),n.classList.add("stop")}

11()}

12),(function(e){console.warn("Error with decoding audio data"+e.err)}

13))}

14else console.error(this.response)}

15,t.onerror=function(){console.error("Connection error.")}

16,t.responseType="arraybuffer",t.send(`action=readablergspeak&nonce=${a.textToSpeechNonce}

17&text=${encodeURIComponent(s)}

18&lang=${document.documentElement.lang}

19`)}

20))}

21function g(){document.querySelector(".mdp-readabler-tts.stop")&&document.querySelector(".mdp-readabler-tts").remove()}

22function h(){const e=d.getRangeAt(0).getBoundingClientRect(),n=window.pageXOffset||document.documentElement.scrollTop||document.body.scrollTop;m=e.left+(e.width-u*c.length)/2,p=t?e.bottom+n+10:e.top+n-u-10}

23function y(){if(document.querySelector(".mdp-readabler-tts")){h();let e=document.querySelector(".mdp-readabler-tts");e.style.top=p+"px",e.style.left=m+"px"}

24}

25function f(){c=function(){const e=[{feature:"gspeak",call:b()}

26],t=document.createElement("div");let n=0;return e.forEach((function(e){i[e.feature]&&(t.appendChild(e.call),n++)}

27)),{icons:t,length:n}

28}

29(),h();const e=document.createElement("div");e.className="mdp-readabler-tts",e.style="top:"+p+"px;left:"+m+"px;",e.appendChild(c.icons);const n=document.createElement("div");n.classList.add("mdp-readabler-tts-arrow"),t&&n.classList.add("mdp-readabler-tts-arrow-mobile"),n.style="left:"+(u*c.length/2-8)+"px;",i.disable||e.appendChild(n),document.body.appendChild(e)}

30function v(){function e(){return null!==n.readabler&&!!window.getSelection().toString()}

31function a(){let e;if(document.selection&&document.selection.createRange)return e=document.selection.createRange(),e.htmlText;if(window.getSelection){const t=window.getSelection();if(t.rangeCount>0){e=t.getRangeAt(0);const n=e.cloneContents(),a=document.createElement("div");return a.appendChild(n),a.innerHTML}

32return""}

33return""}

34function o(){let e;if(t)return window.getSelection?e=window.getSelection():document.getSelection?e=document.getSelection():document.selection&&(e=document.selection.createRange().text),e;if(window.getSelection&&(e=window.getSelection()).modify){if(e=window.getSelection(),!e.isCollapsed){const t=document.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset);const n=t.collapsed;t.detach();const a=e.focusNode,o=e.focusOffset;let i;e.collapse(e.anchorNode,e.anchorOffset),i=n?["backward","forward"]:["forward","backward"],e.modify("move",i[0],"character"),e.modify("move",i[1],"word"),e.extend(a,o),e.modify("extend",i[1],"character"),e.modify("extend",i[0],"word")}

35}

36else if((e=document.selection)&&"Control"!==e.type){const t=e.createRange();if(t.text){for(t.expand("word");/\s$/.test(t.text);)t.moveEnd("character",-1);t.select()}

37}

38return e}

39const i=function(){setTimeout((function(){document.querySelector(".mdp-readabler-tts")?e()?(d=o(),l=a(),s=l,y(),(document.querySelector(".mdp-readabler-tts.stop")||document.querySelector(".mdp-readabler-tts.loading"))&&function(){const e=document.querySelector(".mdp-readabler-tts .selection__icon"),t=document.createElement("div");t.innerHTML=r.icon,e.parentNode.replaceChild(t,e);const n=document.querySelector(".mdp-readabler-tts");n.classList.remove("stop"),n.classList.remove("loading")}

40()):t||document.querySelector(".mdp-readabler-tts.stop")||document.querySelector(".mdp-readabler-tts.loading")||document.querySelector(".mdp-readabler-tts").remove():e()&&(d=o(),l=a(),s=l,f())}

...

</html>