From f35232cc52f661337a5ef8f229930e90cdd7eafa Mon Sep 17 00:00:00 2001
From: cutls
Date: Fri, 8 Nov 2019 22:52:54 +0900
Subject: [PATCH] Coding style
---
app/js/login/manager.js | 1260 ++++++++++++++++-------------
app/js/platform/end.js | 197 +++--
app/js/platform/first.js | 227 +++---
app/js/platform/nano.js | 361 ++++-----
app/js/platform/preload.js | 342 ++++----
app/js/platform/punycode.js | 389 +++++----
app/js/platform/twitter.js | 838 ++++++++++++-------
app/js/post/bb-md.js | 383 ++++-----
app/js/post/emoji.js | 356 ++++----
app/js/post/img.js | 338 ++++----
app/js/post/misskeystatus.js | 334 ++++----
app/js/post/post.js | 415 +++++-----
app/js/post/secure.js | 168 ++--
app/js/post/status.js | 722 ++++++++---------
app/js/post/suggest.js | 314 ++++----
app/js/post/use-txtbox.js | 122 +--
app/js/tl/card.js | 383 +++++----
app/js/tl/datails.js | 712 ++++++++--------
app/js/tl/filter.js | 608 +++++++-------
app/js/tl/list.js | 398 ++++-----
app/js/tl/mix.js | 444 +++++-----
app/js/tl/notification.js | 492 ++++++------
app/js/tl/parse.js | 1476 +++++++++++++++++++++-------------
app/js/tl/poll.js | 208 ++---
app/js/tl/speech.js | 305 +++----
app/js/tl/src.js | 360 +++++----
app/js/tl/tag.js | 207 +++--
app/js/tl/tl.js | 1463 +++++++++++++++++----------------
app/js/ui/img.js | 438 +++++-----
app/js/ui/layout.js | 1064 ++++++++++++++----------
30 files changed, 8287 insertions(+), 7037 deletions(-)
diff --git a/app/js/login/manager.js b/app/js/login/manager.js
index 225c0aef..f1ad3038 100644
--- a/app/js/login/manager.js
+++ b/app/js/login/manager.js
@@ -1,984 +1,1094 @@
//アカウントマネージャ
//最初に読むやつ
function load() {
- $("#acct-list").html("");
+ $('#acct-list').html('')
if (location.search) {
- var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
- var mode = m[1];
- var codex = m[2];
- if (mode == "first" && codex == "true") {
- $("body").addClass("first");
+ var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
+ var mode = m[1]
+ var codex = m[2]
+ if (mode == 'first' && codex == 'true') {
+ $('body').addClass('first')
} else {
}
}
- var prof = localStorage.getItem("prof");
- $(".my-prof").attr("src", prof);
- var name = localStorage.getItem("name");
- $("#now-name").text(name);
- var user = localStorage.getItem("user");
- $("#now-user").text(user);
- var domain = localStorage.getItem("domain");
- $(".now-domain").text(domain);
- var multi = localStorage.getItem("multi");
+ var prof = localStorage.getItem('prof')
+ $('.my-prof').attr('src', prof)
+ var name = localStorage.getItem('name')
+ $('#now-name').text(name)
+ var user = localStorage.getItem('user')
+ $('#now-user').text(user)
+ var domain = localStorage.getItem('domain')
+ $('.now-domain').text(domain)
+ var multi = localStorage.getItem('multi')
if (!multi) {
- var obj = [];
+ var obj = []
} else {
- var obj = JSON.parse(multi);
+ var obj = JSON.parse(multi)
}
if (obj[0]) {
if (!obj[0].at) {
- obj = [];
- localStorage.removeItem("multi");
+ obj = []
+ localStorage.removeItem('multi')
}
}
- console.table(obj);
- var templete;
+ console.table(obj)
+ var templete
Object.keys(obj).forEach(function(key) {
- var acct = obj[key];
- var list = key * 1 + 1;
- if (acct.background != "def" && acct.text != "def") {
- var style = 'style="background-color:#' + acct.background + "; color:" + acct.text + ';"';
+ var acct = obj[key]
+ var list = key * 1 + 1
+ if (acct.background != 'def' && acct.text != 'def') {
+ var style = 'style="background-color:#' + acct.background + '; color:' + acct.text + ';"'
} else {
- var style = "";
+ var style = ''
}
if (acct.name) {
- var name = acct.name;
+ var name = acct.name
} else {
- var name = acct.user;
+ var name = acct.user
}
- templete = '' + list + '. ' + name + " " + escapeHTML(acct.user) + "@" + acct.domain + '
';
- $("#acct-list").append(templete);
- colorpicker(key);
- });
- multisel();
- var acctN = localStorage.getItem("acct");
+ templete = `
+
+
+
${list}.
+
${name} ${escapeHTML(acct.user)}@${acct.domain}
+
+
+
+ `
+ $('#acct-list').append(templete)
+ colorpicker(key)
+ })
+ multisel()
+ var acctN = localStorage.getItem('acct')
if (!acctN) {
- localStorage.setItem("acct", 0);
- var acctN = 0;
+ localStorage.setItem('acct', 0)
+ var acctN = 0
}
//全部チェックアリでいいと思うの
- $("#linux").prop("checked", true);
+ $('#linux').prop('checked', true)
}
//最初に読む
-load();
-support();
+load()
+support()
//instances.social/instances API
function data(domain) {
- $("#ins-upd").text("Loading...");
- $("#ins-add").text("Loading...");
- $("#ins-connect").text("Loading...");
- $("#ins-toot").text("Loading...");
- $("#ins-sys").text("Loading...");
- $("#ins-per").text("Loading...");
- $("#ins-user").text("Loading...");
- $("#ins-ver").text("Loading...");
- $("#ins-name").text("Loading...");
- $("#ins-prof").attr("src", "../../img/loading.svg");
- var start = "https://instances.social/api/1.0/instances/show?name=" + domain;
+ $('#ins-upd').text('Loading...')
+ $('#ins-add').text('Loading...')
+ $('#ins-connect').text('Loading...')
+ $('#ins-toot').text('Loading...')
+ $('#ins-sys').text('Loading...')
+ $('#ins-per').text('Loading...')
+ $('#ins-user').text('Loading...')
+ $('#ins-ver').text('Loading...')
+ $('#ins-name').text('Loading...')
+ $('#ins-prof').attr('src', '../../img/loading.svg')
+ var start = 'https://instances.social/api/1.0/instances/show?name=' + domain
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M"
+ 'content-type': 'application/json',
+ Authorization:
+ 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (!json.error) {
- $("#ins-name").text(json.name);
- $("#ins-upd").text(date(json.checked_at, "full"));
- $("#ins-add").text(date(json.added_at, "full"));
- $("#ins-connect").text(json.connections);
- $("#ins-toot").text(json.statuses);
- $("#ins-sys").text(date(json.updated_at, "full"));
- $("#ins-per").text(json.uptime * 100);
- $("#ins-user").text(json.users);
- $("#ins-ver").text(json.version);
+ $('#ins-name').text(json.name)
+ $('#ins-upd').text(date(json.checked_at, 'full'))
+ $('#ins-add').text(date(json.added_at, 'full'))
+ $('#ins-connect').text(json.connections)
+ $('#ins-toot').text(json.statuses)
+ $('#ins-sys').text(date(json.updated_at, 'full'))
+ $('#ins-per').text(json.uptime * 100)
+ $('#ins-user').text(json.users)
+ $('#ins-ver').text(json.version)
} else {
- console.error(json.error);
+ console.error(json.error)
}
- });
- var start = "https://" + domain + "/api/v1/instance";
+ })
+ var start = 'https://' + domain + '/api/v1/instance'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (!json.error) {
- $("#ins-title").text(json.title);
- $("#ins-desc").html(json.description);
- $("#ins-email").text(json.email);
- $("#ins-toot").text(json.stats.status_count);
- $("#ins-user").text(json.stats.user_count);
- $("#ins-ver").text(json.version);
- $("#ins-prof").attr("src", json.thumbnail);
- $("#ins-admin").text(escapeHTML(json.contact_account.display_name) + "(" + json.contact_account.acct + ")");
- $("#ins-admin").attr("href", "index.html?mode=user&code=" + json.contact_account.username + "@" + domain);
+ $('#ins-title').text(json.title)
+ $('#ins-desc').html(json.description)
+ $('#ins-email').text(json.email)
+ $('#ins-toot').text(json.stats.status_count)
+ $('#ins-user').text(json.stats.user_count)
+ $('#ins-ver').text(json.version)
+ $('#ins-prof').attr('src', json.thumbnail)
+ $('#ins-admin').text(
+ escapeHTML(json.contact_account.display_name) + '(' + json.contact_account.acct + ')'
+ )
+ $('#ins-admin').attr(
+ 'href',
+ 'index.html?mode=user&code=' + json.contact_account.username + '@' + domain
+ )
} else {
- console.error(json.error);
+ console.error(json.error)
}
- });
+ })
}
//アカウントデータ 消す
function multiDel(target) {
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
//削除確認ダイアログ
Swal.fire({
title: lang.lang_manager_logout,
- text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm,
- type: "warning",
+ text: obj[target]['user'] + '@' + obj[target]['domain'] + lang.lang_manager_confirm,
+ type: 'warning',
showCancelButton: true,
- confirmButtonColor: "#3085d6",
- cancelButtonColor: "#d33",
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
if (result.value) {
Object.keys(obj).forEach(function(key) {
- var nk = key - 1;
+ var nk = key - 1
//公開範囲(差分のみ)
if (key >= target) {
- var oldvis = localStorage.getItem("vis-memory-" + key);
+ var oldvis = localStorage.getItem('vis-memory-' + key)
if (oldvis) {
- localStorage.setItem("vis-memory-" + nk, oldvis);
+ localStorage.setItem('vis-memory-' + nk, oldvis)
}
}
//独自ロケール
- localStorage.removeItem("home_" + key);
- localStorage.removeItem("local_" + key);
- localStorage.removeItem("public_" + key);
- localStorage.removeItem("notification_" + key);
+ localStorage.removeItem('home_' + key)
+ localStorage.removeItem('local_' + key)
+ localStorage.removeItem('public_' + key)
+ localStorage.removeItem('notification_' + key)
//アクセストークンとドメイン、プロフ(差分)
if (key > target) {
- var olddom = localStorage.getItem("domain_" + key);
- localStorage.setItem("domain_" + nk, olddom);
- var oldat = localStorage.getItem("acct_" + key + "_at");
- localStorage.setItem("acct_" + nk + "_at", oldat);
- localStorage.setItem("name_" + nk, localStorage.getItem("name_" + key));
- localStorage.setItem("user_" + target, localStorage.getItem("user_" + key));
- localStorage.setItem("user-id_" + target, localStorage.getItem("user-id_" + key));
- localStorage.setItem("prof_" + target, localStorage.getItem("prof_" + key));
+ var olddom = localStorage.getItem('domain_' + key)
+ localStorage.setItem('domain_' + nk, olddom)
+ var oldat = localStorage.getItem('acct_' + key + '_at')
+ localStorage.setItem('acct_' + nk + '_at', oldat)
+ localStorage.setItem('name_' + nk, localStorage.getItem('name_' + key))
+ localStorage.setItem('user_' + target, localStorage.getItem('user_' + key))
+ localStorage.setItem('user-id_' + target, localStorage.getItem('user-id_' + key))
+ localStorage.setItem('prof_' + target, localStorage.getItem('prof_' + key))
}
- });
+ })
//とりあえず消す
- obj.splice(target, 1);
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
- load();
+ obj.splice(target, 1)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
+ load()
//カラムデータコンフリクト
- var col = localStorage.getItem("column");
- var oldcols = JSON.parse(col);
- var newcols = [];
+ var col = localStorage.getItem('column')
+ var oldcols = JSON.parse(col)
+ var newcols = []
Object.keys(oldcols).forEach(function(key) {
- var nk = key - 1;
- var oldcol = oldcols[key];
+ var nk = key - 1
+ var oldcol = oldcols[key]
if (target < oldcol.domain) {
- var newdom = oldcol.domain - 1;
+ var newdom = oldcol.domain - 1
} else {
- var newdom = oldcol.domain;
+ var newdom = oldcol.domain
}
- var type = oldcol.type;
+ var type = oldcol.type
//消した垢のコラムじゃないときコピー
if (target != oldcol.domain) {
var add = {
domain: newdom,
type: type
- };
- newcols.push(add);
+ }
+ newcols.push(add)
}
- });
- var json = JSON.stringify(newcols);
- localStorage.setItem("column", json);
+ })
+ var json = JSON.stringify(newcols)
+ localStorage.setItem('column', json)
}
- });
+ })
}
function multiDel2(target) {
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
Swal.fire({
title: lang.lang_manager_logout,
- text: obj[target]["user"] + "@" + obj[target]["domain"] + lang.lang_manager_confirm,
- type: "warning",
+ text: obj[target]['user'] + '@' + obj[target]['domain'] + lang.lang_manager_confirm,
+ type: 'warning',
showCancelButton: true,
- confirmButtonColor: "#3085d6",
- cancelButtonColor: "#d33",
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
if (result.value) {
- obj.splice(target, 1);
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
+ obj.splice(target, 1)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
Object.keys(obj).forEach(function(key) {
if (key >= target) {
- var oldvis = localStorage.getItem("vis-memory-" + key);
+ var oldvis = localStorage.getItem('vis-memory-' + key)
if (oldvis) {
- var nk = key - 1;
- localStorage.setItem("vis-memory-" + nk, oldvis);
+ var nk = key - 1
+ localStorage.setItem('vis-memory-' + nk, oldvis)
}
}
- localStorage.removeItem("home_" + key);
- localStorage.removeItem("local_" + key);
- localStorage.removeItem("public_" + key);
- localStorage.removeItem("notification_" + key);
- refresh(key);
- });
- var col = localStorage.getItem("column");
+ localStorage.removeItem('home_' + key)
+ localStorage.removeItem('local_' + key)
+ localStorage.removeItem('public_' + key)
+ localStorage.removeItem('notification_' + key)
+ refresh(key)
+ })
+ var col = localStorage.getItem('column')
if (!col) {
var obj = [
{
domain: 0,
- type: "local"
+ type: 'local'
}
- ];
- localStorage.setItem("card_0", "true");
- var json = JSON.stringify(obj);
- localStorage.setItem("column", json);
+ ]
+ localStorage.setItem('card_0', 'true')
+ var json = JSON.stringify(obj)
+ localStorage.setItem('column', json)
} else {
- var cobj = JSON.parse(col);
+ var cobj = JSON.parse(col)
}
Object.keys(cobj).forEach(function(key) {
- var column = cobj[key];
+ var column = cobj[key]
if (column.domain > target) {
- var nk = key - 1;
- column.domain = nk;
- cobj[key] = column;
+ var nk = key - 1
+ column.domain = nk
+ cobj[key] = column
} else if (column.domain == target) {
- localStorage.removeItem("card_" + tlid);
- cobj.splice(key, 1);
+ localStorage.removeItem('card_' + tlid)
+ cobj.splice(key, 1)
}
- });
- var json = JSON.stringify(column);
- localStorage.setItem("column", json);
- load();
+ })
+ var json = JSON.stringify(column)
+ localStorage.setItem('column', json)
+ load()
}
- });
+ })
}
//サポートインスタンス
function support() {
Object.keys(idata).forEach(function(key) {
- var instance = idata[key];
- if (instance == "instance") {
- templete = "' + idata[key + "_name"] + "(" + key + ") ";
- $("#support").append(templete);
+ var instance = idata[key]
+ if (instance == 'instance') {
+ templete =
+ '' +
+ idata[key + '_name'] +
+ '(' +
+ key +
+ ') '
+ $('#support').append(templete)
}
- });
+ })
}
//URL指定してポップアップ
function login(url) {
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
- if ($("#misskey:checked").val() == "on") {
- $("#misskey").prop("checked", true);
- misskeyLogin(url);
- return;
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
+ if ($('#misskey:checked').val() == 'on') {
+ $('#misskey').prop('checked', true)
+ misskeyLogin(url)
+ return
}
- $("#compt").hide();
- if ($("#linux:checked").val() == "on") {
- var red = "urn:ietf:wg:oauth:2.0:oob";
- if (~url.indexOf("pixelfed")) {
- red = "https://thedesk.top/hello.html";
+ $('#compt').hide()
+ if ($('#linux:checked').val() == 'on') {
+ var red = 'urn:ietf:wg:oauth:2.0:oob'
+ if (~url.indexOf('pixelfed')) {
+ red = 'https://thedesk.top/hello.html'
}
} else {
- var red = "thedesk://manager";
+ var red = 'thedesk://manager'
}
- localStorage.setItem("redirect", red);
- var start = "https://" + url + "/api/v1/apps";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
+ localStorage.setItem('redirect', red)
+ var start = 'https://' + url + '/api/v1/apps'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
httpreq.send(
JSON.stringify({
- scopes: "read write follow",
- client_name: "TheDesk(PC)",
+ scopes: 'read write follow',
+ client_name: 'TheDesk(PC)',
redirect_uris: red,
- website: "https://thedesk.top"
+ website: 'https://thedesk.top'
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- localStorage.setItem("msky", "false");
- var auth = "https://" + url + "/oauth/authorize?client_id=" + json["client_id"] + "&client_secret=" + json["client_secret"] + "&response_type=code&scope=read+write+follow&redirect_uri=" + encodeURIComponent(red);
- localStorage.setItem("domain_tmp", url);
- localStorage.setItem("client_id", json["client_id"]);
- localStorage.setItem("client_secret", json["client_secret"]);
- $("#auth").show();
- versionChecker(url);
- $("#add").hide();
- postMessage(["openUrl", auth], "*");
- if ($("#linux:checked").val() == "on") {
+ localStorage.setItem('msky', 'false')
+ var auth =
+ 'https://' +
+ url +
+ '/oauth/authorize?client_id=' +
+ json['client_id'] +
+ '&client_secret=' +
+ json['client_secret'] +
+ '&response_type=code&scope=read+write+follow&redirect_uri=' +
+ encodeURIComponent(red)
+ localStorage.setItem('domain_tmp', url)
+ localStorage.setItem('client_id', json['client_id'])
+ localStorage.setItem('client_secret', json['client_secret'])
+ $('#auth').show()
+ versionChecker(url)
+ $('#add').hide()
+ postMessage(['openUrl', auth], '*')
+ if ($('#linux:checked').val() == 'on') {
} else {
- postMessage(["sendSinmpleIpc", "quit"], "*");
+ postMessage(['sendSinmpleIpc', 'quit'], '*')
}
}
- };
+ }
}
function versionChecker(url) {
- var start = "https://" + url + "/api/v1/instance";
+ var start = 'https://' + url + '/api/v1/instance'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var version = json.version;
+ var version = json.version
if (version) {
- var reg = version.match(/^([0-9])\.[0-9]\.[0-9]/u);
+ var reg = version.match(/^([0-9])\.[0-9]\.[0-9]/u)
if (reg) {
- versionCompat(reg[1], reg, json.title, reg[0]);
+ versionCompat(reg[1], reg, json.title, reg[0])
}
}
- });
+ })
}
function versionCompat(prefix, ver, title, real) {
- $("#compt-instance").text(title);
- $("#compt-ver").text(real);
- if (~real.indexOf("compatible")) {
- $("#compt-warn").show();
+ $('#compt-instance').text(title)
+ $('#compt-ver').text(real)
+ if (~real.indexOf('compatible')) {
+ $('#compt-warn').show()
} else {
- $("#compt-warn").hide();
+ $('#compt-warn').hide()
}
- $("#compt-list").html("");
- var start = "../../source/version.json";
+ $('#compt-list').html('')
+ var start = '../../source/version.json'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var complete = false;
- var ct = 0;
- var jl = 0;
- var jl2 = 0;
+ var complete = false
+ var ct = 0
+ var jl = 0
+ var jl2 = 0
Object.keys(json).forEach(function(key) {
- var data = json[key];
+ var data = json[key]
if (data) {
- jl++;
+ jl++
if (key != real && !complete) {
for (var i = 0; i < data.length; i++) {
- var e = "";
+ var e = ''
if (i == 0) {
- e = "(" + key + ")";
+ e = '(' + key + ')'
}
- $("#compt-list").append("" + data[i] + e + " ");
- ct++;
- e = "";
+ $('#compt-list').append('' + data[i] + e + ' ')
+ ct++
+ e = ''
}
- jl2++;
+ jl2++
} else if (!complete) {
- complete = true;
+ complete = true
}
}
- });
- if (lang.language == "ja" && ct > 0) {
- if (jl2 != jl && prefix != "1") {
- $("#compt").show();
+ })
+ if (lang.language == 'ja' && ct > 0) {
+ if (jl2 != jl && prefix != '1') {
+ $('#compt').show()
}
}
- });
+ })
}
//これが後のMisskeyである。
function misskeyLogin(url) {
if (!url) {
- var url = $("#misskey-url").val();
+ var url = $('#misskey-url').val()
}
- var start = "http://" + url + "/api/app/create";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
- localStorage.setItem("msky", "true");
+ var start = 'http://' + url + '/api/app/create'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
+ localStorage.setItem('msky', 'true')
httpreq.send(
JSON.stringify({
- name: "TheDesk(PC)",
- description: "Mastodon and Misskey client for PC",
- permission: ["account-read", "account-write", "account/read", "account/write", "drive-read", "drive-write", "favorite-read", "favorite-write", "favorites-read", "following-read", "following-write", "messaging-read", "messaging-write", "note-read", "note-write", "notification-read", "notification-write", "reaction-read", "reaction-write", "vote-read", "vote-write", "read:account", "write:account", "read:drive", "write:drive", "read:blocks", "write:blocks", "read:favorites", "write:favorites", "read:following", "write:following", "read:messaging", "write:messaging", "read:mutes", "write:mutes", "write:notes", "read:notifications", "write:notifications", "read:reactions", "write:reactions", "write:votes"]
+ name: 'TheDesk(PC)',
+ description: 'Mastodon and Misskey client for PC',
+ permission: [
+ 'account-read',
+ 'account-write',
+ 'account/read',
+ 'account/write',
+ 'drive-read',
+ 'drive-write',
+ 'favorite-read',
+ 'favorite-write',
+ 'favorites-read',
+ 'following-read',
+ 'following-write',
+ 'messaging-read',
+ 'messaging-write',
+ 'note-read',
+ 'note-write',
+ 'notification-read',
+ 'notification-write',
+ 'reaction-read',
+ 'reaction-write',
+ 'vote-read',
+ 'vote-write',
+ 'read:account',
+ 'write:account',
+ 'read:drive',
+ 'write:drive',
+ 'read:blocks',
+ 'write:blocks',
+ 'read:favorites',
+ 'write:favorites',
+ 'read:following',
+ 'write:following',
+ 'read:messaging',
+ 'write:messaging',
+ 'read:mutes',
+ 'write:mutes',
+ 'write:notes',
+ 'read:notifications',
+ 'write:notifications',
+ 'read:reactions',
+ 'write:reactions',
+ 'write:votes'
+ ]
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- misskeyAuth(url, json.secret);
+ misskeyAuth(url, json.secret)
}
- };
+ }
}
function misskeyAuth(url, mkc) {
- var start = "https://" + url + "/api/auth/session/generate";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
+ var start = 'https://' + url + '/api/auth/session/generate'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
- localStorage.setItem("mkc", mkc);
- localStorage.setItem("msky", "true");
+ localStorage.setItem('mkc', mkc)
+ localStorage.setItem('msky', 'true')
httpreq.send(
JSON.stringify({
appSecret: mkc
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- var token = json.token;
- $("#auth").show();
- $("#code").val(token);
- $("#add").hide();
- $("#misskey").prop("checked", false);
- localStorage.setItem("domain_tmp", url);
- postMessage(["openUrl", json.url], "*");
+ var token = json.token
+ $('#auth').show()
+ $('#code').val(token)
+ $('#add').hide()
+ $('#misskey').prop('checked', false)
+ localStorage.setItem('domain_tmp', url)
+ postMessage(['openUrl', json.url], '*')
}
- };
+ }
}
//テキストボックスにURL入れた
function instance() {
- var url = $("#url").val();
- if (url.indexOf("@") != -1 || url.indexOf("https") != -1) {
- alert('入力形式が違います。(Cutls@mstdn.jpにログインする場合、入力するのは"mstdn.jp"です。)');
- return false;
+ var url = $('#url').val()
+ if (url.indexOf('@') != -1 || url.indexOf('https') != -1) {
+ alert('入力形式が違います。(Cutls@mstdn.jpにログインする場合、入力するのは"mstdn.jp"です。)')
+ return false
}
- login(url);
+ login(url)
}
//コード入れてAccessTokenゲット
function code(code) {
- localStorage.removeItem("redirect");
+ localStorage.removeItem('redirect')
if (!code) {
- var code = $("#code").val();
- $("#code").val("");
+ var code = $('#code').val()
+ $('#code').val('')
}
- if (!code || code == "") {
- M.toast({ html: lang.lang_fatalerroroccured + "Error: no code", displayLength: 5000 });
- return false;
+ if (!code || code == '') {
+ M.toast({ html: lang.lang_fatalerroroccured + 'Error: no code', displayLength: 5000 })
+ return false
}
- var url = localStorage.getItem("domain_tmp");
- localStorage.removeItem("domain_tmp");
- if (localStorage.getItem("msky") == "true") {
- var start = "https://" + url + "/api/auth/session/userkey";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
+ var url = localStorage.getItem('domain_tmp')
+ localStorage.removeItem('domain_tmp')
+ if (localStorage.getItem('msky') == 'true') {
+ var start = 'https://' + url + '/api/auth/session/userkey'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
httpreq.send(
JSON.stringify({
token: code,
- appSecret: localStorage.getItem("mkc")
+ appSecret: localStorage.getItem('mkc')
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- var i = sha256(json.accessToken + localStorage.getItem("mkc"));
- var avatar = json["user"]["avatarUrl"];
- var priv = "public";
+ var i = sha256(json.accessToken + localStorage.getItem('mkc'))
+ var avatar = json['user']['avatarUrl']
+ var priv = 'public'
var add = {
at: i,
- name: json["user"]["name"],
+ name: json['user']['name'],
domain: url,
- user: json["user"]["username"],
+ user: json['user']['username'],
prof: avatar,
- id: json["user"]["id"],
+ id: json['user']['id'],
vis: priv,
- mode: "misskey"
- };
- localStorage.setItem("mode_" + url, "misskey");
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
- var target = obj.length;
- obj.push(add);
- localStorage.setItem("name_" + target, json["user"]["name"]);
- localStorage.setItem("user_" + target, json["user"]["username"]);
- localStorage.setItem("user-id_" + target, json["user"]["id"]);
- localStorage.setItem("prof_" + target, avatar);
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
- if ($("body").hasClass("first")) {
- location.href = "index.html";
+ mode: 'misskey'
}
- load();
- return;
+ localStorage.setItem('mode_' + url, 'misskey')
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
+ var target = obj.length
+ obj.push(add)
+ localStorage.setItem('name_' + target, json['user']['name'])
+ localStorage.setItem('user_' + target, json['user']['username'])
+ localStorage.setItem('user-id_' + target, json['user']['id'])
+ localStorage.setItem('prof_' + target, avatar)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
+ if ($('body').hasClass('first')) {
+ location.href = 'index.html'
+ }
+ load()
+ return
}
- };
- return;
- } else {
- var red = "urn:ietf:wg:oauth:2.0:oob";
- if (~url.indexOf("pixelfed")) {
- red = "https://thedesk.top/hello.html";
}
- var start = "https://" + url + "/oauth/token";
- var id = localStorage.getItem("client_id");
- var secret = localStorage.getItem("client_secret");
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
+ return
+ } else {
+ var red = 'urn:ietf:wg:oauth:2.0:oob'
+ if (~url.indexOf('pixelfed')) {
+ red = 'https://thedesk.top/hello.html'
+ }
+ var start = 'https://' + url + '/oauth/token'
+ var id = localStorage.getItem('client_id')
+ var secret = localStorage.getItem('client_secret')
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
httpreq.send(
JSON.stringify({
- grant_type: "authorization_code",
+ grant_type: 'authorization_code',
redirect_uri: red,
client_id: id,
client_secret: secret,
code: code
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- if (json["access_token"]) {
- $("#auth").hide();
- $("#add").show();
- getdata(url, json["access_token"]);
+ if (json['access_token']) {
+ $('#auth').hide()
+ $('#add').show()
+ getdata(url, json['access_token'])
}
}
- };
+ }
}
}
//ユーザーデータ取得
function getdata(domain, at) {
- var start = "https://" + domain + "/api/v1/accounts/verify_credentials";
+ var start = 'https://' + domain + '/api/v1/accounts/verify_credentials'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json.error) {
- console.error("Error:" + json.error);
- M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 });
- return;
+ console.error('Error:' + json.error)
+ M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
+ return
}
- var avatar = json["avatar"];
+ var avatar = json['avatar']
//missingがmissingなやつ
- if (avatar == "/avatars/original/missing.png") {
- avatar = "../../img/missing.svg";
+ if (avatar == '/avatars/original/missing.png') {
+ avatar = '../../img/missing.svg'
}
- if (json["source"]) {
- var priv = json["source"]["privacy"];
+ if (json['source']) {
+ var priv = json['source']['privacy']
} else {
- var priv = "public";
+ var priv = 'public'
}
var add = {
at: at,
- name: json["display_name"],
+ name: json['display_name'],
domain: domain,
- user: json["acct"],
+ user: json['acct'],
prof: avatar,
- id: json["id"],
+ id: json['id'],
vis: priv,
- mode: "mastodon"
- };
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
- var target = obj.length;
- obj.push(add);
- localStorage.setItem("name_" + target, json["display_name"]);
- localStorage.setItem("user_" + target, json["acct"]);
- localStorage.setItem("user-id_" + target, json["id"]);
- localStorage.setItem("prof_" + target, avatar);
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
- if ($("body").hasClass("first")) {
- location.href = "index.html";
+ mode: 'mastodon'
}
- load();
- });
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
+ var target = obj.length
+ obj.push(add)
+ localStorage.setItem('name_' + target, json['display_name'])
+ localStorage.setItem('user_' + target, json['acct'])
+ localStorage.setItem('user-id_' + target, json['id'])
+ localStorage.setItem('prof_' + target, avatar)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
+ if ($('body').hasClass('first')) {
+ location.href = 'index.html'
+ }
+ load()
+ })
}
//アクセストークン直接入力
function atSetup(type) {
- var url = localStorage.getItem("domain_tmp");
- localStorage.removeItem("domain_tmp");
- var multi = localStorage.getItem("multi");
- var avatar = "../../img/missing.svg";
- var priv = "public";
- if (type == "misskey") {
- var i = $("#misskey-key").val();
+ var url = localStorage.getItem('domain_tmp')
+ localStorage.removeItem('domain_tmp')
+ var multi = localStorage.getItem('multi')
+ var avatar = '../../img/missing.svg'
+ var priv = 'public'
+ if (type == 'misskey') {
+ var i = $('#misskey-key').val()
var add = {
at: i,
- name: "Pseudo Account",
+ name: 'Pseudo Account',
domain: url,
- user: "user+pseudo",
+ user: 'user+pseudo',
prof: avatar,
- id: "id+pseudo",
+ id: 'id+pseudo',
vis: priv,
- mode: "misskey"
- };
- localStorage.setItem("mode_" + url, "misskey");
+ mode: 'misskey'
+ }
+ localStorage.setItem('mode_' + url, 'misskey')
} else {
- var i = $("#code").val();
+ var i = $('#code').val()
var add = {
at: i,
- name: "Pseudo Account",
+ name: 'Pseudo Account',
domain: url,
- user: "user+pseudo",
+ user: 'user+pseudo',
prof: avatar,
- id: "id+pseudo",
+ id: 'id+pseudo',
vis: priv,
- mode: ""
- };
+ mode: ''
+ }
}
- if (!i || i == "") {
- M.toast({ html: lang.lang_fatalerroroccured + "Error: access token", displayLength: 5000 });
- return false;
+ if (!i || i == '') {
+ M.toast({ html: lang.lang_fatalerroroccured + 'Error: access token', displayLength: 5000 })
+ return false
}
- var obj = JSON.parse(multi);
- var target = obj.length;
- obj.push(add);
- localStorage.setItem("name_" + target, add["name"]);
- localStorage.setItem("user_" + target, add["username"]);
- localStorage.setItem("user-id_" + target, add["id"]);
- localStorage.setItem("prof_" + target, avatar);
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
- refresh(target);
+ var obj = JSON.parse(multi)
+ var target = obj.length
+ obj.push(add)
+ localStorage.setItem('name_' + target, add['name'])
+ localStorage.setItem('user_' + target, add['username'])
+ localStorage.setItem('user-id_' + target, add['id'])
+ localStorage.setItem('prof_' + target, avatar)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
+ refresh(target)
}
//ユーザーデータ更新
function refresh(target) {
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
- console.log(obj);
- if (obj[target].mode == "misskey") {
- misskeyRefresh(obj, target, obj[target].domain);
- return;
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
+ console.log(obj)
+ if (obj[target].mode == 'misskey') {
+ misskeyRefresh(obj, target, obj[target].domain)
+ return
}
- var start = "https://" + obj[target].domain + "/api/v1/accounts/verify_credentials";
+ var start = 'https://' + obj[target].domain + '/api/v1/accounts/verify_credentials'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + obj[target].at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + obj[target].at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json.error) {
- console.error("Error:" + json.error);
- M.toast({ html: lang.lang_fatalerroroccured + "Error:" + json.error, displayLength: 5000 });
- return;
+ console.error('Error:' + json.error)
+ M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
+ return
}
- var avatar = json["avatar"];
+ var avatar = json['avatar']
//missingがmissingなやつ
- if (avatar == "/avatars/original/missing.png" || !avatar) {
- avatar = "./img/missing.svg";
+ if (avatar == '/avatars/original/missing.png' || !avatar) {
+ avatar = './img/missing.svg'
}
var ref = {
at: obj[target].at,
- name: json["display_name"],
+ name: json['display_name'],
domain: obj[target].domain,
- user: json["acct"],
+ user: json['acct'],
prof: avatar,
- id: json["id"],
- vis: json["source"]["privacy"]
- };
- localStorage.setItem("name_" + target, json["display_name"]);
- localStorage.setItem("user_" + target, json["acct"]);
- localStorage.setItem("user-id_" + target, json["id"]);
- localStorage.setItem("prof_" + target, avatar);
- if (json["source"]["sensitive"]) {
- localStorage.setItem("nsfw_" + target, "true");
- } else {
- localStorage.removeItem("nsfw_" + target);
+ id: json['id'],
+ vis: json['source']['privacy']
}
- obj[target] = ref;
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
+ localStorage.setItem('name_' + target, json['display_name'])
+ localStorage.setItem('user_' + target, json['acct'])
+ localStorage.setItem('user-id_' + target, json['id'])
+ localStorage.setItem('prof_' + target, avatar)
+ if (json['source']['sensitive']) {
+ localStorage.setItem('nsfw_' + target, 'true')
+ } else {
+ localStorage.removeItem('nsfw_' + target)
+ }
+ obj[target] = ref
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
- load();
- });
+ load()
+ })
}
function misskeyRefresh(obj, target, url) {
- var start = "https://" + url + "/api/users/show";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
+ var start = 'https://' + url + '/api/users/show'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
httpreq.send(
JSON.stringify({
username: obj[target].user,
i: obj[target].at
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- var avatar = json["user"]["avatarUrl"];
- var priv = "public";
+ var avatar = json['user']['avatarUrl']
+ var priv = 'public'
var add = {
at: json.accessToken,
- name: json["user"]["name"],
+ name: json['user']['name'],
domain: url,
- user: json["user"]["username"],
+ user: json['user']['username'],
prof: avatar,
- id: json["user"]["id"],
+ id: json['user']['id'],
vis: priv
- };
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
- var target = obj.length;
- obj.push(add);
- localStorage.setItem("name_" + target, json["user"]["name"]);
- localStorage.setItem("user_" + target, json["user"]["username"]);
- localStorage.setItem("user-id_" + target, json["user"]["id"]);
- localStorage.setItem("prof_" + target, avatar);
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
- load();
- return;
+ }
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
+ var target = obj.length
+ obj.push(add)
+ localStorage.setItem('name_' + target, json['user']['name'])
+ localStorage.setItem('user_' + target, json['user']['username'])
+ localStorage.setItem('user-id_' + target, json['user']['id'])
+ localStorage.setItem('prof_' + target, avatar)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
+ load()
+ return
}
- };
+ }
}
//アカウントを選択…を実装
function multisel() {
- var multi = localStorage.getItem("multi");
+ var multi = localStorage.getItem('multi')
if (!multi) {
- var obj = [];
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
+ var obj = []
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
} else {
- var obj = JSON.parse(multi);
+ var obj = JSON.parse(multi)
}
- var templete;
- var last = localStorage.getItem("main");
- var sel;
+ var templete
+ var last = localStorage.getItem('main')
+ var sel
if (obj.length < 1) {
- $("#src-acct-sel").html('Tootsearch ');
- $("#add-acct-sel").html('' + lang.lang_login_noauth + " ");
+ $('#src-acct-sel').html('Tootsearch ')
+ $('#add-acct-sel').html('' + lang.lang_login_noauth + ' ')
} else {
Object.keys(obj).forEach(function(key) {
- var acct = obj[key];
- var list = key * 1 + 1;
+ var acct = obj[key]
+ var list = key * 1 + 1
if (key == last) {
- sel = "selected";
- mainb = "(" + lang.lang_manager_def + ")";
- var domain = localStorage.getItem("domain_" + key);
- var profimg = localStorage.getItem("prof_" + key);
- var domain = localStorage.getItem("domain_" + key);
+ sel = 'selected'
+ mainb = '(' + lang.lang_manager_def + ')'
+ var domain = localStorage.getItem('domain_' + key)
+ var profimg = localStorage.getItem('prof_' + key)
+ var domain = localStorage.getItem('domain_' + key)
if (!profimg) {
- profimg = "../../img/missing.svg";
+ profimg = '../../img/missing.svg'
}
} else {
- sel = "";
- mainb = "";
+ sel = ''
+ mainb = ''
}
- templete = '" + acct.user + "@" + acct.domain + mainb + " ";
- $(".acct-sel").append(templete);
- });
+ template = `
+
+ ${acct.user}@${acct.domain}${mainb}
+
+ `
+ $('.acct-sel').append(templete)
+ })
}
- $("select").formSelect();
+ $('select').formSelect()
}
function mainacct() {
- var acct_id = $("#main-acct-sel").val();
- localStorage.setItem("main", acct_id);
- M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 });
+ var acct_id = $('#main-acct-sel').val()
+ localStorage.setItem('main', acct_id)
+ M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 })
}
function colorpicker(key) {
- temp = '" + lang.lang_manager_none + "
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
" + '
";
- $("#colorsel_" + key).html(temp);
+ temp = `${lang.lang_manager_none}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`
+ $('#colorsel_' + key).html(temp)
}
function coloradd(key, bg, txt) {
- var col = localStorage.getItem("multi");
- var o = JSON.parse(col);
- var obj = o[key];
- obj.background = bg;
- obj.text = txt;
- o[key] = obj;
- var json = JSON.stringify(o);
- localStorage.setItem("multi", json);
- if (txt == "def") {
- $("#acct_" + key).attr("style", "");
+ var col = localStorage.getItem('multi')
+ var o = JSON.parse(col)
+ var obj = o[key]
+ obj.background = bg
+ obj.text = txt
+ o[key] = obj
+ var json = JSON.stringify(o)
+ localStorage.setItem('multi', json)
+ if (txt == 'def') {
+ $('#acct_' + key).attr('style', '')
} else {
- $("#acct_" + key).css("background-color", "#" + bg);
- if (txt == "black") {
- var bghex = "000000";
- var ichex = "9e9e9e";
- } else if (txt == "white") {
- var bghex = "ffffff";
- var ichex = "eeeeee";
+ $('#acct_' + key).css('background-color', '#' + bg)
+ if (txt == 'black') {
+ var bghex = '000000'
+ var ichex = '9e9e9e'
+ } else if (txt == 'white') {
+ var bghex = 'ffffff'
+ var ichex = 'eeeeee'
}
- $("#acct_" + key + " .nex").css("color", "#" + ichex);
- $("#acct_" + key).css("color", "#" + bghex);
+ $('#acct_' + key + ' .nex').css('color', '#' + ichex)
+ $('#acct_' + key).css('color', '#' + bghex)
}
}
//入力時にハッシュタグと@をサジェスト
-var timer = null;
+var timer = null
-var input = document.getElementById("url");
+var input = document.getElementById('url')
-var prev_val = input.value;
-var oldSuggest;
-var suggest;
+var prev_val = input.value
+var oldSuggest
+var suggest
input.addEventListener(
- "focus",
+ 'focus',
function() {
- $("#ins-suggest").html("");
- window.clearInterval(timer);
+ $('#ins-suggest').html('')
+ window.clearInterval(timer)
timer = window.setInterval(function() {
- var new_val = input.value;
+ var new_val = input.value
if (prev_val != new_val) {
if (new_val.length > 3) {
- var start = "https://instances.social/api/1.0/instances/search?q=" + new_val;
+ var start = 'https://instances.social/api/1.0/instances/search?q=' + new_val
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M"
+ 'content-type': 'application/json',
+ Authorization:
+ 'Bearer tC8F6xWGWBUwGScyNevYlx62iO6fdQ4oIK0ad68Oo7ZKB8GQdGpjW9TKxBnIh8grAhvd5rw3iyP9JPamoDpeLQdz62EToPJUW99hDx8rfuJfGdjQuimZPTbIOx0woA5M'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (!json.error) {
- var urls = "Suggest:";
+ var urls = 'Suggest:'
Object.keys(json.instances).forEach(function(key) {
- var url = json.instances[key];
- urls = urls + " ' + escapeHTML(url.name) + " ";
- });
- $("#ins-suggest").html(urls);
+ var url = json.instances[key]
+ urls =
+ urls +
+ ` ${escapeHTML(url.name)} `
+ })
+ $('#ins-suggest').html(urls)
} else {
- console.error(json.error);
+ console.error(json.error)
}
- });
+ })
}
- oldSuggest = suggest;
- prev_value = new_val;
+ oldSuggest = suggest
+ prev_value = new_val
}
- }, 1000);
+ }, 1000)
},
false
-);
+)
input.addEventListener(
- "blur",
+ 'blur',
function() {
- window.clearInterval(timer);
+ window.clearInterval(timer)
},
false
-);
+)
//acctで未読マーカーは要らない
function asReadEnd() {
- postMessage(["asReadComp", ""], "*");
+ postMessage(['asReadComp', ''], '*')
}
diff --git a/app/js/platform/end.js b/app/js/platform/end.js
index 2aace0b9..f0d6cefd 100644
--- a/app/js/platform/end.js
+++ b/app/js/platform/end.js
@@ -1,104 +1,96 @@
//プラットフォーム別 最後に読むやつ
-//リンクを外部で開くか内部で出すか
+//リンクを外部で開くか内部で出すか
$(document).on('click', 'a', e => {
- var $a = $(e.target);
- var url = $a.attr('href');
+ var $a = $(e.target)
+ var url = $a.attr('href')
if (!url) {
- var url = $a.parent().attr('href');
+ var url = $a.parent().attr('href')
}
- var urls = [];
+ var urls = []
if (url) {
- urls = url.match(/https?:\/\/(.+)/);
+ urls = url.match(/https?:\/\/(.+)/)
//トゥートのURLぽかったら
- toot = url.match(/https:\/\/([^+_]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/);
- if(!toot){
+ toot = url.match(/https:\/\/([^+_]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/)
+ if (!toot) {
//Pleroma対策
- toot = url.match(/https:\/\/([^+_]+)\/users\/([a-zA-Z0-9_]+)\/statuses\/([0-9]+)/);
+ toot = url.match(/https:\/\/([^+_]+)\/users\/([a-zA-Z0-9_]+)\/statuses\/([0-9]+)/)
}
//タグのURLぽかったら
- var tags = [];
- tags = url.match(
- /https:\/\/([^+_]+)\/tags\/([_a-zA-Z0-9\&=+\%]+)/
- );
+ var tags = []
+ tags = url.match(/https:\/\/([^+_]+)\/tags\/([_a-zA-Z0-9\&=+\%]+)/)
//メンションっぽかったら
- var ats = [];
- ats = url.match(
- /https:\/\/([^+_]+)\/@([_a-zA-Z0-9\&=+\%]+)/
- );
+ var ats = []
+ ats = url.match(/https:\/\/([^+_]+)\/@([_a-zA-Z0-9\&=+\%]+)/)
if (toot) {
if (toot[1]) {
- var acct_id = $a.parent().attr("data-acct");
+ var acct_id = $a.parent().attr('data-acct')
if (!acct_id) {
- acct_id = 0;
+ acct_id = 0
}
- $a.parent().addClass("loadp")
- $a.parent().text("Loading...")
- detEx(url, acct_id);
+ $a.parent().addClass('loadp')
+ $a.parent().text('Loading...')
+ detEx(url, acct_id)
}
-
} else if (tags) {
if (tags[2]) {
- var acct_id = $a.parent().attr("data-acct");
+ var acct_id = $a.parent().attr('data-acct')
if (!acct_id) {
- acct_id = 0;
+ acct_id = 0
}
tl('tag', decodeURI(tags[2]), acct_id, 'add')
}
} else if (ats) {
if (ats[2]) {
//Quesdon判定
- if (!~ats[2].indexOf("@")) {
- udgEx(url, "main");
+ if (!~ats[2].indexOf('@')) {
+ udgEx(url, 'main')
return false
} else {
- postMessage(["openUrl", url], "*")
+ postMessage(['openUrl', url], '*')
}
-
-
}
} else {
//hrefがhttp/httpsならブラウザで
if (urls) {
if (urls[0]) {
- if (~url.indexOf("thedeks.top")) {
+ if (~url.indexOf('thedeks.top')) {
//alert("If you recieve this alert, let the developer(Cutls@kirishima.cloud) know it with a screenshot.");
- url = "https://thedesk.top";
+ url = 'https://thedesk.top'
}
- postMessage(["openUrl", url], "*")
+ postMessage(['openUrl', url], '*')
} else {
-
- location.href = url;
+ location.href = url
}
} else {
- location.href = url;
+ location.href = url
}
}
}
- return false;
-});
+ return false
+})
//よく使うライブラリ
//コピー
function execCopy(string) {
- postMessage(["copy", string], "*")
- return true;
+ postMessage(['copy', string], '*')
+ return true
}
function progshow(e) {
if (e.lengthComputable) {
- var percent = e.loaded / e.total;
- console.log("Progress: " + percent * 100);
- $("#imgsel").hide();
+ var percent = e.loaded / e.total
+ console.log('Progress: ' + percent * 100)
+ $('#imgsel').hide()
if (percent < 1) {
- $("#imgup").text(Math.floor(percent * 100) + "%");
+ $('#imgup').text(Math.floor(percent * 100) + '%')
} else {
- $("#imgup").text(lang.lang_progress);
+ $('#imgup').text(lang.lang_progress)
}
}
}
function opendev() {
- var webview = document.getElementById("webview");
- webview.openDevTools();
+ var webview = document.getElementById('webview')
+ webview.openDevTools()
/*webview.sendInputEvent({
type: "keyDown",
keyCode: '2'
@@ -107,91 +99,94 @@ function opendev() {
}
var soundFile
function playSound() {
- window.AudioContext = window.AudioContext || window.webkitAudioContext;
- if(soundFile){
+ window.AudioContext = window.AudioContext || window.webkitAudioContext
+ if (soundFile) {
soundFile.stop()
}
- context = new AudioContext();
- context.createBufferSource().start(0);
- context.decodeAudioData(request.response, function (buf) {
+ context = new AudioContext()
+ context.createBufferSource().start(0)
+ context.decodeAudioData(request.response, function(buf) {
//console.log("Playing:" , source)
- source.buffer = buf;
- source.loop = false;
- });
- source = context.createBufferSource();
- volumeControl = context.createGain();
- source.connect(volumeControl);
- volumeControl.connect(context.destination);
- var cvol = localStorage.getItem("customVol")
+ source.buffer = buf
+ source.loop = false
+ })
+ source = context.createBufferSource()
+ volumeControl = context.createGain()
+ source.connect(volumeControl)
+ volumeControl.connect(context.destination)
+ var cvol = localStorage.getItem('customVol')
if (cvol) {
vol = cvol
- }else{
+ } else {
vol = 0.8
}
volumeControl.gain.value = vol
- source.start(0);
- soundFile = source;
+ source.start(0)
+ soundFile = source
function newFunction() {
- var source;
- return source;
+ var source
+ return source
}
}
function nano() {
- postMessage(["nano", null], "*")
+ postMessage(['nano', null], '*')
}
-onmessage = function (e) {
- if (e.data[0] == "details") {
+onmessage = function(e) {
+ if (e.data[0] == 'details') {
details(e.data[1][0], e.data[1][1])
- } else if (e.data[0] == "udg") {
+ } else if (e.data[0] == 'udg') {
udg(e.data[1][0], e.data[1][1])
- } else if (e.data[0] == "media") {
+ } else if (e.data[0] == 'media') {
media(e.data[1][0], e.data[1][1], e.data[1][2])
- } else if (e.data[0] == "post") {
- post("pass")
- } else if (e.data[0] == "toastSaved") {
- M.toast({ html: lang.lang_img_DLDone + e.data[1][0] + 'Show ', displayLength: 5000 })
- } else if (e.data[0] == "parseColumn") {
+ } else if (e.data[0] == 'post') {
+ post('pass')
+ } else if (e.data[0] == 'toastSaved') {
+ var show = `${lang.lang_img_DLDone}${
+ e.data[1][0]
+ }Show `
+ M.toast({ html: show, displayLength: 5000 })
+ } else if (e.data[0] == 'parseColumn') {
parseColumn(e.data[1])
- } else if (e.data[0] == "exportSettingsCore") {
+ } else if (e.data[0] == 'exportSettingsCore') {
var exp = exportSettingsCore()
- postMessage(["exportSettingsCoreComplete", [e.data[1], exp]], "*")
- } else if (e.data[0] == "importSettingsCore") {
+ postMessage(['exportSettingsCoreComplete', [e.data[1], exp]], '*')
+ } else if (e.data[0] == 'importSettingsCore') {
importSettingsCore(e.data[1])
- }else if (e.data[0] == "fontList") {
+ } else if (e.data[0] == 'fontList') {
fontList(e.data[1])
- } else if (e.data[0] == "customSoundSave") {
+ } else if (e.data[0] == 'customSoundSave') {
customSoundSave(e.data[1][0], e.data[1][1])
- } else if (e.data[0] == "ctLoadCore") {
+ } else if (e.data[0] == 'ctLoadCore') {
ctLoadCore(e.data[1])
- } else if (e.data[0] == "ctLoad") {
+ } else if (e.data[0] == 'ctLoad') {
ctLoad()
- } else if (e.data[0] == "customConnect") {
+ } else if (e.data[0] == 'customConnect') {
customConnect(e.data[1])
- } else if (e.data[0] == "clearCustomImport") {
+ } else if (e.data[0] == 'clearCustomImport') {
clearCustomImport()
- } else if (e.data[0] == "npCore") {
- npCore(e.data[1]);
- } else if (e.data[0] == "renderMem") {
+ } else if (e.data[0] == 'npCore') {
+ npCore(e.data[1])
+ } else if (e.data[0] == 'renderMem') {
renderMem(e.data[1][0], e.data[1][1], e.data[1][2])
- } else if (e.data[0] == "updateProg") {
- updateProg(e.data[1]);
- } else if (e.data[0] == "updateMess") {
- updateMess(e.data[1]);
- } else if (e.data[0] == "renderAbout") {
- renderAbout(e.data[1]);
- } else if (e.data[0] == "asRead") {
+ } else if (e.data[0] == 'updateProg') {
+ updateProg(e.data[1])
+ } else if (e.data[0] == 'updateMess') {
+ updateMess(e.data[1])
+ } else if (e.data[0] == 'renderAbout') {
+ renderAbout(e.data[1])
+ } else if (e.data[0] == 'asRead') {
asRead()
- } else if (e.data[0] == "asReadEnd") {
+ } else if (e.data[0] == 'asReadEnd') {
asReadEnd()
- } else if (e.data[0] == "logData") {
- $("#logs").val(e.data[1])
- var obj = document.getElementById("logs");
- obj.scrollTop = obj.scrollHeight;
- } else if (e.data[0] == "alert") {
+ } else if (e.data[0] == 'logData') {
+ $('#logs').val(e.data[1])
+ var obj = document.getElementById('logs')
+ obj.scrollTop = obj.scrollHeight
+ } else if (e.data[0] == 'alert') {
Swal.fire({
type: 'info',
title: e.data[1]
})
}
-}
\ No newline at end of file
+}
diff --git a/app/js/platform/first.js b/app/js/platform/first.js
index e79f0f6c..20aca529 100644
--- a/app/js/platform/first.js
+++ b/app/js/platform/first.js
@@ -1,214 +1,225 @@
-document.title="TheDesk"
-$.strip_tags = function (str, allowed) {
+document.title = 'TheDesk'
+$.strip_tags = function(str, allowed) {
if (!str) {
- return "";
+ return ''
}
- allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || [])
- .join('');
+ allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('')
var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
- commentsAndPhpTags = /|<\?(?:php)?[\s\S]*?\?>/gi;
- return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
- return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
- });
-};
+ commentsAndPhpTags = /|<\?(?:php)?[\s\S]*?\?>/gi
+ return str.replace(commentsAndPhpTags, '').replace(tags, function($0, $1) {
+ return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
+ })
+}
function escapeHTML(str) {
if (!str) {
- return "";
+ return ''
}
- return str.replace(/&/g, '&')
+ return str
+ .replace(/&/g, '&')
.replace(//g, '>')
.replace(/"/g, '"')
- .replace(/'/g, ''');
+ .replace(/'/g, ''')
}
//PHPのnl2brと同様
function nl2br(str) {
if (!str) {
- return "";
+ return ''
}
- str = str.replace(/\r\n/g, " ");
- str = str.replace(/(\n|\r)/g, " ");
- return str;
+ str = str.replace(/\r\n/g, ' ')
+ str = str.replace(/(\n|\r)/g, ' ')
+ return str
}
function br2nl(str) {
if (!str) {
- return "";
+ return ''
}
- str = str.replace(/ /g, "\r\n");
- return str;
+ str = str.replace(/ /g, '\r\n')
+ return str
}
function formattime(date) {
- var str = date.getFullYear() + "-";
+ var str = date.getFullYear() + '-'
if (date.getMonth() + 1 < 10) {
- str = str + "0" + (date.getMonth() + 1) + "-";
+ str = str + '0' + (date.getMonth() + 1) + '-'
} else {
- str = str + (date.getMonth() + 1) + "-";
+ str = str + (date.getMonth() + 1) + '-'
}
if (date.getDate() < 10) {
- str = str + "0" + date.getDate()
+ str = str + '0' + date.getDate()
} else {
str = str + date.getDate()
}
- str = str + "T";
+ str = str + 'T'
if (date.getHours() < 10) {
- str = str + "0" + date.getHours() + ":"
+ str = str + '0' + date.getHours() + ':'
} else {
- str = str + date.getHours() + ":"
+ str = str + date.getHours() + ':'
}
if (date.getMinutes() < 10) {
- str = str + "0" + date.getMinutes()
+ str = str + '0' + date.getMinutes()
} else {
str = str + date.getMinutes()
}
- return escapeHTML(str);
+ return escapeHTML(str)
}
function formattimeutc(date) {
- var str = date.getUTCFullYear() + "-";
+ var str = date.getUTCFullYear() + '-'
if (date.getUTCMonth() + 1 < 10) {
- str = str + "0" + (date.getUTCMonth() + 1) + "-";
+ str = str + '0' + (date.getUTCMonth() + 1) + '-'
} else {
- str = str + (date.getUTCMonth() + 1) + "-";
+ str = str + (date.getUTCMonth() + 1) + '-'
}
if (date.getUTCDate() < 10) {
- str = str + "0" + date.getUTCDate()
+ str = str + '0' + date.getUTCDate()
} else {
str = str + date.getUTCDate()
}
- str = str + "T";
+ str = str + 'T'
if (date.getUTCHours() < 10) {
- str = str + "0" + date.getUTCHours() + ":"
+ str = str + '0' + date.getUTCHours() + ':'
} else {
- str = str + date.getUTCHours() + ":"
+ str = str + date.getUTCHours() + ':'
}
if (date.getUTCMinutes() < 10) {
- str = str + "0" + date.getUTCMinutes()
+ str = str + '0' + date.getUTCMinutes()
} else {
str = str + date.getUTCMinutes()
}
- return escapeHTML(str);
+ return escapeHTML(str)
}
-postMessage(["sendSinmpleIpc", "custom-css-request"], "*")
+postMessage(['sendSinmpleIpc', 'custom-css-request'], '*')
function makeCID() {
- return randomStr(8) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(4) + "-" + randomStr(12);
+ return (
+ randomStr(8) +
+ '-' +
+ randomStr(4) +
+ '-' +
+ randomStr(4) +
+ '-' +
+ randomStr(4) +
+ '-' +
+ randomStr(12)
+ )
}
function randomStr(l) {
// 生成する文字列に含める文字セット
- var c = "abcdefghijklmnopqrstuvwxyz0123456789";
- var cl = c.length;
- var r = "";
+ var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
+ var cl = c.length
+ var r = ''
for (var i = 0; i < l; i++) {
- r += c[Math.floor(Math.random() * cl)];
+ r += c[Math.floor(Math.random() * cl)]
}
- return r;
+ return r
}
function rgbToHex(color) {
// HEXに変換したものを代入する変数
- var hex = '';
+ var hex = ''
// 第1引数がHEXのとき変換処理は必要ないのでそのままreturn
// IE8の場合はjQueryのcss()関数でHEXを返すので除外
if (color.match(/^#[a-f\d]{3}$|^#[a-f\d]{6}$/i)) {
- return color;
+ return color
}
// 正規表現
- var regex = color.match(/^rgb\(([0-9.]+),\s*([0-9.]+),\s*([0-9.]+)\)$/);
+ var regex = color.match(/^rgb\(([0-9.]+),\s*([0-9.]+),\s*([0-9.]+)\)$/)
// 正規表現でマッチしたとき
if (regex) {
- var rgb =
- [
- // RGBからHEXへ変換
- parseInt(regex[1]).toString(16),
- parseInt(regex[2]).toString(16),
- parseInt(regex[3]).toString(16)
- ];
+ var rgb = [
+ // RGBからHEXへ変換
+ parseInt(regex[1]).toString(16),
+ parseInt(regex[2]).toString(16),
+ parseInt(regex[3]).toString(16)
+ ]
for (var i = 0; i < rgb.length; ++i) {
// rgb(1,1,1)のようなときHEXに変換すると1桁になる
// 1桁のときは前に0を足す
if (rgb[i].length == 1) {
- rgb[i] = '0' + rgb[i];
+ rgb[i] = '0' + rgb[i]
}
- hex += rgb[i];
+ hex += rgb[i]
}
- return hex;
+ return hex
}
- console.error(color + ':第1引数はRGB形式で入力');
+ console.error(color + ':第1引数はRGB形式で入力')
}
/*マルチバイト用切り出し*/
-$.isSurrogatePear = function (upper, lower) {
- return 0xD800 <= upper && upper <= 0xDBFF && 0xDC00 <= lower && lower <= 0xDFFF;
-};
-$.mb_strlen = function (str) {
- var ret = 0;
- for (var i = 0; i < str.length; i++ , ret++) {
- var upper = str.charCodeAt(i);
- var lower = str.length > (i + 1) ? str.charCodeAt(i + 1) : 0;
+$.isSurrogatePear = function(upper, lower) {
+ return 0xd800 <= upper && upper <= 0xdbff && 0xdc00 <= lower && lower <= 0xdfff
+}
+$.mb_strlen = function(str) {
+ var ret = 0
+ for (var i = 0; i < str.length; i++, ret++) {
+ var upper = str.charCodeAt(i)
+ var lower = str.length > i + 1 ? str.charCodeAt(i + 1) : 0
if ($.isSurrogatePear(upper, lower)) {
- i++;
+ i++
}
}
- return ret;
-};
-$.mb_substr = function (str, begin, end) {
- var ret = '';
- for (var i = 0, len = 0; i < str.length; i++ , len++) {
- var upper = str.charCodeAt(i);
- var lower = str.length > (i + 1) ? str.charCodeAt(i + 1) : 0;
- var s = '';
+ return ret
+}
+$.mb_substr = function(str, begin, end) {
+ var ret = ''
+ for (var i = 0, len = 0; i < str.length; i++, len++) {
+ var upper = str.charCodeAt(i)
+ var lower = str.length > i + 1 ? str.charCodeAt(i + 1) : 0
+ var s = ''
if ($.isSurrogatePear(upper, lower)) {
- i++;
- s = String.fromCharCode(upper, lower);
+ i++
+ s = String.fromCharCode(upper, lower)
} else {
- s = String.fromCharCode(upper);
+ s = String.fromCharCode(upper)
}
if (begin <= len && len < end) {
- ret += s;
+ ret += s
}
}
- return ret;
-};
+ return ret
+}
//ソートするやつ
function object_array_sort(data, key, order, fn) {
- var num_a = -1;
- var num_b = 1;
+ var num_a = -1
+ var num_b = 1
if (order === 'asc') {
- num_a = 1;
- num_b = -1;
+ 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 = {};
+ 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];
+ arrObj[data[i]['family']] = data[i]
}
- data = [];
+ data = []
for (var key in arrObj) {
- data.push(arrObj[key]);
+ data.push(arrObj[key])
}
- fn(data);
+ fn(data)
}
-function setLog(txt1, txt2,txt3){
+function setLog(txt1, txt2, txt3) {
//url,statuscode,responsetext
var text = new Date().toUTCString()
- text=text+","+txt1+","+txt2+","+escapeCsv(txt3)
+ text = text + ',' + txt1 + ',' + txt2 + ',' + escapeCsv(txt3)
console.error(text)
- postMessage(["log", text], "*")
+ postMessage(['log', text], '*')
}
function escapeCsv(str) {
- if(!str){return str;}
- var result;
- result = str.replace(/\"/g, "\"\"");
- if (result.indexOf(",") >= 0) {
- result = "\"" + result + "\""
+ if (!str) {
+ return str
}
- return result;
-}
\ No newline at end of file
+ var result
+ result = str.replace(/\"/g, '""')
+ if (result.indexOf(',') >= 0) {
+ result = '"' + result + '"'
+ }
+ return result
+}
diff --git a/app/js/platform/nano.js b/app/js/platform/nano.js
index 7147145d..77e17853 100644
--- a/app/js/platform/nano.js
+++ b/app/js/platform/nano.js
@@ -1,262 +1,263 @@
-
//TL取得
-var websocket;
+var websocket
function tl(data) {
- var tlid = 0;
- if(websocket){
+ var tlid = 0
+ if (websocket) {
websocket.close()
}
- var acct_id = $("#post-acct-sel").val();
- var type = $("#type-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
+ var acct_id = $('#post-acct-sel').val()
+ var type = $('#type-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
//タグの場合はカラム追加して描画
if (!type) {
//デフォルト
- var type = "local";
+ var type = 'local'
}
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- $("#notice_nano").text(cap(type, data) + " TL(" + localStorage.getItem(
- "user_" + acct_id) + "@" + domain + ")");
- var start = "https://" + domain + "/api/v1/timelines/" + com(type, data);
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ $('#notice_nano').text(
+ cap(type, data) + ' TL(' + localStorage.getItem('user_' + acct_id) + '@' + domain + ')'
+ )
+ var start = 'https://' + domain + '/api/v1/timelines/' + com(type, data)
fetch(start, {
method: 'GET',
headers: {
'content-type': 'application/json',
- 'Authorization': 'Bearer ' + at
- },
- }).then(function (response) {
- if (!response.ok) {
- response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ Authorization: 'Bearer ' + at
}
- return response.json();
- }).catch(function (error) {
- console.error(error);
- }).then(function (json) {
- var templete = parse([json[0]], '', acct_id, tlid);
- $("#timeline_nano").html(templete);
- jQuery("time.timeago").timeago();
- $("#menu").addClass("hide");
- });
+ })
+ .then(function(response) {
+ if (!response.ok) {
+ response.text().then(function(text) {
+ setLog(response.url, response.status, text)
+ })
+ }
+ return response.json()
+ })
+ .catch(function(error) {
+ console.error(error)
+ })
+ .then(function(json) {
+ var templete = parse([json[0]], '', acct_id, tlid)
+ $('#timeline_nano').html(templete)
+ jQuery('time.timeago').timeago()
+ $('#menu').addClass('hide')
+ })
//Streaming接続
- var tlid = 0;
- if (type == "home") {
- var start = "wss://" + domain +
- "/api/v1/streaming/?stream=user&access_token=" + at;
- } else if (type == "pub") {
- var start = "wss://" + domain +
- "/api/v1/streaming/?stream=public&access_token=" + at;
- } else if (type == "local") {
- var start = "wss://" + domain +
- "/api/v1/streaming/?stream=public:local&access_token=" + at;
- } else if (type == "tag") {
- var start = "wss://" + domain +
- "/api/v1/streaming/?stream=hashtag&tag=" + data + "&access_token=" + at;
+ var tlid = 0
+ if (type == 'home') {
+ var start = 'wss://' + domain + '/api/v1/streaming/?stream=user&access_token=' + at
+ } else if (type == 'pub') {
+ var start = 'wss://' + domain + '/api/v1/streaming/?stream=public&access_token=' + at
+ } else if (type == 'local') {
+ var start = 'wss://' + domain + '/api/v1/streaming/?stream=public:local&access_token=' + at
+ } else if (type == 'tag') {
+ var start =
+ 'wss://' + domain + '/api/v1/streaming/?stream=hashtag&tag=' + data + '&access_token=' + at
}
- websocket = new WebSocket(start);
- websocket.onopen = function (mess) {
- $("#notice_icon_" + tlid).removeClass("red-text");
+ websocket = new WebSocket(start)
+ websocket.onopen = function(mess) {
+ $('#notice_icon_' + tlid).removeClass('red-text')
}
- websocket.onmessage = function (mess) {
- var typeA = JSON.parse(mess.data).event;
- if (typeA == "update") {
- var obj = JSON.parse(JSON.parse(mess.data).payload);
- var templete = parse([obj], '', acct_id, tlid);
- jQuery("time.timeago").timeago();
- $("#timeline_nano").html(templete);
+ websocket.onmessage = function(mess) {
+ var typeA = JSON.parse(mess.data).event
+ if (typeA == 'update') {
+ var obj = JSON.parse(JSON.parse(mess.data).payload)
+ var templete = parse([obj], '', acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ $('#timeline_nano').html(templete)
}
-
}
- websocket.onerror = function (error) {
- console.error('WebSocket Error ' + error);
- };
- websocket.onclose = function (mess) {
- console.error("Close Streaming API:" + type);
+ websocket.onerror = function(error) {
+ console.error('WebSocket Error ' + error)
+ }
+ websocket.onclose = function(mess) {
+ console.error('Close Streaming API:' + type)
}
}
//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"
+ 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'
}
}
//TLのURL
function com(type, data) {
- if (type == "home") {
- return "home?"
- } else if (type == "local") {
- return "public?local=true&"
- } else if (type == "pub") {
- return "public?"
- } else if (type == "tag") {
- return "tag/" + data + "?"
+ if (type == 'home') {
+ return 'home?'
+ } else if (type == 'local') {
+ return 'public?local=true&'
+ } else if (type == 'pub') {
+ return 'public?'
+ } else if (type == 'tag') {
+ return 'tag/' + data + '?'
}
- if (type == "list") {
- return "list/" + data + "?"
+ if (type == 'list') {
+ 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 == '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"
+ if (type == 'list') {
+ return 'subject'
}
}
-function todo() { }
-function todc() { }
-function hide() { }
-$(function ($) {
+function todo() {}
+function todc() {}
+function hide() {}
+$(function($) {
//キーボードショートカット
- $(window).keydown(function (e) {
- var hasFocus = $('input').is(':focus');
- var hasFocus2 = $('textarea').is(':focus');
+ $(window).keydown(function(e) {
+ var hasFocus = $('input').is(':focus')
+ var hasFocus2 = $('textarea').is(':focus')
//Ctrl+Enter:投稿
if (event.ctrlKey) {
if (e.keyCode === 13) {
- post();
- return false;
+ post()
+ return false
}
}
- });
-});
+ })
+})
function set() {
- $("#menu").toggleClass("hide");
- if($("#menu").hasClass("hide")){
- $("#setting").text("Setting")
- }else{
- $("#setting").text("Close")
+ $('#menu').toggleClass('hide')
+ if ($('#menu').hasClass('hide')) {
+ $('#setting').text('Setting')
+ } else {
+ $('#setting').text('Close')
}
}
-var multi = localStorage.getItem("multi");
+var multi = localStorage.getItem('multi')
if (!multi) {
var obj = [
{
- at: localStorage.getItem(localStorage.getItem("domain_" + acct_id) + "_at"),
- name: localStorage.getItem("name_" + acct_id),
- domain: localStorage.getItem("domain_" + acct_id),
- user: localStorage.getItem("user_" + acct_id),
- prof: localStorage.getItem("prof_" + acct_id)
+ at: localStorage.getItem(localStorage.getItem('domain_' + acct_id) + '_at'),
+ name: localStorage.getItem('name_' + acct_id),
+ domain: localStorage.getItem('domain_' + acct_id),
+ user: localStorage.getItem('user_' + acct_id),
+ prof: localStorage.getItem('prof_' + acct_id)
}
- ];
- var json = JSON.stringify(obj);
- localStorage.setItem("multi", json);
+ ]
+ var json = JSON.stringify(obj)
+ localStorage.setItem('multi', json)
} else {
- var obj = JSON.parse(multi);
+ var obj = JSON.parse(multi)
}
-var templete;
-var last = localStorage.getItem("last-use");
-var sel;
+var templete
+var last = localStorage.getItem('last-use')
+var sel
Object.keys(obj).forEach(function(key) {
- var acct = obj[key];
- var list = key * 1 + 1;
+ var acct = obj[key]
+ var list = key * 1 + 1
if (key == last) {
- sel = "selected";
+ sel = 'selected'
} else {
- sel = "";
+ sel = ''
}
- templete = '" + acct.user + "@" + acct.domain + " ";
- $("#post-acct-sel").append(templete);
-});
+ templete = `${acct.user}@${acct.domain} `
+ $('#post-acct-sel').append(templete)
+})
function mov() {
- return false;
+ return false
}
function resetmv() {
- return false;
+ return false
}
function post() {
- var acct_id = $("#post-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/statuses";
- var str = $("#textarea").val();
+ var acct_id = $('#post-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/statuses'
+ var str = $('#textarea').val()
var toot = {
status: str
- };
- var vis = loadVis(acct_id);
- toot.visibility = vis;
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify(toot));
+ }
+ var vis = loadVis(acct_id)
+ toot.visibility = vis
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify(toot))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- if(this.status!==200){ setLog(start, this.status, this.response); }
- $("#textarea").val("");
- }
- };
-}
-function loadVis(acct_id) {
- var vist = localStorage.getItem("vis");
- if (!vist) {
- return "public";
- } else {
- if (vist == "memory") {
- var memory = localStorage.getItem("vis-memory-" + acct_id);
- if (!memory) {
- memory = "public";
+ if (this.status !== 200) {
+ setLog(start, this.status, this.response)
}
- return memory;
- } else if (vist == "server" || vist == "useapi") {
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
- var memory = obj[acct_id]["vis"];
- if (!memory) {
- memory = "public";
- }
- return memory;
- } else {
- return vist;
+ $('#textarea').val('')
}
}
}
-function loader(){
- var acct_id = $("#post-acct-sel").val()
+function loadVis(acct_id) {
+ var vist = localStorage.getItem('vis')
+ if (!vist) {
+ return 'public'
+ } else {
+ if (vist == 'memory') {
+ var memory = localStorage.getItem('vis-memory-' + acct_id)
+ if (!memory) {
+ memory = 'public'
+ }
+ return memory
+ } else if (vist == 'server' || vist == 'useapi') {
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
+ var memory = obj[acct_id]['vis']
+ if (!memory) {
+ memory = 'public'
+ }
+ return memory
+ } else {
+ return vist
+ }
+ }
+}
+function loader() {
+ var acct_id = $('#post-acct-sel').val()
console.log(loadVis(acct_id))
- $("#vis-sel").val(loadVis(acct_id));
+ $('#vis-sel').val(loadVis(acct_id))
}
loader()
-$("textarea").height(15); //init
-$("textarea").css("lineHeight", "1rem"); //init
+$('textarea').height(15) //init
+$('textarea').css('lineHeight', '1rem') //init
-$("textarea").on("input", function(evt) {
+$('textarea').on('input', function(evt) {
if (evt.target.scrollHeight > evt.target.offsetHeight) {
- $(evt.target).height(evt.target.scrollHeight);
+ $(evt.target).height(evt.target.scrollHeight)
} else {
var lineHeight = Number(
$(evt.target)
- .css("lineHeight")
- .split("px")[0]
- );
+ .css('lineHeight')
+ .split('px')[0]
+ )
while (true) {
- $(evt.target).height($(evt.target).height() - lineHeight);
+ $(evt.target).height($(evt.target).height() - lineHeight)
if (evt.target.scrollHeight > evt.target.offsetHeight) {
- $(evt.target).height(evt.target.scrollHeight);
- break;
+ $(evt.target).height(evt.target.scrollHeight)
+ break
}
}
}
-});
\ No newline at end of file
+})
diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js
index 555b51c0..0dbacfbc 100644
--- a/app/js/platform/preload.js
+++ b/app/js/platform/preload.js
@@ -1,194 +1,194 @@
-var electron = require("electron");
-const shell = electron.shell;
-var ipc = electron.ipcRenderer;
+var electron = require('electron')
+const shell = electron.shell
+var ipc = electron.ipcRenderer
onmessage = function(e) {
- if (e.data[0] == "openUrl") {
- urls = e.data[1].match(/https?:\/\/(.+)/);
+ if (e.data[0] == 'openUrl') {
+ urls = e.data[1].match(/https?:\/\/(.+)/)
if (urls) {
- shell.openExternal(e.data[1]);
+ shell.openExternal(e.data[1])
}
- } else if (e.data[0] == "sendSinmpleIpc") {
- ipc.send(e.data[1], "");
- } else if (e.data[0] == "dialogStore") {
- ipc.send("dialogStore", e.data[1]);
- } else if (e.data[0] == "bmpImage") {
- ipc.send("bmp-image", e.data[1]);
- } else if (e.data[0] == "dialogCW") {
- ipc.send("dialogCW", e.data[1]);
- } else if (e.data[0] == "nativeNotf") {
- console.log(e.data[1]);
- ipc.send("native-notf", e.data[1]);
- } else if (e.data[0] == "dialogClient") {
- ipc.send("dialogClient", e.data[1]);
- } else if (e.data[0] == "generalDL") {
- ipc.send("general-dl", e.data[1]);
- } else if (e.data[0] == "openFinder") {
- ipc.send("open-finder", e.data[1]);
- } else if (e.data[0] == "columnDel") {
- ipc.send("column-del", e.data[1]);
- } else if (e.data[0] == "lang") {
- ipc.send("lang", e.data[1]);
- } else if (e.data[0] == "exportSettings") {
- ipc.send("exportSettings", e.data[1]);
- } else if (e.data[0] == "exportSettingsCoreComplete") {
- ipc.send("export", e.data[1]);
- } else if (e.data[0] == "importSettings") {
- ipc.send("importSettings", e.data[1]);
- } else if (e.data[0] == "customSound") {
- ipc.send("customSound", e.data[1]);
- } else if (e.data[0] == "themeJsonDelete") {
- ipc.send("theme-json-delete", e.data[1]);
- } else if (e.data[0] == "themeJsonCreate") {
- ipc.send("theme-json-create", e.data[1]);
- } else if (e.data[0] == "themeJsonRequest") {
- ipc.send("theme-json-request", e.data[1]);
- } else if (e.data[0] == "ha") {
- ipc.send("ha", e.data[1]);
- } else if (e.data[0] == "ua") {
- ipc.send("ua", e.data[1]);
- } else if (e.data[0] == "aboutData") {
- ipc.send("aboutData", "");
- } else if (e.data[0] == "itunes") {
- console.log("NowPlaying");
- ipc.send("itunes", e.data[1]);
- } else if (e.data[0] == "themeCSSRequest") {
- ipc.send("theme-css-request", e.data[1]);
- } else if (e.data[0] == "customCSSRequest") {
- ipc.send("custom-css-request", e.data[1]);
- } else if (e.data[0] == "downloadButton") {
- ipc.send("download-btn", e.data[1]);
- } else if (e.data[0] == "nano") {
- ipc.send("nano", null);
- } else if (e.data[0] == "asReadComp") {
- ipc.send("sendMarkersComplete", null);
- } else if (e.data[0] == "copy") {
- ipc.send("copy", e.data[1]);
- } else if (e.data[0] == "log") {
- ipc.send("log", e.data[1]);
+ } else if (e.data[0] == 'sendSinmpleIpc') {
+ ipc.send(e.data[1], '')
+ } else if (e.data[0] == 'dialogStore') {
+ ipc.send('dialogStore', e.data[1])
+ } else if (e.data[0] == 'bmpImage') {
+ ipc.send('bmp-image', e.data[1])
+ } else if (e.data[0] == 'dialogCW') {
+ ipc.send('dialogCW', e.data[1])
+ } else if (e.data[0] == 'nativeNotf') {
+ console.log(e.data[1])
+ ipc.send('native-notf', e.data[1])
+ } else if (e.data[0] == 'dialogClient') {
+ ipc.send('dialogClient', e.data[1])
+ } else if (e.data[0] == 'generalDL') {
+ ipc.send('general-dl', e.data[1])
+ } else if (e.data[0] == 'openFinder') {
+ ipc.send('open-finder', e.data[1])
+ } else if (e.data[0] == 'columnDel') {
+ ipc.send('column-del', e.data[1])
+ } else if (e.data[0] == 'lang') {
+ ipc.send('lang', e.data[1])
+ } else if (e.data[0] == 'exportSettings') {
+ ipc.send('exportSettings', e.data[1])
+ } else if (e.data[0] == 'exportSettingsCoreComplete') {
+ ipc.send('export', e.data[1])
+ } else if (e.data[0] == 'importSettings') {
+ ipc.send('importSettings', e.data[1])
+ } else if (e.data[0] == 'customSound') {
+ ipc.send('customSound', e.data[1])
+ } else if (e.data[0] == 'themeJsonDelete') {
+ ipc.send('theme-json-delete', e.data[1])
+ } else if (e.data[0] == 'themeJsonCreate') {
+ ipc.send('theme-json-create', e.data[1])
+ } else if (e.data[0] == 'themeJsonRequest') {
+ ipc.send('theme-json-request', e.data[1])
+ } else if (e.data[0] == 'ha') {
+ ipc.send('ha', e.data[1])
+ } else if (e.data[0] == 'ua') {
+ ipc.send('ua', e.data[1])
+ } else if (e.data[0] == 'aboutData') {
+ ipc.send('aboutData', '')
+ } else if (e.data[0] == 'itunes') {
+ console.log('NowPlaying')
+ ipc.send('itunes', e.data[1])
+ } else if (e.data[0] == 'themeCSSRequest') {
+ ipc.send('theme-css-request', e.data[1])
+ } else if (e.data[0] == 'customCSSRequest') {
+ ipc.send('custom-css-request', e.data[1])
+ } else if (e.data[0] == 'downloadButton') {
+ ipc.send('download-btn', e.data[1])
+ } else if (e.data[0] == 'nano') {
+ ipc.send('nano', null)
+ } else if (e.data[0] == 'asReadComp') {
+ ipc.send('sendMarkersComplete', null)
+ } else if (e.data[0] == 'copy') {
+ ipc.send('copy', e.data[1])
+ } else if (e.data[0] == 'log') {
+ ipc.send('log', e.data[1])
}
-};
+}
//version.js
-ipc.send("getPlatform", "");
-ipc.on("platform", function(event, args) {
- localStorage.setItem("platform", args[0]);
- localStorage.setItem("bit", args[1]);
- localStorage.setItem("about", JSON.stringify([args[2], args[3], args[4], args[5]]));
-});
+ipc.send('getPlatform', '')
+ipc.on('platform', function(event, args) {
+ localStorage.setItem('platform', args[0])
+ localStorage.setItem('bit', args[1])
+ localStorage.setItem('about', JSON.stringify([args[2], args[3], args[4], args[5]]))
+})
-ipc.on("reload", function(event, arg) {
- location.reload();
-});
+ipc.on('reload', function(event, arg) {
+ location.reload()
+})
//Native Notf
-ipc.on("shownotf", function(event, args) {
- if (args["type"] == "toot") {
- postMessage(["details", [id, acct_id]], "*");
- } else if (args["type"] == "userdata") {
- postMessage(["udg", [user, acct_id]], "*");
+ipc.on('shownotf', function(event, args) {
+ if (args['type'] == 'toot') {
+ postMessage(['details', [id, acct_id]], '*')
+ } else if (args['type'] == 'userdata') {
+ postMessage(['udg', [user, acct_id]], '*')
}
-});
+})
//first.js
-ipc.on("custom-css-response", function(event, arg) {
- if (arg == "") {
- return false;
+ipc.on('custom-css-response', function(event, arg) {
+ if (arg == '') {
+ return false
}
- var styleNode = document.createElement("style");
- styleNode.setAttribute("type", "text/css");
+ var styleNode = document.createElement('style')
+ styleNode.setAttribute('type', 'text/css')
- var content = document.createTextNode(arg);
- styleNode.append(content);
- document.getElementsByTagName("head")[0].append(styleNode);
-});
-ipc.on("theme-css-response", function(event, arg) {
- if (arg == "") {
- return false;
+ var content = document.createTextNode(arg)
+ styleNode.append(content)
+ document.getElementsByTagName('head')[0].append(styleNode)
+})
+ipc.on('theme-css-response', function(event, arg) {
+ if (arg == '') {
+ return false
}
- var styleNode = document.createElement("style");
- styleNode.setAttribute("type", "text/css");
+ var styleNode = document.createElement('style')
+ styleNode.setAttribute('type', 'text/css')
- var content = document.createTextNode(arg);
- styleNode.append(content);
- document.getElementsByTagName("head")[0].append(styleNode);
-});
+ var content = document.createTextNode(arg)
+ styleNode.append(content)
+ document.getElementsByTagName('head')[0].append(styleNode)
+})
//img.js
-ipc.on("bmp-img-comp", function(event, b64) {
- postMessage(["media", [b64[0], "image/png", b64[1]]], "*");
-});
+ipc.on('bmp-img-comp', function(event, b64) {
+ postMessage(['media', [b64[0], 'image/png', b64[1]]], '*')
+})
//ui,img.js
-ipc.on("general-dl-prog", function(event, arg) {
- console.log("Progress: " + arg);
-});
-ipc.on("general-dl-message", function(event, arg) {
- var argC = arg.replace(/\\/g, "\\\\") + "\\\\.";
- console.log("saved");
- postMessage(["toastSaved", [arg, argC]], "*");
-});
+ipc.on('general-dl-prog', function(event, arg) {
+ console.log('Progress: ' + arg)
+})
+ipc.on('general-dl-message', function(event, arg) {
+ var argC = arg.replace(/\\/g, '\\\\') + '\\\\.'
+ console.log('saved')
+ postMessage(['toastSaved', [arg, argC]], '*')
+})
//setting.js
-ipc.on("langres", function(event, arg) {
- location.href = "../" + arg + "/setting.html";
-});
-ipc.on("exportSettingsFile", function(event, arg) {
- postMessage(["exportSettingsCore", arg], "*");
-});
-ipc.on("exportAllComplete", function(event, arg) {
- postMessage(["alert", "Complete"], "*");
-});
-ipc.on("config", function(event, arg) {
- postMessage(["importSettingsCore", arg], "*");
-});
-ipc.on("savefolder", function(event, arg) {
- localStorage.setItem("savefolder", arg);
-});
-ipc.on("font-list", function(event, arg) {
- postMessage(["fontList", arg], "*");
-});
-ipc.on("customSoundRender", function(event, args) {
- postMessage(["customSoundSave", [args[0], args[1]]], "*");
-});
-ipc.on("theme-json-list-response", function(event, args) {
- postMessage(["ctLoadCore", args], "*");
-});
-ipc.on("theme-json-delete-complete", function(event, args) {
- postMessage(["ctLoad", ""], "*");
-});
-ipc.on("theme-json-response", function(event, args) {
- postMessage(["customConnect", args], "*");
-});
-ipc.on("theme-json-create-complete", function(event, args) {
- postMessage(["clearCustomImport", ""], "*");
- postMessage(["ctLoad", ""], "*");
-});
+ipc.on('langres', function(event, arg) {
+ location.href = '../' + arg + '/setting.html'
+})
+ipc.on('exportSettingsFile', function(event, arg) {
+ postMessage(['exportSettingsCore', arg], '*')
+})
+ipc.on('exportAllComplete', function(event, arg) {
+ postMessage(['alert', 'Complete'], '*')
+})
+ipc.on('config', function(event, arg) {
+ postMessage(['importSettingsCore', arg], '*')
+})
+ipc.on('savefolder', function(event, arg) {
+ localStorage.setItem('savefolder', arg)
+})
+ipc.on('font-list', function(event, arg) {
+ postMessage(['fontList', arg], '*')
+})
+ipc.on('customSoundRender', function(event, args) {
+ postMessage(['customSoundSave', [args[0], args[1]]], '*')
+})
+ipc.on('theme-json-list-response', function(event, args) {
+ postMessage(['ctLoadCore', args], '*')
+})
+ipc.on('theme-json-delete-complete', function(event, args) {
+ postMessage(['ctLoad', ''], '*')
+})
+ipc.on('theme-json-response', function(event, args) {
+ postMessage(['customConnect', args], '*')
+})
+ipc.on('theme-json-create-complete', function(event, args) {
+ postMessage(['clearCustomImport', ''], '*')
+ postMessage(['ctLoad', ''], '*')
+})
//spotify.js
-ipc.on("itunes-np", function(event, arg) {
- postMessage(["npCore", arg], "*");
-});
+ipc.on('itunes-np', function(event, arg) {
+ postMessage(['npCore', arg], '*')
+})
//tips.js
-ipc.on("memory", function(event, arg) {
- var use = arg[0];
- var cpu = arg[1];
- var total = arg[2];
- postMessage(["renderMem", [use, cpu, total]], "*");
-});
+ipc.on('memory', function(event, arg) {
+ var use = arg[0]
+ var cpu = arg[1]
+ var total = arg[2]
+ postMessage(['renderMem', [use, cpu, total]], '*')
+})
//log
-ipc.on("logData", function(event, args) {
- postMessage(["logData", args], "*");
-});
+ipc.on('logData', function(event, args) {
+ postMessage(['logData', args], '*')
+})
//update.html
-ipc.on("prog", function(event, arg) {
- postMessage(["updateProg", arg], "*");
-});
-ipc.on("mess", function(event, arg) {
- postMessage(["updateMess", arg], "*");
-});
-ipc.on("asRead", function(event, arg) {
- postMessage(["asRead", ""], "*");
-});
-ipc.on("asReadEnd", function(event, arg) {
- postMessage(["asReadEnd", ""], "*");
-});
-var webviewDom = document.getElementById("webview");
+ipc.on('prog', function(event, arg) {
+ postMessage(['updateProg', arg], '*')
+})
+ipc.on('mess', function(event, arg) {
+ postMessage(['updateMess', arg], '*')
+})
+ipc.on('asRead', function(event, arg) {
+ postMessage(['asRead', ''], '*')
+})
+ipc.on('asReadEnd', function(event, arg) {
+ postMessage(['asReadEnd', ''], '*')
+})
+var webviewDom = document.getElementById('webview')
if (webviewDom) {
- webviewDom.addEventListener("new-window", function(e) {
- shell.openExternal(e.url);
- });
+ webviewDom.addEventListener('new-window', function(e) {
+ shell.openExternal(e.url)
+ })
}
diff --git a/app/js/platform/punycode.js b/app/js/platform/punycode.js
index 2c87f6cc..ab963d54 100644
--- a/app/js/platform/punycode.js
+++ b/app/js/platform/punycode.js
@@ -1,18 +1,15 @@
/*! https://mths.be/punycode v1.4.1 by @mathias */
;(function(root) {
-
/** Detect free variables */
- var freeExports = typeof exports == 'object' && exports &&
- !exports.nodeType && exports;
- var freeModule = typeof module == 'object' && module &&
- !module.nodeType && module;
- var freeGlobal = typeof global == 'object' && global;
+ var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports
+ var freeModule = typeof module == 'object' && module && !module.nodeType && module
+ var freeGlobal = typeof global == 'object' && global
if (
freeGlobal.global === freeGlobal ||
freeGlobal.window === freeGlobal ||
freeGlobal.self === freeGlobal
) {
- root = freeGlobal;
+ root = freeGlobal
}
/**
@@ -21,39 +18,33 @@
* @type Object
*/
var punycode,
-
- /** Highest positive signed 32-bit float value */
- maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
-
- /** Bootstring parameters */
- base = 36,
- tMin = 1,
- tMax = 26,
- skew = 38,
- damp = 700,
- initialBias = 72,
- initialN = 128, // 0x80
- delimiter = '-', // '\x2D'
-
- /** Regular expressions */
- regexPunycode = /^xn--/,
- regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
- regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
-
- /** Error messages */
- errors = {
- 'overflow': 'Overflow: input needs wider integers to process',
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
- 'invalid-input': 'Invalid input'
- },
-
- /** Convenience shortcuts */
- baseMinusTMin = base - tMin,
- floor = Math.floor,
- stringFromCharCode = String.fromCharCode,
-
- /** Temporary variable */
- key;
+ /** Highest positive signed 32-bit float value */
+ maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
+ /** Bootstring parameters */
+ base = 36,
+ tMin = 1,
+ tMax = 26,
+ skew = 38,
+ damp = 700,
+ initialBias = 72,
+ initialN = 128, // 0x80
+ delimiter = '-', // '\x2D'
+ /** Regular expressions */
+ regexPunycode = /^xn--/,
+ regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
+ regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
+ /** Error messages */
+ errors = {
+ overflow: 'Overflow: input needs wider integers to process',
+ 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
+ 'invalid-input': 'Invalid input'
+ },
+ /** Convenience shortcuts */
+ baseMinusTMin = base - tMin,
+ floor = Math.floor,
+ stringFromCharCode = String.fromCharCode,
+ /** Temporary variable */
+ key
/*--------------------------------------------------------------------------*/
@@ -64,7 +55,7 @@
* @returns {Error} Throws a `RangeError` with the applicable error message.
*/
function error(type) {
- throw new RangeError(errors[type]);
+ throw new RangeError(errors[type])
}
/**
@@ -76,12 +67,12 @@
* @returns {Array} A new array of values returned by the callback function.
*/
function map(array, fn) {
- var length = array.length;
- var result = [];
+ var length = array.length
+ var result = []
while (length--) {
- result[length] = fn(array[length]);
+ result[length] = fn(array[length])
}
- return result;
+ return result
}
/**
@@ -95,19 +86,19 @@
* function.
*/
function mapDomain(string, fn) {
- var parts = string.split('@');
- var result = '';
+ var parts = string.split('@')
+ var result = ''
if (parts.length > 1) {
// In email addresses, only the domain name should be punycoded. Leave
// the local part (i.e. everything up to `@`) intact.
- result = parts[0] + '@';
- string = parts[1];
+ result = parts[0] + '@'
+ string = parts[1]
}
// Avoid `split(regex)` for IE8 compatibility. See #17.
- string = string.replace(regexSeparators, '\x2E');
- var labels = string.split('.');
- var encoded = map(labels, fn).join('.');
- return result + encoded;
+ string = string.replace(regexSeparators, '\x2E')
+ var labels = string.split('.')
+ var encoded = map(labels, fn).join('.')
+ return result + encoded
}
/**
@@ -125,28 +116,29 @@
*/
function ucs2decode(string) {
var output = [],
- counter = 0,
- length = string.length,
- value,
- extra;
+ counter = 0,
+ length = string.length,
+ value,
+ extra
while (counter < length) {
- value = string.charCodeAt(counter++);
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
+ value = string.charCodeAt(counter++)
+ if (value >= 0xd800 && value <= 0xdbff && counter < length) {
// high surrogate, and there is a next character
- extra = string.charCodeAt(counter++);
- if ((extra & 0xFC00) == 0xDC00) { // low surrogate
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
+ extra = string.charCodeAt(counter++)
+ if ((extra & 0xfc00) == 0xdc00) {
+ // low surrogate
+ output.push(((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000)
} else {
// unmatched surrogate; only append this code unit, in case the next
// code unit is the high surrogate of a surrogate pair
- output.push(value);
- counter--;
+ output.push(value)
+ counter--
}
} else {
- output.push(value);
+ output.push(value)
}
}
- return output;
+ return output
}
/**
@@ -159,15 +151,15 @@
*/
function ucs2encode(array) {
return map(array, function(value) {
- var output = '';
- if (value > 0xFFFF) {
- value -= 0x10000;
- output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
- value = 0xDC00 | value & 0x3FF;
+ var output = ''
+ if (value > 0xffff) {
+ value -= 0x10000
+ output += stringFromCharCode(((value >>> 10) & 0x3ff) | 0xd800)
+ value = 0xdc00 | (value & 0x3ff)
}
- output += stringFromCharCode(value);
- return output;
- }).join('');
+ output += stringFromCharCode(value)
+ return output
+ }).join('')
}
/**
@@ -181,15 +173,15 @@
*/
function basicToDigit(codePoint) {
if (codePoint - 48 < 10) {
- return codePoint - 22;
+ return codePoint - 22
}
if (codePoint - 65 < 26) {
- return codePoint - 65;
+ return codePoint - 65
}
if (codePoint - 97 < 26) {
- return codePoint - 97;
+ return codePoint - 97
}
- return base;
+ return base
}
/**
@@ -206,7 +198,7 @@
function digitToBasic(digit, flag) {
// 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
+ return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5)
}
/**
@@ -215,13 +207,13 @@
* @private
*/
function adapt(delta, numPoints, firstTime) {
- var k = 0;
- delta = firstTime ? floor(delta / damp) : delta >> 1;
- delta += floor(delta / numPoints);
- for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
- delta = floor(delta / baseMinusTMin);
+ var k = 0
+ delta = firstTime ? floor(delta / damp) : delta >> 1
+ delta += floor(delta / numPoints)
+ for (; /* no initialization */ delta > (baseMinusTMin * tMax) >> 1; k += base) {
+ delta = floor(delta / baseMinusTMin)
}
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
+ return floor(k + ((baseMinusTMin + 1) * delta) / (delta + skew))
}
/**
@@ -234,95 +226,91 @@
function decode(input) {
// Don't use UCS-2
var output = [],
- inputLength = input.length,
- out,
- i = 0,
- n = initialN,
- bias = initialBias,
- basic,
- j,
- index,
- oldi,
- w,
- k,
- digit,
- t,
- /** Cached calculation results */
- baseMinusT;
+ inputLength = input.length,
+ out,
+ i = 0,
+ n = initialN,
+ bias = initialBias,
+ basic,
+ j,
+ index,
+ oldi,
+ w,
+ k,
+ digit,
+ t,
+ /** Cached calculation results */
+ baseMinusT
// Handle the basic code points: let `basic` be the number of input code
// points before the last delimiter, or `0` if there is none, then copy
// the first basic code points to the output.
- basic = input.lastIndexOf(delimiter);
+ basic = input.lastIndexOf(delimiter)
if (basic < 0) {
- basic = 0;
+ basic = 0
}
for (j = 0; j < basic; ++j) {
// if it's not a basic code point
if (input.charCodeAt(j) >= 0x80) {
- error('not-basic');
+ error('not-basic')
}
- output.push(input.charCodeAt(j));
+ output.push(input.charCodeAt(j))
}
// Main decoding loop: start just after the last delimiter if any basic code
// points were copied; start at the beginning otherwise.
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
-
+ for (index = basic > 0 ? basic + 1 : 0; index < inputLength /* no final expression */; ) {
// `index` is the index of the next character to be consumed.
// Decode a generalized variable-length integer into `delta`,
// which gets added to `i`. The overflow checking is easier
// if we increase `i` as we go, then subtract off its starting
// value at the end to obtain `delta`.
- for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
-
+ for (oldi = i, w = 1, k = base /* no condition */; ; k += base) {
if (index >= inputLength) {
- error('invalid-input');
+ error('invalid-input')
}
- digit = basicToDigit(input.charCodeAt(index++));
+ digit = basicToDigit(input.charCodeAt(index++))
if (digit >= base || digit > floor((maxInt - i) / w)) {
- error('overflow');
+ error('overflow')
}
- i += digit * w;
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ i += digit * w
+ t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias
if (digit < t) {
- break;
+ break
}
- baseMinusT = base - t;
+ baseMinusT = base - t
if (w > floor(maxInt / baseMinusT)) {
- error('overflow');
+ error('overflow')
}
- w *= baseMinusT;
-
+ w *= baseMinusT
}
- out = output.length + 1;
- bias = adapt(i - oldi, out, oldi == 0);
+ out = output.length + 1
+ bias = adapt(i - oldi, out, oldi == 0)
// `i` was supposed to wrap around from `out` to `0`,
// incrementing `n` each time, so we'll fix that now:
if (floor(i / out) > maxInt - n) {
- error('overflow');
+ error('overflow')
}
- n += floor(i / out);
- i %= out;
+ n += floor(i / out)
+ i %= out
// Insert `n` at position `i` of the output
- output.splice(i++, 0, n);
-
+ output.splice(i++, 0, n)
}
- return ucs2encode(output);
+ return ucs2encode(output)
}
/**
@@ -334,109 +322,105 @@
*/
function encode(input) {
var n,
- delta,
- handledCPCount,
- basicLength,
- bias,
- j,
- m,
- q,
- k,
- t,
- currentValue,
- output = [],
- /** `inputLength` will hold the number of code points in `input`. */
- inputLength,
- /** Cached calculation results */
- handledCPCountPlusOne,
- baseMinusT,
- qMinusT;
+ delta,
+ handledCPCount,
+ basicLength,
+ bias,
+ j,
+ m,
+ q,
+ k,
+ t,
+ currentValue,
+ output = [],
+ /** `inputLength` will hold the number of code points in `input`. */
+ inputLength,
+ /** Cached calculation results */
+ handledCPCountPlusOne,
+ baseMinusT,
+ qMinusT
// Convert the input in UCS-2 to Unicode
- input = ucs2decode(input);
+ input = ucs2decode(input)
// Cache the length
- inputLength = input.length;
+ inputLength = input.length
// Initialize the state
- n = initialN;
- delta = 0;
- bias = initialBias;
+ n = initialN
+ delta = 0
+ bias = initialBias
// Handle the basic code points
for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
+ currentValue = input[j]
if (currentValue < 0x80) {
- output.push(stringFromCharCode(currentValue));
+ output.push(stringFromCharCode(currentValue))
}
}
- handledCPCount = basicLength = output.length;
+ handledCPCount = basicLength = output.length
// `handledCPCount` is the number of code points that have been handled;
// `basicLength` is the number of basic code points.
// Finish the basic string - if it is not empty - with a delimiter
if (basicLength) {
- output.push(delimiter);
+ output.push(delimiter)
}
// Main encoding loop:
while (handledCPCount < inputLength) {
-
// All non-basic code points < n have been handled already. Find the next
// larger one:
for (m = maxInt, j = 0; j < inputLength; ++j) {
- currentValue = input[j];
+ currentValue = input[j]
if (currentValue >= n && currentValue < m) {
- m = currentValue;
+ m = currentValue
}
}
// Increase `delta` enough to advance the decoder's state to ,
// but guard against overflow
- handledCPCountPlusOne = handledCPCount + 1;
+ handledCPCountPlusOne = handledCPCount + 1
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
- error('overflow');
+ error('overflow')
}
- delta += (m - n) * handledCPCountPlusOne;
- n = m;
+ delta += (m - n) * handledCPCountPlusOne
+ n = m
for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
+ currentValue = input[j]
if (currentValue < n && ++delta > maxInt) {
- error('overflow');
+ error('overflow')
}
if (currentValue == n) {
// Represent delta as a generalized variable-length integer
- for (q = delta, k = base; /* no condition */; k += base) {
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
+ for (q = delta, k = base /* no condition */; ; k += base) {
+ t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias
if (q < t) {
- break;
+ break
}
- qMinusT = q - t;
- baseMinusT = base - t;
- output.push(
- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
- );
- q = floor(qMinusT / baseMinusT);
+ qMinusT = q - t
+ baseMinusT = base - t
+ output.push(stringFromCharCode(digitToBasic(t + (qMinusT % baseMinusT), 0)))
+ q = floor(qMinusT / baseMinusT)
}
- output.push(stringFromCharCode(digitToBasic(q, 0)));
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
- delta = 0;
- ++handledCPCount;
+ output.push(stringFromCharCode(digitToBasic(q, 0)))
+ bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength)
+ delta = 0
+ ++handledCPCount
}
}
- ++delta;
- ++n;
-
+ ++delta
+ ++n
}
- return output.join('');
+ return output.join('')
}
/**
@@ -452,10 +436,8 @@
*/
function toUnicode(input) {
return mapDomain(input, function(string) {
- return regexPunycode.test(string)
- ? decode(string.slice(4).toLowerCase())
- : string;
- });
+ return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string
+ })
}
/**
@@ -471,10 +453,8 @@
*/
function toASCII(input) {
return mapDomain(input, function(string) {
- return regexNonASCII.test(string)
- ? 'xn--' + encode(string)
- : string;
- });
+ return regexNonASCII.test(string) ? 'xn--' + encode(string) : string
+ })
}
/*--------------------------------------------------------------------------*/
@@ -486,7 +466,7 @@
* @memberOf punycode
* @type String
*/
- 'version': '1.4.1',
+ version: '1.4.1',
/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
@@ -494,40 +474,35 @@
* @memberOf punycode
* @type Object
*/
- 'ucs2': {
- 'decode': ucs2decode,
- 'encode': ucs2encode
+ ucs2: {
+ decode: ucs2decode,
+ encode: ucs2encode
},
- 'decode': decode,
- 'encode': encode,
- 'toASCII': toASCII,
- 'toUnicode': toUnicode
- };
+ decode: decode,
+ encode: encode,
+ toASCII: toASCII,
+ toUnicode: toUnicode
+ }
/** Expose `punycode` */
// Some AMD build optimizers, like r.js, check for specific condition patterns
// like the following:
- if (
- typeof define == 'function' &&
- typeof define.amd == 'object' &&
- define.amd
- ) {
+ if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
define('punycode', function() {
- return punycode;
- });
+ return punycode
+ })
} else if (freeExports && freeModule) {
if (module.exports == freeExports) {
// in Node.js, io.js, or RingoJS v0.8.0+
- freeModule.exports = punycode;
+ freeModule.exports = punycode
} else {
// in Narwhal or RingoJS v0.7.0-
for (key in punycode) {
- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
+ punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key])
}
}
} else {
// in Rhino or a web browser
- root.punycode = punycode;
+ root.punycode = punycode
}
-
-}(this));
+})(this)
diff --git a/app/js/platform/twitter.js b/app/js/platform/twitter.js
index 51c377e6..710f9cee 100644
--- a/app/js/platform/twitter.js
+++ b/app/js/platform/twitter.js
@@ -1,319 +1,531 @@
-"use strict";
-var _createClass = function () {
- function a(e, f) {
- for (var h, g = 0; g < f.length; g++) h = f[g], h.enumerable = h.enumerable || !1, h.configurable = !0, "value" in h && (h.writable = !0), Object.defineProperty(e, h.key, h)
- }
- return function (e, f, g) {
- return f && a(e.prototype, f), g && a(e, g), e
- }
-}();
+'use strict'
+var _createClass = (function() {
+ function a(e, f) {
+ for (var h, g = 0; g < f.length; g++)
+ (h = f[g]),
+ (h.enumerable = h.enumerable || !1),
+ (h.configurable = !0),
+ 'value' in h && (h.writable = !0),
+ Object.defineProperty(e, h.key, h)
+ }
+ return function(e, f, g) {
+ return f && a(e.prototype, f), g && a(e, g), e
+ }
+})()
function _classCallCheck(a, e) {
- if (!(a instanceof e)) throw new TypeError("Cannot call a class as a function")
+ if (!(a instanceof e)) throw new TypeError('Cannot call a class as a function')
}
-var TJScrollTask = function () {
- function a(e, f, g) {
- _classCallCheck(this, a), this.tjDeck = e, this.$t = e.$wrap, this.x = f, this.d = g, this.sl = e.wrapL, this.sTime = Date.now(), this.ended = !1, this._bindAnim = this._anim.bind(this);
- var h = e.getClms();
- 0 > f || f > h[0].offsetWidth * (h.length - 1) ? this.ended = !0 : requestAnimationFrame(this._bindAnim)
- }
- return _createClass(a, [{
- key: "stop",
- value: function stop() {
- this.ended || (this.ended = !0, cancelAnimationFrame(this._bindAnim))
- }
- }, {
- key: "_anim",
- value: function _anim() {
- if (!this.ended) {
- var e = (Date.now() - this.sTime) / this.d,
- f = this.sl,
- g = this.x - this.sl;
- 1 < e && !this.ended && (this.stop(), e = 1), this.tjDeck.scrollWrap(this._easeOut(e, f, g, 1)), 1 > e && requestAnimationFrame(this._bindAnim)
- }
- }
- }, {
- key: "_easeOut",
- value: function _easeOut(e, f, g, h) {
- return e /= h, --e, g * (e * e * e + 1) + f
- }
- }]), a
-}(),
- TJDeck = function () {
- function a() {
- _classCallCheck(this, a), this.version = "0.0.9", this.$wrap = document.querySelector(".js-app-columns"), this.wrapL = 0, this.scrollTask = null, this.options = this.getOptionObj(), this.setOptionFromObj(this.options), this.$options = this.createOptionPanel(), document.body.appendChild(this.$options), this.updateBlur(), this.updateLight()
- }
- return _createClass(a, [{
- key: "getOption",
- value: function getOption(e, f) {
- var g = localStorage.getItem("tj_deck_" + e);
- return g ? "true" == g : f
- }
- }, {
- key: "getOptionObj",
- value: function getOptionObj() {
- return {
- light: this.getOption("light", !0),
- light_clm: this.getOption("light_clm", !1),
- blur: this.getOption("blur", !1)
- }
- }
- }, {
- key: "setOption",
- value: function setOption(e, f) {
- localStorage.setItem("tj_deck_" + e, f)
- }
- }, {
- key: "setOptionFromObj",
- value: function setOptionFromObj(e) {
- for (var f = Object.keys(e), g = 0; g < f.length; g++) this.setOption(f[g], e[f[g]])
- }
- }, {
- key: "getClms",
- value: function getClms() {
- return this.$wrap.querySelectorAll("section.column")
- }
- }, {
- key: "back",
- value: function back() {
- if ("none" != this.$options.style.display) return this.updateOption(), void this.hideOptionPanel();
- var e = document.querySelector(".mdl-dismiss");
- if (e) return void e.click();
- if (this.isShownDrawer()) return void this.hideDrawer();
- var f = this.getClosestColumn(this.wrapL),
- g = f.querySelector(".js-column-back");
- if (g) return void g.click()
- }
- }, {
- key: "isShownItem",
- value: function isShownItem() {
- return !!document.querySelector(".mdl-dismiss") || this.isShownDrawer()
- }
- }, {
- key: "isShownDrawer",
- value: function isShownDrawer() {
- return !!document.querySelector(".hide-detail-view-inline")
- }
- }, {
- key: "hideDrawer",
- value: function hideDrawer() {
- var e = document.querySelector(".js-hide-drawer");
- e && e.click()
- }
- }, {
- key: "showDrawer",
- value: function showDrawer() {
- var e = document.querySelector(".js-show-drawer");
- e && e.click()
- }
- }, {
- key: "manageBack",
- value: function manageBack() {
- history.pushState(null, null, ""), window.addEventListener("popstate", function () {
- this.back(), history.pushState(null, null, "")
- }.bind(this))
- }
- }, {
- key: "observeModals",
- value: function observeModals() {
- for (var e = new MutationObserver(function (j) {
- for (var k, l, m = 0; m < j.length; m++) {
- k = j[m];
- for (var o = 0; o < k.addedNodes.length; o++) l = k.addedNodes[m], this.stopAnkerFromModal(l)
- }
- }.bind(this)), f = {
- attributes: !1,
- characterData: !0,
- childList: !0
- }, g = document.querySelectorAll(".js-modals-container, .js-modal"), h = 0; h < g.length; h++) e.observe(g[h], f)
- }
- }, {
- key: "stopAnkerFromModal",
- value: function stopAnkerFromModal(e) {
- for (var g, f = e.querySelectorAll("a"), h = function (k) {
- return k.preventDefault(), k.target.removeEventListener("click", h), !1
- }, j = 0; j < f.length; j++) g = f[j], g.href && g.href.match(/#$/) && g.addEventListener("click", h)
- }
- }, {
- key: "observeClms",
- value: function observeClms() {
- var e = new MutationObserver(function (g) {
- for (var h, j, k = 0; k < g.length; k++) j = g[k], j.addedNodes[0] && (h = j.addedNodes[0]), j.removedNodes[0] && (j.nextSibling instanceof Element ? h = j.nextSibling : j.previousSibling instanceof Element ? h = j.previousSibling : h = this.getClms()[0]);
- h && h instanceof Element && this.scrollWrapAnim(h.offsetLeft)
- }.bind(this));
- e.observe(this.$wrap, {
- attributes: !1,
- characterData: !1,
- childList: !0
- })
- }
- }, {
- key: "manageScroll",
- value: function manageScroll() {
- var e, g, h, f = Date.now(),
- j = null;
- document.querySelector(".js-app-columns-container").addEventListener("scroll", function (k) {
- //k.target.scrollLeft = 0
- }.bind(this)), document.querySelector(".js-app-columns").addEventListener("drag", function (k) {
- 1 < k.touches.length || this.isShownItem() || (e = this._getPosObj(k), g = e, j = -1, f = Date.now(), h = this.getClosestColumn(this.wrapL))
- }.bind(this)), window.addEventListener("touchmove", function (k) {
- if (j) {
- if (0 > j) {
- var l = this._getPosObj(k);
- if (Math.abs(l.x - e.x) < Math.abs(l.y - e.y)) return void (j = 0);
- j = 1
- }
- if (1 == j) {
- this.scrollTask && this.scrollTask.stop();
- var l = this._getPosObj(k);
- g = l, this.options.light_clm || this.scrollWrap(this.wrapL + g.x - l.x)
- }
- }
- }.bind(this)), window.addEventListener("touchend", function () {
- if (!(1 > j)) {
- j = null;
- var p, l = Date.now(),
- m = g,
- o = e.x - m.x;
- 0.5 <= Math.abs(o) / (l - f) ? 0 < o ? (p = h.nextElementSibling, this.hideMenu()) : (p = h.previousElementSibling, !p && this.showMenu()) : p = this.getClosestColumn(this.wrapL), p && p instanceof Element && this.scrollWrapAnim(p.offsetLeft)
- }
- }.bind(this))
- }
- }, {
- key: "scrollWrapAnim",
- value: function scrollWrapAnim(e) {
- this.scrollTask && this.scrollTask.stop(), this.scrollTask = new TJScrollTask(this, e, this.options.light_clm ? 0 : 500)
- }
- }, {
- key: "scrollWrap",
- value: function scrollWrap(e) {
- var f = this.getClms();
- 0 > e || e > f[0].offsetWidth * (f.length - 1) || !isFinite(e) || (this.$wrap.style.transform = "translateX(" + -e + "px)", this.wrapL = e)
- }
- }, {
- key: "getClosestColumn",
- value: function getClosestColumn(e) {
- for (var h, f = this.getClms(), g = 0; g < f.length; g++)
- if (h = Math.abs(e - f[g].offsetLeft), h <= f[g].offsetWidth / 2) return f[g];
- return f[f.length - 1]
- }
- }, {
- key: "_getPosObj",
- value: function _getPosObj(e) {
- return {
- x: e.touches[0].pageX,
- y: e.touches[0].pageY
- }
- }
- }, {
- key: "hideMenu",
- value: function hideMenu() {
- document.body.classList.add("tj_hide_menu")
- }
- }, {
- key: "showMenu",
- value: function showMenu() {
- document.body.classList.remove("tj_hide_menu")
- }
- }, {
- key: "showTJSetting",
- value: function showTJSetting() { }
- }, {
- key: "addTJNav",
- value: function addTJNav() {
- var e = document.createElement("nav");
- e.classList.add("tj_nav"), e.appendChild(this.createTweetBtn()), e.appendChild(this.createSettingBtn()), document.querySelector(".js-app-content").appendChild(e)
- }
- }, {
- key: "createTweetBtn",
- value: function createTweetBtn() {
- var e = document.createElement("button");
- return e.classList.add("tj_tweet_btn", "Button", "Button--primary", "tweet-button"), e.innerHTML = " ", e.addEventListener("click", this.showDrawer.bind(this)), e
- }
- }, {
- key: "createSettingBtn",
- value: function createSettingBtn() {
- var e = document.createElement("a");
- return e.classList.add("tj_setting_btn"), e.href = "javascript:void(0)", e.innerHTML = " ", e.addEventListener("click", this.showOptionPanel.bind(this)), e
- }
- }, {
- key: "createOptionPanel",
- value: function createOptionPanel() {
- var e = document.createElement("div");
- return e.classList.add("tj_options"), e.style.display = "none", e.innerHTML = "\nTJDeck 設定
\n(Customed by Cutls P: https://gist.github.com/cutls/ 8787a55d2c1c53274e68a427966046a6)
\n\t基本アニメーションをなくす: \n\t \n
\n\n\tカラム切り替えアニメーションをなくす: \n\t \n
\n\n\tカラムをぼかす(撮影用): \n\t \n
\n\n\t
Script Version: " + this.version + "
\n
\n\n", e.querySelector(".tj_ops_close").addEventListener("click", function () {
- this.updateOption(), this.hideOptionPanel()
- }.bind(this)), e
- }
- }, {
- key: "hideOptionPanel",
- value: function hideOptionPanel() {
- var e = this.$options;
- e.style.display = "none"
- }
- }, {
- key: "showOptionPanel",
- value: function showOptionPanel() {
- var e = this.$options;
- this.updateOptionPanel(e), e.style.display = ""
- }
- }, {
- key: "updateOptionPanel",
- value: function updateOptionPanel() {
- var e = this.$options;
- ["light", "light_clm", "blur"].forEach(function (f) {
- var g = e.querySelector("#tj_ops_" + f);
- g.checked = this.options[f]
- }.bind(this))
- }
- }, {
- key: "updateOption",
- value: function updateOption() {
- var e = this.$options;
- ["light", "light_clm", "blur"].forEach(function (f) {
- var g = e.querySelector("#tj_ops_" + f);
- this.options[f] = !!g && g.checked
- }.bind(this)), this.setOptionFromObj(this.options), this.updateBlur(), this.updateLight()
- }
- }, {
- key: "updateBlur",
- value: function updateBlur() {
- this.options.blur ? this.$wrap.classList.add("tj_blur") : this.$wrap.classList.remove("tj_blur")
- }
- }, {
- key: "updateLight",
- value: function updateLight() {
- this.options.light ? document.body.classList.add("tj_light") : document.body.classList.remove("tj_light")
- }
- }, {
- key: "manageStyle",
- value: function manageStyle() {
- this.addStyle();
- var e = window.innerWidth;
- window.addEventListener("resize", function () {
- if (e != window.innerWidth) {
- var f = document.querySelector("#tj_deck_css");
- f && f.remove(), this.addStyle(), this.scrollWrap(this.wrapL * (window.innerWidth / e)), e = window.innerWidth
- }
- }.bind(this))
- }
- }, {
- key: "refreshStyle",
- value: function refreshStyle() { }
- }, {
- key: "addStyle",
- value: function addStyle() {
- var e = document.querySelector("head"),
- f = document.createElement("style");
- f.type = "text/css", f.id = "tj_deck_css", f.innerHTML = "\nhtml {\n\t/*overscroll-behavior: none; プルダウンでリロードさせない */\n}\n\nbody.tj_light,\nbody.tj_light * {\n\ttransition-duration: 0ms!important;\n}\nbody.tj_light .inline-reply {\n\t/* 0にするとアニメーションイベントが発生せずに動作がおかしくなるので1ms */\n\ttransition-duration: 1ms!important;\n}\n\n.js-column-options {\n\tdisplay: none!important;\n}\n.is-options-open .js-column-options {\n\tdisplay: block!important;\n}\n\n/* TJDeck オプションパネル */\n.tj_options {\n\tposition: fixed;\n\twidth: 100%;\n\theight: 100%;\n\ttop: 0;\n\tleft: 0;\n\tpadding: 1em;\n\tbackground: #fff;\n\tcolor: #222;\n\tz-index: 300;\n}\n.tj_options .title {\n\tmargin-bottom: 1em;\n\tfont-size: 1.1em;\n\tfont-weight: bold;\n\ttext-align: center;\n}\n.tj_options > div {\n\tmargin: 1em 0;\n}\n.tj_options label,\n.tj_options input {\n\tdisplay: inline-block!important;\n\tmargin: 0!important;\n\tvertical-align: middle!important;\n}\n\n\n/* サイドメニューの表示切替 */\n.js-app-header {\n\tposition: fixed!important;\n}\n.tj_hide_menu .js-app-header {\n\ttransform: translateX(-50px);\n}\n\n/* メインの位置を左端に */\n.js-app-content {\n\tleft: 0!important;\n}\n\n\n/* サイドバーが出たらナビを隠す */\n.hide-detail-view-inline .tj_nav {\n\tdisplay: none;\n}\n\n.tj_tweet_btn {\n\tposition: fixed!important;\n\twidth: 60px!important;\n\theight: 60px!important;\n\tbottom: 1em!important;\n\tright: 1em!important;\n\tpadding: 0;\n\tbackground-color: #1da1f2;\n\tcolor: #fff;\n\tborder-radius: 36px;\n\tfont-size: 16px;\n\tline-height: 1em;\n\ttext-align: center;\n\tbox-shadow: 1px 1px 5px rgba(0, 0, 0, .5);\n\tz-index: 200;\n}\n.tj_tweet_btn .icon-compose,\n.tj_setting_btn .icon-settings {\n\tdisplay: inline-block;\n\tmargin-top: 0;\n\tfont-size: 20px!important;\n}\n.tj_setting_btn {\n\tposition: fixed;\n\twidth: 50px;\n\theight: 50px;\n\ttop: 0!important;\n\tright: 40px!important;\n\tbackground-color: transparent;\n\tcolor: #333;\n\ttext-align: center;\n\tbox-shadow: none;\n\tz-index: 200;\n}\n.tj_setting_btn > i.icon-settings {\n\tmargin-top: -2px;\n\tline-height: 50px;\n}\n\n.application {\n\tz-index: auto;\n}\n\n/* カラムの余白をなくす */\n.app-columns {\n\tpadding: 0!important;\n}\n\n\n/* カラムを幅いっぱいに表示 */\n.column {\n\twidth: " + document.body.clientWidth + "px!important;\n\theight: " + document.body.clientHeight + "px!important;\n\tmax-width: 600px!important;\n\tmargin: 0!important;\n}\n\n/* カラムの設定をabsoluteに */\n.js-column-options-container {\n\tposition: absolute!important;\n\twidth: 100%;\n}\n\n/* サイドパネルを表示したときにメインを動かなくする */\n.application > .app-content {\n\tmargin-right: 0!important;\n\ttransform: translateX(0px)!important;\n}\n\n/* メインエリアのスクロールを禁止 */\n#container {\n\toverflow: hidden!important;\n}\n\n/* サイドパネルを幅いっぱいに表示 */\n.js-drawer {\n\twidth: " + document.body.clientWidth + "px!important;\n\tmax-width: 600px!important;\n\t/*left: -" + document.body.clientWidth + "px!important;*/\n\tleft: 0!important;\n\ttransform: translateX(-" + document.body.clientWidth + "px);\n}\n.hide-detail-view-inline .js-drawer {/* 表示中 */\n\twidth: " + document.body.clientWidth + "px!important;\n\tmax-width: 600px!important;\n\t/*left: 0!important;*/\n\ttransform: translateX(0);\n\tz-index: 201!important;\n}\n.hide-detail-view-inline .js-drawer:after {\n\tdisplay: none!important;\n}\n\n/* サイドパネルのタイトルを消す */\n.js-docked-compose .compose-text-title {\n\tdisplay: none!important;\n}\n/* アカウント選択アイコン位置を上にずらす */\n.js-docked-compose .compose-accounts {\n\twidth: 200px!important;\n\tmargin-top: -50px;\n}\n\n/* ツイート入力エリアをすこし小さくする */\n.js-docked-compose .compose-text-container {\n\tpadding: 5px!important;\n}\n.js-docked-compose .js-compose-text {\n\theight: 90px!important;\n}\n\n/* ツイートボタンを大きく */\n.js-docked-compose .js-send-button {\n\twidth: 100px!important;\n\ttext-align: center;\n}\n\n/* 各種ボタンを小さくして横並びにする */\n.js-docked-compose .compose-content button.js-add-image-button,\n.js-docked-compose .compose-content .js-schedule-button,\n.js-docked-compose .compose-content .js-tweet-button,\n.js-docked-compose .compose-content .js-dm-button {\n\tdisplay: inline-block!important;\n\twidth: auto!important;\n}\n.js-docked-compose .compose-content .js-tweet-button.is-hidden,\n.js-docked-compose .compose-content .js-dm-button.is-hidden {\n\tdisplay: none!important;\n}\n.js-add-image-button > .label,\n.js-schedule-button > .label,\n.js-tweet-button > .label,\n.js-dm-button > .label {\n\tdisplay: none!important;\n}\n.js-add-image-button,\n.js-scheduler,\n.js-tweet-type-button {\n\tdisplay: inline-block;\n\ttransform: translateY(-65px);\n}\n\n\n/* サイドパネルのフッターを消す */\n.js-docked-compose > footer {\n\tdisplay: none!important;\n}\n.js-docked-compose .compose-content {\n\tbottom: 0!important;\n}\n\n/* サイドパネルのヘッダーを消す */\n.js-compose-header {\n\tposition: absolute!important;\n\tright: 20px!important;\n\tborder: 0!important;\n}\nheader.js-compose-header div.compose-title {\n\tdisplay: none!important;\n}\n.js-account-selector-grid-toggle {\n\tmargin-right: 50px!important;\n}\n\n/* モーダルの位置調整 */\n.overlay:before,\n.ovl-plain:before,\n.ovl:before {\n\tdisplay: none!important;\n}\n\n/* リツイートモーダルの幅設定 */\n#actions-modal > .mdl {\n\tmax-width: 100%!important;\n}\n\n/* モーダルのメディア表示調整 */\n.js-modal-panel .js-embeditem {/* 画面いっぱいに表示 */\n\theight: 100%!important;\n\ttop: 0!important;\n\tbottom: 0!important;\n}\n.js-modal-panel .js-embeditem iframe {\n\tmax-width: 100%!important;\n\tmax-height: 100%!important;\n}\n.js-modal-panel .js-med-tweet {/* ツイートを非表示 */\n\tdisplay: none!important;\n}\n\n/* 閉じるボタン */\n.js-modal-panel .mdl-dismiss {\n\tz-index: 2;\n}\n\n/* 画像表示を調整する */\n.js-modal-panel .js-embeditem {\n\tdisplay: flex!important;\n\tflex-direction: column;\n\tz-index: 1;\n}\n/* 画像表示部分 */\n.js-modal-panel .js-embeditem .l-table {\n\tposition: relative!important;\n\tdisplay: block!important;\n\theight: auto!important;\n\tflex: auto;\n}\n\n.js-modal-panel .js-embeditem .l-table div,\n.js-modal-panel .js-embeditem .l-table a {\n\tposition: static!important;\n}\n.js-modal-panel .js-embeditem .l-table .js-media-image-link {\n\tpointer-events: none;\n}\n\n/* 画像サイズ指定 */\n.js-modal-panel .js-embeditem .l-table img,\n.js-modal-panel .js-embeditem .l-table iframe {\n\tposition: absolute;\n\tmax-width: 100%!important;\n\tmax-height: 100%!important;\n\twidth: auto!important;\n\theight: auto!important;\n\ttop: 0!important;\n\tbottom: 0!important;\n\tleft: 0!important;\n\tright: 0!important;\n\tmargin: auto!important;\n}\n.js-modal-panel .js-embeditem .l-table iframe {\n\twidth: 100%!important;\n\theight: 100%!important;\n}\n\n/* 画像検索ボタンの位置調整 */\n.js-modal-panel .js-embeditem .l-table .reverse-image-search {\n\tposition: fixed!important;\n\tdisplay: block!important;\n\tleft: 10px!important;\n}\n\n/* 画像移動ボタンの表示位置を調整する */\n.js-modal-panel .js-embeditem .js-media-gallery-prev,\n.js-modal-panel .js-embeditem .js-media-gallery-next {\n\tposition: relative!important;\n\ttop: auto!important;\n\twidth: 50%!important;\n\theight: 60px!important;\n}\n.js-modal-panel .js-embeditem .js-media-gallery-next {\n\tmargin-top: -60px;\n\talign-self: flex-end;\n}\n\n/* 画像下部のリンクを非表示 */\n.med-origlink,\n.med-flaglink {\n\tdisplay: none!important;\n}\n\n\n/* デバッグ用モザイク */\n.tj_blur .js-stream-item-content {\n\tfilter: blur(5px);\n}\n.tj_blur section.column:nth-child(1) .js-stream-item-content {\n\tfilter: none;\n}\n", e.appendChild(f)
- }
- }]), a
- }();
-window.tj_deck = null;
+var TJScrollTask = (function() {
+ function a(e, f, g) {
+ _classCallCheck(this, a),
+ (this.tjDeck = e),
+ (this.$t = e.$wrap),
+ (this.x = f),
+ (this.d = g),
+ (this.sl = e.wrapL),
+ (this.sTime = Date.now()),
+ (this.ended = !1),
+ (this._bindAnim = this._anim.bind(this))
+ var h = e.getClms()
+ 0 > f || f > h[0].offsetWidth * (h.length - 1)
+ ? (this.ended = !0)
+ : requestAnimationFrame(this._bindAnim)
+ }
+ return (
+ _createClass(a, [
+ {
+ key: 'stop',
+ value: function stop() {
+ this.ended || ((this.ended = !0), cancelAnimationFrame(this._bindAnim))
+ }
+ },
+ {
+ key: '_anim',
+ value: function _anim() {
+ if (!this.ended) {
+ var e = (Date.now() - this.sTime) / this.d,
+ f = this.sl,
+ g = this.x - this.sl
+ 1 < e && !this.ended && (this.stop(), (e = 1)),
+ this.tjDeck.scrollWrap(this._easeOut(e, f, g, 1)),
+ 1 > e && requestAnimationFrame(this._bindAnim)
+ }
+ }
+ },
+ {
+ key: '_easeOut',
+ value: function _easeOut(e, f, g, h) {
+ return (e /= h), --e, g * (e * e * e + 1) + f
+ }
+ }
+ ]),
+ a
+ )
+ })(),
+ TJDeck = (function() {
+ function a() {
+ _classCallCheck(this, a),
+ (this.version = '0.0.9'),
+ (this.$wrap = document.querySelector('.js-app-columns')),
+ (this.wrapL = 0),
+ (this.scrollTask = null),
+ (this.options = this.getOptionObj()),
+ this.setOptionFromObj(this.options),
+ (this.$options = this.createOptionPanel()),
+ document.body.appendChild(this.$options),
+ this.updateBlur(),
+ this.updateLight()
+ }
+ return (
+ _createClass(a, [
+ {
+ key: 'getOption',
+ value: function getOption(e, f) {
+ var g = localStorage.getItem('tj_deck_' + e)
+ return g ? 'true' == g : f
+ }
+ },
+ {
+ key: 'getOptionObj',
+ value: function getOptionObj() {
+ return {
+ light: this.getOption('light', !0),
+ light_clm: this.getOption('light_clm', !1),
+ blur: this.getOption('blur', !1)
+ }
+ }
+ },
+ {
+ key: 'setOption',
+ value: function setOption(e, f) {
+ localStorage.setItem('tj_deck_' + e, f)
+ }
+ },
+ {
+ key: 'setOptionFromObj',
+ value: function setOptionFromObj(e) {
+ for (var f = Object.keys(e), g = 0; g < f.length; g++) this.setOption(f[g], e[f[g]])
+ }
+ },
+ {
+ key: 'getClms',
+ value: function getClms() {
+ return this.$wrap.querySelectorAll('section.column')
+ }
+ },
+ {
+ key: 'back',
+ value: function back() {
+ if ('none' != this.$options.style.display)
+ return this.updateOption(), void this.hideOptionPanel()
+ var e = document.querySelector('.mdl-dismiss')
+ if (e) return void e.click()
+ if (this.isShownDrawer()) return void this.hideDrawer()
+ var f = this.getClosestColumn(this.wrapL),
+ g = f.querySelector('.js-column-back')
+ if (g) return void g.click()
+ }
+ },
+ {
+ key: 'isShownItem',
+ value: function isShownItem() {
+ return !!document.querySelector('.mdl-dismiss') || this.isShownDrawer()
+ }
+ },
+ {
+ key: 'isShownDrawer',
+ value: function isShownDrawer() {
+ return !!document.querySelector('.hide-detail-view-inline')
+ }
+ },
+ {
+ key: 'hideDrawer',
+ value: function hideDrawer() {
+ var e = document.querySelector('.js-hide-drawer')
+ e && e.click()
+ }
+ },
+ {
+ key: 'showDrawer',
+ value: function showDrawer() {
+ var e = document.querySelector('.js-show-drawer')
+ e && e.click()
+ }
+ },
+ {
+ key: 'manageBack',
+ value: function manageBack() {
+ history.pushState(null, null, ''),
+ window.addEventListener(
+ 'popstate',
+ function() {
+ this.back(), history.pushState(null, null, '')
+ }.bind(this)
+ )
+ }
+ },
+ {
+ key: 'observeModals',
+ value: function observeModals() {
+ for (
+ var e = new MutationObserver(
+ function(j) {
+ for (var k, l, m = 0; m < j.length; m++) {
+ k = j[m]
+ for (var o = 0; o < k.addedNodes.length; o++)
+ (l = k.addedNodes[m]), this.stopAnkerFromModal(l)
+ }
+ }.bind(this)
+ ),
+ f = {
+ attributes: !1,
+ characterData: !0,
+ childList: !0
+ },
+ g = document.querySelectorAll('.js-modals-container, .js-modal'),
+ h = 0;
+ h < g.length;
+ h++
+ )
+ e.observe(g[h], f)
+ }
+ },
+ {
+ key: 'stopAnkerFromModal',
+ value: function stopAnkerFromModal(e) {
+ for (
+ var g,
+ f = e.querySelectorAll('a'),
+ h = function(k) {
+ return k.preventDefault(), k.target.removeEventListener('click', h), !1
+ },
+ j = 0;
+ j < f.length;
+ j++
+ )
+ (g = f[j]), g.href && g.href.match(/#$/) && g.addEventListener('click', h)
+ }
+ },
+ {
+ key: 'observeClms',
+ value: function observeClms() {
+ var e = new MutationObserver(
+ function(g) {
+ for (var h, j, k = 0; k < g.length; k++)
+ (j = g[k]),
+ j.addedNodes[0] && (h = j.addedNodes[0]),
+ j.removedNodes[0] &&
+ (j.nextSibling instanceof Element
+ ? (h = j.nextSibling)
+ : j.previousSibling instanceof Element
+ ? (h = j.previousSibling)
+ : (h = this.getClms()[0]))
+ h && h instanceof Element && this.scrollWrapAnim(h.offsetLeft)
+ }.bind(this)
+ )
+ e.observe(this.$wrap, {
+ attributes: !1,
+ characterData: !1,
+ childList: !0
+ })
+ }
+ },
+ {
+ key: 'manageScroll',
+ value: function manageScroll() {
+ var e,
+ g,
+ h,
+ f = Date.now(),
+ j = null
+ document.querySelector('.js-app-columns-container').addEventListener(
+ 'scroll',
+ function(k) {
+ //k.target.scrollLeft = 0
+ }.bind(this)
+ ),
+ document.querySelector('.js-app-columns').addEventListener(
+ 'drag',
+ function(k) {
+ 1 < k.touches.length ||
+ this.isShownItem() ||
+ ((e = this._getPosObj(k)),
+ (g = e),
+ (j = -1),
+ (f = Date.now()),
+ (h = this.getClosestColumn(this.wrapL)))
+ }.bind(this)
+ ),
+ window.addEventListener(
+ 'touchmove',
+ function(k) {
+ if (j) {
+ if (0 > j) {
+ var l = this._getPosObj(k)
+ if (Math.abs(l.x - e.x) < Math.abs(l.y - e.y)) return void (j = 0)
+ j = 1
+ }
+ if (1 == j) {
+ this.scrollTask && this.scrollTask.stop()
+ var l = this._getPosObj(k)
+ ;(g = l), this.options.light_clm || this.scrollWrap(this.wrapL + g.x - l.x)
+ }
+ }
+ }.bind(this)
+ ),
+ window.addEventListener(
+ 'touchend',
+ function() {
+ if (!(1 > j)) {
+ j = null
+ var p,
+ l = Date.now(),
+ m = g,
+ o = e.x - m.x
+ 0.5 <= Math.abs(o) / (l - f)
+ ? 0 < o
+ ? ((p = h.nextElementSibling), this.hideMenu())
+ : ((p = h.previousElementSibling), !p && this.showMenu())
+ : (p = this.getClosestColumn(this.wrapL)),
+ p && p instanceof Element && this.scrollWrapAnim(p.offsetLeft)
+ }
+ }.bind(this)
+ )
+ }
+ },
+ {
+ key: 'scrollWrapAnim',
+ value: function scrollWrapAnim(e) {
+ this.scrollTask && this.scrollTask.stop(),
+ (this.scrollTask = new TJScrollTask(this, e, this.options.light_clm ? 0 : 500))
+ }
+ },
+ {
+ key: 'scrollWrap',
+ value: function scrollWrap(e) {
+ var f = this.getClms()
+ 0 > e ||
+ e > f[0].offsetWidth * (f.length - 1) ||
+ !isFinite(e) ||
+ ((this.$wrap.style.transform = 'translateX(' + -e + 'px)'), (this.wrapL = e))
+ }
+ },
+ {
+ key: 'getClosestColumn',
+ value: function getClosestColumn(e) {
+ for (var h, f = this.getClms(), g = 0; g < f.length; g++)
+ if (((h = Math.abs(e - f[g].offsetLeft)), h <= f[g].offsetWidth / 2)) return f[g]
+ return f[f.length - 1]
+ }
+ },
+ {
+ key: '_getPosObj',
+ value: function _getPosObj(e) {
+ return {
+ x: e.touches[0].pageX,
+ y: e.touches[0].pageY
+ }
+ }
+ },
+ {
+ key: 'hideMenu',
+ value: function hideMenu() {
+ document.body.classList.add('tj_hide_menu')
+ }
+ },
+ {
+ key: 'showMenu',
+ value: function showMenu() {
+ document.body.classList.remove('tj_hide_menu')
+ }
+ },
+ {
+ key: 'showTJSetting',
+ value: function showTJSetting() {}
+ },
+ {
+ key: 'addTJNav',
+ value: function addTJNav() {
+ var e = document.createElement('nav')
+ e.classList.add('tj_nav'),
+ e.appendChild(this.createTweetBtn()),
+ e.appendChild(this.createSettingBtn()),
+ document.querySelector('.js-app-content').appendChild(e)
+ }
+ },
+ {
+ key: 'createTweetBtn',
+ value: function createTweetBtn() {
+ var e = document.createElement('button')
+ return (
+ e.classList.add('tj_tweet_btn', 'Button', 'Button--primary', 'tweet-button'),
+ (e.innerHTML = ' '),
+ e.addEventListener('click', this.showDrawer.bind(this)),
+ e
+ )
+ }
+ },
+ {
+ key: 'createSettingBtn',
+ value: function createSettingBtn() {
+ var e = document.createElement('a')
+ return (
+ e.classList.add('tj_setting_btn'),
+ (e.href = 'javascript:void(0)'),
+ (e.innerHTML = ' '),
+ e.addEventListener('click', this.showOptionPanel.bind(this)),
+ e
+ )
+ }
+ },
+ {
+ key: 'createOptionPanel',
+ value: function createOptionPanel() {
+ var e = document.createElement('div')
+ return (
+ e.classList.add('tj_options'),
+ (e.style.display = 'none'),
+ (e.innerHTML =
+ '\nTJDeck 設定
\n(Customed by Cutls P: https://gist.github.com/cutls/ 8787a55d2c1c53274e68a427966046a6)
\n\t基本アニメーションをなくす: \n\t \n
\n\n\tカラム切り替えアニメーションをなくす: \n\t \n
\n\n\tカラムをぼかす(撮影用): \n\t \n
\n\n\t
Script Version: ' +
+ this.version +
+ '
\n
\n\n'),
+ e.querySelector('.tj_ops_close').addEventListener(
+ 'click',
+ function() {
+ this.updateOption(), this.hideOptionPanel()
+ }.bind(this)
+ ),
+ e
+ )
+ }
+ },
+ {
+ key: 'hideOptionPanel',
+ value: function hideOptionPanel() {
+ var e = this.$options
+ e.style.display = 'none'
+ }
+ },
+ {
+ key: 'showOptionPanel',
+ value: function showOptionPanel() {
+ var e = this.$options
+ this.updateOptionPanel(e), (e.style.display = '')
+ }
+ },
+ {
+ key: 'updateOptionPanel',
+ value: function updateOptionPanel() {
+ var e = this.$options
+ ;['light', 'light_clm', 'blur'].forEach(
+ function(f) {
+ var g = e.querySelector('#tj_ops_' + f)
+ g.checked = this.options[f]
+ }.bind(this)
+ )
+ }
+ },
+ {
+ key: 'updateOption',
+ value: function updateOption() {
+ var e = this.$options
+ ;['light', 'light_clm', 'blur'].forEach(
+ function(f) {
+ var g = e.querySelector('#tj_ops_' + f)
+ this.options[f] = !!g && g.checked
+ }.bind(this)
+ ),
+ this.setOptionFromObj(this.options),
+ this.updateBlur(),
+ this.updateLight()
+ }
+ },
+ {
+ key: 'updateBlur',
+ value: function updateBlur() {
+ this.options.blur
+ ? this.$wrap.classList.add('tj_blur')
+ : this.$wrap.classList.remove('tj_blur')
+ }
+ },
+ {
+ key: 'updateLight',
+ value: function updateLight() {
+ this.options.light
+ ? document.body.classList.add('tj_light')
+ : document.body.classList.remove('tj_light')
+ }
+ },
+ {
+ key: 'manageStyle',
+ value: function manageStyle() {
+ this.addStyle()
+ var e = window.innerWidth
+ window.addEventListener(
+ 'resize',
+ function() {
+ if (e != window.innerWidth) {
+ var f = document.querySelector('#tj_deck_css')
+ f && f.remove(),
+ this.addStyle(),
+ this.scrollWrap(this.wrapL * (window.innerWidth / e)),
+ (e = window.innerWidth)
+ }
+ }.bind(this)
+ )
+ }
+ },
+ {
+ key: 'refreshStyle',
+ value: function refreshStyle() {}
+ },
+ {
+ key: 'addStyle',
+ value: function addStyle() {
+ var e = document.querySelector('head'),
+ f = document.createElement('style')
+ ;(f.type = 'text/css'),
+ (f.id = 'tj_deck_css'),
+ (f.innerHTML =
+ '\nhtml {\n\t/*overscroll-behavior: none; プルダウンでリロードさせない */\n}\n\nbody.tj_light,\nbody.tj_light * {\n\ttransition-duration: 0ms!important;\n}\nbody.tj_light .inline-reply {\n\t/* 0にするとアニメーションイベントが発生せずに動作がおかしくなるので1ms */\n\ttransition-duration: 1ms!important;\n}\n\n.js-column-options {\n\tdisplay: none!important;\n}\n.is-options-open .js-column-options {\n\tdisplay: block!important;\n}\n\n/* TJDeck オプションパネル */\n.tj_options {\n\tposition: fixed;\n\twidth: 100%;\n\theight: 100%;\n\ttop: 0;\n\tleft: 0;\n\tpadding: 1em;\n\tbackground: #fff;\n\tcolor: #222;\n\tz-index: 300;\n}\n.tj_options .title {\n\tmargin-bottom: 1em;\n\tfont-size: 1.1em;\n\tfont-weight: bold;\n\ttext-align: center;\n}\n.tj_options > div {\n\tmargin: 1em 0;\n}\n.tj_options label,\n.tj_options input {\n\tdisplay: inline-block!important;\n\tmargin: 0!important;\n\tvertical-align: middle!important;\n}\n\n\n/* サイドメニューの表示切替 */\n.js-app-header {\n\tposition: fixed!important;\n}\n.tj_hide_menu .js-app-header {\n\ttransform: translateX(-50px);\n}\n\n/* メインの位置を左端に */\n.js-app-content {\n\tleft: 0!important;\n}\n\n\n/* サイドバーが出たらナビを隠す */\n.hide-detail-view-inline .tj_nav {\n\tdisplay: none;\n}\n\n.tj_tweet_btn {\n\tposition: fixed!important;\n\twidth: 60px!important;\n\theight: 60px!important;\n\tbottom: 1em!important;\n\tright: 1em!important;\n\tpadding: 0;\n\tbackground-color: #1da1f2;\n\tcolor: #fff;\n\tborder-radius: 36px;\n\tfont-size: 16px;\n\tline-height: 1em;\n\ttext-align: center;\n\tbox-shadow: 1px 1px 5px rgba(0, 0, 0, .5);\n\tz-index: 200;\n}\n.tj_tweet_btn .icon-compose,\n.tj_setting_btn .icon-settings {\n\tdisplay: inline-block;\n\tmargin-top: 0;\n\tfont-size: 20px!important;\n}\n.tj_setting_btn {\n\tposition: fixed;\n\twidth: 50px;\n\theight: 50px;\n\ttop: 0!important;\n\tright: 40px!important;\n\tbackground-color: transparent;\n\tcolor: #333;\n\ttext-align: center;\n\tbox-shadow: none;\n\tz-index: 200;\n}\n.tj_setting_btn > i.icon-settings {\n\tmargin-top: -2px;\n\tline-height: 50px;\n}\n\n.application {\n\tz-index: auto;\n}\n\n/* カラムの余白をなくす */\n.app-columns {\n\tpadding: 0!important;\n}\n\n\n/* カラムを幅いっぱいに表示 */\n.column {\n\twidth: ' +
+ document.body.clientWidth +
+ 'px!important;\n\theight: ' +
+ document.body.clientHeight +
+ 'px!important;\n\tmax-width: 600px!important;\n\tmargin: 0!important;\n}\n\n/* カラムの設定をabsoluteに */\n.js-column-options-container {\n\tposition: absolute!important;\n\twidth: 100%;\n}\n\n/* サイドパネルを表示したときにメインを動かなくする */\n.application > .app-content {\n\tmargin-right: 0!important;\n\ttransform: translateX(0px)!important;\n}\n\n/* メインエリアのスクロールを禁止 */\n#container {\n\toverflow: hidden!important;\n}\n\n/* サイドパネルを幅いっぱいに表示 */\n.js-drawer {\n\twidth: ' +
+ document.body.clientWidth +
+ 'px!important;\n\tmax-width: 600px!important;\n\t/*left: -' +
+ document.body.clientWidth +
+ 'px!important;*/\n\tleft: 0!important;\n\ttransform: translateX(-' +
+ document.body.clientWidth +
+ 'px);\n}\n.hide-detail-view-inline .js-drawer {/* 表示中 */\n\twidth: ' +
+ document.body.clientWidth +
+ 'px!important;\n\tmax-width: 600px!important;\n\t/*left: 0!important;*/\n\ttransform: translateX(0);\n\tz-index: 201!important;\n}\n.hide-detail-view-inline .js-drawer:after {\n\tdisplay: none!important;\n}\n\n/* サイドパネルのタイトルを消す */\n.js-docked-compose .compose-text-title {\n\tdisplay: none!important;\n}\n/* アカウント選択アイコン位置を上にずらす */\n.js-docked-compose .compose-accounts {\n\twidth: 200px!important;\n\tmargin-top: -50px;\n}\n\n/* ツイート入力エリアをすこし小さくする */\n.js-docked-compose .compose-text-container {\n\tpadding: 5px!important;\n}\n.js-docked-compose .js-compose-text {\n\theight: 90px!important;\n}\n\n/* ツイートボタンを大きく */\n.js-docked-compose .js-send-button {\n\twidth: 100px!important;\n\ttext-align: center;\n}\n\n/* 各種ボタンを小さくして横並びにする */\n.js-docked-compose .compose-content button.js-add-image-button,\n.js-docked-compose .compose-content .js-schedule-button,\n.js-docked-compose .compose-content .js-tweet-button,\n.js-docked-compose .compose-content .js-dm-button {\n\tdisplay: inline-block!important;\n\twidth: auto!important;\n}\n.js-docked-compose .compose-content .js-tweet-button.is-hidden,\n.js-docked-compose .compose-content .js-dm-button.is-hidden {\n\tdisplay: none!important;\n}\n.js-add-image-button > .label,\n.js-schedule-button > .label,\n.js-tweet-button > .label,\n.js-dm-button > .label {\n\tdisplay: none!important;\n}\n.js-add-image-button,\n.js-scheduler,\n.js-tweet-type-button {\n\tdisplay: inline-block;\n\ttransform: translateY(-65px);\n}\n\n\n/* サイドパネルのフッターを消す */\n.js-docked-compose > footer {\n\tdisplay: none!important;\n}\n.js-docked-compose .compose-content {\n\tbottom: 0!important;\n}\n\n/* サイドパネルのヘッダーを消す */\n.js-compose-header {\n\tposition: absolute!important;\n\tright: 20px!important;\n\tborder: 0!important;\n}\nheader.js-compose-header div.compose-title {\n\tdisplay: none!important;\n}\n.js-account-selector-grid-toggle {\n\tmargin-right: 50px!important;\n}\n\n/* モーダルの位置調整 */\n.overlay:before,\n.ovl-plain:before,\n.ovl:before {\n\tdisplay: none!important;\n}\n\n/* リツイートモーダルの幅設定 */\n#actions-modal > .mdl {\n\tmax-width: 100%!important;\n}\n\n/* モーダルのメディア表示調整 */\n.js-modal-panel .js-embeditem {/* 画面いっぱいに表示 */\n\theight: 100%!important;\n\ttop: 0!important;\n\tbottom: 0!important;\n}\n.js-modal-panel .js-embeditem iframe {\n\tmax-width: 100%!important;\n\tmax-height: 100%!important;\n}\n.js-modal-panel .js-med-tweet {/* ツイートを非表示 */\n\tdisplay: none!important;\n}\n\n/* 閉じるボタン */\n.js-modal-panel .mdl-dismiss {\n\tz-index: 2;\n}\n\n/* 画像表示を調整する */\n.js-modal-panel .js-embeditem {\n\tdisplay: flex!important;\n\tflex-direction: column;\n\tz-index: 1;\n}\n/* 画像表示部分 */\n.js-modal-panel .js-embeditem .l-table {\n\tposition: relative!important;\n\tdisplay: block!important;\n\theight: auto!important;\n\tflex: auto;\n}\n\n.js-modal-panel .js-embeditem .l-table div,\n.js-modal-panel .js-embeditem .l-table a {\n\tposition: static!important;\n}\n.js-modal-panel .js-embeditem .l-table .js-media-image-link {\n\tpointer-events: none;\n}\n\n/* 画像サイズ指定 */\n.js-modal-panel .js-embeditem .l-table img,\n.js-modal-panel .js-embeditem .l-table iframe {\n\tposition: absolute;\n\tmax-width: 100%!important;\n\tmax-height: 100%!important;\n\twidth: auto!important;\n\theight: auto!important;\n\ttop: 0!important;\n\tbottom: 0!important;\n\tleft: 0!important;\n\tright: 0!important;\n\tmargin: auto!important;\n}\n.js-modal-panel .js-embeditem .l-table iframe {\n\twidth: 100%!important;\n\theight: 100%!important;\n}\n\n/* 画像検索ボタンの位置調整 */\n.js-modal-panel .js-embeditem .l-table .reverse-image-search {\n\tposition: fixed!important;\n\tdisplay: block!important;\n\tleft: 10px!important;\n}\n\n/* 画像移動ボタンの表示位置を調整する */\n.js-modal-panel .js-embeditem .js-media-gallery-prev,\n.js-modal-panel .js-embeditem .js-media-gallery-next {\n\tposition: relative!important;\n\ttop: auto!important;\n\twidth: 50%!important;\n\theight: 60px!important;\n}\n.js-modal-panel .js-embeditem .js-media-gallery-next {\n\tmargin-top: -60px;\n\talign-self: flex-end;\n}\n\n/* 画像下部のリンクを非表示 */\n.med-origlink,\n.med-flaglink {\n\tdisplay: none!important;\n}\n\n\n/* デバッグ用モザイク */\n.tj_blur .js-stream-item-content {\n\tfilter: blur(5px);\n}\n.tj_blur section.column:nth-child(1) .js-stream-item-content {\n\tfilter: none;\n}\n'),
+ e.appendChild(f)
+ }
+ }
+ ]),
+ a
+ )
+ })()
+window.tj_deck = null
function tjDeckStart() {
- console.log("TJDeckスタート!!!"), window.tj_deck = new TJDeck, window.tj_deck.manageStyle(), window.tj_deck.manageScroll(), window.tj_deck.manageBack(), window.tj_deck.observeClms(), window.tj_deck.observeModals(), window.tj_deck.hideMenu(), window.tj_deck.addTJNav(), document.querySelector("textarea.js-compose-text").spellcheck = !1
+ console.log('TJDeckスタート!!!'),
+ (window.tj_deck = new TJDeck()),
+ window.tj_deck.manageStyle(),
+ window.tj_deck.manageScroll(),
+ window.tj_deck.manageBack(),
+ window.tj_deck.observeClms(),
+ window.tj_deck.observeModals(),
+ window.tj_deck.hideMenu(),
+ window.tj_deck.addTJNav(),
+ (document.querySelector('textarea.js-compose-text').spellcheck = !1)
}
-if (document.querySelector(".js-app-columns")) tjDeckStart();
-else var timer = setInterval(function () {
- document.querySelector(".js-app-columns") ? (tjDeckStart(), clearInterval(timer)) : console.log("まだロード中")
-}, 500);
+if (document.querySelector('.js-app-columns')) tjDeckStart()
+else
+ var timer = setInterval(function() {
+ document.querySelector('.js-app-columns')
+ ? (tjDeckStart(), clearInterval(timer))
+ : console.log('まだロード中')
+ }, 500)
diff --git a/app/js/post/bb-md.js b/app/js/post/bb-md.js
index 1da76d33..82339ce5 100644
--- a/app/js/post/bb-md.js
+++ b/app/js/post/bb-md.js
@@ -1,316 +1,341 @@
//BBCodeとMarkdownの入力・パーサー
//アカウント変えた時にBBとかMDとか
function mdCheck() {
- var acct_id = $("#post-acct-sel").val();
- var profimg = localStorage.getItem("prof_" + acct_id);
+ var acct_id = $('#post-acct-sel').val()
+ var profimg = localStorage.getItem('prof_' + acct_id)
if (!profimg) {
- profimg = "../../img/missing.svg";
+ profimg = '../../img/missing.svg'
}
- $("#acct-sel-prof").attr("src", profimg);
- if (localStorage.getItem("post_" + acct_id)) {
- $("#toot-post-btn").text(localStorage.getItem("post_" + acct_id) + "(" + localStorage.getItem("domain_" + acct_id) + ")");
+ $('#acct-sel-prof').attr('src', profimg)
+ if (localStorage.getItem('post_' + acct_id)) {
+ $('#toot-post-btn').text(
+ localStorage.getItem('post_' + acct_id) +
+ '(' +
+ localStorage.getItem('domain_' + acct_id) +
+ ')'
+ )
} else {
- $("#toot-post-btn").text(lang.lang_toot + "(" + localStorage.getItem("domain_" + acct_id) + ")");
+ $('#toot-post-btn').text(lang.lang_toot + '(' + localStorage.getItem('domain_' + acct_id) + ')')
}
- if (!localStorage.getItem("bb_" + acct_id) && !localStorage.getItem("md_" + acct_id)) {
- $(".markdown").addClass("hide");
- $(".anti-markdown").addClass("hide");
+ if (!localStorage.getItem('bb_' + acct_id) && !localStorage.getItem('md_' + acct_id)) {
+ $('.markdown').addClass('hide')
+ $('.anti-markdown').addClass('hide')
} else {
- $(".anti-markdown").removeClass("hide");
+ $('.anti-markdown').removeClass('hide')
}
- if ($(".markdown").hasClass("hide")) {
- localStorage.setItem("md", "hide");
+ if ($('.markdown').hasClass('hide')) {
+ localStorage.setItem('md', 'hide')
} else {
- localStorage.removeItem("md");
+ localStorage.removeItem('md')
}
- var domain = localStorage.getItem("domain_" + acct_id);
- if (domain == "itabashi.0j0.jp") {
- $("#limited-button").removeClass("hide");
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (domain == 'itabashi.0j0.jp') {
+ $('#limited-button').removeClass('hide')
} else {
- $("#limited-button").addClass("hide");
+ $('#limited-button').addClass('hide')
}
- if (domain == "kirishima.cloud") {
- $("#faicon-btn").show();
+ if (domain == 'kirishima.cloud') {
+ $('#faicon-btn').show()
} else {
- $("#faicon-btn").hide();
+ $('#faicon-btn').hide()
}
- if (domain == "imastodon.net") {
- trendTag();
+ if (domain == 'imastodon.net') {
+ trendTag()
} else {
- $("#trendtag").html("");
+ $('#trendtag').html('')
}
- if (localStorage.getItem("mode_" + domain) == "misskey") {
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
M.toast({ html: lang.lang_bbmd_misskey, displayLength: 5000 })
}
- if (idata[domain + "_letters"]) {
- $("#textarea").attr("data-length", idata[domain + "_letters"])
+ if (idata[domain + '_letters']) {
+ $('#textarea').attr('data-length', idata[domain + '_letters'])
} else {
- $("#textarea").attr("data-length", 500)
+ $('#textarea').attr('data-length', 500)
}
- if (idata[domain + "_glitch"] === "true") {
- $("#local-button").removeClass("hide");
+ if (idata[domain + '_glitch'] === 'true') {
+ $('#local-button').removeClass('hide')
} else {
- $("#local-button").addClass("hide");
+ $('#local-button').addClass('hide')
}
- var multi = localStorage.getItem("multi");
+ var multi = localStorage.getItem('multi')
if (multi) {
- var obj = JSON.parse(multi);
- if (obj[acct_id].background && obj[acct_id].background != "def" && obj[acct_id].text && obj[acct_id].text != "def") {
- $("#toot-post-btn").removeClass("indigo");
- $("#toot-post-btn").css("background-color", "#" + obj[acct_id].background);
- $("#toot-post-btn").css("color", obj[acct_id].text);
+ var obj = JSON.parse(multi)
+ if (
+ obj[acct_id].background &&
+ obj[acct_id].background != 'def' &&
+ obj[acct_id].text &&
+ obj[acct_id].text != 'def'
+ ) {
+ $('#toot-post-btn').removeClass('indigo')
+ $('#toot-post-btn').css('background-color', '#' + obj[acct_id].background)
+ $('#toot-post-btn').css('color', obj[acct_id].text)
} else {
- $("#toot-post-btn").css("background-color", "");
- $("#toot-post-btn").css("color", "");
- $("#toot-post-btn").addClass("indigo");
-
+ $('#toot-post-btn').css('background-color', '')
+ $('#toot-post-btn').css('color', '')
+ $('#toot-post-btn').addClass('indigo')
}
}
- loadVis();
+ loadVis()
}
//BOXのトグルボタン
function mdToggle() {
- $(".markdown").toggleClass("hide");
- $(".anti-markdown").toggleClass("hide");
- if ($(".markdown").hasClass("hide")) {
- localStorage.setItem("md", "hide");
+ $('.markdown').toggleClass('hide')
+ $('.anti-markdown').toggleClass('hide')
+ if ($('.markdown').hasClass('hide')) {
+ localStorage.setItem('md', 'hide')
} else {
- localStorage.removeItem("md");
+ localStorage.removeItem('md')
}
-
}
//最初に読み込みます(MD対応インスタンスかチェック)
-if (localStorage.getItem("md") == "hide") {
- $(".markdown").addClass("hide");
- $(".anti-markdown").removeClass("hide");
+if (localStorage.getItem('md') == 'hide') {
+ $('.markdown').addClass('hide')
+ $('.anti-markdown').removeClass('hide')
}
//タグを選んだ時に(BB版)
function tagsel(tag) {
- var acct_id = $("#post-acct-sel").val();
- if (!localStorage.getItem("bb_" + acct_id)) {
- return false;
+ var acct_id = $('#post-acct-sel').val()
+ if (!localStorage.getItem('bb_' + acct_id)) {
+ return false
}
- if (tag == "large" || tag == "size" || tag == "color" || tag == "colorhex") {
- var sub = $("#" + tag).val();
- var sub = sub.replace(/#/g, "");
- surroundHTML(tag + "=" + sub, tag);
- } else if (tag == "flip=vertical" || tag == "flip=horizontal") {
- surroundHTML(tag, "flip");
+ if (tag == 'large' || tag == 'size' || tag == 'color' || tag == 'colorhex') {
+ var sub = $('#' + tag).val()
+ var sub = sub.replace(/#/g, '')
+ surroundHTML(tag + '=' + sub, tag)
+ } else if (tag == 'flip=vertical' || tag == 'flip=horizontal') {
+ surroundHTML(tag, 'flip')
} else {
- surroundHTML(tag, tag);
+ surroundHTML(tag, tag)
}
- $("#textarea").focus();
+ $('#textarea').focus()
}
//HTMLをエスケープしてXSSを防ぐ
function escape_html(string) {
if (typeof string !== 'string') {
- return string;
+ return string
}
- return string.replace(/[&'`"<>]/g, function (match) {
+ return string.replace(/[&'`"<>]/g, function(match) {
return {
'&': '&',
"'": ''',
'`': '`',
'"': '"',
'<': '<',
- '>': '>',
+ '>': '>'
}[match]
- });
+ })
}
//テキストボックスで選択したやつをタグで囲む(BB版)
function surroundHTML(tagS, tagE) {
- var acct_id = $("#post-acct-sel").val();
- if (!localStorage.getItem("bb_" + acct_id)) {
- return false;
+ var acct_id = $('#post-acct-sel').val()
+ if (!localStorage.getItem('bb_' + acct_id)) {
+ return false
}
- var target = document.getElementById("textarea");
- var pos = getAreaRange(target);
+ var target = document.getElementById('textarea')
+ var pos = getAreaRange(target)
- var val = target.value;
- var range = val.slice(pos.start, pos.end);
- var beforeNode = val.slice(0, pos.start);
- var afterNode = val.slice(pos.end);
- var insertNode;
+ var val = target.value
+ var range = val.slice(pos.start, pos.end)
+ var beforeNode = val.slice(0, pos.start)
+ var afterNode = val.slice(pos.end)
+ var insertNode
if (range || pos.start != pos.end) {
- insertNode = '[' + tagS + ']' + range + '[/' + tagE + ']';
- target.value = beforeNode + insertNode + afterNode;
- }
-
- else if (pos.start == pos.end) {
- insertNode = '[' + tagS + ']' + '[/' + tagE + ']';
- target.value = beforeNode + insertNode + afterNode;
+ insertNode = '[' + tagS + ']' + range + '[/' + tagE + ']'
+ target.value = beforeNode + insertNode + afterNode
+ } else if (pos.start == pos.end) {
+ insertNode = '[' + tagS + ']' + '[/' + tagE + ']'
+ target.value = beforeNode + insertNode + afterNode
}
}
function markdown(tag, ck, br, space) {
- if (space == "before") {
- tagE = tag;
- tag = " " + tag;
+ if (space == 'before') {
+ tagE = tag
+ tag = ' ' + tag
} else {
- tagE = tag;
+ tagE = tag
}
- surroundMD(tag, tagE, ck, br);
- $("#textarea").focus();
+ surroundMD(tag, tagE, ck, br)
+ $('#textarea').focus()
}
function surroundMD(tagS, tagE, ck, br) {
- var acct_id = $("#post-acct-sel").val();
- if (!localStorage.getItem("md_" + acct_id)) {
- return false;
+ var acct_id = $('#post-acct-sel').val()
+ if (!localStorage.getItem('md_' + acct_id)) {
+ return false
}
- var target = document.getElementById("textarea");
- var pos = getAreaRange(target);
+ var target = document.getElementById('textarea')
+ var pos = getAreaRange(target)
- var val = target.value;
- var range = val.slice(pos.start, pos.end);
- var beforeNode = val.slice(0, pos.start);
- var afterNode = val.slice(pos.end);
- var insertNode;
- if (br == "yes") {
- var br = "\n";
+ var val = target.value
+ var range = val.slice(pos.start, pos.end)
+ var beforeNode = val.slice(0, pos.start)
+ var afterNode = val.slice(pos.end)
+ var insertNode
+ if (br == 'yes') {
+ var br = '\n'
} else {
- var br = "";
+ var br = ''
}
- if ((range || pos.start != pos.end) && ck == "yes") {
- insertNode = tagS + range + tagE;
- target.value = beforeNode + insertNode + br + afterNode;
- }
-
- else if (pos.start == pos.end || ck == "no") {
- insertNode = tagS + range;
- target.value = beforeNode + insertNode + br + afterNode;
+ if ((range || pos.start != pos.end) && ck == 'yes') {
+ insertNode = tagS + range + tagE
+ target.value = beforeNode + insertNode + br + afterNode
+ } else if (pos.start == pos.end || ck == 'no') {
+ insertNode = tagS + range
+ target.value = beforeNode + insertNode + br + afterNode
}
}
//テキストボックスの前後チェック
function getAreaRange(obj) {
- var pos = new Object();
+ var pos = new Object()
if (window.getSelection()) {
- pos.start = obj.selectionStart;
- pos.end = obj.selectionEnd;
+ pos.start = obj.selectionStart
+ pos.end = obj.selectionEnd
}
- return pos;
+ return pos
}
//Markdownのリンク挿入
function markdownLink() {
- var acct_id = $("#post-acct-sel").val();
- if (!localStorage.getItem("md_" + acct_id)) {
- return false;
+ var acct_id = $('#post-acct-sel').val()
+ if (!localStorage.getItem('md_' + acct_id)) {
+ return false
}
- var linkIns = "[" + $("#linkt").val() + "]" + "(" + $("#link2").val() + ")";
- if (linkIns != "[]()") {
- $("#textarea").val($("#textarea").val() + linkIns);
- $("#linkt").val("");
- $("#link2").val("");
- $("#textarea").focus();
+ var linkIns = '[' + $('#linkt').val() + ']' + '(' + $('#link2').val() + ')'
+ if (linkIns != '[]()') {
+ $('#textarea').val($('#textarea').val() + linkIns)
+ $('#linkt').val('')
+ $('#link2').val('')
+ $('#textarea').focus()
}
}
//Markdownのimg挿入
function markdownImage() {
- var acct_id = $("#post-acct-sel").val();
- if (!localStorage.getItem("md_" + acct_id)) {
- return false;
+ var acct_id = $('#post-acct-sel').val()
+ if (!localStorage.getItem('md_' + acct_id)) {
+ return false
}
- var imgIns = "![" + $("#image").val() + "]" + "(" + $("#image2").val() + ")";
- if (imgIns != "![]()") {
- $("#textarea").val($("#textarea").val() + imgIns);
- $("#image").val("");
- $("#image2").val("");
- $("#textarea").focus();
+ var imgIns = '![' + $('#image').val() + ']' + '(' + $('#image2').val() + ')'
+ if (imgIns != '![]()') {
+ $('#textarea').val($('#textarea').val() + imgIns)
+ $('#image').val('')
+ $('#image2').val('')
+ $('#textarea').focus()
}
}
//文字数をチェック(hタグ用)
function str_count(all, part) {
- return (all.match(new RegExp(part, "g")) || []).length;
+ return (all.match(new RegExp(part, 'g')) || []).length
}
//プレビュー
function preview() {
- $("#preview-field").show();
- $("#toot-field").hide();
- $("#preview-btn").hide();
- var bb = escape_html($("#textarea").val());
+ $('#preview-field').show()
+ $('#toot-field').hide()
+ $('#preview-btn').hide()
+ var bb = escape_html($('#textarea').val())
//quote
- var bb = bb.replace(/>(.+)$/g, '$1<\/blockquote>');
+ var bb = bb.replace(/>(.+)$/g, '$1 ')
//spin
- var bb = bb.replace(/\[spin\](.+)\[\/spin\]/g, '$1<\/span>');
+ var bb = bb.replace(/\[spin\](.+)\[\/spin\]/g, '$1 ')
//pulse
- var bb = bb.replace(/\[pulse\](.+)\[\/pulse\]/g, '$1<\/span>');
+ var bb = bb.replace(/\[pulse\](.+)\[\/pulse\]/g, '$1 ')
//large
- var bb = bb.replace(/\[large=([0-9]{1,2})x\](.+)\[\/large\]/g, '$2<\/span>');
+ var bb = bb.replace(
+ /\[large=([0-9]{1,2})x\](.+)\[\/large\]/g,
+ '$2 '
+ )
//vertical
- var bb = bb.replace(/\[flip=vertical\](.+)\[\/flip\]/g, '$1<\/span>');
+ var bb = bb.replace(
+ /\[flip=vertical\](.+)\[\/flip\]/g,
+ '$1 '
+ )
//horizontal
- var bb = bb.replace(/\[flip=horizontal\](.+)\[\/flip\]/g, '$1<\/span>');
+ var bb = bb.replace(
+ /\[flip=horizontal\](.+)\[\/flip\]/g,
+ '$1 '
+ )
//b
- var bb = bb.replace(/\[b\](.+)\[\/b\]/g, '$1<\/b>');
+ var bb = bb.replace(/\[b\](.+)\[\/b\]/g, '$1 ')
//i
- var bb = bb.replace(/\[i\](.+)\[\/i\]/g, '$1<\/i>');
+ var bb = bb.replace(/\[i\](.+)\[\/i\]/g, '$1 ')
//u
- var bb = bb.replace(/\[u\](.+)\[\/u\]/g, '$1<\/u>');
+ var bb = bb.replace(/\[u\](.+)\[\/u\]/g, '$1 ')
//s
- var bb = bb.replace(/\[s\](.+)\[\/s\]/g, '$1<\/s>');
+ var bb = bb.replace(/\[s\](.+)\[\/s\]/g, '$1 ')
//size
- var bb = bb.replace(/\[size=([0-9]{1,2})\](.+)\[\/size\]/g, '$2<\/span>');
+ var bb = bb.replace(
+ /\[size=([0-9]{1,2})\](.+)\[\/size\]/g,
+ '$2 '
+ )
//colorhex
- var bb = bb.replace(/\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g, '$2<\/span>');
+ var bb = bb.replace(
+ /\[colorhex=([A-Fa-f0-9]+)\](.+)\[\/colorhex\]/g,
+ '$2 '
+ )
//code
- var bb = bb.replace(/`(.+)`/g, '$1<\/code>');
+ var bb = bb.replace(/`(.+)`/g, '$1
')
//head
- var m;
- m = bb.match(/^#{1,6}(.+)$/gm);
+ var m
+ m = bb.match(/^#{1,6}(.+)$/gm)
if (m) {
for (let i = 0; i < m.length; i++) {
- var t = m[i].match(/^#{1,6}(.+)$/);
- var indexct = '' + t[1] + ' ';
- var bb = bb.replace(new RegExp(m[i], ""), indexct);
+ var t = m[i].match(/^#{1,6}(.+)$/)
+ var indexct = '' + t[1] + ' '
+ var bb = bb.replace(new RegExp(m[i], ''), indexct)
}
}
//list(ul)
- var li;
- li = bb.match(/^\- (.+)$/gm);
+ var li
+ li = bb.match(/^\- (.+)$/gm)
if (li) {
for (let l = 0; l < li.length; l++) {
- var u = li[l].match(/^\- (.+)$/);
- var listUl = '' + u[1] + ' ';
+ var u = li[l].match(/^\- (.+)$/)
+ var listUl = '' + u[1] + ' '
if (l == 0) {
- listUl = '' + listUl;
+ listUl = '' + listUl
}
if (l == li.length - 1) {
- listUl = listUl + ' ';
+ listUl = listUl + ' '
}
- var bb = bb.replace(new RegExp(li[l], ""), listUl);
+ var bb = bb.replace(new RegExp(li[l], ''), listUl)
}
}
//list(ol)
- var li;
- li = bb.match(/^1\. (.+)$/gm);
+ var li
+ li = bb.match(/^1\. (.+)$/gm)
if (li) {
for (let l = 0; l < li.length; l++) {
- var u = li[l].match(/^1\. (.+)$/);
- var listUl = '' + u[1] + ' ';
+ var u = li[l].match(/^1\. (.+)$/)
+ var listUl = '' + u[1] + ' '
if (l === 0) {
- listUl = '' + listUl;
+ listUl = '' + listUl
}
if (l === li.length - 1) {
- listUl = listUl + ' ';
+ listUl = listUl + ' '
}
- var bb = bb.replace(new RegExp(li[l], ""), listUl);
+ var bb = bb.replace(new RegExp(li[l], ''), listUl)
}
}
//img
- var bb = bb.replace(/!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, ' ');
+ var bb = bb.replace(
+ /!\[(.+)\]\((https:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,
+ ' '
+ )
//link
- var bb = bb.replace(/\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g, '$1<\/a>');
- bb = nl2br(bb);
- bb = bb.replace(new RegExp(" ", "g"), "");
- $("#md-preview").html(bb);
+ var bb = bb.replace(
+ /\[(.+)\]\((https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)\)/g,
+ ' $1 '
+ )
+ bb = nl2br(bb)
+ bb = bb.replace(new RegExp(' ', 'g'), '')
+ $('#md-preview').html(bb)
}
//Editで戻る
function previewEdit() {
- $("#preview-field").hide();
- $("#toot-field").show();
- $("#preview-btn").show();
- $("#md-preview").html("");
-}
\ No newline at end of file
+ $('#preview-field').hide()
+ $('#toot-field').show()
+ $('#preview-btn').show()
+ $('#md-preview').html('')
+}
diff --git a/app/js/post/emoji.js b/app/js/post/emoji.js
index 6f10b382..8735aa4c 100644
--- a/app/js/post/emoji.js
+++ b/app/js/post/emoji.js
@@ -1,319 +1,323 @@
//絵文字ピッカー
//最初に読み込む
-$("#emoji-before").addClass("disabled");
-$("#emoji-next").addClass("disabled");
+$('#emoji-before').addClass('disabled')
+$('#emoji-next').addClass('disabled')
//絵文字ボタンのトグル
function emojiToggle(reaction) {
- var acct_id = $("#post-acct-sel").val();
- var selin = $("#textarea").prop("selectionStart");
+ var acct_id = $('#post-acct-sel').val()
+ var selin = $('#textarea').prop('selectionStart')
if (!selin) {
- selin = 0;
+ selin = 0
}
- if ($("#emoji").hasClass("hide")) {
- $("#emoji").removeClass("hide");
- $("#right-side").show();
- $("#right-side").css("width", "300px");
- $("#left-side").css("width", "calc(100% - 300px)");
- var width = localStorage.getItem("postbox-width");
+ if ($('#emoji').hasClass('hide')) {
+ $('#emoji').removeClass('hide')
+ $('#right-side').show()
+ $('#right-side').css('width', '300px')
+ $('#left-side').css('width', 'calc(100% - 300px)')
+ var width = localStorage.getItem('postbox-width')
if (width) {
- width = width.replace("px", "") * 1 + 300;
+ width = width.replace('px', '') * 1 + 300
} else {
- width = 600;
+ width = 600
}
- $("#post-box").css("width", width + "px");
- $("#suggest").html("");
- if (!localStorage.getItem("emojis_" + acct_id)) {
- var html = '' + lang.lang_emoji_get + " ";
- $("#emoji-list").html(html);
+ $('#post-box').css('width', width + 'px')
+ $('#suggest').html('')
+ if (!localStorage.getItem('emojis_' + acct_id)) {
+ var html = `${lang.lang_emoji_get} `
+ $('#emoji-list').html(html)
} else {
- emojiList("home", reaction);
+ emojiList('home', reaction)
}
} else {
- $("#poll").addClass("hide");
- $("#right-side").hide();
- $("#right-side").css("width", "300px");
- $("#emoji").addClass("hide");
- $("#suggest").html("");
- $("#left-side").css("width", "100%");
- var width = localStorage.getItem("postbox-width");
+ $('#poll').addClass('hide')
+ $('#right-side').hide()
+ $('#right-side').css('width', '300px')
+ $('#emoji').addClass('hide')
+ $('#suggest').html('')
+ $('#left-side').css('width', '100%')
+ var width = localStorage.getItem('postbox-width')
if (width) {
- width = width.replace("px", "") * 1;
+ width = width.replace('px', '') * 1
} else {
- width = 300;
+ width = 300
}
- $("#post-box").css("width", width + "px");
+ $('#post-box').css('width', width + 'px')
}
}
//絵文字リスト挿入
function emojiGet(parse, started) {
- $("#emoji-list").text("Loading...");
- var acct_id = $("#post-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- var start = "https://" + domain + "/api/v1/custom_emojis";
+ $('#emoji-list').text('Loading...')
+ var acct_id = $('#post-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ var start = 'https://' + domain + '/api/v1/custom_emojis'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- if (parse == "true") {
- $("#emoji-list").text("Parsing...");
+ if (parse == 'true') {
+ $('#emoji-list').text('Parsing...')
var md = {
categorized: {},
uncategorized: []
- };
- var if_categorized = false;
+ }
+ var if_categorized = false
Object.keys(json).forEach(function(key) {
- var emoji = json[key];
+ var emoji = json[key]
if (emoji.visible_in_picker) {
- var listed = true;
+ var listed = true
} else {
- var listed = false;
+ var listed = false
}
if (emoji.category) {
- var cat = emoji.category;
- if (!md["categorized"][cat]) {
- md["categorized"][cat] = [];
+ var cat = emoji.category
+ if (!md['categorized'][cat]) {
+ md['categorized'][cat] = []
}
- md["categorized"][cat].push({
+ md['categorized'][cat].push({
shortcode: emoji.shortcode,
url: emoji.url,
listed: listed
- });
- if_categorized = true;
+ })
+ if_categorized = true
} else {
- md["uncategorized"].push({
+ md['uncategorized'].push({
shortcode: emoji.shortcode,
url: emoji.url,
listed: listed
- });
+ })
}
- });
- console.log(md);
+ })
+ console.log(md)
//絵文字をマストドン公式と同順にソート
- md["uncategorized"].sort(function(a, b) {
- if (a.shortcode < b.shortcode) return -1;
- if (a.shortcode > b.shortcode) return 1;
- return 0;
- });
- Object.keys(md["categorized"]).forEach(function(key) {
- md["categorized"][key].sort(function(a, b) {
- if (a.shortcode < b.shortcode) return -1;
- if (a.shortcode > b.shortcode) return 1;
- return 0;
- });
- });
+ md['uncategorized'].sort(function(a, b) {
+ if (a.shortcode < b.shortcode) return -1
+ if (a.shortcode > b.shortcode) return 1
+ return 0
+ })
+ Object.keys(md['categorized']).forEach(function(key) {
+ md['categorized'][key].sort(function(a, b) {
+ if (a.shortcode < b.shortcode) return -1
+ if (a.shortcode > b.shortcode) return 1
+ return 0
+ })
+ })
- md["if_categorized"] = if_categorized;
- localStorage.setItem("emojis_" + acct_id, JSON.stringify(md));
+ md['if_categorized'] = if_categorized
+ localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
} else {
- localStorage.setItem("emojis_" + acct_id, JSON.stringify(md));
+ localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
}
- localStorage.setItem("emojiseek", 0);
+ localStorage.setItem('emojiseek', 0)
if (!started) {
- emojiList("home");
+ emojiList('home')
}
- });
+ })
} else {
- var start = "https://" + domain + "/api/meta";
+ var start = 'https://' + domain + '/api/meta'
fetch(start, {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json.enableEmojiReaction) {
- localStorage.setItem("emojiReaction_" + acct_id, "true");
+ localStorage.setItem('emojiReaction_' + acct_id, 'true')
} else {
- localStorage.setItem("emojiReaction_" + acct_id, "disabled");
+ localStorage.setItem('emojiReaction_' + acct_id, 'disabled')
}
- var emojis = json.emojis;
- var md = { uncategorized: [] };
+ var emojis = json.emojis
+ var md = { uncategorized: [] }
Object.keys(emojis).forEach(function(key) {
- var emoji = emojis[key];
- md["uncategorized"].push({
+ var emoji = emojis[key]
+ md['uncategorized'].push({
shortcode: emoji.name,
url: emoji.url,
listed: true
- });
- });
- md["if_categorized"] = false;
- if (parse == "true") {
- $("#emoji-list").text("Parsing...");
+ })
+ })
+ md['if_categorized'] = false
+ if (parse == 'true') {
+ $('#emoji-list').text('Parsing...')
//絵文字をマストドン公式と同順にソート
- md["uncategorized"].sort(function(a, b) {
- if (a.shortcode < b.shortcode) return -1;
- if (a.shortcode > b.shortcode) return 1;
- return 0;
- });
- localStorage.setItem("emojis_" + acct_id, JSON.stringify(md));
+ md['uncategorized'].sort(function(a, b) {
+ if (a.shortcode < b.shortcode) return -1
+ if (a.shortcode > b.shortcode) return 1
+ return 0
+ })
+ localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
} else {
- localStorage.setItem("emojis_" + acct_id, JSON.stringify(md));
+ localStorage.setItem('emojis_' + acct_id, JSON.stringify(md))
}
- localStorage.setItem("emojiseek", 0);
+ localStorage.setItem('emojiseek', 0)
if (!started) {
- emojiList("home");
+ emojiList('home')
}
- });
+ })
}
}
//リストの描画
function emojiList(target, reaction) {
- $("#now-emoji").text(lang.lang_emoji_custom);
- var acct_id = $("#post-acct-sel").val();
- if (reaction && localStorage.getItem("emojiReaction_" + acct_id) != "true") {
- console.error("Disabled");
- clear();
- hide();
- return false;
+ $('#now-emoji').text(lang.lang_emoji_custom)
+ var acct_id = $('#post-acct-sel').val()
+ if (reaction && localStorage.getItem('emojiReaction_' + acct_id) != 'true') {
+ console.error('Disabled')
+ clear()
+ hide()
+ return false
}
- var start = localStorage.getItem("emojiseek");
- if (target == "next") {
- var start = start * 1 + 127;
- localStorage.setItem("emojiseek", start);
- } else if (target == "before") {
- var start = start - 127;
- localStorage.setItem("emojiseek", start);
+ var start = localStorage.getItem('emojiseek')
+ if (target == 'next') {
+ var start = start * 1 + 127
+ localStorage.setItem('emojiseek', start)
+ } else if (target == 'before') {
+ var start = start - 127
+ localStorage.setItem('emojiseek', start)
} else {
- var start = 0;
- localStorage.getItem("emojiseek", 0);
+ var start = 0
+ localStorage.getItem('emojiseek', 0)
}
- var html = "";
- var raw = JSON.parse(localStorage.getItem("emojis_" + acct_id));
- console.log(raw);
+ var html = ''
+ var raw = JSON.parse(localStorage.getItem('emojis_' + acct_id))
+ console.log(raw)
if (raw.if_categorized) {
var obj = [
{
divider: true,
cat: lang.lang_emoji_uncat
}
- ];
- var cats = raw["uncategorized"];
- obj = obj.concat(cats);
- Object.keys(raw["categorized"]).forEach(function(key) {
- var cats = raw["categorized"][key];
+ ]
+ var cats = raw['uncategorized']
+ obj = obj.concat(cats)
+ Object.keys(raw['categorized']).forEach(function(key) {
+ var cats = raw['categorized'][key]
obj = obj.concat([
{
divider: true,
cat: key
}
- ]);
- obj = obj.concat(cats);
- });
+ ])
+ obj = obj.concat(cats)
+ })
} else {
- var obj = raw["uncategorized"];
+ var obj = raw['uncategorized']
}
- console.log(obj);
+ console.log(obj)
- var num = obj.length;
+ var num = obj.length
if (num < start) {
- var start = 0;
- localStorage.setItem("emojiseek", start);
+ var start = 0
+ localStorage.setItem('emojiseek', start)
}
- var page = Math.ceil(num / 126);
- $("#emoji-sum").text(page);
- var ct = Math.ceil(start / 126);
+ var page = Math.ceil(num / 126)
+ $('#emoji-sum').text(page)
+ var ct = Math.ceil(start / 126)
if (ct === 0) {
if (num > 0) {
- var ct = 1;
+ var ct = 1
}
- $("#emoji-before").addClass("disabled");
+ $('#emoji-before').addClass('disabled')
} else {
- $("#emoji-before").removeClass("disabled");
+ $('#emoji-before').removeClass('disabled')
}
if (page != 1) {
- $("#emoji-next").removeClass("disabled");
+ $('#emoji-next').removeClass('disabled')
} else {
- $("#emoji-next").addClass("disabled");
+ $('#emoji-next').addClass('disabled')
}
- $("#emoji-count").text(ct);
+ $('#emoji-count').text(ct)
for (i = start; i < start + 126; i++) {
- var emoji = obj[i];
+ var emoji = obj[i]
if (emoji) {
if (reaction) {
- html = html + " ';
+ html =
+ html +
+ ` `
} else {
if (emoji.divider) {
- html = html + '' + emoji.cat + "
";
+ html = html + '' + emoji.cat + '
'
} else {
if (emoji.listed) {
- html = html + " ';
+ html =
+ html +
+ ` `
}
}
}
}
}
- $("#emoji-list").html(html);
+ $('#emoji-list').html(html)
}
//絵文字など様々なものをテキストボックスに挿入
function emojiInsert(code, del) {
- var now = $("#textarea").val();
- var selin = $("#textarea").prop("selectionStart");
- if (localStorage.getItem("emoji-zero-width") == "yes") {
- var blank = "";
+ var now = $('#textarea').val()
+ var selin = $('#textarea').prop('selectionStart')
+ if (localStorage.getItem('emoji-zero-width') == 'yes') {
+ var blank = ''
} else {
- var blank = " ";
+ var blank = ' '
}
- var before = now.substr(0, selin);
- if (before.slice(-1) != " ") {
- before = before + blank;
+ var before = now.substr(0, selin)
+ if (before.slice(-1) != ' ') {
+ before = before + blank
}
- var after = now.substr(selin, now.length);
- if (after.slice(-1) != " ") {
- after = blank + after;
+ var after = now.substr(selin, now.length)
+ if (after.slice(-1) != ' ') {
+ after = blank + after
}
- newt = before + code + after;
+ newt = before + code + after
if (!del) {
- $("#textarea").val(newt);
+ $('#textarea').val(newt)
//emoji();
} else {
- var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
- var now = now.replace(regExp, "");
- $("#textarea").val(now + blank + code);
+ var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
+ var now = now.replace(regExp, '')
+ $('#textarea').val(now + blank + code)
}
- $("#textarea").focus();
+ $('#textarea').focus()
}
//改行挿入
function brInsert(code) {
- if (!$("#post-box").hasClass("appear")) {
- localStorage.setItem("nohide", true);
- show();
+ if (!$('#post-box').hasClass('appear')) {
+ localStorage.setItem('nohide', true)
+ show()
}
- var now = $("#textarea").val();
- $("#textarea").val(now + code);
- $("#textarea").focus();
+ var now = $('#textarea').val()
+ $('#textarea').val(now + code)
+ $('#textarea').focus()
}
diff --git a/app/js/post/img.js b/app/js/post/img.js
index 68eb86c3..ff13ae48 100644
--- a/app/js/post/img.js
+++ b/app/js/post/img.js
@@ -1,269 +1,273 @@
//ドラッグ・アンド・ドロップからアップロードまで。uiのimg.jsとは異なります。
-var obj = $("body");
-var system;
+var obj = $('body')
+var system
//ドラッグスタート
-obj.on("dragstart", function(e) {
- system = "locked";
-});
+obj.on('dragstart', function(e) {
+ system = 'locked'
+})
//何もなくファイルが通過
-obj.on("dragend", function(e) {
- system = "";
-});
+obj.on('dragend', function(e) {
+ system = ''
+})
//ドラッグファイルが画面上に
-obj.on("dragenter", function(e) {
- if (system != "locked") {
- $("#drag").css("display", "flex");
+obj.on('dragenter', function(e) {
+ if (system != 'locked') {
+ $('#drag').css('display', 'flex')
}
-});
-$("body").on("dragover", function(e) {
- e.stopPropagation();
- e.preventDefault();
-});
+})
+$('body').on('dragover', function(e) {
+ e.stopPropagation()
+ e.preventDefault()
+})
//ドロップした
-$("body").on("drop", function(e) {
- if (system != "locked") {
- $("#drag").css("display", "none");
- e.preventDefault();
- var files = e.originalEvent.dataTransfer.files;
- pimg(files);
+$('body').on('drop', function(e) {
+ if (system != 'locked') {
+ $('#drag').css('display', 'none')
+ e.preventDefault()
+ var files = e.originalEvent.dataTransfer.files
+ pimg(files)
}
-});
+})
//何もなくファイルが通過
-$("#drag").on("dragleave", function(e) {
- $("#drag").css("display", "none");
-});
+$('#drag').on('dragleave', function(e) {
+ $('#drag').css('display', 'none')
+})
//複数アップ
function pimg(files) {
- console.table(files);
+ console.table(files)
for (i = 0; i < files.length; i++) {
- var dot = files[i].path.match(/\.(.+)$/)[1];
- if (dot == "bmp" || dot == "BMP") {
- postMessage(["bmpImage", [files[i].path, i]], "*");
- todo(lang.lang_progress);
+ var dot = files[i].path.match(/\.(.+)$/)[1]
+ if (dot == 'bmp' || dot == 'BMP') {
+ postMessage(['bmpImage', [files[i].path, i]], '*')
+ todo(lang.lang_progress)
} else {
- handleFileUpload(files[i], obj, i);
+ handleFileUpload(files[i], obj, i)
}
}
}
//ドラッグ・アンド・ドロップを終了
function closedrop() {
- $("#drag").css("display", "none");
+ $('#drag').css('display', 'none')
}
//ファイル選択
function fileselect() {
- postMessage(["sendSinmpleIpc", "file-select"], "*");
+ postMessage(['sendSinmpleIpc', 'file-select'], '*')
}
//ファイル読み込み
function handleFileUpload(files, obj, no) {
- var fr = new FileReader();
+ var fr = new FileReader()
fr.onload = function(evt) {
- var b64 = evt.target.result;
- $("#b64-box").val(b64);
- var ret = media(b64, files["type"], no);
- };
- fr.readAsDataURL(files);
- $("#mec").append(files["name"] + "/");
+ var b64 = evt.target.result
+ $('#b64-box').val(b64)
+ var ret = media(b64, files['type'], no)
+ }
+ fr.readAsDataURL(files)
+ $('#mec').append(files['name'] + '/')
}
//ファイルアップロード
function media(b64, type, no) {
- var l = 4;
- var c = "abcdefghijklmnopqrstuvwxyz0123456789";
- var cl = c.length;
- var r = "";
+ var l = 4
+ var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
+ var cl = c.length
+ var r = ''
for (var i = 0; i < l; i++) {
- r += c[Math.floor(Math.random() * cl)];
+ r += c[Math.floor(Math.random() * cl)]
}
- if ($("#media").val()) {
- $("#media").val($("#media").val() + "," + "tmp_" + r);
+ if ($('#media').val()) {
+ $('#media').val($('#media').val() + ',' + 'tmp_' + r)
} else {
- $("#media").val("tmp_" + r);
+ $('#media').val('tmp_' + r)
}
- $(".toot-btn-group").prop("disabled", true);
- $("#post-acct-sel").prop("disabled", true);
- localStorage.setItem("image", "busy");
- todo("Image Upload...");
- var media = toBlob(b64, type);
- var fd = new FormData();
- fd.append("file", media);
- var acct_id = $("#post-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var httpreq = new XMLHttpRequest();
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/drive/files/create";
- httpreq.open("POST", start, true);
- httpreq.upload.addEventListener("progress", progshow, false);
- httpreq.responseType = "json";
- if ($("#nsfw").hasClass("nsfw-avail")) {
- var nsfw = true;
+ $('.toot-btn-group').prop('disabled', true)
+ $('#post-acct-sel').prop('disabled', true)
+ localStorage.setItem('image', 'busy')
+ todo('Image Upload...')
+ var media = toBlob(b64, type)
+ var fd = new FormData()
+ fd.append('file', media)
+ var acct_id = $('#post-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var httpreq = new XMLHttpRequest()
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/drive/files/create'
+ httpreq.open('POST', start, true)
+ httpreq.upload.addEventListener('progress', progshow, false)
+ httpreq.responseType = 'json'
+ if ($('#nsfw').hasClass('nsfw-avail')) {
+ var nsfw = true
} else {
- var nsfw = false;
+ var nsfw = false
}
- var previewer = "url";
- fd.append("i", at);
+ var previewer = 'url'
+ fd.append('i', at)
//fd.append('isSensitive', nsfw);
- httpreq.send(fd);
+ httpreq.send(fd)
} else {
- var previewer = "preview_url";
- var start = "https://" + domain + "/api/v1/media";
- httpreq.open("POST", start, true);
- httpreq.upload.addEventListener("progress", progshow, false);
- httpreq.responseType = "json";
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.send(fd);
+ var previewer = 'preview_url'
+ var start = 'https://' + domain + '/api/v1/media'
+ httpreq.open('POST', start, true)
+ httpreq.upload.addEventListener('progress', progshow, false)
+ httpreq.responseType = 'json'
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.send(fd)
}
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
if (!json.id) {
- todc();
- $("#imgup").text("");
- $(".toot-btn-group").prop("disabled", false);
- $("#post-acct-sel").prop("disabled", false);
- $("select").formSelect();
- $("#imgsel").show();
- M.toast({ html: lang.lang_postimg_failupload, displayLength: 5000 });
- return false;
+ todc()
+ $('#imgup').text('')
+ $('.toot-btn-group').prop('disabled', false)
+ $('#post-acct-sel').prop('disabled', false)
+ $('select').formSelect()
+ $('#imgsel').show()
+ M.toast({ html: lang.lang_postimg_failupload, displayLength: 5000 })
+ return false
}
- var img = localStorage.getItem("img");
- if (json.type.indexOf("image") != -1) {
- var html = ' ';
- $("#preview").append(html);
+ var img = localStorage.getItem('img')
+ if (json.type.indexOf('image') != -1) {
+ var html = ` `
+ $('#preview').append(html)
} else {
- $("#preview").append(lang.lang_postimg_previewdis);
+ $('#preview').append(lang.lang_postimg_previewdis)
}
if (!img) {
- var img = "no-act";
+ var img = 'no-act'
}
- if (img != "inline") {
- var mediav = $("#media").val();
- var regExp = new RegExp("tmp_" + r, "g");
- mediav = mediav.replace(regExp, json["id"]);
- $("#media").val(mediav);
+ if (img != 'inline') {
+ var mediav = $('#media').val()
+ var regExp = new RegExp('tmp_' + r, 'g')
+ mediav = mediav.replace(regExp, json['id'])
+ $('#media').val(mediav)
}
- if (img == "url") {
- $("#textarea").val($("#textarea").val() + " " + json["text_url"]);
+ if (img == 'url') {
+ $('#textarea').val($('#textarea').val() + ' ' + json['text_url'])
}
- todc();
- if (localStorage.getItem("nsfw_" + acct_id)) {
- $("#nsfw").addClass("yellow-text");
- $("#nsfw").html("visibility");
- $("#nsfw").addClass("nsfw-avail");
+ todc()
+ if (localStorage.getItem('nsfw_' + acct_id)) {
+ $('#nsfw').addClass('yellow-text')
+ $('#nsfw').html('visibility')
+ $('#nsfw').addClass('nsfw-avail')
}
- $(".toot-btn-group").prop("disabled", false);
- $("select").formSelect();
- $("#mec").text(lang.lang_there);
- M.toast({ html: lang.lang_postimg_aftupload, displayLength: 1000 });
- $("#imgup").text("");
- $("#imgsel").show();
- localStorage.removeItem("image");
+ $('.toot-btn-group').prop('disabled', false)
+ $('select').formSelect()
+ $('#mec').text(lang.lang_there)
+ M.toast({ html: lang.lang_postimg_aftupload, displayLength: 1000 })
+ $('#imgup').text('')
+ $('#imgsel').show()
+ localStorage.removeItem('image')
}
- };
+ }
}
//Base64からBlobへ
function toBlob(base64, type) {
- var bin = atob(base64.replace(/^.*,/, ""));
- var buffer = new Uint8Array(bin.length);
+ var bin = atob(base64.replace(/^.*,/, ''))
+ var buffer = new Uint8Array(bin.length)
for (var i = 0; i < bin.length; i++) {
- buffer[i] = bin.charCodeAt(i);
+ buffer[i] = bin.charCodeAt(i)
}
// Blobを作成
try {
var blob = new Blob([new Uint8Array(buffer)], {
type: type
- });
+ })
} catch (e) {
- return false;
+ return false
}
- return blob;
+ return blob
}
//画像を貼り付けたら…
-var element = document.querySelector("#textarea");
-element.addEventListener("paste", function(e) {
+var element = document.querySelector('#textarea')
+element.addEventListener('paste', function(e) {
if (!e.clipboardData || !e.clipboardData.items) {
- return true;
+ return true
}
// DataTransferItemList に画像が含まれいない場合は終了する
- var imageItems = [...e.clipboardData.items].filter(i => i.type.startsWith("image"));
+ var imageItems = [...e.clipboardData.items].filter(i => i.type.startsWith('image'))
if (imageItems.length == 0) {
- console.warn("it is not image");
- return true;
+ console.warn('it is not image')
+ return true
}
// ファイルとして得る
// DataTransferItem の kind は file なので getAsString ではなく getAsFile を呼ぶ
- var imageFile = imageItems[0].getAsFile();
- var imageType = imageItems[0].type;
+ var imageFile = imageItems[0].getAsFile()
+ var imageType = imageItems[0].type
// FileReaderで読み込む
- var fr = new FileReader();
+ var fr = new FileReader()
fr.onload = function(e) {
// onload内ではe.target.resultにbase64が入っているのであとは煮るなり焼くなり
- var base64 = e.target.result;
- var mediav = $("#media").val();
+ var base64 = e.target.result
+ var mediav = $('#media').val()
if (mediav) {
- var i = mediav.split(",").length;
+ var i = mediav.split(',').length
}
// DataTransferItem の type に mime tipes があるのでそれを使う
- media(base64, imageType, i);
- };
- fr.readAsDataURL(imageFile);
+ media(base64, imageType, i)
+ }
+ fr.readAsDataURL(imageFile)
// 画像以外がペーストされたときのために、元に戻しておく
-});
+})
function deleteImage(key) {
Swal.fire({
title: lang.lang_postimg_delete,
- type: "warning",
+ type: 'warning',
showCancelButton: true,
- confirmButtonColor: "#3085d6",
- cancelButtonColor: "#d33",
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
if (result.value) {
- var media = $("#media").val();
- var arr = media.split(",");
+ var media = $('#media').val()
+ var arr = media.split(',')
for (var i = 0; i < media.length; i++) {
if (arr[i] == key) {
- arr.splice(i, 1);
- break;
+ arr.splice(i, 1)
+ break
}
}
- $("#media").val(arr.join(","));
- $("#preview [data-media=" + key + "]").remove();
+ $('#media').val(arr.join(','))
+ $('#preview [data-media=' + key + ']').remove()
}
- });
+ })
}
function altImage(acct_id, id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/media/" + id;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/media/' + id
Swal.fire({
title: lang.lang_postimg_desc,
text: lang.lang_postimg_leadContext,
- input: "text",
+ input: 'text',
inputAttributes: {
- autocapitalize: "off"
+ autocapitalize: 'off'
},
showCancelButton: true,
- confirmButtonText: "Post",
+ confirmButtonText: 'Post',
showLoaderOnConfirm: true,
preConfirm: data => {
return fetch(start, {
- method: "PUT",
+ method: 'PUT',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
},
body: JSON.stringify({
description: data
@@ -272,27 +276,27 @@ function altImage(acct_id, id) {
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- console.log(json);
- $("[data-media=" + id + "]").attr("title", data);
- });
+ console.log(json)
+ $('[data-media=' + id + ']').attr('title', data)
+ })
},
allowOutsideClick: () => !Swal.isLoading()
}).then(result => {
if (result.value) {
Swal.fire({
- title: "Complete"
- });
+ title: 'Complete'
+ })
}
- });
+ })
}
diff --git a/app/js/post/misskeystatus.js b/app/js/post/misskeystatus.js
index f53a7fb7..e81b2dfe 100644
--- a/app/js/post/misskeystatus.js
+++ b/app/js/post/misskeystatus.js
@@ -1,261 +1,273 @@
//Renpost
function renote(id, acct_id, remote) {
- if ($("#pub_" + id).hasClass("rted")) {
- return false;
+ if ($('#pub_' + id).hasClass('rted')) {
+ return false
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/notes/create";
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- return false;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/notes/create'
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ return false
}
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify({ i: at, renoteId: id }));
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify({ i: at, renoteId: id }))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- console.log(["Success: renote", json]);
- $("[toot-id=" + id + "]").addClass("rted");
- $(".rt_" + id).toggleClass("teal-text");
+ console.log(['Success: renote', json])
+ $('[toot-id=' + id + ']').addClass('rted')
+ $('.rt_' + id).toggleClass('teal-text')
}
- };
+ }
}
//Renote
function renoteqt(id, acct_id) {
- localStorage.setItem("nohide", true);
- show();
- $("#reply").val("renote_" + id);
- $("#rec").text("Renote");
- $("#post-acct-sel").val(acct_id);
- $("#post-acct-sel").prop("disabled", true);
- $("select").formSelect();
- $("#textarea").attr("placeholder", lang.lang_misskeyparse_qt);
- $("#textarea").focus();
+ localStorage.setItem('nohide', true)
+ show()
+ $('#reply').val('renote_' + id)
+ $('#rec').text('Renote')
+ $('#post-acct-sel').val(acct_id)
+ $('#post-acct-sel').prop('disabled', true)
+ $('select').formSelect()
+ $('#textarea').attr('placeholder', lang.lang_misskeyparse_qt)
+ $('#textarea').focus()
}
//Reply
function misskeyreply(id, acct_id) {
- localStorage.setItem("nohide", true);
- show();
- $("#reply").val(id);
- $("#rec").text("Renote");
- $("#post-acct-sel").val(acct_id);
- $("#post-acct-sel").prop("disabled", true);
- $("select").formSelect();
- $("#textarea").attr("placeholder", lang.lang_misskeyparse_qt);
- $("#textarea").focus();
+ localStorage.setItem('nohide', true)
+ show()
+ $('#reply').val(id)
+ $('#rec').text('Renote')
+ $('#post-acct-sel').val(acct_id)
+ $('#post-acct-sel').prop('disabled', true)
+ $('select').formSelect()
+ $('#textarea').attr('placeholder', lang.lang_misskeyparse_qt)
+ $('#textarea').focus()
}
//Reaction
function reactiontoggle(id, acct_id, tlid) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/notes/show";
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- return false;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/notes/show'
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ return false
}
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify({ i: at, noteId: id }));
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify({ i: at, noteId: id }))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- console.log(["Success: reaction", json]);
+ console.log(['Success: reaction', json])
if (json.reactions) {
- var reactions = ["like", "love", "laugh", "hmm", "surprise", "congrats", "angry", "confused", "pudding", "rip"];
+ var reactions = [
+ 'like',
+ 'love',
+ 'laugh',
+ 'hmm',
+ 'surprise',
+ 'congrats',
+ 'angry',
+ 'confused',
+ 'pudding',
+ 'rip'
+ ]
for (var i = 0; i < reactions.length; i++) {
if (json.reactions[reactions[i]]) {
- $("#pub_" + id + " .re-" + reactions[i] + "ct").text(json.reactions[reactions[i]]);
- $("#pub_" + id + " .re-" + reactions[i]).removeClass("hide");
+ $('#pub_' + id + ' .re-' + reactions[i] + 'ct').text(json.reactions[reactions[i]])
+ $('#pub_' + id + ' .re-' + reactions[i]).removeClass('hide')
} else {
- $("#pub_" + id + " .re-" + reactions[i] + "ct").text(0);
- if ($("#pub_" + id + " .reactions").hasClass("fullreact")) {
- $("#pub_" + id + " .re-" + reactions[i]).addClass("hide");
+ $('#pub_' + id + ' .re-' + reactions[i] + 'ct').text(0)
+ if ($('#pub_' + id + ' .reactions').hasClass('fullreact')) {
+ $('#pub_' + id + ' .re-' + reactions[i]).addClass('hide')
} else {
- $("#pub_" + id + " .re-" + reactions[i]).removeClass("hide");
+ $('#pub_' + id + ' .re-' + reactions[i]).removeClass('hide')
}
- $("#pub_" + id + " .re-" + reactions[i] + "ct").text(json.reactions[reactions[i]]);
+ $('#pub_' + id + ' .re-' + reactions[i] + 'ct').text(json.reactions[reactions[i]])
}
}
- $("#pub_" + id + " .reactions").removeClass("hide");
- $("#pub_" + id + " .reactions").toggleClass("fullreact");
+ $('#pub_' + id + ' .reactions').removeClass('hide')
+ $('#pub_' + id + ' .reactions').toggleClass('fullreact')
} else {
- if ($("#pub_" + id + " .reactions").hasClass("fullreact")) {
- $("#pub_" + id + " .reactions").addClass("hide");
- $("#pub_" + id + " .reactions").removeClass("fullreact");
+ if ($('#pub_' + id + ' .reactions').hasClass('fullreact')) {
+ $('#pub_' + id + ' .reactions').addClass('hide')
+ $('#pub_' + id + ' .reactions').removeClass('fullreact')
} else {
- $("#pub_" + id + " .reactions").removeClass("hide");
- $("#pub_" + id + " .reaction").removeClass("hide");
- $("#pub_" + id + " .reactions").addClass("fullreact");
+ $('#pub_' + id + ' .reactions').removeClass('hide')
+ $('#pub_' + id + ' .reaction').removeClass('hide')
+ $('#pub_' + id + ' .reactions').addClass('fullreact')
}
}
}
- };
- $("#pub_" + id + " .freeReact").toggleClass("hide");
+ }
+ $('#pub_' + id + ' .freeReact').toggleClass('hide')
}
//reactioncustom
function reactioncustom(acct_id, id) {
- $("#reply").val(id);
- $("#unreact").hide();
- $("#addreact").removeClass("hide");
- $("#post-acct-sel").val(acct_id);
- $("select").formSelect();
- localStorage.setItem("nohide", true);
- show();
- emojiToggle(true);
- $("#left-side").hide();
- $("#default-emoji").hide();
+ $('#reply').val(id)
+ $('#unreact').hide()
+ $('#addreact').removeClass('hide')
+ $('#post-acct-sel').val(acct_id)
+ $('select').formSelect()
+ localStorage.setItem('nohide', true)
+ show()
+ emojiToggle(true)
+ $('#left-side').hide()
+ $('#default-emoji').hide()
}
function reactRefresh(acct_id, id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/notes/show";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/notes/show'
- var req = {};
- req.i = at;
- req.noteId = id;
+ var req = {}
+ req.i = at
+ req.noteId = id
var i = {
- method: "POST",
+ method: 'POST',
body: JSON.stringify(req)
- };
+ }
fetch(start, i)
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (!json) {
- return false;
+ return false
}
- var poll = "";
+ var poll = ''
if (json.error) {
- $("[toot-id=" + id + "]").hide();
- $("[toot-id=" + id + "]").remove();
+ $('[toot-id=' + id + ']').hide()
+ $('[toot-id=' + id + ']').remove()
} else {
- reactRefreshCore(json);
+ reactRefreshCore(json)
}
- });
+ })
}
function reactRefreshCore(json) {
- var id = json.id;
+ var id = json.id
if (json.reactions) {
- $("#pub_" + id + " .reactions").removeClass("hide");
- var regExp = new RegExp(":", "g");
+ $('#pub_' + id + ' .reactions').removeClass('hide')
+ var regExp = new RegExp(':', 'g')
Object.keys(json.reactions).forEach(function(keye) {
- keyeClass = keye.replace(regExp, "");
+ keyeClass = keye.replace(regExp, '')
if (json.reactions[keye]) {
- $("#pub_" + id + " .re-" + keyeClass + "ct").text(json.reactions[keye]);
- $("#pub_" + id + " .re-" + keyeClass).removeClass("hide");
+ $('#pub_' + id + ' .re-' + keyeClass + 'ct').text(json.reactions[keye])
+ $('#pub_' + id + ' .re-' + keyeClass).removeClass('hide')
} else {
- $("#pub_" + id + " .re-" + keyeClass + "ct").text(0);
- if ($("#pub_" + id + " .reactions").hasClass("fullreact")) {
- $("#pub_" + id + " .re-" + keyeClass).addClass("hide");
+ $('#pub_' + id + ' .re-' + keyeClass + 'ct').text(0)
+ if ($('#pub_' + id + ' .reactions').hasClass('fullreact')) {
+ $('#pub_' + id + ' .re-' + keyeClass).addClass('hide')
}
- $("#pub_" + id + " .re-" + keyeClass + "ct").text(json.reactions[keye]);
+ $('#pub_' + id + ' .re-' + keyeClass + 'ct').text(json.reactions[keye])
}
- });
+ })
}
}
function emojiReaction(emoji) {
- var acct_id = $("#post-acct-sel").val();
- var id = $("#reply").val();
- reaction(emoji, id, acct_id, null);
- clear();
- hide();
+ var acct_id = $('#post-acct-sel').val()
+ var id = $('#reply').val()
+ reaction(emoji, id, acct_id, null)
+ clear()
+ hide()
}
function reaction(mode, id, acct_id, tlid) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if ($(".fav_" + id).hasClass("yellow-text")) {
- var flag = "delete";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if ($('.fav_' + id).hasClass('yellow-text')) {
+ var flag = 'delete'
} else {
- var flag = "create";
+ var flag = 'create'
}
- var start = "https://" + domain + "/api/notes/reactions/" + flag;
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- return false;
+ var start = 'https://' + domain + '/api/notes/reactions/' + flag
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ return false
}
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify({ i: at, noteId: id, reaction: mode }));
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify({ i: at, noteId: id, reaction: mode }))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- $(".fav_" + id).toggleClass("yellow-text");
+ $('.fav_' + id).toggleClass('yellow-text')
}
- };
+ }
}
//Vote
function vote(acct_id, id, to) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/notes/polls/vote";
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- return false;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/notes/polls/vote'
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ return false
}
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify({ i: at, noteId: id, choice: to }));
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify({ i: at, noteId: id, choice: to }))
httpreq.onreadystatechange = function() {
- voterefresh(acct_id, id);
- };
+ voterefresh(acct_id, id)
+ }
}
function voterefresh(acct_id, id) {
- var httpreqd = new XMLHttpRequest();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/notes/show";
- httpreqd.open("POST", start, true);
- httpreqd.setRequestHeader("Content-Type", "application/json");
- httpreqd.responseType = "json";
- httpreqd.send(JSON.stringify({ i: at, noteId: id }));
+ var httpreqd = new XMLHttpRequest()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/notes/show'
+ httpreqd.open('POST', start, true)
+ httpreqd.setRequestHeader('Content-Type', 'application/json')
+ httpreqd.responseType = 'json'
+ httpreqd.send(JSON.stringify({ i: at, noteId: id }))
httpreqd.onreadystatechange = function() {
if (httpreqd.readyState == 4) {
- var json = httpreqd.response;
+ var json = httpreqd.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
if (!json) {
- return false;
+ return false
}
- var poll = "";
+ var poll = ''
if (json.poll) {
- var choices = json.poll.choices;
+ var choices = json.poll.choices
Object.keys(choices).forEach(function(keyc) {
- var choice = choices[keyc];
+ var choice = choices[keyc]
if (choice.isVoted) {
- var myvote = twemoji.parse("✅");
+ var myvote = twemoji.parse('✅')
} else {
- var myvote = "";
+ var myvote = ''
}
- poll = poll + '' + escapeHTML(choice.text) + "(" + choice.votes + "" + myvote + ")
";
- });
- $(".vote_" + json.id).html(poll);
+ //WIP here
+ poll = poll + `${escapeHTML(choice.text)}(${choice.votes})${myvote})
`
+ })
+ $('.vote_' + json.id).html(poll)
}
}
- };
+ }
}
diff --git a/app/js/post/post.js b/app/js/post/post.js
index 7eb95496..e86da973 100644
--- a/app/js/post/post.js
+++ b/app/js/post/post.js
@@ -1,35 +1,39 @@
/*投稿系*/
//投稿
function sec() {
- var mode = localStorage.getItem("sec");
- var acct_id = $("#post-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- if (~domain.indexOf("kirishima.cloud") >= 0 && mode == "local") {
- mode = "unlisted";
+ var mode = localStorage.getItem('sec')
+ var acct_id = $('#post-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (~domain.indexOf('kirishima.cloud') >= 0 && mode == 'local') {
+ mode = 'unlisted'
}
- post(null, mode);
+ post(null, mode)
}
function post(mode, postvis) {
- if ($("#toot-post-btn").prop("disabled")) {
- return false;
+ if ($('#toot-post-btn').prop('disabled')) {
+ return false
}
- var str = $("#textarea").val();
- var acct_id = $("#post-acct-sel").val();
- localStorage.setItem("last-use", acct_id);
- var domain = localStorage.getItem("domain_" + acct_id);
- if (!localStorage.getItem("cw_sentence")) {
- var cw_sent = 500;
+ var str = $('#textarea').val()
+ var acct_id = $('#post-acct-sel').val()
+ localStorage.setItem('last-use', acct_id)
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (!localStorage.getItem('cw_sentence')) {
+ var cw_sent = 500
} else {
- var cw_sent = localStorage.getItem("cw_sentence");
+ var cw_sent = localStorage.getItem('cw_sentence')
}
- if (!localStorage.getItem("cw_letters")) {
- var cw_ltres = 7000;
+ if (!localStorage.getItem('cw_letters')) {
+ var cw_ltres = 7000
} else {
- var cw_ltres = localStorage.getItem("cw_letters");
+ var cw_ltres = localStorage.getItem('cw_letters')
}
- if (domain != "kirishima.cloud") {
- if (mode != "pass" && !$("#cw").hasClass("cw-avail") && (str.length > cw_sent || (str.split("\n").length - 1) > cw_ltres)) {
- var plus = str.replace(/\n/g, "").slice(0, 10) + "...";
+ if (domain != 'kirishima.cloud') {
+ if (
+ mode != 'pass' &&
+ !$('#cw').hasClass('cw-avail') &&
+ (str.length > cw_sent || str.split('\n').length - 1 > cw_ltres)
+ ) {
+ var plus = str.replace(/\n/g, '').slice(0, 10) + '...'
Swal.fire({
title: lang.lang_post_cwtitle,
text: lang.lang_post_cwtxt + plus,
@@ -40,34 +44,34 @@ function post(mode, postvis) {
confirmButtonText: lang.lang_post_btn2,
cancelButtonText: lang.lang_post_btn3,
showCloseButton: true,
- focusConfirm: false,
- }).then((result) => {
- if (result.dismiss == "cancel") {
+ focusConfirm: false
+ }).then(result => {
+ if (result.dismiss == 'cancel') {
//btn3:sonomama
- post("pass")
+ post('pass')
} else if (result.value) {
//btn2:auto-CW
- $("#cw-text").show();
- $("#cw").addClass("yellow-text");
- $("#cw").addClass("cw-avail");
- $("#cw-text").val(plus);
- post("pass")
+ $('#cw-text').show()
+ $('#cw').addClass('yellow-text')
+ $('#cw').addClass('cw-avail')
+ $('#cw-text').val(plus)
+ post('pass')
}
})
- return false;
+ return false
}
}
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- misskeyPost();
- return;
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ misskeyPost()
+ return
}
- $(".toot-btn-group").prop("disabled", true);
- todo("Posting");
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/statuses";
- var reply = $("#reply").val();
- if (str.indexOf(localStorage.getItem("stable")) == -1) {
- str + " #" + localStorage.getItem("stable");
+ $('.toot-btn-group').prop('disabled', true)
+ todo('Posting')
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/statuses'
+ var reply = $('#reply').val()
+ if (str.indexOf(localStorage.getItem('stable')) == -1) {
+ str + ' #' + localStorage.getItem('stable')
}
var toot = {
status: str
@@ -75,66 +79,66 @@ function post(mode, postvis) {
if (reply) {
toot.in_reply_to_id = reply
}
- var media = $("#media").val();
+ var media = $('#media').val()
if (media) {
- toot.media_ids = media.split(",");
+ toot.media_ids = media.split(',')
}
- var quote = $("#quote").val();
+ var quote = $('#quote').val()
if (quote) {
- toot.quote_id = quote;
+ toot.quote_id = quote
}
- if ($("#nsfw").hasClass("nsfw-avail")) {
- var nsfw = "true";
- toot.sensitive = nsfw;
+ if ($('#nsfw').hasClass('nsfw-avail')) {
+ var nsfw = 'true'
+ toot.sensitive = nsfw
} else {
- var nsfw = "false";
+ var nsfw = 'false'
}
if (postvis) {
- var vis = postvis;
+ var vis = postvis
} else {
- var vis = $("#vis").text();
+ var vis = $('#vis').text()
}
- if (vis != "inherit" && vis != "local") {
- toot.visibility = vis;
- } else if (vis == "local") {
- toot.status = str + "👁️";
+ if (vis != 'inherit' && vis != 'local') {
+ toot.visibility = vis
+ } else if (vis == 'local') {
+ toot.status = str + '👁️'
}
- if ($("#cw").hasClass("cw-avail")) {
- var spo = $("#cw-text").val();
- cw();
- toot.spoiler_text = spo;
+ if ($('#cw').hasClass('cw-avail')) {
+ var spo = $('#cw-text').val()
+ cw()
+ toot.spoiler_text = spo
} else {
- var spo = "";
+ var spo = ''
}
- if ($("#sch-box").hasClass("sch-avail")) {
- var scheduled = formattimeutc(new Date(Date.parse($("#sch-date").val())))
- console.log("This toot will be posted at:" + scheduled)
- schedule();
- toot.scheduled_at = scheduled;
+ if ($('#sch-box').hasClass('sch-avail')) {
+ var scheduled = formattimeutc(new Date(Date.parse($('#sch-date').val())))
+ console.log('This toot will be posted at:' + scheduled)
+ schedule()
+ toot.scheduled_at = scheduled
} else {
- var scheduled = "";
+ var scheduled = ''
}
- if (!$("#poll").hasClass("hide")) {
- var options = [];
- $(".mastodon-choice").map(function () {
- var choice = $(this).val();
- if (choice != "") {
- options.push(choice);
+ if (!$('#poll').hasClass('hide')) {
+ var options = []
+ $('.mastodon-choice').map(function() {
+ var choice = $(this).val()
+ if (choice != '') {
+ options.push(choice)
}
- });
- if ($("#poll-multiple:checked").val() == "1") {
- var mul = true;
+ })
+ if ($('#poll-multiple:checked').val() == '1') {
+ var mul = true
} else {
- var mul = false;
+ var mul = false
}
- if ($("#poll-until:checked").val() == "1") {
- var htt = true;
+ if ($('#poll-until:checked').val() == '1') {
+ var htt = true
} else {
- var htt = false;
+ var htt = false
}
- var exin = pollCalc();
+ var exin = pollCalc()
if (!exin) {
- todc("Error: Poll expires_in param")
+ todc('Error: Poll expires_in param')
}
toot.poll = {
options: options,
@@ -143,167 +147,174 @@ function post(mode, postvis) {
hide_totals: htt
}
}
- console.table(toot);
- var httpreq = new XMLHttpRequest();
- httpreq.open('POST', start, true);
- httpreq.setRequestHeader('Content-Type', 'application/json');
- httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify(toot));
- httpreq.onreadystatechange = function () {
+ console.table(toot)
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify(toot))
+ httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
- if(this.status!==200){ setLog(start, this.status, json); }
- var box = localStorage.getItem("box");
- if (box == "yes" || !box) {
- $("#textarea").blur();
- hide();
+ var json = httpreq.response
+ if (this.status !== 200) {
+ setLog(start, this.status, json)
}
- $(".toot-btn-group").prop("disabled", false);
- todc();
- clear();
+ var box = localStorage.getItem('box')
+ if (box == 'yes' || !box) {
+ $('#textarea').blur()
+ hide()
+ }
+ $('.toot-btn-group').prop('disabled', false)
+ todc()
+ clear()
}
}
}
function misskeyPost() {
- var str = $("#textarea").val();
- var acct_id = $("#post-acct-sel").val();
- localStorage.setItem("last-use", acct_id);
- var domain = localStorage.getItem("domain_" + acct_id);
- $(".toot-btn-group").prop("disabled", true);
- todo("Posting");
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/notes/create";
- var reply = $("#reply").val();
+ var str = $('#textarea').val()
+ var acct_id = $('#post-acct-sel').val()
+ localStorage.setItem('last-use', acct_id)
+ var domain = localStorage.getItem('domain_' + acct_id)
+ $('.toot-btn-group').prop('disabled', true)
+ todo('Posting')
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/notes/create'
+ var reply = $('#reply').val()
var toot = {
text: str
}
if (reply) {
- if (reply.indexOf("renote") !== -1) {
- toot.renoteId = reply.replace("renote_", "")
+ if (reply.indexOf('renote') !== -1) {
+ toot.renoteId = reply.replace('renote_', '')
} else {
toot.replyId = reply
}
}
- var media = $("#media").val();
+ var media = $('#media').val()
if (media) {
- toot.mediaIds = media.split(",");
+ toot.mediaIds = media.split(',')
}
- if ($("#nsfw").hasClass("nsfw-avail")) {
- var nsfw = "true";
- toot.sensitive = nsfw;
+ if ($('#nsfw').hasClass('nsfw-avail')) {
+ var nsfw = 'true'
+ toot.sensitive = nsfw
} else {
- var nsfw = "false";
+ var nsfw = 'false'
}
- var vis = $("#vis").text();
- if (vis == "unlisted") {
- vis = "home"
- } else if (vis == "direct") {
- vis = "specified";
- toot.visibleUserIds = str.match(/@([a-zA-Z0-9_@.-]+)(\s|$)/g).join('').split("@");
+ var vis = $('#vis').text()
+ if (vis == 'unlisted') {
+ vis = 'home'
+ } else if (vis == 'direct') {
+ vis = 'specified'
+ toot.visibleUserIds = str
+ .match(/@([a-zA-Z0-9_@.-]+)(\s|$)/g)
+ .join('')
+ .split('@')
}
- if (vis != "inherit") {
- toot.visibility = vis;
+ if (vis != 'inherit') {
+ toot.visibility = vis
}
- if ($("#cw").hasClass("cw-avail")) {
- var spo = $("#cw-text").val();
- cw();
- toot.cw = spo;
+ if ($('#cw').hasClass('cw-avail')) {
+ var spo = $('#cw-text').val()
+ cw()
+ toot.cw = spo
} else {
- var spo = "";
+ var spo = ''
}
- toot.i = at;
- var httpreq = new XMLHttpRequest();
- httpreq.open('POST', start, true);
- httpreq.setRequestHeader('Content-Type', 'application/json');
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify(toot));
- httpreq.onreadystatechange = function () {
+ toot.i = at
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify(toot))
+ httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- if (str.indexOf(localStorage.getItem("stable")) == -1) {
- localStorage.removeItem("stable")
+ if (str.indexOf(localStorage.getItem('stable')) == -1) {
+ localStorage.removeItem('stable')
}
- var json = httpreq.response;
- if(this.status!==200){ setLog(start, this.status, json); }
- console.log(["Success: toot", json]);
- var box = localStorage.getItem("box");
- if (box == "yes") {
- hide();
- } else if (box == "hide") {
- $("body").addClass("mini-post");
- $(".mini-btn").text("expand_less");
+ var json = httpreq.response
+ if (this.status !== 200) {
+ setLog(start, this.status, json)
}
- $(".toot-btn-group").prop("disabled", false);
- todc();
- clear();
+ console.log(['Success: toot', json])
+ var box = localStorage.getItem('box')
+ if (box == 'yes') {
+ hide()
+ } else if (box == 'hide') {
+ $('body').addClass('mini-post')
+ $('.mini-btn').text('expand_less')
+ }
+ $('.toot-btn-group').prop('disabled', false)
+ todc()
+ clear()
}
}
}
//クリア(Shift+C)
function clear() {
- $("#textarea").val("");
- if (localStorage.getItem("stable")) {
- $("#textarea").val("#" + localStorage.getItem("stable") + " ")
+ $('#textarea').val('')
+ if (localStorage.getItem('stable')) {
+ $('#textarea').val('#' + localStorage.getItem('stable') + ' ')
}
- $("#textarea").attr("placeholder", lang.lang_toot);
- $("#reply").val("");
- $("#quote").val("");
- $("#media").val("");
- var cwt = localStorage.getItem("cw-text");
+ $('#textarea').attr('placeholder', lang.lang_toot)
+ $('#reply').val('')
+ $('#quote').val('')
+ $('#media').val('')
+ var cwt = localStorage.getItem('cw-text')
if (cwt) {
- $("#cw-text").val(cwt);
+ $('#cw-text').val(cwt)
} else {
- $("#cw-text").val("");
+ $('#cw-text').val('')
}
- var acw = localStorage.getItem("always-cw");
- if (acw != "yes") {
- $("#cw").removeClass("yellow-text");
- $("#cw").removeClass("cw-avail");
- $("#cw-text").hide();
+ var acw = localStorage.getItem('always-cw')
+ if (acw != 'yes') {
+ $('#cw').removeClass('yellow-text')
+ $('#cw').removeClass('cw-avail')
+ $('#cw-text').hide()
} else {
- $("#cw").addClass("yellow-text");
- $("#cw").addClass("cw-avail");
- $("#cw-text").show();
+ $('#cw').addClass('yellow-text')
+ $('#cw').addClass('cw-avail')
+ $('#cw-text').show()
}
- $("#rec").text(lang.lang_no);
- $("#mec").text(lang.lang_nothing);
- loadVis();
- $("#nsfw").removeClass("yellow-text");
- $("#nsfw").html("visibility_off");
- $("#nsfw").removeClass("nsfw-avail");
- $("#nsc").text(lang.lang_nothing);
- $("#drag").css("background-color", "#e0e0e0");
- $("#preview").html("");
- $(".toot-btn-group").prop("disabled", false);
- $("#post-acct-sel").prop("disabled", false);
- $("#days_poll").val(0);
- $("#hours_poll").val(0);
- $("#mins_poll").val(6);
- $("#poll").addClass("hide")
- $("#pollsta").text(lang.lang_no)
- $(".mastodon-choice").map(function () {
- $(this).val("");
- });
- localStorage.removeItem("image");
- if (localStorage.getItem("mainuse") == "main") {
- $("#post-acct-sel").val(localStorage.getItem("main"));
+ $('#rec').text(lang.lang_no)
+ $('#mec').text(lang.lang_nothing)
+ loadVis()
+ $('#nsfw').removeClass('yellow-text')
+ $('#nsfw').html('visibility_off')
+ $('#nsfw').removeClass('nsfw-avail')
+ $('#nsc').text(lang.lang_nothing)
+ $('#drag').css('background-color', '#e0e0e0')
+ $('#preview').html('')
+ $('.toot-btn-group').prop('disabled', false)
+ $('#post-acct-sel').prop('disabled', false)
+ $('#days_poll').val(0)
+ $('#hours_poll').val(0)
+ $('#mins_poll').val(6)
+ $('#poll').addClass('hide')
+ $('#pollsta').text(lang.lang_no)
+ $('.mastodon-choice').map(function() {
+ $(this).val('')
+ })
+ localStorage.removeItem('image')
+ if (localStorage.getItem('mainuse') == 'main') {
+ $('#post-acct-sel').val(localStorage.getItem('main'))
}
- $("#emoji").addClass("hide")
- $('select').formSelect();
- $("#default-emoji").show();
- $("#unreact").show();
- $("#addreact").addClass("hide");
- $("#right-side").hide()
- $("#right-side").css("width", "300px")
- $("#left-side").css("width", "100%")
- var width = localStorage.getItem("postbox-width");
- if(width){
- width = width.replace("px", "") * 1
+ $('#emoji').addClass('hide')
+ $('select').formSelect()
+ $('#default-emoji').show()
+ $('#unreact').show()
+ $('#addreact').addClass('hide')
+ $('#right-side').hide()
+ $('#right-side').css('width', '300px')
+ $('#left-side').css('width', '100%')
+ var width = localStorage.getItem('postbox-width')
+ if (width) {
+ width = width.replace('px', '') * 1
} else {
width = 300
}
- $("#post-box").css("width", width)
+ $('#post-box').css('width', width)
mdCheck()
-}
\ No newline at end of file
+}
diff --git a/app/js/post/secure.js b/app/js/post/secure.js
index 770e19e2..ce66d7f6 100644
--- a/app/js/post/secure.js
+++ b/app/js/post/secure.js
@@ -1,130 +1,128 @@
/*保護系*/
//画像保護
function nsfw() {
- if ($("#nsfw").hasClass("nsfw-avail")) {
- $("#nsfw").removeClass("yellow-text");
- $("#nsfw").html("visibility_off");
- $("#nsfw").removeClass("nsfw-avail");
+ if ($('#nsfw').hasClass('nsfw-avail')) {
+ $('#nsfw').removeClass('yellow-text')
+ $('#nsfw').html('visibility_off')
+ $('#nsfw').removeClass('nsfw-avail')
} else {
- $("#nsfw").addClass("yellow-text");
- $("#nsfw").html("visibility");
- $("#nsfw").addClass("nsfw-avail");
+ $('#nsfw').addClass('yellow-text')
+ $('#nsfw').html('visibility')
+ $('#nsfw').addClass('nsfw-avail')
}
}
//投稿公開範囲
function vis(set) {
- $("#vis").text(set);
- $("#vis-icon").removeClass("red-text");
- $("#vis-icon").removeClass("orange-text");
- $("#vis-icon").removeClass("blue-text");
- $("#vis-icon").removeClass("purple-text");
- $("#vis-icon").removeClass("light-blue-text");
- $("#vis-icon").removeClass("teal-text");
- if (set == "public") {
- $("#vis-icon").text("public");
- $("#vis-icon").addClass("purple-text");
- } else if (set == "unlisted") {
- $("#vis-icon").text("lock_open");
- $("#vis-icon").addClass("blue-text");
- } else if (set == "private") {
- $("#vis-icon").text("lock");
- $("#vis-icon").addClass("orange-text");
- } else if (set == "direct") {
- $("#vis-icon").text("mail");
- $("#vis-icon").addClass("red-text");
- } else if (set == "limited") {
- $("#vis-icon").text("group");
- $("#vis-icon").addClass("teal-text");
- } else if (set == "local") {
- $("#vis-icon").text("visibility");
- $("#vis-icon").addClass("light-blue-text");
+ $('#vis').text(set)
+ $('#vis-icon').removeClass('red-text')
+ $('#vis-icon').removeClass('orange-text')
+ $('#vis-icon').removeClass('blue-text')
+ $('#vis-icon').removeClass('purple-text')
+ $('#vis-icon').removeClass('light-blue-text')
+ $('#vis-icon').removeClass('teal-text')
+ if (set == 'public') {
+ $('#vis-icon').text('public')
+ $('#vis-icon').addClass('purple-text')
+ } else if (set == 'unlisted') {
+ $('#vis-icon').text('lock_open')
+ $('#vis-icon').addClass('blue-text')
+ } else if (set == 'private') {
+ $('#vis-icon').text('lock')
+ $('#vis-icon').addClass('orange-text')
+ } else if (set == 'direct') {
+ $('#vis-icon').text('mail')
+ $('#vis-icon').addClass('red-text')
+ } else if (set == 'limited') {
+ $('#vis-icon').text('group')
+ $('#vis-icon').addClass('teal-text')
+ } else if (set == 'local') {
+ $('#vis-icon').text('visibility')
+ $('#vis-icon').addClass('light-blue-text')
}
- var vis = localStorage.getItem("vis");
- if (vis == "memory") {
- var acct_id = $("#post-acct-sel").val();
- localStorage.setItem("vis-memory-" + acct_id, set);
+ var vis = localStorage.getItem('vis')
+ if (vis == 'memory') {
+ var acct_id = $('#post-acct-sel').val()
+ localStorage.setItem('vis-memory-' + acct_id, set)
}
var ins = M.Dropdown.getInstance($('#dropdown1'))
- if(ins){
- ins.close();
+ if (ins) {
+ ins.close()
}
}
function loadVis() {
- var vist = localStorage.getItem("vis");
+ var vist = localStorage.getItem('vis')
if (!vist) {
- vis("public");
+ vis('public')
} else {
- if (vist == "memory") {
- var acct_id = $("#post-acct-sel").val();
- var memory = localStorage.getItem("vis-memory-" + acct_id);
+ if (vist == 'memory') {
+ var acct_id = $('#post-acct-sel').val()
+ var memory = localStorage.getItem('vis-memory-' + acct_id)
if (!memory) {
- memory = "public";
+ memory = 'public'
}
- vis(memory);
- } else if (vist == "useapi") {
- var acct_id = $("#post-acct-sel").val();
- var multi = localStorage.getItem("multi");
- var obj = JSON.parse(multi);
- var memory = obj[acct_id]["vis"];
+ vis(memory)
+ } else if (vist == 'useapi') {
+ var acct_id = $('#post-acct-sel').val()
+ var multi = localStorage.getItem('multi')
+ var obj = JSON.parse(multi)
+ var memory = obj[acct_id]['vis']
if (!memory) {
- memory = "public";
+ memory = 'public'
}
- vis(memory);
+ vis(memory)
} else {
- vis(vist);
+ vis(vist)
}
}
}
-loadVis();
+loadVis()
//コンテントワーニング
function cw() {
- if ($("#cw").hasClass("cw-avail")) {
- $("#cw-text").val();
- $("#cw-text").hide();
- $("#cw").removeClass("yellow-text");
- $("#cw").removeClass("cw-avail");
+ if ($('#cw').hasClass('cw-avail')) {
+ $('#cw-text').val()
+ $('#cw-text').hide()
+ $('#cw').removeClass('yellow-text')
+ $('#cw').removeClass('cw-avail')
} else {
- $("#cw-text").show();
- $("#cw").addClass("yellow-text");
- $("#cw").addClass("cw-avail");
- var cwt = localStorage.getItem("cw-text");
+ $('#cw-text').show()
+ $('#cw').addClass('yellow-text')
+ $('#cw').addClass('cw-avail')
+ var cwt = localStorage.getItem('cw-text')
if (cwt) {
- $("#cw-text").val(cwt);
+ $('#cw-text').val(cwt)
}
}
}
//TLでコンテントワーニングを表示トグル
function cw_show(id) {
- $(".cw_hide_" + id).toggleClass("cw");
- $(".cw-long-" + id).toggleClass("hide");
+ $('.cw_hide_' + id).toggleClass('cw')
+ $('.cw-long-' + id).toggleClass('hide')
}
-$(function () {
- $('#cw-text').on('change', function (event) {
- var acct_id = $("#post-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- var cwlen = $('#cw-text').val().length;
+$(function() {
+ $('#cw-text').on('change', function(event) {
+ var acct_id = $('#post-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var cwlen = $('#cw-text').val().length
- if (idata[domain + "_letters"]) {
- $("#textarea").attr("data-length", idata[domain + "_letters"] - cwlen)
+ if (idata[domain + '_letters']) {
+ $('#textarea').attr('data-length', idata[domain + '_letters'] - cwlen)
} else {
- $("#textarea").attr("data-length", 500 - cwlen)
+ $('#textarea').attr('data-length', 500 - cwlen)
}
-
-
- });
-});
+ })
+})
//スケジュール
function schedule() {
- if ($("#sch-box").hasClass("sch-avail")) {
- $("#sch-box").hide();
- $("#sch-box").removeClass("sch-avail");
+ if ($('#sch-box').hasClass('sch-avail')) {
+ $('#sch-box').hide()
+ $('#sch-box').removeClass('sch-avail')
} else {
- var date = new Date();
+ var date = new Date()
- $("#sch-box").show();
- $("#sch-date").val(formattime(date));
- $("#sch-box").addClass("sch-avail");
+ $('#sch-box').show()
+ $('#sch-date').val(formattime(date))
+ $('#sch-box').addClass('sch-avail')
}
}
diff --git a/app/js/post/status.js b/app/js/post/status.js
index 9f2e4a5f..a2418b09 100644
--- a/app/js/post/status.js
+++ b/app/js/post/status.js
@@ -1,596 +1,596 @@
//お気に入り登録やブースト等、フォローやブロック等
//お気に入り登録
function fav(id, acct_id, remote) {
- if ($("#pub_" + id).hasClass("faved")) {
- var flag = "unfavourite";
+ if ($('#pub_' + id).hasClass('faved')) {
+ var flag = 'unfavourite'
} else {
- var flag = "favourite";
+ var flag = 'favourite'
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
if (json.reblog) {
- json = json.reblog;
+ json = json.reblog
}
- if (remote != "remote") {
+ if (remote != 'remote') {
//APIのふぁぼカウントがおかしい
- if ($("[unique-id=" + id + "] .fav_ct").text() == json.favourites_count) {
- if (flag == "unfavourite") {
- var fav = json.favourites_count - 1;
+ if ($('[unique-id=' + id + '] .fav_ct').text() == json.favourites_count) {
+ if (flag == 'unfavourite') {
+ var fav = json.favourites_count - 1
if (fav * 1 < 0) {
- fav = 0;
+ fav = 0
}
} else {
- var fav = json.favourites_count;
+ var fav = json.favourites_count
//var fav = json.favourites_count;
}
} else {
- var fav = json.favourites_count;
+ var fav = json.favourites_count
}
- $("[unique-id=" + id + "] .fav_ct").text(fav);
- $("[unique-id=" + id + "] .rt_ct").text(json.reblogs_count);
- if ($("[unique-id=" + id + "]").hasClass("faved")) {
- $("[unique-id=" + id + "]").removeClass("faved");
- $(".fav_" + id).removeClass("yellow-text");
+ $('[unique-id=' + id + '] .fav_ct').text(fav)
+ $('[unique-id=' + id + '] .rt_ct').text(json.reblogs_count)
+ if ($('[unique-id=' + id + ']').hasClass('faved')) {
+ $('[unique-id=' + id + ']').removeClass('faved')
+ $('.fav_' + id).removeClass('yellow-text')
} else {
- $("[unique-id=" + id + "]").addClass("faved");
- $(".fav_" + id).addClass("yellow-text");
+ $('[unique-id=' + id + ']').addClass('faved')
+ $('.fav_' + id).addClass('yellow-text')
}
} else {
- M.toast({ html: lang.lang_status_favWarn, displayLength: 1000 });
+ M.toast({ html: lang.lang_status_favWarn, displayLength: 1000 })
}
}
- };
+ }
}
//ブースト
function rt(id, acct_id, remote, vis) {
- if ($("#pub_" + id).hasClass("rted")) {
- var flag = "unreblog";
+ if ($('#pub_' + id).hasClass('rted')) {
+ var flag = 'unreblog'
} else {
- var flag = "reblog";
+ var flag = 'reblog'
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
if (vis) {
- httpreq.send(JSON.stringify({ visibility: vis }));
+ httpreq.send(JSON.stringify({ visibility: vis }))
} else {
- httpreq.send();
+ httpreq.send()
}
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
if (json.reblog) {
- json = json.reblog;
+ json = json.reblog
}
- console.log(["Success: boost", json]);
- $("[unique-id=" + id + "] .fav_ct").text(json.favourites_count);
+ console.log(['Success: boost', json])
+ $('[unique-id=' + id + '] .fav_ct').text(json.favourites_count)
if (!json.reblog) {
- if (flag == "unreblog") {
- var rt = json.reblogs_count - 1;
+ if (flag == 'unreblog') {
+ var rt = json.reblogs_count - 1
if (rt * 1 < 0) {
- rt = 0;
+ rt = 0
}
} else {
- var rt = json.reblogs_count;
+ var rt = json.reblogs_count
}
- $("[unique-id=" + id + "] .rt_ct").text(rt);
+ $('[unique-id=' + id + '] .rt_ct').text(rt)
} else {
- $("[unique-id=" + id + "] .rt_ct").text(json.reblogs_count);
+ $('[unique-id=' + id + '] .rt_ct').text(json.reblogs_count)
}
- if ($("[unique-id=" + id + "]").hasClass("rted")) {
- $("[unique-id=" + id + "]").removeClass("rted");
- $(".rt_" + id).removeClass("light-blue-text");
+ if ($('[unique-id=' + id + ']').hasClass('rted')) {
+ $('[unique-id=' + id + ']').removeClass('rted')
+ $('.rt_' + id).removeClass('light-blue-text')
} else {
- $("[unique-id=" + id + "]").addClass("rted");
- $(".rt_" + id).addClass("light-blue-text");
+ $('[unique-id=' + id + ']').addClass('rted')
+ $('.rt_' + id).addClass('light-blue-text')
}
}
- };
+ }
}
function boostWith(vis) {
- var id = $("#tootmodal").attr("data-id");
- var acct_id = $("#tootmodal").attr("data-acct");
- rt(id, acct_id, false, vis);
+ var id = $('#tootmodal').attr('data-id')
+ var acct_id = $('#tootmodal').attr('data-acct')
+ rt(id, acct_id, false, vis)
}
//フォロー
async function follow(acct_id, resolve) {
- if (!acct_id && acct_id != "selector") {
- var acct_id = $("#his-data").attr("use-acct");
- } else if (acct_id == "selector") {
- var acct_id = $("#user-acct-sel").val();
+ if (!acct_id && acct_id != 'selector') {
+ var acct_id = $('#his-data').attr('use-acct')
+ } else if (acct_id == 'selector') {
+ var acct_id = $('#user-acct-sel').val()
}
- if (!resolve && $("#his-data").hasClass("following")) {
- var flag = "unfollow";
- var flagm = "delete";
+ if (!resolve && $('#his-data').hasClass('following')) {
+ var flag = 'unfollow'
+ var flagm = 'delete'
} else {
- var flag = "follow";
- var flagm = "create";
+ var flag = 'follow'
+ var flagm = 'create'
}
- var id = $("#his-data").attr("user-id");
- if (resolve == "selector") {
- var fullacct = $("#his-acct").attr("fullname");
- var id = await acctResolve(acct_id, fullacct);
- console.log(id);
+ var id = $('#his-data').attr('user-id')
+ if (resolve == 'selector') {
+ var fullacct = $('#his-acct').attr('fullname')
+ var id = await acctResolve(acct_id, fullacct)
+ console.log(id)
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/following/" + flagm;
- var ent = { i: at, userId: id };
- } else if (flag == "follow") {
- var ent = {};
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/accounts/' + id + '/' + flag
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/following/' + flagm
+ var ent = { i: at, userId: id }
+ } else if (flag == 'follow') {
+ var ent = {}
}
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify(ent));
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify(ent))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, json);
+ setLog(start, this.status, json)
}
- console.log(["Success: folllow", json]);
- if ($("#his-data").hasClass("following")) {
- $("#his-data").removeClass("following");
- $("#his-follow-btn-text").text(lang.lang_status_follow);
+ console.log(['Success: folllow', json])
+ if ($('#his-data').hasClass('following')) {
+ $('#his-data').removeClass('following')
+ $('#his-follow-btn-text').text(lang.lang_status_follow)
} else {
- $("#his-data").addClass("following");
- $("#his-follow-btn-text").text(lang.lang_status_unfollow);
+ $('#his-data').addClass('following')
+ $('#his-follow-btn-text').text(lang.lang_status_unfollow)
}
}
- };
+ }
}
async function acctResolve(acct_id, user) {
- console.log("Get user data of " + user);
- var domain = localStorage.getItem("domain_" + acct_id);
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- return false;
+ console.log('Get user data of ' + user)
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ return false
}
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + user;
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + user
let promise = await fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
- });
- var idJson = await promise.json();
+ })
+ var idJson = await promise.json()
if (idJson.accounts[0]) {
- var id = idJson.accounts[0].id;
+ var id = idJson.accounts[0].id
} else {
- M.toast({ html: lang.lang_fatalerroroccured, displayLength: 2000 });
+ M.toast({ html: lang.lang_fatalerroroccured, displayLength: 2000 })
}
- return id;
+ return id
}
//ブロック
function block(acct_id) {
- if ($("#his-data").hasClass("blocking")) {
- var flag = "unblock";
- var txt = lang.lang_status_unmute;
+ if ($('#his-data').hasClass('blocking')) {
+ var flag = 'unblock'
+ var txt = lang.lang_status_unmute
} else {
- var flag = "block";
- var txt = lang.lang_status_block;
+ var flag = 'block'
+ var txt = lang.lang_status_block
}
Swal.fire({
title: txt,
- text: "",
- type: "warning",
+ text: '',
+ type: 'warning',
showCancelButton: true,
- confirmButtonColor: "#3085d6",
- cancelButtonColor: "#d33",
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
if (result.value) {
if (!acct_id) {
- var acct_id = $("#his-data").attr("use-acct");
+ var acct_id = $('#his-data').attr('use-acct')
}
- var id = $("#his-data").attr("user-id");
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var id = $('#his-data').attr('user-id')
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/accounts/' + id + '/' + flag
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- if ($("#his-data").hasClass("blocking")) {
- $("#his-data").removeClass("blocking");
- $("#his-block-btn-text").text(lang.lang_status_block);
+ if ($('#his-data').hasClass('blocking')) {
+ $('#his-data').removeClass('blocking')
+ $('#his-block-btn-text').text(lang.lang_status_block)
} else {
- $("#his-data").addClass("blocking");
- $("#his-block-btn-text").text(lang.lang_status_unblock);
+ $('#his-data').addClass('blocking')
+ $('#his-block-btn-text').text(lang.lang_status_unblock)
}
}
- };
+ }
}
- });
+ })
}
//ミュート
function muteDo(acct_id) {
- if ($("#his-data").hasClass("muting")) {
- var flag = "unmute";
- var flagm = "delete";
- var txt = lang.lang_status_unmute;
+ if ($('#his-data').hasClass('muting')) {
+ var flag = 'unmute'
+ var flagm = 'delete'
+ var txt = lang.lang_status_unmute
} else {
- var flag = "mute";
- var flagm = "create";
- var txt = lang.lang_status_mute;
+ var flag = 'mute'
+ var flagm = 'create'
+ var txt = lang.lang_status_mute
}
Swal.fire({
title: txt,
- text: "",
- type: "warning",
+ text: '',
+ type: 'warning',
showCancelButton: true,
- confirmButtonColor: "#3085d6",
- cancelButtonColor: "#d33",
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
if (result.value) {
if (!acct_id) {
- var acct_id = $("#his-data").attr("use-acct");
+ var acct_id = $('#his-data').attr('use-acct')
}
- var id = $("#his-data").attr("user-id");
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/mute/" + flagm;
- var ent = { i: at, userId: id };
- var rq = JSON.stringify(ent);
+ var id = $('#his-data').attr('user-id')
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/mute/' + flagm
+ var ent = { i: at, userId: id }
+ var rq = JSON.stringify(ent)
} else {
- var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
- var rq = "";
+ var start = 'https://' + domain + '/api/v1/accounts/' + id + '/' + flag
+ var rq = ''
}
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send(rq);
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(rq)
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- if ($("#his-data").hasClass("muting")) {
- $("#his-data").removeClass("muting");
- $("#his-mute-btn-text").text(lang.lang_status_mute);
+ if ($('#his-data').hasClass('muting')) {
+ $('#his-data').removeClass('muting')
+ $('#his-mute-btn-text').text(lang.lang_status_mute)
} else {
- $("#his-data").addClass("muting");
- $("#his-mute-btn-text").text(lang.lang_status_unmute);
+ $('#his-data').addClass('muting')
+ $('#his-mute-btn-text').text(lang.lang_status_unmute)
}
}
- };
+ }
}
- });
+ })
}
//投稿削除
function del(id, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/notes/delete";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify({ i: at, noteId: id }));
- $("[toot-id=" + id + "]").hide();
- $("[toot-id=" + id + "]").remove();
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/notes/delete'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify({ i: at, noteId: id }))
+ $('[toot-id=' + id + ']').hide()
+ $('[toot-id=' + id + ']').remove()
} else {
- var start = "https://" + domain + "/api/v1/statuses/" + id;
- var httpreq = new XMLHttpRequest();
- httpreq.open("DELETE", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var start = 'https://' + domain + '/api/v1/statuses/' + id
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('DELETE', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
}
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
}
- };
+ }
}
//redraft
function redraft(id, acct_id) {
Swal.fire({
title: lang.lang_status_redraftTitle,
text: lang.lang_status_redraft,
- type: "warning",
+ type: 'warning',
showCancelButton: true,
- confirmButtonColor: "#3085d6",
- cancelButtonColor: "#d33",
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
}).then(result => {
if (result.value) {
- show();
- del(id, acct_id);
- $("#post-acct-sel").prop("disabled", true);
- $("#post-acct-sel").val(acct_id);
- $("select").formSelect();
- mdCheck();
- var medias = $("[toot-id=" + id + "]").attr("data-medias");
- var vismode = $("[toot-id=" + id + "] .vis-data").attr("data-vis");
- vis(vismode);
- $("#media").val(medias);
- var ct = medias.split(",").length;
- $("[toot-id=" + id + "] img.toot-img").each(function(i, elem) {
+ show()
+ del(id, acct_id)
+ $('#post-acct-sel').prop('disabled', true)
+ $('#post-acct-sel').val(acct_id)
+ $('select').formSelect()
+ mdCheck()
+ var medias = $('[toot-id=' + id + ']').attr('data-medias')
+ var vismode = $('[toot-id=' + id + '] .vis-data').attr('data-vis')
+ vis(vismode)
+ $('#media').val(medias)
+ var ct = medias.split(',').length
+ $('[toot-id=' + id + '] img.toot-img').each(function(i, elem) {
if (i < ct) {
- var url = $(elem).attr("src");
- console.log("Play back image data:" + url);
- $("#preview").append(' ');
+ var url = $(elem).attr('src')
+ console.log('Play back image data:' + url)
+ $('#preview').append(' ')
}
- });
- var html = $("[toot-id=" + id + "] .toot").html();
- html = html.replace(/^(.+)<\/p>$/, "$1");
- html = html.replace(/ /, "\n");
- html = html.replace(/
/, "\n");
- html = html.replace(/<\/p>/, "\n");
- html = html.replace(/ /g, "$1");
- html = $.strip_tags(html);
- localStorage.setItem("nohide", true);
- show();
- $("#textarea").val(html);
- var cwtxt = $("[toot-id=" + id + "] .cw_text").html();
- if (cwtxt != "") {
- cwtxt = $.strip_tags(cwtxt);
- cw();
- $("#cw-text").val(cwtxt);
+ })
+ var html = $('[toot-id=' + id + '] .toot').html()
+ html = html.replace(/^
(.+)<\/p>$/, '$1')
+ html = html.replace(/ /, '\n')
+ html = html.replace(/
/, '\n')
+ html = html.replace(/<\/p>/, '\n')
+ html = html.replace(/ /g, '$1')
+ html = $.strip_tags(html)
+ localStorage.setItem('nohide', true)
+ show()
+ $('#textarea').val(html)
+ var cwtxt = $('[toot-id=' + id + '] .cw_text').html()
+ if (cwtxt != '') {
+ cwtxt = $.strip_tags(cwtxt)
+ cw()
+ $('#cw-text').val(cwtxt)
}
}
- });
+ })
}
//ピン留め
function pin(id, acct_id) {
- if ($("#pub_" + id).hasClass("pined")) {
- var flag = "unpin";
+ if ($('#pub_' + id).hasClass('pined')) {
+ var flag = 'unpin'
} else {
- var flag = "pin";
+ var flag = 'pin'
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/statuses/" + id + "/" + flag;
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/statuses/' + id + '/' + flag
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- console.log(["Success: pinned", json]);
- if ($("[toot-id=" + id + "]").hasClass("pined")) {
- $("[toot-id=" + id + "]").removeClass("pined");
- $(".pin_" + id).removeClass("blue-text");
+ console.log(['Success: pinned', json])
+ if ($('[toot-id=' + id + ']').hasClass('pined')) {
+ $('[toot-id=' + id + ']').removeClass('pined')
+ $('.pin_' + id).removeClass('blue-text')
} else {
- $("[toot-id=" + id + "]").addClass("pined");
- $(".pin_" + id).addClass("blue-text");
+ $('[toot-id=' + id + ']').addClass('pined')
+ $('.pin_' + id).addClass('blue-text')
}
}
- };
+ }
}
//フォロリク
function request(id, flag, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/follow_requests/" + id + "/" + flag;
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/follow_requests/' + id + '/' + flag
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- console.log(["Success: request", "type:" + flag, json]);
- showReq();
+ console.log(['Success: request', 'type:' + flag, json])
+ showReq()
}
- };
+ }
}
//ドメインブロック(未実装)
function domainblock(add, flag, acct_id) {
if (!acct_id) {
- var acct_id = $("#his-data").attr("use-acct");
+ var acct_id = $('#his-data').attr('use-acct')
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/domain_blocks";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/domain_blocks'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- console.log(["Success: domain block", json]);
- showDom();
+ console.log(['Success: domain block', json])
+ showDom()
}
- };
+ }
}
function addDomainblock() {
- var domain = $("#domainblock").val();
- domainblock(domain, "POST");
+ var domain = $('#domainblock').val()
+ domainblock(domain, 'POST')
}
//ユーザー強調
function empUser() {
- var usr = localStorage.getItem("user_emp");
- var obj = JSON.parse(usr);
- var id = $("#his-acct").attr("fullname");
+ var usr = localStorage.getItem('user_emp')
+ var obj = JSON.parse(usr)
+ var id = $('#his-acct').attr('fullname')
if (!obj) {
- var obj = [];
- obj.push(id);
- M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 });
+ var obj = []
+ obj.push(id)
+ M.toast({ html: id + lang.lang_status_emphas, displayLength: 4000 })
} else {
- var can;
+ var can
Object.keys(obj).forEach(function(key) {
- var usT = obj[key];
+ var usT = obj[key]
if (usT != id && !can) {
- can = false;
+ can = false
} else {
- can = true;
- obj.splice(key, 1);
- M.toast({ html: id + lang.lang_status_unemphas, displayLength: 4000 });
+ can = true
+ obj.splice(key, 1)
+ M.toast({ html: id + lang.lang_status_unemphas, displayLength: 4000 })
}
- });
+ })
}
- var json = JSON.stringify(obj);
- localStorage.setItem("user_emp", json);
+ var json = JSON.stringify(obj)
+ localStorage.setItem('user_emp', json)
}
//Endorse
function pinUser() {
- var id = $("#his-data").attr("user-id");
- var acct_id = $("#his-data").attr("use-acct");
- if ($("#his-end-btn").hasClass("endorsed")) {
- var flag = "unpin";
+ var id = $('#his-data').attr('user-id')
+ var acct_id = $('#his-data').attr('use-acct')
+ if ($('#his-end-btn').hasClass('endorsed')) {
+ var flag = 'unpin'
} else {
- var flag = "pin";
+ var flag = 'pin'
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/accounts/" + id + "/" + flag;
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/accounts/' + id + '/' + flag
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- if ($("#his-end-btn").hasClass("endorsed")) {
- $("#his-end-btn").removeClass("endorsed");
- $("#his-end-btn").text(lang.lang_status_endorse);
+ if ($('#his-end-btn').hasClass('endorsed')) {
+ $('#his-end-btn').removeClass('endorsed')
+ $('#his-end-btn').text(lang.lang_status_endorse)
} else {
- $("#his-end-btn").addClass("endorsed");
- $("#his-end-btn").text(lang.lang_status_unendorse);
+ $('#his-end-btn').addClass('endorsed')
+ $('#his-end-btn').text(lang.lang_status_unendorse)
}
}
- };
+ }
}
//URLコピー
function tootUriCopy(url) {
- execCopy(url);
- M.toast({ html: lang.lang_details_url, displayLength: 1500 });
+ execCopy(url)
+ M.toast({ html: lang.lang_details_url, displayLength: 1500 })
}
//他のアカウントで…
function staEx(mode) {
- var url = $("#tootmodal").attr("data-url");
- var acct_id = $("#status-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + url;
+ var url = $('#tootmodal').attr('data-url')
+ var acct_id = $('#status-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + url
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var id = json.statuses[0].id;
- if (mode == "rt") {
- rt(id, acct_id, "remote");
- } else if (mode == "fav") {
- fav(id, acct_id, "remote");
- } else if (mode == "reply") {
- reEx(id);
+ var id = json.statuses[0].id
+ if (mode == 'rt') {
+ rt(id, acct_id, 'remote')
+ } else if (mode == 'fav') {
+ fav(id, acct_id, 'remote')
+ } else if (mode == 'reply') {
+ reEx(id)
}
- });
- return;
+ })
+ return
}
function toggleAction(id, tlid, acct_id) {
- if (tlid == "notf") {
- var tlide = "[data-acct=" + acct_id + "] .notf-timeline";
- } else if (tlid == "user") {
- var tlide = "#his-tl-contents";
+ if (tlid == 'notf') {
+ var tlide = '[data-acct=' + acct_id + '] .notf-timeline'
+ } else if (tlid == 'user') {
+ var tlide = '#his-tl-contents'
} else {
- var tlide = "[tlid=" + tlid + "]";
+ var tlide = '[tlid=' + tlid + ']'
}
- if (!$(tlide + " [toot-id=" + id + "]").hasClass("ext-mode")) {
- $(tlide + " [toot-id=" + id + "] .type-a").hide();
- $(tlide + " [toot-id=" + id + "] .type-b").show();
- $(tlide + " [toot-id=" + id + "]").addClass("ext-mode");
- $(tlide + " [toot-id=" + id + "] .act-icon").text("expand_less");
+ if (!$(tlide + ' [toot-id=' + id + ']').hasClass('ext-mode')) {
+ $(tlide + ' [toot-id=' + id + '] .type-a').hide()
+ $(tlide + ' [toot-id=' + id + '] .type-b').show()
+ $(tlide + ' [toot-id=' + id + ']').addClass('ext-mode')
+ $(tlide + ' [toot-id=' + id + '] .act-icon').text('expand_less')
} else {
- $(tlide + " [toot-id=" + id + "] .type-b").hide();
- $(tlide + " [toot-id=" + id + "] .type-a").show();
- $(tlide + " [toot-id=" + id + "]").removeClass("ext-mode");
- $(tlide + " [toot-id=" + id + "] .act-icon").text("expand_more");
+ $(tlide + ' [toot-id=' + id + '] .type-b').hide()
+ $(tlide + ' [toot-id=' + id + '] .type-a').show()
+ $(tlide + ' [toot-id=' + id + ']').removeClass('ext-mode')
+ $(tlide + ' [toot-id=' + id + '] .act-icon').text('expand_more')
}
}
diff --git a/app/js/post/suggest.js b/app/js/post/suggest.js
index 8da067ce..8f248ff4 100644
--- a/app/js/post/suggest.js
+++ b/app/js/post/suggest.js
@@ -1,254 +1,262 @@
//入力時にハッシュタグと@をサジェスト
-var timer = null;
+var timer = null
-var input = document.getElementById("textarea");
+var input = document.getElementById('textarea')
-var prev_val = input.value;
-var oldSuggest;
-var suggest;
+var prev_val = input.value
+var oldSuggest
+var suggest
input.addEventListener(
- "focus",
+ 'focus',
function() {
- localStorage.removeItem("cursor");
- var acct_id = $("#post-acct-sel").val();
- $("#suggest").html("");
- window.clearInterval(timer);
+ localStorage.removeItem('cursor')
+ var acct_id = $('#post-acct-sel').val()
+ $('#suggest').html('')
+ window.clearInterval(timer)
timer = window.setInterval(function() {
- var new_val = input.value;
- if (new_val == "") {
- $("#suggest").html("");
- if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
- $("#right-side").hide();
- $("#right-side").css("width", "300px");
- $("#left-side").css("width", "100%");
- var width = localStorage.getItem("postbox-width");
+ var new_val = input.value
+ if (new_val == '') {
+ $('#suggest').html('')
+ if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
+ $('#right-side').hide()
+ $('#right-side').css('width', '300px')
+ $('#left-side').css('width', '100%')
+ var width = localStorage.getItem('postbox-width')
if (width) {
- width = width.replace("px", "") * 1;
+ width = width.replace('px', '') * 1
} else {
- width = 300;
+ width = 300
}
- $("#post-box").css("width", width + "px");
+ $('#post-box').css('width', width + 'px')
}
- return;
+ return
}
if (prev_val != new_val) {
- var tag = new_val.match(/#(\S{3,})/);
- var acct = new_val.match(/@(\S{3,})/);
+ var tag = new_val.match(/#(\S{3,})/)
+ var acct = new_val.match(/@(\S{3,})/)
if (tag && tag[1]) {
- var q = tag[1];
+ var q = tag[1]
} else if (acct && acct[1]) {
- var q = acct[1];
+ var q = acct[1]
} else {
- $("#suggest").html("");
- if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
- $("#right-side").hide();
- $("#right-side").css("width", "300px");
- $("#left-side").css("width", "100%");
- var width = localStorage.getItem("postbox-width");
+ $('#suggest').html('')
+ if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
+ $('#right-side').hide()
+ $('#right-side').css('width', '300px')
+ $('#left-side').css('width', '100%')
+ var width = localStorage.getItem('postbox-width')
if (width) {
- width = width.replace("px", "") * 1;
+ width = width.replace('px', '') * 1
} else {
- width = 300;
+ width = 300
}
- $("#post-box").css("width", width + "px");
+ $('#post-box').css('width', width + 'px')
}
- return;
+ return
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- suggest = "https://" + domain + "/api/v2/search?q=" + q;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ suggest = 'https://' + domain + '/api/v2/search?q=' + q
if (suggest != oldSuggest) {
- console.log("Try to get suggest at " + suggest);
+ console.log('Try to get suggest at ' + suggest)
fetch(suggest, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- console.log(["Search", 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];
- 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 = "#' + escapeHTML(tag.name) + " " + uses + "toot(s)";
+ var tag = json.hashtags[key4]
+ 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 = `#${escapeHTML(tag.name)} ${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 + " ";
- nev = true;
}
- });
- $("#suggest").html(ins);
- $("#right-side").show();
- $("#right-side").css("width", "200px");
- $("#left-side").css("width", "calc(100% - 200px)");
- var width = localStorage.getItem("postbox-width");
+ 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 + ' '
+ nev = true
+ }
+ })
+ $('#suggest').html(ins)
+ $('#right-side').show()
+ $('#right-side').css('width', '200px')
+ $('#left-side').css('width', 'calc(100% - 200px)')
+ var width = localStorage.getItem('postbox-width')
if (width) {
- width = width.replace("px", "") * 1 + 200;
+ width = width.replace('px', '') * 1 + 200
} else {
- width = 500;
+ width = 500
}
- $("#post-box").css("width", width + "px");
- $("#poll").addClass("hide");
- $("#emoji").addClass("hide");
+ $('#post-box').css('width', width + 'px')
+ $('#poll').addClass('hide')
+ $('#emoji').addClass('hide')
}
} else if (json.accounts[0] && acct[1]) {
- var accts = "";
+ var accts = ''
Object.keys(json.accounts).forEach(function(key3) {
- var acct = json.accounts[key3];
+ var acct = json.accounts[key3]
if (acct.acct != q) {
//Instance Actorって…
- if (acct.username.indexOf(".") < 0) {
- accts = accts + "@' + acct.acct + " ";
+ if (acct.username.indexOf('.') < 0) {
+ accts = accts + `@${acct.acct} `
}
}
- });
- $("#right-side").show();
- $("#right-side").css("width", "200px");
- $("#left-side").css("width", "calc(100% - 200px)");
- var width = localStorage.getItem("postbox-width");
+ })
+ $('#right-side').show()
+ $('#right-side').css('width', '200px')
+ $('#left-side').css('width', 'calc(100% - 200px)')
+ var width = localStorage.getItem('postbox-width')
if (width) {
- width = width.replace("px", "") * 1 + 200;
+ width = width.replace('px', '') * 1 + 200
} else {
- width = 500;
+ width = 500
}
- $("#post-box").css("width", width + "px");
- $("#suggest").html(accts);
- $("#poll").addClass("hide");
- $("#emoji").addClass("hide");
+ $('#post-box').css('width', width + 'px')
+ $('#suggest').html(accts)
+ $('#poll').addClass('hide')
+ $('#emoji').addClass('hide')
} else {
- if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
- $("#right-side").hide();
- $("#right-side").css("width", "300px");
- $("#left-side").css("width", "100%");
- var width = localStorage.getItem("postbox-width");
+ if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
+ $('#right-side').hide()
+ $('#right-side').css('width', '300px')
+ $('#left-side').css('width', '100%')
+ var width = localStorage.getItem('postbox-width')
if (width) {
- width = width.replace("px", "") * 1;
+ width = width.replace('px', '') * 1
} else {
- width = 300;
+ width = 300
}
- $("#post-box").css("width", width + "px");
+ $('#post-box').css('width', width + 'px')
}
}
- });
+ })
}
}
- oldSuggest = suggest;
- prev_value = new_val;
- }, 1000);
+ oldSuggest = suggest
+ prev_value = new_val
+ }, 1000)
},
false
-);
+)
input.addEventListener(
- "blur",
+ 'blur',
function() {
- window.clearInterval(timer);
- favTag();
+ window.clearInterval(timer)
+ favTag()
},
false
-);
+)
function tagInsert(code, del) {
- var now = $("#textarea").val();
- var selin = $("#textarea").prop("selectionStart");
+ var now = $('#textarea').val()
+ var selin = $('#textarea').prop('selectionStart')
if (!del) {
} else {
- var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
- var now = now.replace(regExp, "");
- selin = selin - del.length;
+ var regExp = new RegExp(del.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
+ var now = now.replace(regExp, '')
+ selin = selin - del.length
}
if (selin > 0) {
- var before = now.substr(0, selin);
- var after = now.substr(selin, now.length);
- newt = before + " " + code + " " + after;
+ var before = now.substr(0, selin)
+ var after = now.substr(selin, now.length)
+ newt = before + ' ' + code + ' ' + after
} else {
- newt = code + " " + now;
+ newt = code + ' ' + now
}
- $("#textarea").val(newt);
- $("#textarea").focus();
- if ($("#poll").hasClass("hide") && $("#emoji").hasClass("hide")) {
- $("#right-side").hide();
- $("#right-side").css("width", "300px");
- $("#left-side").css("width", "50%");
- var width = localStorage.getItem("postbox-width").replace("px", "") * 1;
+ $('#textarea').val(newt)
+ $('#textarea').focus()
+ if ($('#poll').hasClass('hide') && $('#emoji').hasClass('hide')) {
+ $('#right-side').hide()
+ $('#right-side').css('width', '300px')
+ $('#left-side').css('width', '50%')
+ var width = localStorage.getItem('postbox-width').replace('px', '') * 1
if (!width) {
- width = 300;
+ width = 300
}
- $("#post-box").css("width", width + "px");
+ $('#post-box').css('width', width + 'px')
}
- $("#suggest").html("");
+ $('#suggest').html('')
}
function cgNPs(q) {
- suggest = "https://cg.toot.app/api/v1/search/light?q=" + q;
+ suggest = 'https://cg.toot.app/api/v1/search/light?q=' + q
if (suggest != oldSuggest) {
- console.log("Try to get suggest at " + suggest);
+ console.log('Try to get suggest at ' + suggest)
fetch(suggest, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json[0]) {
- var tags = "";
+ var tags = ''
Object.keys(json).forEach(function(key4) {
- var tag = json[key4];
- tags = tags + "' + escapeHTML(json[key4]) + " ";
- });
- $("#suggest").html("Cinderella NowPlaying:" + tags);
+ var tag = json[key4]
+ tags = tags + `${escapeHTML(json[key4])} `
+ })
+ $('#suggest').html('Cinderella NowPlaying:' + tags)
} else {
- $("#suggest").html("Cinderella NowPlaying:Not Found");
+ $('#suggest').html('Cinderella NowPlaying:Not Found')
}
- });
+ })
}
}
diff --git a/app/js/post/use-txtbox.js b/app/js/post/use-txtbox.js
index 97350115..9e272df2 100644
--- a/app/js/post/use-txtbox.js
+++ b/app/js/post/use-txtbox.js
@@ -1,81 +1,81 @@
/*リプライ*/
function re(id, ats_cm, acct_id, mode) {
- clear();
- var ats = ats_cm.split(',');
- localStorage.setItem("nohide", true);
- show();
- $("#reply").val(id);
+ clear()
+ var ats = ats_cm.split(',')
+ localStorage.setItem('nohide', true)
+ show()
+ $('#reply').val(id)
for (var i = 0; i < ats.length; i++) {
- var at = ats[i];
- var te = $("#textarea").val();
- if (at != localStorage.getItem("user_" + acct_id)) {
- $("#textarea").val("@" + at + " " + te);
+ var at = ats[i]
+ var te = $('#textarea').val()
+ if (at != localStorage.getItem('user_' + acct_id)) {
+ $('#textarea').val('@' + at + ' ' + te)
}
}
- $("#rec").text(lang.lang_yesno);
- $("#post-acct-sel").val(acct_id);
- $("#post-acct-sel").prop("disabled", true);
- $('select').formSelect();
+ $('#rec').text(lang.lang_yesno)
+ $('#post-acct-sel').val(acct_id)
+ $('#post-acct-sel').prop('disabled', true)
+ $('select').formSelect()
mdCheck()
- $("#textarea").attr("placeholder", lang.lang_usetxtbox_reply);
- $("#textarea").focus();
- var profimg = localStorage.getItem("prof_" + acct_id);
+ $('#textarea').attr('placeholder', lang.lang_usetxtbox_reply)
+ $('#textarea').focus()
+ var profimg = localStorage.getItem('prof_' + acct_id)
if (!profimg) {
- profimg = "../../img/missing.svg";
+ profimg = '../../img/missing.svg'
}
- $("#acct-sel-prof").attr("src", profimg);
- vis(mode);
+ $('#acct-sel-prof').attr('src', profimg)
+ vis(mode)
}
function reEx(id) {
- $('#tootmodal').modal('close');
- var at = $("#tootmodal").attr("data-user");
- var acct_id = $("#status-acct-sel").val();
- var mode = $("#tootmodal .vis-data").attr("data-vis");
- re(id, at, acct_id, mode);
+ $('#tootmodal').modal('close')
+ var at = $('#tootmodal').attr('data-user')
+ var acct_id = $('#status-acct-sel').val()
+ var mode = $('#tootmodal .vis-data').attr('data-vis')
+ re(id, at, acct_id, mode)
}
//引用
function qt(id, acct_id, at, url) {
- localStorage.setItem("nohide", true);
- var qt = localStorage.getItem("quote");
+ localStorage.setItem('nohide', true)
+ var qt = localStorage.getItem('quote')
if (!qt) {
- var qt = "simple";
+ var qt = 'simple'
}
- if (qt == "nothing") {
- return false;
+ if (qt == 'nothing') {
+ return false
}
- if (qt == "simple") {
- show();
- $("#textarea").val("\n" + url);
- } else if (qt == "mention") {
- show();
- $("#textarea").val("\n" + url + " From:@" + at);
- } else if (qt == "full") {
- show();
- var html = $("[toot-id=" + id + "] .toot").html();
- html = html.match(/^
(.+)<\/p>$/)[1];
- html = html.replace(/ /, "\n");
- html = html.replace(/
/, "\n");
- html = html.replace(/<\/p>/, "\n");
- html = $.strip_tags(html);
- $("#textarea").val("\n" + "@" + at + " " + html + "\n" + url);
- } else if (qt == "apiQuote") {
- clear();
- localStorage.setItem("nohide", true);
- show();
- $("#quote").val(id);
- $("#post-acct-sel").val(acct_id);
- $("#post-acct-sel").prop("disabled", true);
- $('select').formSelect();
- $("#textarea").attr("placeholder", lang.lang_usetxtbox_reply);
- $("#textarea").focus();
- var profimg = localStorage.getItem("prof_" + acct_id);
+ if (qt == 'simple') {
+ show()
+ $('#textarea').val('\n' + url)
+ } else if (qt == 'mention') {
+ show()
+ $('#textarea').val('\n' + url + ' From:@' + at)
+ } else if (qt == 'full') {
+ show()
+ var html = $('[toot-id=' + id + '] .toot').html()
+ html = html.match(/^
(.+)<\/p>$/)[1]
+ html = html.replace(/ /, '\n')
+ html = html.replace(/
/, '\n')
+ html = html.replace(/<\/p>/, '\n')
+ html = $.strip_tags(html)
+ $('#textarea').val('\n' + '@' + at + ' ' + html + '\n' + url)
+ } else if (qt == 'apiQuote') {
+ clear()
+ localStorage.setItem('nohide', true)
+ show()
+ $('#quote').val(id)
+ $('#post-acct-sel').val(acct_id)
+ $('#post-acct-sel').prop('disabled', true)
+ $('select').formSelect()
+ $('#textarea').attr('placeholder', lang.lang_usetxtbox_reply)
+ $('#textarea').focus()
+ var profimg = localStorage.getItem('prof_' + acct_id)
if (!profimg) {
- profimg = "../../img/missing.svg";
+ profimg = '../../img/missing.svg'
}
- $("#acct-sel-prof").attr("src", profimg);
+ $('#acct-sel-prof').attr('src', profimg)
}
- $("#post-acct-sel").val(acct_id);
- $('select').formSelect();
+ $('#post-acct-sel').val(acct_id)
+ $('select').formSelect()
mdCheck()
- $("#textarea").focus();
-}
\ No newline at end of file
+ $('#textarea').focus()
+}
diff --git a/app/js/tl/card.js b/app/js/tl/card.js
index 5cd30895..b6babce0 100644
--- a/app/js/tl/card.js
+++ b/app/js/tl/card.js
@@ -4,292 +4,349 @@ function additional(acct_id, tlid) {
//メンション系
//$(".mention").attr("href", "");
- $("#timeline-container .mention").addClass("parsed");
+ $('#timeline-container .mention').addClass('parsed')
- $("#timeline-container .hashtag, #timeline-container [rel=tag]").each(function(i, elem) {
+ $('#timeline-container .hashtag, #timeline-container [rel=tag]').each(function(i, elem) {
var tags = $(this)
- .attr("href")
- .match(/https?:\/\/([-a-zA-Z0-9@.]+)\/tags\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/);
+ .attr('href')
+ .match(/https?:\/\/([-a-zA-Z0-9@.]+)\/tags\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/)
if (tags) {
- var tagThis = tags[2];
+ var tagThis = tags[2]
} else {
- var tagThis = $(this).attr("data-tag");
+ var tagThis = $(this).attr('data-tag')
}
if (tagThis) {
- $(this).attr("onclick", "tagShow('" + tagThis + "')");
- $(this).attr("href", "#");
+ $(this).attr('onclick', "tagShow('" + tagThis + "')")
+ $(this).attr('href', '#')
}
- });
+ })
//トゥートサムネ
- $("#timeline_" + tlid + " .toot a:not(.parsed)").each(function(i, elem) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var card = localStorage.getItem("card_" + tlid);
- var text = $(this).attr("href");
+ $('#timeline_' + tlid + ' .toot a:not(.parsed)').each(function(i, elem) {
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var card = localStorage.getItem('card_' + tlid)
+ var text = $(this).attr('href')
if (text) {
- if (text.indexOf("twimg.com") === -1) {
- var urls = text.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/);
+ if (text.indexOf('twimg.com') === -1) {
+ var urls = text.match(
+ /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
+ )
}
} else {
- text = "";
- var urls = [];
+ text = ''
+ var urls = []
}
//トゥートのURLぽかったら
- toot = text.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/);
+ toot = text.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/)
if (toot) {
if (toot[1]) {
- $(this).attr("data-acct", acct_id);
+ $(this).attr('data-acct', acct_id)
}
}
if (urls) {
- $(this).remove();
+ $(this).remove()
} else if (!card) {
var id = $(this)
- .parents(".cvo")
- .attr("toot-id");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/url?url=" + text;
+ .parents('.cvo')
+ .attr('toot-id')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/url?url=' + text
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
//body: JSON.stringify({})
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json.title) {
- $("[toot-id=" + id + "] .additional").html('URL' + lang.lang_cards_check + ": Title:" + escapeHTML(json.title) + " " + escapeHTML(json.description) + " ");
- $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
- $("[toot-id=" + id + "]").addClass("parsed");
+ $('[toot-id=' + id + '] .additional').html(
+ 'URL' +
+ lang.lang_cards_check +
+ ': Title:' +
+ escapeHTML(json.title) +
+ ' ' +
+ escapeHTML(json.description) +
+ ' '
+ )
+ $('[toot-id=' + id + '] a:not(.parsed)').addClass('parsed')
+ $('[toot-id=' + id + ']').addClass('parsed')
}
- });
+ })
}
} else {
- $(this).attr("title", text);
+ $(this).attr('title', text)
}
- });
- $("i.unparsed").each(function(i, elem) {
- var dem = $(this).text();
- var dom = $(this);
- var start = "./js/emoji/emoji-map.json";
- var xmlHttpRequest = new XMLHttpRequest();
+ })
+ $('i.unparsed').each(function(i, elem) {
+ var dem = $(this).text()
+ var dom = $(this)
+ var start = './js/emoji/emoji-map.json'
+ var xmlHttpRequest = new XMLHttpRequest()
xmlHttpRequest.onreadystatechange = function() {
if (this.readyState === 4 && this.status === 200) {
if (this.response) {
- var json = this.response;
+ var json = this.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- var emojis = json.emojis;
+ var emojis = json.emojis
for (i = 0; i < emojis.length; i++) {
- var emojie = emojis[i];
- var regExp = new RegExp(dem, "g");
+ var emojie = emojis[i]
+ var regExp = new RegExp(dem, 'g')
if (emojie.emoji.match(regExp)) {
- var sc = emojie.name;
- var sc = "twa-" + sc.replace(/_/g, "-");
- dom.addClass(sc);
- dom.text("");
- dom.removeClass("unparsed");
- break;
+ var sc = emojie.name
+ var sc = 'twa-' + sc.replace(/_/g, '-')
+ dom.addClass(sc)
+ dom.text('')
+ dom.removeClass('unparsed')
+ break
}
}
}
}
- };
- xmlHttpRequest.open("GET", start, true);
- xmlHttpRequest.responseType = "json";
- xmlHttpRequest.send(null);
- });
+ }
+ xmlHttpRequest.open('GET', start, true)
+ xmlHttpRequest.responseType = 'json'
+ xmlHttpRequest.send(null)
+ })
- $("#timeline_" + tlid + " .toot:not(:has(a:not(.add-show,.parsed)))").each(function(i, elem) {
+ $('#timeline_' + tlid + ' .toot:not(:has(a:not(.add-show,.parsed)))').each(function(i, elem) {
$(this)
.parent()
- .find(".add-show")
- .hide();
- });
+ .find('.add-show')
+ .hide()
+ })
//Markdownイメージビューワー
- $("#timeline_" + tlid + " .toot a:not(.img-parsed):has(img)").each(function(i, elem) {
- var ilink = $(this).attr("href");
+ $('#timeline_' + tlid + ' .toot a:not(.img-parsed):has(img)').each(function(i, elem) {
+ var ilink = $(this).attr('href')
var id = $(this)
- .parents(".cvo")
- .attr("toot-id");
- $(this).attr("href", "#");
- $(this).attr("onclick", "imgv('" + id + "','" + i + "')");
- $(this).attr("data-type", "image");
- $(this).attr("id", id + "-image-" + i);
- $(this).attr("data-url", ilink);
- $(this).addClass("img-parsed");
- });
+ .parents('.cvo')
+ .attr('toot-id')
+ $(this).attr('href', '#')
+ $(this).attr('onclick', "imgv('" + id + "','" + i + "')")
+ $(this).attr('data-type', 'image')
+ $(this).attr('id', id + '-image-' + i)
+ $(this).attr('data-url', ilink)
+ $(this).addClass('img-parsed')
+ })
}
function additionalIndv(tlid, acct_id, id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var text = $("[toot-id=" + id + "] .toot a").attr("href");
- var urls = text.match(/https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/);
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var text = $('[toot-id=' + id + '] .toot a').attr('href')
+ var urls = text.match(
+ /https?:\/\/([-a-zA-Z0-9@.]+)\/media\/([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)/
+ )
if (urls) {
- $("[toot-id=" + id + "] .toot a").remove();
+ $('[toot-id=' + id + '] .toot a').remove()
} else {
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/url?url=" + text;
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/url?url=' + text
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
//body: JSON.stringify({})
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json.title) {
- $("[toot-id=" + id + "] .additional").html('URL' + lang.lang_cards_check + ": Title:" + escapeHTML(json.title) + " " + escapeHTML(json.description) + " ");
- $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
- $("[toot-id=" + id + "]").addClass("parsed");
+ $('[toot-id=' + id + '] .additional').html(
+ `URL${lang.lang_cards_check}: Title:${escapeHTML(
+ json.title
+ )} ${escapeHTML(json.description)} `
+ )
+ $('[toot-id=' + id + '] a:not(.parsed)').addClass('parsed')
+ $('[toot-id=' + id + ']').addClass('parsed')
}
- });
+ })
} else {
- var id = $("[toot-id=" + id + "] .toot a")
- .parents(".cvo")
- .attr("toot-id");
- var start = "https://" + domain + "/api/v1/statuses/" + id;
+ var id = $('[toot-id=' + id + '] .toot a')
+ .parents('.cvo')
+ .attr('toot-id')
+ var start = 'https://' + domain + '/api/v1/statuses/' + id
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
//body: JSON.stringify({})
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- json = json.card;
+ json = json.card
//このリンク鳥やんけ、ってとき
- if (json.provider_name == "Twitter") {
+ if (json.provider_name == 'Twitter') {
if (json.image) {
- var twiImg = ' ';
+ var twiImg = `
+
+ `
} else {
- var twiImg = "";
+ var twiImg = ''
}
- $("[toot-id=" + id + "] .additional").html('
");
- } else if (json.provider_name == "pixiv") {
+ $('[toot-id=' + id + '] .additional').html(`
+
+ `)
+ } else if (json.provider_name == 'pixiv') {
if (json.image) {
- var pxvImg = ' ';
+ var pxvImg = `
+
+ `
} else {
- var pxvImg = "";
+ var pxvImg = ''
}
- $("[toot-id=" + id + "] .additional").html('' + escapeHTML(json.author_name) + " " + escapeHTML(json.title) + pxvImg + "
");
+ $('[toot-id=' + id + '] .additional').html(
+ `
+ ${escapeHTML(json.author_name)}
+
+ ${escapeHTML(json.title)}
+ ${pxvImg}
+
`
+ )
} else {
if (json.title) {
- $("[toot-id=" + id + "] .additional").html('URL' + lang.lang_cards_check + ": Title:" + escapeHTML(json.title) + " " + escapeHTML(json.description) + " ");
+ $('[toot-id=' + id + '] .additional').html(
+ `URL
+ ${lang.lang_cards_check}
+ : Title:
+ ${escapeHTML(json.title)}
+
+ ${escapeHTML(json.description)}
+ `
+ )
}
if (json.html) {
- $("[toot-id=" + id + "] .additional").html(json.html + 'picture_in_picture_alt ');
+ $('[toot-id=' + id + '] .additional').html(
+ json.html +
+ `picture_in_picture_alt `
+ )
}
}
if (json.title) {
- $("[toot-id=" + id + "] a:not(.parsed)").addClass("parsed");
- $("[toot-id=" + id + "]").addClass("parsed");
+ $('[toot-id=' + id + '] a:not(.parsed)').addClass('parsed')
+ $('[toot-id=' + id + ']').addClass('parsed')
}
- });
+ })
}
}
}
//各TL上方のLink[On/Off]
function cardToggle(tlid) {
- var card = localStorage.getItem("card_" + tlid);
+ var card = localStorage.getItem('card_' + tlid)
if (!card) {
- localStorage.setItem("card_" + tlid, "true");
- $("#sta-card-" + tlid).text("Off");
- $("#sta-card-" + tlid).css("color", "red");
+ localStorage.setItem('card_' + tlid, 'true')
+ $('#sta-card-' + tlid).text('Off')
+ $('#sta-card-' + tlid).css('color', 'red')
} else {
- localStorage.removeItem("card_" + tlid);
- $("#sta-card-" + tlid).text("On");
- $("#sta-card-" + tlid).css("color", "#009688");
+ localStorage.removeItem('card_' + tlid)
+ $('#sta-card-' + tlid).text('On')
+ $('#sta-card-' + tlid).css('color', '#009688')
}
}
//各TL上方のLink[On/Off]をチェック
function cardCheck(tlid) {
- var card = localStorage.getItem("card_" + tlid);
+ var card = localStorage.getItem('card_' + tlid)
if (!card) {
- $("#sta-card-" + tlid).text("On");
- $("#sta-card-" + tlid).css("color", "#009688");
+ $('#sta-card-' + tlid).text('On')
+ $('#sta-card-' + tlid).css('color', '#009688')
} else {
- $("#sta-card-" + tlid).text("Off");
- $("#sta-card-" + tlid).css("color", "red");
+ $('#sta-card-' + tlid).text('Off')
+ $('#sta-card-' + tlid).css('color', 'red')
}
}
function mov(id, tlid, type) {
- var click = false;
- if (tlid == "notf") {
- var tlide = "[data-notf=" + acct_id + "]";
- } else if (tlid == "user") {
- var tlide = "#his-data";
+ var click = false
+ if (tlid == 'notf') {
+ var tlide = '[data-notf=' + acct_id + ']'
+ } else if (tlid == 'user') {
+ var tlide = '#his-data'
} else {
- var tlide = "[tlid=" + tlid + "]";
+ var tlide = '[tlid=' + tlid + ']'
}
- var mouseover = localStorage.getItem("mouseover");
+ var mouseover = localStorage.getItem('mouseover')
if (!mouseover) {
- mouseover = "";
+ mouseover = ''
}
- if (mouseover == "yes") {
- mouseover = "hide";
- } else if (mouseover == "click") {
- if (type == "mv") {
- mouseover = "";
+ if (mouseover == 'yes') {
+ mouseover = 'hide'
+ } else if (mouseover == 'click') {
+ if (type == 'mv') {
+ mouseover = ''
} else {
- mouseover = "hide";
+ mouseover = 'hide'
}
- click = true;
- } else if (mouseover == "no") {
- mouseover = "";
+ click = true
+ } else if (mouseover == 'no') {
+ mouseover = ''
}
- if (mouseover == "hide") {
+ if (mouseover == 'hide') {
if (click) {
- $(tlide + " [toot-id=" + id + "]").toggleClass("hide-actions");
+ $(tlide + ' [toot-id=' + id + ']').toggleClass('hide-actions')
} else {
- $(tlide + " [toot-id=" + id + "]").removeClass("hide-actions");
+ $(tlide + ' [toot-id=' + id + ']').removeClass('hide-actions')
}
//$(tlide + " [toot-id=" + id + "] .area-vis").toggleClass("hide")
@@ -299,18 +356,18 @@ function mov(id, tlid, type) {
}
function resetmv(type) {
- var mouseover = localStorage.getItem("mouseover");
+ var mouseover = localStorage.getItem('mouseover')
if (!mouseover) {
- mouseover = "";
- } else if (mouseover == "yes") {
- mouseover = "hide";
- } else if (mouseover == "no") {
- mouseover = "";
- } else if (mouseover == "click" && type != "mv") {
- mouseover = "hide";
+ mouseover = ''
+ } else if (mouseover == 'yes') {
+ mouseover = 'hide'
+ } else if (mouseover == 'no') {
+ mouseover = ''
+ } else if (mouseover == 'click' && type != 'mv') {
+ mouseover = 'hide'
}
- if (mouseover == "hide") {
- $(".cvo").addClass("hide-actions");
+ if (mouseover == 'hide') {
+ $('.cvo').addClass('hide-actions')
//$(".area-vis").addClass("hide");
//$(".area-actions").addClass("hide");
//$(".area-side").addClass("hide");
diff --git a/app/js/tl/datails.js b/app/js/tl/datails.js
index d18dd3ac..ab7230c2 100644
--- a/app/js/tl/datails.js
+++ b/app/js/tl/datails.js
@@ -1,263 +1,263 @@
//トゥートの詳細
function details(id, acct_id, tlid, mode) {
- if (mode == "dm") {
- $(".dm-hide").hide();
+ if (mode == 'dm') {
+ $('.dm-hide').hide()
} else {
- $(".dm-hide").show();
+ $('.dm-hide').show()
}
- $(".toot-reset").html('' + lang.lang_details_nodata + " ");
- var html = $("#timeline_" + tlid + " [toot-id=" + id + "]").html();
- $("#toot-this").html(html);
- $("#tootmodal").modal("open");
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/notes/show";
+ $('.toot-reset').html('' + lang.lang_details_nodata + ' ')
+ var html = $('#timeline_' + tlid + ' [toot-id=' + id + ']').html()
+ $('#toot-this').html(html)
+ $('#tootmodal').modal('open')
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/notes/show'
var i = {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
},
body: JSON.stringify({
i: at,
noteId: id
})
- };
+ }
} else {
- var start = "https://" + domain + "/api/v1/statuses/" + id;
+ var start = 'https://' + domain + '/api/v1/statuses/' + id
var i = {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
- };
+ }
}
fetch(start, i)
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- console.log(["Toot data:", json]);
- if (!$("#timeline_" + tlid + " #pub_" + id).length) {
- var html = parse([json], "", acct_id);
- $("#toot-this").html(html);
- jQuery("time.timeago").timeago();
+ console.log(['Toot data:', json])
+ if (!$('#timeline_' + tlid + ' #pub_' + id).length) {
+ var html = parse([json], '', acct_id)
+ $('#toot-this').html(html)
+ jQuery('time.timeago').timeago()
}
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var url = "https://" + domain + "/notes/" + json.id;
- var scn = json.user.username;
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var url = 'https://' + domain + '/notes/' + json.id
+ var scn = json.user.username
if (!json.user.host) {
- var local = true;
+ var local = true
} else {
- var local = false;
- scn = scn + "@" + host;
+ var local = false
+ scn = scn + '@' + host
}
- var rep = "";
- var uid = json.user.id;
+ var rep = ''
+ var uid = json.user.id
if (json._replyIds) {
- replyTL(json._replyIds[0], acct_id);
+ replyTL(json._replyIds[0], acct_id)
}
} else {
- var url = json.url;
+ var url = json.url
if (json.account.acct == json.account.username) {
- var local = true;
+ var local = true
} else {
- var local = false;
+ var local = false
}
- var scn = json.account.acct;
- var uid = json.account.id;
- if (json["in_reply_to_id"]) {
- replyTL(json["in_reply_to_id"], acct_id);
+ var scn = json.account.acct
+ var uid = json.account.id
+ if (json['in_reply_to_id']) {
+ replyTL(json['in_reply_to_id'], acct_id)
}
}
- $("#toot-this .fav_ct").text(json.favourites_count);
- $("#toot-this .rt_ct").text(json.reblogs_count);
- $("#tootmodal").attr("data-url", url);
- $("#tootmodal").attr("data-id", json.id);
- $("#tootmodal").attr("data-acct", acct_id);
+ $('#toot-this .fav_ct').text(json.favourites_count)
+ $('#toot-this .rt_ct').text(json.reblogs_count)
+ $('#tootmodal').attr('data-url', url)
+ $('#tootmodal').attr('data-id', json.id)
+ $('#tootmodal').attr('data-acct', acct_id)
if (local) {
- $("#tootmodal").attr("data-user", scn + "@" + domain);
+ $('#tootmodal').attr('data-user', scn + '@' + domain)
} else {
- $("#tootmodal").attr("data-user", scn);
+ $('#tootmodal').attr('data-user', scn)
}
- getContext(id, acct_id);
- var dom = null;
+ getContext(id, acct_id)
+ var dom = null
if (!local) {
- dom = scn.replace(/.+@/g, "");
+ dom = scn.replace(/.+@/g, '')
} else {
- dom = domain;
+ dom = domain
}
- beforeToot(id, acct_id, dom);
- userToot(id, acct_id, uid);
- afterToot(id, acct_id, dom);
- afterUserToot(id, acct_id, uid);
- afterFTLToot(id, acct_id, dom);
- faved(id, acct_id);
- rted(id, acct_id);
- if ($("#toot-this div").hasClass("cvo")) {
- $("#toot-this").removeClass("cvo");
+ beforeToot(id, acct_id, dom)
+ userToot(id, acct_id, uid)
+ afterToot(id, acct_id, dom)
+ afterUserToot(id, acct_id, uid)
+ afterFTLToot(id, acct_id, dom)
+ faved(id, acct_id)
+ rted(id, acct_id)
+ if ($('#toot-this div').hasClass('cvo')) {
+ $('#toot-this').removeClass('cvo')
} else {
- if (!$("#toot-this .cvo").hasClass("cvo")) {
- $("#toot-this").addClass("cvo");
+ if (!$('#toot-this .cvo').hasClass('cvo')) {
+ $('#toot-this').addClass('cvo')
}
}
- if (!$("#activator").hasClass("active")) {
- $("#det-col").collapsible("open", 4);
+ if (!$('#activator').hasClass('active')) {
+ $('#det-col').collapsible('open', 4)
}
- });
+ })
}
//返信タイムライン
function replyTL(id, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/notes/show";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/notes/show'
var i = {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
},
body: JSON.stringify({
i: at,
noteId: id
})
- };
+ }
} else {
- return false;
+ return false
}
fetch(start, i)
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "thread");
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), 'thread')
} else {
- var mute = [];
+ var mute = []
}
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var templete = misskeyParse([json], "", acct_id, "", "", mute);
- $("#toot-after").prepend(templete);
- $("#toot-after .hide").html(lang.lang_details_filtered);
- $("#toot-after .by_filter").css("display", "block");
- $("#toot-after .by_filter").removeClass("hide");
- var rep = "_replyIds";
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var templete = misskeyParse([json], '', acct_id, '', '', mute)
+ $('#toot-after').prepend(templete)
+ $('#toot-after .hide').html(lang.lang_details_filtered)
+ $('#toot-after .by_filter').css('display', 'block')
+ $('#toot-after .by_filter').removeClass('hide')
+ var rep = '_replyIds'
if (json[rep]) {
- replyTL(json[rep][0], acct_id);
+ replyTL(json[rep][0], 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") {
- var start = "https://" + domain + "/api/notes/conversation";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/notes/conversation'
var i = {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
},
body: JSON.stringify({
i: at,
noteId: id
})
- };
+ }
} else {
- var start = "https://" + domain + "/api/v1/statuses/" + id + "/context";
+ var start = 'https://' + domain + '/api/v1/statuses/' + id + '/context'
var i = {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
- };
+ }
}
fetch(start, i)
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- json.reverse();
- var templete = misskeyParse(json, "", acct_id, "", "", []);
- $("#toot-reply").html(templete);
- $("#toot-reply .hide").html(lang.lang_details_filtered);
- $("#toot-reply .by_filter").css("display", "block");
- $("#toot-reply .by_filter").removeClass("hide");
- jQuery("time.timeago").timeago();
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ json.reverse()
+ var templete = misskeyParse(json, '', acct_id, '', '', [])
+ $('#toot-reply').html(templete)
+ $('#toot-reply .hide').html(lang.lang_details_filtered)
+ $('#toot-reply .by_filter').css('display', 'block')
+ $('#toot-reply .by_filter').removeClass('hide')
+ jQuery('time.timeago').timeago()
} else {
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "thread");
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), 'thread')
} else {
- var mute = [];
+ var mute = []
}
- var templete = parse(json.descendants, "", acct_id, "", "", mute);
- if (templete != "") {
- $("#toot-after .no-data").hide();
+ var templete = parse(json.descendants, '', acct_id, '', '', mute)
+ if (templete != '') {
+ $('#toot-after .no-data').hide()
}
- $("#toot-after").html(templete);
- $("#toot-after .hide").html(lang.lang_details_filtered);
- $("#toot-after .by_filter").css("display", "block");
- $("#toot-after .by_filter").removeClass("hide");
- var templete = parse(json.ancestors, "", acct_id, "", "", mute);
- if (templete != "") {
- $("#toot-reply .no-data").hide();
+ $('#toot-after').html(templete)
+ $('#toot-after .hide').html(lang.lang_details_filtered)
+ $('#toot-after .by_filter').css('display', 'block')
+ $('#toot-after .by_filter').removeClass('hide')
+ var templete = parse(json.ancestors, '', acct_id, '', '', mute)
+ if (templete != '') {
+ $('#toot-reply .no-data').hide()
}
- $("#toot-reply").prepend(templete);
- $("#toot-reply .hide").html(lang.lang_details_filtered);
- $("#toot-reply .by_filter").css("display", "block");
- $("#toot-reply .by_filter").removeClass("hide");
- jQuery("time.timeago").timeago();
+ $('#toot-reply').prepend(templete)
+ $('#toot-reply .hide').html(lang.lang_details_filtered)
+ $('#toot-reply .by_filter').css('display', 'block')
+ $('#toot-reply .by_filter').removeClass('hide')
+ jQuery('time.timeago').timeago()
}
- });
+ })
}
//前のトゥート(Back TL)
function beforeToot(id, acct_id, domain) {
//var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/notes/local-timeline";
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/notes/local-timeline'
fetch(start, {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
},
body: JSON.stringify({
i: at,
@@ -267,62 +267,62 @@ function beforeToot(id, acct_id, domain) {
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = misskeyParse(json, "noauth", acct_id);
- $("#toot-before").html(templete);
- jQuery("time.timeago").timeago();
- });
+ var templete = misskeyParse(json, 'noauth', acct_id)
+ $('#toot-before').html(templete)
+ jQuery('time.timeago').timeago()
+ })
} else {
- var start = "https://" + domain + "/api/v1/timelines/public?local=true&max_id=" + id;
+ var start = 'https://' + domain + '/api/v1/timelines/public?local=true&max_id=' + id
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = parse(json, "noauth", acct_id);
- if (templete != "") {
- $("#toot-before .no-data").hide();
+ var templete = parse(json, 'noauth', acct_id)
+ if (templete != '') {
+ $('#toot-before .no-data').hide()
}
- $("#toot-before").html(templete);
- jQuery("time.timeago").timeago();
- });
+ $('#toot-before').html(templete)
+ jQuery('time.timeago').timeago()
+ })
}
}
//前のユーザーのトゥート
function userToot(id, acct_id, user) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/users/notes";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/users/notes'
fetch(start, {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
},
body: JSON.stringify({
i: at,
@@ -333,333 +333,341 @@ function userToot(id, acct_id, user) {
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = misskeyParse(json, "noauth", acct_id);
- $("#user-before").html(templete);
- jQuery("time.timeago").timeago();
- });
+ var templete = misskeyParse(json, 'noauth', acct_id)
+ $('#user-before').html(templete)
+ jQuery('time.timeago').timeago()
+ })
} else {
- var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses?max_id=" + id;
+ var start = 'https://' + domain + '/api/v1/accounts/' + user + '/statuses?max_id=' + id
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = parse(json, "", acct_id);
- if (templete != "") {
- $("#user-before .no-data").hide();
+ var templete = parse(json, '', acct_id)
+ if (templete != '') {
+ $('#user-before .no-data').hide()
}
- $("#user-before").html(templete);
- jQuery("time.timeago").timeago();
- });
+ $('#user-before').html(templete)
+ jQuery('time.timeago').timeago()
+ })
}
}
//後のLTL
function afterToot(id, acct_id, domain) {
//var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/timelines/public?local=true&min_id=" + id;
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/timelines/public?local=true&min_id=' + id
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = parse(json, "noauth", acct_id);
- if (templete != "") {
- $("#ltl-after .no-data").hide();
+ var templete = parse(json, 'noauth', acct_id)
+ if (templete != '') {
+ $('#ltl-after .no-data').hide()
}
- $("#ltl-after").html(templete);
- jQuery("time.timeago").timeago();
- });
+ $('#ltl-after').html(templete)
+ jQuery('time.timeago').timeago()
+ })
}
//後のUTL
function afterUserToot(id, acct_id, user) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/accounts/" + user + "/statuses?min_id=" + id;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/accounts/' + user + '/statuses?min_id=' + id
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = parse(json, "", acct_id);
- if (templete != "") {
- $("#user-after .no-data").hide();
+ var templete = parse(json, '', acct_id)
+ if (templete != '') {
+ $('#user-after .no-data').hide()
}
- $("#user-after").html(templete);
- jQuery("time.timeago").timeago();
- });
+ $('#user-after').html(templete)
+ jQuery('time.timeago').timeago()
+ })
}
//後のFTL
function afterFTLToot(id, acct_id, domain) {
//var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/timelines/public?min_id=" + id;
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/timelines/public?min_id=' + id
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = parse(json, "noauth", acct_id);
- if (templete != "") {
- $("#ftl-after .no-data").hide();
+ var templete = parse(json, 'noauth', acct_id)
+ if (templete != '') {
+ $('#ftl-after .no-data').hide()
}
- $("#ftl-after").html(templete);
- jQuery("time.timeago").timeago();
- });
+ $('#ftl-after').html(templete)
+ jQuery('time.timeago').timeago()
+ })
}
//ふぁぼ一覧
function faved(id, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- return false;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ return false
}
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/statuses/" + id + "/favourited_by";
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/statuses/' + id + '/favourited_by'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = userparse(json, "", acct_id);
- if (templete != "") {
- $("#toot-fav .no-data").hide();
+ var templete = userparse(json, '', acct_id)
+ if (templete != '') {
+ $('#toot-fav .no-data').hide()
}
- $("#toot-fav").html(templete);
- jQuery("time.timeago").timeago();
- });
+ $('#toot-fav').html(templete)
+ jQuery('time.timeago').timeago()
+ })
}
//ブースト一覧
function rted(id, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- return false;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ return false
}
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/statuses/" + id + "/reblogged_by";
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/statuses/' + id + '/reblogged_by'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var templete = userparse(json, "", acct_id);
- $("#toot-rt").html(templete);
- jQuery("time.timeago").timeago();
- });
+ var templete = userparse(json, '', acct_id)
+ $('#toot-rt').html(templete)
+ jQuery('time.timeago').timeago()
+ })
}
//URL等のコピー
function cbCopy(mode) {
- var url = $("#tootmodal").attr("data-url");
- var urls = url.match(/https?:\/\/([-.a-zA-Z0-9]+)/);
- var domain = urls[1];
- if (mode == "emb") {
- var emb = '';
- execCopy(emb);
- M.toast({ html: lang.lang_details_embed, displayLength: 1500 });
+ var url = $('#tootmodal').attr('data-url')
+ var urls = url.match(/https?:\/\/([-.a-zA-Z0-9]+)/)
+ var domain = urls[1]
+ if (mode == 'emb') {
+ var emb =
+ `
+ `
+ execCopy(emb)
+ M.toast({ html: lang.lang_details_embed, displayLength: 1500 })
} else {
if (execCopy(url)) {
- M.toast({ html: lang.lang_details_url, displayLength: 1500 });
+ M.toast({ html: lang.lang_details_url, displayLength: 1500 })
}
}
}
//本文のコピー
function staCopy(id) {
- var html = $("[toot-id=" + id + "] .toot").html();
- html = html.replace(/^(.+)<\/p>$/, "$1");
- html = html.replace(/ /, "\n");
- html = html.replace(/
/, "\n");
- html = html.replace(/<\/p>/, "\n");
- console.log("Copy it:\n" + html);
- html = html.replace(/ /g, "$1");
- html = $.strip_tags(html);
+ var html = $('[toot-id=' + id + '] .toot').html()
+ html = html.replace(/^
(.+)<\/p>$/, '$1')
+ html = html.replace(/ /, '\n')
+ html = html.replace(/
/, '\n')
+ html = html.replace(/<\/p>/, '\n')
+ console.log('Copy it:\n' + html)
+ html = html.replace(/ /g, '$1')
+ html = $.strip_tags(html)
if (execCopy(html)) {
- M.toast({ html: lang.lang_details_txt, displayLength: 1500 });
+ M.toast({ html: lang.lang_details_txt, displayLength: 1500 })
}
}
//翻訳
function trans(tar, to) {
- var html = $("#toot-this .toot").html();
+ var html = $('#toot-this .toot').html()
if (html.match(/^
(.+)<\/p>$/)) {
- html = html.match(/^
(.+)<\/p>$/)[1];
+ html = html.match(/^
(.+)<\/p>$/)[1]
}
- html = html.replace(/ /g, "\n");
- html = html.replace(/
/g, "\n");
- html = html.replace(/<\/p>/g, "\n");
- html = $.strip_tags(html);
- if (~tar.indexOf("zh")) {
- tar = "zh";
+ html = html.replace(/ /g, '\n')
+ html = html.replace(/
/g, '\n')
+ html = html.replace(/<\/p>/g, '\n')
+ html = $.strip_tags(html)
+ if (~tar.indexOf('zh')) {
+ tar = 'zh'
}
- $("#toot-this .additional").text("Loading...(Powered by Google Translate)");
- var exec = "https://script.google.com/macros/s/AKfycbxhwW5tjjop9Irg-y1zr_WsXlCKEzwWG6KuoOt_vVRDfEbRv0c/exec?format=json&text=" + encodeURIComponent(html) + "&source=" + tar + "&target=" + to;
- console.log("Try to translate from " + tar + " to " + to + " at " + exec);
+ $('#toot-this .additional').text('Loading...(Powered by Google Translate)')
+ var exec =
+ 'https://script.google.com/macros/s/AKfycbxhwW5tjjop9Irg-y1zr_WsXlCKEzwWG6KuoOt_vVRDfEbRv0c/exec?format=json&text=' +
+ encodeURIComponent(html) +
+ '&source=' +
+ tar +
+ '&target=' +
+ to
+ console.log('Try to translate from ' + tar + ' to ' + to + ' at ' + exec)
fetch(exec, {
- method: "GET"
+ method: 'GET'
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(text) {
- $("#toot-this .additional").html('' + text.text + " ");
- });
+ $('#toot-this .additional').html('' + text.text + ' ')
+ })
}
//ブラウザで開く
function brws() {
- var url = $("#tootmodal").attr("data-url");
- postMessage(["openUrl", url], "*");
+ var url = $('#tootmodal').attr('data-url')
+ postMessage(['openUrl', url], '*')
}
//外部からトゥート開く
function detEx(url, acct_id) {
- if (acct_id == "main") {
- acct_id = localStorage.getItem("main");
+ if (acct_id == 'main') {
+ acct_id = localStorage.getItem('main')
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v2/search?resolve=true&q=" + url;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + url
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (!json.statuses) {
- postMessage(["openUrl", url], "*");
+ postMessage(['openUrl', url], '*')
} else {
- var id = json.statuses[0].id;
- $(".loadp").text($(".loadp").attr("href"));
- $(".loadp").removeClass("loadp");
- details(id, acct_id, 0);
+ var id = json.statuses[0].id
+ $('.loadp').text($('.loadp').attr('href'))
+ $('.loadp').removeClass('loadp')
+ details(id, acct_id, 0)
}
- });
- return;
+ })
+ return
}
diff --git a/app/js/tl/filter.js b/app/js/tl/filter.js
index adc4b2db..d3eeeff4 100644
--- a/app/js/tl/filter.js
+++ b/app/js/tl/filter.js
@@ -1,200 +1,212 @@
/*メディアフィルター機能*/
//各TL上方のMedia[On/Off]
function mediaToggle(tlid) {
- var media = localStorage.getItem("media_" + tlid);
+ var media = localStorage.getItem('media_' + tlid)
if (media) {
- localStorage.removeItem("media_" + tlid);
- $("#sta-media-" + tlid).text("Off");
- $("#sta-media-" + tlid).css("color", "red");
- $("#timeline_" + tlid).removeClass("media-filter");
+ localStorage.removeItem('media_' + tlid)
+ $('#sta-media-' + tlid).text('Off')
+ $('#sta-media-' + tlid).css('color', 'red')
+ $('#timeline_' + tlid).removeClass('media-filter')
} else {
- localStorage.setItem("media_" + tlid, "true");
- $("#sta-media-" + tlid).text("On");
- $("#sta-media-" + tlid).css("color", "#009688");
- $("#timeline_" + tlid).addClass("media-filter");
+ localStorage.setItem('media_' + tlid, 'true')
+ $('#sta-media-' + tlid).text('On')
+ $('#sta-media-' + tlid).css('color', '#009688')
+ $('#timeline_' + tlid).addClass('media-filter')
}
}
//各TL上方のBT[BTOnly/BTExc/Off]
function ebtToggle(tlid) {
- var ebt = localStorage.getItem("ebt_" + tlid);
- if (ebt == "true") {
- localStorage.setItem("ebt_" + tlid, "but");
- $("#sta-bt-" + tlid).text("BT Only");
- $("#sta-bt-" + tlid).css("color", "#ff9800");
- $("#timeline_" + tlid).addClass("except-bt-filter");
- $("#timeline_" + tlid).removeClass("bt-filter");
- } else if (ebt == "but") {
- localStorage.removeItem("ebt_" + tlid);
- $("#sta-bt-" + tlid).text("Off");
- $("#sta-bt-" + tlid).css("color", "red");
- $("#timeline_" + tlid).removeClass("bt-filter");
- $("#timeline_" + tlid).removeClass("except-bt-filter");
+ var ebt = localStorage.getItem('ebt_' + tlid)
+ if (ebt == 'true') {
+ localStorage.setItem('ebt_' + tlid, 'but')
+ $('#sta-bt-' + tlid).text('BT Only')
+ $('#sta-bt-' + tlid).css('color', '#ff9800')
+ $('#timeline_' + tlid).addClass('except-bt-filter')
+ $('#timeline_' + tlid).removeClass('bt-filter')
+ } else if (ebt == 'but') {
+ localStorage.removeItem('ebt_' + tlid)
+ $('#sta-bt-' + tlid).text('Off')
+ $('#sta-bt-' + tlid).css('color', 'red')
+ $('#timeline_' + tlid).removeClass('bt-filter')
+ $('#timeline_' + tlid).removeClass('except-bt-filter')
} else {
- localStorage.setItem("ebt_" + tlid, "true");
- $("#sta-bt-" + tlid).text("BT Ex");
- $("#sta-bt-" + tlid).css("color", "#009688");
- $("#timeline_" + tlid).addClass("bt-filter");
- $("#timeline_" + tlid).removeClass("except-bt-filter");
+ localStorage.setItem('ebt_' + tlid, 'true')
+ $('#sta-bt-' + tlid).text('BT Ex')
+ $('#sta-bt-' + tlid).css('color', '#009688')
+ $('#timeline_' + tlid).addClass('bt-filter')
+ $('#timeline_' + tlid).removeClass('except-bt-filter')
}
}
//各TL上方のMedia[On/Off]をチェック
function mediaCheck(tlid) {
- var media = localStorage.getItem("media_" + tlid);
+ var media = localStorage.getItem('media_' + tlid)
if (media) {
- $("#sta-media-" + tlid).text("On");
- $("#sta-media-" + tlid).css("color", "#009688");
- $("#timeline_" + tlid).addClass("media-filter");
+ $('#sta-media-' + tlid).text('On')
+ $('#sta-media-' + tlid).css('color', '#009688')
+ $('#timeline_' + tlid).addClass('media-filter')
} else {
- $("#sta-media-" + tlid).text("Off");
- $("#sta-media-" + tlid).css("color", "red");
- $("#timeline_" + tlid).removeClass("media-filter");
+ $('#sta-media-' + tlid).text('Off')
+ $('#sta-media-' + tlid).css('color', 'red')
+ $('#timeline_' + tlid).removeClass('media-filter')
}
}
//各TL上方のBT[On/Off]をチェック
function ebtCheck(tlid) {
- var ebt = localStorage.getItem("ebt_" + tlid);
- if (ebt == "true") {
- $("#sta-bt-" + tlid).text("BT Ex");
- $("#sta-bt-" + tlid).css("color", "#009688");
- $("#timeline_" + tlid).addClass("bt-filter");
- $("#timeline_" + tlid).removeClass("except-bt-filter");
- } else if (ebt == "but") {
- $("#sta-bt-" + tlid).text("BT Only");
- $("#sta-bt-" + tlid).css("color", "#ff9800");
- $("#timeline_" + tlid).addClass("except-bt-filter");
- $("#timeline_" + tlid).removeClass("bt-filter");
+ var ebt = localStorage.getItem('ebt_' + tlid)
+ if (ebt == 'true') {
+ $('#sta-bt-' + tlid).text('BT Ex')
+ $('#sta-bt-' + tlid).css('color', '#009688')
+ $('#timeline_' + tlid).addClass('bt-filter')
+ $('#timeline_' + tlid).removeClass('except-bt-filter')
+ } else if (ebt == 'but') {
+ $('#sta-bt-' + tlid).text('BT Only')
+ $('#sta-bt-' + tlid).css('color', '#ff9800')
+ $('#timeline_' + tlid).addClass('except-bt-filter')
+ $('#timeline_' + tlid).removeClass('bt-filter')
} else {
- $("#sta-bt-" + tlid).text("Off");
- $("#sta-bt-" + tlid).css("color", "red");
- $("#timeline_" + tlid).removeClass("bt-filter");
- $("#timeline_" + tlid).removeClass("except-bt-filter");
+ $('#sta-bt-' + tlid).text('Off')
+ $('#sta-bt-' + tlid).css('color', 'red')
+ $('#timeline_' + tlid).removeClass('bt-filter')
+ $('#timeline_' + tlid).removeClass('except-bt-filter')
}
}
/* 削除追跡*/
function catchToggle(tlid) {
- var catchck = localStorage.getItem("catch_" + tlid);
+ var catchck = localStorage.getItem('catch_' + tlid)
if (catchck) {
- localStorage.removeItem("catch_" + tlid);
- $("#sta-del-" + tlid).text("Off");
- $("#sta-del-" + tlid).css("color", "red");
- parseColumn(tlid);
+ localStorage.removeItem('catch_' + tlid)
+ $('#sta-del-' + tlid).text('Off')
+ $('#sta-del-' + tlid).css('color', 'red')
+ parseColumn(tlid)
} else {
- localStorage.setItem("catch_" + tlid, "true");
- $("#sta-del-" + tlid).text("On");
- $("#sta-del-" + tlid).css("color", "#009688");
- parseColumn(tlid);
+ localStorage.setItem('catch_' + tlid, 'true')
+ $('#sta-del-' + tlid).text('On')
+ $('#sta-del-' + tlid).css('color', '#009688')
+ parseColumn(tlid)
}
}
function catchCheck(tlid) {
- var catchck = localStorage.getItem("catch_" + tlid);
+ var catchck = localStorage.getItem('catch_' + tlid)
if (catchck) {
- $("#sta-del-" + tlid).text("On");
- $("#sta-del-" + tlid).css("color", "#009688");
+ $('#sta-del-' + tlid).text('On')
+ $('#sta-del-' + tlid).css('color', '#009688')
} else {
- $("#sta-del-" + tlid).text("Off");
- $("#sta-del-" + tlid).css("color", "red");
+ $('#sta-del-' + tlid).text('Off')
+ $('#sta-del-' + tlid).css('color', 'red')
}
}
function delreset(tlid) {
- $("[tlid=" + tlid + "] .by_delcatch").hide();
- $("[tlid=" + tlid + "] .by_delcatch").remove();
+ $('[tlid=' + tlid + '] .by_delcatch').hide()
+ $('[tlid=' + tlid + '] .by_delcatch').remove()
}
/*ワードフィルター機能*/
function filterMenu() {
- $("#left-menu div").removeClass("active");
- $("#filterMenu").addClass("active");
- $(".menu-content").addClass("hide");
- $("#filter-box").removeClass("hide");
+ $('#left-menu div').removeClass('active')
+ $('#filterMenu').addClass('active')
+ $('.menu-content').addClass('hide')
+ $('#filter-box').removeClass('hide')
}
function filter() {
- $("#filtered-words").html("");
- $("#filter-edit-id").val("");
- var acct_id = $("#filter-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/filters";
+ $('#filtered-words').html('')
+ $('#filter-edit-id').val('')
+ var acct_id = $('#filter-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/filters'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var filters = "";
+ var filters = ''
Object.keys(json).forEach(function(key) {
- var filterword = json[key];
- var context = filterword.context.join(",");
- filters = filters + escapeHTML(filterword.phrase) + '(for ' + context + ") :' + lang.lang_edit + ' /' + lang.lang_del + " ";
- });
- if (filters == "") {
- filters = lang.lang_filter_nodata + " ";
+ var filterword = json[key]
+ var context = filterword.context.join(',')
+ filters =
+ filters +
+ escapeHTML(filterword.phrase) +
+ `(for ${context}) :
+
+ ${lang.lang_edit}
+ /
+ ' +
+ ${lang.lang_del}'
+ `
+ })
+ if (filters == '') {
+ filters = lang.lang_filter_nodata + ' '
}
- $("#filtered-words").html(filters);
+ $('#filtered-words').html(filters)
} else {
- $("#filtered-words").html(lang_filter_nodata);
+ $('#filtered-words').html(lang_filter_nodata)
}
- });
+ })
}
function filterTime(day, hour, min) {
- $("#days_filter").val(day);
- $("#hours_filter").val(hour);
- $("#mins_filter").val(min);
+ $('#days_filter').val(day)
+ $('#hours_filter').val(hour)
+ $('#mins_filter').val(min)
}
function makeNewFilter() {
- var acct_id = $("#filter-acct-sel").val();
- var phr = $("#filter-add-word").val();
- var cont = [];
- if ($("#home_filter:checked").val()) {
- cont.push("home");
+ var acct_id = $('#filter-acct-sel').val()
+ var phr = $('#filter-add-word').val()
+ var cont = []
+ if ($('#home_filter:checked').val()) {
+ cont.push('home')
}
- if ($("#local_filter:checked").val()) {
- cont.push("public");
+ if ($('#local_filter:checked').val()) {
+ cont.push('public')
}
- if ($("#notf_filter:checked").val()) {
- cont.push("notifications");
+ if ($('#notf_filter:checked').val()) {
+ cont.push('notifications')
}
- if ($("#conv_filter:checked").val()) {
- cont.push("thread");
+ if ($('#conv_filter:checked').val()) {
+ cont.push('thread')
}
if (!cont.length) {
- $("#filtered-words").html("Error:" + lang.lang_filter_errordegree);
+ $('#filtered-words').html('Error:' + lang.lang_filter_errordegree)
}
- var exc = $("#except_filter:checked").val();
- var who = $("#wholeword_filter:checked").val();
+ var exc = $('#except_filter:checked').val()
+ var who = $('#wholeword_filter:checked').val()
if (!who) {
- who = false;
+ who = false
}
- var time = $("#days_filter").val() * 24 * 60 * 60 + $("#hours_filter").val() * 60 * 60 + $("#mins_filter").val() * 60;
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if ($("#filter-edit-id").val()) {
- var start = "https://" + domain + "/api/v1/filters/" + $("#filter-edit-id").val();
- var method = "PUT";
+ var time =
+ $('#days_filter').val() * 24 * 60 * 60 +
+ $('#hours_filter').val() * 60 * 60 +
+ $('#mins_filter').val() * 60
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if ($('#filter-edit-id').val()) {
+ var start = 'https://' + domain + '/api/v1/filters/' + $('#filter-edit-id').val()
+ var method = 'PUT'
} else {
- var start = "https://" + domain + "/api/v1/filters";
- var method = "POST";
+ var start = 'https://' + domain + '/api/v1/filters'
+ var method = 'POST'
}
- var httpreq = new XMLHttpRequest();
- httpreq.open(method, start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
+ var httpreq = new XMLHttpRequest()
+ httpreq.open(method, start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
httpreq.send(
JSON.stringify({
phrase: phr,
@@ -203,220 +215,220 @@ function makeNewFilter() {
whole_word: who,
expires_in: time
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- filter();
- filterUpdate(acct_id);
- $("#filter-add-word").val("");
- $("#home_filter").prop("checked", false);
- $("#local_filter").prop("checked", false);
- $("#notf_filter").prop("checked", false);
- $("#conv_filter").prop("checked", false);
- $("#except_filter").prop("checked", false);
- $("#wholeword_filter").prop("checked", false);
- $("#days_filter").val("0");
- $("#hours_filter").val("0");
- $("#mins_filter").val("0");
- $("#add-filter-btn").text(lang.lang_add);
- $("#filter-edit-id").val("");
+ filter()
+ filterUpdate(acct_id)
+ $('#filter-add-word').val('')
+ $('#home_filter').prop('checked', false)
+ $('#local_filter').prop('checked', false)
+ $('#notf_filter').prop('checked', false)
+ $('#conv_filter').prop('checked', false)
+ $('#except_filter').prop('checked', false)
+ $('#wholeword_filter').prop('checked', false)
+ $('#days_filter').val('0')
+ $('#hours_filter').val('0')
+ $('#mins_filter').val('0')
+ $('#add-filter-btn').text(lang.lang_add)
+ $('#filter-edit-id').val('')
}
- };
+ }
}
function filterEdit(id, acct_id) {
- $("#filter-add-word").val("");
- $("#home_filter").prop("checked", false);
- $("#local_filter").prop("checked", false);
- $("#notf_filter").prop("checked", false);
- $("#conv_filter").prop("checked", false);
- $("#except_filter").prop("checked", false);
- $("#wholeword_filter").prop("checked", false);
- $("#days_filter").val("0");
- $("#hours_filter").val("0");
- $("#mins_filter").val("0");
- $("#add-filter-btn").text(lang.lang_edit);
- $("#filter-edit-id").val(id);
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/filters/" + id;
+ $('#filter-add-word').val('')
+ $('#home_filter').prop('checked', false)
+ $('#local_filter').prop('checked', false)
+ $('#notf_filter').prop('checked', false)
+ $('#conv_filter').prop('checked', false)
+ $('#except_filter').prop('checked', false)
+ $('#wholeword_filter').prop('checked', false)
+ $('#days_filter').val('0')
+ $('#hours_filter').val('0')
+ $('#mins_filter').val('0')
+ $('#add-filter-btn').text(lang.lang_edit)
+ $('#filter-edit-id').val(id)
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/filters/' + id
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var now = new Date();
- now = now.getTime();
- var now = Math.floor(now / 1000);
- $("#filter-add-word").val(json.phrase);
+ var now = new Date()
+ now = now.getTime()
+ var now = Math.floor(now / 1000)
+ $('#filter-add-word').val(json.phrase)
Object.keys(json.context).forEach(function(key) {
- var context = json.context[key];
- $("[value=" + context + "]").prop("checked", true);
- });
+ var context = json.context[key]
+ $('[value=' + context + ']').prop('checked', true)
+ })
if (json.irreversible) {
- $("#except_filter").prop("checked", true);
+ $('#except_filter').prop('checked', true)
}
if (json.whole_word) {
- $("#wholeword_filter").prop("checked", true);
+ $('#wholeword_filter').prop('checked', true)
}
- var expires = date(json.expires_at, "unix") - now;
- var mins = Math.floor(expires / 60) % 60;
- var hours = Math.floor(expires / 3600) % 24;
- var days = Math.floor(expires / 3600 / 24);
- $("#days_filter").val(days);
- $("#hours_filter").val(hours);
- $("#mins_filter").val(mins);
+ var expires = date(json.expires_at, 'unix') - now
+ var mins = Math.floor(expires / 60) % 60
+ var hours = Math.floor(expires / 3600) % 24
+ var days = Math.floor(expires / 3600 / 24)
+ $('#days_filter').val(days)
+ $('#hours_filter').val(hours)
+ $('#mins_filter').val(mins)
}
- });
+ })
}
function filterDel(id, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/filters/" + id;
- var httpreq = new XMLHttpRequest();
- httpreq.open("DELETE", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send();
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/filters/' + id
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('DELETE', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send()
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- filter();
- filterUpdate(acct_id);
+ filter()
+ filterUpdate(acct_id)
}
- };
+ }
}
function getFilter(acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- var start = "https://" + domain + "/api/v1/filters";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ var start = 'https://' + domain + '/api/v1/filters'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- localStorage.setItem("filter_" + acct_id, JSON.stringify(json));
- });
+ localStorage.setItem('filter_' + acct_id, JSON.stringify(json))
+ })
} else {
- localStorage.setItem("filter_" + acct_id, JSON.stringify({}));
+ localStorage.setItem('filter_' + acct_id, JSON.stringify({}))
}
}
function getFilterType(json, type) {
if (!json) {
- return [];
+ return []
}
- if (type == "local") {
- type = "public";
- } else if (type == "list") {
- type = "home";
- } else if (type == "notf") {
- type = "notifi";
+ if (type == 'local') {
+ type = 'public'
+ } else if (type == 'list') {
+ type = 'home'
+ } else if (type == 'notf') {
+ type = 'notifi'
}
- var mutedfilters = [];
+ var mutedfilters = []
Object.keys(json).forEach(function(key) {
- var filterword = json[key];
- var phrases = filterword.phrase;
- if (filterword.context.join(",").indexOf(type) !== -1) {
- mutedfilters.push(phrases);
+ var filterword = json[key]
+ var phrases = filterword.phrase
+ if (filterword.context.join(',').indexOf(type) !== -1) {
+ mutedfilters.push(phrases)
}
- });
- return mutedfilters;
+ })
+ return mutedfilters
}
function filterUpdate(acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/filters";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/filters'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- localStorage.setItem("filter_" + acct_id, JSON.stringify(json));
- filterUpdateInternal(json, "home");
- filterUpdateInternal(json, "local");
- filterUpdateInternal(json, "notf");
- filterUpdateInternal(json, "pub");
- });
+ localStorage.setItem('filter_' + acct_id, JSON.stringify(json))
+ filterUpdateInternal(json, 'home')
+ filterUpdateInternal(json, 'local')
+ filterUpdateInternal(json, 'notf')
+ filterUpdateInternal(json, 'pub')
+ })
}
function filterUpdateInternal(json, type) {
- var home = getFilterType(json, type);
- var wordmute = localStorage.getItem("word_mute");
+ var home = getFilterType(json, type)
+ var wordmute = localStorage.getItem('word_mute')
if (wordmute) {
- var wordmute = JSON.parse(wordmute);
- home = home.concat(wordmute);
+ var wordmute = JSON.parse(wordmute)
+ home = home.concat(wordmute)
}
if (home) {
- $("[data-acct=" + acct_id + "] [data-type=" + type + "] .cvo").each(function(i, elem) {
- var id = $(elem).attr("toot-id");
- $("[toot-id=" + id + "]").removeClass("hide");
+ $('[data-acct=' + acct_id + '] [data-type=' + type + '] .cvo').each(function(i, elem) {
+ var id = $(elem).attr('toot-id')
+ $('[toot-id=' + id + ']').removeClass('hide')
var text = $(elem)
- .find(".toot")
- .html();
+ .find('.toot')
+ .html()
Object.keys(home).forEach(function(key8) {
- var word = home[key8];
- var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
+ var word = home[key8]
+ var regExp = new RegExp(word.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
if ($.strip_tags(text).match(regExp)) {
- $("[toot-id=" + id + "]").addClass("hide");
+ $('[toot-id=' + id + ']').addClass('hide')
}
- });
- });
+ })
+ })
}
}
/*
@@ -427,73 +439,73 @@ function filterUpdateInternal(json, type) {
*/
//通知フィルター
function exclude(key) {
- localStorage.setItem("exclude-" + key, "");
- var excludetxt = localStorage.getItem("exclude-" + key);
- if ($("#exc-reply-" + key + ":checked").val()) {
- excludetxt = "?exclude_types[]=mention";
+ localStorage.setItem('exclude-' + key, '')
+ var excludetxt = localStorage.getItem('exclude-' + key)
+ if ($('#exc-reply-' + key + ':checked').val()) {
+ excludetxt = '?exclude_types[]=mention'
}
- if ($("#exc-fav-" + key + ":checked").val()) {
- if (excludetxt || excludetxt != "") {
- excludetxt = excludetxt + "&exclude_types[]=favourite";
+ if ($('#exc-fav-' + key + ':checked').val()) {
+ if (excludetxt || excludetxt != '') {
+ excludetxt = excludetxt + '&exclude_types[]=favourite'
} else {
- excludetxt = "?exclude_types[]=favourite";
+ excludetxt = '?exclude_types[]=favourite'
}
}
- if ($("#exc-bt-" + key + ":checked").val()) {
- if (excludetxt || excludetxt != "") {
- excludetxt = excludetxt + "&exclude_types[]=reblog";
+ if ($('#exc-bt-' + key + ':checked').val()) {
+ if (excludetxt || excludetxt != '') {
+ excludetxt = excludetxt + '&exclude_types[]=reblog'
} else {
- excludetxt = "?exclude_types[]=reblog";
+ excludetxt = '?exclude_types[]=reblog'
}
}
- if ($("#exc-follow-" + key + ":checked").val()) {
- if (excludetxt || excludetxt != "") {
- excludetxt = excludetxt + "&exclude_types[]=follow";
+ if ($('#exc-follow-' + key + ':checked').val()) {
+ if (excludetxt || excludetxt != '') {
+ excludetxt = excludetxt + '&exclude_types[]=follow'
} else {
- excludetxt = "?exclude_types[]=follow";
+ excludetxt = '?exclude_types[]=follow'
}
}
- if ($("#exc-poll-" + key + ":checked").val()) {
- if (excludetxt || excludetxt != "") {
- excludetxt = excludetxt + "&exclude_types[]=poll";
+ if ($('#exc-poll-' + key + ':checked').val()) {
+ if (excludetxt || excludetxt != '') {
+ excludetxt = excludetxt + '&exclude_types[]=poll'
} else {
- excludetxt = "?exclude_types[]=poll";
+ excludetxt = '?exclude_types[]=poll'
}
} else {
}
- localStorage.setItem("exclude-" + key, excludetxt);
- parseColumn(key);
+ localStorage.setItem('exclude-' + key, excludetxt)
+ parseColumn(key)
}
function excludeCk(key, target) {
- var exc = localStorage.getItem("exclude-" + key);
+ var exc = localStorage.getItem('exclude-' + key)
if (!exc) {
- return "";
+ return ''
}
if (~exc.indexOf(target)) {
- return "checked";
+ return 'checked'
} else {
- return "";
+ return ''
}
}
function checkNotfFilter(tlid) {
- var excludetxt = localStorage.getItem("exclude-" + tlid);
- if (!excludetxt || excludetxt != "") {
- return true;
+ var excludetxt = localStorage.getItem('exclude-' + tlid)
+ if (!excludetxt || excludetxt != '') {
+ return true
} else {
- return false;
+ return false
}
}
function resetNotfFilter(tlid) {
- localStorage.setItem("exclude-" + tlid, "");
- parseColumn(tlid);
+ localStorage.setItem('exclude-' + tlid, '')
+ parseColumn(tlid)
}
function notfFilter(id, tlid, acct_id) {
- var excludetxt = localStorage.getItem("exclude-" + tlid);
- if (excludetxt || excludetxt != "") {
- excludetxt = excludetxt + "&account_id=" + id;
+ var excludetxt = localStorage.getItem('exclude-' + tlid)
+ if (excludetxt || excludetxt != '') {
+ excludetxt = excludetxt + '&account_id=' + id
} else {
- excludetxt = "?account_id=" + id;
+ excludetxt = '?account_id=' + id
}
- localStorage.setItem("exclude-" + tlid, excludetxt);
- parseColumn(tlid);
+ localStorage.setItem('exclude-' + tlid, excludetxt)
+ parseColumn(tlid)
}
diff --git a/app/js/tl/list.js b/app/js/tl/list.js
index 33fb1478..579bbfcb 100644
--- a/app/js/tl/list.js
+++ b/app/js/tl/list.js
@@ -1,21 +1,21 @@
function listMenu() {
- $("#left-menu div").removeClass("active");
- $("#listMenu").addClass("active");
- $(".menu-content").addClass("hide");
- $("#list-box").removeClass("hide");
- $("ul.tabs").tabs("select_tab", "src-sta");
- $("#src-contents").html("");
+ $('#left-menu div').removeClass('active')
+ $('#listMenu').addClass('active')
+ $('.menu-content').addClass('hide')
+ $('#list-box').removeClass('hide')
+ $('ul.tabs').tabs('select_tab', 'src-sta')
+ $('#src-contents').html('')
}
function list() {
- $("#lists-user").html("");
- var acct_id = $("#list-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/users/lists/list";
+ $('#lists-user').html('')
+ var acct_id = $('#list-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/users/lists/list'
fetch(start, {
- method: "POST",
+ method: 'POST',
body: JSON.stringify({
i: at
})
@@ -23,231 +23,256 @@ function list() {
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var lists = "";
+ var lists = ''
Object.keys(json).forEach(function(key) {
- var list = json[key];
- lists = lists + escapeHTML(list.title) + ":' + lang.lang_list_show + " ";
- });
- $("#lists").html(lists);
+ var list = json[key]
+ lists =
+ lists +
+ escapeHTML(list.title) +
+ `:
+ ${lang.lang_list_show}
+ `
+ })
+ $('#lists').html(lists)
} else {
- $("#lists").html(lang.lang_list_nodata);
+ $('#lists').html(lang.lang_list_nodata)
}
- });
+ })
} else {
- var start = "https://" + domain + "/api/v1/lists";
+ var start = 'https://' + domain + '/api/v1/lists'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var lists = "";
+ var lists = ''
Object.keys(json).forEach(function(key) {
- var list = json[key];
- lists = lists + escapeHTML(list.title) + ":' + lang.lang_list_show + " /' + lang.lang_list_users + " ";
- });
- $("#lists").html(lists);
+ var list = json[key]
+ lists =
+ lists +
+ escapeHTML(list.title) +
+ `:
+ ${lang.lang_list_show}
+ /
+
+ ${lang.lang_list_users}
+ ' `
+ })
+ $('#lists').html(lists)
} else {
- $("#lists").html(lang.lang_list_nodata);
+ $('#lists').html(lang.lang_list_nodata)
}
- });
+ })
}
}
function makeNewList() {
- var acct_id = $("#list-acct-sel").val();
- var text = $("#list-add").val();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- var start = "https://" + domain + "/api/v1/lists";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
+ var acct_id = $('#list-acct-sel').val()
+ var text = $('#list-add').val()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ var start = 'https://' + domain + '/api/v1/lists'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
httpreq.send(
JSON.stringify({
title: text
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- list();
- $("#list-add").val("");
+ list()
+ $('#list-add').val('')
}
- };
+ }
} else {
- var start = "https://" + domain + "/api/users/lists/create";
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.responseType = "json";
+ var start = 'https://' + domain + '/api/users/lists/create'
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.responseType = 'json'
httpreq.send(
JSON.stringify({
i: at,
title: text
})
- );
+ )
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- list();
- $("#list-add").val("");
+ list()
+ $('#list-add').val('')
}
- };
+ }
}
}
function listShow(id, title, acct_id) {
- localStorage.setItem("list_" + id + "_" + acct_id, title);
- tl("list", id, acct_id, "add");
+ localStorage.setItem('list_' + id + '_' + acct_id, title)
+ tl('list', id, acct_id, 'add')
}
function listUser(id, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/lists/' + id + '/accounts'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var lists = "";
- var templete = userparse(json, "", acct_id);
+ var lists = ''
+ var templete = userparse(json, '', acct_id)
if (!json[0]) {
- templete = lang.lang_list_nouser;
+ templete = lang.lang_list_nouser
}
- $("#lists-user").html(templete);
- jQuery("time.timeago").timeago();
+ $('#lists-user').html(templete)
+ jQuery('time.timeago').timeago()
} else {
- $("#lists-user").html(lang.lang_list_nouser);
+ $('#lists-user').html(lang.lang_list_nouser)
}
- });
+ })
}
function hisList(user, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) != "misskey") {
- var start = "https://" + domain + "/api/v1/lists";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) != 'misskey') {
+ var start = 'https://' + domain + '/api/v1/lists'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var lists = lang.lang_list_add + " ";
+ var lists = lang.lang_list_add + ' '
Object.keys(json).forEach(function(key) {
- var list = json[key];
- lists = lists + "' + escapeHTML(list.title) + " ";
- });
- $("#his-lists-a").html(lists);
+ var list = json[key]
+ lists =
+ lists +
+ `
+ ${escapeHTML(list.title)}
+ `
+ })
+ $('#his-lists-a').html(lists)
} else {
- $("#his-lists-a").html(lang.lang_list_nodata);
+ $('#his-lists-a').html(lang.lang_list_nodata)
}
- });
- var start = "https://" + domain + "/api/v1/accounts/" + user + "/lists";
+ })
+ var start = 'https://' + domain + '/api/v1/accounts/' + user + '/lists'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var lists = lang.lang_list_remove + " ";
+ var lists = lang.lang_list_remove + ' '
Object.keys(json).forEach(function(key) {
- var list = json[key];
- lists = lists + "' + escapeHTML(list.title) + " ";
- });
- $("#his-lists-b").html(lists);
+ var list = json[key]
+ lists =
+ lists +
+ `
+ ${escapeHTML(list.title)}
+ `
+ })
+ $('#his-lists-b').html(lists)
} else {
- $("#his-lists-b").html(lang.lang_list_nodata);
+ $('#his-lists-b').html(lang.lang_list_nodata)
}
- });
+ })
} else {
- var start = "https://" + domain + "/api/users/lists/list";
+ var start = 'https://' + domain + '/api/users/lists/list'
fetch(start, {
- method: "POST",
+ method: 'POST',
body: JSON.stringify({
i: at
})
@@ -255,94 +280,105 @@ function hisList(user, acct_id) {
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var lists = "";
+ var lists = ''
Object.keys(json).forEach(function(key) {
- var list = json[key];
- lists = lists + list.title + ":' + lang.lang_list_show + " /' + lang.lang_list_add + lang.lang_list_add_misskey + " ";
- });
- $("#his-lists-a").html(lists);
+ var list = json[key]
+ lists =
+ lists +
+ list.title +
+ `:
+ ${lang.lang_list_show}
+ /
+
+ ${lang.lang_list_add}
+ ${lang.lang_list_add_misskey}
+ ' `
+ })
+ $('#his-lists-a').html(lists)
} else {
- $("#his-lists-a").html(lang.lang_list_nodata);
+ $('#his-lists-a').html(lang.lang_list_nodata)
}
- });
- $("#his-lists-b").html("");
+ })
+ $('#his-lists-b').html('')
}
}
function listAdd(id, user, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/users/lists/push";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/users/lists/push'
var i = {
i: at,
listId: id,
userId: user
- };
+ }
} else {
- var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts";
+ var start = 'https://' + domain + '/api/v1/lists/' + id + '/accounts'
var i = {
account_ids: [user]
- };
+ }
}
- var httpreq = new XMLHttpRequest();
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify(i));
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify(i))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- hisList(user, acct_id);
+ hisList(user, acct_id)
}
- };
+ }
}
function listRemove(id, user, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var start = "https://" + domain + "/api/users/lists/push";
- var method = "POST";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var start = 'https://' + domain + '/api/users/lists/push'
+ var method = 'POST'
var i = {
i: at,
listId: id,
userId: user
- };
+ }
} else {
- var start = "https://" + domain + "/api/v1/lists/" + id + "/accounts";
- var method = "DELETE";
+ var start = 'https://' + domain + '/api/v1/lists/' + id + '/accounts'
+ var method = 'DELETE'
var i = {
account_ids: [user]
- };
+ }
}
- var httpreq = new XMLHttpRequest();
- httpreq.open(method, start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify(i));
+ var httpreq = new XMLHttpRequest()
+ httpreq.open(method, start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify(i))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- hisList(user, acct_id);
+ hisList(user, acct_id)
}
- };
+ }
}
diff --git a/app/js/tl/mix.js b/app/js/tl/mix.js
index f6dc9ed4..1e8da013 100644
--- a/app/js/tl/mix.js
+++ b/app/js/tl/mix.js
@@ -1,353 +1,375 @@
//Integrated TL
function mixtl(acct_id, tlid, type, delc, voice) {
- localStorage.removeItem("morelock");
- localStorage.setItem("now", type);
- todo("Integrated TL Loading...(Local)");
+ localStorage.removeItem('morelock')
+ localStorage.setItem('now', type)
+ todo('Integrated TL Loading...(Local)')
//まずLocal
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/timelines/public?local=true";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/timelines/public?local=true'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(jsonL) {
- var start = "https://" + domain + "/api/v1/timelines/home";
+ var start = 'https://' + domain + '/api/v1/timelines/home'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(jsonH) {
- var homearr = [];
- var timeline = jsonL.concat(jsonH);
+ var homearr = []
+ var timeline = jsonL.concat(jsonH)
timeline.sort(function(a, b) {
- if (date(a.created_at, "unix") >= date(b.created_at, "unix")) return -1;
- if (date(a.created_at, "unix") < date(b.created_at, "unix")) return 1;
- return 0;
- });
- if (type == "integrated") {
- timeline.splice(20);
+ if (date(a.created_at, 'unix') >= date(b.created_at, 'unix')) return -1
+ if (date(a.created_at, 'unix') < date(b.created_at, 'unix')) return 1
+ return 0
+ })
+ if (type == 'integrated') {
+ timeline.splice(20)
}
- var templete = "";
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "mix");
+ var templete = ''
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), 'mix')
} else {
- var mute = [];
+ var mute = []
}
Object.keys(timeline).forEach(function(key) {
- var pkey = key * 1 + 1;
+ var pkey = key * 1 + 1
if (pkey < timeline.length) {
- if (date(timeline[key].created_at, "unix") != date(timeline[pkey].created_at, "unix")) {
- if (type == "integrated") {
- templete = templete + parse([timeline[key]], "", acct_id, tlid, "", mute, "mix");
- } else if (type == "plus") {
+ if (
+ date(timeline[key].created_at, 'unix') != date(timeline[pkey].created_at, 'unix')
+ ) {
+ if (type == 'integrated') {
+ templete = templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'mix')
+ } else if (type == 'plus') {
if (timeline[key].account.acct == timeline[key].account.username) {
- templete = templete + parse([timeline[key]], "", acct_id, tlid, "", mute, "plus");
+ templete =
+ templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'plus')
}
}
}
}
- });
- $("#landing_" + tlid).hide();
- $("#timeline_" + tlid).html(templete);
- mixre(acct_id, tlid, type, mute, delc, voice);
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
- todc();
- });
- });
+ })
+ $('#landing_' + tlid).hide()
+ $('#timeline_' + tlid).html(templete)
+ mixre(acct_id, tlid, type, mute, delc, voice)
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ todc()
+ })
+ })
}
//Streamingに接続
function mixre(acct_id, tlid, TLtype, mute, delc, voice, mode) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (localStorage.getItem("streaming_" + acct_id)) {
- var wss = localStorage.getItem("streaming_" + acct_id);
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (localStorage.getItem('streaming_' + acct_id)) {
+ var wss = localStorage.getItem('streaming_' + acct_id)
} else {
- var wss = "wss://" + domain;
+ var wss = 'wss://' + domain
}
- var startHome = wss + "/api/v1/streaming/?stream=user&access_token=" + at;
- var startLocal = wss + "/api/v1/streaming/?stream=public:local&access_token=" + at;
- var wshid = websocketHome.length;
- var wslid = websocketLocal.length;
- websocketHome[wshid] = new WebSocket(startHome);
- websocketLocal[wslid] = new WebSocket(startLocal);
+ var startHome = wss + '/api/v1/streaming/?stream=user&access_token=' + at
+ var startLocal = wss + '/api/v1/streaming/?stream=public:local&access_token=' + at
+ var wshid = websocketHome.length
+ var wslid = websocketLocal.length
+ websocketHome[wshid] = new WebSocket(startHome)
+ websocketLocal[wslid] = new WebSocket(startLocal)
websocketHome[wshid].onopen = function(mess) {
- localStorage.setItem("wssH_" + tlid, wshid);
- console.table({ tlid: tlid, type: "Connect Streaming API(Integrated:Home)", domain: domain, message: mess });
- $("#notice_icon_" + tlid).removeClass("red-text");
- };
+ localStorage.setItem('wssH_' + tlid, wshid)
+ console.table({
+ tlid: tlid,
+ type: 'Connect Streaming API(Integrated:Home)',
+ domain: domain,
+ message: mess
+ })
+ $('#notice_icon_' + tlid).removeClass('red-text')
+ }
websocketLocal[wslid].onopen = function(mess) {
- localStorage.setItem("wssL_" + tlid, wslid);
- console.table({ tlid: tlid, type: "Connect Streaming API(Integrated:Local)", domain: domain, message: mess });
- $("#notice_icon_" + tlid).removeClass("red-text");
- };
+ localStorage.setItem('wssL_' + tlid, wslid)
+ console.table({
+ tlid: tlid,
+ type: 'Connect Streaming API(Integrated:Local)',
+ domain: domain,
+ message: mess
+ })
+ $('#notice_icon_' + tlid).removeClass('red-text')
+ }
websocketLocal[wslid].onmessage = function(mess) {
- console.log(["Receive Streaming API:(Integrated:Local)", obj]);
+ console.log(['Receive Streaming API:(Integrated:Local)', obj])
- var obj = JSON.parse(JSON.parse(mess.data).payload);
- var type = JSON.parse(mess.data).event;
- if (type == "delete") {
- if (delc == "true") {
- $("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
- $("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
+ var obj = JSON.parse(JSON.parse(mess.data).payload)
+ var type = JSON.parse(mess.data).event
+ if (type == 'delete') {
+ if (delc == 'true') {
+ $('#timeline_' + tlid + ' [toot-id=' + JSON.parse(mess.data).payload + ']').addClass(
+ 'emphasized'
+ )
+ $('#timeline_' + tlid + ' [toot-id=' + JSON.parse(mess.data).payload + ']').addClass(
+ 'by_delcatch'
+ )
} else {
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').hide()
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').remove()
}
- } else if (type == "update") {
- var templete = parse([obj], "", acct_id, tlid, "", mute);
- if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) {
+ } else if (type == 'update') {
+ var templete = parse([obj], '', acct_id, tlid, '', mute)
+ if ($('#timeline_' + tlid + ' [toot-id=' + obj.id + ']').length < 1) {
if (voice) {
- say(obj.content);
+ say(obj.content)
}
- var templete = parse([obj], type, acct_id, tlid, "", mute, "mix");
- var pool = localStorage.getItem("pool_" + tlid);
+ var templete = parse([obj], type, acct_id, tlid, '', mute, 'mix')
+ var pool = localStorage.getItem('pool_' + tlid)
if (pool) {
- pool = templete + pool;
+ pool = templete + pool
} else {
- pool = templete;
+ pool = templete
}
- localStorage.setItem("pool_" + tlid, pool);
+ localStorage.setItem('pool_' + tlid, pool)
- scrollck();
+ scrollck()
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
} else {
- todo("二重取得発生中");
+ todo('二重取得発生中')
}
}
- };
+ }
websocketHome[wshid].onmessage = function(mess) {
- console.log(["Receive Streaming API:(Integrated:Home)", obj]);
- var obj = JSON.parse(JSON.parse(mess.data).payload);
- var type = JSON.parse(mess.data).event;
- if (type == "delete") {
+ console.log(['Receive Streaming API:(Integrated:Home)', obj])
+ var obj = JSON.parse(JSON.parse(mess.data).payload)
+ var type = JSON.parse(mess.data).event
+ if (type == 'delete') {
if (del > 10) {
- reconnector(tlid, type, acct_id, data);
+ reconnector(tlid, type, acct_id, data)
} else {
- localStorage.setItem("delete", del * 1 + 1);
+ localStorage.setItem('delete', del * 1 + 1)
}
- if (delc == "true") {
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
+ if (delc == 'true') {
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').addClass('emphasized')
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').addClass('by_delcatch')
} else {
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').hide()
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').remove()
}
- } else if (type == "update") {
- localStorage.removeItem("delete");
- if (TLtype == "integrated") {
- var templete = parse([obj], "", acct_id, tlid);
- } else if (TLtype == "plus") {
+ } else if (type == 'update') {
+ localStorage.removeItem('delete')
+ if (TLtype == 'integrated') {
+ var templete = parse([obj], '', acct_id, tlid)
+ } else if (TLtype == 'plus') {
if (obj.account.acct == obj.account.username) {
- var templete = parse([obj], "", acct_id, tlid, "", mute, "mix");
+ var templete = parse([obj], '', acct_id, tlid, '', mute, 'mix')
} else {
- var templete = "";
+ var templete = ''
}
}
- if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) {
+ if ($('#timeline_' + tlid + ' [toot-id=' + obj.id + ']').length < 1) {
if (voice) {
- say(obj.content);
+ say(obj.content)
}
- var templete = parse([obj], type, acct_id, tlid, "", mute, "mix");
- var pool = localStorage.getItem("pool_" + tlid);
+ var templete = parse([obj], type, acct_id, tlid, '', mute, 'mix')
+ var pool = localStorage.getItem('pool_' + tlid)
if (pool) {
- pool = templete + pool;
+ pool = templete + pool
} else {
- pool = templete;
+ pool = templete
}
- localStorage.setItem("pool_" + tlid, pool);
+ localStorage.setItem('pool_' + tlid, pool)
- scrollck();
+ scrollck()
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
} else {
- todo("二重取得発生中");
+ todo('二重取得発生中')
}
}
- };
+ }
websocketLocal[wslid].onerror = function(error) {
- console.error("WebSocketLocal Error");
- console.error(error);
- if (mode == "error") {
- $("#notice_icon_" + tlid).addClass("red-text");
- todo("WebSocket Error " + error);
+ console.error('WebSocketLocal Error')
+ console.error(error)
+ if (mode == 'error') {
+ $('#notice_icon_' + tlid).addClass('red-text')
+ todo('WebSocket Error ' + error)
} else {
- var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
- localStorage.setItem("wserror_" + tlid, errorct);
+ var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
+ localStorage.setItem('wserror_' + tlid, errorct)
if (errorct < 3) {
- reconnector(tlid, TLtype, acct_id, "", "error");
+ reconnector(tlid, TLtype, acct_id, '', 'error')
}
}
- };
+ }
websocketLocal[wslid].onclose = function() {
- console.warn("WebSocketLocal Closing:" + tlid);
- if (mode == "error") {
- $("#notice_icon_" + tlid).addClass("red-text");
- todo("WebSocket Closed");
+ console.warn('WebSocketLocal Closing:' + tlid)
+ if (mode == 'error') {
+ $('#notice_icon_' + tlid).addClass('red-text')
+ todo('WebSocket Closed')
} else {
- var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
- localStorage.setItem("wserror_" + tlid, errorct);
+ var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
+ localStorage.setItem('wserror_' + tlid, errorct)
if (errorct < 3) {
- reconnector(tlid, TLtype, acct_id, "", "error");
+ reconnector(tlid, TLtype, acct_id, '', 'error')
}
}
- };
+ }
websocketHome[wshid].onerror = function(error) {
- console.error(["WebSocketHome Error", error]);
- if (mode == "error") {
- $("#notice_icon_" + tlid).addClass("red-text");
- todo("WebSocket Error " + error);
+ console.error(['WebSocketHome Error', error])
+ if (mode == 'error') {
+ $('#notice_icon_' + tlid).addClass('red-text')
+ todo('WebSocket Error ' + error)
} else {
- var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
- localStorage.setItem("wserror_" + tlid, errorct);
+ var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
+ localStorage.setItem('wserror_' + tlid, errorct)
if (errorct < 3) {
- reconnector(tlid, TLtype, acct_id, "", "error");
+ reconnector(tlid, TLtype, acct_id, '', 'error')
}
}
- };
+ }
websocketHome[wshid].onclose = function() {
- console.warn("WebSocketHome Closing:" + tlid);
- if (mode == "error") {
- $("#notice_icon_" + tlid).addClass("red-text");
- todo("WebSocket Closed");
+ console.warn('WebSocketHome Closing:' + tlid)
+ if (mode == 'error') {
+ $('#notice_icon_' + tlid).addClass('red-text')
+ todo('WebSocket Closed')
} else {
- var errorct = localStorage.getItem("wserror_" + tlid) * 1 + 1;
- localStorage.setItem("wserror_" + tlid, errorct);
+ var errorct = localStorage.getItem('wserror_' + tlid) * 1 + 1
+ localStorage.setItem('wserror_' + tlid, errorct)
if (errorct < 3) {
- reconnector(tlid, TLtype, acct_id, "", "error");
+ reconnector(tlid, TLtype, acct_id, '', 'error')
}
}
- };
+ }
}
//ある程度のスクロールで発火
function mixmore(tlid, type) {
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- var acct_id = obj[tlid].domain;
- moreloading = true;
- todo("Integrated TL MoreLoading...(Local)");
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var sid = $("#timeline_" + tlid + " .cvo")
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ var acct_id = obj[tlid].domain
+ moreloading = true
+ todo('Integrated TL MoreLoading...(Local)')
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var sid = $('#timeline_' + tlid + ' .cvo')
.last()
- .attr("unique-id");
+ .attr('unique-id')
- var start = "https://" + domain + "/api/v1/timelines/public?local=true&max_id=" + sid;
+ var start = 'https://' + domain + '/api/v1/timelines/public?local=true&max_id=' + sid
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(jsonL) {
- var start = "https://" + domain + "/api/v1/timelines/home?max_id=" + sid;
+ var start = 'https://' + domain + '/api/v1/timelines/home?max_id=' + sid
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(jsonH) {
- var homearr = [];
- var timeline = jsonL.concat(jsonH);
+ var homearr = []
+ var timeline = jsonL.concat(jsonH)
timeline.sort(function(a, b) {
- if (date(a.created_at, "unix") > date(b.created_at, "unix")) return -1;
- if (date(a.created_at, "unix") < date(b.created_at, "unix")) return 1;
- return 0;
- });
- timeline.splice(20);
- var templete = "";
+ if (date(a.created_at, 'unix') > date(b.created_at, 'unix')) return -1
+ if (date(a.created_at, 'unix') < date(b.created_at, 'unix')) return 1
+ return 0
+ })
+ timeline.splice(20)
+ var templete = ''
Object.keys(timeline).forEach(function(key) {
- var pkey = key * 1 + 1;
+ var pkey = key * 1 + 1
if (pkey < 20) {
- if (date(timeline[key].created_at, "unix") != date(timeline[pkey].created_at, "unix")) {
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "mix");
+ if (
+ date(timeline[key].created_at, 'unix') != date(timeline[pkey].created_at, 'unix')
+ ) {
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(
+ JSON.parse(localStorage.getItem('filter_' + acct_id)),
+ 'mix'
+ )
} else {
- var mute = [];
+ var mute = []
}
- if (type == "integrated") {
- templete = templete + parse([timeline[key]], "", acct_id, tlid, "", mute, "mix");
- } else if (type == "plus") {
+ if (type == 'integrated') {
+ templete = templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'mix')
+ } else if (type == 'plus') {
if (timeline[key].account.acct == timeline[key].account.username) {
- templete = templete + parse([timeline[key]], "", acct_id, tlid, "", mute, "mix");
+ templete = templete + parse([timeline[key]], '', acct_id, tlid, '', mute, 'mix')
}
}
}
}
- });
+ })
- $("#timeline_" + tlid).append(templete);
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
- moreloading = false;
- todc();
- });
- });
+ $('#timeline_' + tlid).append(templete)
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ moreloading = false
+ todc()
+ })
+ })
}
diff --git a/app/js/tl/notification.js b/app/js/tl/notification.js
index 094a314c..6b252dcb 100644
--- a/app/js/tl/notification.js
+++ b/app/js/tl/notification.js
@@ -1,422 +1,430 @@
//通知
//取得+Streaming接続
function notf(acct_id, tlid, sys) {
- if (sys == "direct") {
- notfColumn(acct_id, tlid, sys);
+ if (sys == 'direct') {
+ notfColumn(acct_id, tlid, sys)
} else {
- notfCommon(acct_id, tlid, sys);
+ notfCommon(acct_id, tlid, sys)
}
}
function notfColumn(acct_id, tlid, sys) {
- todo("Notifications Loading...");
- var native = localStorage.getItem("nativenotf");
- var at = localStorage.getItem("acct_" + acct_id + "_at");
+ todo('Notifications Loading...')
+ var native = localStorage.getItem('nativenotf')
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
if (!native) {
- native = "yes";
+ native = 'yes'
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var httpreq = new XMLHttpRequest();
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var misskey = true;
- var start = "https://" + domain + "/api/i/notifications";
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var httpreq = new XMLHttpRequest()
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var misskey = true
+ var start = 'https://' + domain + '/api/i/notifications'
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
var body = JSON.stringify({
i: at
- });
+ })
} else {
- var misskey = false;
- if (localStorage.getItem("exclude-" + tlid)) {
- var exc = localStorage.getItem("exclude-" + tlid);
+ var misskey = false
+ if (localStorage.getItem('exclude-' + tlid)) {
+ var exc = localStorage.getItem('exclude-' + tlid)
} else {
- var exc = "";
+ var exc = ''
}
- var start = "https://" + domain + "/api/v1/notifications" + exc;
- httpreq.open("GET", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- var body = "";
+ var start = 'https://' + domain + '/api/v1/notifications' + exc
+ httpreq.open('GET', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ var body = ''
}
- httpreq.responseType = "json";
- httpreq.send(body);
+ httpreq.responseType = 'json'
+ httpreq.send(body)
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- var max_id = httpreq.getResponseHeader("link");
+ var max_id = httpreq.getResponseHeader('link')
if (max_id) {
- max_id = max_id.match(/[?&]{1}max_id=([0-9]+)/)[1];
+ max_id = max_id.match(/[?&]{1}max_id=([0-9]+)/)[1]
}
if (json[0]) {
- var templete = "";
- var lastnotf = localStorage.getItem("lastnotf_" + acct_id);
- localStorage.setItem("lastnotf_" + acct_id, json[0].id);
+ var templete = ''
+ var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
+ localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) {
- var obj = json[key];
- if (lastnotf == obj.id && key > 0 && native == "yes") {
- var ct = key;
+ var obj = json[key]
+ if (lastnotf == obj.id && key > 0 && native == 'yes') {
+ var ct = key
if (key > 14) {
- ct = "15+";
+ ct = '15+'
}
- var os = localStorage.getItem("platform");
+ var os = localStorage.getItem('platform')
var options = {
body: ct + lang.lang_notf_new,
- icon: localStorage.getItem("prof_" + acct_id)
- };
- var n = new Notification("TheDesk:" + domain, options);
+ icon: localStorage.getItem('prof_' + acct_id)
+ }
+ var n = new Notification('TheDesk:' + domain, options)
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif");
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), 'notif')
} else {
- var mute = [];
+ var mute = []
}
- if (obj.type != "follow") {
+ if (obj.type != 'follow') {
if (misskey) {
- templete = templete + misskeyParse([obj], "notf", acct_id, tlid, -1, mute);
+ templete = templete + misskeyParse([obj], 'notf', acct_id, tlid, -1, mute)
} else {
- templete = templete + parse([obj], "notf", acct_id, tlid, -1, mute);
+ templete = templete + parse([obj], 'notf', acct_id, tlid, -1, mute)
}
} else {
if (misskey) {
- templete = templete + misskeyUserparse([obj], "notf", acct_id, tlid, -1, mute);
+ templete = templete + misskeyUserparse([obj], 'notf', acct_id, tlid, -1, mute)
} else {
- templete = templete + userparse([obj.account], "notf", acct_id, tlid, -1);
+ templete = templete + userparse([obj.account], 'notf', acct_id, tlid, -1)
}
}
- });
- templete = templete + '
';
- $("#timeline_" + tlid).html(templete);
- $("#landing_" + tlid).hide();
- jQuery("time.timeago").timeago();
+ })
+ templete = templete + '
'
+ $('#timeline_' + tlid).html(templete)
+ $('#landing_' + tlid).hide()
+ jQuery('time.timeago').timeago()
}
- $("#notf-box").addClass("fetched");
- todc();
+ $('#notf-box').addClass('fetched')
+ todc()
//Markers
- var markers = localStorage.getItem("markers");
- if (markers == "yes") {
- markers = true;
+ var markers = localStorage.getItem('markers')
+ if (markers == 'yes') {
+ markers = true
} else {
- markers = false;
+ markers = false
}
if (markers) {
- getMarker(tlid, "notf", acct_id);
+ getMarker(tlid, 'notf', acct_id)
}
}
- };
+ }
if (!misskey) {
- if (localStorage.getItem("streaming_" + acct_id)) {
- var wss = localStorage.getItem("streaming_" + acct_id);
+ if (localStorage.getItem('streaming_' + acct_id)) {
+ var wss = localStorage.getItem('streaming_' + acct_id)
} else {
- var wss = "wss://" + domain;
+ var wss = 'wss://' + domain
}
- var start = wss + "/api/v1/streaming/?stream=user&access_token=" + at;
+ var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
} else {
- var start = "wss://" + domain + "/?i=" + at;
+ var start = 'wss://' + domain + '/?i=' + at
}
}
function notfCommon(acct_id, tlid, sys) {
- todo("Notifications Loading...");
- var native = localStorage.getItem("nativenotf");
- var at = localStorage.getItem("acct_" + acct_id + "_at");
+ todo('Notifications Loading...')
+ var native = localStorage.getItem('nativenotf')
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
if (!native) {
- native = "yes";
+ native = 'yes'
}
- var domain = localStorage.getItem("domain_" + acct_id);
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var misskey = true;
- var start = "https://" + domain + "/api/i/notifications";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var misskey = true
+ var start = 'https://' + domain + '/api/i/notifications'
var i = {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
},
body: JSON.stringify({
i: at
})
- };
+ }
} else {
- var misskey = false;
- var start = "https://" + domain + "/api/v1/notifications";
+ var misskey = false
+ var start = 'https://' + domain + '/api/v1/notifications'
var i = {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
- };
+ }
}
fetch(start, i)
.then(function(response) {
- console.log("header to get param:" + response.headers.get("link"));
+ console.log('header to get param:' + response.headers.get('link'))
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json[0]) {
- var templete = "";
- var lastnotf = localStorage.getItem("lastnotf_" + acct_id);
- localStorage.setItem("lastnotf_" + acct_id, json[0].id);
+ var templete = ''
+ var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
+ localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) {
- var obj = json[key];
- if (lastnotf == obj.id && key > 0 && native == "yes") {
- var ct = key;
+ var obj = json[key]
+ if (lastnotf == obj.id && key > 0 && native == 'yes') {
+ var ct = key
if (key > 14) {
- ct = "15+";
+ ct = '15+'
}
- var os = localStorage.getItem("platform");
+ var os = localStorage.getItem('platform')
var options = {
body: ct + lang.lang_notf_new,
- icon: localStorage.getItem("prof_" + acct_id)
- };
- var n = new Notification("TheDesk:" + domain, options);
+ icon: localStorage.getItem('prof_' + acct_id)
+ }
+ var n = new Notification('TheDesk:' + domain, options)
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif");
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), 'notif')
} else {
- var mute = [];
+ var mute = []
}
- if (obj.type != "follow") {
+ if (obj.type != 'follow') {
if (misskey) {
- templete = templete + misskeyParse([obj], "notf", acct_id, "notf", -1, mute);
+ templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
} else {
- templete = templete + parse([obj], "notf", acct_id, "notf", -1, mute);
+ templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute)
}
} else {
if (misskey) {
- templete = templete + misskeyUserparse([obj], "notf", acct_id, "notf", -1, mute);
+ templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute)
} else {
- templete = templete + userparse([obj.account], "notf", acct_id, "notf", -1);
+ templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1)
}
}
- });
- $("div[data-notf=" + acct_id + "]").html(templete);
- $("#landing_" + tlid).hide();
- jQuery("time.timeago").timeago();
+ })
+ $('div[data-notf=' + acct_id + ']').html(templete)
+ $('#landing_' + tlid).hide()
+ jQuery('time.timeago').timeago()
}
- $("#notf-box").addClass("fetched");
- todc();
- notfWS(misskey, acct_id, tlid, domain, at);
- });
+ $('#notf-box').addClass('fetched')
+ todc()
+ notfWS(misskey, acct_id, tlid, domain, at)
+ })
}
function notfWS(misskey, acct_id, tlid, domain, at) {
if (!misskey) {
- if (localStorage.getItem("streaming_" + acct_id)) {
- var wss = localStorage.getItem("streaming_" + acct_id);
+ if (localStorage.getItem('streaming_' + acct_id)) {
+ var wss = localStorage.getItem('streaming_' + acct_id)
} else {
- var wss = "wss://" + domain;
+ var wss = 'wss://' + domain
}
- var start = wss + "/api/v1/streaming/?stream=user&access_token=" + at;
+ var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
- var wsid = websocketNotf.length;
- websocketNotf[acct_id] = new WebSocket(start);
+ var wsid = websocketNotf.length
+ websocketNotf[acct_id] = new WebSocket(start)
websocketNotf[acct_id].onopen = function(mess) {
- console.table({ acct_id: acct_id, type: "Connect Streaming API(Notf)", domain: domain, message: [mess] });
- $("i[data-notf=" + acct_id + "]").removeClass("red-text");
- };
+ console.table({
+ acct_id: acct_id,
+ type: 'Connect Streaming API(Notf)',
+ domain: domain,
+ message: [mess]
+ })
+ $('i[data-notf=' + acct_id + ']').removeClass('red-text')
+ }
websocketNotf[acct_id].onmessage = function(mess) {
//console.log(["Receive Streaming API(Notf):" + acct_id + "(" + domain + ")", JSON.parse(JSON.parse(mess.data).payload)]);
- var popup = localStorage.getItem("popup");
+ var popup = localStorage.getItem('popup')
if (!popup) {
- popup = 0;
+ popup = 0
}
- var obj = JSON.parse(JSON.parse(mess.data).payload);
- var type = JSON.parse(mess.data).event;
- if (type == "notification") {
- var templete = "";
- localStorage.setItem("lastnotf_" + acct_id, obj.id);
- if (!$("#unread_" + tlid + " .material-icons").hasClass("teal-text")) {
+ var obj = JSON.parse(JSON.parse(mess.data).payload)
+ var type = JSON.parse(mess.data).event
+ if (type == 'notification') {
+ var templete = ''
+ localStorage.setItem('lastnotf_' + acct_id, obj.id)
+ if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
//markers show中はダメ
- if (obj.type != "follow") {
- templete = parse([obj], "notf", acct_id, "notf", popup);
+ if (obj.type != 'follow') {
+ templete = parse([obj], 'notf', acct_id, 'notf', popup)
} else {
- templete = userparse([obj], "notf", acct_id, "notf", popup);
+ templete = userparse([obj], 'notf', acct_id, 'notf', popup)
}
- if (!$("div[data-notfIndv=" + acct_id + "_" + obj.id + "]").length) {
- $("div[data-notf=" + acct_id + "]").prepend(templete);
- $("div[data-const=notf_" + acct_id + "]").prepend(templete);
+ if (!$('div[data-notfIndv=' + acct_id + '_' + obj.id + ']').length) {
+ $('div[data-notf=' + acct_id + ']').prepend(templete)
+ $('div[data-const=notf_' + acct_id + ']').prepend(templete)
}
- jQuery("time.timeago").timeago();
+ jQuery('time.timeago').timeago()
}
- } else if (type == "delete") {
- $("[toot-id=" + obj + "]").hide();
- $("[toot-id=" + obj + "]").remove();
+ } else if (type == 'delete') {
+ $('[toot-id=' + obj + ']').hide()
+ $('[toot-id=' + obj + ']').remove()
}
- };
+ }
websocketNotf[acct_id].onerror = function(error) {
- console.error("WebSocket Error " + error);
- errorct++;
- console.log(errorct);
+ console.error('WebSocket Error ' + error)
+ errorct++
+ console.log(errorct)
if (errorct < 3) {
- notfWS(misskey, acct_id, tlid, domain, at);
+ notfWS(misskey, acct_id, tlid, domain, at)
}
- };
+ }
websocketNotf[acct_id].onclose = function(error) {
- console.error("WebSocket Close " + error);
- errorct++;
- console.log(errorct);
+ console.error('WebSocket Close ' + error)
+ errorct++
+ console.log(errorct)
if (errorct < 3) {
- notfWS(misskey, acct_id, tlid, domain, at);
+ notfWS(misskey, acct_id, tlid, domain, at)
}
- };
+ }
}
}
//一定のスクロールで発火
function notfmore(tlid) {
- console.log({ status: "kicked", status: moreloading });
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- var acct_id = obj[tlid].domain;
+ console.log({ status: 'kicked', status: moreloading })
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ var acct_id = obj[tlid].domain
if (!type) {
- var type = obj[tlid].type;
+ var type = obj[tlid].type
} else {
- var data;
+ var data
}
- var sid = $("#timeline_" + tlid + " .notif-marker")
+ var sid = $('#timeline_' + tlid + ' .notif-marker')
.last()
- .attr("data-maxid");
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var domain = localStorage.getItem("domain_" + acct_id);
+ .attr('data-maxid')
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var domain = localStorage.getItem('domain_' + acct_id)
if (sid && !moreloading) {
- moreloading = true;
- var httpreq = new XMLHttpRequest();
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var misskey = true;
- var start = "https://" + domain + "/api/i/notifications";
- httpreq.open(POST, start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
+ moreloading = true
+ var httpreq = new XMLHttpRequest()
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var misskey = true
+ var start = 'https://' + domain + '/api/i/notifications'
+ httpreq.open(POST, start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
var body = JSON.stringify({
i: at,
untilID: sid
- });
+ })
} else {
- var misskey = false;
- if (localStorage.getItem("exclude-" + tlid)) {
- var exc = localStorage.getItem("exclude-" + tlid) + "&max_id=" + sid;
+ var misskey = false
+ if (localStorage.getItem('exclude-' + tlid)) {
+ var exc = localStorage.getItem('exclude-' + tlid) + '&max_id=' + sid
} else {
- var exc = "?max_id=" + sid;
+ var exc = '?max_id=' + sid
}
- var start = "https://" + domain + "/api/v1/notifications" + exc;
- httpreq.open("GET", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- var body = "";
+ var start = 'https://' + domain + '/api/v1/notifications' + exc
+ httpreq.open('GET', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ var body = ''
}
- httpreq.responseType = "json";
- httpreq.send(body);
+ httpreq.responseType = 'json'
+ httpreq.send(body)
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- console.log(["More notifications on " + tlid, json]);
- var max_id = httpreq.getResponseHeader("link").match(/[?&]{1}max_id=([0-9]+)/)[1];
+ console.log(['More notifications on ' + tlid, json])
+ var max_id = httpreq.getResponseHeader('link').match(/[?&]{1}max_id=([0-9]+)/)[1]
if (json[0]) {
- var templete = "";
- var lastnotf = localStorage.getItem("lastnotf_" + acct_id);
- localStorage.setItem("lastnotf_" + acct_id, json[0].id);
+ var templete = ''
+ var lastnotf = localStorage.getItem('lastnotf_' + acct_id)
+ localStorage.setItem('lastnotf_' + acct_id, json[0].id)
Object.keys(json).forEach(function(key) {
- var obj = json[key];
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), "notif");
+ var obj = json[key]
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(
+ JSON.parse(localStorage.getItem('filter_' + acct_id)),
+ 'notif'
+ )
} else {
- var mute = [];
+ var mute = []
}
- if (obj.type != "follow") {
+ if (obj.type != 'follow') {
if (misskey) {
- templete = templete + misskeyParse([obj], "notf", acct_id, "notf", -1, mute);
+ templete = templete + misskeyParse([obj], 'notf', acct_id, 'notf', -1, mute)
} else {
- templete = templete + parse([obj], "notf", acct_id, "notf", -1, mute);
+ templete = templete + parse([obj], 'notf', acct_id, 'notf', -1, mute)
}
} else {
if (misskey) {
- templete = templete + misskeyUserparse([obj], "notf", acct_id, "notf", -1, mute);
+ templete = templete + misskeyUserparse([obj], 'notf', acct_id, 'notf', -1, mute)
} else {
- templete = templete + userparse([obj.account], "notf", acct_id, "notf", -1);
+ templete = templete + userparse([obj.account], 'notf', acct_id, 'notf', -1)
}
}
- });
- moreloading = false;
- templete = templete + '
';
- $("#timeline_" + tlid).append(templete);
- $("#landing_" + tlid).hide();
- jQuery("time.timeago").timeago();
+ })
+ moreloading = false
+ templete = templete + '
'
+ $('#timeline_' + tlid).append(templete)
+ $('#landing_' + tlid).hide()
+ jQuery('time.timeago').timeago()
}
- $("#notf-box").addClass("fetched");
- todc();
+ $('#notf-box').addClass('fetched')
+ todc()
}
- };
+ }
}
}
//通知トグルボタン
function notfToggle(acct, tlid) {
- if ($("#notf-box_" + tlid).hasClass("column-hide")) {
- $("#notf-box_" + tlid).css("display", "block");
- $("#notf-box_" + tlid).animate(
+ if ($('#notf-box_' + tlid).hasClass('column-hide')) {
+ $('#notf-box_' + tlid).css('display', 'block')
+ $('#notf-box_' + tlid).animate(
{
- height: "400px"
+ height: '400px'
},
{
duration: 300,
complete: function() {
- $("#notf-box_" + tlid).css("overflow-y", "scroll");
- $("#notf-box_" + tlid).removeClass("column-hide");
+ $('#notf-box_' + tlid).css('overflow-y', 'scroll')
+ $('#notf-box_' + tlid).removeClass('column-hide')
}
}
- );
+ )
} else {
- $("#notf-box_" + tlid).css("overflow-y", "hidden");
- $("#notf-box_" + tlid).animate(
+ $('#notf-box_' + tlid).css('overflow-y', 'hidden')
+ $('#notf-box_' + tlid).animate(
{
- height: "0"
+ height: '0'
},
{
duration: 300,
complete: function() {
- $("#notf-box_" + tlid).addClass("column-hide");
- $("#notf-box_" + tlid).css("display", "none");
+ $('#notf-box_' + tlid).addClass('column-hide')
+ $('#notf-box_' + tlid).css('display', 'none')
}
}
- );
+ )
}
- notfCanceler(acct);
+ notfCanceler(acct)
}
function notfCanceler(acct) {
- $(".notf-reply_" + acct).text(0);
- localStorage.removeItem("notf-reply_" + acct);
- $(".notf-reply_" + acct).addClass("hide");
- $(".notf-fav_" + acct).text(0);
- localStorage.removeItem("notf-fav_" + acct);
- $(".notf-fav_" + acct).addClass("hide");
- $(".notf-bt_" + acct).text(0);
- localStorage.removeItem("notf-bt_" + acct);
- $(".notf-bt_" + acct).addClass("hide");
- $(".notf-follow_" + acct).text(0);
- localStorage.removeItem("notf-follow_" + acct);
- $(".notf-follow_" + acct).addClass("hide");
- $(".notf-icon_" + acct).removeClass("red-text");
+ $('.notf-reply_' + acct).text(0)
+ localStorage.removeItem('notf-reply_' + acct)
+ $('.notf-reply_' + acct).addClass('hide')
+ $('.notf-fav_' + acct).text(0)
+ localStorage.removeItem('notf-fav_' + acct)
+ $('.notf-fav_' + acct).addClass('hide')
+ $('.notf-bt_' + acct).text(0)
+ localStorage.removeItem('notf-bt_' + acct)
+ $('.notf-bt_' + acct).addClass('hide')
+ $('.notf-follow_' + acct).text(0)
+ localStorage.removeItem('notf-follow_' + acct)
+ $('.notf-follow_' + acct).addClass('hide')
+ $('.notf-icon_' + acct).removeClass('red-text')
}
function allNotfRead() {
- var multi = localStorage.getItem("multi");
+ var multi = localStorage.getItem('multi')
if (multi) {
- var obj = JSON.parse(multi);
+ var obj = JSON.parse(multi)
Object.keys(obj).forEach(function(key) {
- notfCanceler(key);
- });
+ notfCanceler(key)
+ })
}
}
-allNotfRead();
+allNotfRead()
diff --git a/app/js/tl/parse.js b/app/js/tl/parse.js
index 744aa8fc..5388c71c 100644
--- a/app/js/tl/parse.js
+++ b/app/js/tl/parse.js
@@ -1,1013 +1,1375 @@
//オブジェクトパーサー(トゥート)
function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
- var templete = "";
+ var templete = ''
if (obj[0]) {
if (tlid === 1) {
}
- localStorage.setItem("lastunix_" + tlid, date(obj[0].created_at, "unix"));
+ localStorage.setItem('lastunix_' + tlid, date(obj[0].created_at, 'unix'))
}
- var actb = "re,rt,fav,qt,del,pin,red";
+ var actb = 're,rt,fav,qt,del,pin,red'
if (actb) {
- var actb = actb.split(",");
- var disp = {};
+ var actb = actb.split(',')
+ var disp = {}
for (var k = 0; k < actb.length; k++) {
if (k < 4) {
- var tp = "type-a";
+ var tp = 'type-a'
} else {
- var tp = "type-b";
+ var tp = 'type-b'
}
- disp[actb[k]] = tp;
+ disp[actb[k]] = tp
}
}
- var qt = localStorage.getItem("quote");
- if (qt == "nothing" || !qt) {
- var qtClass = "hide";
+ var qt = localStorage.getItem('quote')
+ if (qt == 'nothing' || !qt) {
+ var qtClass = 'hide'
} else {
- if (qt == "apiQuote") {
- if (localStorage.getItem("quote_" + acct_id)) {
- var qtClass = "";
+ if (qt == 'apiQuote') {
+ if (localStorage.getItem('quote_' + acct_id)) {
+ var qtClass = ''
} else {
- var qtClass = "hide";
+ var qtClass = 'hide'
}
} else {
- var qtClass = "";
+ var qtClass = ''
}
}
- var datetype = localStorage.getItem("datetype");
- var nsfwtype = localStorage.getItem("nsfw");
- var sent = localStorage.getItem("sentence");
- var ltr = localStorage.getItem("letters");
- var gif = localStorage.getItem("gif");
- var imh = localStorage.getItem("img-height");
+ var datetype = localStorage.getItem('datetype')
+ var nsfwtype = localStorage.getItem('nsfw')
+ var sent = localStorage.getItem('sentence')
+ var ltr = localStorage.getItem('letters')
+ var gif = localStorage.getItem('gif')
+ var imh = localStorage.getItem('img-height')
if (!imh) {
- imh = 200;
+ imh = 200
}
- if (imh == "full") {
- imh = "auto";
+ if (imh == 'full') {
+ imh = 'auto'
} else {
- imh = imh + "px";
+ imh = imh + 'px'
}
//独自ロケール
- var locale = localStorage.getItem("locale");
- if (locale == "yes") {
- var locale = false;
+ var locale = localStorage.getItem('locale')
+ if (locale == 'yes') {
+ var locale = false
}
//ネイティブ通知
- var native = localStorage.getItem("nativenotf");
+ var native = localStorage.getItem('nativenotf')
if (!native) {
- native = "yes";
+ native = 'yes'
}
//クライアント強調
- var empCli = localStorage.getItem("client_emp");
+ var empCli = localStorage.getItem('client_emp')
if (empCli) {
- var empCli = JSON.parse(empCli);
+ var empCli = JSON.parse(empCli)
}
//クライアントミュート
- var muteCli = localStorage.getItem("client_mute");
+ var muteCli = localStorage.getItem('client_mute')
if (muteCli) {
- var muteCli = JSON.parse(muteCli);
+ var muteCli = JSON.parse(muteCli)
}
//ユーザー強調
- var useremp = localStorage.getItem("user_emp");
+ var useremp = localStorage.getItem('user_emp')
if (useremp) {
- var useremp = JSON.parse(useremp);
+ var useremp = JSON.parse(useremp)
}
//ワード強調
- var wordempList = localStorage.getItem("word_emp");
+ var wordempList = localStorage.getItem('word_emp')
if (wordempList) {
- var wordempList = JSON.parse(wordempList);
+ var wordempList = JSON.parse(wordempList)
}
//ワードミュート
- var wordmuteList = localStorage.getItem("word_mute");
+ var wordmuteList = localStorage.getItem('word_mute')
if (wordmuteList) {
- var wordmuteList = JSON.parse(wordmuteList);
+ var wordmuteList = JSON.parse(wordmuteList)
if (wordmuteList) {
- wordmuteList = wordmuteList.concat(mutefilter);
+ wordmuteList = wordmuteList.concat(mutefilter)
}
} else {
- wordmuteList = mutefilter;
+ wordmuteList = mutefilter
}
//Ticker
- var tickerck = localStorage.getItem("ticker_ok");
- if (tickerck=="yes") {
- var ticker = true;
- } else if(!ticker || ticker == "no") {
- var ticker = false;
+ var tickerck = localStorage.getItem('ticker_ok')
+ if (tickerck == 'yes') {
+ var ticker = true
+ } else if (!ticker || ticker == 'no') {
+ var ticker = false
}
//Animation
- var anime = localStorage.getItem("animation");
- if (anime == "yes" || !anime) {
- var animecss = "cvo-anime";
+ var anime = localStorage.getItem('animation')
+ if (anime == 'yes' || !anime) {
+ var animecss = 'cvo-anime'
} else {
- var animecss = "";
+ var animecss = ''
}
//Cards
- var card = localStorage.getItem("card_" + tlid);
+ var card = localStorage.getItem('card_' + tlid)
if (!sent) {
- sent = 500;
+ sent = 500
}
if (!ltr) {
- var ltr = 500;
+ var ltr = 500
}
- if (!nsfwtype || nsfwtype == "yes") {
- var nsfw = "ok";
+ if (!nsfwtype || nsfwtype == 'yes') {
+ var nsfw = 'ok'
} else {
- var nsfw;
+ var nsfw
}
- var cwtype = localStorage.getItem("cw");
- if (!cwtype || cwtype == "yes") {
- var cw = "ok";
+ var cwtype = localStorage.getItem('cw')
+ if (!cwtype || cwtype == 'yes') {
+ var cw = 'ok'
} else {
- var cw;
+ var cw
}
if (!datetype) {
- datetype = "absolute";
+ datetype = 'absolute'
}
if (!gif) {
- var gif = "yes";
+ var gif = 'yes'
}
if (!imh) {
- var imh = "200";
+ var imh = '200'
}
if (!emp) {
- var emp = [];
+ var emp = []
}
if (!mute) {
- var mute = [];
+ var mute = []
}
if (!useremp) {
- var useremp = [];
+ var useremp = []
}
if (!wordemp) {
- var wordemp = [];
+ var wordemp = []
}
if (!wordmute) {
- var wordmute = [];
+ var wordmute = []
}
//via通知
- var viashow = localStorage.getItem("viashow");
+ var viashow = localStorage.getItem('viashow')
if (!viashow) {
- viashow = "via-hide";
+ viashow = 'via-hide'
}
- if (viashow == "hide") {
- viashow = "via-hide";
+ if (viashow == 'hide') {
+ viashow = 'via-hide'
}
//認証なしTL
- if (mix == "noauth") {
- var noauth = "hide";
- var antinoauth = "";
+ if (mix == 'noauth') {
+ var noauth = 'hide'
+ var antinoauth = ''
} else {
- var noauth = "";
- var antinoauth = "hide";
+ var noauth = ''
+ var antinoauth = 'hide'
}
//DMTL
- if (type == "dm") {
- var dmHide = "hide";
- var antidmHide = "";
+ if (type == 'dm') {
+ var dmHide = 'hide'
+ var antidmHide = ''
} else {
- var dmHide = "";
- var antidmHide = "hide";
+ var dmHide = ''
+ var antidmHide = 'hide'
}
//マウスオーバーのみ
- var mouseover = localStorage.getItem("mouseover");
+ var mouseover = localStorage.getItem('mouseover')
if (!mouseover) {
- mouseover = "";
- } else if (mouseover == "yes" || mouseover == "click") {
- mouseover = "hide-actions";
- } else if (mouseover == "no") {
- mouseover = "";
+ mouseover = ''
+ } else if (mouseover == 'yes' || mouseover == 'click') {
+ mouseover = 'hide-actions'
+ } else if (mouseover == 'no') {
+ mouseover = ''
}
//リプカウント
- var replyct_view = localStorage.getItem("replyct");
+ var replyct_view = localStorage.getItem('replyct')
if (!replyct_view) {
- replyct_view = "hidden";
+ replyct_view = 'hidden'
}
- var local = [];
- var times = [];
+ var local = []
+ var times = []
Object.keys(obj).forEach(function(key) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var toot = obj[key];
- if (type == "dm") {
- var dmid = toot.id;
- toot = toot.last_status;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var toot = obj[key]
+ if (type == 'dm') {
+ var dmid = toot.id
+ toot = toot.last_status
}
if (toot.account.display_name) {
- var dis_name = escapeHTML(toot.account.display_name);
+ var dis_name = escapeHTML(toot.account.display_name)
} else {
- var dis_name = toot.account.acct;
+ var dis_name = toot.account.acct
}
if (toot.account.emojis) {
- var actemojick = toot.account.emojis[0];
+ var actemojick = toot.account.emojis[0]
} else {
- var actemojick = false;
+ var actemojick = false
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function(key5) {
- var emoji = toot.account.emojis[key5];
- var shortcode = emoji.shortcode;
- var emoji_url = ' ';
- var regExp = new RegExp(":" + shortcode + ":", "g");
- dis_name = dis_name.replace(regExp, emoji_url);
- });
+ var emoji = toot.account.emojis[key5]
+ var shortcode = emoji.shortcode
+ var emoji_url = `
+
+ `
+ var regExp = new RegExp(':' + shortcode + ':', 'g')
+ dis_name = dis_name.replace(regExp, emoji_url)
+ })
}
- var noticeavatar = "";
- if (mix == "notf") {
- if (gif == "yes") {
- noticeavatar = toot.account.avatar;
+ var noticeavatar = ''
+ if (mix == 'notf') {
+ if (gif == 'yes') {
+ noticeavatar = toot.account.avatar
} else {
- noticeavatar = toot.account.avatar_static;
+ noticeavatar = toot.account.avatar_static
}
- noticeavatar = "' + ' ';
- if (toot.type == "mention") {
- var what = lang.lang_parse_mentioned;
- var icon = "fa-share teal-text";
- noticeavatar = "";
- } else if (toot.type == "reblog") {
- var what = lang.lang_parse_bted;
- var icon = "fa-retweet light-blue-text";
- if (!locale && localStorage.getItem("bt_" + acct_id)) {
- what = localStorage.getItem("bt_" + acct_id);
+ noticeavatar = `
+
+ `
+ if (toot.type == 'mention') {
+ var what = lang.lang_parse_mentioned
+ var icon = 'fa-share teal-text'
+ noticeavatar = ''
+ } else if (toot.type == 'reblog') {
+ var what = lang.lang_parse_bted
+ var icon = 'fa-retweet light-blue-text'
+ if (!locale && localStorage.getItem('bt_' + acct_id)) {
+ what = localStorage.getItem('bt_' + acct_id)
}
- } else if (toot.type == "favourite") {
- var what = lang.lang_parse_faved;
- var icon = "fa-star yellow-text";
- if (!locale && localStorage.getItem("fav_" + acct_id)) {
- what = localStorage.getItem("fav_" + acct_id);
+ } else if (toot.type == 'favourite') {
+ var what = lang.lang_parse_faved
+ var icon = 'fa-star yellow-text'
+ if (!locale && localStorage.getItem('fav_' + acct_id)) {
+ what = localStorage.getItem('fav_' + acct_id)
}
- } else if (toot.type == "poll") {
- var what = lang.lang_parse_polled;
- var icon = "fa-tasks purple-text";
+ } else if (toot.type == 'poll') {
+ var what = lang.lang_parse_polled
+ var icon = 'fa-tasks purple-text'
}
- if (tlid == "notf") {
- var notfFilHide = "hide";
+ if (tlid == 'notf') {
+ var notfFilHide = 'hide'
} else {
- var notfFilHide = "";
+ var notfFilHide = ''
}
- var noticetext = ' ' + date(toot.created_at, datetype) + '' + dis_name + "(@" + toot.account.acct + ") ";
- var notice = noticetext;
- var memory = localStorage.getItem("notice-mem");
+ var noticetext = `
+
+
+
+ ${date(toot.created_at, datetype)}
+
+
+
+ ${dis_name}(@${toot.account.acct})
+ `
+ var notice = noticetext
+ var memory = localStorage.getItem('notice-mem')
if (popup >= 0 && obj.length < 5 && noticetext != memory) {
- if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
- if (toot.type == "mention") {
- var replyct = localStorage.getItem("notf-reply_" + acct_id);
- $(".notf-reply_" + acct_id).text(replyct * 1 - -1);
- localStorage.setItem("notf-reply_" + acct_id, replyct * 1 - -1);
- $(".notf-reply_" + acct_id).removeClass("hide");
- var sound = localStorage.getItem("replySound");
- if (sound == "default") {
- var file = "../../source/notif3.wav";
+ if (localStorage.getItem('hasNotfC_' + acct_id) != 'true') {
+ if (toot.type == 'mention') {
+ var replyct = localStorage.getItem('notf-reply_' + acct_id)
+ $('.notf-reply_' + acct_id).text(replyct * 1 - -1)
+ localStorage.setItem('notf-reply_' + acct_id, replyct * 1 - -1)
+ $('.notf-reply_' + acct_id).removeClass('hide')
+ var sound = localStorage.getItem('replySound')
+ if (sound == 'default') {
+ var file = '../../source/notif3.wav'
}
- } else if (toot.type == "reblog") {
- var btct = localStorage.getItem("notf-bt_" + acct_id);
- $(".notf-bt_" + acct_id).text(btct * 1 - -1);
- localStorage.setItem("notf-bt_" + acct_id, btct * 1 - -1);
- $(".notf-bt_" + acct_id).removeClass("hide");
- var sound = localStorage.getItem("btSound");
- if (sound == "default") {
- var file = "../../source/notif2.wav";
+ } else if (toot.type == 'reblog') {
+ var btct = localStorage.getItem('notf-bt_' + acct_id)
+ $('.notf-bt_' + acct_id).text(btct * 1 - -1)
+ localStorage.setItem('notf-bt_' + acct_id, btct * 1 - -1)
+ $('.notf-bt_' + acct_id).removeClass('hide')
+ var sound = localStorage.getItem('btSound')
+ if (sound == 'default') {
+ var file = '../../source/notif2.wav'
}
- } else if (toot.type == "favourite") {
- var favct = localStorage.getItem("notf-fav_" + acct_id);
- $(".notf-fav_" + acct_id).text(favct * 1 - -1);
- localStorage.setItem("notf-fav_" + acct_id, favct * 1 - -1);
- $(".notf-fav_" + acct_id).removeClass("hide");
- var sound = localStorage.getItem("favSound");
- if (sound == "default") {
- var file = "../../source/notif.wav";
+ } else if (toot.type == 'favourite') {
+ var favct = localStorage.getItem('notf-fav_' + acct_id)
+ $('.notf-fav_' + acct_id).text(favct * 1 - -1)
+ localStorage.setItem('notf-fav_' + acct_id, favct * 1 - -1)
+ $('.notf-fav_' + acct_id).removeClass('hide')
+ var sound = localStorage.getItem('favSound')
+ if (sound == 'default') {
+ var file = '../../source/notif.wav'
}
}
}
if (popup > 0) {
- M.toast({ html: "[" + domain + "]" + escapeHTML(toot.account.display_name) + what, displayLength: popup * 1000 });
+ M.toast({
+ html: '[' + domain + ']' + escapeHTML(toot.account.display_name) + what,
+ displayLength: popup * 1000
+ })
}
//通知音
- if (sound == "c1") {
- var file = localStorage.getItem("custom1");
- } else if (sound == "c2") {
- var file = localStorage.getItem("custom2");
- } else if (sound == "c3") {
- var file = localStorage.getItem("custom3");
- } else if (sound == "c4") {
- var file = localStorage.getItem("custom4");
+ if (sound == 'c1') {
+ var file = localStorage.getItem('custom1')
+ } else if (sound == 'c2') {
+ var file = localStorage.getItem('custom2')
+ } else if (sound == 'c3') {
+ var file = localStorage.getItem('custom3')
+ } else if (sound == 'c4') {
+ var file = localStorage.getItem('custom4')
}
if (file) {
- request = new XMLHttpRequest();
- request.open("GET", file, true);
- request.responseType = "arraybuffer";
- request.onload = playSound;
- request.send();
+ request = new XMLHttpRequest()
+ request.open('GET', file, true)
+ request.responseType = 'arraybuffer'
+ request.onload = playSound
+ request.send()
}
- if (native == "yes") {
- var os = localStorage.getItem("platform");
+ if (native == 'yes') {
+ var os = localStorage.getItem('platform')
var options = {
- body: toot.account.display_name + "(" + toot.account.acct + ")" + what + "\n\n" + $.strip_tags(toot.status.content),
+ body:
+ toot.account.display_name +
+ '(' +
+ toot.account.acct +
+ ')' +
+ what +
+ '\n\n' +
+ $.strip_tags(toot.status.content),
icon: toot.account.avatar
- };
- var n = new Notification("TheDesk:" + domain, options);
+ }
+ var n = new Notification('TheDesk:' + domain, options)
}
- if (localStorage.getItem("hasNotfC_" + acct_id) != "true") {
- $(".notf-icon_" + acct_id).addClass("red-text");
+ if (localStorage.getItem('hasNotfC_' + acct_id) != 'true') {
+ $('.notf-icon_' + acct_id).addClass('red-text')
}
- localStorage.setItem("notice-mem", noticetext);
- noticetext = "";
+ localStorage.setItem('notice-mem', noticetext)
+ noticetext = ''
}
- var if_notf = 'data-notfIndv="' + acct_id + "_" + toot.id + '" data-notf="' + toot.id + '"';
- var toot = toot.status;
- var uniqueid = toot.id;
- var dis_name = escapeHTML(toot.account.display_name);
+ var if_notf = 'data-notfIndv="' + acct_id + '_' + toot.id + '" data-notf="' + toot.id + '"'
+ var toot = toot.status
+ var uniqueid = toot.id
+ var dis_name = escapeHTML(toot.account.display_name)
if (toot.account.emojis) {
- var actemojick = toot.account.emojis[0];
+ var actemojick = toot.account.emojis[0]
} else {
- var actemojick = false;
+ var actemojick = false
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function(key5) {
- var emoji = toot.account.emojis[key5];
- var shortcode = emoji.shortcode;
- var emoji_url = ' ';
- var regExp = new RegExp(":" + shortcode + ":", "g");
- dis_name = dis_name.replace(regExp, emoji_url);
- });
+ var emoji = toot.account.emojis[key5]
+ var shortcode = emoji.shortcode
+ var emoji_url = `
+ `
+ var regExp = new RegExp(':' + shortcode + ':', 'g')
+ dis_name = dis_name.replace(regExp, emoji_url)
+ })
}
} else {
- var if_notf = "";
+ var if_notf = ''
if (toot.reblog) {
- if (gif == "yes") {
- noticeavatar = toot.account.avatar;
+ if (gif == 'yes') {
+ noticeavatar = toot.account.avatar
} else {
- noticeavatar = toot.account.avatar_static;
+ noticeavatar = toot.account.avatar_static
}
- noticeavatar = "' + ' ';
- var rebtxt = lang.lang_parse_btedsimple;
- var rticon = "fa-retweet light-blue-text";
- if (localStorage.getItem("domain_" + acct_id) == "imastodon.net" && !locale) {
- rebtxt = ":「わかるわ」";
- } else if (localStorage.getItem("domain_" + acct_id) == "mstdn.osaka" && !locale) {
- rebtxt = "がしばいた";
+ noticeavatar = `
+
+ `
+ var rebtxt = lang.lang_parse_btedsimple
+ var rticon = 'fa-retweet light-blue-text'
+ if (localStorage.getItem('domain_' + acct_id) == 'imastodon.net' && !locale) {
+ rebtxt = ':「わかるわ」'
+ } else if (localStorage.getItem('domain_' + acct_id) == 'mstdn.osaka' && !locale) {
+ rebtxt = 'がしばいた'
}
- var notice = ' ' + dis_name + "(@" + toot.account.acct + ") ";
- var boostback = "shared";
- var uniqueid = toot.id;
- var toot = toot.reblog;
- var dis_name = escapeHTML(toot.account.display_name);
+ var notice =
+ ' ' +
+ dis_name +
+ '(@' +
+ toot.account.acct +
+ ') '
+ var boostback = 'shared'
+ var uniqueid = toot.id
+ var toot = toot.reblog
+ var dis_name = escapeHTML(toot.account.display_name)
if (!dis_name) {
- dis_name = toot.account.acct;
+ dis_name = toot.account.acct
}
if (toot.account.emojis) {
- var actemojick = toot.account.emojis[0];
+ var actemojick = toot.account.emojis[0]
} else {
- var actemojick = false;
+ var actemojick = false
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function(key5) {
- var emoji = toot.account.emojis[key5];
- var shortcode = emoji.shortcode;
- var emoji_url = ' ';
- var regExp = new RegExp(":" + shortcode + ":", "g");
- dis_name = dis_name.replace(regExp, emoji_url);
- });
+ var emoji = toot.account.emojis[key5]
+ var shortcode = emoji.shortcode
+ var emoji_url = `
+ `
+ var regExp = new RegExp(':' + shortcode + ':', 'g')
+ dis_name = dis_name.replace(regExp, emoji_url)
+ })
}
} else {
- var uniqueid = toot.id;
- var notice = "";
- var boostback = "unshared";
+ var uniqueid = toot.id
+ var notice = ''
+ var boostback = 'unshared'
//ユーザー強調
if (toot.account.username != toot.account.acct) {
- var fullname = toot.account.acct;
+ var fullname = toot.account.acct
} else {
- var domain = localStorage.getItem("domain_" + acct_id);
- var fullname = toot.account.acct + "@" + domain;
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var fullname = toot.account.acct + '@' + domain
}
if (useremp) {
Object.keys(useremp).forEach(function(key10) {
- var user = useremp[key10];
+ var user = useremp[key10]
if (user == fullname) {
- boostback = "emphasized";
+ boostback = 'emphasized'
}
- });
+ })
}
}
}
- if (toot.content == "") {
- var content = " ";
+ if (toot.content == '') {
+ var content = ' '
} else {
- var content = toot.content;
+ var content = toot.content
}
if (content) {
- var id = toot.id;
- if (mix == "home") {
- var home = "";
- var divider = '
';
+ var id = toot.id
+ if (mix == 'home') {
+ var home = ''
+ var divider = '
'
} else {
- var home = "";
- var divider = '
';
+ var home = ''
+ var divider = '
'
}
if (toot.account.locked) {
- var locked = ' ';
+ var locked = ' '
} else {
- var locked = "";
+ var locked = ''
}
if (!toot.application) {
- var via = "";
- viashow = "hide";
+ var via = ''
+ viashow = 'hide'
} else {
- var via = escapeHTML(toot.application.name);
+ var via = escapeHTML(toot.application.name)
if (empCli) {
//強調チェック
Object.keys(empCli).forEach(function(key6) {
- var empCliList = empCli[key6];
+ var empCliList = empCli[key6]
if (empCliList == via) {
- boostback = "emphasized";
+ boostback = 'emphasized'
}
- });
+ })
}
if (muteCli) {
//ミュートチェック
Object.keys(muteCli).forEach(function(key7) {
- var muteCliList = muteCli[key7];
+ var muteCliList = muteCli[key7]
if (muteCliList == via) {
- boostback = "hide";
+ boostback = 'hide'
}
- });
+ })
}
}
- if (mix == "pinned") {
- boostback = "emphasized";
+ if (mix == 'pinned') {
+ boostback = 'emphasized'
}
if (toot.spoiler_text && cw) {
- var spoil = escapeHTML(toot.spoiler_text);
- var spoiler = "cw cw_hide_" + toot.id;
- var api_spoil = "gray";
- var spoiler_show = '' + lang.lang_parse_cwshow + " ";
+ var spoil = escapeHTML(toot.spoiler_text)
+ var spoiler = 'cw cw_hide_' + toot.id
+ var api_spoil = 'gray'
+ var spoiler_show = `${lang.lang_parse_cwshow} `
} else {
if (content) {
- var ct1 = content.split("
").length + content.split(" ").length - 2;
- var ct2 = content.split("").length + content.split(" ").length - 2;
+ var ct1 = content.split('').length + content.split(' ').length - 2
+ var ct2 = content.split('').length + content.split(' ').length - 2
} else {
- var ct1 = 100;
- var ct2 = 100;
+ var ct1 = 100
+ var ct2 = 100
}
if (ct1 > ct2) {
- var ct = ct1;
+ var ct = ct1
} else {
- var ct = ct2;
+ var ct = ct2
}
- if ((sent < ct && $.mb_strlen($.strip_tags(content)) > 5) || ($.strip_tags(content).length > ltr && $.mb_strlen($.strip_tags(content)) > 5)) {
- var content = '' + lang.lang_parse_fulltext + " " + content;
- var spoil = '' + $.mb_substr($.strip_tags(content), 0, 100) + ' ' + lang.lang_parse_autofold + " ";
- var spoiler = "cw cw_hide_" + toot.id;
- var spoiler_show = '' + lang.lang_parse_more + " ";
+ if (
+ (sent < ct && $.mb_strlen($.strip_tags(content)) > 5) ||
+ ($.strip_tags(content).length > ltr && $.mb_strlen($.strip_tags(content)) > 5)
+ ) {
+ var content = `${lang.lang_parse_fulltext} ` + content
+ var spoil = `${$.mb_substr(
+ $.strip_tags(content),
+ 0,
+ 100
+ )}
+ ${lang.lang_parse_autofold} `
+ var spoiler = 'cw cw_hide_' + toot.id
+ var spoiler_show = `
+ ${lang.lang_parse_more}
+ `
} else {
- var spoil = escapeHTML(toot.spoiler_text);
- var spoiler = "";
- var spoiler_show = "";
+ var spoil = escapeHTML(toot.spoiler_text)
+ var spoiler = ''
+ var spoiler_show = ''
}
}
var urls = $.strip_tags(content)
- .replace(/\n/g, " ")
- .match(/https?:\/\/([^+_]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/);
- urlsck = content.match(/(https?):\/\/([^<>]*?)\/([^"]*)/g);
+ .replace(/\n/g, ' ')
+ .match(
+ /https?:\/\/([^+_]+)\/?(?!.*((media|tags)|mentions)).*([-_.!~*\'()a-zA-Z0-9;\/?:\@&=+\$,%#]+)?/
+ )
+ urlsck = content.match(/(https?):\/\/([^<>]*?)\/([^"]*)/g)
if (urlsck) {
for (var urlct = 0; urlct < urlsck.length; urlct++) {
- var urlindv = urlsck[urlct];
- urlCont = urlindv.match(/(https?):\/\/([^a-zA-Z0-9.-]*?)\.(.+?)\/([^"]*)/);
+ var urlindv = urlsck[urlct]
+ urlCont = urlindv.match(/(https?):\/\/([^a-zA-Z0-9.-]*?)\.(.+?)\/([^"]*)/)
if (urlCont) {
- urlindv = urlindv.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&");
- var encoded = encodeURI(urlCont[4]);
- var punycoded = "xn--" + punycode.encode(urlCont[2]);
- var eUrl = urlCont[1] + "://" + punycoded + "." + urlCont[3] + "/" + encoded;
- var regExp = new RegExp('href="' + urlindv + '"', "g");
- content = content.replace(regExp, 'href="' + eUrl + '"');
+ urlindv = urlindv.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&')
+ var encoded = encodeURI(urlCont[4])
+ var punycoded = 'xn--' + punycode.encode(urlCont[2])
+ var eUrl = urlCont[1] + '://' + punycoded + '.' + urlCont[3] + '/' + encoded
+ var regExp = new RegExp('href="' + urlindv + '"', 'g')
+ content = content.replace(regExp, 'href="' + eUrl + '"')
}
}
}
if (urls) {
- var analyze = "' + lang.lang_parse_url + " ";
+ var analyze = `
+ ${lang.lang_parse_url}
+ `
} else {
- var analyze = "";
+ var analyze = ''
}
- var viewer = "";
- var hasmedia = "";
- var youtube = "";
+ var viewer = ''
+ var hasmedia = ''
+ var youtube = ''
//Poll
- var poll = "";
+ var poll = ''
if (toot.poll) {
- var poll = pollParse(toot.poll, acct_id);
+ var poll = pollParse(toot.poll, acct_id)
}
- var mediack = toot.media_attachments[0];
+ var mediack = toot.media_attachments[0]
//メディアがあれば
- var media_ids = "";
+ var media_ids = ''
if (mediack) {
- hasmedia = "hasmedia";
- var cwdt = 100 / toot.media_attachments.length;
+ hasmedia = 'hasmedia'
+ var cwdt = 100 / toot.media_attachments.length
Object.keys(toot.media_attachments).forEach(function(key2) {
- var media = toot.media_attachments[key2];
- var purl = media.preview_url;
- media_ids = media_ids + media.id + ",";
- var url = media.url;
- var nsfwmes = "";
+ var media = toot.media_attachments[key2]
+ var purl = media.preview_url
+ media_ids = media_ids + media.id + ','
+ var url = media.url
+ var nsfwmes = ''
if (toot.sensitive && nsfw) {
- var sense = "sensitive";
- var blur = media.blurhash;
- nsfwmes = '' + lang.lang_parse_nsfw + "
";
+ var sense = 'sensitive'
+ var blur = media.blurhash
+ nsfwmes = '' + lang.lang_parse_nsfw + '
'
if (blur) {
- purl = parseBlur(blur);
- var sense = "";
+ purl = parseBlur(blur)
+ var sense = ''
}
} else {
- var sense = "";
- var blur = null;
+ var sense = ''
+ var blur = null
}
- if (media.pleroma && media.pleroma.mime_type.indexOf("video") !== -1) {
- viewer = viewer + " ';
+ if (media.pleroma && media.pleroma.mime_type.indexOf('video') !== -1) {
+ viewer =
+ viewer +
+ `
+
+ `
} else {
- if (media.type == "unknown") {
- var mty = media.remote_url.match(/.+(\..+)$/)[1];
- viewer = viewer + '[' + lang.lang_parse_unknown + "( " + mty + " )] ";
- } else if (media.type == "audio") {
- viewer = viewer + '';
+ if (media.type == 'unknown') {
+ var mty = media.remote_url.match(/.+(\..+)$/)[1]
+ viewer =
+ viewer +
+ `[${lang.lang_parse_unknown}(${mty})] `
+ } else if (media.type == 'audio') {
+ viewer =
+ viewer +
+ ''
} else {
if (media.description) {
- var desc = media.description;
+ var desc = media.description
} else {
- var desc = "";
+ var desc = ''
}
- console.log("https://"+domain+"/storage/no-preview.png")
- if(media.preview_url=="https://"+domain+"/storage/no-preview.png"){ purl=url; nsfwmes = 'Unavailable preview
';}
- viewer = viewer + " ' + nsfwmes + " ";
+ console.log('https://' + domain + '/storage/no-preview.png')
+ if (media.preview_url == 'https://' + domain + '/storage/no-preview.png') {
+ purl = url
+ nsfwmes = 'Unavailable preview
'
+ }
+ viewer =
+ viewer +
+ `
+
+ ${nsfwmes}
+ `
}
}
- });
- media_ids = media_ids.slice(0, -1);
+ })
+ media_ids = media_ids.slice(0, -1)
} else {
- viewer = "";
- hasmedia = "nomedia";
+ viewer = ''
+ hasmedia = 'nomedia'
}
- var menck = toot.mentions[0];
- var mentions = "";
+ var menck = toot.mentions[0]
+ var mentions = ''
//メンションであれば
if (menck) {
- mentions = "";
- var to_mention = [];
+ mentions = ''
+ var to_mention = []
Object.keys(toot.mentions).forEach(function(key3) {
- var mention = toot.mentions[key3];
+ var mention = toot.mentions[key3]
//自分は除外
//自インスタンスかどうかを確認し、IDの一致
- if (mention.acct == mention.username && mention.id == localStorage.getItem("user-id_" + acct_id)) {
+ if (
+ mention.acct == mention.username &&
+ mention.id == localStorage.getItem('user-id_' + acct_id)
+ ) {
//自分
} else {
//そのトゥの人NG
if (toot.account.acct != mention.acct) {
- mentions = mentions + "@' + mention.acct + " ";
- to_mention.push(mention.acct);
+ mentions =
+ mentions +
+ `@${mention.acct} `
+ to_mention.push(mention.acct)
}
}
- });
- to_mention.push(toot.account.acct);
- mentions = '' + mentions + "
";
+ })
+ to_mention.push(toot.account.acct)
+ mentions = '' + mentions + '
'
} else {
- var to_mention = [toot.account.acct];
+ var to_mention = [toot.account.acct]
//メンションじゃなくてもlang_parse_thread
if (toot.in_reply_to_id) {
- mentions = '";
+ mentions = ``
}
}
- var tagck = toot.tags[0];
- var tags = "";
+ var tagck = toot.tags[0]
+ var tags = ''
//タグであれば
if (tagck) {
Object.keys(toot.tags).forEach(function(key4) {
- var tag = toot.tags[key4];
- var featured = " Feature ';
- tags = tags + '#' + tag.name + ":TL Toot ' + "Pin ' + featured + " ";
- });
- tags = '' + tags + "
";
+ var tag = toot.tags[key4]
+ var featured = ` Feature `
+ tags =
+ tags +
+ `#${tag.name}:
+ TL Toot
+ Pin featured `
+ })
+ tags = '' + tags + '
'
}
//リプ数
if (toot.replies_count || toot.replies_count === 0) {
- var replyct = toot.replies_count;
- if (replyct_view == "hidden" && replyct > 1) {
- replyct = "1+";
+ var replyct = toot.replies_count
+ if (replyct_view == 'hidden' && replyct > 1) {
+ replyct = '1+'
}
} else {
- var replyct = "";
+ var replyct = ''
}
//公開範囲を取得
- var vis = "";
- var visen = toot.visibility;
- if (visen == "public") {
- var vis = 'public ";
- var can_rt = "";
- } else if (visen == "unlisted") {
- var vis = 'lock_open ";
- var can_rt = "";
- } else if (visen == "private") {
- var vis = 'lock ";
+ var vis = ''
+ var visen = toot.visibility
+ if (visen == 'public') {
+ var vis = `
+ public
+ `
+ var can_rt = ''
+ } else if (visen == 'unlisted') {
+ var vis = `
+ lock_open
+ `
+ var can_rt = ''
+ } else if (visen == 'private') {
+ var vis = `
+ lock
+ `
- var can_rt = "unvisible";
- } else if (visen == "direct") {
- var vis = 'mail ";
- var can_rt = "unvisible";
+ var can_rt = 'unvisible'
+ } else if (visen == 'direct') {
+ var vis = `
+ mail
+ `
+ var can_rt = 'unvisible'
}
- if (toot.account.acct == localStorage.getItem("user_" + acct_id)) {
- var if_mine = "";
- var mine_via = "type-b";
- var can_rt = "";
+ if (toot.account.acct == localStorage.getItem('user_' + acct_id)) {
+ var if_mine = ''
+ var mine_via = 'type-b'
+ var can_rt = ''
} else {
- var if_mine = "hide";
- var mine_via = "";
+ var if_mine = 'hide'
+ var mine_via = ''
}
if (toot.favourited) {
- var if_fav = " yellow-text";
- var fav_app = "faved";
+ var if_fav = ' yellow-text'
+ var fav_app = 'faved'
} else {
- var if_fav = "";
- var fav_app = "";
+ var if_fav = ''
+ var fav_app = ''
}
if (toot.reblogged) {
- var if_rt = "light-blue-text";
- var rt_app = "rted";
+ var if_rt = 'light-blue-text'
+ var rt_app = 'rted'
} else {
- var if_rt = "";
- var rt_app = "";
+ var if_rt = ''
+ var rt_app = ''
}
if (toot.pinned) {
- var if_pin = "blue-text";
- var pin_app = "pinnedToot";
+ var if_pin = 'blue-text'
+ var pin_app = 'pinnedToot'
} else {
- var if_pin = "";
- var pin_app = "";
+ var if_pin = ''
+ var pin_app = ''
}
//アニメ再生
- if (gif == "yes") {
- var avatar = toot.account.avatar;
+ if (gif == 'yes') {
+ var avatar = toot.account.avatar
} else {
- var avatar = toot.account.avatar_static;
+ var avatar = toot.account.avatar_static
}
//ワードミュート
if (wordmuteList) {
Object.keys(wordmuteList).forEach(function(key8) {
- var worde = wordmuteList[key8];
+ var worde = wordmuteList[key8]
if (worde) {
if (worde.tag) {
- var wordList = worde.tag;
+ var wordList = worde.tag
} else {
- var wordList = worde;
+ var wordList = worde
}
- var regExp = new RegExp(wordList.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
+ var regExp = new RegExp(wordList.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
if ($.strip_tags(content).match(regExp)) {
- boostback = "hide by_filter";
+ boostback = 'hide by_filter'
}
}
- });
+ })
}
//ワード強調
if (wordempList) {
Object.keys(wordempList).forEach(function(key9) {
- var wordList = wordempList[key9];
+ var wordList = wordempList[key9]
if (wordList) {
- var wordList = wordList.tag;
- var regExp = new RegExp(wordList.replace(/[.*+?^=!:${}()|[\]\/\\]/g, "\\$&"), "g");
- content = content.replace(regExp, '' + wordList + " ");
+ var wordList = wordList.tag
+ var regExp = new RegExp(wordList.replace(/[.*+?^=!:${}()|[\]\/\\]/g, '\\$&'), 'g')
+ content = content.replace(regExp, '' + wordList + ' ')
}
- });
+ })
}
if (toot.emojis) {
- var emojick = toot.emojis[0];
+ var emojick = toot.emojis[0]
} else {
- var emojick = false;
+ var emojick = false
}
//絵文字があれば
if (emojick) {
Object.keys(toot.emojis).forEach(function(key5) {
- var emoji = toot.emojis[key5];
- var shortcode = emoji.shortcode;
- var emoji_url = ' ';
- var regExp = new RegExp(":" + shortcode + ":", "g");
- content = content.replace(regExp, emoji_url);
- spoil = spoil.replace(regExp, emoji_url);
- poll = poll.replace(regExp, emoji_url);
- });
+ var emoji = toot.emojis[key5]
+ var shortcode = emoji.shortcode
+ var emoji_url = `
+ `
+ 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];
+ var nicoemojick = toot.profile_emojis[0]
} else {
- var nicoemojick = false;
+ 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 = ' ';
- var regExp = new RegExp(":" + shortcode + ":", "g");
- content = content.replace(regExp, emoji_url);
- spoil = spoil.replace(regExp, emoji_url);
- poll = poll.replace(regExp, emoji_url);
- });
+ var emoji = toot.profile_emojis[keynico]
+ var shortcode = emoji.shortcode
+ var emoji_url = ` `
+ 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);
+ content = twemoji.parse(content)
if (dis_name) {
- dis_name = twemoji.parse(dis_name);
+ dis_name = twemoji.parse(dis_name)
}
if (spoil) {
- spoil = twemoji.parse(spoil);
+ spoil = twemoji.parse(spoil)
}
if (noticetext) {
- noticetext = twemoji.parse(noticetext);
+ noticetext = twemoji.parse(noticetext)
}
if (notice) {
- notice = twemoji.parse(notice);
+ notice = twemoji.parse(notice)
}
if (poll) {
- poll = twemoji.parse(poll);
+ poll = twemoji.parse(poll)
}
//日本語じゃない
if (toot.language != lang.language && toot.language) {
- var trans = '';
+ var trans = ``
} else {
- var trans = "";
+ var trans = ''
}
//Cards
if (!card && toot.card) {
- var cards = toot.card;
- if (cards.provider_name == "Twitter") {
+ var cards = toot.card
+ if (cards.provider_name == 'Twitter') {
if (cards.image) {
- var twiImg = ' ';
+ var twiImg = ' '
} else {
- var twiImg = "";
+ var twiImg = ''
}
- analyze = '";
+ analyze = ``
}
if (cards.title) {
- analyze = 'URL' + lang.lang_cards_check + ": Title:" + escapeHTML(cards.title) + " " + escapeHTML(cards.description) + " ";
+ analyze = `
+ URL${lang.lang_cards_check}:
+ Title:${escapeHTML(cards.title)}
+ ${escapeHTML(cards.description)}
+ `
}
if (cards.html) {
- analyze = cards.html + 'picture_in_picture_alt ';
+ analyze =
+ cards.html +
+ `picture_in_picture_alt `
}
}
//Ticker
- var tickerdom = "";
+ var tickerdom = ''
if (ticker) {
- var tickerdata = localStorage.getItem("ticker");
+ var tickerdata = localStorage.getItem('ticker')
if (tickerdata) {
- var tickerdata = JSON.parse(tickerdata);
+ var tickerdata = JSON.parse(tickerdata)
- var thisdomain = toot.account.acct.split("@");
+ var thisdomain = toot.account.acct.split('@')
if (thisdomain.length > 1) {
- thisdomain = thisdomain[1];
+ thisdomain = thisdomain[1]
}
for (var i = 0; i < tickerdata.length; i++) {
- var value = tickerdata[i];
+ var value = tickerdata[i]
if (value.domain == thisdomain) {
- var tickerdom = ' ' + escapeHTML(value.name) + " ";
- break;
+ var tickerdom = `
+
+
${escapeHTML(value.name)}
+
`
+ break
}
}
}
}
//Quote
if (toot.quote) {
- var quoteUser = toot.quote.account.display_name;
+ var quoteUser = toot.quote.account.display_name
if (!quoteUser) {
- quoteUser = toot.quote.account.acct;
+ quoteUser = toot.quote.account.acct
}
- poll = poll + '' + '
' + escapeHTML(quoteUser) + '
' + toot.quote.content + '
';
+ poll =
+ poll +
+ `
+
+
+ ${escapeHTML(quoteUser)}
+
+
+ ${toot.quote.content}
+
+
+
`
}
- templete = templete + '" + '
' + notice + home + "
" + '
' + ' ' + noticeavatar + "
" + '
' + dis_name + ' @' + toot.account.acct + locked + "
" + '
' + date(toot.created_at, datetype) + " " + "
" + '
' + tickerdom + '
' + spoil + " " + spoiler_show + '' + content + "
" + poll + "" + viewer + "" + '
' + analyze + " " + "" + mentions + tags + "
" + '
' + vis + "
" + '
' + '
" + '
" + '
" + '
" + '
' + '
" + '
' + '
' + '
' + trans + '
' + via + " " + '
' + '
' + "
" + "";
+ templete =
+ templete +
+ `
+ `
}
- });
- if (mix == "mix") {
- return [templete, local, times];
+ })
+ if (mix == 'mix') {
+ return [templete, local, times]
} else {
- return templete;
+ return templete
}
}
//オブジェクトパーサー(ユーザーデータ)
function userparse(obj, auth, acct_id, tlid, popup) {
//独自ロケール
- var locale = localStorage.getItem("locale");
- if (locale == "yes") {
- var locale = false;
+ var locale = localStorage.getItem('locale')
+ if (locale == 'yes') {
+ var locale = false
}
- var templete = "";
- var datetype = localStorage.getItem("datetype");
+ var templete = ''
+ var datetype = localStorage.getItem('datetype')
Object.keys(obj).forEach(function(key) {
- var toot = obj[key];
+ var toot = obj[key]
if (toot) {
- console.log(["Parsing", toot]);
+ console.log(['Parsing', toot])
if (!toot.username) {
- var raw = toot;
- toot = toot.account;
- var notf = true;
+ var raw = toot
+ toot = toot.account
+ var notf = true
} else {
- var notf = false;
+ var notf = false
}
//Instance Actorって…
- if (toot.username.indexOf(".") < 0) {
+ if (toot.username.indexOf('.') < 0) {
if (toot.locked) {
- var locked = ' ';
+ var locked = ' '
} else {
- var locked = "";
+ var locked = ''
}
- if (auth == "request") {
- var authhtml = 'person_add person_add_disabled ';
+ if (auth == 'request') {
+ var authhtml =
+ `
+ person_add
+
+
+ person_add_disabled
+ `
} else {
- var authhtml = "";
+ var authhtml = ''
}
- var ftxt = lang.lang_parse_followed;
- if (!locale && localStorage.getItem("followlocale_" + acct_id)) {
- ftxt = localStorage.getItem("followlocale_" + acct_id);
+ var ftxt = lang.lang_parse_followed
+ if (!locale && localStorage.getItem('followlocale_' + acct_id)) {
+ ftxt = localStorage.getItem('followlocale_' + acct_id)
}
if (popup > 0 || popup == -1 || notf) {
- var notftext = ftxt + " ";
+ var notftext = ftxt + ' '
} else {
- var notftext = "";
+ var notftext = ''
}
- var memory = localStorage.getItem("notice-mem");
+ var memory = localStorage.getItem('notice-mem')
if (popup >= 0 && obj.length < 5 && notftext != memory) {
- M.toast({ html: escapeHTML(toot.display_name) + ":" + ftxt, displayLength: popup * 1000 });
- $(".notf-icon_" + tlid).addClass("red-text");
- localStorage.setItem("notice-mem", notftext);
- notftext = "";
- var native = localStorage.getItem("nativenotf");
+ M.toast({ html: escapeHTML(toot.display_name) + ':' + ftxt, displayLength: popup * 1000 })
+ $('.notf-icon_' + tlid).addClass('red-text')
+ localStorage.setItem('notice-mem', notftext)
+ notftext = ''
+ var native = localStorage.getItem('nativenotf')
if (!native) {
- native = "yes";
+ native = 'yes'
}
- if (native == "yes") {
- var os = localStorage.getItem("platform");
+ if (native == 'yes') {
+ var os = localStorage.getItem('platform')
var options = {
- body: toot.display_name + "(" + toot.acct + ")" + ftxt,
+ body: toot.display_name + '(' + toot.acct + ')' + ftxt,
icon: toot.avatar
- };
- var domain = localStorage.getItem("domain_" + acct_id);
- var n = new Notification("TheDesk:" + domain, options);
+ }
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var n = new Notification('TheDesk:' + domain, options)
}
}
if (toot.display_name) {
- var dis_name = escapeHTML(toot.display_name);
+ var dis_name = escapeHTML(toot.display_name)
} else {
- var dis_name = toot.username;
+ var dis_name = toot.username
}
//ネイティブ通知
if (toot.emojis) {
- var actemojick = toot.emojis[0];
+ var actemojick = toot.emojis[0]
} else {
- var actemojick = false;
+ var actemojick = false
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.emojis).forEach(function(key5) {
- var emoji = toot.emojis[key5];
- var shortcode = emoji.shortcode;
- var emoji_url = ' ';
- var regExp = new RegExp(":" + shortcode + ":", "g");
- dis_name = dis_name.replace(regExp, emoji_url);
- });
+ var emoji = toot.emojis[key5]
+ var shortcode = emoji.shortcode
+ var emoji_url = `
+ `
+ var regExp = new RegExp(':' + shortcode + ':', 'g')
+ dis_name = dis_name.replace(regExp, emoji_url)
+ })
}
if (dis_name) {
- dis_name = twemoji.parse(dis_name);
+ dis_name = twemoji.parse(dis_name)
}
if (toot.avatar) {
- var avatar = toot.avatar;
+ var avatar = toot.avatar
} else {
- var avatar = "../../img/missing.svg";
+ var avatar = '../../img/missing.svg'
}
- if (tlid == "dir" && acct_id == "noauth") {
- var udg = "';
+ if (tlid == 'dir' && acct_id == 'noauth') {
+ var udg =
+ ` `
} else {
- var udg = " ';
+ var udg =
+ ` `
}
- var latest = date(toot.last_status_at, "relative");
+ var latest = date(toot.last_status_at, 'relative')
if (toot.last_status_at) {
- var latesthtml = 'Last: ' + latest + "
";
+ var latesthtml = `Last:${latest}
`
} else {
- var latesthtml = "";
+ var latesthtml = ''
}
- templete = templete + '' + notftext + '
' + udg + '
' + '
' + dis_name + " " + ' @' + toot.acct + locked + " " + "
" + "
" + '
' + toot.note.replace(/ .+/g, '... ') + "
" + '
' + lang.lang_status_follow + ":" + toot.following_count + '
' + lang.lang_status_followers + ":" + toot.followers_count + "
" + latesthtml + authhtml + "
" + "
";
+ templete =
+ templete +
+ `
+
${notftext}
+
+ ${udg}
+
+
+
+
+ ${dis_name}
+
+ @ ${toot.acct}${locked}
+
+
+
+ ${toot.note.replace(/ .+/g, '... ')}
+
+
+
+ ${lang.lang_status_follow}:${toot.following_count}
+
+
+ ${lang.lang_status_followers}:${toot.followers_count}
+
+ ${latesthtml}${authhtml}
+
+
+ `
}
}
- });
- return templete;
+ })
+ return templete
}
//クライアントダイアログ
function client(name) {
- if (name != "Unknown") {
+ if (name != 'Unknown') {
//聞く
Swal.fire({
title: lang.lang_parse_clientop,
text: name + lang.lang_parse_clienttxt,
- type: "info",
+ type: 'info',
showCancelButton: true,
- confirmButtonColor: "#3085d6",
- cancelButtonColor: "#3085d6",
+ confirmButtonColor: '#3085d6',
+ cancelButtonColor: '#3085d6',
confirmButtonText: lang.lang_parse_clientmute,
cancelButtonText: lang.lang_parse_clientemp,
showCloseButton: true,
focusConfirm: false
}).then(result => {
- if (result.dismiss == "cancel") {
+ if (result.dismiss == 'cancel') {
//Emp
- var cli = localStorage.getItem("client_emp");
- var obj = JSON.parse(cli);
+ var cli = localStorage.getItem('client_emp')
+ var obj = JSON.parse(cli)
if (!obj) {
- var obj = [];
- obj.push(name);
- M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 });
+ var obj = []
+ obj.push(name)
+ M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
} else {
- var can;
+ var can
Object.keys(obj).forEach(function(key) {
- var cliT = obj[key];
+ var cliT = obj[key]
if (cliT != name && !can) {
- can = false;
+ can = false
} else {
- can = true;
- obj.splice(key, 1);
- M.toast({ html: escapeHTML(name) + lang.lang_status_unemphas, displayLength: 2000 });
+ can = true
+ obj.splice(key, 1)
+ M.toast({ html: escapeHTML(name) + lang.lang_status_unemphas, displayLength: 2000 })
}
- });
+ })
if (!can) {
- obj.push(name);
- M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 });
+ obj.push(name)
+ M.toast({ html: escapeHTML(name) + lang.lang_status_emphas, displayLength: 2000 })
} else {
}
- var json = JSON.stringify(obj);
- localStorage.setItem("client_emp", json);
- parseColumn();
+ var json = JSON.stringify(obj)
+ localStorage.setItem('client_emp', json)
+ parseColumn()
}
} else if (result.value) {
//Mute
- var cli = localStorage.getItem("client_mute");
- var obj = JSON.parse(cli);
+ var cli = localStorage.getItem('client_mute')
+ var obj = JSON.parse(cli)
if (!obj) {
- obj = [];
+ obj = []
}
- obj.push(name);
- var json = JSON.stringify(obj);
- localStorage.setItem("client_mute", json);
- M.toast({ html: escapeHTML(name) + lang.lang_parse_mute, displayLength: 2000 });
- parseColumn();
+ obj.push(name)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('client_mute', json)
+ M.toast({ html: escapeHTML(name) + lang.lang_parse_mute, displayLength: 2000 })
+ parseColumn()
}
- });
+ })
}
}
//Poll Parser
function pollParse(poll, acct_id) {
- var datetype = localStorage.getItem("datetype");
- var choices = poll.options;
+ var datetype = localStorage.getItem('datetype')
+ var choices = poll.options
if (poll.own_votes) {
- var minechoice = poll.own_votes;
+ var minechoice = poll.own_votes
} else {
- var minechoice = [];
+ var minechoice = []
}
if (poll.voted) {
- var myvote = lang.lang_parse_voted;
- var result_hide = "";
+ var myvote = lang.lang_parse_voted
+ var result_hide = ''
} else if (poll.expired) {
- var myvote = lang.lang_parse_endedvote;
- var result_hide = "";
+ var myvote = lang.lang_parse_endedvote
+ var result_hide = ''
} else {
- var myvote = " ' + lang.lang_parse_vote + " ";
+ var myvote =
+ `${lang.lang_parse_vote} `
if (choices[0].votes_count === 0 || choices[0].votes_count > 0) {
- myvote = myvote + "' + lang.lang_parse_unvoted + " ";
+ myvote =
+ myvote +
+ `
+ ${lang.lang_parse_unvoted}
+ `
}
- var result_hide = "hide";
+ var result_hide = 'hide'
}
- var ended = date(poll.expires_at, datetype);
- var pollHtml = "";
+ var ended = date(poll.expires_at, datetype)
+ var pollHtml = ''
Object.keys(choices).forEach(function(keyc) {
- var choice = choices[keyc];
- var voteit = "";
+ var choice = choices[keyc]
+ var voteit = ''
for (var i = 0; i < minechoice.length; i++) {
- var me = minechoice[i];
+ var me = minechoice[i]
if (me == keyc) {
- var voteit = "✅";
- break;
+ var voteit = '✅'
+ break
}
}
if (!poll.voted && !poll.expired) {
- var votesel = "voteSelMastodon('" + acct_id + "','" + poll.id + "'," + keyc + "," + poll.multiple + ")";
- var voteclass = "pointer waves-effect waves-light";
+ var votesel =
+ "voteSelMastodon('" + acct_id + "','" + poll.id + "'," + keyc + ',' + poll.multiple + ')'
+ var voteclass = 'pointer waves-effect waves-light'
} else {
- var votesel = "";
- var voteclass = "";
+ var votesel = ''
+ var voteclass = ''
}
- pollHtml = pollHtml + '' + escapeHTML(choice.title) + '(' + choice.votes_count + ") " + voteit + "
";
- });
- pollHtml = '";
- return pollHtml;
+ pollHtml =
+ pollHtml +
+ `
+ ${escapeHTML(choice.title)}
+
+ (${choice.votes_count})
+
+ ${voteit}
+
`
+ })
+ pollHtml =
+ ``
+ return pollHtml
}
diff --git a/app/js/tl/poll.js b/app/js/tl/poll.js
index 9c70344a..1947eda1 100644
--- a/app/js/tl/poll.js
+++ b/app/js/tl/poll.js
@@ -1,37 +1,37 @@
//アンケートのトグル
function pollToggle() {
- if ($("#poll").hasClass("hide")) {
- $("#right-side").show()
- $("#right-side").css("width", "300px")
- $("#left-side").css("width", "calc(100% - 300px)")
- var width = localStorage.getItem("postbox-width");
- if (width) {
- width = width.replace("px", "") * 1 + 300
- } else {
- width = 600
- }
- $("#post-box").css("width", width + "px")
- $("#poll").removeClass("hide")
- $("#pollsta").text(lang.lang_yesno)
- } else {
- $("#right-side").hide()
- $("#left-side").css("width", "100%")
- $("#right-side").css("width", "300px")
- var width = localStorage.getItem("postbox-width");
- if (width) {
- width = width.replace("px", "") * 1
- } else {
- width = 300
- }
- $("#post-box").css("width", width + "px")
- $("#emoji").addClass("hide")
- $("#poll").addClass("hide")
- $("#pollsta").text(lang.lang_no)
- }
+ if ($('#poll').hasClass('hide')) {
+ $('#right-side').show()
+ $('#right-side').css('width', '300px')
+ $('#left-side').css('width', 'calc(100% - 300px)')
+ var width = localStorage.getItem('postbox-width')
+ if (width) {
+ width = width.replace('px', '') * 1 + 300
+ } else {
+ width = 600
+ }
+ $('#post-box').css('width', width + 'px')
+ $('#poll').removeClass('hide')
+ $('#pollsta').text(lang.lang_yesno)
+ } else {
+ $('#right-side').hide()
+ $('#left-side').css('width', '100%')
+ $('#right-side').css('width', '300px')
+ var width = localStorage.getItem('postbox-width')
+ if (width) {
+ width = width.replace('px', '') * 1
+ } else {
+ width = 300
+ }
+ $('#post-box').css('width', width + 'px')
+ $('#emoji').addClass('hide')
+ $('#poll').addClass('hide')
+ $('#pollsta').text(lang.lang_no)
+ }
}
function pollProviderCk() {
- $(".poll-provider").addClass("hide");
- $("#" + $("#poll-sel").val()).removeClass("hide");
+ $('.poll-provider').addClass('hide')
+ $('#' + $('#poll-sel').val()).removeClass('hide')
}
/*
function pollAddtime(num){
@@ -42,86 +42,86 @@ function pollAddtime(num){
}
*/
function pollCalc() {
- var days = $("#days_poll").val();
- var hrs = $("#hours_poll").val();
- var mins = $("#mins_poll").val();
- console.log("Poll calc:" + days * 86400 + hrs * 3600 + mins * 60)
- return days * 86400 + hrs * 3600 + mins * 60;
-
+ var days = $('#days_poll').val()
+ var hrs = $('#hours_poll').val()
+ var mins = $('#mins_poll').val()
+ console.log('Poll calc:' + days * 86400 + hrs * 3600 + mins * 60)
+ return days * 86400 + hrs * 3600 + mins * 60
}
//Vote
function voteSelMastodon(acct_id, id, to, mul) {
- if ($('.vote_' + acct_id + '_' + id + '_' + to).hasClass("sel")) {
- $('.vote_' + acct_id + '_' + id + '_' + to).css("background-color", "transparent")
- $('.vote_' + acct_id + '_' + id + '_' + to).removeClass("sel");
- } else {
- if (!mul) {
- $('.vote_' + acct_id + '_' + id + ' div').each(function (i, elem) {
- if (i == to) {
- $(this).css("background-color", "var(--emphasized)");
- $(this).addClass("sel");
- } else {
- $(this).css("background-color", "transparent")
- $(this).removeClass("sel");
- }
- });
- } else {
- $('.vote_' + acct_id + '_' + id + '_' + to).css("background-color", "var(--emphasized)")
- $('.vote_' + acct_id + '_' + id + '_' + to).addClass("sel");
- }
- }
-
+ if ($('.vote_' + acct_id + '_' + id + '_' + to).hasClass('sel')) {
+ $('.vote_' + acct_id + '_' + id + '_' + to).css('background-color', 'transparent')
+ $('.vote_' + acct_id + '_' + id + '_' + to).removeClass('sel')
+ } else {
+ if (!mul) {
+ $('.vote_' + acct_id + '_' + id + ' div').each(function(i, elem) {
+ if (i == to) {
+ $(this).css('background-color', 'var(--emphasized)')
+ $(this).addClass('sel')
+ } else {
+ $(this).css('background-color', 'transparent')
+ $(this).removeClass('sel')
+ }
+ })
+ } else {
+ $('.vote_' + acct_id + '_' + id + '_' + to).css('background-color', 'var(--emphasized)')
+ $('.vote_' + acct_id + '_' + id + '_' + to).addClass('sel')
+ }
+ }
}
function voteMastodon(acct_id, id) {
- var choice = [];
- $('.vote_' + acct_id + '_' + id + ' div').each(function (i, elem) {
- if ($(this).hasClass("sel")) {
- choice.push(i + "");
- }
- });
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/polls/" + id + "/votes";
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- return false;
- }
- var httpreq = new XMLHttpRequest();
- httpreq.open('POST', start, true);
- httpreq.setRequestHeader('Content-Type', 'application/json');
- httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify({ choices: choice }));
- httpreq.onreadystatechange = function () {
- voteMastodonrefresh(acct_id, id)
- }
+ var choice = []
+ $('.vote_' + acct_id + '_' + id + ' div').each(function(i, elem) {
+ if ($(this).hasClass('sel')) {
+ choice.push(i + '')
+ }
+ })
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/polls/' + id + '/votes'
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ return false
+ }
+ var httpreq = new XMLHttpRequest()
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify({ choices: choice }))
+ httpreq.onreadystatechange = function() {
+ voteMastodonrefresh(acct_id, id)
+ }
}
function showResult(acct_id, id) {
- $('.vote_' + acct_id + '_' + id + '_result').toggleClass("hide")
+ $('.vote_' + acct_id + '_' + id + '_result').toggleClass('hide')
}
function voteMastodonrefresh(acct_id, id) {
- var datetype = localStorage.getItem("datetype");
- if (!datetype) {
- datetype = "absolute";
- }
- var httpreqd = new XMLHttpRequest();
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/polls/" + id;
- httpreqd.open('GET', start, true);
- httpreqd.setRequestHeader('Content-Type', 'application/json');
- httpreqd.setRequestHeader('Authorization', 'Bearer ' + at);
- httpreqd.responseType = 'json';
- httpreqd.send();
- httpreqd.onreadystatechange = function () {
- if (httpreqd.readyState == 4) {
- if(this.status!==200){ setLog(start, this.status, this.response); }
- var json = httpreqd.response;
- console.log(["Refresh vote", json]);
- if (!json) {
- return false;
- }
- var poll = pollParse(json, acct_id)
- $('.vote_' + acct_id + '_' + json.id).html(poll)
- }
- }
-}
\ No newline at end of file
+ var datetype = localStorage.getItem('datetype')
+ if (!datetype) {
+ datetype = 'absolute'
+ }
+ var httpreqd = new XMLHttpRequest()
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/polls/' + id
+ httpreqd.open('GET', start, true)
+ httpreqd.setRequestHeader('Content-Type', 'application/json')
+ httpreqd.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreqd.responseType = 'json'
+ httpreqd.send()
+ httpreqd.onreadystatechange = function() {
+ if (httpreqd.readyState == 4) {
+ if (this.status !== 200) {
+ setLog(start, this.status, this.response)
+ }
+ var json = httpreqd.response
+ console.log(['Refresh vote', json])
+ if (!json) {
+ return false
+ }
+ var poll = pollParse(json, acct_id)
+ $('.vote_' + acct_id + '_' + json.id).html(poll)
+ }
+ }
+}
diff --git a/app/js/tl/speech.js b/app/js/tl/speech.js
index 610cef55..dccb8a41 100644
--- a/app/js/tl/speech.js
+++ b/app/js/tl/speech.js
@@ -1,170 +1,183 @@
-$voise = null;
-isBouyomi = localStorage.getItem("voice_bouyomi");
-$voiseName = lang.lang_speech;
-$voices = speechSynthesis.getVoices();
-$synthes = new SpeechSynthesisUtterance();
-$voise = $.grep($voices, function (n, i) { return n.name == $voiseName })[0];
-$synthes.voice = $voise; // 音声の設定
-localStorage.removeItem("voicebank");
+$voise = null
+isBouyomi = localStorage.getItem('voice_bouyomi')
+$voiseName = lang.lang_speech
+$voices = speechSynthesis.getVoices()
+$synthes = new SpeechSynthesisUtterance()
+$voise = $.grep($voices, function(n, i) {
+ return n.name == $voiseName
+})[0]
+$synthes.voice = $voise // 音声の設定
+localStorage.removeItem('voicebank')
speechSynthesis.cancel()
-if (!localStorage.getItem("voice_vol")) {
- localStorage.setItem("voice_vol", 1)
+if (!localStorage.getItem('voice_vol')) {
+ localStorage.setItem('voice_vol', 1)
}
-voiceRate = localStorage.getItem("voice_speed");
+voiceRate = localStorage.getItem('voice_speed')
$synthes.rate = voiceRate
-voicePitch = localStorage.getItem("voice_pitch");
+voicePitch = localStorage.getItem('voice_pitch')
$synthes.pitch = voicePitch
-voiceVol = localStorage.getItem("voice_vol");
+voiceVol = localStorage.getItem('voice_vol')
$synthes.volume = voiceVol
function say(msgr) {
- msg = voiceParse(msgr);
- var voice = localStorage.getItem("voicebank");
- var obj = JSON.parse(voice);
- if (!obj) {
- var json = JSON.stringify([msg]);
- localStorage.setItem("voicebank", json);
- } else {
- obj.push([msg]);
- var json = JSON.stringify(obj);
- localStorage.setItem("voicebank", json);
- }
-
+ msg = voiceParse(msgr)
+ var voice = localStorage.getItem('voicebank')
+ var obj = JSON.parse(voice)
+ if (!obj) {
+ var json = JSON.stringify([msg])
+ localStorage.setItem('voicebank', json)
+ } else {
+ obj.push([msg])
+ var json = JSON.stringify(obj)
+ localStorage.setItem('voicebank', json)
+ }
}
-$repeat = setInterval(function () {
- if (!speechSynthesis.speaking) {
- var voice = localStorage.getItem("voicebank");
- if (voice) {
- var obj = JSON.parse(voice);
- if (obj[0]) {
- if (localStorage.getItem("voice_bouyomi")) {
- var delim = "";
- var thisVoiceRate = voiceRate * 10 + 70
- var thisVoicePitch = voicePitch * 50 + 70
- var thisVoiceVol = voiceVol * 100
- console.log(thisVoiceRate, thisVoicePitch, thisVoiceVol)
- var command = 0x0001;
- var type = 0;
- var sends = "" + command + delim + thisVoiceRate + delim + thisVoicePitch + delim + thisVoiceVol + delim + type + delim + obj[0];
- bouyomiConnect(sends)
- } else {
- $synthes.text = obj[0];
- speechSynthesis.speak($synthes);
- }
+$repeat = setInterval(function() {
+ if (!speechSynthesis.speaking) {
+ var voice = localStorage.getItem('voicebank')
+ if (voice) {
+ var obj = JSON.parse(voice)
+ if (obj[0]) {
+ if (localStorage.getItem('voice_bouyomi')) {
+ var delim = ''
+ var thisVoiceRate = voiceRate * 10 + 70
+ var thisVoicePitch = voicePitch * 50 + 70
+ var thisVoiceVol = voiceVol * 100
+ console.log(thisVoiceRate, thisVoicePitch, thisVoiceVol)
+ var command = 0x0001
+ var type = 0
+ var sends =
+ '' +
+ command +
+ delim +
+ thisVoiceRate +
+ delim +
+ thisVoicePitch +
+ delim +
+ thisVoiceVol +
+ delim +
+ type +
+ delim +
+ obj[0]
+ bouyomiConnect(sends)
+ } else {
+ $synthes.text = obj[0]
+ speechSynthesis.speak($synthes)
+ }
- obj.splice(0, 1);
- var json = JSON.stringify(obj);
- localStorage.setItem("voicebank", json);
- }
- }
- }
-}, 300);
+ obj.splice(0, 1)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('voicebank', json)
+ }
+ }
+ }
+}, 300)
function voiceParse(msg) {
- msg = $.strip_tags(msg);
- msg = msg.replace(/#/g, "");
- msg = msg.replace(/'/g, "");
- msg = msg.replace(/"/g, "");
- msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?%&-]+/g, "");
- return msg;
+ msg = $.strip_tags(msg)
+ msg = msg.replace(/#/g, '')
+ msg = msg.replace(/'/g, '')
+ msg = msg.replace(/"/g, '')
+ msg = msg.replace(/https?:\/\/[a-zA-Z0-9./-@_=?%&-]+/g, '')
+ return msg
}
function voiceToggle(tlid) {
- var voiceck = localStorage.getItem("voice_" + tlid);
- if (voiceck) {
- localStorage.removeItem("voice_" + tlid);
- speechSynthesis.cancel()
- if (localStorage.getItem("voice_bouyomi")) {
- var command = 0x0010;
- var sends = "" + command;
- bouyomiConnect(sends)
- }
- $("#sta-voice-" + tlid).text("Off");
- $("#sta-voice-" + tlid).css("color", 'red');
- parseColumn(tlid);
- } else {
- localStorage.setItem("voice_" + tlid, "true");
- $("#sta-voice-" + tlid).text("On");
- $("#sta-voice-" + tlid).css("color", '#009688');
- parseColumn(tlid);
- }
+ var voiceck = localStorage.getItem('voice_' + tlid)
+ if (voiceck) {
+ localStorage.removeItem('voice_' + tlid)
+ speechSynthesis.cancel()
+ if (localStorage.getItem('voice_bouyomi')) {
+ var command = 0x0010
+ var sends = '' + command
+ bouyomiConnect(sends)
+ }
+ $('#sta-voice-' + tlid).text('Off')
+ $('#sta-voice-' + tlid).css('color', 'red')
+ parseColumn(tlid)
+ } else {
+ localStorage.setItem('voice_' + tlid, 'true')
+ $('#sta-voice-' + tlid).text('On')
+ $('#sta-voice-' + tlid).css('color', '#009688')
+ parseColumn(tlid)
+ }
}
function voiceCheck(tlid) {
- var voiceck = localStorage.getItem("voice_" + tlid);
- if (voiceck) {
- $("#sta-voice-" + tlid).text("On");
- $("#sta-voice-" + tlid).css("color", '#009688');
- } else {
- $("#sta-voice-" + tlid).text("Off");
- $("#sta-voice-" + tlid).css("color", 'red');
- }
+ var voiceck = localStorage.getItem('voice_' + tlid)
+ if (voiceck) {
+ $('#sta-voice-' + tlid).text('On')
+ $('#sta-voice-' + tlid).css('color', '#009688')
+ } else {
+ $('#sta-voice-' + tlid).text('Off')
+ $('#sta-voice-' + tlid).css('color', 'red')
+ }
}
function voicePlay() {
- if (speechSynthesis.speaking) {
- speechSynthesis.cancel()
- } else {
- var text = $("#voicetxt").val();
- var rate = $("#voicespeed").val();
- var pitch = $("#voicepitch").val()
- var vol = $("#voicevol").val()
- if (localStorage.getItem("voice_bouyomi")) {
- var delim = "";
- rate = rate * 1 + 70
- pitch = pitch * 1 + 70
- var command = 0x0001; // コマンドです。0x0001.読み上げ/0x0010.ポーズ/0x0020.再開/0x0030.スキップ
- /*var speed = 100; // 速度50-200。-1を指定すると本体設定
+ if (speechSynthesis.speaking) {
+ speechSynthesis.cancel()
+ } else {
+ var text = $('#voicetxt').val()
+ var rate = $('#voicespeed').val()
+ var pitch = $('#voicepitch').val()
+ var vol = $('#voicevol').val()
+ if (localStorage.getItem('voice_bouyomi')) {
+ var delim = ''
+ rate = rate * 1 + 70
+ pitch = pitch * 1 + 70
+ var command = 0x0001 // コマンドです。0x0001.読み上げ/0x0010.ポーズ/0x0020.再開/0x0030.スキップ
+ /*var speed = 100; // 速度50-200。-1を指定すると本体設定
var pitch = 100; // ピッチ50-200。-1を指定すると本体設定
var volume = 100; // ボリューム0-100。-1を指定すると本体設定*/
- var type = 0; // 声質(0.本体設定/1.女性1/2.女性2/3.男性1/4.男性2/5.中性/6.ロボット/7.機械1/8.機械2)
- var sends = "" + command + delim + rate + delim + pitch + delim + vol + delim + type + delim + text;
- bouyomiConnect(sends)
- } else {
- $synthes.text = text
- $synthes.rate = rate / 10
- $synthes.pitch = pitch / 50
- $synthes.volume = vol / 100;
- speechSynthesis.speak($synthes);
- }
- }
+ var type = 0 // 声質(0.本体設定/1.女性1/2.女性2/3.男性1/4.男性2/5.中性/6.ロボット/7.機械1/8.機械2)
+ var sends =
+ '' + command + delim + rate + delim + pitch + delim + vol + delim + type + delim + text
+ bouyomiConnect(sends)
+ } else {
+ $synthes.text = text
+ $synthes.rate = rate / 10
+ $synthes.pitch = pitch / 50
+ $synthes.volume = vol / 100
+ speechSynthesis.speak($synthes)
+ }
+ }
}
function voiceSettings() {
- var awk = $("[name=bym]:checked").val();
- if (awk == "yes") {
- localStorage.setItem("voice_bouyomi", "yes");
- M.toast({ html: "Bouyomi Chan connection requires WebSocket Plugin", displayLength: 3000 })
- } else {
- localStorage.removeItem("voice_bouyomi");
- }
- localStorage.setItem("voice_speed", $("#voicespeed").val() / 10);
- localStorage.setItem("voice_pitch", $("#voicepitch").val() / 50);
- localStorage.setItem("voice_vol", $("#voicevol").val() / 100);
- M.toast({ html: lang.lang_speech_refresh, displayLength: 3000 })
+ var awk = $('[name=bym]:checked').val()
+ if (awk == 'yes') {
+ localStorage.setItem('voice_bouyomi', 'yes')
+ M.toast({ html: 'Bouyomi Chan connection requires WebSocket Plugin', displayLength: 3000 })
+ } else {
+ localStorage.removeItem('voice_bouyomi')
+ }
+ localStorage.setItem('voice_speed', $('#voicespeed').val() / 10)
+ localStorage.setItem('voice_pitch', $('#voicepitch').val() / 50)
+ localStorage.setItem('voice_vol', $('#voicevol').val() / 100)
+ M.toast({ html: lang.lang_speech_refresh, displayLength: 3000 })
}
function voiceSettingLoad() {
- var flag = localStorage.getItem("voice_bouyomi");
- if (flag) {
- $("#bym_yes").prop("checked", true);
- } else {
- $("#bym_no").prop("checked", true);
- }
- var speed = localStorage.getItem("voice_speed");
- var pitch = localStorage.getItem("voice_pitch");
- var vol = localStorage.getItem("voice_vol");
- if (speed) {
- $("#voicespeed").val(speed * 10);
- $("#voicespeedVal").text(speed * 10);
- }
- if (pitch) {
- $("#voicepitch").val(pitch * 50);
- $("#voicepitchVal").text(pitch * 50);
- }
- if (vol) {
- $("#voicevol").val(vol * 100);
- $("#voicevolVal").text(vol * 100);
- }
+ var flag = localStorage.getItem('voice_bouyomi')
+ if (flag) {
+ $('#bym_yes').prop('checked', true)
+ } else {
+ $('#bym_no').prop('checked', true)
+ }
+ var speed = localStorage.getItem('voice_speed')
+ var pitch = localStorage.getItem('voice_pitch')
+ var vol = localStorage.getItem('voice_vol')
+ if (speed) {
+ $('#voicespeed').val(speed * 10)
+ $('#voicespeedVal').text(speed * 10)
+ }
+ if (pitch) {
+ $('#voicepitch').val(pitch * 50)
+ $('#voicepitchVal').text(pitch * 50)
+ }
+ if (vol) {
+ $('#voicevol').val(vol * 100)
+ $('#voicevolVal').text(vol * 100)
+ }
}
function bouyomiConnect(sends) {
- var socket = new WebSocket('ws://localhost:50002/');
- socket.onopen = function () {
- socket.send(sends);
- }
-
-}
\ No newline at end of file
+ var socket = new WebSocket('ws://localhost:50002/')
+ socket.onopen = function() {
+ socket.send(sends)
+ }
+}
diff --git a/app/js/tl/src.js b/app/js/tl/src.js
index db174225..4a4dc78e 100644
--- a/app/js/tl/src.js
+++ b/app/js/tl/src.js
@@ -1,226 +1,267 @@
//検索
//検索ボックストグル
function searchMenu() {
- $("#src-contents").html("");
- trend();
- $("#left-menu div").removeClass("active");
- $("#searchMenu").addClass("active");
- $(".menu-content").addClass("hide");
- $("#src-box").removeClass("hide");
+ $('#src-contents').html('')
+ trend()
+ $('#left-menu div').removeClass('active')
+ $('#searchMenu').addClass('active')
+ $('.menu-content').addClass('hide')
+ $('#src-box').removeClass('hide')
//$('ul.tabs').tabs('select_tab', 'src-sta');
}
//検索取得
function src(mode, offset) {
if (!offset) {
- $("#src-contents").html("");
- var add = "";
+ $('#src-contents').html('')
+ var add = ''
} else {
- var add = "&type=accounts&offset=" + $("#src-accts .cvo").length;
+ var add = '&type=accounts&offset=' + $('#src-accts .cvo').length
}
- var q = $("#src").val();
- var acct_id = $("#src-acct-sel").val();
- if (acct_id == "tootsearch") {
- tsAdd(q);
- return false;
+ var q = $('#src').val()
+ var acct_id = $('#src-acct-sel').val()
+ if (acct_id == 'tootsearch') {
+ tsAdd(q)
+ return false
}
- localStorage.setItem("last-use", acct_id);
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var m = q.match(/^#(.+)$/);
+ localStorage.setItem('last-use', acct_id)
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var m = q.match(/^#(.+)$/)
if (m) {
- q = m[1];
+ q = m[1]
}
- if (user == "--now") {
- var user = $("#his-data").attr("user-id");
+ if (user == '--now') {
+ var user = $('#his-data').attr('user-id')
}
if (!mode) {
- var start = "https://" + domain + "/api/v2/search?q=" + q + add;
+ var start = 'https://' + domain + '/api/v2/search?q=' + q + add
} else {
- var start = "https://" + domain + "/api/v1/search?q=" + q;
+ var start = 'https://' + domain + '/api/v1/search?q=' + q
}
- console.log("Try to search at " + start);
+ console.log('Try to search at ' + start)
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- src("v1");
- return false;
+ src('v1')
+ return false
})
.then(function(json) {
- console.log(["Search", json]);
+ console.log(['Search', json])
//ハッシュタグ
if (json.hashtags[0]) {
- var tags = "";
+ var tags = ''
Object.keys(json.hashtags).forEach(function(key4) {
- var tag = json.hashtags[key4];
+ var tag = json.hashtags[key4]
if (mode) {
- tags = tags + "#" + escapeHTML(tag) + " ";
+ tags =
+ tags +
+ `
+ #${escapeHTML(tag)}
+
+ `
} else {
- tags = tags + graphDraw(tag, acct_id);
+ tags = tags + graphDraw(tag, acct_id)
}
- });
- $("#src-contents").append("Tags " + tags);
+ })
+ $('#src-contents').append('Tags ' + tags)
}
//トゥート
if (json.statuses[0]) {
- var templete = parse(json.statuses, "", acct_id);
- $("#src-contents").append(" Mentions " + templete);
+ var templete = parse(json.statuses, '', acct_id)
+ $('#src-contents').append(' Mentions ' + templete)
}
//アカウント
if (json.accounts[0]) {
- var templete = userparse(json.accounts, "", acct_id);
+ var templete = userparse(json.accounts, '', acct_id)
if (!offset) {
- $("#src-contents").append(' Accounts' + templete + '
more... ');
+ $('#src-contents').append(
+ ` Accounts
+ ${templete}
+
more... `
+ )
} else {
- $("#src-accts").append(templete);
+ $('#src-accts').append(templete)
}
}
- jQuery("time.timeago").timeago();
- });
+ jQuery('time.timeago').timeago()
+ })
}
function tsAdd(q) {
var add = {
domain: acct_id,
- type: "tootsearch",
+ type: 'tootsearch',
data: q
- };
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- localStorage.setItem("card_" + obj.length, "true");
- obj.push(add);
- var json = JSON.stringify(obj);
- localStorage.setItem("column", json);
- parseColumn("add");
+ }
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ localStorage.setItem('card_' + obj.length, 'true')
+ obj.push(add)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('column', json)
+ parseColumn('add')
}
function tootsearch(tlid, q) {
- var start = "https://tootsearch.chotto.moe/api/v1/search?from=0&sort=created_at%3Adesc&q=" + q;
- console.log("Toot srrach at " + start);
- $("#notice_" + tlid).text("tootsearch(" + q + ")");
- $("#notice_icon_" + tlid).text("search");
+ var start = 'https://tootsearch.chotto.moe/api/v1/search?from=0&sort=created_at%3Adesc&q=' + q
+ console.log('Toot srrach at ' + start)
+ $('#notice_' + tlid).text('tootsearch(' + q + ')')
+ $('#notice_icon_' + tlid).text('search')
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(raw) {
- var templete = "";
- var json = raw.hits.hits;
- var max_id = raw["hits"].length;
+ var templete = ''
+ var json = raw.hits.hits
+ var max_id = raw['hits'].length
for (var i = 0; i < json.length; i++) {
- var toot = json[i]["_source"];
+ var toot = json[i]['_source']
if (lastid != toot.uri) {
if (toot && toot.account) {
- templete = templete + parse([toot], "noauth", null, tlid, 0, [], "tootsearch");
+ templete = templete + parse([toot], 'noauth', null, tlid, 0, [], 'tootsearch')
}
}
- var lastid = toot.uri;
+ var lastid = toot.uri
}
if (!templete) {
- templete = lang.lang_details_nodata;
+ templete = lang.lang_details_nodata
} else {
- templete = templete + '
';
+ templete = templete + `
`
}
- $("#timeline_" + tlid).html(templete);
+ $('#timeline_' + tlid).html(templete)
- jQuery("time.timeago").timeago();
- });
+ jQuery('time.timeago').timeago()
+ })
}
function moreTs(tlid, q) {
- var sid = $("#timeline_" + tlid + " .ts-marker")
+ var sid = $('#timeline_' + tlid + ' .ts-marker')
.last()
- .attr("data-maxid");
- moreloading = true;
- var start = "https://tootsearch.chotto.moe/api/v1/search?from=" + sid + "&sort=created_at%3Adesc&q=" + q;
- $("#notice_" + tlid).text("tootsearch(" + q + ")");
- $("#notice_icon_" + tlid).text("search");
+ .attr('data-maxid')
+ moreloading = true
+ var start =
+ 'https://tootsearch.chotto.moe/api/v1/search?from=' + sid + '&sort=created_at%3Adesc&q=' + q
+ $('#notice_' + tlid).text('tootsearch(' + q + ')')
+ $('#notice_icon_' + tlid).text('search')
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json"
+ 'content-type': 'application/json'
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(raw) {
- var templete = "";
- var json = raw.hits.hits;
- var max_id = raw["hits"].length;
+ var templete = ''
+ var json = raw.hits.hits
+ var max_id = raw['hits'].length
for (var i = 0; i < json.length; i++) {
- var toot = json[i]["_source"];
+ var toot = json[i]['_source']
if (lastid != toot.uri) {
if (toot && toot.account) {
- templete = templete + parse([toot], "noauth", null, tlid, 0, [], "tootsearch");
+ templete = templete + parse([toot], 'noauth', null, tlid, 0, [], 'tootsearch')
}
}
- var lastid = toot.uri;
+ var lastid = toot.uri
}
if (!templete) {
- templete = lang.lang_details_nodata;
+ templete = lang.lang_details_nodata
} else {
- templete = templete + '
';
+ templete = templete + `
`
}
- $("#timeline_" + tlid).append(templete);
+ $('#timeline_' + tlid).append(templete)
- jQuery("time.timeago").timeago();
- });
+ jQuery('time.timeago').timeago()
+ })
}
function graphDraw(tag, acct_id) {
- var tags = "";
- var his = tag.history;
- var max = Math.max.apply(null, [his[0].uses, his[1].uses, his[2].uses, his[3].uses, his[4].uses, his[5].uses, his[6].uses]);
- var six = 50 - (his[6].uses / max) * 50;
- var five = 50 - (his[5].uses / max) * 50;
- var four = 50 - (his[4].uses / max) * 50;
- var three = 50 - (his[3].uses / max) * 50;
- var two = 50 - (his[2].uses / max) * 50;
- var one = 50 - (his[1].uses / max) * 50;
- var zero = 50 - (his[0].uses / max) * 50;
+ var tags = ''
+ var his = tag.history
+ var max = Math.max.apply(null, [
+ his[0].uses,
+ his[1].uses,
+ his[2].uses,
+ his[3].uses,
+ his[4].uses,
+ his[5].uses,
+ his[6].uses
+ ])
+ var six = 50 - (his[6].uses / max) * 50
+ var five = 50 - (his[5].uses / max) * 50
+ var four = 50 - (his[4].uses / max) * 50
+ var three = 50 - (his[3].uses / max) * 50
+ var two = 50 - (his[2].uses / max) * 50
+ var one = 50 - (his[1].uses / max) * 50
+ var zero = 50 - (his[0].uses / max) * 50
if (max === 0) {
- tags = '' + ' ' + his[0].uses + " toot(s) #" + escapeHTML(tag.name) + " " + his[0].accounts + lang.lang_src_people;
+ tags =
+ `
+ ${his[0].uses}
+ toot(s)
+
+ #${escapeHTML(tag.name)}
+ ` +
+ his[0].accounts +
+ lang.lang_src_people
} else {
- tags = '' + ' ' + ' ' + his[0].uses + " toot #" + escapeHTML(tag.name) + " " + his[0].accounts + lang.lang_src_people;
+ tags =
+ `
+
+
+
+
+
+
+ ${his[0].uses}
+ toot
+
+ #${escapeHTML(tag.name)}
+ ` +
+ his[0].accounts +
+ lang.lang_src_people
}
- return tags;
+ return tags
}
/*
@@ -228,51 +269,74 @@ function graphDraw(tag, acct_id) {
*/
function trend() {
- console.log("get trend");
- $("#src-contents").html("");
- var acct_id = $("#src-acct-sel").val();
- if (acct_id == "tootsearch") {
- return false;
+ console.log('get trend')
+ $('#src-contents').html('')
+ var acct_id = $('#src-acct-sel').val()
+ if (acct_id == 'tootsearch') {
+ return false
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/trends";
- console.log(start);
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/trends'
+ console.log(start)
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- setLog(start, "JSON", error);
- console.error(error);
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- var tags = "";
+ var tags = ''
Object.keys(json).forEach(function(keye) {
- var tag = json[keye];
- var his = tag.history;
- var max = Math.max.apply(null, [his[0].uses, his[1].uses, his[2].uses, his[3].uses, his[4].uses, his[5].uses, his[6].uses]);
- var six = 50 - (his[6].uses / max) * 50;
- var five = 50 - (his[5].uses / max) * 50;
- var four = 50 - (his[4].uses / max) * 50;
- var three = 50 - (his[3].uses / max) * 50;
- var two = 50 - (his[2].uses / max) * 50;
- var one = 50 - (his[1].uses / max) * 50;
- var zero = 50 - (his[0].uses / max) * 50;
- tags = '' + ' ' + ' ' + his[0].uses + " toots #" + tag.name + " " + his[0].accounts + lang.lang_src_people + " ";
+ var tag = json[keye]
+ var his = tag.history
+ var max = Math.max.apply(null, [
+ his[0].uses,
+ his[1].uses,
+ his[2].uses,
+ his[3].uses,
+ his[4].uses,
+ his[5].uses,
+ his[6].uses
+ ])
+ var six = 50 - (his[6].uses / max) * 50
+ var five = 50 - (his[5].uses / max) * 50
+ var four = 50 - (his[4].uses / max) * 50
+ var three = 50 - (his[3].uses / max) * 50
+ var two = 50 - (his[2].uses / max) * 50
+ var one = 50 - (his[1].uses / max) * 50
+ var zero = 50 - (his[0].uses / max) * 50
+ tags =
+ `
+
+
+
+
+
+ ${his[0].uses}
+ toot
+
+ #${escapeHTML(tag.name)}
+ ` +
+ his[0].accounts +
+ lang.lang_src_people +
+ ' '
- $("#src-contents").append(tags);
- });
- });
+ $('#src-contents').append(tags)
+ })
+ })
}
diff --git a/app/js/tl/tag.js b/app/js/tl/tag.js
index 28b1f8b7..74500403 100644
--- a/app/js/tl/tag.js
+++ b/app/js/tl/tag.js
@@ -1,150 +1,181 @@
//タグ表示
if (location.search) {
- var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
- var mode = m[1];
- var codex = m[2];
- if (mode == "tag") {
- var acct_id = localStorage.getItem("main");
- tl("tag", decodeURI(codex), acct_id, "add");
+ var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
+ var mode = m[1]
+ var codex = m[2]
+ if (mode == 'tag') {
+ var acct_id = localStorage.getItem('main')
+ tl('tag', decodeURI(codex), acct_id, 'add')
}
}
//よく使うタグ
function tagShow(tag) {
- $("[data-tag=" + decodeURI(tag).toLowerCase() + "]").toggleClass("hide");
+ $('[data-tag=' + decodeURI(tag).toLowerCase() + ']').toggleClass('hide')
}
//タグ追加
function tagPin(tag) {
- var tags = localStorage.getItem("tag");
+ var tags = localStorage.getItem('tag')
if (!tags) {
- var obj = [];
+ var obj = []
} else {
- var obj = JSON.parse(tags);
+ var obj = JSON.parse(tags)
}
- var can;
+ var can
Object.keys(obj).forEach(function(key) {
- var tagT = obj[key];
+ var tagT = obj[key]
if (tagT == tag) {
- can = true;
+ can = true
} else {
- can = false;
+ can = false
}
- });
+ })
if (!can) {
- obj.push(tag);
+ obj.push(tag)
}
- var json = JSON.stringify(obj);
- localStorage.setItem("tag", json);
- favTag();
+ var json = JSON.stringify(obj)
+ localStorage.setItem('tag', json)
+ favTag()
}
//タグ削除
function tagRemove(key) {
- var tags = localStorage.getItem("tag");
- var obj = JSON.parse(tags);
- obj.splice(key, 1);
- var json = JSON.stringify(obj);
- localStorage.setItem("tag", json);
- favTag();
+ var tags = localStorage.getItem('tag')
+ var obj = JSON.parse(tags)
+ obj.splice(key, 1)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('tag', json)
+ favTag()
}
function favTag() {
- $("#taglist").html("");
- var tagarr = localStorage.getItem("tag");
+ $('#taglist').html('')
+ var tagarr = localStorage.getItem('tag')
if (!tagarr) {
- var obj = [];
+ var obj = []
} else {
- var obj = JSON.parse(tagarr);
+ var obj = JSON.parse(tagarr)
}
- var tags = "";
- var nowPT = localStorage.getItem("stable");
+ var tags = ''
+ var nowPT = localStorage.getItem('stable')
Object.keys(obj).forEach(function(key) {
- var tag = obj[key];
+ var tag = obj[key]
if (nowPT != tag) {
- console.log("stable tags:" + nowPT + "/" + tag);
- var ptt = lang.lang_tags_realtime;
- var nowon = "";
+ console.log('stable tags:' + nowPT + '/' + tag)
+ var ptt = lang.lang_tags_realtime
+ var nowon = ''
} else {
- var ptt = lang.lang_tags_unrealtime;
- var nowon = "(" + lang.lang_tags_realtime + ")";
+ var ptt = lang.lang_tags_unrealtime
+ var nowon = '(' + lang.lang_tags_realtime + ')'
}
- tag = escapeHTML(tag);
- tags = tags + "#' + tag + " " + nowon + ' TL Toot ' + "' + ptt + " ' + lang.lang_del + " ";
- });
+ tag = escapeHTML(tag)
+ tags =
+ tags +
+ `#${tag}
+ ${nowon}
+
+ TL
+
+
+ Toot
+
+
+ ${ptt}
+
+
+ ${lang.lang_del}
+
+ `
+ })
if (obj.length > 0) {
- $("#taglist").append("My Tags:" + tags);
+ $('#taglist').append('My Tags:' + tags)
} else {
- $("#taglist").append("");
+ $('#taglist').append('')
}
}
function trendTag() {
- $(".trendtag").remove();
- var domain = "imastodon.net";
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/trend_tags";
+ $('.trendtag').remove()
+ var domain = 'imastodon.net'
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/trend_tags'
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (json) {
- var tags = "";
- json = json.score;
+ var tags = ''
+ json = json.score
Object.keys(json).forEach(function(tag) {
- tag = escapeHTML(tag);
- tags = tags + "#' + tag + ' TL Toot ';
- });
- $("#taglist").append('アイマストドントレンドタグrefresh :' + tags + "
");
- trendintervalset();
+ tag = escapeHTML(tag)
+ tags =
+ tags +
+ `#${tag}
+
+ TL
+
+ Toot
+
+ `
+ })
+ $('#taglist').append(
+ 'アイマストドントレンドタグrefresh :' +
+ tags +
+ '
'
+ )
+ trendintervalset()
} else {
- $("#taglist").html("");
+ $('#taglist').html('')
}
- });
+ })
}
function trendintervalset() {
- setTimeout(trendTag, 6000000);
+ setTimeout(trendTag, 6000000)
}
function tagTL(a, b, c, d) {
- var acct_id = $("#post-acct-sel").val();
- tl(a, b, acct_id, d);
+ var acct_id = $('#post-acct-sel').val()
+ tl(a, b, acct_id, d)
}
function autoToot(tag) {
- tag = escapeHTML(tag);
- var nowPT = localStorage.getItem("stable");
+ tag = escapeHTML(tag)
+ var nowPT = localStorage.getItem('stable')
if (nowPT == tag) {
- localStorage.removeItem("stable");
- M.toast({ html: lang.lang_tags_unrealtime, displayLength: 3000 });
+ localStorage.removeItem('stable')
+ M.toast({ html: lang.lang_tags_unrealtime, displayLength: 3000 })
} else {
- localStorage.setItem("stable", tag);
- M.toast({ html: lang.lang_tags_tagwarn.replace("{{tag}}", tag).replace("{{tag}}", tag), displayLength: 3000 });
- brInsert("#" + tag + " ");
+ localStorage.setItem('stable', tag)
+ M.toast({
+ html: lang.lang_tags_tagwarn.replace('{{tag}}', tag).replace('{{tag}}', tag),
+ displayLength: 3000
+ })
+ brInsert('#' + tag + ' ')
}
- favTag();
+ favTag()
}
//タグをフィーチャー
function tagFeature(name, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var start = "https://" + domain + "/api/v1/featured_tags";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var start = 'https://' + domain + '/api/v1/featured_tags'
fetch(start, {
- method: "POST",
+ method: 'POST',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
},
body: JSON.stringify({
name: name
@@ -153,16 +184,16 @@ function tagFeature(name, acct_id) {
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- return false;
+ return false
})
.then(function(json) {
- console.log(json);
- M.toast({ html: "Complete: " + escapeHTML(name), displayLength: 3000 });
- });
+ console.log(json)
+ M.toast({ html: 'Complete: ' + escapeHTML(name), displayLength: 3000 })
+ })
}
diff --git a/app/js/tl/tl.js b/app/js/tl/tl.js
index 41494e01..529388b5 100644
--- a/app/js/tl/tl.js
+++ b/app/js/tl/tl.js
@@ -1,56 +1,62 @@
//TL取得
-moreloading = false;
-var errorct = 0;
+moreloading = false
+var errorct = 0
function tl(type, data, acct_id, tlid, delc, voice, mode) {
- scrollevent();
- $("#unread_" + tlid + " .material-icons").removeClass("teal-text");
- localStorage.removeItem("morelock");
- localStorage.removeItem("pool");
- var domain = localStorage.getItem("domain_" + acct_id);
+ scrollevent()
+ $('#unread_' + tlid + ' .material-icons').removeClass('teal-text')
+ localStorage.removeItem('morelock')
+ localStorage.removeItem('pool')
+ var domain = localStorage.getItem('domain_' + acct_id)
//タグとかの場合はカラム追加して描画
- if (tlid == "add") {
- console.log("add new column");
- var newtab = $(".box").length;
+ if (tlid == 'add') {
+ console.log('add new column')
+ var newtab = $('.box').length
var add = {
domain: acct_id,
type: type,
data: data
- };
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- localStorage.setItem("card_" + obj.length, "true");
- obj.push(add);
- var json = JSON.stringify(obj);
- localStorage.setItem("column", json);
- parseColumn("add");
- return;
+ }
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ localStorage.setItem('card_' + obj.length, 'true')
+ obj.push(add)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('column', json)
+ parseColumn('add')
+ return
}
if (!type) {
- var type = localStorage.getItem("now");
+ var type = localStorage.getItem('now')
if (!type) {
//デフォルト
- var type = "local";
+ var type = 'local'
}
}
- if (type == "mix" && localStorage.getItem("mode_" + domain) != "misskey") {
+ if (type == 'mix' && localStorage.getItem('mode_' + domain) != 'misskey') {
//Integratedなら飛ばす
- $("#notice_" + tlid).text("Integrated TL(" + localStorage.getItem("user_" + acct_id) + "@" + domain + ")");
- $("#notice_icon_" + tlid).text("merge_type");
- mixtl(acct_id, tlid, "integrated", delc, voice);
- return;
- } else if (type == "plus") {
+ $('#notice_' + tlid).text(
+ 'Integrated TL(' + localStorage.getItem('user_' + acct_id) + '@' + domain + ')'
+ )
+ $('#notice_icon_' + tlid).text('merge_type')
+ mixtl(acct_id, tlid, 'integrated', delc, voice)
+ return
+ } else if (type == 'plus') {
//Local+なら飛ばす
- $("#notice_" + tlid).text("Local+ TL(" + localStorage.getItem("user_" + acct_id) + "@" + domain + ")");
- $("#notice_icon_" + tlid).text("people_outline");
- mixtl(acct_id, tlid, "plus", delc, voice);
- return;
- } else if (type == "notf") {
+ $('#notice_' + tlid).text(
+ 'Local+ TL(' + localStorage.getItem('user_' + acct_id) + '@' + domain + ')'
+ )
+ $('#notice_icon_' + tlid).text('people_outline')
+ mixtl(acct_id, tlid, 'plus', delc, voice)
+ return
+ } else if (type == 'notf') {
//通知なら飛ばす
- notf(acct_id, tlid, "direct");
- $("#notice_" + tlid).text(cap(type, data, acct_id) + "(" + localStorage.getItem("user_" + acct_id) + "@" + domain + ")");
- $("#notice_icon_" + tlid).text("notifications");
- return;
+ notf(acct_id, tlid, 'direct')
+ $('#notice_' + tlid).text(
+ cap(type, data, acct_id) + '(' + localStorage.getItem('user_' + acct_id) + '@' + domain + ')'
+ )
+ $('#notice_icon_' + tlid).text('notifications')
+ return
} /*else if (type == "dm") {
//DMなら飛ばす
dm(acct_id, tlid, "plus",delc,voice);
@@ -59,1076 +65,1103 @@ function tl(type, data, acct_id, tlid, delc, voice, mode) {
$("#notice_icon_" + tlid).text("mail_outline");
return;
}*/
- localStorage.setItem("now", type);
- todo(cap(type) + " TL Loading...");
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (type != "noauth") {
+ localStorage.setItem('now', type)
+ todo(cap(type) + ' TL Loading...')
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (type != 'noauth') {
var hdr = {
- "content-type": "application/json",
- Authorization: "Bearer " + at
- };
- $("#notice_" + tlid).text(cap(type, data, acct_id) + "(" + localStorage.getItem("user_" + acct_id) + "@" + domain + ")");
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
+ }
+ $('#notice_' + tlid).text(
+ cap(type, data, acct_id) + '(' + localStorage.getItem('user_' + acct_id) + '@' + domain + ')'
+ )
} else {
var hdr = {
- "content-type": "application/json"
- };
- domain = acct_id;
- $("#notice_" + tlid).text("Glance TL(" + domain + ")");
+ 'content-type': 'application/json'
+ }
+ domain = acct_id
+ $('#notice_' + tlid).text('Glance TL(' + domain + ')')
}
- $("#notice_icon_" + tlid).text(icon(type));
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var misskey = true;
- var url = misskeycom(type, data);
- var start = "https://" + domain + "/api/notes/" + url;
- var method = "POST";
- var req = {};
- if (type != "noauth") {
- req.i = at;
+ $('#notice_icon_' + tlid).text(icon(type))
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var misskey = true
+ var url = misskeycom(type, data)
+ var start = 'https://' + domain + '/api/notes/' + url
+ var method = 'POST'
+ var req = {}
+ if (type != 'noauth') {
+ req.i = at
}
- if (type == "local-media" || type == "pub-media") {
- req.mediaOnly = true;
+ if (type == 'local-media' || type == 'pub-media') {
+ req.mediaOnly = true
}
- if (type == "tag") {
- req.tag = data;
+ if (type == 'tag') {
+ req.tag = data
}
- if (type == "list") {
- req.listId = data;
+ if (type == 'list') {
+ req.listId = data
}
- req.limit = 20;
+ req.limit = 20
var i = {
method: method,
headers: hdr,
body: JSON.stringify(req)
- };
+ }
} else {
- var misskey = false;
- var url = com(type, data);
- if (type == "tag") {
- var tag = localStorage.getItem("tag-range");
- if (tag == "local") {
- url = url + "local=true";
+ var misskey = false
+ var url = com(type, data)
+ if (type == 'tag') {
+ var tag = localStorage.getItem('tag-range')
+ if (tag == 'local') {
+ url = url + 'local=true'
}
}
- if (type == "dm") {
- var start = "https://" + domain + "/api/v1/conversations";
+ if (type == 'dm') {
+ var start = 'https://' + domain + '/api/v1/conversations'
} else {
- var start = "https://" + domain + "/api/v1/timelines/" + url;
+ var start = 'https://' + domain + '/api/v1/timelines/' + url
}
- var method = "GET";
+ var method = 'GET'
var i = {
method: method,
headers: hdr
- };
+ }
}
- console.log(["Try to get timeline of " + tlid, start]);
+ console.log(['Try to get timeline of ' + tlid, start])
fetch(start, i)
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- console.log(["Result of getting timeline of " + tlid, json]);
- $("#landing_" + tlid).hide();
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ console.log(['Result of getting timeline of ' + tlid, json])
+ $('#landing_' + tlid).hide()
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
if (misskey) {
- var templete = misskeyParse(json, type, acct_id, tlid, "", mute);
+ var templete = misskeyParse(json, type, acct_id, tlid, '', mute)
} else {
- var templete = parse(json, type, acct_id, tlid, "", mute, type);
- localStorage.setItem("lastobj_" + tlid, json[0].id);
+ var templete = parse(json, type, acct_id, tlid, '', mute, type)
+ localStorage.setItem('lastobj_' + tlid, json[0].id)
}
- $("#timeline_" + tlid).html(templete);
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
- todc();
- reload(type, "", acct_id, tlid, data, mute, delc, voice);
- if (type == "home" || type == "notf") {
+ $('#timeline_' + tlid).html(templete)
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ todc()
+ reload(type, '', acct_id, tlid, data, mute, delc, voice)
+ if (type == 'home' || type == 'notf') {
//Markers
- var markers = localStorage.getItem("markers");
- if (markers == "yes") {
- markers = true;
+ var markers = localStorage.getItem('markers')
+ if (markers == 'yes') {
+ markers = true
} else {
- markers = false;
+ markers = false
}
if (markers) {
- getMarker(tlid, type, acct_id);
+ getMarker(tlid, type, acct_id)
}
}
- $(window).scrollTop(0);
- });
+ $(window).scrollTop(0)
+ })
}
//Streaming接続
function reload(type, cc, acct_id, tlid, data, mute, delc, voice, mode) {
if (!type) {
- var type = localStorage.getItem("now");
+ var type = localStorage.getItem('now')
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- localStorage.setItem("now", type);
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var misskey = true;
- var key = localStorage.getItem("misskey_wss_" + acct_id);
- var send = '{"type":"connect","body":{"channel":"' + typePs(type) + '","id":"' + tlid + '"}}';
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ localStorage.setItem('now', type)
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var misskey = true
+ var key = localStorage.getItem('misskey_wss_' + acct_id)
+ var send = '{"type":"connect","body":{"channel":"' + typePs(type) + '","id":"' + tlid + '"}}'
var mskyset = setInterval(function() {
if (misskeywsstate[key]) {
- misskeyws[key].send(send);
- clearInterval(mskyset);
+ misskeyws[key].send(send)
+ clearInterval(mskyset)
}
- }, 100);
+ }, 100)
} else {
- var misskey = false;
- if (localStorage.getItem("streaming_" + acct_id)) {
- var wss = localStorage.getItem("streaming_" + acct_id);
+ var misskey = false
+ if (localStorage.getItem('streaming_' + acct_id)) {
+ var wss = localStorage.getItem('streaming_' + acct_id)
} else {
- var wss = "wss://" + domain;
+ var wss = 'wss://' + domain
}
- if (type == "home") {
- var start = wss + "/api/v1/streaming/?stream=user&access_token=" + at;
- } else if (type == "pub") {
- var start = wss + "/api/v1/streaming/?stream=public&access_token=" + at;
- } else if (type == "pub-media") {
- var start = wss + "/api/v1/streaming/?stream=public:media&access_token=" + at;
- } else if (type == "local") {
- var start = wss + "/api/v1/streaming/?stream=public:local&access_token=" + at;
- } else if (type == "local-media") {
- var start = wss + "/api/v1/streaming/?stream=public:local:media&only_media=true&access_token=" + at;
- } else if (type == "tag") {
- if (type == "tag") {
- var tag = localStorage.getItem("tag-range");
- if (tag == "local") {
- data = data + "&local=true";
+ if (type == 'home') {
+ var start = wss + '/api/v1/streaming/?stream=user&access_token=' + at
+ } else if (type == 'pub') {
+ var start = wss + '/api/v1/streaming/?stream=public&access_token=' + at
+ } else if (type == 'pub-media') {
+ var start = wss + '/api/v1/streaming/?stream=public:media&access_token=' + at
+ } else if (type == 'local') {
+ var start = wss + '/api/v1/streaming/?stream=public:local&access_token=' + at
+ } else if (type == 'local-media') {
+ var start =
+ wss + '/api/v1/streaming/?stream=public:local:media&only_media=true&access_token=' + at
+ } else if (type == 'tag') {
+ if (type == 'tag') {
+ var tag = localStorage.getItem('tag-range')
+ if (tag == 'local') {
+ data = data + '&local=true'
}
}
- var start = wss + "/api/v1/streaming/?stream=hashtag&tag=" + data + "&access_token=" + at;
- } else if (type == "noauth") {
- var start = "wss://" + acct_id + "/api/v1/streaming/?stream=public:local";
- } else if (type == "list") {
- var start = wss + "/api/v1/streaming/?stream=list&list=" + data + "&access_token=" + at;
- } else if (type == "dm") {
- var start = wss + "/api/v1/streaming/?stream=direct&access_token=" + at;
+ var start = wss + '/api/v1/streaming/?stream=hashtag&tag=' + data + '&access_token=' + at
+ } else if (type == 'noauth') {
+ var start = 'wss://' + acct_id + '/api/v1/streaming/?stream=public:local'
+ } else if (type == 'list') {
+ var start = wss + '/api/v1/streaming/?stream=list&list=' + data + '&access_token=' + at
+ } else if (type == 'dm') {
+ var start = wss + '/api/v1/streaming/?stream=direct&access_token=' + at
}
- var wsid = websocket.length;
- localStorage.setItem("wss_" + tlid, wsid);
- websocket[wsid] = new WebSocket(start);
+ var wsid = websocket.length
+ localStorage.setItem('wss_' + tlid, wsid)
+ websocket[wsid] = new WebSocket(start)
websocket[wsid].onopen = function(mess) {
- console.table({ tlid: tlid, type: "Connect Streaming API" + type, domain: domain, message: [mess] });
- errorct = 0;
- $("#notice_icon_" + tlid).removeClass("red-text");
- };
+ console.table({
+ tlid: tlid,
+ type: 'Connect Streaming API' + type,
+ domain: domain,
+ message: [mess]
+ })
+ errorct = 0
+ $('#notice_icon_' + tlid).removeClass('red-text')
+ }
websocket[wsid].onmessage = function(mess) {
- console.log([tlid + ":Receive Streaming API:", JSON.parse(mess.data)]);
+ console.log([tlid + ':Receive Streaming API:', JSON.parse(mess.data)])
if (misskey) {
- if (JSON.parse(mess.data).type == "note") {
- var obj = JSON.parse(mess.data).body;
+ if (JSON.parse(mess.data).type == 'note') {
+ var obj = JSON.parse(mess.data).body
if (voice) {
- say(obj.text);
+ say(obj.text)
}
websocketNotf[acct_id].send(
JSON.stringify({
- type: "capture",
+ type: 'capture',
id: obj.id
})
- );
- var templete = misskeyParse([obj], type, acct_id, tlid, "", mute);
- var pool = localStorage.getItem("pool_" + tlid);
+ )
+ var templete = misskeyParse([obj], type, acct_id, tlid, '', mute)
+ var pool = localStorage.getItem('pool_' + tlid)
if (pool) {
- pool = templete + pool;
+ pool = templete + pool
} else {
- pool = templete;
+ pool = templete
}
- localStorage.setItem("pool_" + tlid, pool);
- scrollck();
- jQuery("time.timeago").timeago();
+ localStorage.setItem('pool_' + tlid, pool)
+ scrollck()
+ jQuery('time.timeago').timeago()
}
} else {
- var typeA = JSON.parse(mess.data).event;
- if (typeA == "delete") {
- var del = localStorage.getItem("delete");
+ var typeA = JSON.parse(mess.data).event
+ if (typeA == 'delete') {
+ var del = localStorage.getItem('delete')
if (del > 10) {
- reconnector(tlid, type, acct_id, data);
+ reconnector(tlid, type, acct_id, data)
} else {
- localStorage.setItem("delete", del * 1 + 1);
+ localStorage.setItem('delete', del * 1 + 1)
}
- var obj = JSON.parse(mess.data).payload;
- if (delc == "true") {
- $("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("emphasized");
- $("#timeline_" + tlid + " [toot-id=" + JSON.parse(mess.data).payload + "]").addClass("by_delcatch");
+ var obj = JSON.parse(mess.data).payload
+ if (delc == 'true') {
+ $('#timeline_' + tlid + ' [toot-id=' + JSON.parse(mess.data).payload + ']').addClass(
+ 'emphasized'
+ )
+ $('#timeline_' + tlid + ' [toot-id=' + JSON.parse(mess.data).payload + ']').addClass(
+ 'by_delcatch'
+ )
} else {
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").hide();
- $("[toot-id=" + JSON.parse(mess.data).payload + "]").remove();
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').hide()
+ $('[toot-id=' + JSON.parse(mess.data).payload + ']').remove()
}
- } else if (typeA == "update" || typeA == "conversation") {
- localStorage.removeItem("delete");
- if (!$("#unread_" + tlid + " .material-icons").hasClass("teal-text")) {
+ } else if (typeA == 'update' || typeA == 'conversation') {
+ localStorage.removeItem('delete')
+ if (!$('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
//markers show中はダメ
- var obj = JSON.parse(JSON.parse(mess.data).payload);
- if ($("#timeline_" + tlid + " [toot-id=" + obj.id + "]").length < 1) {
+ var obj = JSON.parse(JSON.parse(mess.data).payload)
+ if ($('#timeline_' + tlid + ' [toot-id=' + obj.id + ']').length < 1) {
if (voice) {
- say(obj.content);
+ say(obj.content)
}
- var templete = parse([obj], type, acct_id, tlid, "", mute, type);
- if ($("timeline_box_" + tlid + "_box .tl-box").scrollTop() === 0) {
- $("#timeline_" + tlid).prepend(templete);
+ var templete = parse([obj], type, acct_id, tlid, '', mute, type)
+ if ($('timeline_box_' + tlid + '_box .tl-box').scrollTop() === 0) {
+ $('#timeline_' + tlid).prepend(templete)
} else {
- var pool = localStorage.getItem("pool_" + tlid);
+ var pool = localStorage.getItem('pool_' + tlid)
if (pool) {
- pool = templete + pool;
+ pool = templete + pool
} else {
- pool = templete;
+ pool = templete
}
- localStorage.setItem("pool_" + tlid, pool);
+ localStorage.setItem('pool_' + tlid, pool)
}
- scrollck();
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
+ scrollck()
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
} else {
- todo("二重取得発生中");
+ todo('二重取得発生中')
}
- todc();
+ todc()
}
- } else if (typeA == "filters_changed") {
- filterUpdate(acct_id);
+ } else if (typeA == 'filters_changed') {
+ filterUpdate(acct_id)
}
}
- };
+ }
websocket[wsid].onerror = function(error) {
- console.error("Error closing");
- console.error(error);
- if (mode == "error") {
- $("#notice_icon_" + tlid).addClass("red-text");
- todo("WebSocket Error " + error);
+ console.error('Error closing')
+ console.error(error)
+ if (mode == 'error') {
+ $('#notice_icon_' + tlid).addClass('red-text')
+ todo('WebSocket Error ' + error)
} else {
- errorct++;
- console.log(errorct);
+ errorct++
+ console.log(errorct)
if (errorct < 3) {
- reconnector(tlid, type, acct_id, data, "error");
+ reconnector(tlid, type, acct_id, data, 'error')
}
}
- return false;
- };
+ return false
+ }
websocket[wsid].onclose = function() {
- console.warn("Closing " + tlid);
- if (mode == "error") {
- $("#notice_icon_" + tlid).addClass("red-text");
- todo("WebSocket Closed");
+ console.warn('Closing ' + tlid)
+ if (mode == 'error') {
+ $('#notice_icon_' + tlid).addClass('red-text')
+ todo('WebSocket Closed')
} else {
- errorct++;
- console.log(errorct);
+ errorct++
+ console.log(errorct)
if (errorct < 3) {
- reconnector(tlid, type, acct_id, data, "error");
+ reconnector(tlid, type, acct_id, data, 'error')
}
}
- return false;
- };
+ return false
+ }
}
}
//一定のスクロールで発火
function moreload(type, tlid) {
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- var acct_id = obj[tlid].domain;
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ var acct_id = obj[tlid].domain
if (!type) {
- var type = obj[tlid].type;
+ var type = obj[tlid].type
} else {
- var data;
+ var data
}
- if (type == "tag") {
- var data = obj[tlid].data;
- var tag = localStorage.getItem("tag-range");
- if (tag == "local") {
- data = data + "&local=true";
+ if (type == 'tag') {
+ var data = obj[tlid].data
+ var tag = localStorage.getItem('tag-range')
+ if (tag == 'local') {
+ data = data + '&local=true'
}
- } else if (type == "list") {
- var data = obj[tlid].data;
+ } else if (type == 'list') {
+ var data = obj[tlid].data
}
- var sid = $("#timeline_" + tlid + " .cvo")
+ var sid = $('#timeline_' + tlid + ' .cvo')
.last()
- .attr("unique-id");
+ .attr('unique-id')
if (sid && !moreloading) {
- if (type == "mix" && localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct_id)) != "misskey") {
- mixmore(tlid, "integrated");
- return;
- } else if (type == "plus" && localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct_id)) != "misskey") {
- mixmore(tlid, "plus");
- return;
- } else if (type == "notf") {
- notfmore(tlid);
- return;
- } else if (type == "tootsearch") {
- var data = obj[tlid].data;
- moreTs(tlid, data);
- return;
+ if (
+ type == 'mix' &&
+ localStorage.getItem('mode_' + localStorage.getItem('domain_' + acct_id)) != 'misskey'
+ ) {
+ mixmore(tlid, 'integrated')
+ return
+ } else if (
+ type == 'plus' &&
+ localStorage.getItem('mode_' + localStorage.getItem('domain_' + acct_id)) != 'misskey'
+ ) {
+ mixmore(tlid, 'plus')
+ return
+ } else if (type == 'notf') {
+ notfmore(tlid)
+ return
+ } else if (type == 'tootsearch') {
+ var data = obj[tlid].data
+ moreTs(tlid, data)
+ return
}
- moreloading = true;
- localStorage.setItem("now", type);
- todo(cap(type) + " TL MoreLoading");
- if (type != "noauth") {
- var at = localStorage.getItem("acct_" + acct_id + "_at");
+ moreloading = true
+ localStorage.setItem('now', type)
+ todo(cap(type) + ' TL MoreLoading')
+ if (type != 'noauth') {
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
var hdr = {
- "content-type": "application/json",
- Authorization: "Bearer " + at
- };
- var domain = localStorage.getItem("domain_" + acct_id);
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
+ }
+ var domain = localStorage.getItem('domain_' + acct_id)
} else {
var hdr = {
- "content-type": "application/json"
- };
- domain = acct_id;
+ 'content-type': 'application/json'
+ }
+ domain = acct_id
}
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var misskey = true;
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var misskey = true
hdr = {
- "content-type": "application/json"
- };
- var url = misskeycom(type, data);
- var start = "https://" + domain + "/api/notes/" + url;
- var method = "POST";
- var req = {};
- if (type != "noauth") {
- req.i = at;
+ 'content-type': 'application/json'
}
- if (type == "local-media" || type == "pub-media") {
- req.mediaOnly = true;
+ var url = misskeycom(type, data)
+ var start = 'https://' + domain + '/api/notes/' + url
+ var method = 'POST'
+ var req = {}
+ if (type != 'noauth') {
+ req.i = at
}
- if (type == "tag") {
- req.tag = data;
+ if (type == 'local-media' || type == 'pub-media') {
+ req.mediaOnly = true
}
- if (type == "list") {
- req.listId = data;
+ if (type == 'tag') {
+ req.tag = data
}
- req.untilId = sid;
- req.limit = 20;
+ if (type == 'list') {
+ req.listId = data
+ }
+ req.untilId = sid
+ req.limit = 20
var i = {
method: method,
headers: hdr,
body: JSON.stringify(req)
- };
- } else {
- var misskey = false;
- var start = "https://" + domain + "/api/v1/timelines/" + com(type, data) + "max_id=" + sid;
- if (type == "dm") {
- var start = "https://" + domain + "/api/v1/conversations?" + "max_id=" + sid;
}
- var method = "GET";
+ } else {
+ var misskey = false
+ var start = 'https://' + domain + '/api/v1/timelines/' + com(type, data) + 'max_id=' + sid
+ if (type == 'dm') {
+ var start = 'https://' + domain + '/api/v1/conversations?' + 'max_id=' + sid
+ }
+ var method = 'GET'
var i = {
method: method,
headers: hdr
- };
+ }
}
fetch(start, i)
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
if (misskey) {
- var templete = misskeyParse(json, "", acct_id, tlid, "", mute);
+ var templete = misskeyParse(json, '', acct_id, tlid, '', mute)
} else {
- var templete = parse(json, "", acct_id, tlid, "", mute, type);
+ var templete = parse(json, '', acct_id, tlid, '', mute, type)
}
- $("#timeline_" + tlid).append(templete);
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
- moreloading = false;
- todc();
- });
+ $('#timeline_' + tlid).append(templete)
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ moreloading = false
+ todc()
+ })
}
}
//TL差分取得
function tlDiff(type, data, acct_id, tlid, delc, voice, mode) {
- console.log("Get diff of TL" + tlid);
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- var acct_id = obj[tlid].domain;
+ console.log('Get diff of TL' + tlid)
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ var acct_id = obj[tlid].domain
if (!type) {
- var type = obj[tlid].type;
+ var type = obj[tlid].type
} else {
- var data;
+ var data
}
- if (type == "tag") {
- var data = obj[tlid].data;
- var tag = localStorage.getItem("tag-range");
- if (tag == "local") {
- data = data + "&local=true";
+ if (type == 'tag') {
+ var data = obj[tlid].data
+ var tag = localStorage.getItem('tag-range')
+ if (tag == 'local') {
+ data = data + '&local=true'
}
- } else if (type == "list") {
- var data = obj[tlid].data;
+ } else if (type == 'list') {
+ var data = obj[tlid].data
}
- var sid = $("#timeline_" + tlid + " .cvo")
+ var sid = $('#timeline_' + tlid + ' .cvo')
.first()
- .attr("unique-id");
+ .attr('unique-id')
if (sid && !moreloading) {
- if (type == "mix" && localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct_id)) != "misskey") {
- return;
- } else if (type == "plus" && localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct_id)) != "misskey") {
- return;
- } else if (type == "notf") {
- return;
+ if (
+ type == 'mix' &&
+ localStorage.getItem('mode_' + localStorage.getItem('domain_' + acct_id)) != 'misskey'
+ ) {
+ return
+ } else if (
+ type == 'plus' &&
+ localStorage.getItem('mode_' + localStorage.getItem('domain_' + acct_id)) != 'misskey'
+ ) {
+ return
+ } else if (type == 'notf') {
+ return
}
- moreloading = true;
- localStorage.setItem("now", type);
- todo(cap(type) + " TL MoreLoading");
- if (type != "noauth") {
- var at = localStorage.getItem("acct_" + acct_id + "_at");
+ moreloading = true
+ localStorage.setItem('now', type)
+ todo(cap(type) + ' TL MoreLoading')
+ if (type != 'noauth') {
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
var hdr = {
- "content-type": "application/json",
- Authorization: "Bearer " + at
- };
- var domain = localStorage.getItem("domain_" + acct_id);
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
+ }
+ var domain = localStorage.getItem('domain_' + acct_id)
} else {
var hdr = {
- "content-type": "application/json"
- };
- domain = acct_id;
+ 'content-type': 'application/json'
+ }
+ domain = acct_id
}
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- var misskey = true;
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ var misskey = true
hdr = {
- "content-type": "application/json"
- };
- var url = misskeycom(type, data);
- var start = "https://" + domain + "/api/notes/" + url;
- var method = "POST";
- var req = {};
- if (type != "noauth") {
- req.i = at;
+ 'content-type': 'application/json'
}
- if (type == "local-media" || type == "pub-media") {
- req.mediaOnly = true;
+ var url = misskeycom(type, data)
+ var start = 'https://' + domain + '/api/notes/' + url
+ var method = 'POST'
+ var req = {}
+ if (type != 'noauth') {
+ req.i = at
}
- if (type == "tag") {
- req.tag = data;
+ if (type == 'local-media' || type == 'pub-media') {
+ req.mediaOnly = true
}
- if (type == "list") {
- req.listId = data;
+ if (type == 'tag') {
+ req.tag = data
}
- req.sinceId = sid;
- req.limit = 20;
+ if (type == 'list') {
+ req.listId = data
+ }
+ req.sinceId = sid
+ req.limit = 20
var i = {
method: method,
headers: hdr,
body: JSON.stringify(req)
- };
- } else {
- var misskey = false;
- var start = "https://" + domain + "/api/v1/timelines/" + com(type, data) + "since_id=" + sid;
- if (type == "dm") {
- var start = "https://" + domain + "/api/v1/conversations?" + "since_id=" + sid;
}
- var method = "GET";
+ } else {
+ var misskey = false
+ var start = 'https://' + domain + '/api/v1/timelines/' + com(type, data) + 'since_id=' + sid
+ if (type == 'dm') {
+ var start = 'https://' + domain + '/api/v1/conversations?' + 'since_id=' + sid
+ }
+ var method = 'GET'
var i = {
method: method,
headers: hdr
- };
+ }
}
fetch(start, i)
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
- console.log(["Result diff of TL" + tlid, json]);
+ console.log(['Result diff of TL' + tlid, json])
if (misskey) {
- var templete = misskeyParse(json, "", acct_id, tlid, "", mute);
+ var templete = misskeyParse(json, '', acct_id, tlid, '', mute)
} else {
- var templete = parse(json, "", acct_id, tlid, "", mute, type);
+ var templete = parse(json, '', acct_id, tlid, '', mute, type)
}
- $("#timeline_" + tlid).prepend(templete);
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
- moreloading = false;
- todc();
- });
+ $('#timeline_' + tlid).prepend(templete)
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ moreloading = false
+ todc()
+ })
}
}
//TL再取得
function reloadTL(type, data, acct_id, key, delc, voice) {
- tl(type, data, acct_id, key, delc, voice, "");
+ tl(type, data, acct_id, key, delc, voice, '')
}
//WebSocket切断
function tlCloser() {
Object.keys(websocket).forEach(function(tlid) {
if (websocketOld[tlid]) {
- websocketOld[tlid].close();
- console.log("%c Close Streaming API: Old" + tlid, "color:blue");
+ websocketOld[tlid].close()
+ console.log('%c Close Streaming API: Old' + tlid, 'color:blue')
}
if (websocket[0]) {
- console.log(websocket[0]);
- websocket[tlid].close();
- console.log("%c Close Streaming API:" + tlid, "color:blue");
+ console.log(websocket[0])
+ websocket[tlid].close()
+ console.log('%c Close Streaming API:' + tlid, 'color:blue')
}
- });
- websocket = [];
+ })
+ websocket = []
Object.keys(websocketHome).forEach(function(tlid) {
if (websocketHome[tlid]) {
- websocketHome[tlid].close();
- console.log("%c Close Streaming API:Integrated Home" + tlid, "color:blue");
+ websocketHome[tlid].close()
+ console.log('%c Close Streaming API:Integrated Home' + tlid, 'color:blue')
}
- });
- websocketHome = [];
+ })
+ websocketHome = []
Object.keys(websocketLocal).forEach(function(tlid) {
if (websocketLocal[tlid]) {
- websocketLocal[tlid].close();
- console.log("%c Close Streaming API:Integrated Local" + tlid, "color:blue");
+ websocketLocal[tlid].close()
+ console.log('%c Close Streaming API:Integrated Local' + tlid, 'color:blue')
}
- });
- websocketLocal = [];
+ })
+ websocketLocal = []
Object.keys(websocketNotf).forEach(function(tlid) {
if (websocketNotf[tlid]) {
- websocketNotf[tlid].close();
- console.log("%c Close Streaming API:Notf" + tlid, "color:blue");
+ websocketNotf[tlid].close()
+ console.log('%c Close Streaming API:Notf' + tlid, 'color:blue')
}
- });
+ })
Object.keys(misskeyws).forEach(function(tlid) {
if (misskeyws[tlid]) {
- misskeyws[tlid].close();
- console.log("%c Close Streaming API:Misskey" + tlid, "color:blue");
+ misskeyws[tlid].close()
+ console.log('%c Close Streaming API:Misskey' + tlid, 'color:blue')
}
- });
- misskeyws = {};
+ })
+ misskeyws = {}
}
//TLのタイトル
function cap(type, data, acct_id) {
//独自ロケール
- var locale = localStorage.getItem("locale");
- if (locale == "yes") {
- var locale = false;
+ var locale = localStorage.getItem('locale')
+ if (locale == 'yes') {
+ var locale = false
}
- if (type == "home") {
- if (localStorage.getItem("home_" + acct_id) && !locale) {
- var response = localStorage.getItem("home_" + acct_id);
+ if (type == 'home') {
+ if (localStorage.getItem('home_' + acct_id) && !locale) {
+ var response = localStorage.getItem('home_' + acct_id)
} else {
- var response = "Home TL";
+ var response = 'Home TL'
}
- } else if (type == "local") {
- if (localStorage.getItem("local_" + acct_id) && !locale) {
- var response = localStorage.getItem("local_" + acct_id);
+ } else if (type == 'local') {
+ if (localStorage.getItem('local_' + acct_id) && !locale) {
+ var response = localStorage.getItem('local_' + acct_id)
} else {
- var response = "Local TL";
+ var response = 'Local TL'
}
- } else if (type == "local-media") {
- if (localStorage.getItem("local_" + acct_id) && !locale) {
- var response = localStorage.getItem("local_" + acct_id) + "(" + lang.lang_tl_media + ")";
+ } else if (type == 'local-media') {
+ if (localStorage.getItem('local_' + acct_id) && !locale) {
+ var response = localStorage.getItem('local_' + acct_id) + '(' + lang.lang_tl_media + ')'
} else {
- var response = "Local TL(Media)";
+ var response = 'Local TL(Media)'
}
- } else if (type == "pub") {
- if (localStorage.getItem("public_" + acct_id) && !locale) {
- var response = localStorage.getItem("public_" + acct_id);
+ } else if (type == 'pub') {
+ if (localStorage.getItem('public_' + acct_id) && !locale) {
+ var response = localStorage.getItem('public_' + acct_id)
} else {
- var response = "Federated TL";
+ var response = 'Federated TL'
}
- } else if (type == "pub-media") {
- if (localStorage.getItem("public_" + acct_id) && !locale) {
- var response = localStorage.getItem("public_" + acct_id) + "(" + lang.lang_tl_media + ")";
+ } else if (type == 'pub-media') {
+ if (localStorage.getItem('public_' + acct_id) && !locale) {
+ var response = localStorage.getItem('public_' + acct_id) + '(' + lang.lang_tl_media + ')'
} else {
- var response = "Federated TL(Media)";
+ var response = 'Federated TL(Media)'
}
- } else if (type == "tag") {
- var response = "#" + escapeHTML(data);
- } else if (type == "list") {
- var ltitle = localStorage.getItem("list_" + data + "_" + acct_id);
- var response = "List(" + ltitle + ")";
- } else if (type == "notf") {
- if (localStorage.getItem("notification_" + acct_id) && !locale) {
- var response = localStorage.getItem("notification_" + acct_id);
+ } else if (type == 'tag') {
+ var response = '#' + escapeHTML(data)
+ } else if (type == 'list') {
+ var ltitle = localStorage.getItem('list_' + data + '_' + acct_id)
+ var response = 'List(' + ltitle + ')'
+ } else if (type == 'notf') {
+ if (localStorage.getItem('notification_' + acct_id) && !locale) {
+ var response = localStorage.getItem('notification_' + acct_id)
} else {
- var response = "Notification TL";
+ var response = 'Notification TL'
}
- } else if (type == "noauth") {
- var response = "Glance TL";
- } else if (type == "dm") {
- var response = "DM";
- } else if (type == "mix") {
- if (localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct_id)) == "misskey") {
- var response = "Social TL";
+ } else if (type == 'noauth') {
+ var response = 'Glance TL'
+ } else if (type == 'dm') {
+ var response = 'DM'
+ } else if (type == 'mix') {
+ if (localStorage.getItem('mode_' + localStorage.getItem('domain_' + acct_id)) == 'misskey') {
+ var response = 'Social TL'
} else {
- var response = "Integrated";
+ var response = 'Integrated'
}
- } else if (type == "plus") {
- var response = "Local+";
- } else if (type == "webview") {
- var response = "Twitter";
- } else if (type == "tootsearch") {
- var response = "tootsearch(" + escapeHTML(data) + ")";
+ } else if (type == 'plus') {
+ var response = 'Local+'
+ } else if (type == 'webview') {
+ var response = 'Twitter'
+ } else if (type == 'tootsearch') {
+ var response = 'tootsearch(' + escapeHTML(data) + ')'
}
- return response;
+ return response
}
//TLのURL
function com(type, data) {
- if (type == "home") {
- return "home?";
- } else if (type == "local" || type == "noauth") {
- return "public?local=true&";
- } else if (type == "local-media") {
- return "public?local=true&only_media=true&";
- } else if (type == "pub") {
- return "public?";
- } else if (type == "pub-media") {
- return "public?only_media=true&";
- } else if (type == "tag") {
- return "tag/" + data + "?";
- } else if (type == "list") {
- return "list/" + data + "?";
- } else if (type == "dm") {
- return "direct?";
+ if (type == 'home') {
+ return 'home?'
+ } else if (type == 'local' || type == 'noauth') {
+ return 'public?local=true&'
+ } else if (type == 'local-media') {
+ return 'public?local=true&only_media=true&'
+ } else if (type == 'pub') {
+ return 'public?'
+ } else if (type == 'pub-media') {
+ return 'public?only_media=true&'
+ } else if (type == 'tag') {
+ return 'tag/' + data + '?'
+ } else if (type == 'list') {
+ return 'list/' + data + '?'
+ } else if (type == 'dm') {
+ return 'direct?'
}
}
//Misskey
function typePs(type) {
- if (type == "home") {
- return "homeTimeline";
- } else if (type == "local" || type == "noauth") {
- return "localTimeline";
- } else if (type == "local-media") {
- return "localTimeline";
- } else if (type == "pub") {
- return "globalTimeline";
- } else if (type == "mix") {
- return "hybridTimeline";
- } else if (type == "tag") {
- return "hashtag";
- } else if (type == "list") {
- return "userList";
+ if (type == 'home') {
+ return 'homeTimeline'
+ } else if (type == 'local' || type == 'noauth') {
+ return 'localTimeline'
+ } else if (type == 'local-media') {
+ return 'localTimeline'
+ } else if (type == 'pub') {
+ return 'globalTimeline'
+ } else if (type == 'mix') {
+ return 'hybridTimeline'
+ } else if (type == 'tag') {
+ return 'hashtag'
+ } else if (type == 'list') {
+ return 'userList'
}
}
function misskeycom(type, data) {
- if (type == "home") {
- return "timeline";
- } else if (type == "mix") {
- return "hybrid-timeline";
- } else if (type == "local" || type == "noauth") {
- return "local-timeline";
- } else if (type == "local-media") {
- return "local-timeline";
- } else if (type == "pub") {
- return "global-timeline";
- } else if (type == "pub-media") {
- return "global-timeline";
- } else if (type == "tag") {
- return "search_by_tag";
- } else if (type == "list") {
- return "user-list-timeline";
+ if (type == 'home') {
+ return 'timeline'
+ } else if (type == 'mix') {
+ return 'hybrid-timeline'
+ } else if (type == 'local' || type == 'noauth') {
+ return 'local-timeline'
+ } else if (type == 'local-media') {
+ return 'local-timeline'
+ } else if (type == 'pub') {
+ return 'global-timeline'
+ } else if (type == 'pub-media') {
+ return 'global-timeline'
+ } else if (type == 'tag') {
+ return 'search_by_tag'
+ } else if (type == 'list') {
+ return 'user-list-timeline'
}
}
//TLのアイコン
function icon(type) {
- if (type == "home") {
- var response = "home";
- } else if (type == "local") {
- var response = "people_outline";
- } else if (type == "local-media") {
- var response = "people_outline";
- } else if (type == "pub") {
- var response = "language";
- } else if (type == "pub-media") {
- var response = "language";
- } else if (type == "tag") {
- var response = "whatshot";
- } else if (type == "list") {
- var response = "view_headline";
- } else if (type == "notf") {
- var response = "notifications";
- } else if (type == "noauth") {
- var response = "people_outline";
- } else if (type == "dm") {
- var response = "mail_outline";
- } else if (type == "mix") {
- var response = "merge_type";
- } else if (type == "plus") {
- var response = "merge_type";
- } else if (type == "webview") {
- var response = "language";
- } else if (type == "tootsearch") {
- var response = "search";
+ if (type == 'home') {
+ var response = 'home'
+ } else if (type == 'local') {
+ var response = 'people_outline'
+ } else if (type == 'local-media') {
+ var response = 'people_outline'
+ } else if (type == 'pub') {
+ var response = 'language'
+ } else if (type == 'pub-media') {
+ var response = 'language'
+ } else if (type == 'tag') {
+ var response = 'whatshot'
+ } else if (type == 'list') {
+ var response = 'view_headline'
+ } else if (type == 'notf') {
+ var response = 'notifications'
+ } else if (type == 'noauth') {
+ var response = 'people_outline'
+ } else if (type == 'dm') {
+ var response = 'mail_outline'
+ } else if (type == 'mix') {
+ var response = 'merge_type'
+ } else if (type == 'plus') {
+ var response = 'merge_type'
+ } else if (type == 'webview') {
+ var response = 'language'
+ } else if (type == 'tootsearch') {
+ var response = 'search'
}
- return response;
+ return response
}
function strAlive() {
- var date = new Date();
- var a = date.getTime();
- var unix = Math.floor(a / 1000);
- var col = localStorage.getItem("column");
+ var date = new Date()
+ var a = date.getTime()
+ var unix = Math.floor(a / 1000)
+ var col = localStorage.getItem('column')
if (col) {
- var obj = JSON.parse(col);
+ var obj = JSON.parse(col)
Object.keys(obj).forEach(function(key) {
- if ($("#notice_icon_" + key).hasClass("red-text")) {
- var type = obj[key].type;
- var acct_id = obj[key].domain;
- var data = obj[key].data;
- reconnector(key, type, acct_id, data, "error");
+ if ($('#notice_icon_' + key).hasClass('red-text')) {
+ var type = obj[key].type
+ var acct_id = obj[key].domain
+ var data = obj[key].data
+ reconnector(key, type, acct_id, data, 'error')
}
- });
+ })
}
- return;
+ return
}
function strAliveInt() {
- setTimeout(strAlive, 10000);
+ setTimeout(strAlive, 10000)
}
function reconnector(tlid, type, acct_id, data, mode) {
- console.log("%c Reconnector:" + mode + "(timeline" + tlid + ")", "color:pink");
- if (type == "mix" || type == "integrated" || type == "plus") {
- if (localStorage.getItem("voice_" + tlid)) {
- var voice = true;
+ console.log('%c Reconnector:' + mode + '(timeline' + tlid + ')', 'color:pink')
+ if (type == 'mix' || type == 'integrated' || type == 'plus') {
+ if (localStorage.getItem('voice_' + tlid)) {
+ var voice = true
} else {
- var voice = false;
+ var voice = false
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
- var wssh = localStorage.getItem("wssH_" + tlid);
- websocketHome[wssh].close();
- var wssl = localStorage.getItem("wssL_" + tlid);
- websocketLocal[wssl].close();
- mixre(acct_id, tlid, type, mute, "", voice, mode);
- } else if (type == "notf") {
- notfColumn(acct_id, tlid, "");
+ var wssh = localStorage.getItem('wssH_' + tlid)
+ websocketHome[wssh].close()
+ var wssl = localStorage.getItem('wssL_' + tlid)
+ websocketLocal[wssl].close()
+ mixre(acct_id, tlid, type, mute, '', voice, mode)
+ } else if (type == 'notf') {
+ notfColumn(acct_id, tlid, '')
} else {
- var wss = localStorage.getItem("wss_" + tlid);
- websocket[wss].close();
- if (localStorage.getItem("voice_" + tlid)) {
- var voice = true;
+ var wss = localStorage.getItem('wss_' + tlid)
+ websocket[wss].close()
+ if (localStorage.getItem('voice_' + tlid)) {
+ var voice = true
} else {
- var voice = false;
+ var voice = false
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
- reload(type, "", acct_id, tlid, data, mute, "", voice, mode);
+ reload(type, '', acct_id, tlid, data, mute, '', voice, mode)
}
- M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 });
+ M.toast({ html: lang.lang_tl_reconnect, displayLength: 2000 })
}
function columnReload(tlid, type) {
- $("#notice_icon_" + tlid).addClass("red-text");
- $("#unread_" + tlid + " .material-icons").removeClass("teal-text");
- if (type == "mix" || type == "integrated" || type == "plus") {
- if (localStorage.getItem("voice_" + tlid)) {
- var voice = true;
+ $('#notice_icon_' + tlid).addClass('red-text')
+ $('#unread_' + tlid + ' .material-icons').removeClass('teal-text')
+ if (type == 'mix' || type == 'integrated' || type == 'plus') {
+ if (localStorage.getItem('voice_' + tlid)) {
+ var voice = true
} else {
- var voice = false;
+ var voice = false
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
- var wssh = localStorage.getItem("wssH_" + tlid);
- websocketHome[wssh].close();
- var wssl = localStorage.getItem("wssL_" + tlid);
- websocketLocal[wssl].close();
- parseColumn(tlid);
- } else if (type == "notf") {
- $("#notice_icon_" + tlid).removeClass("red-text");
- notfColumn(acct_id, tlid, "");
+ var wssh = localStorage.getItem('wssH_' + tlid)
+ websocketHome[wssh].close()
+ var wssl = localStorage.getItem('wssL_' + tlid)
+ websocketLocal[wssl].close()
+ parseColumn(tlid)
+ } else if (type == 'notf') {
+ $('#notice_icon_' + tlid).removeClass('red-text')
+ notfColumn(acct_id, tlid, '')
} else {
- var wss = localStorage.getItem("wss_" + tlid);
- websocket[wss].close();
- if (localStorage.getItem("voice_" + tlid)) {
- var voice = true;
+ var wss = localStorage.getItem('wss_' + tlid)
+ websocket[wss].close()
+ if (localStorage.getItem('voice_' + tlid)) {
+ var voice = true
} else {
- var voice = false;
+ var voice = false
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
- parseColumn(tlid);
+ parseColumn(tlid)
}
}
-strAliveInt();
+strAliveInt()
//Markers
function getMarker(tlid, type, acct_id) {
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- if (type == "home") {
- var add = "home";
- } else if (type == "notf") {
- var add = "notifications";
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ if (type == 'home') {
+ var add = 'home'
+ } else if (type == 'notf') {
+ var add = 'notifications'
}
- var start = "https://" + domain + "/api/v1/markers?timeline=" + add;
+ var start = 'https://' + domain + '/api/v1/markers?timeline=' + add
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- $("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + lang.lang_nothing);
- $("#unread_" + tlid).attr("data-id", "");
- return false;
+ $('#unread_' + tlid).attr('title', lang.lang_layout_unread + ':' + lang.lang_nothing)
+ $('#unread_' + tlid).attr('data-id', '')
+ return false
})
.then(function(json) {
if (json) {
if (json[add]) {
- json = json[add];
- $("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + json.updated_at + " v" + json.version);
- $("#unread_" + tlid).attr("data-id", json.last_read_id);
+ json = json[add]
+ $('#unread_' + tlid).attr(
+ 'title',
+ lang.lang_layout_unread + ':' + json.updated_at + ' v' + json.version
+ )
+ $('#unread_' + tlid).attr('data-id', json.last_read_id)
} else {
- $("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + lang.lang_nothing);
- $("#unread_" + tlid).attr("data-id", "");
+ $('#unread_' + tlid).attr('title', lang.lang_layout_unread + ':' + lang.lang_nothing)
+ $('#unread_' + tlid).attr('data-id', '')
}
} else {
- $("#unread_" + tlid).attr("title", lang.lang_layout_unread + ":" + lang.lang_nothing);
- $("#unread_" + tlid).attr("data-id", "");
+ $('#unread_' + tlid).attr('title', lang.lang_layout_unread + ':' + lang.lang_nothing)
+ $('#unread_' + tlid).attr('data-id', '')
}
- });
+ })
}
function showUnread(tlid, type, acct_id) {
- if ($("#unread_" + tlid + " .material-icons").hasClass("teal-text")) {
- goTop(tlid);
- return;
+ if ($('#unread_' + tlid + ' .material-icons').hasClass('teal-text')) {
+ goTop(tlid)
+ return
}
- $("#unread_" + tlid + " .material-icons").addClass("teal-text");
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var id = $("#unread_" + tlid).attr("data-id");
- if (type == "home") {
- var add = "timelines/home?min_id=" + id;
- } else if (type == "notf") {
- var add = "notifications?min_id=" + id;
+ $('#unread_' + tlid + ' .material-icons').addClass('teal-text')
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var id = $('#unread_' + tlid).attr('data-id')
+ if (type == 'home') {
+ var add = 'timelines/home?min_id=' + id
+ } else if (type == 'notf') {
+ var add = 'notifications?min_id=' + id
}
- var start = "https://" + domain + "/api/v1/" + add;
+ var start = 'https://' + domain + '/api/v1/' + add
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (!json || !json.length) {
- columnReload(tlid, type);
+ columnReload(tlid, type)
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
- var templete = parse(json, type, acct_id, tlid, "", mute, type);
- var len = json.length - 1;
- $("#timeline_" + tlid).html(templete);
- if ($("#timeline_" + tlid + " .cvo:eq(" + len + ")").length) {
- var to = $("#timeline_" + tlid + " .cvo:eq(" + len + ")").offset().top;
- $("#timeline_box_" + tlid + "_box .tl-box").scrollTop(to);
+ var templete = parse(json, type, acct_id, tlid, '', mute, type)
+ var len = json.length - 1
+ $('#timeline_' + tlid).html(templete)
+ if ($('#timeline_' + tlid + ' .cvo:eq(' + len + ')').length) {
+ var to = $('#timeline_' + tlid + ' .cvo:eq(' + len + ')').offset().top
+ $('#timeline_box_' + tlid + '_box .tl-box').scrollTop(to)
}
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
- todc();
- });
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ todc()
+ })
}
-var ueloadlock = false;
+var ueloadlock = false
function ueload(tlid) {
if (ueloadlock) {
- return false;
+ return false
}
- ueloadlock = true;
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- var acct_id = obj[tlid * 1].domain;
- var type = obj[tlid * 1].type;
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var id = $("#timeline_" + tlid + " .cvo:eq(0)").attr("unique-id");
- if (type == "home") {
- var add = "timelines/home?min_id=" + id;
- } else if (type == "notf") {
- var add = "notifications?min_id=" + id;
+ ueloadlock = true
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ var acct_id = obj[tlid * 1].domain
+ var type = obj[tlid * 1].type
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var id = $('#timeline_' + tlid + ' .cvo:eq(0)').attr('unique-id')
+ if (type == 'home') {
+ var add = 'timelines/home?min_id=' + id
+ } else if (type == 'notf') {
+ var add = 'notifications?min_id=' + id
}
- var start = "https://" + domain + "/api/v1/" + add;
+ var start = 'https://' + domain + '/api/v1/' + add
fetch(start, {
- method: "GET",
+ method: 'GET',
headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + at
+ 'content-type': 'application/json',
+ Authorization: 'Bearer ' + at
}
})
.then(function(response) {
if (!response.ok) {
response.text().then(function(text) {
- setLog(response.url, response.status, text);
- });
+ setLog(response.url, response.status, text)
+ })
}
- return response.json();
+ return response.json()
})
.catch(function(error) {
- todo(error);
- setLog(start, "JSON", error);
- console.error(error);
+ todo(error)
+ setLog(start, 'JSON', error)
+ console.error(error)
})
.then(function(json) {
if (!json) {
- columnReload(tlid, type);
+ columnReload(tlid, type)
}
- if (localStorage.getItem("filter_" + acct_id) != "undefined") {
- var mute = getFilterType(JSON.parse(localStorage.getItem("filter_" + acct_id)), type);
+ if (localStorage.getItem('filter_' + acct_id) != 'undefined') {
+ var mute = getFilterType(JSON.parse(localStorage.getItem('filter_' + acct_id)), type)
} else {
- var mute = [];
+ var mute = []
}
- var templete = parse(json, "", acct_id, tlid, "", mute, type);
- var len = json.length - 1;
- $("#timeline_" + tlid).prepend(templete);
- if ($("#timeline_" + tlid + " .cvo:eq(" + len + ")").length) {
- var to = $("#timeline_" + tlid + " .cvo:eq(" + len + ")").offset().top;
- $("#timeline_box_" + tlid + "_box .tl-box").scrollTop(to);
+ var templete = parse(json, '', acct_id, tlid, '', mute, type)
+ var len = json.length - 1
+ $('#timeline_' + tlid).prepend(templete)
+ if ($('#timeline_' + tlid + ' .cvo:eq(' + len + ')').length) {
+ var to = $('#timeline_' + tlid + ' .cvo:eq(' + len + ')').offset().top
+ $('#timeline_box_' + tlid + '_box .tl-box').scrollTop(to)
}
- additional(acct_id, tlid);
- jQuery("time.timeago").timeago();
- todc();
- ueloadlock = false;
- });
+ additional(acct_id, tlid)
+ jQuery('time.timeago').timeago()
+ todc()
+ ueloadlock = false
+ })
}
function asRead(callback) {
//Markers
- var markers = localStorage.getItem("markers");
- if (markers == "no") {
- markers = false;
+ var markers = localStorage.getItem('markers')
+ if (markers == 'no') {
+ markers = false
} else {
- markers = true;
+ markers = true
}
if (markers) {
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
- var obl = obj.length;
- ct = 0;
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
+ var obl = obj.length
+ ct = 0
for (var i = 0; i < obl; i++) {
- var acct_id = obj[i].domain;
- var type = obj[i].type;
- if (type == "home" || type == "notf") {
- if (type == "home") {
- var id = $("#timeline_" + i + " .cvo:eq(0)").attr("unique-id");
+ var acct_id = obj[i].domain
+ var type = obj[i].type
+ if (type == 'home' || type == 'notf') {
+ if (type == 'home') {
+ var id = $('#timeline_' + i + ' .cvo:eq(0)').attr('unique-id')
var poster = {
home: {
last_read_id: id
}
- };
+ }
} else {
- var id = $("#timeline_" + i + " .cvo:eq(0)").attr("data-notf");
+ var id = $('#timeline_' + i + ' .cvo:eq(0)').attr('data-notf')
var poster = {
notifications: {
last_read_id: id
}
- };
+ }
}
- var domain = localStorage.getItem("domain_" + acct_id);
- var at = localStorage.getItem("acct_" + acct_id + "_at");
- var httpreq = new XMLHttpRequest();
- var start = "https://" + domain + "/api/v1/markers";
- httpreq.open("POST", start, true);
- httpreq.setRequestHeader("Content-Type", "application/json");
- httpreq.setRequestHeader("Authorization", "Bearer " + at);
- httpreq.responseType = "json";
- httpreq.send(JSON.stringify(poster));
+ var domain = localStorage.getItem('domain_' + acct_id)
+ var at = localStorage.getItem('acct_' + acct_id + '_at')
+ var httpreq = new XMLHttpRequest()
+ var start = 'https://' + domain + '/api/v1/markers'
+ httpreq.open('POST', start, true)
+ httpreq.setRequestHeader('Content-Type', 'application/json')
+ httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.responseType = 'json'
+ httpreq.send(JSON.stringify(poster))
httpreq.onreadystatechange = function() {
if (httpreq.readyState === 4) {
- var json = httpreq.response;
+ var json = httpreq.response
if (this.status !== 200) {
- setLog(start, this.status, this.response);
+ setLog(start, this.status, this.response)
}
- console.log(json);
- ct++;
+ console.log(json)
+ ct++
if (ct == obl && callback) {
- postMessage(["asReadComp", ""], "*");
+ postMessage(['asReadComp', ''], '*')
}
}
- };
+ }
}
}
}
}
function asReadEnd() {
//Markers
- var markers = localStorage.getItem("markers");
- if (markers == "no") {
- markers = false;
+ var markers = localStorage.getItem('markers')
+ if (markers == 'no') {
+ markers = false
} else {
- markers = true;
+ markers = true
}
if (markers) {
- asRead(true);
+ asRead(true)
Swal.fire({
title: lang.lang_tl_postmarkers_title,
html: lang.lang_tl_postmarkers,
timer: 3000,
onBeforeOpen: () => {
- Swal.showLoading();
+ Swal.showLoading()
},
onClose: () => {}
- }).then(result => {});
+ }).then(result => {})
} else {
- postMessage(["asReadComp", ""], "*");
+ postMessage(['asReadComp', ''], '*')
}
}
diff --git a/app/js/ui/img.js b/app/js/ui/img.js
index badf241a..b84a73e6 100644
--- a/app/js/ui/img.js
+++ b/app/js/ui/img.js
@@ -1,259 +1,276 @@
/*イメージビューワー*/
//postのimg.jsとは異なります。
function imgv(id, key, acct_id) {
- $("#imgprog").text(0);
- $('#imgmodal').hide();
- $('#imgmodal').attr('src', '../../img/loading.svg');
- var murl = $("#" + id + "-image-" + key).attr("data-url");
- var type = $("#" + id + "-image-" + key).attr("data-type");
- $("#imagemodal").attr("data-id", id);
- $("#imagemodal").attr("data-acct", acct_id);
- $(document).ready(function () {
- if (type == "image") {
- $('#imagemodal').modal('open');
- xhr = new XMLHttpRequest;
- xhr.open('GET', murl, true);
- xhr.addEventListener('progress', function (event) {
- if (event.lengthComputable) {
- var total = event.total;
- var now = event.loaded;
- var per = now / total * 100;
- $("#imgprog").text(Math.floor(per));
- }
- }, false);
- xhr.addEventListener('loadend', function (event) {
- var total = event.total;
- var now = event.loaded;
- var per = now / total * 100;
- $("#imgprog").text(Math.floor(per));
- }, false);
- xhr.send();
- $('#imgmodal').attr('src', murl);
- $('#imagewrap').dragScroll(); // ドラッグスクロール設定
- $('#imgmodal').show();
- $('#imagemodal').attr('data-key', key);
- $('#imagemodal').attr('data-id', id);
- } else if (type == "video" || type == "gifv") {
- $('#video').attr('src', murl);
- $('#videomodal').modal('open');
- $('#imgmodal').show();
+ $('#imgprog').text(0)
+ $('#imgmodal').hide()
+ $('#imgmodal').attr('src', '../../img/loading.svg')
+ var murl = $('#' + id + '-image-' + key).attr('data-url')
+ var type = $('#' + id + '-image-' + key).attr('data-type')
+ $('#imagemodal').attr('data-id', id)
+ $('#imagemodal').attr('data-acct', acct_id)
+ $(document).ready(function() {
+ if (type == 'image') {
+ $('#imagemodal').modal('open')
+ xhr = new XMLHttpRequest()
+ xhr.open('GET', murl, true)
+ xhr.addEventListener(
+ 'progress',
+ function(event) {
+ if (event.lengthComputable) {
+ var total = event.total
+ var now = event.loaded
+ var per = (now / total) * 100
+ $('#imgprog').text(Math.floor(per))
+ }
+ },
+ false
+ )
+ xhr.addEventListener(
+ 'loadend',
+ function(event) {
+ var total = event.total
+ var now = event.loaded
+ var per = (now / total) * 100
+ $('#imgprog').text(Math.floor(per))
+ },
+ false
+ )
+ xhr.send()
+ $('#imgmodal').attr('src', murl)
+ $('#imagewrap').dragScroll() // ドラッグスクロール設定
+ $('#imgmodal').show()
+ $('#imagemodal').attr('data-key', key)
+ $('#imagemodal').attr('data-id', id)
+ } else if (type == 'video' || type == 'gifv') {
+ $('#video').attr('src', murl)
+ $('#videomodal').modal('open')
+ $('#imgmodal').show()
}
- var element = new Image();
- var width;
- element.onload = function () {
- var width = element.naturalWidth;
- var height = element.naturalHeight;
- var windowH = $(window).height();
- var windowW = $(window).width();
- $("#imagemodal").css("bottom", "0")
- $("#imagemodal img").css("width", "auto")
+ var element = new Image()
+ var width
+ element.onload = function() {
+ var width = element.naturalWidth
+ var height = element.naturalHeight
+ var windowH = $(window).height()
+ var windowW = $(window).width()
+ $('#imagemodal').css('bottom', '0')
+ $('#imagemodal img').css('width', 'auto')
if (height < windowH) {
- $("#imagemodal").css("height", height + 60 + "px")
- $("#imagemodal img").css("height", "100%")
+ $('#imagemodal').css('height', height + 60 + 'px')
+ $('#imagemodal img').css('height', '100%')
if (width > windowW * 0.8) {
- $("#imagemodal").css("width", "80vw")
- $("#imagemodal img").css("width", "100%")
- var heightS = windowW * 0.8 / width * height;
- $("#imagemodal").css("height", heightS + 60 + "px")
+ $('#imagemodal').css('width', '80vw')
+ $('#imagemodal img').css('width', '100%')
+ var heightS = ((windowW * 0.8) / width) * height
+ $('#imagemodal').css('height', heightS + 60 + 'px')
} else {
- $("#imagemodal").css("width", width + "px")
+ $('#imagemodal').css('width', width + 'px')
}
} else {
- $("#imagemodal img").css("width", "auto")
- var widthS = windowH / height * width;
+ $('#imagemodal img').css('width', 'auto')
+ var widthS = (windowH / height) * width
if (widthS < windowW) {
- $("#imagemodal").css("width", widthS + "px")
+ $('#imagemodal').css('width', widthS + 'px')
} else {
- $("#imagemodal").css("width", "100vw")
+ $('#imagemodal').css('width', '100vw')
}
- $("#imagemodal").css("height", "100vh")
- $("#imagemodal img").css("height", "calc(100vh - 60px)")
+ $('#imagemodal').css('height', '100vh')
+ $('#imagemodal img').css('height', 'calc(100vh - 60px)')
}
-
}
- if ($("#" + id + "-image-" + (key * 1 + 1)).length == 0) {
- $("#image-next").prop("disabled", true);
+ if ($('#' + id + '-image-' + (key * 1 + 1)).length == 0) {
+ $('#image-next').prop('disabled', true)
} else {
- $("#image-next").prop("disabled", false);
+ $('#image-next').prop('disabled', false)
}
- if ($("#" + id + "-image-" + (key * 1 - 1)).length == 0) {
- $("#image-prev").prop("disabled", true);
+ if ($('#' + id + '-image-' + (key * 1 - 1)).length == 0) {
+ $('#image-prev').prop('disabled', true)
} else {
- $("#image-prev").prop("disabled", false);
+ $('#image-prev').prop('disabled', false)
}
- element.src = murl;
- });
+ element.src = murl
+ })
}
//イメージビューワーの送り
function imgCont(type) {
- $("#imgprog").text(0);
- var key = $('#imagemodal').attr('data-key');
- var id = $('#imagemodal').attr('data-id');
- if (type == "next") {
- key++;
- } else if (type == "prev") {
- key = key * 1 - 1;
+ $('#imgprog').text(0)
+ var key = $('#imagemodal').attr('data-key')
+ var id = $('#imagemodal').attr('data-id')
+ if (type == 'next') {
+ key++
+ } else if (type == 'prev') {
+ key = key * 1 - 1
}
- var murl = $("#" + id + "-image-" + key).attr("data-url");
+ var murl = $('#' + id + '-image-' + key).attr('data-url')
if (murl) {
- $('#imgmodal').attr('src', '../../img/loading.svg');
- var type = $("#" + id + "-image-" + key).attr("data-type");
- $(document).ready(function () {
- if (type == "image") {
- xhr = new XMLHttpRequest;
- xhr.open('GET', murl, true);
- xhr.responseType = "arraybuffer";
- xhr.addEventListener('progress', function (event) {
- if (event.lengthComputable) {
- var total = event.total;
- var now = event.loaded;
- var per = now / total * 100;
- $("#imgprog").text(Math.floor(per));
- }
- }, false);
- xhr.addEventListener('loadend', function (event) {
- var total = event.total;
- var now = event.loaded;
- var per = now / total * 100;
- $("#imgprog").text(Math.floor(per));
- }, false);
- xhr.send();
- $('#imgmodal').attr('src', murl);
- $('#imagewrap').dragScroll(); // ドラッグスクロール設定
- $('#imagemodal').attr('data-key', key);
- $('#imagemodal').attr('data-id', id);
- } else if (type == "video" || type == "gifv") {
- $('#video').attr('src', murl);
- $('#videomodal').modal('open');
+ $('#imgmodal').attr('src', '../../img/loading.svg')
+ var type = $('#' + id + '-image-' + key).attr('data-type')
+ $(document).ready(function() {
+ if (type == 'image') {
+ xhr = new XMLHttpRequest()
+ xhr.open('GET', murl, true)
+ xhr.responseType = 'arraybuffer'
+ xhr.addEventListener(
+ 'progress',
+ function(event) {
+ if (event.lengthComputable) {
+ var total = event.total
+ var now = event.loaded
+ var per = (now / total) * 100
+ $('#imgprog').text(Math.floor(per))
+ }
+ },
+ false
+ )
+ xhr.addEventListener(
+ 'loadend',
+ function(event) {
+ var total = event.total
+ var now = event.loaded
+ var per = (now / total) * 100
+ $('#imgprog').text(Math.floor(per))
+ },
+ false
+ )
+ xhr.send()
+ $('#imgmodal').attr('src', murl)
+ $('#imagewrap').dragScroll() // ドラッグスクロール設定
+ $('#imagemodal').attr('data-key', key)
+ $('#imagemodal').attr('data-id', id)
+ } else if (type == 'video' || type == 'gifv') {
+ $('#video').attr('src', murl)
+ $('#videomodal').modal('open')
}
- var element = new Image();
- var width;
- element.onload = function () {
- var width = element.naturalWidth;
- var height = element.naturalHeight;
- var windowH = $(window).height();
- var windowW = $(window).width();
- $("#imagemodal").css("bottom", "0")
- $("#imagemodal img").css("width", "auto")
+ var element = new Image()
+ var width
+ element.onload = function() {
+ var width = element.naturalWidth
+ var height = element.naturalHeight
+ var windowH = $(window).height()
+ var windowW = $(window).width()
+ $('#imagemodal').css('bottom', '0')
+ $('#imagemodal img').css('width', 'auto')
if (height < windowH) {
- $("#imagemodal").css("height", height + 60 + "px")
- $("#imagemodal img").css("height", "100%")
+ $('#imagemodal').css('height', height + 60 + 'px')
+ $('#imagemodal img').css('height', '100%')
if (width > windowW * 0.8) {
- $("#imagemodal").css("width", "80vw")
- $("#imagemodal img").css("width", "100%")
- var heightS = windowW * 0.8 / width * height;
- $("#imagemodal").css("height", heightS + 60 + "px")
+ $('#imagemodal').css('width', '80vw')
+ $('#imagemodal img').css('width', '100%')
+ var heightS = ((windowW * 0.8) / width) * height
+ $('#imagemodal').css('height', heightS + 60 + 'px')
} else {
- $("#imagemodal").css("width", width + "px")
+ $('#imagemodal').css('width', width + 'px')
}
} else {
- $("#imagemodal img").css("width", "auto")
- var widthS = windowH / height * width;
+ $('#imagemodal img').css('width', 'auto')
+ var widthS = (windowH / height) * width
if (widthS < windowW) {
- $("#imagemodal").css("width", widthS + "px")
+ $('#imagemodal').css('width', widthS + 'px')
} else {
- $("#imagemodal").css("width", "100vw")
+ $('#imagemodal').css('width', '100vw')
}
- $("#imagemodal").css("height", "100vh")
- $("#imagemodal img").css("height", "calc(100vh - 60px)")
+ $('#imagemodal').css('height', '100vh')
+ $('#imagemodal img').css('height', 'calc(100vh - 60px)')
}
}
- if ($("#" + id + "-image-" + (key * 1 + 1)).length === 0) {
- $("#image-next").prop("disabled", true);
+ if ($('#' + id + '-image-' + (key * 1 + 1)).length === 0) {
+ $('#image-next').prop('disabled', true)
} else {
- $("#image-next").prop("disabled", false);
+ $('#image-next').prop('disabled', false)
}
- if ($("#" + id + "-image-" + (key * 1 - 1)).length === 0) {
- $("#image-prev").prop("disabled", true);
+ if ($('#' + id + '-image-' + (key * 1 - 1)).length === 0) {
+ $('#image-prev').prop('disabled', true)
} else {
- $("#image-prev").prop("disabled", false);
+ $('#image-prev').prop('disabled', false)
}
- element.src = murl;
-
- });
+ element.src = murl
+ })
}
}
//ズームボタン(z:倍率)
function zoom(z) {
- var wdth = $('#imagewrap img').width();
- var wdth = wdth * z;
- $('#imagewrap img').css("width", wdth + "px");
- var hgt = $('#imagewrap img').height();
- var hgt = hgt * z;
- $('#imagewrap img').css("height", hgt + "px");
+ var wdth = $('#imagewrap img').width()
+ var wdth = wdth * z
+ $('#imagewrap img').css('width', wdth + 'px')
+ var hgt = $('#imagewrap img').height()
+ var hgt = hgt * z
+ $('#imagewrap img').css('height', hgt + 'px')
}
//スマホ対応ドラッグ移動システム
-(function () {
- $.fn.dragScroll = function () {
- var target = this;
- $(this).mousedown(function (event) {
- $(this)
- .data('down', true)
- .data('x', event.clientX)
- .data('y', event.clientY)
- .data('scrollLeft', this.scrollLeft)
- .data('scrollTop', this.scrollTop);
- return false;
- }).css({
- 'overflow': 'hidden', // スクロールバー非表示
- 'cursor': 'move'
- });
+;(function() {
+ $.fn.dragScroll = function() {
+ var target = this
+ $(this)
+ .mousedown(function(event) {
+ $(this)
+ .data('down', true)
+ .data('x', event.clientX)
+ .data('y', event.clientY)
+ .data('scrollLeft', this.scrollLeft)
+ .data('scrollTop', this.scrollTop)
+ return false
+ })
+ .css({
+ overflow: 'hidden', // スクロールバー非表示
+ cursor: 'move'
+ })
// ウィンドウから外れてもイベント実行
- $(document).mousemove(function (event) {
- if ($(target).data('down') == true) {
- // スクロール
- target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') -
- event.clientX);
- target.scrollTop($(target).data('scrollTop') + $(target).data('y') -
- event.clientY);
- return false; // 文字列選択を抑止
- }
- }).mouseup(function (event) {
- $(target).data('down', false);
- });
- $(this).on('touchstart', function (event) {
- $(this)
- .data('down', true)
- .data('x', getX(event))
- .data('y', getY(event))
- .data('scrollLeft', this.scrollLeft)
- .data('scrollTop', this.scrollTop);
- return false;
- }).css({
- 'overflow': 'hidden', // スクロールバー非表示
- 'cursor': 'move'
- }); //指が触れたか検知
- $(this).on('touchmove', function (event) {
+ $(document)
+ .mousemove(function(event) {
+ if ($(target).data('down') == true) {
+ // スクロール
+ target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') - event.clientX)
+ target.scrollTop($(target).data('scrollTop') + $(target).data('y') - event.clientY)
+ return false // 文字列選択を抑止
+ }
+ })
+ .mouseup(function(event) {
+ $(target).data('down', false)
+ })
+ $(this)
+ .on('touchstart', function(event) {
+ $(this)
+ .data('down', true)
+ .data('x', getX(event))
+ .data('y', getY(event))
+ .data('scrollLeft', this.scrollLeft)
+ .data('scrollTop', this.scrollTop)
+ return false
+ })
+ .css({
+ overflow: 'hidden', // スクロールバー非表示
+ cursor: 'move'
+ }) //指が触れたか検知
+ $(this).on('touchmove', function(event) {
if ($(target).data('down') === true) {
// スクロール
- target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') -
- getX(event));
- target.scrollTop($(target).data('scrollTop') + $(target).data('y') -
- getY(event));
- return false; // 文字列選択を抑止
- } else { }
- }); //指が動いたか検知
- $(this).on('touchend', function (event) {
- $(target).data('down', false);
- });
+ target.scrollLeft($(target).data('scrollLeft') + $(target).data('x') - getX(event))
+ target.scrollTop($(target).data('scrollTop') + $(target).data('y') - getY(event))
+ return false // 文字列選択を抑止
+ } else {
+ }
+ }) //指が動いたか検知
+ $(this).on('touchend', function(event) {
+ $(target).data('down', false)
+ })
- return this;
+ return this
}
-})(jQuery);
+})(jQuery)
function getX(event) {
- return event.originalEvent.touches[0].pageX;
+ return event.originalEvent.touches[0].pageX
}
function getY(event) {
- return event.originalEvent.touches[0].pageY;
+ return event.originalEvent.touches[0].pageY
}
//マウスホイールで拡大
-var element = document.getElementById("imagemodal");
-element.onmousewheel = function (e) {
- var delta = e.wheelDelta;
+var element = document.getElementById('imagemodal')
+element.onmousewheel = function(e) {
+ var delta = e.wheelDelta
if (delta > 0) {
zoom(1.1)
} else {
@@ -263,25 +280,24 @@ element.onmousewheel = function (e) {
//当該トゥート
function detFromImg() {
- var id = $("#imagemodal").attr("data-id");
- var acct_id = $("#imagemodal").attr("data-acct");
- $('#imagemodal').modal('close');
- details(id, acct_id);
+ var id = $('#imagemodal').attr('data-id')
+ var acct_id = $('#imagemodal').attr('data-acct')
+ $('#imagemodal').modal('close')
+ details(id, acct_id)
}
//画像保存
function dlImg() {
- var url = $("#imgmodal").attr("src");
- if (localStorage.getItem("savefolder")) {
- var save = localStorage.getItem("savefolder");
+ var url = $('#imgmodal').attr('src')
+ if (localStorage.getItem('savefolder')) {
+ var save = localStorage.getItem('savefolder')
} else {
- var save = "";
+ var save = ''
}
- postMessage(["generalDL", [url, save, false]], "*")
-
+ postMessage(['generalDL', [url, save, false]], '*')
}
function openFinder(dir) {
- postMessage(["openFinder", dir], "*")
+ postMessage(['openFinder', dir], '*')
}
-function stopVideo(){
+function stopVideo() {
document.getElementById('video').pause()
-}
\ No newline at end of file
+}
diff --git a/app/js/ui/layout.js b/app/js/ui/layout.js
index 73288973..11716fe4 100644
--- a/app/js/ui/layout.js
+++ b/app/js/ui/layout.js
@@ -1,462 +1,585 @@
//レイアウトの設定
-var websocketOld = [];
-var websocket = [];
-var websocketHome = [];
-var websocketLocal = [];
-var websocketNotf = [];
+var websocketOld = []
+var websocket = []
+var websocketHome = []
+var websocketLocal = []
+var websocketNotf = []
//カラム追加ボックストグル
function addColumnMenu() {
- $("#left-menu div").removeClass("active");
- $("#addColumnMenu").addClass("active");
- $(".menu-content").addClass("hide");
- $("#add-box").removeClass("hide");
+ $('#left-menu div').removeClass('active')
+ $('#addColumnMenu').addClass('active')
+ $('.menu-content').addClass('hide')
+ $('#add-box').removeClass('hide')
addselCk()
}
-$('.type').click(function () {
- $(".type").removeClass("active");
- $(this).addClass("active");
- $("#type-sel").val($(this).attr("data-type"))
+$('.type').click(function() {
+ $('.type').removeClass('active')
+ $(this).addClass('active')
+ $('#type-sel').val($(this).attr('data-type'))
})
//最初、カラム変更時に発火
function parseColumn(target, dontclose) {
if (target === 0) {
//this is kuso
- target = "zero"
+ target = 'zero'
}
- console.log("%c Parse column", "color:red;font-size:125%");
- var size = localStorage.getItem("size");
+ console.log('%c Parse column', 'color:red;font-size:125%')
+ 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");
+ $('#timeline-container').css('font-size', size + 'px')
+ $('.toot-reset').css('font-size', size + 'px')
+ $('.cont-series').css('font-size', size + 'px')
}
- if (localStorage.getItem("menu-done")) {
- $("#fukidashi").addClass("hide")
+ if (localStorage.getItem('menu-done')) {
+ $('#fukidashi').addClass('hide')
}
if (!dontclose && !target) {
- tlCloser();
+ tlCloser()
}
- var multi = localStorage.getItem("multi");
+ var multi = localStorage.getItem('multi')
if (multi) {
- var obj = JSON.parse(multi);
+ var obj = JSON.parse(multi)
- var templete;
- Object.keys(obj).forEach(function (key) {
- var acct = obj[key];
+ var templete
+ Object.keys(obj).forEach(function(key) {
+ var acct = obj[key]
- 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);
- localStorage.setItem("acct_" + key + "_at", acct.at);
- notf(key, 0);
- ckdb(key);
+ 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)
+ localStorage.setItem('acct_' + key + '_at', acct.at)
+ notf(key, 0)
+ ckdb(key)
//フィルターデータ読もう
- getFilter(key);
- var domain = localStorage.getItem("domain_" + key);
- if (localStorage.getItem("mode_" + domain) == "misskey") {
- localStorage.removeItem("misskey_wss_" + key)
+ getFilter(key)
+ var domain = localStorage.getItem('domain_' + key)
+ if (localStorage.getItem('mode_' + domain) == 'misskey') {
+ localStorage.removeItem('misskey_wss_' + key)
connectMisskey(key, false)
}
- localStorage.removeItem("emoji_" + key) //カスタム絵文字カテゴリ分け用旧データ削除
- });
+ localStorage.removeItem('emoji_' + key) //カスタム絵文字カテゴリ分け用旧データ削除
+ })
}
- var acctlist = obj;
- console.table(obj);
+ var acctlist = obj
+ console.table(obj)
/*var xed=localStorage.getItem("xed");
if(xed){
xpand();
}*/
- var col = localStorage.getItem("column");
+ var col = localStorage.getItem('column')
if (!col) {
- var obj = [{
- domain: 0,
- type: 'local'
- }];
- var json = JSON.stringify(obj);
- localStorage.setItem("column", json);
+ var obj = [
+ {
+ domain: 0,
+ type: 'local'
+ }
+ ]
+ var json = JSON.stringify(obj)
+ localStorage.setItem('column', json)
} else {
- var obj = JSON.parse(col);
+ var obj = JSON.parse(col)
}
var numtarget = false
- if (target == "add") {
+ if (target == 'add') {
var tlidtar = obj.length - 1
obj = [obj[tlidtar]]
} else if (target) {
var tlidtar = target
- if (target == "zero") {
+ if (target == 'zero') {
target = 0
}
obj = [obj[target]]
numtarget = true
} else {
var tlidtar = null
- if ($("#timeline-container").length) {
- $("#timeline-container").html("");
- $(".box, .boxIn").resizable("destroy");
+ if ($('#timeline-container').length) {
+ $('#timeline-container').html('')
+ $('.box, .boxIn').resizable('destroy')
}
}
- var basekey = 0;
+ var basekey = 0
for (var key = 0; key < obj.length; key++) {
- var next = key + 1;
+ var next = key + 1
//acctって言いながらタイムライン
- var acct = obj[key];
+ var acct = obj[key]
if (tlidtar) {
- if (tlidtar == "zero") {
+ if (tlidtar == 'zero') {
key = 0
} else {
key = tlidtar
}
-
}
- if (acct.type == "notf") {
- var notf_attr = ' data-notf=' + acct.domain;
- var if_notf = "hide";
+ if (acct.type == 'notf') {
+ var notf_attr = ' data-notf=' + acct.domain
+ var if_notf = 'hide'
} else {
- var notf_attr = '';
- var if_notf = "";
+ var notf_attr = ''
+ var if_notf = ''
}
- if (localStorage.getItem("notification_" + acct.domain)) {
- var unique_notf = lang.lang_layout_thisacct.replace("{{notf}}", localStorage.getItem("notification_" + acct.domain));
+ 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";
+ if (lang.language == 'ja') {
+ var notflocale = '通知'
+ } else if (lang.language == 'en') {
+ var notflocale = 'Notification'
}
- var unique_notf = lang.lang_layout_thisacct.replace("{{notf}}", notflocale);
+ var unique_notf = lang.lang_layout_thisacct.replace('{{notf}}', notflocale)
}
- var insert = "";
- var icnsert = "";
+ var insert = ''
+ var icnsert = ''
if (acct.background) {
- if (acct.text == "def") {
-
+ 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"
+ 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 + '" ';
+ insert = 'background-color:#' + acct.background + '; color: #' + txhex + '; '
+ icnsert = ' style="color: #' + ichex + '" '
}
}
- console.log(acct);
+ console.log(acct)
if (acctlist[acct.domain]) {
- if (acctlist[acct.domain].background != "def") {
- insert = insert + " border-bottom:medium solid #" + acctlist[acct.domain].background + ";";
+ if (acctlist[acct.domain].background != 'def') {
+ insert = insert + ' border-bottom:medium solid #' + acctlist[acct.domain].background + ';'
}
}
- if (acct.type == "notf" && localStorage.getItem("setasread") == "no") {
- localStorage.setItem("hasNotfC_" + acct.domain, "true");
+ if (acct.type == 'notf' && localStorage.getItem('setasread') == 'no') {
+ localStorage.setItem('hasNotfC_' + acct.domain, 'true')
} else {
- localStorage.removeItem("hasNotfC_" + acct.domain);
+ localStorage.removeItem('hasNotfC_' + acct.domain)
}
- var width = localStorage.getItem("width");
+ var width = localStorage.getItem('width')
if (width) {
- var css = " min-width:" + width + "px;"
+ var css = ' min-width:' + width + 'px;'
}
- if(acct.width){
- var css = " min-width:" + acct.width + "px;max-width:" + acct.width + "px;"
+ if (acct.width) {
+ var css = ' min-width:' + acct.width + 'px;max-width:' + acct.width + 'px;'
}
- if(!css){
- var css = ""
+ if (!css) {
+ var css = ''
}
- if (acct.type == "webview") {
- if (localStorage.getItem("fixwidth")) {
- var fixwidth = localStorage.getItem("fixwidth");
- var css = " min-width:" + fixwidth + "px;"
+ if (acct.type == 'webview') {
+ if (localStorage.getItem('fixwidth')) {
+ var fixwidth = localStorage.getItem('fixwidth')
+ var css = ' min-width:' + fixwidth + 'px;'
} else {
- var css = "";
+ var css = ''
}
- var html = webviewParse("https://tweetdeck.twitter.com", key, insert, icnsert, css);
- $("#timeline-container").append(html);
- } else if (acct.type == "tootsearch") {
+ var html = webviewParse('https://tweetdeck.twitter.com', key, insert, icnsert, css)
+ $('#timeline-container').append(html)
+ } else if (acct.type == 'tootsearch') {
if (!acct.left_fold) {
- basekey = key;
+ basekey = key
}
- var anime = localStorage.getItem("animation");
- if (anime == "yes" || !anime) {
- var animecss = "box-anime";
+ var anime = localStorage.getItem('animation')
+ if (anime == 'yes' || !anime) {
+ var animecss = 'box-anime'
} else {
- var animecss = "";
+ var animecss = ''
}
- unstreamingTL(acct.type, key, basekey, insert, icnsert, acct.left_fold, css, animecss, acct.data);
+ unstreamingTL(
+ acct.type,
+ key,
+ basekey,
+ insert,
+ icnsert,
+ acct.left_fold,
+ css,
+ animecss,
+ acct.data
+ )
} else {
- var anime = localStorage.getItem("animation");
- if (anime == "yes" || !anime) {
- var animecss = "box-anime";
+ var anime = localStorage.getItem('animation')
+ if (anime == 'yes' || !anime) {
+ var animecss = 'box-anime'
} else {
- var animecss = "";
+ var animecss = ''
}
- var unread = 'more '
- if (acct.type == "notf") {
- var exclude = lang.lang_excluded + ': ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- 'Filter ';
+ var unread =
+ `
+ more
+ `
+ if (acct.type == 'notf') {
+ var exclude =
+ lang.lang_excluded +
+ `:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Filter `
if (checkNotfFilter(key)) {
- exclude = exclude + 'Clear all '
+ exclude =
+ exclude +
+ `
+ Clear all
+ `
}
- exclude = exclude + " ";
-
- } else if (acct.type == "home") {
- var exclude = 'Off ' + lang.lang_layout_excludingbt + ' ';
-
+ exclude = exclude + ' '
+ } else if (acct.type == 'home') {
+ var exclude =
+ `
+
+ Off
+
+ ${lang.lang_layout_excludingbt}
+ `
} else {
- var exclude = "";
- unread = ""
+ var exclude = ''
+ unread = ''
}
- var markers = localStorage.getItem("markers");
- if (markers == "yes") {
- markers = true;
+ var markers = localStorage.getItem('markers')
+ if (markers == 'yes') {
+ markers = true
} else {
markers = false
}
if (!markers) {
- unread = ""
+ unread = ''
}
if (!acct.left_fold) {
- basekey = key;
+ basekey = key
if (!numtarget) {
- var basehtml = '
';
- $("#timeline-container").append(basehtml);
+ var basehtml =
+ `
`
+ $('#timeline-container').append(basehtml)
}
- var left_hold = 'view_agenda ' + lang.lang_layout_leftFold + ' ';
+ var left_hold =
+ `
+ view_agenda
+
+ ${lang.lang_layout_leftFold} `
} else {
- var left_hold = 'view_column ' + lang.lang_layout_leftUnfold + ' ';
+ var left_hold =
+ `
+ view_column
+
+ ${lang.lang_layout_leftUnfold} `
}
if (key === 0) {
- left_hold = '';
+ left_hold = ''
}
- if (localStorage.getItem("mode_" + localStorage.getItem("domain_" + acct.domain)) == "misskey") {
- var isMisRed = ""
- exclude = ""
- var if_misskey_hide = "hide"
+ 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 = ""
+ var isMisRed = 'red-text'
+ var if_misskey_hide = ''
}
- if(acct.height){
- var addHeight = " min-height:" + acct.height + "px;max-height:" + acct.height + "px;"
- }else {
- var addHeight = ""
+ if (acct.height) {
+ var addHeight = ' min-height:' + acct.height + 'px;max-height:' + acct.height + 'px;'
+ } else {
+ var addHeight = ''
}
- var html = '' +
- '
' + exclude + left_hold + '
perm_media On ' + lang.lang_layout_mediafil + '
link On ' + lang.lang_layout_linkana + '
hearing ' +
- '">On ' + lang.lang_layout_tts + 'TL
refresh ' + lang.lang_layout_reconnect + ' ' + lang.lang_layout_headercolor + '
' + lang.lang_layout_nodata + '
'
+ var html =
+ `
+
+
+
+
+
+
+
+ ${lang.lang_layout_nodata}
+
+
+
`
if (numtarget) {
$('timeline_box_' + key + '_box').html(html)
} else {
$('#timeline_box_' + basekey + '_parentBox').append(html)
}
- localStorage.removeItem("pool_" + key);
+ localStorage.removeItem('pool_' + key)
if (acct.data) {
- var data = acct.data;
+ var data = acct.data
} else {
- var data = "";
+ var data = ''
}
- if (localStorage.getItem("catch_" + key)) {
- var delc = "true";
+ if (localStorage.getItem('catch_' + key)) {
+ var delc = 'true'
} else {
- var delc = "false";
+ var delc = 'false'
}
- if (localStorage.getItem("voice_" + key)) {
- var voice = true;
+ if (localStorage.getItem('voice_' + key)) {
+ var voice = true
} else {
- var voice = false;
+ var voice = false
}
- tl(acct.type, data, acct.domain, key, delc, voice, "");
- cardCheck(key);
- ebtCheck(key);
- mediaCheck(key);
- catchCheck(key);
- voiceCheck(key);
- var css = ""
+ tl(acct.type, data, acct.domain, key, delc, voice, '')
+ cardCheck(key)
+ ebtCheck(key)
+ mediaCheck(key)
+ catchCheck(key)
+ voiceCheck(key)
+ var css = ''
}
}
- var box = localStorage.getItem("box");
- if (box == "absolute") {
- setTimeout(show, 1000);
+ var box = localStorage.getItem('box')
+ if (box == 'absolute') {
+ setTimeout(show, 1000)
}
- if (localStorage.getItem("reverse")) {
- $("#bottom").removeClass("reverse");
- $(".leftside").removeClass("reverse");
+ if (localStorage.getItem('reverse')) {
+ $('#bottom').removeClass('reverse')
+ $('.leftside').removeClass('reverse')
}
- $("#bottom").removeClass("hide");
- if (localStorage.getItem("sec") && localStorage.getItem("sec") != "nothing") {
- secvis(localStorage.getItem("sec"));
+ $('#bottom').removeClass('hide')
+ if (localStorage.getItem('sec') && localStorage.getItem('sec') != 'nothing') {
+ secvis(localStorage.getItem('sec'))
}
- favTag();
- var cw = localStorage.getItem("always-cw");
- if (cw == "yes") {
- if (!$("#cw").hasClass("cw-avail")) {
- $("#cw-text").show();
- $("#cw").addClass("yellow-text");
- $("#cw").addClass("cw-avail");
- var cwt = localStorage.getItem("cw-text");
+ favTag()
+ var cw = localStorage.getItem('always-cw')
+ if (cw == 'yes') {
+ if (!$('#cw').hasClass('cw-avail')) {
+ $('#cw-text').show()
+ $('#cw').addClass('yellow-text')
+ $('#cw').addClass('cw-avail')
+ var cwt = localStorage.getItem('cw-text')
if (cwt) {
- $("#cw-text").val(cwt);
+ $('#cw-text').val(cwt)
}
}
}
- $(".box, .boxIn").resizable({
+ $('.box, .boxIn').resizable({
minHeight: 50,
minWidth: 50,
grid: 50,
- resize: function (event, ui) {
- $(this).css("min-width", ui.size.width + "px")
- $(this).css("max-width", ui.size.width + "px")
- $(this).css("min-height", ui.size.height + "px")
- $(this).css("max-height", ui.size.height + "px")
+ resize: function(event, ui) {
+ $(this).css('min-width', ui.size.width + 'px')
+ $(this).css('max-width', ui.size.width + 'px')
+ $(this).css('min-height', ui.size.height + 'px')
+ $(this).css('max-height', ui.size.height + 'px')
},
- stop: function (event, ui) {
- var col = localStorage.getItem("column");
- var o = JSON.parse(col);
+ stop: function(event, ui) {
+ var col = localStorage.getItem('column')
+ var o = JSON.parse(col)
var width = ui.size.width
var height = ui.size.height
- if ($(this).hasClass("boxIn")) {
+ if ($(this).hasClass('boxIn')) {
//縦幅。その縦幅を持つカラムのidは
- console.log("tate")
- var key = $(this).attr("tlid")
- var obj = o[key];
- obj.height = height;
- o[key] = obj;
+ console.log('tate')
+ var key = $(this).attr('tlid')
+ var obj = o[key]
+ obj.height = height
+ o[key] = obj
} else {
//横幅。その縦幅を持つカラムのidは
- console.log("yoko")
- var key = $(this).find(".boxIn").attr("tlid")
- var obj = o[key];
- obj.width = width;
- o[key] = obj;
+ console.log('yoko')
+ var key = $(this)
+ .find('.boxIn')
+ .attr('tlid')
+ var obj = o[key]
+ obj.width = width
+ o[key] = obj
}
- var json = JSON.stringify(o);
- localStorage.setItem("column", json);
+ var json = JSON.stringify(o)
+ localStorage.setItem('column', json)
}
- });
+ })
}
function checkStr(type, data, acct_id, key, delc, voice) {
- if ($('#notice_icon_' + key).hasClass("red-text") && type != "notf" && type != "mix") {
- goTop(key);
- tlDiff(type, data, acct_id, key, delc, voice, "");
+ if ($('#notice_icon_' + key).hasClass('red-text') && type != 'notf' && type != 'mix') {
+ goTop(key)
+ tlDiff(type, data, acct_id, key, delc, voice, '')
} else {
- goTop(key);
+ goTop(key)
}
}
//セカンダリートゥートボタン
function secvis(set) {
- if (set == "public") {
- $("#toot-sec-icon").text("public");
- $("#toot-sec-btn").addClass("purple");
- } else if (set == "unlisted") {
- $("#toot-sec-icon").text("lock_open");
- $("#toot-sec-btn").addClass("blue");
- } else if (set == "private") {
- $("#toot-sec-icon").text("lock");
- $("#toot-sec-btn").addClass("orange");
- } else if (set == "direct") {
- $("#toot-sec-icon").text("mail");
- $("#toot-sec-btn").addClass("red");
- } else if (set == "limited") {
- $("#toot-sec-icon").text("group");
- $("#toot-sec-btn").addClass("teal");
- } else if (set == "local") {
- $("#toot-sec-icon").text("visibility");
- $("#toot-sec-btn").addClass("light-blue");
+ if (set == 'public') {
+ $('#toot-sec-icon').text('public')
+ $('#toot-sec-btn').addClass('purple')
+ } else if (set == 'unlisted') {
+ $('#toot-sec-icon').text('lock_open')
+ $('#toot-sec-btn').addClass('blue')
+ } else if (set == 'private') {
+ $('#toot-sec-icon').text('lock')
+ $('#toot-sec-btn').addClass('orange')
+ } else if (set == 'direct') {
+ $('#toot-sec-icon').text('mail')
+ $('#toot-sec-btn').addClass('red')
+ } else if (set == 'limited') {
+ $('#toot-sec-icon').text('group')
+ $('#toot-sec-btn').addClass('teal')
+ } else if (set == 'local') {
+ $('#toot-sec-icon').text('visibility')
+ $('#toot-sec-btn').addClass('light-blue')
}
- $("#toot-sec-btn").removeClass("hide");
+ $('#toot-sec-btn').removeClass('hide')
}
//カラム追加
function addColumn() {
- var acct = $("#add-acct-sel").val();
- if (acct != "webview" && acct != "noauth") {
- localStorage.setItem("last-use", acct);
+ var acct = $('#add-acct-sel').val()
+ if (acct != 'webview' && acct != 'noauth') {
+ localStorage.setItem('last-use', acct)
}
- var type = $("#type-sel").val();
- if (acct == "noauth") {
- acct = $("#noauth-url").val();
- type = "noauth"
- } else if (acct == "webview") {
- acct = "";
- type = "webview"
+ var type = $('#type-sel').val()
+ if (acct == 'noauth') {
+ acct = $('#noauth-url').val()
+ type = 'noauth'
+ } else if (acct == 'webview') {
+ acct = ''
+ type = 'webview'
}
var add = {
domain: acct,
type: type
- };
- var multi = localStorage.getItem("column");
- var obj = JSON.parse(multi);
+ }
+ var multi = localStorage.getItem('column')
+ var obj = JSON.parse(multi)
if (!obj) {
- var leng = 0;
- var json = JSON.stringify([add]);
- localStorage.setItem("column", json);
+ var leng = 0
+ var json = JSON.stringify([add])
+ localStorage.setItem('column', json)
} else {
- var leng = obj.length;
- obj.push(add);
- var json = JSON.stringify(obj);
- localStorage.setItem("column", json);
+ var leng = obj.length
+ obj.push(add)
+ var json = JSON.stringify(obj)
+ localStorage.setItem('column', json)
}
- parseColumn('add');
+ parseColumn('add')
}
function addselCk() {
- var acct = $("#add-acct-sel").val();
- var domain = localStorage.getItem("domain_" + acct);
- if (acct == "webview") {
- $("#auth").addClass("hide");
- $("#noauth").addClass("hide");
- $("#webview-add").removeClass("hide");
- } else if (acct == "noauth") {
- $("#auth").addClass("hide");
- $("#noauth").removeClass("hide");
- $("#webview-add").addClass("hide");
+ var acct = $('#add-acct-sel').val()
+ var domain = localStorage.getItem('domain_' + acct)
+ if (acct == 'webview') {
+ $('#auth').addClass('hide')
+ $('#noauth').addClass('hide')
+ $('#webview-add').removeClass('hide')
+ } else if (acct == 'noauth') {
+ $('#auth').addClass('hide')
+ $('#noauth').removeClass('hide')
+ $('#webview-add').addClass('hide')
} else {
- $("#auth").removeClass("hide");
- $("#noauth").addClass("hide");
- $("#webview-add").addClass("hide");
+ $('#auth').removeClass('hide')
+ $('#noauth').addClass('hide')
+ $('#webview-add').addClass('hide')
}
- if (domain == "knzk.me" || domain == "mstdn.y-zu.org") {
- $("#type-sel").append('
' + lang.layout_dm + ' ');
+ if (domain == 'knzk.me' || domain == 'mstdn.y-zu.org') {
+ $('#type-sel').append(
+ '
' + lang.layout_dm + ' '
+ )
} else {
- $("#direct-add").remove();
+ $('#direct-add').remove()
}
}
//カラム削除
function removeColumn(tlid) {
- $("#sort-box").addClass("hide");
- $("#sort-box").removeClass("show");
+ $('#sort-box').addClass('hide')
+ $('#sort-box').removeClass('show')
Swal.fire({
title: lang.lang_layout_deleteColumn,
text: lang.lang_layout_deleteColumnDesc,
@@ -466,161 +589,260 @@ function removeColumn(tlid) {
cancelButtonColor: '#d33',
confirmButtonText: lang.lang_yesno,
cancelButtonText: lang.lang_no
- }).then((result) => {
+ }).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);
+ 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()
+ $('#timeline_box_' + tlid + '_parentBox').remove()
}
- $("#sort-box").removeClass("hide");
- $("#sort-box").addClass("show");
- });
+ $('#sort-box').removeClass('hide')
+ $('#sort-box').addClass('show')
+ })
}
//設定トグル
function setToggle(tlid) {
- colorpicker(tlid);
- if ($("#util-box_" + tlid).hasClass("column-hide")) {
- $("#util-box_" + tlid).css("display", "block")
- $("#util-box_" + tlid).animate({
- 'height': '200px'
- }, {
- 'duration': 300,
- 'complete': function () {
- $("#util-box_" + tlid).css("overflow-y", "scroll")
- $("#util-box_" + tlid).removeClass("column-hide")
+ colorpicker(tlid)
+ if ($('#util-box_' + tlid).hasClass('column-hide')) {
+ $('#util-box_' + tlid).css('display', 'block')
+ $('#util-box_' + tlid).animate(
+ {
+ height: '200px'
+ },
+ {
+ duration: 300,
+ complete: function() {
+ $('#util-box_' + tlid).css('overflow-y', 'scroll')
+ $('#util-box_' + tlid).removeClass('column-hide')
+ }
}
- });
+ )
} else {
- $("#util-box_" + tlid).css("overflow-y", "hidden")
- $("#util-box_" + tlid).animate({
- 'height': '0'
- }, {
- 'duration': 300,
- 'complete': function () {
- $("#util-box_" + tlid).addClass("column-hide")
- $("#util-box_" + tlid).css("display", "none")
+ $('#util-box_' + tlid).css('overflow-y', 'hidden')
+ $('#util-box_' + tlid).animate(
+ {
+ height: '0'
+ },
+ {
+ duration: 300,
+ complete: function() {
+ $('#util-box_' + tlid).addClass('column-hide')
+ $('#util-box_' + tlid).css('display', 'none')
+ }
}
- });
+ )
}
}
function colorpicker(key) {
temp =
- '
Default
' +
- '
Red
' +
- '
Pink
' +
- '
Purple
' +
- '
Deep-purple
' +
- '
Indigo
' +
- '
Blue
' +
- '
Light-blue
' +
- '
Cyan
' +
- '
Teal
' +
- '
Green
' +
- '
Light-green
' +
- '
Lime
' +
- '
Yellow
' +
- '
Amber
' +
- '
Orange
' +
- '
Deep-orange
' +
- '
Brown
' +
- '
Grey
' +
- '
Blue-grey
' +
- '
Black
' +
- '
White
';
- $("#picker_" + key).html(temp);
+ `
Default
+
Red
+
Pink
+
Purple
+
Deep-purple
+
Indigo
+
Blue
+
Light-blue
+
Cyan
+
Teal
+
Green
+
Light-green
+
Lime
+
Yellow
+
Amber
+
Orange
+
Deep-orange
+
Brown
+
Grey
+
Blue-grey
+
Black
+
White
`
+ $('#picker_' + key).html(temp)
}
function coloradd(key, bg, txt) {
- var col = localStorage.getItem("column");
- var o = JSON.parse(col);
- var obj = o[key];
- obj.background = bg;
- obj.text = txt;
- o[key] = obj;
- var json = JSON.stringify(o);
- localStorage.setItem("column", json);
- if (txt == "def") {
- $("#menu_" + key).css("background-color", "");
- $("#menu_" + key).css("color", "");
- $("#menu_" + key + " .nex").css("color", "");
+ var col = localStorage.getItem('column')
+ var o = JSON.parse(col)
+ var obj = o[key]
+ obj.background = bg
+ obj.text = txt
+ o[key] = obj
+ var json = JSON.stringify(o)
+ localStorage.setItem('column', json)
+ if (txt == 'def') {
+ $('#menu_' + key).css('background-color', '')
+ $('#menu_' + key).css('color', '')
+ $('#menu_' + key + ' .nex').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).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);
+ $('#menu_' + key + ' .nex').css('color', '#' + ichex)
+ $('#menu_' + key).css('color', '#' + bghex)
}
}
//禁断のTwitter
function webviewParse(url, key, insert, icnsert, css) {
- var html = '
' +
- '
' + lang.lang_layout_headercolor + '
';
- return html;
+ var html =
+ `
+
+
+
+ ${lang.lang_layout_headercolor}
+
+
+
+
+
`
+ return html
}
function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, animecss, q) {
if (!left_fold) {
- var basehtml = '
';
- $("#timeline-container").append(basehtml);
- var left_hold = '
view_agenda ' + lang.lang_layout_leftFold + '
';
+ var basehtml =
+ '
'
+ $('#timeline-container').append(basehtml)
+ var left_hold =
+ '
view_agenda ' +
+ lang.lang_layout_leftFold +
+ '
'
} else {
- var left_hold = '
view_column ' + lang.lang_layout_leftUnfold + '
';
+ var left_hold =
+ '
view_column ' +
+ lang.lang_layout_leftUnfold +
+ '
'
}
- var html = '