thedesk/app/js/ui/layout.js

579 lines
25 KiB
JavaScript
Raw Normal View History

2018-01-28 23:22:43 +11:00
//レイアウトの設定
2018-03-27 13:39:35 +11:00
var websocketOld = [];
var websocket = [];
var websocketHome = [];
var websocketLocal = [];
var websocketNotf = [];
2018-01-28 23:22:43 +11:00
2018-03-27 13:39:35 +11:00
//カラム追加ボックストグル
function addColumnMenu() {
$("#left-menu div").removeClass("active");
$("#addColumnMenu").addClass("active");
$(".menu-content").addClass("hide");
2019-05-19 17:39:30 +10:00
$("#add-box").removeClass("hide");
2018-03-27 13:39:35 +11:00
addselCk()
}
2019-05-19 17:39:30 +10:00
$('.type').click(function () {
2019-03-16 02:40:20 +11:00
$(".type").removeClass("active");
$(this).addClass("active");
$("#type-sel").val($(this).attr("data-type"))
})
2018-01-28 23:22:43 +11:00
//最初、カラム変更時に発火
function parseColumn(target, dontclose) {
if (target === 0) {
//this is kuso
target = "zero"
}
2019-05-19 17:39:30 +10:00
console.log("%c Parse column", "color:red;font-size:125%");
2018-03-27 13:39:35 +11:00
var size = localStorage.getItem("size");
if (size) {
$("#timeline-container").css("font-size", size + "px");
$(".toot-reset").css("font-size", size + "px");
$(".cont-series").css("font-size", size + "px");
}
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("menu-done")) {
2019-04-23 00:16:57 +10:00
$("#fukidashi").addClass("hide")
}
if (!dontclose && !target) {
2019-05-11 02:31:15 +10:00
tlCloser();
}
2018-03-27 13:39:35 +11:00
var multi = localStorage.getItem("multi");
2019-04-11 02:52:01 +10:00
if (multi) {
2018-03-27 13:39:35 +11:00
var obj = JSON.parse(multi);
2019-05-19 17:39:30 +10:00
2018-03-27 13:39:35 +11:00
var templete;
2019-05-19 17:39:30 +10:00
Object.keys(obj).forEach(function (key) {
2018-01-28 23:22:43 +11:00
var acct = obj[key];
2018-03-27 13:39:35 +11:00
localStorage.setItem("name_" + key, acct.name);
localStorage.setItem("user_" + key, acct.user);
localStorage.setItem("user-id_" + key, acct.id);
localStorage.setItem("prof_" + key, acct.prof);
localStorage.setItem("domain_" + key, acct.domain);
2019-05-19 17:39:30 +10:00
localStorage.setItem("acct_" + key + "_at", acct.at);
2018-03-27 13:39:35 +11:00
notf(key, 0);
ckdb(key);
2018-07-17 01:39:06 +10:00
//フィルターデータ読もう
getFilter(key);
2019-05-11 02:31:15 +10:00
var domain = localStorage.getItem("domain_" + key);
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + domain) == "misskey") {
2019-05-11 02:31:15 +10:00
localStorage.removeItem("misskey_wss_" + key)
2019-07-09 01:27:18 +10:00
connectMisskey(key, false)
2019-05-11 02:31:15 +10:00
}
2018-01-28 23:22:43 +11:00
});
2018-03-27 13:39:35 +11:00
}
2019-05-19 17:39:30 +10:00
var acctlist = obj;
2019-05-19 16:17:05 +10:00
console.table(obj);
2019-03-19 02:24:46 +11:00
/*var xed=localStorage.getItem("xed");
2018-03-27 13:39:35 +11:00
if(xed){
xpand();
2019-03-19 01:01:45 +11:00
}*/
2018-03-27 13:39:35 +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);
}
var numtarget = false
if (target == "add") {
var tlidtar = obj.length - 1
obj = [obj[tlidtar]]
} else if (target) {
var tlidtar = target
if (target == "zero") {
target = 0
}
obj = [obj[target]]
numtarget = true
} else {
var tlidtar = null
if ($("#timeline-container").length) {
$("#timeline-container").html("");
}
2018-03-27 13:39:35 +11:00
}
2019-05-19 17:39:30 +10:00
var basekey = 0;
for (var key = 0; key < obj.length; key++) {
var next = key + 1;
//acctって言いながらタイムライン
2018-03-27 13:39:35 +11:00
var acct = obj[key];
if (tlidtar) {
if (tlidtar == "zero") {
key = 0
} else {
key = tlidtar
}
}
2019-05-19 17:39:30 +10:00
if (acct.type == "notf") {
var notf_attr = ' data-notf=' + acct.domain;
var if_notf = "hide";
} else {
var notf_attr = '';
var if_notf = "";
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("notification_" + acct.domain)) {
var unique_notf = lang.lang_layout_thisacct.replace("{{notf}}", localStorage.getItem("notification_" + acct.domain));
} else {
if (lang.language == "ja") {
var notflocale = "通知";
} else if (lang.language == "en") {
var notflocale = "Notification";
2018-04-07 14:31:09 +10:00
}
2019-05-19 17:39:30 +10:00
var unique_notf = lang.lang_layout_thisacct.replace("{{notf}}", notflocale);
}
var insert = "";
var icnsert = "";
if (acct.background) {
if (acct.text == "def") {
} else {
if (acct.text == "black") {
var txhex = "000000";
var ichex = "9e9e9e"
} else if (acct.text == "white") {
var txhex = "ffffff";
var ichex = "eeeeee"
}
insert = 'background-color:#' + acct.background + '; color: #' + txhex + '; ';
icnsert = ' style="color: #' + ichex + '" ';
2018-04-07 14:31:09 +10:00
}
}
2019-03-21 06:42:47 +11:00
console.log(acct);
2019-05-19 17:39:30 +10:00
if (acctlist[acct.domain]) {
if (acctlist[acct.domain].background != "def") {
insert = insert + " border-bottom:medium solid #" + acctlist[acct.domain].background + ";";
2018-07-07 03:51:48 +10:00
}
2018-06-18 00:26:45 +10:00
}
2019-05-19 17:39:30 +10:00
if (acct.type == "notf" && localStorage.getItem("setasread") == "no") {
localStorage.setItem("hasNotfC_" + acct.domain, "true");
} else {
2018-08-17 03:21:40 +10:00
localStorage.removeItem("hasNotfC_" + acct.domain);
}
2019-05-19 17:39:30 +10:00
if (acct.type == "webview") {
if (localStorage.getItem("fixwidth")) {
var fixwidth = localStorage.getItem("fixwidth");
var css = " min-width:" + fixwidth + "px;"
} else {
var css = "";
2019-02-27 03:51:37 +11:00
}
2019-05-19 17:39:30 +10:00
var html = webviewParse("https://tweetdeck.twitter.com", key, insert, icnsert, css);
2018-09-10 03:06:00 +10:00
$("#timeline-container").append(html);
2019-05-19 17:39:30 +10:00
} else if (acct.type == "tootsearch") {
if (!acct.left_fold) {
basekey = key;
}
var width = localStorage.getItem("width");
if (width) {
2019-05-19 17:39:30 +10:00
var css = " min-width:" + width + "px;"
}
var anime = localStorage.getItem("animation");
2019-05-19 17:39:30 +10:00
if (anime == "yes" || !anime) {
var animecss = "box-anime";
} else {
var animecss = "";
}
2019-05-19 17:39:30 +10:00
unstreamingTL(acct.type, key, basekey, insert, icnsert, acct.left_fold, css, animecss, acct.data);
} else {
2019-02-27 03:51:37 +11:00
var width = localStorage.getItem("width");
2019-05-19 17:39:30 +10:00
if (width) {
var css = " min-width:" + width + "px;"
}
var anime = localStorage.getItem("animation");
if (anime == "yes" || !anime) {
var animecss = "box-anime";
} else {
var animecss = "";
}
2019-09-08 02:44:28 +10:00
var unread = '<a id="unread_' + key + '" onclick="showUnread(' + key + ',\'' + acct.type + '\',\'' + acct.domain + '\')" class="setting nex" title="' + lang.lang_layout_unread + '"><i class="material-icons waves-effect nex">more</i></a>'
2019-05-19 17:39:30 +10:00
if (acct.type == "notf") {
2019-06-16 21:35:15 +10:00
var exclude = lang.lang_excluded + ':<br><label><input type="checkbox" class="filled-in" id="exc-reply-' + key + '" ' + excludeCk(key, "mention") + ' /><span><i class="fas fa-share exc-icons"></i></span></label> ' +
'<label><input type="checkbox" class="filled-in" id="exc-fav-' + key + '" ' + excludeCk(key, "favourite") + ' /><span><i class="fas fa-star exc-icons"></i></span></label> ' +
'<label><input type="checkbox" class="filled-in" id="exc-bt-' + key + '" ' + excludeCk(key, "reblog") + ' /><span><i class="fas fa-retweet exc-icons"></i></span></label> ' +
'<label><input type="checkbox" class="filled-in" id="exc-follow-' + key + '" ' + excludeCk(key, "follow") + ' /><span><i class="fas fa-users exc-icons"></i></span></label> ' +
'<label><input type="checkbox" class="filled-in" id="exc-poll-' + key + '" ' + excludeCk(key, "poll") + ' /><span><i class="fas fa-tasks exc-icons"></i></span></label> ' +
'<button class="btn waves-effect" style="width:60px; padding:0;" onclick="exclude(' + key + ')">Filter</button>';
2019-06-15 02:32:59 +10:00
if (checkNotfFilter(key)) {
exclude = exclude + '<button class="btn red waves-effect" style="width:60px; padding:0;" onclick="resetNotfFilter(' + key + ')">Clear all</button>'
}
exclude = exclude + "<br>";
2019-09-07 02:33:30 +10:00
2019-05-19 17:39:30 +10:00
} else if (acct.type == "home") {
var exclude = '<a onclick="ebtToggle(' + key +
')" class="setting nex"><i class="fas fa-retweet waves-effect nex" title="' + lang.lang_layout_excludingbt + '" style="font-size:24px"></i><span id="sta-bt-' +
key + '">Off</span></a>' + lang.lang_layout_excludingbt + '<br>';
2019-09-07 02:33:30 +10:00
2019-05-19 17:39:30 +10:00
} else {
var exclude = "";
2019-09-07 02:33:30 +10:00
unread = ""
2019-05-19 17:39:30 +10:00
}
2019-09-08 10:39:26 +10:00
var markers = localStorage.getItem("markers");
if (markers == "no") {
markers = false;
} else {
markers = true
}
if (!markers) {
unread = ""
}
2019-05-19 17:39:30 +10:00
if (!acct.left_fold) {
basekey = key;
if (!numtarget) {
var basehtml = '<div style="' + css + '" class="box ' + animecss + '" id="timeline_box_' + basekey + '_parentBox"></div>';
$("#timeline-container").append(basehtml);
}
2019-05-19 17:39:30 +10:00
var left_hold = '<a onclick="leftFoldSet(' + key + ')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_leftFold + '">view_agenda</i></a>' + lang.lang_layout_leftFold + '</span><br>';
} else {
var left_hold = '<a onclick="leftFoldRemove(' + key + ')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_leftUnfold + '">view_column</i></a>' + lang.lang_layout_leftUnfold + '</span><br>';
2019-03-21 06:42:47 +11:00
}
2019-05-19 17:39:30 +10:00
if (key === 0) {
left_hold = '';
2019-03-21 06:42:47 +11:00
}
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct.domain)) == "misskey") {
var isMisRed = ""
exclude = ""
var if_misskey_hide = "hide"
} else {
var isMisRed = "red-text"
var if_misskey_hide = ""
2019-05-08 01:48:59 +10:00
}
2019-05-19 17:39:30 +10:00
var html = '<div class="boxIn" id="timeline_box_' + key + '_box" tlid="' + key +
'" data-acct="' + acct.domain + '"><div class="notice-box z-depth-2" id="menu_' + key + '" style="' + insert + ' ">' +
'<div class="area-notice"><i class="material-icons waves-effect ' + isMisRed + '" id="notice_icon_' + key + '"' + notf_attr + ' style="font-size:40px; padding-top:25%;" onclick="checkStr(\'' + acct.type + '\', \'' + data + '\', \'' + acct.domain + '\', \'' + key + '\', \'' + delc + '\',\'' + voice + '\',null)" title="' + lang.lang_layout_gotop + '"></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 ' + if_notf + '" title="' + unique_notf + '"' + icnsert + '><i class="material-icons waves-effect nex notf-icon_' +
2019-09-07 02:33:30 +10:00
acct.domain + '">notifications</i></a>' + unread + '</div><div class="area-sta"><span class="new badge teal notf-reply_' + acct.domain + ' hide" data-badge-caption="Reply">0</span><span class="new badge yellow black-text notf-fav_' + acct.domain + ' hide" data-badge-caption="Fav">0</span><span class="new badge blue notf-bt_' + acct.domain + ' hide" data-badge-caption="BT">0</span><span class="new badge orange notf-follow_' + acct.domain + ' hide" data-badge-caption="Follow">0</span></div>' +
2019-05-19 17:39:30 +10:00
'<div class="area-a2"><a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_delthis + '"' + icnsert + '>cancel</i></a></div>' +
'<div class="area-a3"><a onclick="setToggle(' + key +
')" class="setting nex" title="' + lang.lang_layout_setthis + '"' + icnsert + '><i class="material-icons waves-effect nex">settings</i></a></div></div>' +
'<div class="column-hide notf-indv-box z-depth-4" id="notf-box_' + key +
'"><div id="notifications_' + key +
'" data-notf="' + acct.domain + '" data-type="notf" class="notf-timeline"></div></div><div class="column-hide notf-indv-box" id="util-box_' + key +
'" style="padding:5px;">' + exclude + left_hold + '<a onclick="mediaToggle(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_mediafil + '">perm_media</i><span id="sta-media-' +
key + '">On</span></a>' + lang.lang_layout_mediafil + '<br><a onclick="cardToggle(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_linkanades + '">link</i><span id="sta-card-' +
key + '">On</span></a>' + lang.lang_layout_linkana + '<br><a onclick="voiceToggle(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_tts + '">hearing</i><span id="sta-voice-' +
key + ',\'' + acct.type + '\'">On</span></a>' + lang.lang_layout_tts + 'TL<br><a onclick="columnReload(' + key +
2019-09-08 02:44:28 +10:00
',\'' + acct.type + '\')" class="setting nex ' + if_misskey_hide + '"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_reconnect + '">refresh</i></a><span>' + lang.lang_layout_reconnect + '</span><br>' + lang.lang_layout_headercolor + '<br><div id="picker_' + key + '" class="color-picker"></div></div><div class="tl-box" tlid="' + key + '"><div id="timeline_' + key +
2019-05-19 17:39:30 +10:00
'" class="tl ' + acct.type + '-timeline " tlid="' + key + '" data-type="' + acct.type + '" data-acct="' + acct.domain + '" data-const="' + acct.type + '_' + acct.domain + '"><div id="landing_' + key + '" style="text-align:center">' + lang.lang_layout_nodata + '</div></div></div>'
if (numtarget) {
$('timeline_box_' + key + '_box').html(html)
} else {
$('#timeline_box_' + basekey + '_parentBox').append(html)
}
2019-05-19 17:39:30 +10:00
localStorage.removeItem("pool_" + key);
if (acct.data) {
var data = acct.data;
} else {
var data = "";
}
if (localStorage.getItem("catch_" + key)) {
var delc = "true";
} else {
var delc = "false";
}
2018-07-22 23:03:46 +10:00
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("voice_" + key)) {
var voice = true;
} else {
var voice = false;
}
tl(acct.type, data, acct.domain, key, delc, voice, "");
cardCheck(key);
ebtCheck(key);
mediaCheck(key);
catchCheck(key);
voiceCheck(key);
2018-09-10 03:06:00 +10:00
}
2019-03-21 06:42:47 +11:00
}
2018-03-27 13:39:35 +11:00
var box = localStorage.getItem("box");
2018-08-05 13:36:23 +10:00
if (box == "absolute") {
2018-08-10 12:35:21 +10:00
setTimeout(show, 1000);
2018-03-27 13:39:35 +11:00
}
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("reverse")) {
2018-09-11 04:59:44 +10:00
$("#bottom").removeClass("reverse");
$(".leftside").removeClass("reverse");
}
2019-08-11 03:52:32 +10:00
$("#bottom").removeClass("hide");
2019-05-19 17:39:30 +10:00
if (localStorage.getItem("sec") && localStorage.getItem("sec") != "nothing") {
2018-09-17 21:55:00 +10:00
secvis(localStorage.getItem("sec"));
}
2018-03-27 13:39:35 +11:00
favTag();
2018-08-05 13:36:23 +10:00
var cw = localStorage.getItem("always-cw");
if (cw == "yes") {
2019-05-19 17:39:30 +10:00
if (!$("#cw").hasClass("cw-avail")) {
2018-08-05 13:36:23 +10:00
$("#cw-text").show();
$("#cw").addClass("yellow-text");
$("#cw").addClass("cw-avail");
2019-05-19 17:39:30 +10:00
var cwt = localStorage.getItem("cw-text");
if (cwt) {
2018-08-05 13:36:23 +10:00
$("#cw-text").val(cwt);
}
}
}
2018-03-27 13:39:35 +11:00
}
2019-05-19 17:39:30 +10:00
function checkStr(type, data, acct_id, key, delc, voice) {
if ($('#notice_icon_' + key).hasClass("red-text") && type != "notf" && type != "mix") {
2019-04-08 01:14:06 +10:00
goTop(key);
2019-05-19 17:39:30 +10:00
tlDiff(type, data, acct_id, key, delc, voice, "");
} else {
2019-04-08 01:14:06 +10:00
goTop(key);
}
}
2018-09-17 21:55:00 +10:00
//セカンダリートゥートボタン
2019-05-19 17:39:30 +10:00
function secvis(set) {
if (set == "public") {
2018-09-17 21:55:00 +10:00
$("#toot-sec-icon").text("public");
$("#toot-sec-btn").addClass("purple");
2019-05-19 17:39:30 +10:00
} else if (set == "unlisted") {
2018-09-17 21:55:00 +10:00
$("#toot-sec-icon").text("lock_open");
$("#toot-sec-btn").addClass("blue");
2019-05-19 17:39:30 +10:00
} else if (set == "private") {
2018-09-17 21:55:00 +10:00
$("#toot-sec-icon").text("lock");
$("#toot-sec-btn").addClass("orange");
2019-05-19 17:39:30 +10:00
} else if (set == "direct") {
2018-09-17 21:55:00 +10:00
$("#toot-sec-icon").text("mail");
$("#toot-sec-btn").addClass("red");
2019-05-19 17:39:30 +10:00
} else if (set == "limited") {
2018-09-17 21:55:00 +10:00
$("#toot-sec-icon").text("group");
$("#toot-sec-btn").addClass("teal");
2019-05-19 17:39:30 +10:00
} else if (set == "local") {
2018-09-17 21:55:00 +10:00
$("#toot-sec-icon").text("visibility");
$("#toot-sec-btn").addClass("light-blue");
}
$("#toot-sec-btn").removeClass("hide");
}
2018-01-28 23:22:43 +11:00
//カラム追加
2018-03-27 13:39:35 +11:00
function addColumn() {
var acct = $("#add-acct-sel").val();
2019-06-15 02:32:59 +10:00
if (acct != "webview" && acct != "noauth") {
2019-05-20 23:34:58 +10:00
localStorage.setItem("last-use", acct);
}
2018-03-27 13:39:35 +11:00
var type = $("#type-sel").val();
2019-05-19 17:39:30 +10:00
if (acct == "noauth") {
acct = $("#noauth-url").val();
type = "noauth"
} else if (acct == "webview") {
acct = "";
type = "webview"
2018-01-28 23:22:43 +11:00
}
2018-03-27 13:39:35 +11:00
var add = {
domain: acct,
type: type
};
var multi = localStorage.getItem("column");
var obj = JSON.parse(multi);
2019-05-19 17:39:30 +10:00
if (!obj) {
var leng = 0;
2018-04-07 14:31:09 +10:00
var json = JSON.stringify([add]);
localStorage.setItem("column", json);
2019-05-19 17:39:30 +10:00
} else {
var leng = obj.length;
2018-04-07 14:31:09 +10:00
obj.push(add);
var json = JSON.stringify(obj);
localStorage.setItem("column", json);
}
2019-05-19 17:39:30 +10:00
parseColumn('add');
2018-03-27 13:39:35 +11:00
}
2019-05-19 17:39:30 +10:00
function addselCk() {
2018-03-27 13:39:35 +11:00
var acct = $("#add-acct-sel").val();
2019-05-19 17:39:30 +10:00
var domain = localStorage.getItem("domain_" + acct);
if (acct == "webview") {
2018-09-10 03:06:00 +10:00
$("#auth").addClass("hide");
$("#noauth").addClass("hide");
$("#webview-add").removeClass("hide");
2019-05-19 17:39:30 +10:00
} else if (acct == "noauth") {
2018-03-27 13:39:35 +11:00
$("#auth").addClass("hide");
$("#noauth").removeClass("hide");
2018-09-10 03:06:00 +10:00
$("#webview-add").addClass("hide");
2019-05-19 17:39:30 +10:00
} else {
2018-03-27 13:39:35 +11:00
$("#auth").removeClass("hide");
$("#noauth").addClass("hide");
2018-09-10 03:06:00 +10:00
$("#webview-add").addClass("hide");
2018-01-28 23:22:43 +11:00
}
2019-05-19 17:39:30 +10:00
if (domain == "knzk.me" || domain == "mstdn.y-zu.org") {
$("#type-sel").append('<option value="dm" data-trans="dm" id="direct-add">' + lang.layout_dm + '</option>');
} else {
2018-05-02 14:14:03 +10:00
$("#direct-add").remove();
}
2018-03-27 13:39:35 +11:00
}
//カラム削除
function removeColumn(tlid) {
2018-07-29 17:37:54 +10:00
$("#sort-box").addClass("hide");
$("#sort-box").removeClass("show");
2019-06-26 01:52:15 +10:00
Swal.fire({
title: lang.lang_layout_deleteColumn,
text: lang.lang_layout_deleteColumnDesc,
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then((result) => {
if (result.value) {
var multi = localStorage.getItem("column");
var obj = JSON.parse(multi);
obj.splice(tlid, 1);
var json = JSON.stringify(obj);
localStorage.setItem("column", json);
sortLoad()
$("#timeline_box_" + tlid + "_parentBox").remove()
2019-06-26 01:52:15 +10:00
}
2019-06-27 22:57:16 +10:00
$("#sort-box").removeClass("hide");
$("#sort-box").addClass("show");
2019-06-26 01:52:15 +10:00
});
2018-04-07 14:31:09 +10:00
}
//設定トグル
function setToggle(tlid) {
colorpicker(tlid);
2019-05-19 17:39:30 +10:00
if ($("#util-box_" + tlid).hasClass("column-hide")) {
$("#util-box_" + tlid).css("display", "block")
2018-08-10 01:18:35 +10:00
$("#util-box_" + tlid).animate({
'height': '200px'
2019-05-19 17:39:30 +10:00
}, {
2019-09-08 02:44:28 +10:00
'duration': 300,
'complete': function () {
$("#util-box_" + tlid).css("overflow-y", "scroll")
$("#util-box_" + tlid).removeClass("column-hide")
}
});
2019-05-19 17:39:30 +10:00
} else {
$("#util-box_" + tlid).css("overflow-y", "hidden")
2018-08-10 01:18:35 +10:00
$("#util-box_" + tlid).animate({
'height': '0'
2019-05-19 17:39:30 +10:00
}, {
2019-09-08 02:44:28 +10:00
'duration': 300,
'complete': function () {
$("#util-box_" + tlid).addClass("column-hide")
$("#util-box_" + tlid).css("display", "none")
}
});
2018-08-10 01:18:35 +10:00
}
2018-04-07 14:31:09 +10:00
}
2019-05-19 17:39:30 +10:00
function colorpicker(key) {
temp =
'<div onclick="coloradd(' + key + ',\'def\',\'def\')" class="pointer">Default</div>' +
'<div onclick="coloradd(' + key + ',\'f44336\',\'white\')" class="red white-text pointer">Red</div>' +
'<div onclick="coloradd(' + key + ',\'e91e63\',\'white\')" class="pink white-text pointer">Pink</div>' +
'<div onclick="coloradd(' + key + ',\'9c27b0\',\'white\')" class="purple white-text pointer">Purple</div>' +
'<div onclick="coloradd(' + key + ',\'673ab7\',\'white\')" class="deep-purple white-text pointer">Deep-purple</div>' +
'<div onclick="coloradd(' + key + ',\'3f51b5\',\'white\')" class="indigo white-text pointer">Indigo</div>' +
'<div onclick="coloradd(' + key + ',\'2196f3\',\'white\')" class="blue white-text pointer">Blue</div>' +
'<div onclick="coloradd(' + key + ',\'03a9f4\',\'black\')" class="light-blue black-text pointer">Light-blue</div>' +
'<div onclick="coloradd(' + key + ',\'00bcd4\',\'black\')" class="cyan black-text pointer">Cyan</div>' +
'<div onclick="coloradd(' + key + ',\'009688\',\'white\')" class="teal white-text pointer">Teal</div>' +
'<div onclick="coloradd(' + key + ',\'4caf50\',\'black\')" class="green black-text pointer">Green</div>' +
'<div onclick="coloradd(' + key + ',\'8bc34a\',\'black\')" class="light-green black-text pointer">Light-green</div>' +
'<div onclick="coloradd(' + key + ',\'cddc39\',\'black\')" class="lime black-text pointer">Lime</div>' +
'<div onclick="coloradd(' + key + ',\'ffeb3b\',\'black\')" class="yellow black-text pointer">Yellow</div>' +
'<div onclick="coloradd(' + key + ',\'ffc107\',\'black\')" class="amber black-text pointer">Amber</div>' +
'<div onclick="coloradd(' + key + ',\'ff9800\',\'black\')" class="orange black-text pointer">Orange</div>' +
'<div onclick="coloradd(' + key + ',\'ff5722\',\'white\')" class="deep-orange white-text pointer">Deep-orange</div>' +
'<div onclick="coloradd(' + key + ',\'795548\',\'white\')" class="brown white-text pointer">Brown</div>' +
'<div onclick="coloradd(' + key + ',\'9e9e9e\',\'white\')" class="grey white-text pointer">Grey</div>' +
'<div onclick="coloradd(' + key + ',\'607d8b\',\'white\')" class="blue-grey white-text pointer">Blue-grey</div>' +
'<div onclick="coloradd(' + key + ',\'000000\',\'white\')" class="black white-text pointer">Black</div>' +
'<div onclick="coloradd(' + key + ',\'ffffff\',\'black\')" class="white black-text pointer">White</div>';
$("#picker_" + key).html(temp);
2018-04-07 14:31:09 +10:00
}
2019-05-19 17:39:30 +10:00
function coloradd(key, bg, txt) {
2018-04-07 14:31:09 +10:00
var col = localStorage.getItem("column");
var o = JSON.parse(col);
2019-05-19 17:39:30 +10:00
var obj = o[key];
obj.background = bg;
obj.text = txt;
o[key] = obj;
2018-04-07 14:31:09 +10:00
var json = JSON.stringify(o);
localStorage.setItem("column", json);
2019-05-19 17:39:30 +10:00
if (txt == "def") {
$("#menu_" + key).css("background-color", "");
$("#menu_" + key).css("color", "");
} else {
$("#menu_" + key).css('background-color', '#' + bg);
if (txt == "black") {
var bghex = "000000";
var ichex = "9e9e9e"
} else if (txt == "white") {
var bghex = "ffffff";
var ichex = "eeeeee"
}
$("#menu_" + key + " .nex").css('color', '#' + ichex);
$("#menu_" + key).css('color', '#' + bghex);
2018-04-07 14:31:09 +10:00
}
2018-09-10 03:06:00 +10:00
}
//禁断のTwitter
2019-05-19 17:39:30 +10:00
function webviewParse(url, key, insert, icnsert, css) {
2018-09-10 03:06:00 +10:00
var html = '<div class="box" id="timeline_box_' + key + '_box" tlid="' + key +
2019-05-19 17:39:30 +10:00
'" style="' + css + '"><div class="notice-box z-depth-2" id="menu_' + key + '" style="' + insert + '">' +
'<div class="area-notice"><i class="fab fa-twitter waves-effect" id="notice_icon_' + key + '" style="font-size:40px; padding-top:25%;"></i></div>' +
'<div class="area-notice_name tl-title">WebView(' + url + ')</div>' +
2019-06-16 02:18:40 +10:00
'<div class="area-sta"></div>' +
2019-05-19 17:39:30 +10:00
'<div class="area-a2"><a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_delthis + '"' + icnsert + '>cancel</i></a></div>' +
'<div class="area-a3"><a onclick="setToggle(' + key +
')" class="setting nex" title="' + lang.lang_layout_setthis + '"' + icnsert + '><i class="material-icons waves-effect nex">settings</i></a></div></div>' +
'<div class="column-hide notf-indv-box z-depth-4" id="notf-box_' + key +
'"></div><div class="column-hide notf-indv-box" id="util-box_' + key +
'" style="padding:5px;">' + lang.lang_layout_headercolor + '<br><div id="picker_' + key + '" class="color-picker"></div></div><div class="tl-box" tlid="' + key + '" style="width:100%;height:100%;"><div id="timeline_' + key +
2019-06-16 02:18:40 +10:00
'" class="tl" tlid="' + key + '" data-type="webview" style="width:100%;height:100%;"><webview src="' + url + '" style="width:100%;height:100%;" id="webview" preload="./js/platform/twitter.js"></webview></div></div></div>';
2018-09-10 03:06:00 +10:00
return html;
2019-03-21 06:42:47 +11:00
}
2019-05-19 17:39:30 +10:00
function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, animecss, q) {
if (!left_fold) {
var basehtml = '<div style="' + css + '" class="box ' + animecss + '" id="timeline_box_' + basekey + '_parentBox"></div>';
$("#timeline-container").append(basehtml);
2019-05-19 17:39:30 +10:00
var left_hold = '<a onclick="leftFoldSet(' + key + ')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_leftFold + '">view_agenda</i></a>' + lang.lang_layout_leftFold + '</span><br>';
} else {
var left_hold = '<a onclick="leftFoldRemove(' + key + ')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_leftUnfold + '">view_column</i></a>' + lang.lang_layout_leftUnfold + '</span><br>';
}
2019-05-19 17:39:30 +10:00
var html = '<div class="boxIn" id="timeline_box_' + key + '_box" tlid="' + key +
'"><div class="notice-box z-depth-2" id="menu_' + key + '" style="' + insert + ' ">' +
'<div class="area-notice"><i class="material-icons waves-effect" id="notice_icon_' + key + '" style="font-size:40px; padding-top:25%;" onclick="tootsearch(' + key + ',\'' + q + '\');" title="' + lang.lang_layout_gotop + '"></i></div>' +
'<div class="area-notice_name"><span id="notice_' + key + '" class="tl-title"></span></div>' +
'<div class="area-a1"></div><div class="area-sta"></div>' +
'<div class="area-a2"><a onclick="removeColumn(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_delthis + '"' + icnsert + '>cancel</i></a></div>' +
'<div class="area-a3"><a onclick="setToggle(' + key +
')" class="setting nex" title="' + lang.lang_layout_setthis + '"' + icnsert + '><i class="material-icons waves-effect nex">settings</i></a></div></div>' +
'<div class="column-hide notf-indv-box" id="util-box_' + key +
'" style="padding:5px;">' + left_hold + '<a onclick="mediaToggle(' + key +
')" class="setting nex"><i class="material-icons waves-effect nex" title="' + lang.lang_layout_mediafil + '">perm_media</i><span id="sta-media-' +
key + '">On</span></a>' + lang.lang_layout_mediafil + '<br>' + lang.lang_layout_headercolor + '<br><div id="picker_' + key + '" class="color-picker"></div></div><div class="tl-box" tlid="' + key + '"><div id="timeline_' + key +
'" class="tl ' + type + '-timeline " tlid="' + key + '" data-type="' + type + '" data-acct="nostr"><div id="landing_' + key + '" style="text-align:center">' + lang.lang_layout_nodata + '</div></div></div>'
$('#timeline_box_' + basekey + '_parentBox').append(html);
2019-05-19 17:39:30 +10:00
tootsearch(key, q);
cardCheck(key);
ebtCheck(key);
mediaCheck(key);
catchCheck(key);
voiceCheck(key);
return true;
}
2019-05-19 17:39:30 +10:00
function leftFoldSet(key) {
2019-03-21 06:42:47 +11:00
var multi = localStorage.getItem("column");
var obj = JSON.parse(multi);
2019-05-19 17:39:30 +10:00
obj[key].left_fold = true;
2019-03-21 06:42:47 +11:00
var json = JSON.stringify(obj);
localStorage.setItem("column", json);
parseColumn();
}
2019-05-19 17:39:30 +10:00
function leftFoldRemove(key) {
2019-03-21 06:42:47 +11:00
var multi = localStorage.getItem("column");
var obj = JSON.parse(multi);
2019-05-19 17:39:30 +10:00
obj[key].left_fold = false;
2019-03-21 06:42:47 +11:00
var json = JSON.stringify(obj);
localStorage.setItem("column", json);
parseColumn();
2019-06-16 00:07:18 +10:00
}