TheDesk Miho(ver.7)

This commit is contained in:
cutls
2018-02-04 23:56:31 +09:00
parent 108086c48a
commit df86d32b33
17 changed files with 229 additions and 24 deletions

13
app/js/ui/jquery-ui.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -4,6 +4,7 @@
var websocket = [];
var websocketHome = [];
var websocketLocal = [];
var websocketNotf = [];
//カラム追加ボックストグル
function addToggle() {
@@ -53,7 +54,7 @@
tlCloser();
Object.keys(obj).forEach(function(key) {
var acct = obj[key];
var html = '<div class="box" id="timeline_' + key + '_box" tlid="' + key +
var html = '<div class="box" id="timeline_box_' + key + '_box" tlid="' + key +
'"><div class="notice-box"><span id="notice_' + key + '"></span><br>' +
'<a onclick="notfToggle(' + acct.domain + ',' + key +
')" class="setting nex" title="このアカウントの通知"><i class="material-icons nex notf-icon_' +
@@ -65,8 +66,8 @@
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"><div id="timeline_' + key +
'" class="tl"></div></div></div>';
'"></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) {
var data = acct.data;

View File

@@ -1,13 +1,13 @@
//スクロールで続きを読む
function scrollevent() {
$(".box").scroll(function() {
$(".tl-box").scroll(function() {
scrollck();
});
}
scrollevent();
function scrollck() {
$(".box").each(function(i, elem) {
$(".tl-box").each(function(i, elem) {
var tlid = $(this).attr('tlid');
//一番上ならためていた新しいトゥートを表示
if ($(this).scrollTop() == 0) {

View File

@@ -131,6 +131,8 @@ function load() {
var img = "no-act";
}
$("#i_" + img).prop("checked", true);
//並べ替え
sortload();
}
//最初に読む
load();
load();

74
app/js/ui/sort.js Normal file
View File

@@ -0,0 +1,74 @@
//ソートデータ読み込み
function sortload(){
var col = localStorage.getItem("column");
if (col) {
var obj = JSON.parse(col);
}
Object.keys(obj).forEach(function(key) {
var acct = obj[key];
var flag="false";
if(localStorage.getItem("card_" + key)=="true"){
flag="true"
}
var html='<li class="drag-content" data-id="'+key+'" data-flag="'+flag+'">'+localStorage.getItem("domain_" + acct.domain)+" "+cap(acct.type, acct.data)+' TL</li>';
$("#sort").append(html);
});
drag();
}
//TLのタイトル
function cap(type, data) {
if (type == "home") {
return "Home"
} else if (type == "local") {
return "Local"
} else if (type == "pub") {
return "Public"
} else if (type == "tag") {
return "#" + data
} else if (type == "list") {
return "List(id:" + data + ")"
} else if (type == "notf") {
return "Notification"
}
}
//jquery-ui依存
function drag(){
$('#sort').sortable();
$('#sort').disableSelection();
}
//ソート指定
function sort(){
var arr=[];
var flags=[];
$(".drag-content").each(function(i, elem) {
var id=$(this).attr("data-id");
var flag=$(this).attr("data-flag");
arr.push(id)
flags.push(flag);
});
var col = localStorage.getItem("column");
var obj = JSON.parse(col);
var newobj=[];
for(i=0;i<arr.length;i++){
var data=obj[arr[i]];
var add = {
domain: data.domain,
type: data.type,
data:data.data
};
newobj.push(add);
if(flags[i]=="true"){
localStorage.setItem("card_" + i, "true");
}else{
localStorage.removeItem("card_" + i);
}
}
var json = JSON.stringify(newobj);
localStorage.setItem("column", json);
$("#sort").html("");
Materialize.toast("並べ替え完了。", 3000);
sortload();
}