2018-01-28 23:22:43 +11:00
|
|
|
//レイアウトの設定
|
|
|
|
|
|
|
|
var websocketOld = [];
|
|
|
|
var websocket = [];
|
|
|
|
var websocketHome = [];
|
|
|
|
var websocketLocal = [];
|
2018-02-05 01:56:31 +11:00
|
|
|
var websocketNotf = [];
|
2018-01-28 23:22:43 +11:00
|
|
|
|
|
|
|
//カラム追加ボックストグル
|
|
|
|
function addToggle() {
|
|
|
|
$("#add-box").toggleClass("hide");
|
2018-02-25 02:59:53 +11:00
|
|
|
$("#add-box").toggleClass("show");
|
|
|
|
$("#add-box").toggleClass("notf-box");
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
//最初、カラム変更時に発火
|
|
|
|
function parseColumn() {
|
2018-02-18 03:44:03 +11:00
|
|
|
var size = localStorage.getItem("size");
|
|
|
|
if (size) {
|
|
|
|
$("html").css("font-size", size + "px");
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
var multi = localStorage.getItem("multi");
|
|
|
|
if (!multi) {
|
|
|
|
var obj = [{
|
|
|
|
at: localStorage.getItem(localStorage.getItem("domain_0") + "_at"),
|
|
|
|
name: localStorage.getItem("name_0"),
|
|
|
|
domain: localStorage.getItem("domain_0"),
|
|
|
|
user: localStorage.getItem("user_0"),
|
|
|
|
prof: localStorage.getItem("prof_0")
|
|
|
|
}];
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
localStorage.setItem("multi", json);
|
|
|
|
} else {
|
|
|
|
var obj = JSON.parse(multi);
|
|
|
|
|
|
|
|
var templete;
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
|
|
|
var acct = obj[key];
|
|
|
|
localStorage.setItem("name_" + key, acct.name);
|
|
|
|
localStorage.setItem("user_" + key, acct.user);
|
2018-02-18 05:44:20 +11:00
|
|
|
localStorage.setItem("user-id_" + key, acct.id);
|
2018-01-28 23:22:43 +11:00
|
|
|
localStorage.setItem("prof_" + key, acct.prof);
|
|
|
|
localStorage.setItem("domain_" + key, acct.domain);
|
|
|
|
localStorage.setItem(acct.domain + "_at", acct.at);
|
2018-02-09 03:43:11 +11:00
|
|
|
ckdb(key);
|
2018-01-28 23:22:43 +11:00
|
|
|
});
|
|
|
|
}
|
|
|
|
var col = localStorage.getItem("column");
|
|
|
|
if (!col) {
|
|
|
|
var obj = [{
|
|
|
|
domain: 0,
|
|
|
|
type: 'local'
|
|
|
|
}];
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
localStorage.setItem("column", json);
|
|
|
|
} else {
|
|
|
|
var obj = JSON.parse(col);
|
|
|
|
}
|
|
|
|
if ($("#timeline-container").length) {
|
|
|
|
$("#timeline-container").html("");
|
|
|
|
}
|
|
|
|
tlCloser();
|
|
|
|
Object.keys(obj).forEach(function(key) {
|
|
|
|
var acct = obj[key];
|
2018-02-05 01:56:31 +11:00
|
|
|
var html = '<div class="box" id="timeline_box_' + key + '_box" tlid="' + key +
|
2018-02-25 18:21:13 +11:00
|
|
|
'"><div class="notice-box z-depth-2">'+
|
2018-02-26 00:37:04 +11:00
|
|
|
'<div class="area-notice"><i class="material-icons waves-effect" id="notice_icon_' + key + '" style="font-size:40px; padding-top:25%;" onclick="goTop(' + key + ')"></i></div>'+
|
2018-02-25 02:59:53 +11:00
|
|
|
'<div class="area-notice_name"><span id="notice_' + key + '"" class="tl-title"></span></div>'+
|
|
|
|
'<div class="area-a1"><a onclick="notfToggle(' + acct.domain + ',' + key +
|
2018-02-26 00:37:04 +11:00
|
|
|
')" class="setting nex" title="このアカウントの通知"><i class="material-icons waves-effect nex notf-icon_' +
|
2018-02-25 02:59:53 +11:00
|
|
|
key + '">notifications</i></a></div>'+
|
|
|
|
'<div class="area-a2"><a onclick="removeColumn(' + key +
|
2018-02-26 00:37:04 +11:00
|
|
|
')" class="setting nex"><i class="material-icons waves-effect nex" title="このカラムを削除">remove_circle</i></a></div>'+
|
2018-02-25 02:59:53 +11:00
|
|
|
'<div class="area-a3"><a onclick="mediaToggle(' + key +
|
2018-02-26 00:37:04 +11:00
|
|
|
')" class="setting nex"><i class="material-icons waves-effect nex" title="メディアフィルター">perm_media</i><span id="sta-media-' +
|
2018-02-25 02:59:53 +11:00
|
|
|
key + '">On</span></div>'+
|
|
|
|
'<div class="area-a4"><a onclick="cardToggle(' + key +
|
2018-02-26 00:37:04 +11:00
|
|
|
')" class="setting nex"><i class="material-icons waves-effect nex" title="リンクの解析を切り替え(OFFで制限を回避出来る場合があります)">link</i><span id="sta-card-' +
|
2018-02-25 02:59:53 +11:00
|
|
|
key + '">On</span></a></div>'+
|
2018-02-26 00:37:04 +11:00
|
|
|
'<div class="area-a5"><a onclick="goTop(' + key + ')" class="setting nex"><i class="material-icons waves-effect nex" title="一番上へ">vertical_align_top</i></a></div>'+
|
2018-02-25 02:59:53 +11:00
|
|
|
'<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 +
|
2018-02-05 01:56:31 +11:00
|
|
|
'" class="tl" tlid="' + key + '"></div></div></div>';
|
2018-01-28 23:22:43 +11:00
|
|
|
$("#timeline-container").append(html);
|
|
|
|
if (acct.data) {
|
|
|
|
var data = acct.data;
|
|
|
|
} else {
|
|
|
|
var data = "";
|
|
|
|
}
|
|
|
|
tl(acct.type, data, acct.domain, key);
|
2018-02-18 03:44:03 +11:00
|
|
|
notf(acct.domain, key);
|
2018-01-28 23:22:43 +11:00
|
|
|
cardCheck(key);
|
2018-02-18 03:44:03 +11:00
|
|
|
mediaCheck(key);
|
2018-01-28 23:22:43 +11:00
|
|
|
});
|
|
|
|
var width = localStorage.getItem("width");
|
|
|
|
if (width) {
|
|
|
|
$(".box").css("min-width", width + "px");
|
|
|
|
}
|
|
|
|
var box = localStorage.getItem("box");
|
|
|
|
if (box == "yes") {
|
|
|
|
$("#post-box").addClass("hidenbox");
|
|
|
|
$("#post-box").fadeOut();
|
|
|
|
$("#menu-btn").fadeIn();
|
2018-02-24 03:02:44 +11:00
|
|
|
}else if (box == "hide"){
|
|
|
|
$("body").addClass("mini-post");
|
|
|
|
$(".mini-btn").text("expand_less");
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
|
|
|
var vis = localStorage.getItem("vis");
|
|
|
|
if (!vis) {
|
|
|
|
$("#vis").text("public");
|
|
|
|
} else {
|
|
|
|
if (vis == "memory") {
|
|
|
|
var memory = localStorage.getItem("vis-memory");
|
|
|
|
if (!memory) {
|
|
|
|
memory = "public";
|
|
|
|
}
|
|
|
|
$("#vis").text(memory);
|
|
|
|
} else {
|
|
|
|
$("#vis").text(vis);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//カラム追加
|
|
|
|
function addColumn() {
|
|
|
|
var acct = $("#add-acct-sel").val();
|
|
|
|
localStorage.setItem("last-use", acct);
|
|
|
|
var type = $("#type-sel").val();
|
|
|
|
var add = {
|
|
|
|
domain: acct,
|
|
|
|
type: type
|
|
|
|
};
|
|
|
|
var multi = localStorage.getItem("column");
|
|
|
|
var obj = JSON.parse(multi);
|
2018-02-05 02:04:26 +11:00
|
|
|
localStorage.setItem("card_" + obj.length,"true");
|
2018-01-28 23:22:43 +11:00
|
|
|
obj.push(add);
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
localStorage.setItem("column", json);
|
|
|
|
parseColumn();
|
|
|
|
}
|
|
|
|
//カラム削除
|
|
|
|
function removeColumn(tlid) {
|
|
|
|
var multi = localStorage.getItem("column");
|
|
|
|
var obj = JSON.parse(multi);
|
|
|
|
//聞く
|
2018-02-18 16:43:11 +11:00
|
|
|
var electron = require("electron");
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
ipc.send('column-del', "");
|
|
|
|
ipc.on('column-del-reply', function (event, arg) {
|
|
|
|
console.log(arg);
|
|
|
|
if(arg==0){
|
|
|
|
localStorage.removeItem("card_" + tlid);
|
|
|
|
obj.splice(tlid, 1);
|
|
|
|
var json = JSON.stringify(obj);
|
|
|
|
localStorage.setItem("column", json);
|
|
|
|
parseColumn();
|
|
|
|
}
|
|
|
|
})
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|