height: 140, text: document_recurl, colorDark : '#0000ff', colorLight : '#ffffff' }); $("a.opt_print").click(function(){ window.open(print_recurl+"?docurl="+document_recurl_2,"_blank"); }); var audio = null; var _tts_str_size = 2000; function cas_tts(text_arr){ if(text_arr.length > 0){ audio = btts({ tex: text_arr[0], tok: _bd_tk, spd: 5, pit: 5, vol: 15, per: 1 }, { volume: 1, autoDestory: false, timeout: 10000, hidden: false, onInit: function (htmlAudioElement) { if(text_arr.length > 1){ htmlAudioElement.onended = function() { document.getElementById("_yybb").removeChild(audio); $("#_yybb_gen").find("p").html("继续合成中..."); document.getElementById('_yybb_gen').style.display = 'block'; document.getElementById('_yybb').style.display = 'none'; text_arr.shift(); cas_tts(text_arr); } } }, onSuccess: function(htmlAudioElement) { audio = htmlAudioElement; document.getElementById('_yybb_gen').style.display = 'none'; document.getElementById('_yybb').style.display = 'block'; audio.play(); }, onError: function(text) { alert("合成失败,请稍后再试"); }, onTimeout: function () { alert("合成超时,请稍后再试"); } }); }else{ $("#_yybb_gen").find("p").html("无内容播报"); } } $("#_yybb_gen").click(function(){ $(this).find("p").html("语音合成中..."); var _text = document.getElementById('_content').innerText; var _t_arr = new Array(); var _tts_str_index = 0; if(_text == null || _text == ""){ $("#_yybb_gen").find("p").html("无内容播报"); return; } if(_text.length > _tts_str_size){ while(_text != null){ if(_text.length > _tts_str_size){ _t_arr[_tts_str_index] = _text.substr(0, _tts_str_size); _text = _text.substr(_tts_str_size, _text.length); }else{ _t_arr[_tts_str_index] = _text; break; } _tts_str_index ++; } }else{ _t_arr[0] = _text; } cas_tts(_t_arr); }); }); var NowChannel1='其他'; var NowChannel2='深度'; $("#nav li").eq(0).addClass("now"); $(".pad_nav li").eq(0).addClass("cur"); $("#nav li").each(function(){ var channelDesc=$(this).find("a").html(); if(channelDesc==NowChannel1 || channelDesc==NowChannel2){ $(this).addClass("now").siblings().removeClass("now"); } }); $(".pad_nav li").each(function(){ var channelDesc=$(this).find("a").html(); if(channelDesc==NowChannel1 || channelDesc==NowChannel2){ $(this).addClass("cur").siblings().removeClass("cur"); setSwiperNav($(".pad_nav li").index($(".pad_nav li.cur"))); } }); setSwiperNav(0);