Merge branch 'master' of https://github.com/cutls/TheDesk into gh-pages

This commit is contained in:
Cutls 2019-07-31 00:31:27 +09:00
commit 4dcec3f240
16 changed files with 247 additions and 199 deletions

View File

@ -585,6 +585,7 @@ p:not(:last-child) {
display: block;
margin-right: 1px;
float: left;
overflow: hidden;
}
.nsfw-media {
position: absolute;

View File

@ -137,6 +137,10 @@ $(function ($) {
//矢印:選択
if (e.code == "ArrowLeft") {
//left
if ($("#imagemodal").hasClass("open")) {
imgCont('next');
return false;
}
if (selectedColumn > 0) {
selectedColumn--
}
@ -144,6 +148,9 @@ $(function ($) {
return false;
} else if (e.code == "ArrowUp") {
//up
if ($("#imagemodal").hasClass("open")) {
return false;
}
if (selectedToot > 0) {
selectedToot--
}
@ -151,6 +158,10 @@ $(function ($) {
return false;
} else if (e.code == "ArrowRight") {
//right
if ($("#imagemodal").hasClass("open")) {
imgCont('prev');
return false;
}
if (selectedColumn < $(".tl-box").length - 1) {
selectedColumn++
}
@ -158,6 +169,9 @@ $(function ($) {
return false;
} else if (e.code == "ArrowDown") {
//down
if ($("#imagemodal").hasClass("open")) {
return false;
}
selectedToot++
tootSelector(selectedColumn, selectedToot)
return false;
@ -206,19 +220,6 @@ $(function ($) {
}
}
}
//イメージビューワー切り替え
if (e.keyCode === 37 && wv) {
if ($("#imagemodal").hasClass("open")) {
imgCont('prev');
return false;
}
}
if (e.keyCode === 39 && wv) {
if ($("#imagemodal").hasClass("open")) {
imgCont('next');
return false;
}
}
});
//クリアボタン
$("#clear").click(function () {

View File

@ -174,4 +174,29 @@ $.mb_substr = function (str, begin, end) {
}
return ret;
};
//ソートするやつ
function object_array_sort(data, key, order, fn) {
var num_a = -1;
var num_b = 1;
if (order === 'asc') {
num_a = 1;
num_b = -1;
}
data = data.sort(function (a, b) {
var x = a[key];
var y = b[key];
if (x > y) return num_a;
if (x < y) return num_b;
return 0;
});
var arrObj = {};
for (var i = 0; i < data.length; i++) {
arrObj[data[i]['family']] = data[i];
}
data = [];
for (var key in arrObj) {
data.push(arrObj[key]);
}
fn(data);
}
localStorage.removeItem("errors");

View File

@ -160,7 +160,6 @@ ipc.on('memory', function (event, arg) {
})
//update.html
ipc.on('prog', function (event, arg) {
console.log(arg)
postMessage(["updateProg", arg], "*")
})
ipc.on('mess', function (event, arg) {

View File

@ -29,7 +29,6 @@ function post(mode, postvis) {
}
if (domain != "kirishima.cloud") {
if (mode != "pass" && !$("#cw").hasClass("cw-avail") && (str.length > cw_sent || (str.split("\n").length - 1) > cw_ltres)) {
console.log("out")
var plus = str.replace(/\n/g, "").slice(0, 10) + "...";
Swal.fire({
title: lang.lang_post_cwtitle,
@ -43,7 +42,6 @@ function post(mode, postvis) {
showCloseButton: true,
focusConfirm: false,
}).then((result) => {
console.log(result)
if (result.dismiss == "cancel") {
//btn3:sonomama
post("pass")

View File

@ -66,7 +66,7 @@ input.addEventListener("focus", function () {
}
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at");
suggest = "https://" + domain + "/api/v1/search?q=" + q
suggest = "https://" + domain + "/api/v2/search?q=" + q
if (suggest != oldSuggest) {
console.log("Try to get suggest at " + suggest)
fetch(suggest, {
@ -81,18 +81,43 @@ input.addEventListener("focus", function () {
todo(error);
console.error(error);
}).then(function (json) {
console.log(["Search", json]);
//ハッシュタグ
if (json.hashtags[0] && tag) {
if (tag[1]) {
var tags = "";
var tags = [];
Object.keys(json.hashtags).forEach(function (key4) {
var tag = json.hashtags[key4];
if (tag != q) {
tags = tags + '<a onclick="tagInsert(\'#' + tag + '\',\'#' + q +
'\')" class="pointer">#' + tag + '</a><br>';
var his = tag.history;
var uses = his[0].uses * 1 + his[1].uses * 1 + his[2].uses * 1 + his[3].uses * 1 + his[4].uses * 1 + his[5].uses * 1 + his[6].uses * 1;
tagHTML = '<br><a onclick="tagInsert(\'#' + escapeHTML(tag.name) + '\',\'#' + q + '\')" class="pointer">#' +
escapeHTML(tag.name) + '</a>&nbsp;' + uses + 'toot(s)'
var item = {
"uses": uses,
"html": tagHTML
}
tags.push(item)
});
var num_a = -1;
var num_b = 1;
tags = tags.sort(function (a, b) {
var x = a["uses"];
var y = b["uses"];
if (x > y) return num_a;
if (x < y) return num_b;
return 0;
});
var ins = ""
var nev = false
Object.keys(tags).forEach(function (key7) {
ins = ins + tags[key7].html
if (key7 <= 0 && !nev) {
ins = ins + '<br>'
nev = true
}
});
$("#suggest").html(ins);
$("#right-side").show()
$("#suggest").html("Tags:<br>" + tags);
$("#poll").addClass("hide")
$("#emoji").addClass("hide")
}

View File

@ -82,7 +82,7 @@ function details(id, acct_id, tlid, mode) {
} else {
$("#tootmodal").attr("data-user", scn);
}
context(id, acct_id);
getContext(id, acct_id);
var dom = null;
if (!local) {
dom = scn.replace(/.+@/g, '');
@ -156,7 +156,7 @@ function replyTL(id, acct_id) {
}
//コンテクストってなんですか
function context(id, acct_id) {
function getContext(id, acct_id) {
var domain = localStorage.getItem("domain_" + acct_id);
var at = localStorage.getItem("acct_" + acct_id + "_at");
if (localStorage.getItem("mode_" + domain) == "misskey") {

View File

@ -1001,7 +1001,6 @@ function connectMisskey(acct_id, re) {
var mute = [];
if (data.body.id.indexOf("notf:") !== -1) {
var obj = JSON.parse(mess.data).body;
console.log(obj);
var popup = localStorage.getItem("popup");
if (!popup) {
popup = 0;

View File

@ -491,10 +491,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
if (urlCont) {
urlindv = urlindv.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&")
var encoded = encodeURI(urlCont[4])
var punycoded = "xn--"+punycode.encode(urlCont[2])
var punycoded = "xn--" + punycode.encode(urlCont[2])
var eUrl = urlCont[1] + "://" + punycoded + "." + urlCont[3] + "/" + encoded
var regExp = new RegExp('href="' + urlindv + '"', "g")
console.log(eUrl, regExp)
content = content.replace(regExp, 'href="' + eUrl + '"')
}
}
@ -542,60 +541,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
'"><i class="far fa-calendar-times"></i>' +
ended + '</span></div>';
}
if (toot.emojis) {
var emojick = toot.emojis[0];
} else {
var emojick = false;
}
//絵文字があれば
if (emojick) {
Object.keys(toot.emojis).forEach(function (key5) {
var emoji = toot.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '<img draggable="false" src="' + emoji.url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
var regExp = new RegExp(":" + shortcode + ":", "g");
content = content.replace(regExp, emoji_url);
spoil = spoil.replace(regExp, emoji_url);
poll = poll.replace(regExp, emoji_url);
});
}
//ニコフレ絵文字
if (toot.profile_emojis) {
var nicoemojick = toot.profile_emojis[0];
} else {
var nicoemojick = false;
}
//絵文字があれば(nico)
if (nicoemojick) {
Object.keys(toot.profile_emojis).forEach(function (keynico) {
var emoji = toot.profile_emojis[keynico];
var shortcode = emoji.shortcode;
var emoji_url = '<img draggable="false" src="' + emoji.url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
var regExp = new RegExp(":" + shortcode + ":", "g");
content = content.replace(regExp, emoji_url);
spoil = spoil.replace(regExp, emoji_url);
poll = poll.replace(regExp, emoji_url);
});
}
//デフォ絵文字
content = twemoji.parse(content);
if (dis_name) {
dis_name = twemoji.parse(dis_name);
}
if (spoil) {
spoil = twemoji.parse(spoil);
}
if (noticetext) {
noticetext = twemoji.parse(noticetext);
}
if (notice) {
notice = twemoji.parse(notice);
}
if (poll) {
poll = twemoji.parse(poll);
}
var mediack = toot.media_attachments[0];
//メディアがあれば
var media_ids = "";
@ -611,8 +557,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
if (toot.sensitive && nsfw) {
var sense = "sensitive"
var blur = media.blurhash
if (blur) {
nsfwmes = '<div class="nsfw-media">' + lang.lang_parse_nsfw + '</div>'
if (blur) {
purl = parseBlur(blur)
var sense = ""
}
@ -625,7 +571,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
acct_id + ')" id="' + id + '-image-' + key2 + '" data-url="' + url +
'" data-type="video" class="img-parsed"><video src="' +
purl + '" class="' + sense +
' toot-img pointer" style="max-width:100%;"></a></span>';
' toot-img pointer" style="max-width:100%;" loop="true"></a></span>';
} else {
if (media.type == "unknown") {
viewer = viewer + '<a href="' + media.remote_url + '" title="' + media.remote_url + '">[' + lang.lang_parse_unknown + ']</a> '
@ -777,6 +723,60 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
}
});
}
if (toot.emojis) {
var emojick = toot.emojis[0];
} else {
var emojick = false;
}
//絵文字があれば
if (emojick) {
Object.keys(toot.emojis).forEach(function (key5) {
var emoji = toot.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '<img draggable="false" src="' + emoji.url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
var regExp = new RegExp(":" + shortcode + ":", "g");
content = content.replace(regExp, emoji_url);
spoil = spoil.replace(regExp, emoji_url);
poll = poll.replace(regExp, emoji_url);
});
}
//ニコフレ絵文字
if (toot.profile_emojis) {
var nicoemojick = toot.profile_emojis[0];
} else {
var nicoemojick = false;
}
//絵文字があれば(nico)
if (nicoemojick) {
Object.keys(toot.profile_emojis).forEach(function (keynico) {
var emoji = toot.profile_emojis[keynico];
var shortcode = emoji.shortcode;
var emoji_url = '<img draggable="false" src="' + emoji.url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">';
var regExp = new RegExp(":" + shortcode + ":", "g");
content = content.replace(regExp, emoji_url);
spoil = spoil.replace(regExp, emoji_url);
poll = poll.replace(regExp, emoji_url);
});
}
//デフォ絵文字
content = twemoji.parse(content);
if (dis_name) {
dis_name = twemoji.parse(dis_name);
}
if (spoil) {
spoil = twemoji.parse(spoil);
}
if (noticetext) {
noticetext = twemoji.parse(noticetext);
}
if (notice) {
notice = twemoji.parse(notice);
}
if (poll) {
poll = twemoji.parse(poll);
}
//日本語じゃない
if (toot.language != lang.language && toot.language) {
var trans = '<div class="action pin"><a onclick="trans(\'' + toot.language + '\',\'' + lang.language + '\')" class="waves-effect waves-dark btn-flat actct" style="padding:0" title="' + lang.lang_parse_trans + '"><i class="material-icons">g_translate</i></a></div>';
@ -913,6 +913,7 @@ function userparse(obj, auth, acct_id, tlid, popup) {
var datetype = localStorage.getItem("datetype");
Object.keys(obj).forEach(function (key) {
var toot = obj[key];
if (toot) {
console.log(["Parsing", toot])
if (!toot.username) {
var raw = toot;
@ -1026,6 +1027,8 @@ function userparse(obj, auth, acct_id, tlid, popup) {
'</div>' +
'</div>' +
'</div>';
}
});
return templete;
@ -1046,7 +1049,6 @@ function client(name) {
showCloseButton: true,
focusConfirm: false,
}).then((result) => {
console.log(result)
if (result.dismiss == "cancel") {
//Emp
var cli = localStorage.getItem("client_emp");

View File

@ -177,12 +177,12 @@ function graphDraw(tag, acct_id) {
var zero = 50 - (his[0].uses / max * 50);
if (max === 0) {
tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' +
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toots&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toot(s)&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
'\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a>&nbsp;' + his[0].accounts + lang.lang_src_people;
} else {
tags = '<br><br><svg version="1.1" viewbox="0 0 60 50" width="60" height="50">' +
'<g><path d="M0,' + six + ' L10,' + five + ' 20,' + four + ' 30,' + three + ' 40,' + two + ' 50,' + one + ' 60,' + zero + '" style="stroke: #9e9e9e; stroke-width: 1;fill: none;"></path></g>' +
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toots&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
'</svg><span style="font-size:200%">' + his[0].uses + '</span>toot&nbsp;<a onclick="tl(\'tag\',\'' + escapeHTML(tag.name) + '\',\'' + acct_id +
'\',\'add\')" class="pointer">#' + escapeHTML(tag.name) + '</a>&nbsp;' + his[0].accounts + lang.lang_src_people;
}

View File

@ -70,7 +70,6 @@ if (location.search) {
var mode = m[1];
var codex = m[2];
if (mode == "share") {
console.log(codex);
$('textarea').focus();
$("#textarea").val(decodeURI(codex));
show();

View File

@ -357,7 +357,6 @@ function relations(user, acct_id) {
console.error(error);
}).then(function (json) {
var json = json[0];
console.log(json);
if (json.following) {
//自分がフォローしている
$("#his-data").addClass("following");

View File

@ -667,7 +667,7 @@
<!-- Modal Structure Video-->
<div id="videomodal" class="modal modal-fixed-footer">
<div class="modal-content">
<video src="" id="video" style="max-width:100%; max-height:100%;" controls>
<video src="" id="video" style="max-width:100%; max-height:100%;" controls loop="true" autoplay="true">
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Close</a>

View File

@ -667,7 +667,7 @@
<!-- Modal Structure Video-->
<div id="videomodal" class="modal modal-fixed-footer">
<div class="modal-content">
<video src="" id="video" style="max-width:100%; max-height:100%;" controls>
<video src="" id="video" style="max-width:100%; max-height:100%;" controls loop="true" autoplay="true">
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Close</a>

View File

@ -668,7 +668,7 @@
<!-- Modal Structure Video-->
<div id="videomodal" class="modal modal-fixed-footer">
<div class="modal-content">
<video src="" id="video" style="max-width:100%; max-height:100%;" controls>
<video src="" id="video" style="max-width:100%; max-height:100%;" controls loop="true" autoplay="true">
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">@@close@@</a>

View File

@ -667,7 +667,7 @@
<!-- Modal Structure Video-->
<div id="videomodal" class="modal modal-fixed-footer">
<div class="modal-content">
<video src="" id="video" style="max-width:100%; max-height:100%;" controls>
<video src="" id="video" style="max-width:100%; max-height:100%;" controls loop="true" autoplay="true">
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">crwdns385:0crwdne385:0</a>