TheDesk Airi (ver.7)
This commit is contained in:
@@ -22,9 +22,9 @@ function notf(acct_id, tlid, sys) {
|
||||
Object.keys(json).forEach(function(key) {
|
||||
var obj = json[key];
|
||||
if(obj.type!="follow"){
|
||||
templete = templete+parse([obj], '', acct_id, tlid, -1);
|
||||
templete = templete+parse([obj], 'notf', acct_id, tlid, -1);
|
||||
}else{
|
||||
templete = templete+userparse([obj.account], '', acct_id, tlid, -1);
|
||||
templete = templete+userparse([obj.account], 'notf', acct_id, tlid, -1);
|
||||
}
|
||||
|
||||
});
|
||||
@@ -64,9 +64,9 @@ function notf(acct_id, tlid, sys) {
|
||||
}
|
||||
var templete="";
|
||||
if(obj.type!="follow"){
|
||||
templete = templete+parse([obj], '', acct_id, tlid, popup);
|
||||
templete = templete+parse([obj], 'notf', acct_id, tlid, popup);
|
||||
}else{
|
||||
templete = templete+userparse([obj], '', acct_id, tlid, popup);
|
||||
templete = templete+userparse([obj], 'notf', acct_id, tlid, popup);
|
||||
}
|
||||
$("div[data-notf=" + acct_id +"]").prepend(templete);
|
||||
jQuery("time.timeago").timeago();
|
||||
|
@@ -78,7 +78,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
var times=[];
|
||||
Object.keys(obj).forEach(function(key) {
|
||||
var toot = obj[key];
|
||||
if(popup){
|
||||
if (mix == "notf") {
|
||||
if (toot.type == "mention") {
|
||||
var what = "返信しました";
|
||||
} else if (toot.type == "reblog") {
|
||||
@@ -97,7 +97,9 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
var memory = localStorage.getItem("notice-mem");
|
||||
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
|
||||
var domain = localStorage.getItem("domain_" + acct_id);
|
||||
Materialize.toast("["+domain+"より]"+toot.account.display_name+"が"+what, popup * 1000);
|
||||
if(popup>0){
|
||||
Materialize.toast("["+domain+"より]"+toot.account.display_name+"が"+what, popup * 1000);
|
||||
}
|
||||
$(".notf-icon_" + acct_id).addClass("red-text");
|
||||
localStorage.setItem("notice-mem", noticetext);
|
||||
noticetext = "";
|
||||
@@ -169,10 +171,8 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
var spoiler_show = '<a href="#" onclick="cw_show(\'' + toot.id +
|
||||
'\')" class="nex parsed">見る</a><br>';
|
||||
} else {
|
||||
var ct1 = toot.content.split('</p>').length + toot.content.split('<br />').length -
|
||||
2;
|
||||
var ct2 = toot.content.split('</p>').length + toot.content.split('<br>').length -
|
||||
2;
|
||||
var ct1 = toot.content.split('</p>').length + toot.content.split('<br />').length -2;
|
||||
var ct2 = toot.content.split('</p>').length + toot.content.split('<br>').length -2;
|
||||
if(ct1>ct2){ var ct= ct1; }else{ var ct= ct2; }
|
||||
if ((sent < ct && $.mb_strlen($.strip_tags(toot.content)) > 5) || ($.strip_tags(toot.content).length > ltr && $.mb_strlen($.strip_tags(toot.content)) > 5)) {
|
||||
var content = '<span class="gray">以下全文</span><br>' + toot.content
|
||||
@@ -189,7 +189,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
|
||||
var spoiler_show = "";
|
||||
}
|
||||
}
|
||||
var urls = content.match(
|
||||
var urls = $.strip_tags(content).replace(/\n/g, " ").match(
|
||||
/https?:\/\/([-a-zA-Z0-9@.]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/
|
||||
);
|
||||
if (urls) {
|
||||
|
@@ -40,7 +40,7 @@ function tl(type, data, acct_id, tlid) {
|
||||
} else if (type == "notf") {
|
||||
//通知なら飛ばす
|
||||
//notf(acct_id, tlid, 'direct');
|
||||
$("#notice_" + tlid).text(cap(type, data) + " TL(" + localStorage.getItem(
|
||||
$("#notice_" + tlid).text(cap(type, data, acct_id) + "(" + localStorage.getItem(
|
||||
"user_" + acct_id) + "@" + domain + ")");
|
||||
$("#notice_icon_" + tlid).text("notifications");
|
||||
return;
|
||||
@@ -48,7 +48,7 @@ function tl(type, data, acct_id, tlid) {
|
||||
localStorage.setItem("now", type);
|
||||
todo(cap(type) + " TL Loading...");
|
||||
var at = localStorage.getItem(domain + "_at");
|
||||
$("#notice_" + tlid).text(cap(type, data) + " TL(" + localStorage.getItem(
|
||||
$("#notice_" + tlid).text(cap(type, data, acct_id) + "(" + localStorage.getItem(
|
||||
"user_" + acct_id) + "@" + domain + ")");
|
||||
$("#notice_icon_" + tlid).text(icon(type));
|
||||
var url=com(type, data);
|
||||
@@ -119,7 +119,7 @@ function reload(type, cc, acct_id, tlid, data) {
|
||||
}
|
||||
websocket[wsid].onmessage = function(mess) {
|
||||
console.log(tlid + ":Receive Streaming API:");
|
||||
console.log(websocket[wsid]);
|
||||
console.log(mess);
|
||||
|
||||
|
||||
var typeA = JSON.parse(mess.data).event;
|
||||
@@ -256,20 +256,37 @@ function tlCloser() {
|
||||
}
|
||||
|
||||
//TLのタイトル
|
||||
function cap(type, data) {
|
||||
function cap(type, data, acct_id) {
|
||||
if (type == "home") {
|
||||
return "Home"
|
||||
if(localStorage.getItem("home_" + acct_id)){
|
||||
var response=localStorage.getItem("home_" + acct_id);
|
||||
}else{
|
||||
var response="Home TL";
|
||||
}
|
||||
} else if (type == "local") {
|
||||
return "Local"
|
||||
if(localStorage.getItem("local_" + acct_id)){
|
||||
var response=localStorage.getItem("local_" + acct_id);
|
||||
}else{
|
||||
var response="Local TL";
|
||||
}
|
||||
} else if (type == "pub") {
|
||||
return "Public"
|
||||
if(localStorage.getItem("public_" + acct_id)){
|
||||
var response=localStorage.getItem("public_" + acct_id);
|
||||
}else{
|
||||
var response="Federated TL";
|
||||
}
|
||||
} else if (type == "tag") {
|
||||
return "#" + data
|
||||
var response= "#" + data
|
||||
} else if (type == "list") {
|
||||
return "List(id:" + data + ")"
|
||||
var response= "List(id:" + data + ")"
|
||||
} else if (type == "notf") {
|
||||
return "Notification"
|
||||
if(localStorage.getItem("notification_" + acct_id)){
|
||||
var response=localStorage.getItem("notification_" + acct_id);
|
||||
}else{
|
||||
var response="Notification TL";
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
//TLのURL
|
||||
|
Reference in New Issue
Block a user