Тестовик

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » Тестовик » Инструменты для пользователя » Прослушивание текста в постах


Прослушивание текста в постах

Сообщений 1 страница 2 из 2

1

Прослушивание текста в постах

Код:
<!--  Прослушивание текста в постах v.2.1.1-->
<script language="javascript">
$(document).ready(function(){$('.post').map(function (){
var ii = $(this).attr('id'),ws = window.speechSynthesis,p = $('.post-content>*:not(.post-sig)',this).text(),col=$('a.permalink').css('color');$.trim(p);
$('a.sharelink',this).before('<i class="material-icons" id="t-'+ii+'" style="float:right;margin-left:0.3em;margin-top:-5px;cursor:pointer;color:'+col+'" original-title="Listen to the text">volume_down</i>');
var spi=(s,im,t)=>$(s).text(im).attr('original-title',t);$('#t-'+ii).tipsy({live:!0,fade:!0,gravity:'ne'}).on('click touchend',function(e){e.preventDefault();
if (!ws){$.jGrowl(UserLogin+', This browser does not support speech synthesis',{position:'center',life:4e3});}else{var ms = new SpeechSynthesisUtterance(p);ms.onend = function(){spi('#t-'+ii,'volume_down','Listen to the text')};
if(!speechSynthesis.speaking){setTimeout(function(){ws.speak(ms)},100);spi(this,'volume_off','Stop reading');}else{setTimeout(function(){ws.cancel();},250);spi(this,'volume_down','Listen to the text');}
}});});});
</script>

Иконка для прослушивания текста в постах

Код:
<!-- Иконка для прослушивание текста в постах -->

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Источник - здесь.

0

2

ВЕРХ

Код:
<!-- Иконка для прослушивание текста в постах -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--  Прослушивание текста в постах v.2.1.1-->
<script language="javascript">
$(document).ready(function(){$('.post').map(function (){
var ii = $(this).attr('id'),ws = window.speechSynthesis,p = $('.post-content>*:not(.post-sig)',this).text(),col=$('a.permalink').css('color');$.trim(p);
$('a.sharelink',this).before('<i class="material-icons" id="t-'+ii+'" style="float:right;margin-left:0.3em;margin-top:-5px;cursor:pointer;color:'+col+'" original-title="Listen to the text">volume_down</i>');
var spi=(s,im,t)=>$(s).text(im).attr('original-title',t);$('#t-'+ii).tipsy({live:!0,fade:!0,gravity:'ne'}).on('click touchend',function(e){e.preventDefault();
if (!ws){$.jGrowl(UserLogin+', This browser does not support speech synthesis',{position:'center',life:4e3});}else{var ms = new SpeechSynthesisUtterance(p);ms.onend = function(){spi('#t-'+ii,'volume_down','Listen to the text')};
if(!speechSynthesis.speaking){setTimeout(function(){ws.speak(ms)},100);spi(this,'volume_off','Stop reading');}else{setTimeout(function(){ws.cancel();},250);spi(this,'volume_down','Listen to the text');}
}});});});
</script>

0


Вы здесь » Тестовик » Инструменты для пользователя » Прослушивание текста в постах


создать форум