TheDesk Mio (15.10.0)

This commit is contained in:
cutls
2018-07-22 22:03:46 +09:00
parent 7dfbd6e2e4
commit 48c184699a
19 changed files with 374 additions and 77 deletions

View File

@@ -58,6 +58,16 @@ function additional(acct_id, tlid) {
console.error(error);
}).then(function(json) {
console.log(json);
//このリンク鳥やんけ、ってとき
if (json.provider_name=="Twitter"){
if(json.image){
var twiImg='<br><img src="'+json.image+'">';
}else{
var twiImg='';
}
$("[toot-id=" + id + "] .additional").html(
'<blockquote class="twitter-tweet"><b>'+json.author_name+'</b><br>'+json.description+twiImg+'</blockquote>');
}
if (json.title) {
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URLチェック:<br>Title:" + json.title + "<br>" +
@@ -149,14 +159,26 @@ function additionalIndv(tlid, acct_id, id) {
console.error(error);
}).then(function(json) {
console.log(json);
if (json.title) {
//このリンク鳥やんけ、ってとき
console.log(json.provider_name);
if (json.provider_name=="Twitter"){
if(json.image){
var twiImg='<br><img src="'+json.image+'" style="max-width:100%">';
}else{
var twiImg='';
}
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URLチェック:<br>Title:" + json.title + "<br>" +
json.description + "</span>");
}
if (json.html) {
$("[toot-id=" + id + "] .additional").html(json.html+'<i class="material-icons sml pointer" onclick="pip(\''+id+'\')" title="ながら観モード">picture_in_picture_alt</i>');
'<div class="twitter-tweet"><b>'+json.author_name+'</b><br>'+json.description+twiImg+'</div>');
}else{
if (json.title) {
$("[toot-id=" + id + "] .additional").html(
"<span class=\"gray\">URLチェック:<br>Title:" + json.title + "<br>" +
json.description + "</span>");
}
if (json.html) {
$("[toot-id=" + id + "] .additional").html(json.html+'<i class="material-icons sml pointer" onclick="pip(\''+id+'\')" title="ながら観モード">picture_in_picture_alt</i>');
}
}
if (json.title) {
$("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");

View File

@@ -39,7 +39,6 @@ function catchToggle(tlid) {
localStorage.setItem("catch_" + tlid, "true");
$("#sta-del-" + tlid).text("On");
$("#sta-del-" + tlid).css("color",'#009688');
$("#timeline_"+tlid).addClass("media-filter");
parseColumn();
}
}
@@ -53,16 +52,6 @@ function catchCheck(tlid) {
$("#sta-del-" + tlid).css("color",'red');
}
}
function catchCheck(tlid) {
var catchck = localStorage.getItem("catch_" + tlid);
if (catchck) {
$("#sta-del-" + tlid).text("On");
$("#sta-del-" + tlid).css("color",'#009688');
} else {
$("#sta-del-" + tlid).text("Off");
$("#sta-del-" + tlid).css("color",'red');
}
}
function delreset(tlid){
$("[tlid=" + tlid + "] .by_delcatch").hide();
$("[tlid=" + tlid + "] .by_delcatch").remove();
@@ -346,4 +335,10 @@ function filterUpdateInternal(json,type){
});
});
}
}
}
/*
<a onclick="catchToggle(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="削除捕捉(削除されても残ります。背景色が変化します。)">delete</i><span id="sta-del-' +
key + '">On</span></a>削除捕捉<a onclick="delreset(' + key +
')" class="pointer">リセット</a><br>
*/

View File

@@ -106,7 +106,10 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter) {
//via通知
var viashow=localStorage.getItem("viashow");
if(!viashow){
viashow="hide";
viashow="via-hide";
}
if(viashow=="hide"){
viashow="via-hide";
}
//認証なしTL
if(mix=="noauth"){

104
app/js/tl/speech.js Normal file
View File

@@ -0,0 +1,104 @@
$voise = null;
$voiseName = 'Google 日本語';
$voices = speechSynthesis.getVoices();
$synthes = new SpeechSynthesisUtterance();
$voise = $.grep($voices, function(n, i){return n.name == $voiseName})[0];
$synthes.voice = $voise; // 音声の設定
localStorage.removeItem("voicebank");
speechSynthesis.cancel()
$synthes.rate=localStorage.getItem("voice_speed");
$synthes.pitch=localStorage.getItem("voice_pitch");
$synthes.volume=localStorage.getItem("voice_vol");
function say(msg){
msg=voiceParse(msg);
var voice=localStorage.getItem("voicebank");
var obj = JSON.parse(voice);
if(!obj){
var json = JSON.stringify([msg]);
localStorage.setItem("voicebank", json);
}else{
obj.push([msg]);
var json = JSON.stringify(obj);
localStorage.setItem("voicebank", json);
}
}
$repeat = setInterval(function() {
if(!speechSynthesis.speaking){
var voice=localStorage.getItem("voicebank");
if(voice){
var obj = JSON.parse(voice);
if(obj[0]){
$synthes.text = obj[0];
speechSynthesis.speak($synthes);
obj.splice(0, 1);
var json = JSON.stringify(obj);
localStorage.setItem("voicebank", json);
}
}
}
}, 300);
function voiceParse(msg){
msg = msg.replace(/#/g, "");
msg = msg.replace(/'/g, "");
msg = msg.replace(/"/g, "");
msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?&]+/g, "");
return msg;
}
function voiceToggle(tlid) {
var voiceck = localStorage.getItem("voice_" + tlid);
if (voiceck) {
localStorage.removeItem("voice_" + tlid);
speechSynthesis.cancel()
$("#sta-voice-" + tlid).text("Off");
$("#sta-voice-" + tlid).css("color",'red');
parseColumn();
} else {
localStorage.setItem("voice_" + tlid, "true");
$("#sta-voice-" + tlid).text("On");
$("#sta-voice-" + tlid).css("color",'#009688');
parseColumn();
}
}
function voiceCheck(tlid) {
var voiceck = localStorage.getItem("voice_" + tlid);
if (voiceck) {
$("#sta-voice-" + tlid).text("On");
$("#sta-voice-" + tlid).css("color",'#009688');
} else {
$("#sta-voice-" + tlid).text("Off");
$("#sta-voice-" + tlid).css("color",'red');
}
}
function voicePlay(){
if(speechSynthesis.speaking){
speechSynthesis.cancel()
}else{
$synthes.text = $("#voicetxt").val();
$synthes.rate = $("#voicespeed").val()/10;
$synthes.pitch = $("#voicepitch").val()/50;
$synthes.volume = $("#voicevol").val()/100;
speechSynthesis.speak($synthes);
}
}
function voiceSettings(){
localStorage.setItem("voice_speed", $("#voicespeed").val()/10);
localStorage.setItem("voice_pitch", $("#voicepitch").val()/50);
localStorage.setItem("voice_vol", $("#voicevol").val()/100);
Materialize.toast("音声読み上げ設定を更新しました。", 3000);
}
function voiceSettingLoad(){
var speed=localStorage.getItem("voice_speed");
var pitch=localStorage.getItem("voice_pitch");
var vol=localStorage.getItem("voice_vol");
if(speed){
$("#voicespeed").val(speed*10);
}
if(pitch){
$("#voicepitch").val(pitch*50);
}
if(vol){
$("#voicevol").val(vol*100);
}
}

View File

@@ -1,5 +1,5 @@
//TL取得
function tl(type, data, acct_id, tlid, delc) {
function tl(type, data, acct_id, tlid, delc, voice) {
scrollevent();
localStorage.removeItem("morelock");
localStorage.removeItem("pool");
@@ -36,14 +36,14 @@ function tl(type, data, acct_id, tlid, delc) {
$("#notice_" + tlid).text("Integrated TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
$("#notice_icon_" + tlid).text("merge_type");
mixtl(acct_id, tlid, "integrated",delc);
mixtl(acct_id, tlid, "integrated",delc,voice);
return;
}else if (type == "plus") {
//Local+なら飛ばす
$("#notice_" + tlid).text("Local+ TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
$("#notice_icon_" + tlid).text("people_outline");
mixtl(acct_id, tlid, "plus",delc);
mixtl(acct_id, tlid, "plus",delc,voice);
return;
}else if (type == "notf") {
//通知なら飛ばす
@@ -100,13 +100,13 @@ function tl(type, data, acct_id, tlid, delc) {
additional(acct_id, tlid);
jQuery("time.timeago").timeago();
todc();
reload(type, '', acct_id, tlid, data, mute, delc);
reload(type, '', acct_id, tlid, data, mute, delc,voice);
$(window).scrollTop(0);
});
}
//Streaming接続
function reload(type, cc, acct_id, tlid, data, mute, delc) {
function reload(type, cc, acct_id, tlid, data, mute, delc, voice) {
if (!type) {
var type = localStorage.getItem("now");
}
@@ -175,6 +175,10 @@ function reload(type, cc, acct_id, tlid, data, mute, delc) {
var obj = JSON.parse(JSON.parse(mess.data).payload);
console.log(obj);
if($("#timeline_" + tlid +" [toot-id=" + obj.id + "]").length < 1){
console.log("speech:"+voice);
if(voice){
say(obj.content)
}
var templete = parse([obj], type, acct_id, tlid,"",mute);
var pool = localStorage.getItem("pool_" + tlid);
if (pool) {