TheDesk Riina (ver.5)

This commit is contained in:
cutls
2018-02-25 00:59:53 +09:00
parent 467d2559dc
commit 5624266f30
18 changed files with 424 additions and 174 deletions

View File

@@ -46,7 +46,8 @@ function post() {
if (box == "yes") {
hide();
}else if (box == "hide"){
mini();
$("body").addClass("mini-post");
$(".mini-btn").text("expand_less");
}
todc();
clear();

View File

@@ -23,10 +23,21 @@ function fav(id, acct_id) {
console.error(error);
}).then(function(json) {
console.log(json);
$("[toot-id=" + id + "] .fav_ct").text(json.favourites_count);
//APIのふぁぼカウントがおかしい
if ($("[toot-id=" + id + "] .fav_ct").text() == json.favourites_count){
if(flag=="unfavourite"){
var fav=json.favourites_count - 1;
}else{
var fav=json.favourites_count + 1;
//var fav = json.favourites_count;
}
}else{
var fav = json.favourites_count;
}
$("[toot-id=" + id + "] .fav_ct").text(fav);
if (!json.reblog) {
} else {
$("[toot-id=" + id + "] .rt_ct").text(json.reblog.reblogs_count);
$("[toot-id=" + id + "] .rt_ct").text(fav);
}
if ($("[toot-id=" + id +"]").hasClass("faved")) {
$("[toot-id=" + id +"]").removeClass("faved");

View File

@@ -130,7 +130,9 @@ function mixre(acct_id, tlid) {
console.log(obj);
var type = JSON.parse(mess.data).event;
if (type == "delete") {
console.log("Delete");
$("[toot-id=" + obj + "]").hide();
$("[toot-id=" + obj + "]").remove();
} else if (type == "update") {
var templete = parse([obj], '', acct_id);
if (!$("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length) {

View File

@@ -60,6 +60,9 @@ function notf(acct_id, tlid, sys) {
$("#notifications_" + tlid).prepend(templete[0]);
}
jQuery("time.timeago").timeago();
} else if (type == "delete") {
$("[toot-id=" + obj + "]").hide();
$("[toot-id=" + obj + "]").remove();
}
}
@@ -71,6 +74,7 @@ function notf(acct_id, tlid, sys) {
//通知トグルボタン
function notfToggle(acct, tlid) {
$("#notf-box_" + tlid).toggleClass("hide");
$("#notf-box_" + tlid).toggleClass("show");
if (!$("#notf-box_" + tlid).hasClass("fetched")) {
notf(acct, tlid);
}
@@ -359,7 +363,7 @@ function parseNotf(obj, popup, tlid, acct_id) {
'</div>' + divider;
} else {
templete = templete + userparse([eachobj.account],"","true");
templete = templete + userparse([eachobj.account],"",acct_id,"true");
var noticetext = eachobj.account.display_name + "(" + eachobj.account.acct +
")がフォローしました";
var memory = localStorage.getItem("notice-mem");

View File

@@ -263,7 +263,7 @@ function parse(obj, mix, acct_id) {
}
//オブジェクトパーサー(ユーザーデータ)
function userparse(obj, auth, notf) {
function userparse(obj, auth, acct_id, notf) {
var templete = '';
var datetype = localStorage.getItem("datetype");
Object.keys(obj).forEach(function(key) {

View File

@@ -2,6 +2,7 @@
//検索ボックストグル
function srcToggle() {
$("#src-box").toggleClass("hide");
$("#src-box").toggleClass("show");
$('ul.tabs').tabs('select_tab', 'src-sta');
$("#src-contents").html("");
}

View File

@@ -33,6 +33,7 @@ function tl(type, data, acct_id, tlid) {
//Integratedなら飛ばす
$("#notice_" + tlid).text("Integrated TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
$("#notice_icon_" + tlid).text("merge_type");
mixtl(acct_id, tlid);
return;
} else if (type == "notf") {
@@ -40,6 +41,7 @@ function tl(type, data, acct_id, tlid) {
notf(acct_id, tlid, 'direct');
$("#notice_" + tlid).text(cap(type, data) + " TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
$("#notice_icon_" + tlid).text("notifications");
return;
}
localStorage.setItem("now", type);
@@ -47,6 +49,7 @@ function tl(type, data, acct_id, tlid) {
var at = localStorage.getItem(domain + "_at");
$("#notice_" + tlid).text(cap(type, data) + " TL(" + localStorage.getItem(
"user_" + acct_id) + "@" + domain + ")");
$("#notice_icon_" + tlid).text(icon(type));
var start = "https://" + domain + "/api/v1/timelines/" + com(type, data);
console.log(start);
fetch(start, {
@@ -256,3 +259,19 @@ function com(type, data) {
return "list/" + data + "?"
}
}
//TLのアイコン
function icon(type) {
if (type == "home") {
return "home"
} else if (type == "local") {
return "people_outline"
} else if (type == "pub") {
return "language"
} else if (type == "tag") {
return "search"
}
if (type == "list") {
return "subject"
}
}

View File

@@ -9,6 +9,8 @@
//カラム追加ボックストグル
function addToggle() {
$("#add-box").toggleClass("hide");
$("#add-box").toggleClass("show");
$("#add-box").toggleClass("notf-box");
}
//最初、カラム変更時に発火
function parseColumn() {
@@ -60,20 +62,24 @@
Object.keys(obj).forEach(function(key) {
var acct = obj[key];
var html = '<div class="box" id="timeline_box_' + key + '_box" tlid="' + key +
'"><div class="notice-box"><span id="notice_' + key + '" class="tl-title"></span><br>' +
'<a onclick="notfToggle(' + acct.domain + ',' + key +
')" class="setting nex" title="このアカウントの通知"><i class="material-icons nex notf-icon_' +
key + '">notifications</i></a>' +
'<a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons nex" title="このカラムを削除">remove_circle</i></a>' +
'<a onclick="mediaToggle(' + key +
')" class="setting nex"><i class="material-icons nex" title="メディアフィルター">perm_media</i><span id="sta-media-' +
key + '">On</span><a onclick="cardToggle(' + key +
')" class="setting nex"><i class="material-icons nex" title="リンクの解析を切り替え(OFFで制限を回避出来る場合があります)">link</i><span id="sta-card-' +
key + '">On</span></a><a onclick="goTop(' + key + ')" class="setting nex"><i class="material-icons nex" title="一番上へ">vertical_align_top</i></a>' +
'<div class="hide notf-indv-box" id="notf-box_' + key +
'"><div id="notifications_' + key +
'"></div></div></div><div class="tl-box" tlid="' + key + '"><div id="timeline_' + key +
'"><div class="notice-box">'+
'<div class="area-notice"><i class="material-icons" id="notice_icon_' + key + '" style="font-size:40px; padding-top:25%;"></i></div>'+
'<div class="area-notice_name"><span id="notice_' + key + '"" class="tl-title"></span></div>'+
'<div class="area-a1"><a onclick="notfToggle(' + acct.domain + ',' + key +
')" class="setting nex" title="このアカウントの通知"><i class="material-icons nex notf-icon_' +
key + '">notifications</i></a></div>'+
'<div class="area-a2"><a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons nex" title="このカラムを削除">remove_circle</i></a></div>'+
'<div class="area-a3"><a onclick="mediaToggle(' + key +
')" class="setting nex"><i class="material-icons nex" title="メディアフィルター">perm_media</i><span id="sta-media-' +
key + '">On</span></div>'+
'<div class="area-a4"><a onclick="cardToggle(' + key +
')" class="setting nex"><i class="material-icons nex" title="リンクの解析を切り替え(OFFで制限を回避出来る場合があります)">link</i><span id="sta-card-' +
key + '">On</span></a></div>'+
'<div class="area-a5"><a onclick="goTop(' + key + ')" class="setting nex"><i class="material-icons nex" title="一番上へ">vertical_align_top</i></a></div>'+
'<div class="hide notf-indv-box" id="notf-box_' + key +
'"><div id="notifications_' + key +
'"></div></div></div><div class="tl-box" tlid="' + key + '"><div id="timeline_' + key +
'" class="tl" tlid="' + key + '"></div></div></div>';
$("#timeline-container").append(html);
if (acct.data) {

View File

@@ -4,6 +4,7 @@ function Rtoggle(){
Rstop();
}else{
$("#radio-view").toggleClass("hide");
$("#radio-view").toggleClass("show");
$("#radio-input").addClass("hide");
}
}

View File

@@ -34,5 +34,8 @@ function scrollck() {
}
function goTop(id){
$("#timeline_box_"+id+"_box .tl-box").scrollTop(0)
if ($("#timeline_box_"+id+"_box .tl-box").scrollTop() > 500){
$("#timeline_box_"+id+"_box .tl-box").scrollTop(500)
}
$("#timeline_box_"+id+"_box .tl-box").animate({scrollTop:0});
}