Compare commits
	
		
			9 Commits
		
	
	
		
			v21.2.0
			...
			rewrite-ov
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					8eadb8287d | ||
| 
						 | 
					541ebbbb19 | ||
| 
						 | 
					d92a9ae1ae | ||
| 
						 | 
					47749dde7b | ||
| 
						 | 
					78a8c2bdce | ||
| 
						 | 
					2c54e43e37 | ||
| 
						 | 
					fba3b99b54 | ||
| 
						 | 
					489d95f23f | ||
| 
						 | 
					5d01dafeb3 | 
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							@@ -1,3 +1,18 @@
 | 
			
		||||
# rewrite-overallブランチへようこそ🎃
 | 
			
		||||
 | 
			
		||||
このブランチはコードを最初から全部読み直して書き直そうという途方もなく壮大なプロジェクトです。
 | 
			
		||||
 | 
			
		||||
1周目では、
 | 
			
		||||
 | 
			
		||||
* 脱jQuery
 | 
			
		||||
* 脱onclick
 | 
			
		||||
* 脱コールバック地獄
 | 
			
		||||
* 重複してるやつや使ってないやつを消す
 | 
			
		||||
 | 
			
		||||
という極めて当たり前のやつをやっていきます。
 | 
			
		||||
 | 
			
		||||
# 以下いつものREADME
 | 
			
		||||
 | 
			
		||||
<img src="https://thedesk.top/img/top.png" width="300" align="left">
 | 
			
		||||
<img src="https://thedesk.top/img/desk.png" width="150" align="right">
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -605,4 +605,4 @@ textarea {
 | 
			
		||||
.linux .win,
 | 
			
		||||
.darwin .win {
 | 
			
		||||
	display: none;
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
//@ts-check
 | 
			
		||||
//このソフトについて
 | 
			
		||||
function about() {
 | 
			
		||||
	postMessage(["sendSinmpleIpc", "about"], "*")
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
document.getElementById('onClickAbout').addEventListener('click', about)
 | 
			
		||||
							
								
								
									
										38
									
								
								app/js/common/api.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								app/js/common/api.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
async function getApi(start, at) {
 | 
			
		||||
    let json = {}
 | 
			
		||||
    let response = null
 | 
			
		||||
    response = await fetch(start, {
 | 
			
		||||
        method: 'GET',
 | 
			
		||||
        headers: {
 | 
			
		||||
            'content-type': 'application/json',
 | 
			
		||||
            'Authorization': `Bearer ${at}`
 | 
			
		||||
        }
 | 
			
		||||
    })
 | 
			
		||||
    if (!response.ok) {
 | 
			
		||||
        response.text().then(function (text) {
 | 
			
		||||
            setLog(response.url, response.status, text)
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
    json = await response.json()
 | 
			
		||||
    return json
 | 
			
		||||
}
 | 
			
		||||
async function postApi(url, body, at, ideKey) {
 | 
			
		||||
    let json = {}
 | 
			
		||||
    let response = null
 | 
			
		||||
    response = await fetch(url, {
 | 
			
		||||
        method: 'POST',
 | 
			
		||||
        headers: {
 | 
			
		||||
            'content-type': 'application/json',
 | 
			
		||||
            'Authorization': `Bearer ${at}`,
 | 
			
		||||
            'Idempotency-Key': ideKey
 | 
			
		||||
        },
 | 
			
		||||
        body: JSON.stringify(body)
 | 
			
		||||
    })
 | 
			
		||||
    if (!response.ok) {
 | 
			
		||||
        response.text().then(function (text) {
 | 
			
		||||
            setLog(response.url, response.status, text)
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
    json = await response.json()
 | 
			
		||||
    return json
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
var digitCharacters = [
 | 
			
		||||
const digitCharacters = [
 | 
			
		||||
    "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
 | 
			
		||||
    "A", "B", "C", "D", "E", "F", "G", "H", "I", "J",
 | 
			
		||||
    "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
 | 
			
		||||
@@ -10,16 +10,16 @@ var digitCharacters = [
 | 
			
		||||
    "|", "}", "~",
 | 
			
		||||
];
 | 
			
		||||
function decode83(str) {
 | 
			
		||||
    var value = 0;
 | 
			
		||||
    for (var i = 0; i < str.length; i++) {
 | 
			
		||||
        var c = str[i];
 | 
			
		||||
        var digit = digitCharacters.indexOf(c);
 | 
			
		||||
    let value = 0;
 | 
			
		||||
    for (let i = 0; i < str.length; i++) {
 | 
			
		||||
        const c = str[i];
 | 
			
		||||
        const digit = digitCharacters.indexOf(c);
 | 
			
		||||
        value = value * 83 + digit;
 | 
			
		||||
    }
 | 
			
		||||
    return value;
 | 
			
		||||
}
 | 
			
		||||
function linearTosRGB(value) {
 | 
			
		||||
    var v = Math.max(0, Math.min(1, value));
 | 
			
		||||
    const v = Math.max(0, Math.min(1, value));
 | 
			
		||||
    if (v <= 0.0031308) {
 | 
			
		||||
        return Math.round(v * 12.92 * 255 + 0.5);
 | 
			
		||||
    }
 | 
			
		||||
@@ -28,7 +28,7 @@ function linearTosRGB(value) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
function sRGBToLinear(value) {
 | 
			
		||||
    var v = value / 255;
 | 
			
		||||
    const v = value / 255;
 | 
			
		||||
    if (v <= 0.04045) {
 | 
			
		||||
        return v / 12.92;
 | 
			
		||||
    }
 | 
			
		||||
@@ -37,18 +37,18 @@ function sRGBToLinear(value) {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
function decodeDC(value) {
 | 
			
		||||
    var intR = value >> 16;
 | 
			
		||||
    var intG = (value >> 8) & 255;
 | 
			
		||||
    var intB = value & 255;
 | 
			
		||||
    const intR = value >> 16;
 | 
			
		||||
    const intG = (value >> 8) & 255;
 | 
			
		||||
    const intB = value & 255;
 | 
			
		||||
    return [sRGBToLinear(intR), sRGBToLinear(intG), sRGBToLinear(intB)];
 | 
			
		||||
};
 | 
			
		||||
function sign(n) { return (n < 0 ? -1 : 1); }
 | 
			
		||||
function signPow(val, exp) { return sign(val) * Math.pow(Math.abs(val), exp); }
 | 
			
		||||
function decodeDC2(value, maximumValue) {
 | 
			
		||||
    var quantR = Math.floor(value / (19 * 19));
 | 
			
		||||
    var quantG = Math.floor(value / 19) % 19;
 | 
			
		||||
    var quantB = value % 19;
 | 
			
		||||
    var rgb = [
 | 
			
		||||
    const quantR = Math.floor(value / (19 * 19));
 | 
			
		||||
    const quantG = Math.floor(value / 19) % 19;
 | 
			
		||||
    const quantB = value % 19;
 | 
			
		||||
    const rgb = [
 | 
			
		||||
        signPow((quantR - 9) / 9, 2.0) * maximumValue,
 | 
			
		||||
        signPow((quantG - 9) / 9, 2.0) * maximumValue,
 | 
			
		||||
        signPow((quantB - 9) / 9, 2.0) * maximumValue,
 | 
			
		||||
@@ -61,45 +61,45 @@ function decodeblur(blurhash, width, height, punch) {
 | 
			
		||||
        console.error('too short blurhash');
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
    var sizeFlag = decode83(blurhash[0]);
 | 
			
		||||
    var numY = Math.floor(sizeFlag / 9) + 1;
 | 
			
		||||
    var numX = (sizeFlag % 9) + 1;
 | 
			
		||||
    var quantisedMaximumValue = decode83(blurhash[1]);
 | 
			
		||||
    var maximumValue = (quantisedMaximumValue + 1) / 166;
 | 
			
		||||
    const sizeFlag = decode83(blurhash[0]);
 | 
			
		||||
    const numY = Math.floor(sizeFlag / 9) + 1;
 | 
			
		||||
    const numX = (sizeFlag % 9) + 1;
 | 
			
		||||
    const quantisedMaximumValue = decode83(blurhash[1]);
 | 
			
		||||
    const maximumValue = (quantisedMaximumValue + 1) / 166;
 | 
			
		||||
    if (blurhash.length !== 4 + 2 * numX * numY) {
 | 
			
		||||
        console.error('blurhash length mismatch', blurhash.length, 4 + 2 * numX * numY);
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
    var colors = new Array(numX * numY);
 | 
			
		||||
    for (var i = 0; i < colors.length; i++) {
 | 
			
		||||
    let colors = new Array(numX * numY);
 | 
			
		||||
    for (let i = 0; i < colors.length; i++) {
 | 
			
		||||
        if (i === 0) {
 | 
			
		||||
            var value = decode83(blurhash.substring(2, 6));
 | 
			
		||||
            const value = decode83(blurhash.substring(2, 6));
 | 
			
		||||
            colors[i] = decodeDC(value);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            var value = decode83(blurhash.substring(4 + i * 2, 6 + i * 2));
 | 
			
		||||
            const value = decode83(blurhash.substring(4 + i * 2, 6 + i * 2));
 | 
			
		||||
            colors[i] = decodeDC2(value, maximumValue * punch);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    var bytesPerRow = width * 4;
 | 
			
		||||
    var pixels = new Uint8ClampedArray(bytesPerRow * height);
 | 
			
		||||
    const bytesPerRow = width * 4;
 | 
			
		||||
    let pixels = new Uint8ClampedArray(bytesPerRow * height);
 | 
			
		||||
    for (var y = 0; y < height; y++) {
 | 
			
		||||
        for (var x = 0; x < width; x++) {
 | 
			
		||||
            var r = 0;
 | 
			
		||||
            var g = 0;
 | 
			
		||||
            var b = 0;
 | 
			
		||||
            for (var j = 0; j < numY; j++) {
 | 
			
		||||
                for (var i = 0; i < numX; i++) {
 | 
			
		||||
                    var basis = Math.cos(Math.PI * x * i / width) * Math.cos(Math.PI * y * j / height);
 | 
			
		||||
                    var color = colors[i + j * numX];
 | 
			
		||||
            for (let j = 0; j < numY; j++) {
 | 
			
		||||
                for (let i = 0; i < numX; i++) {
 | 
			
		||||
                    let basis = Math.cos(Math.PI * x * i / width) * Math.cos(Math.PI * y * j / height);
 | 
			
		||||
                    let color = colors[i + j * numX];
 | 
			
		||||
                    r += color[0] * basis;
 | 
			
		||||
                    g += color[1] * basis;
 | 
			
		||||
                    b += color[2] * basis;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            var intR = linearTosRGB(r);
 | 
			
		||||
            var intG = linearTosRGB(g);
 | 
			
		||||
            var intB = linearTosRGB(b);
 | 
			
		||||
            const intR = linearTosRGB(r);
 | 
			
		||||
            const intG = linearTosRGB(g);
 | 
			
		||||
            const intB = linearTosRGB(b);
 | 
			
		||||
            pixels[4 * x + 0 + y * bytesPerRow] = intR;
 | 
			
		||||
            pixels[4 * x + 1 + y * bytesPerRow] = intG;
 | 
			
		||||
            pixels[4 * x + 2 + y * bytesPerRow] = intB;
 | 
			
		||||
@@ -109,9 +109,9 @@ function decodeblur(blurhash, width, height, punch) {
 | 
			
		||||
    return pixels;
 | 
			
		||||
}
 | 
			
		||||
function parseBlur(blur) {
 | 
			
		||||
    var canvas = document.getElementById('canvas');
 | 
			
		||||
    var ctx = canvas.getContext('2d');
 | 
			
		||||
    var pixels = decodeblur(blur, 32, 32)
 | 
			
		||||
    const canvas = document.getElementById('canvas');
 | 
			
		||||
    const ctx = canvas.getContext('2d');
 | 
			
		||||
    const pixels = decodeblur(blur, 32, 32)
 | 
			
		||||
    const imageData = new ImageData(pixels, 32, 32);
 | 
			
		||||
 | 
			
		||||
    ctx.putImageData(imageData, 0, 0);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,26 +1,19 @@
 | 
			
		||||
selectedColumn = 0
 | 
			
		||||
selectedToot = 0
 | 
			
		||||
$(function($) {
 | 
			
		||||
let selectedColumn = 0
 | 
			
		||||
let selectedToot = 0
 | 
			
		||||
$(function ($) {
 | 
			
		||||
	//キーボードショートカット
 | 
			
		||||
	$(window).keydown(function(e) {
 | 
			
		||||
		var hasFocus = $('input').is(':focus')
 | 
			
		||||
		var hasFocus2 = $('textarea').is(':focus')
 | 
			
		||||
		if (document.getElementById('webview')) {
 | 
			
		||||
			if ($('#webviewsel:checked').val()) {
 | 
			
		||||
				var wv = false
 | 
			
		||||
			} else {
 | 
			
		||||
				var wv = true
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			var wv = true
 | 
			
		||||
		}
 | 
			
		||||
	$(window).keydown(function (e) {
 | 
			
		||||
		const hasFocus = isFocused('input')
 | 
			
		||||
		const hasFocus2 = isFocused('textarea')
 | 
			
		||||
		const postBox = document.querySelector('#textarea')
 | 
			
		||||
		let wv = false
 | 
			
		||||
		//Enter
 | 
			
		||||
		if (e.keyCode === 13) {
 | 
			
		||||
			if ($('#src').is(':focus')) {
 | 
			
		||||
			if (isFocused('#src')) {
 | 
			
		||||
				src()
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			if ($('#list-add').is(':focus')) {
 | 
			
		||||
			if (isFocused('#list-add')) {
 | 
			
		||||
				makeNewList()
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
@@ -92,7 +85,7 @@ $(function($) {
 | 
			
		||||
			}
 | 
			
		||||
			//X:開閉
 | 
			
		||||
			if (e.keyCode === 88) {
 | 
			
		||||
				if (!$('#post-box').hasClass('appear')) {
 | 
			
		||||
				if (!document.querySelector('#post-box').classList.contains('appear')) {
 | 
			
		||||
					show()
 | 
			
		||||
					$('textarea').focus()
 | 
			
		||||
				} else {
 | 
			
		||||
@@ -102,10 +95,10 @@ $(function($) {
 | 
			
		||||
			}
 | 
			
		||||
			//N:新トゥート
 | 
			
		||||
			if (e.keyCode === 78) {
 | 
			
		||||
				if (!$('#post-box').hasClass('appear')) {
 | 
			
		||||
				if (!document.querySelector('#post-box').classList.contains('appear')) {
 | 
			
		||||
					show()
 | 
			
		||||
				}
 | 
			
		||||
				$('textarea').focus()
 | 
			
		||||
				postBox.focus()
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			//Ctrl+E:全ての通知未読を既読にする
 | 
			
		||||
@@ -153,7 +146,7 @@ $(function($) {
 | 
			
		||||
			//数字:TL
 | 
			
		||||
			if (event.metaKey || event.ctrlKey) {
 | 
			
		||||
				if (e.keyCode >= 49 && e.keyCode <= 57) {
 | 
			
		||||
					var kz = e.keyCode - 49
 | 
			
		||||
					const kz = e.keyCode - 49
 | 
			
		||||
					goColumn(kz)
 | 
			
		||||
					return false
 | 
			
		||||
				}
 | 
			
		||||
@@ -161,7 +154,7 @@ $(function($) {
 | 
			
		||||
			//矢印:選択
 | 
			
		||||
			if (e.code == 'ArrowLeft') {
 | 
			
		||||
				//left
 | 
			
		||||
				if ($('#imagemodal').hasClass('open')) {
 | 
			
		||||
				if (document.querySelector('#imagemodal').classList.contains('open')) {
 | 
			
		||||
					imgCont('prev')
 | 
			
		||||
					return false
 | 
			
		||||
				}
 | 
			
		||||
@@ -172,7 +165,7 @@ $(function($) {
 | 
			
		||||
				return false
 | 
			
		||||
			} else if (e.code == 'ArrowUp') {
 | 
			
		||||
				//up
 | 
			
		||||
				if ($('#imagemodal').hasClass('open')) {
 | 
			
		||||
				if (document.querySelector('#imagemodal').classList.contains('open')) {
 | 
			
		||||
					return false
 | 
			
		||||
				}
 | 
			
		||||
				if (selectedToot > 0) {
 | 
			
		||||
@@ -182,7 +175,7 @@ $(function($) {
 | 
			
		||||
				return false
 | 
			
		||||
			} else if (e.code == 'ArrowRight') {
 | 
			
		||||
				//right
 | 
			
		||||
				if ($('#imagemodal').hasClass('open')) {
 | 
			
		||||
				if (document.querySelector('#imagemodal').classList.contains('open')) {
 | 
			
		||||
					imgCont('next')
 | 
			
		||||
					return false
 | 
			
		||||
				}
 | 
			
		||||
@@ -193,7 +186,7 @@ $(function($) {
 | 
			
		||||
				return false
 | 
			
		||||
			} else if (e.code == 'ArrowDown') {
 | 
			
		||||
				//down
 | 
			
		||||
				if ($('#imagemodal').hasClass('open')) {
 | 
			
		||||
				if (document.querySelector('#imagemodal').classList.contains('open')) {
 | 
			
		||||
					return false
 | 
			
		||||
				}
 | 
			
		||||
				selectedToot++
 | 
			
		||||
@@ -210,24 +203,21 @@ $(function($) {
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			//選択時
 | 
			
		||||
			const selectedId = document.querySelector('.selectedToot').getAttribute('unique-id')
 | 
			
		||||
			const selectedAcctIds = document.querySelector(`#timeline_${selectedColumn}`).getAttribute('data-acct')
 | 
			
		||||
			if (e.keyCode == 70) {
 | 
			
		||||
				var id = $('.selectedToot').attr('unique-id')
 | 
			
		||||
				var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
 | 
			
		||||
				fav(id, acct_id, false)
 | 
			
		||||
				fav(selectedId, selectedAcctIds, false)
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			if (e.keyCode == 66) {
 | 
			
		||||
				var id = $('.selectedToot').attr('unique-id')
 | 
			
		||||
				var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
 | 
			
		||||
				rt(id, acct_id, false)
 | 
			
		||||
				rt(selectedId, selectedAcctIds, false)
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
			if (e.keyCode == 82) {
 | 
			
		||||
				var id = $('.selectedToot').attr('unique-id')
 | 
			
		||||
				var acct_id = $('#timeline_' + selectedColumn).attr('data-acct')
 | 
			
		||||
				var ats_cm = $('.selectedToot .rep-btn').attr('data-men')
 | 
			
		||||
				var mode = $('.selectedToot .rep-btn').attr('data-visen')
 | 
			
		||||
				re(id, ats_cm, acct_id, mode)
 | 
			
		||||
				const target = document.querySelector('.selectedToot .rep-btn')
 | 
			
		||||
				const ats_cm = target.getAttribute('data-men')
 | 
			
		||||
				const mode = target.getAttribute('data-visen')
 | 
			
		||||
				re(selectedId, ats_cm, selectedAcctIds, mode)
 | 
			
		||||
				return false
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -237,9 +227,10 @@ $(function($) {
 | 
			
		||||
				//C+S+(No):ワンクリ
 | 
			
		||||
				if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
 | 
			
		||||
					if (e.keyCode >= 49 && e.keyCode <= 51) {
 | 
			
		||||
						var no = e.keyCode - 48
 | 
			
		||||
						if (localStorage.getItem('oks-' + no)) {
 | 
			
		||||
							$('#textarea').val($('#textarea').val() + localStorage.getItem('oks-' + no))
 | 
			
		||||
						const no = e.keyCode - 48
 | 
			
		||||
						const oks = localStorage.getItem('oks-' + no)
 | 
			
		||||
						if (oks) {
 | 
			
		||||
							postBox.value = postBox.value + oks
 | 
			
		||||
						}
 | 
			
		||||
						return false
 | 
			
		||||
					}
 | 
			
		||||
@@ -248,28 +239,29 @@ $(function($) {
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
	//クリアボタン
 | 
			
		||||
	$('#clear').click(function() {
 | 
			
		||||
		clear()
 | 
			
		||||
	})
 | 
			
		||||
	document.getElementById('clear').addEventListener('click', clear)
 | 
			
		||||
})
 | 
			
		||||
//選択する
 | 
			
		||||
function tootSelector(column, toot) {
 | 
			
		||||
	$('.cvo').removeClass('selectedToot')
 | 
			
		||||
	$('#timeline_' + column + ' .cvo')
 | 
			
		||||
		.eq(toot)
 | 
			
		||||
		.addClass('selectedToot')
 | 
			
		||||
	var scr = $('.tl-box[tlid=' + column + ']').scrollTop()
 | 
			
		||||
	var elem = $('.selectedToot').offset().top
 | 
			
		||||
	var top = elem - $('.tl-box').height() + scr
 | 
			
		||||
	const selectedToot = document.querySelector('.selectedToot')
 | 
			
		||||
	let rect = {top: 0}
 | 
			
		||||
	if (selectedToot) {
 | 
			
		||||
		selectedToot.classList.remove('selectedToot')
 | 
			
		||||
		rect = selectedToot.getBoundingClientRect()
 | 
			
		||||
	}
 | 
			
		||||
	document.querySelectorAll(`#timeline_${column} .cvo`)[toot].classList.add('selectedToot')
 | 
			
		||||
	const scr = document.querySelector(`#tlBox${column}`).scrollTop
 | 
			
		||||
	const elem = rect.top + document.body.scrollTop
 | 
			
		||||
	let top = elem - getHeight('.tl-box') + scr
 | 
			
		||||
	if (top > 0) {
 | 
			
		||||
		top = top + $('.selectedToot').height()
 | 
			
		||||
		top = top + getHeight('.selectedToot')
 | 
			
		||||
		if (top > scr) {
 | 
			
		||||
			$('.tl-box[tlid=' + column + ']').animate({ scrollTop: top })
 | 
			
		||||
			$(`#tlBox${column}`).animate({ scrollTop: top })
 | 
			
		||||
		}
 | 
			
		||||
	} else if (elem < 0) {
 | 
			
		||||
		var to = scr + elem - $('.selectedToot').height()
 | 
			
		||||
		const to = scr + elem - getHeight('.selectedToot')
 | 
			
		||||
		if (to < scr) {
 | 
			
		||||
			$('.tl-box[tlid=' + column + ']').animate({ scrollTop: to })
 | 
			
		||||
			$(`#tlBox${column}`).animate({ scrollTop: to })
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,8 @@
 | 
			
		||||
//モーダル・ドロップダウンの各種設定
 | 
			
		||||
$(document).ready(function () {
 | 
			
		||||
  // the "href" attribute of the modal trigger must specify the modal ID that wants to be triggered
 | 
			
		||||
  $('.modal').modal({
 | 
			
		||||
  const modals = document.querySelectorAll('.modal')
 | 
			
		||||
  M.Modal.init(modals, {
 | 
			
		||||
    inDuration: 300,
 | 
			
		||||
    outDuration: 225,
 | 
			
		||||
    constrainWidth: false, // Does not change width of dropdown to that of the activator
 | 
			
		||||
@@ -10,8 +11,9 @@ $(document).ready(function () {
 | 
			
		||||
    belowOrigin: false, // Displays dropdown below the button
 | 
			
		||||
    alignment: 'left', // Displays dropdown with edge aligned to the left of button
 | 
			
		||||
    stopPropagation: false
 | 
			
		||||
  });
 | 
			
		||||
  $('.dropdown-trigger').dropdown({
 | 
			
		||||
  })
 | 
			
		||||
  const dropdown = document.querySelectorAll('.modal')
 | 
			
		||||
  M.Dropdown.init(dropdown, {
 | 
			
		||||
    inDuration: 300,
 | 
			
		||||
    outDuration: 225,
 | 
			
		||||
    constrainWidth: false, // Does not change width of dropdown to that of the activator
 | 
			
		||||
@@ -20,10 +22,10 @@ $(document).ready(function () {
 | 
			
		||||
    belowOrigin: false, // Displays dropdown below the button
 | 
			
		||||
    alignment: 'left', // Displays dropdown with edge aligned to the left of button
 | 
			
		||||
    stopPropagation: false // Stops event propagation
 | 
			
		||||
  }
 | 
			
		||||
  );
 | 
			
		||||
  $('.collapsible').collapsible();
 | 
			
		||||
  $('#videomodal').modal({
 | 
			
		||||
  })
 | 
			
		||||
  M.Collapsible.init(document.querySelectorAll('.collapsible'));
 | 
			
		||||
  const videoModal = document.querySelectorAll('#videomodal')
 | 
			
		||||
  M.Modal.init(videoModal, {
 | 
			
		||||
    onCloseEnd: stopVideo
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
@@ -1,31 +1,31 @@
 | 
			
		||||
var sha256 = function sha256(ascii) {
 | 
			
		||||
const sha256 = function sha256(ascii) {
 | 
			
		||||
	function rightRotate(value, amount) {
 | 
			
		||||
		return (value >>> amount) | (value << (32 - amount));
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	var mathPow = Math.pow;
 | 
			
		||||
	var maxWord = mathPow(2, 32);
 | 
			
		||||
	var lengthProperty = 'length'
 | 
			
		||||
	var i, j; // Used as a counter across the whole file
 | 
			
		||||
	var result = ''
 | 
			
		||||
	const mathPow = Math.pow;
 | 
			
		||||
	const maxWord = mathPow(2, 32);
 | 
			
		||||
	const lengthProperty = 'length'
 | 
			
		||||
	let i, j; // Used as a counter across the whole file
 | 
			
		||||
	let result = ''
 | 
			
		||||
 | 
			
		||||
	var words = [];
 | 
			
		||||
	var asciiBitLength = ascii[lengthProperty] * 8;
 | 
			
		||||
	let words = [];
 | 
			
		||||
	const asciiBitLength = ascii[lengthProperty] * 8;
 | 
			
		||||
 | 
			
		||||
	//* caching results is optional - remove/add slash from front of this line to toggle
 | 
			
		||||
	// Initial hash value: first 32 bits of the fractional parts of the square roots of the first 8 primes
 | 
			
		||||
	// (we actually calculate the first 64, but extra values are just ignored)
 | 
			
		||||
	var hash = sha256.h = sha256.h || [];
 | 
			
		||||
	let hash = sha256.h = sha256.h || [];
 | 
			
		||||
	// Round constants: first 32 bits of the fractional parts of the cube roots of the first 64 primes
 | 
			
		||||
	var k = sha256.k = sha256.k || [];
 | 
			
		||||
	var primeCounter = k[lengthProperty];
 | 
			
		||||
	let k = sha256.k = sha256.k || [];
 | 
			
		||||
	let primeCounter = k[lengthProperty];
 | 
			
		||||
	/*/
 | 
			
		||||
	var hash = [], k = [];
 | 
			
		||||
	var primeCounter = 0;
 | 
			
		||||
	//*/
 | 
			
		||||
 | 
			
		||||
	var isComposite = {};
 | 
			
		||||
	for (var candidate = 2; primeCounter < 64; candidate++) {
 | 
			
		||||
	let isComposite = {};
 | 
			
		||||
	for (let candidate = 2; primeCounter < 64; candidate++) {
 | 
			
		||||
		if (!isComposite[candidate]) {
 | 
			
		||||
			for (i = 0; i < 313; i += candidate) {
 | 
			
		||||
				isComposite[i] = candidate;
 | 
			
		||||
@@ -47,21 +47,21 @@ var sha256 = function sha256(ascii) {
 | 
			
		||||
 | 
			
		||||
	// process each chunk
 | 
			
		||||
	for (j = 0; j < words[lengthProperty];) {
 | 
			
		||||
		var w = words.slice(j, j += 16); // The message is expanded into 64 words as part of the iteration
 | 
			
		||||
		var oldHash = hash;
 | 
			
		||||
		let w = words.slice(j, j += 16); // The message is expanded into 64 words as part of the iteration
 | 
			
		||||
		const oldHash = hash;
 | 
			
		||||
		// This is now the undefinedworking hash", often labelled as variables a...g
 | 
			
		||||
		// (we have to truncate as well, otherwise extra entries at the end accumulate
 | 
			
		||||
		hash = hash.slice(0, 8);
 | 
			
		||||
 | 
			
		||||
		for (i = 0; i < 64; i++) {
 | 
			
		||||
			var i2 = i + j;
 | 
			
		||||
			const i2 = i + j;
 | 
			
		||||
			// Expand the message into 64 words
 | 
			
		||||
			// Used below if 
 | 
			
		||||
			var w15 = w[i - 15], w2 = w[i - 2];
 | 
			
		||||
			const w15 = w[i - 15], w2 = w[i - 2];
 | 
			
		||||
 | 
			
		||||
			// Iterate
 | 
			
		||||
			var a = hash[0], e = hash[4];
 | 
			
		||||
			var temp1 = hash[7]
 | 
			
		||||
			const a = hash[0], e = hash[4];
 | 
			
		||||
			const temp1 = hash[7]
 | 
			
		||||
				+ (rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25)) // S1
 | 
			
		||||
				+ ((e & hash[5]) ^ ((~e) & hash[6])) // ch
 | 
			
		||||
				+ k[i]
 | 
			
		||||
@@ -74,7 +74,7 @@ var sha256 = function sha256(ascii) {
 | 
			
		||||
				) | 0
 | 
			
		||||
				);
 | 
			
		||||
			// This is only used once, so *could* be moved below, but it only saves 4 bytes and makes things unreadble
 | 
			
		||||
			var temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)) // S0
 | 
			
		||||
			const temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)) // S0
 | 
			
		||||
				+ ((a & hash[1]) ^ (a & hash[2]) ^ (hash[1] & hash[2])); // maj
 | 
			
		||||
 | 
			
		||||
			hash = [(temp1 + temp2) | 0].concat(hash); // We don't bother trimming off the extra ones, they're harmless as long as we're truncating when we do the slice()
 | 
			
		||||
@@ -88,7 +88,7 @@ var sha256 = function sha256(ascii) {
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < 8; i++) {
 | 
			
		||||
		for (j = 3; j + 1; j--) {
 | 
			
		||||
			var b = (hash[i] >> (j * 8)) & 255;
 | 
			
		||||
			const b = (hash[i] >> (j * 8)) & 255;
 | 
			
		||||
			result += ((b < 16) ? 0 : '') + b.toString(16);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
      return inWords($.timeago.datetime(timestamp));
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  var $t = $.timeago;
 | 
			
		||||
  const $t = $.timeago;
 | 
			
		||||
  $.extend($.timeago, {
 | 
			
		||||
    settings: {
 | 
			
		||||
      refreshMillis: 60000,
 | 
			
		||||
@@ -72,9 +72,9 @@
 | 
			
		||||
        throw 'timeago allowPast and allowFuture settings can not both be set to false.';
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var $l = this.settings.strings;
 | 
			
		||||
      var prefix = $l.prefixAgo;
 | 
			
		||||
      var suffix = $l.suffixAgo;
 | 
			
		||||
      const $l = this.settings.strings;
 | 
			
		||||
      let prefix = $l.prefixAgo;
 | 
			
		||||
      let suffix = $l.suffixAgo;
 | 
			
		||||
      if (this.settings.allowFuture) {
 | 
			
		||||
        if (distanceMillis < 0) {
 | 
			
		||||
          prefix = $l.prefixFromNow;
 | 
			
		||||
@@ -86,19 +86,19 @@
 | 
			
		||||
        return this.settings.strings.inPast;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var seconds = Math.abs(distanceMillis) / 1000;
 | 
			
		||||
      var minutes = seconds / 60;
 | 
			
		||||
      var hours = minutes / 60;
 | 
			
		||||
      var days = hours / 24;
 | 
			
		||||
      var years = days / 365;
 | 
			
		||||
      const seconds = Math.abs(distanceMillis) / 1000;
 | 
			
		||||
      const minutes = seconds / 60;
 | 
			
		||||
      const hours = minutes / 60;
 | 
			
		||||
      const days = hours / 24;
 | 
			
		||||
      const years = days / 365;
 | 
			
		||||
 | 
			
		||||
      function substitute(stringOrFunction, number) {
 | 
			
		||||
        var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
 | 
			
		||||
        var value = ($l.numbers && $l.numbers[number]) || number;
 | 
			
		||||
        const string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
 | 
			
		||||
        const value = ($l.numbers && $l.numbers[number]) || number;
 | 
			
		||||
        return string.replace(/%d/i, value);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
 | 
			
		||||
      const words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
 | 
			
		||||
        seconds < 90 && substitute($l.minute, 1) ||
 | 
			
		||||
        minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
 | 
			
		||||
        minutes < 90 && substitute($l.hour, 1) ||
 | 
			
		||||
@@ -110,13 +110,13 @@
 | 
			
		||||
        years < 1.5 && substitute($l.year, 1) ||
 | 
			
		||||
        substitute($l.years, Math.round(years));
 | 
			
		||||
 | 
			
		||||
      var separator = $l.wordSeparator || "";
 | 
			
		||||
        const separator = $l.wordSeparator || "";
 | 
			
		||||
      if ($l.wordSeparator === undefined) { separator = " "; }
 | 
			
		||||
      return $.trim([prefix, words, suffix].join(separator));
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    parse: function (iso8601) {
 | 
			
		||||
      var s = $.trim(iso8601);
 | 
			
		||||
      let s = $.trim(iso8601);
 | 
			
		||||
      s = s.replace(/\.\d+/, ""); // remove milliseconds
 | 
			
		||||
      s = s.replace(/-/, "/").replace(/-/, "/");
 | 
			
		||||
      s = s.replace(/T/, " ").replace(/Z/, " UTC");
 | 
			
		||||
@@ -125,7 +125,7 @@
 | 
			
		||||
      return new Date(s);
 | 
			
		||||
    },
 | 
			
		||||
    datetime: function (elem) {
 | 
			
		||||
      var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
 | 
			
		||||
      const iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
 | 
			
		||||
      return $t.parse(iso8601);
 | 
			
		||||
    },
 | 
			
		||||
    isTime: function (elem) {
 | 
			
		||||
@@ -137,18 +137,18 @@
 | 
			
		||||
  // functions that can be called via $(el).timeago('action')
 | 
			
		||||
  // init is default when no action is given
 | 
			
		||||
  // functions are called with context of a single element
 | 
			
		||||
  var functions = {
 | 
			
		||||
  const functions = {
 | 
			
		||||
    init: function () {
 | 
			
		||||
      functions.dispose.call(this);
 | 
			
		||||
      var refresh_el = $.proxy(refresh, this);
 | 
			
		||||
      const refresh_el = $.proxy(refresh, this);
 | 
			
		||||
      refresh_el();
 | 
			
		||||
      var $s = $t.settings;
 | 
			
		||||
      const $s = $t.settings;
 | 
			
		||||
      if ($s.refreshMillis > 0) {
 | 
			
		||||
        this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    update: function (timestamp) {
 | 
			
		||||
      var date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp);
 | 
			
		||||
      const date = (timestamp instanceof Date) ? timestamp : $t.parse(timestamp);
 | 
			
		||||
      $(this).data('timeago', { datetime: date });
 | 
			
		||||
      if ($t.settings.localeTitle) {
 | 
			
		||||
        $(this).attr("title", date.toLocaleString());
 | 
			
		||||
@@ -168,7 +168,7 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  $.fn.timeago = function (action, options) {
 | 
			
		||||
    var fn = action ? functions[action] : functions.init;
 | 
			
		||||
    const fn = action ? functions[action] : functions.init;
 | 
			
		||||
    if (!fn) {
 | 
			
		||||
      throw new Error("Unknown function name '" + action + "' for timeago");
 | 
			
		||||
    }
 | 
			
		||||
@@ -180,7 +180,7 @@
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  function refresh() {
 | 
			
		||||
    var $s = $t.settings;
 | 
			
		||||
    const $s = $t.settings;
 | 
			
		||||
 | 
			
		||||
    //check if it's still visible
 | 
			
		||||
    if ($s.autoDispose && !$.contains(document.documentElement, this)) {
 | 
			
		||||
@@ -189,7 +189,7 @@
 | 
			
		||||
      return this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var data = prepareData(this);
 | 
			
		||||
    const data = prepareData(this);
 | 
			
		||||
 | 
			
		||||
    if (!isNaN(data.datetime)) {
 | 
			
		||||
      if ($s.cutoff === 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
 | 
			
		||||
@@ -207,7 +207,7 @@
 | 
			
		||||
    element = $(element);
 | 
			
		||||
    if (!element.data("timeago")) {
 | 
			
		||||
      element.data("timeago", { datetime: $t.datetime(element) });
 | 
			
		||||
      var text = $.trim(element.text());
 | 
			
		||||
      const text = $.trim(element.text());
 | 
			
		||||
      if ($t.settings.localeTitle) {
 | 
			
		||||
        element.attr("title", element.data('timeago').datetime.toLocaleString());
 | 
			
		||||
      } else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,41 +1,15 @@
 | 
			
		||||
//バージョンチェッカー
 | 
			
		||||
function verck(ver, jp) {
 | 
			
		||||
async function verck(ver) {
 | 
			
		||||
	console.log('%c Welcome😊 ' + ver, 'color: red;font-size:200%;')
 | 
			
		||||
	$('body').addClass(localStorage.getItem('platform'))
 | 
			
		||||
	var date = new Date()
 | 
			
		||||
	var showVer = false
 | 
			
		||||
	document.querySelector('body').classList.add(localStorage.getItem('platform'))
 | 
			
		||||
	const date = new Date()
 | 
			
		||||
	let showVer = false
 | 
			
		||||
	if (localStorage.getItem('ver') != ver && localStorage.getItem('winstore')) {
 | 
			
		||||
		//ちょっと削除とリンク解析の都合上アレ(s)
 | 
			
		||||
		//対象外のアプデ:storageが20の最初まで"Usamin (18.6.5)"
 | 
			
		||||
		if (!localStorage.getItem('usamin_18_6_5_flag')) {
 | 
			
		||||
			localStorage.setItem('usamin_18_6_5_flag', true)
 | 
			
		||||
			var multi = localStorage.getItem('column')
 | 
			
		||||
			var obj = JSON.parse(multi)
 | 
			
		||||
			for (var i = 0; i < obj.length; i++) {
 | 
			
		||||
				localStorage.removeItem('card_' + i)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		//ちょっと削除とリンク解析の都合上アレ(e)
 | 
			
		||||
		showVer = true
 | 
			
		||||
		console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
 | 
			
		||||
		$(document).ready(function() {
 | 
			
		||||
			if (localStorage.getItem('winstore') && !pwa) {
 | 
			
		||||
				$('#releasenote').modal('open')
 | 
			
		||||
			}
 | 
			
		||||
			verp = ver.replace('(', '')
 | 
			
		||||
			verp = verp.replace('.', '-')
 | 
			
		||||
			verp = verp.replace('.', '-')
 | 
			
		||||
			verp = verp.replace('[', '-')
 | 
			
		||||
			verp = verp.replace(']', '')
 | 
			
		||||
			verp = verp.replace(')', '')
 | 
			
		||||
			verp = verp.replace(' ', '_')
 | 
			
		||||
			console.log('%c ' + verp, 'color: red;font-size:200%;')
 | 
			
		||||
			if (lang.language == 'ja') {
 | 
			
		||||
				$('#release-' + verp).show()
 | 
			
		||||
			} else {
 | 
			
		||||
				$('#release-en').show()
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
		if (localStorage.getItem('winstore') && !pwa) {
 | 
			
		||||
			openRN()
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	localStorage.setItem('ver', ver)
 | 
			
		||||
	if (!showVer) {
 | 
			
		||||
@@ -45,295 +19,224 @@ function verck(ver, jp) {
 | 
			
		||||
			!localStorage.getItem('showSupportMe')
 | 
			
		||||
		) {
 | 
			
		||||
			if (date.getMonth() == 11) {
 | 
			
		||||
				var yrs = date.getFullYear() + 1
 | 
			
		||||
				var nextmonth = yrs * 100 + 1
 | 
			
		||||
				yrs = date.getFullYear() + 1
 | 
			
		||||
				nextmonth = yrs * 100 + 1
 | 
			
		||||
			} else {
 | 
			
		||||
				var yrs = date.getFullYear() 
 | 
			
		||||
				var nextmonth = yrs * 100 + date.getMonth() + 2
 | 
			
		||||
				yrs = date.getFullYear()
 | 
			
		||||
				nextmonth = yrs * 100 + date.getMonth() + 2
 | 
			
		||||
			}
 | 
			
		||||
			if (lang.language != 'ja') {
 | 
			
		||||
				$('#support-btm-ja').addClass('hide')
 | 
			
		||||
				$('#support-btm-en').removeClass('hide')
 | 
			
		||||
				document.querySelector('#support-btm-ja').classList.add('hide')
 | 
			
		||||
				document.querySelector('#support-btm-en').classList.remove('hide')
 | 
			
		||||
			}
 | 
			
		||||
			localStorage.setItem('showSupportMe', nextmonth)
 | 
			
		||||
			$('#support-btm').removeClass('hide')
 | 
			
		||||
			$('#support-btm').animate(
 | 
			
		||||
			document.querySelector('#support-btm').classList.remove('hide')
 | 
			
		||||
			document.querySelector('#support-btm').animate([
 | 
			
		||||
				{
 | 
			
		||||
					bottom: '0'
 | 
			
		||||
					bottom: '-500px'
 | 
			
		||||
				},
 | 
			
		||||
				{
 | 
			
		||||
					duration: 300
 | 
			
		||||
					bottom: '0'
 | 
			
		||||
				}
 | 
			
		||||
			)
 | 
			
		||||
			], 300);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	var platform = localStorage.getItem('platform')
 | 
			
		||||
	const platform = localStorage.getItem('platform')
 | 
			
		||||
	console.log('Your platform:' + platform)
 | 
			
		||||
	if (!localStorage.getItem('winstore') && !pwa) {
 | 
			
		||||
		$('#start').css('display', 'flex')
 | 
			
		||||
		document.querySelector('#start').style.display = 'flex'
 | 
			
		||||
	}
 | 
			
		||||
	let winstore = false
 | 
			
		||||
	if (
 | 
			
		||||
		localStorage.getItem('winstore') == 'brewcask' ||
 | 
			
		||||
		localStorage.getItem('winstore') == 'snapcraft' ||
 | 
			
		||||
		localStorage.getItem('winstore') == 'winstore'
 | 
			
		||||
	) {
 | 
			
		||||
		var winstore = true
 | 
			
		||||
		winstore = true
 | 
			
		||||
	} else {
 | 
			
		||||
		var winstore = false
 | 
			
		||||
		winstore = false
 | 
			
		||||
	}
 | 
			
		||||
	var l = 5
 | 
			
		||||
	const l = 5
 | 
			
		||||
	// 生成する文字列に含める文字セット
 | 
			
		||||
	var c = 'abcdefghijklmnopqrstuvwxyz0123456789'
 | 
			
		||||
	var cl = c.length
 | 
			
		||||
	var r = ''
 | 
			
		||||
	const c = 'abcdefghijklmnopqrstuvwxyz0123456789'
 | 
			
		||||
	const cl = c.length
 | 
			
		||||
	let r = ''
 | 
			
		||||
	for (var i = 0; i < l; i++) {
 | 
			
		||||
		r += c[Math.floor(Math.random() * cl)]
 | 
			
		||||
	}
 | 
			
		||||
	var start = 'https://thedesk.top/ver.json'
 | 
			
		||||
	fetch(start, {
 | 
			
		||||
		method: 'GET'
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
					setLog(response.url, response.status, text)
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
			return response.json()
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(error) {
 | 
			
		||||
			todo(error)
 | 
			
		||||
			setLog(start, 'JSON', error)
 | 
			
		||||
			setLog(start, 'JSON', error)
 | 
			
		||||
			console.error(error)
 | 
			
		||||
		})
 | 
			
		||||
		.then(function(mess) {
 | 
			
		||||
			console.table(mess)
 | 
			
		||||
			if (mess) {
 | 
			
		||||
				//askjp_jp_ua: 2019年10月24日、mstdn.jpによるユーザーエージェントアクセス制限
 | 
			
		||||
				if (jp && mess.jp_ua && !localStorage.getItem('askjp_jp_ua')) {
 | 
			
		||||
					localStorage.setItem('askjp_jp_ua', true)
 | 
			
		||||
					$('#askjp_jp_ua').removeClass('hide')
 | 
			
		||||
				}
 | 
			
		||||
				var platform = localStorage.getItem('platform')
 | 
			
		||||
				if (platform == 'darwin') {
 | 
			
		||||
					var newest = mess.desk_mac
 | 
			
		||||
				} else {
 | 
			
		||||
					var newest = mess.desk
 | 
			
		||||
				}
 | 
			
		||||
				if (newest == ver) {
 | 
			
		||||
					todo(lang.lang_version_usever.replace('{{ver}}', mess.desk))
 | 
			
		||||
					//betaかWinstoreならアプデチェックしない
 | 
			
		||||
				} else if (ver.indexOf('beta') != -1 || winstore) {
 | 
			
		||||
				} else {
 | 
			
		||||
					localStorage.removeItem('instance')
 | 
			
		||||
					if (localStorage.getItem('new-ver-skip')) {
 | 
			
		||||
						if (localStorage.getItem('next-ver') != newest) {
 | 
			
		||||
							postMessage(['sendSinmpleIpc', 'update'], '*')
 | 
			
		||||
						} else {
 | 
			
		||||
							console.warn(lang.lang_version_skipver)
 | 
			
		||||
							todo(lang.lang_version_skipver)
 | 
			
		||||
						}
 | 
			
		||||
					} else {
 | 
			
		||||
						postMessage(['sendSinmpleIpc', 'update'], '*')
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
	if (!localStorage.getItem('last-notice-id')) {
 | 
			
		||||
		localStorage.setItem('last-notice-id', 0)
 | 
			
		||||
	const start = 'https://thedesk.top/ver.json'
 | 
			
		||||
	let mess
 | 
			
		||||
	try {
 | 
			
		||||
		mess = await getApi(start, null)
 | 
			
		||||
	} catch {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	var start = 'https://thedesk.top/notice/index.php?since_id=' + localStorage.getItem('last-notice-id')
 | 
			
		||||
	fetch(start, {
 | 
			
		||||
		method: 'GET',
 | 
			
		||||
		cors: true
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
					setLog(response.url, response.status, text)
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
			return response.json()
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(error) {
 | 
			
		||||
			todo(error)
 | 
			
		||||
			setLog(start, 'JSON', error)
 | 
			
		||||
			console.error(error)
 | 
			
		||||
		})
 | 
			
		||||
		.then(function(mess) {
 | 
			
		||||
			if (mess.length < 1) {
 | 
			
		||||
				return false
 | 
			
		||||
			} else {
 | 
			
		||||
				var last = localStorage.getItem('last-notice-id')
 | 
			
		||||
				localStorage.setItem('last-notice-id', mess[0].ID)
 | 
			
		||||
				for (i = 0; i < mess.length; i++) {
 | 
			
		||||
					var obj = mess[i]
 | 
			
		||||
					if (obj.ID * 1 <= last) {
 | 
			
		||||
						break
 | 
			
		||||
					} else {
 | 
			
		||||
						if (obj.type == 'textv2') {
 | 
			
		||||
							if (~obj.languages.indexOf(lang.language)) {
 | 
			
		||||
								var showVer = true
 | 
			
		||||
								if (obj.toot != '') {
 | 
			
		||||
									var toot =
 | 
			
		||||
										'<button class="btn-flat toast-action" onclick="detEx(\'' +
 | 
			
		||||
										obj.toot +
 | 
			
		||||
										"','main')\">Show</button>"
 | 
			
		||||
								} else {
 | 
			
		||||
									var toot = ''
 | 
			
		||||
								}
 | 
			
		||||
								if (obj.ver != '') {
 | 
			
		||||
									if (obj.ver == ver) {
 | 
			
		||||
										showVer = true
 | 
			
		||||
									} else {
 | 
			
		||||
										showVer = false
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
								if (obj.domain != '') {
 | 
			
		||||
									var multi = localStorage.getItem('multi')
 | 
			
		||||
									if (multi) {
 | 
			
		||||
										showVer = false
 | 
			
		||||
										var accts = JSON.parse(multi)
 | 
			
		||||
										Object.keys(accts).forEach(function(key) {
 | 
			
		||||
											var acct = accts[key]
 | 
			
		||||
											if (acct.domain == obj.domain) {
 | 
			
		||||
												showVer = true
 | 
			
		||||
											}
 | 
			
		||||
										})
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
								if (showVer) {
 | 
			
		||||
									M.toast({
 | 
			
		||||
										html:
 | 
			
		||||
											escapeHTML(obj.text) +
 | 
			
		||||
											toot +
 | 
			
		||||
											'<span class="sml grey-text">(スライドして消去)</span>',
 | 
			
		||||
										displayLength: 86400
 | 
			
		||||
									})
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
	console.table(mess)
 | 
			
		||||
	if (mess) {
 | 
			
		||||
		let newest = null
 | 
			
		||||
		if (platform == 'darwin') {
 | 
			
		||||
			newest = mess.desk_mac
 | 
			
		||||
		} else {
 | 
			
		||||
			newest = mess.desk
 | 
			
		||||
		}
 | 
			
		||||
		if (newest == ver) {
 | 
			
		||||
			todo(lang.lang_version_usever.replace('{{ver}}', mess.desk))
 | 
			
		||||
			//betaかWinstoreならアプデチェックしない
 | 
			
		||||
		} else if (ver.indexOf('beta') != -1 || winstore) {
 | 
			
		||||
			//skipped
 | 
			
		||||
		} else {
 | 
			
		||||
			if (localStorage.getItem('new-ver-skip')) {
 | 
			
		||||
				if (localStorage.getItem('next-ver') != newest) {
 | 
			
		||||
					postMessage(['sendSinmpleIpc', 'update'], '*')
 | 
			
		||||
				} else {
 | 
			
		||||
					console.warn(lang.lang_version_skipver)
 | 
			
		||||
					todo(lang.lang_version_skipver)
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				postMessage(['sendSinmpleIpc', 'update'], '*')
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	let lni = localStorage.getItem('last-notice-id')
 | 
			
		||||
	if (!lni) {
 | 
			
		||||
		localStorage.setItem('last-notice-id', 0)
 | 
			
		||||
		lni = 0
 | 
			
		||||
	}
 | 
			
		||||
	const getNotice = 'https://thedesk.top/notice/index.php?since_id=' + lni
 | 
			
		||||
	let notices
 | 
			
		||||
	try {
 | 
			
		||||
		notices = await getApi(getNotice, null)
 | 
			
		||||
	} catch {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	if (notices.length < 1) {
 | 
			
		||||
		return false
 | 
			
		||||
	} else {
 | 
			
		||||
		localStorage.setItem('last-notice-id', notices[0].ID)
 | 
			
		||||
		for (i = 0; i < notices.length; i++) {
 | 
			
		||||
			var obj = notices[i]
 | 
			
		||||
			if (obj.ID * 1 <= lni) {
 | 
			
		||||
				break
 | 
			
		||||
			} else {
 | 
			
		||||
				toastInterpret(obj)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
var infostreaming = false
 | 
			
		||||
let infostreaming = false
 | 
			
		||||
function infowebsocket() {
 | 
			
		||||
	infows = new WebSocket('wss://thedesk.top/ws/')
 | 
			
		||||
	infows.onopen = function(mess) {
 | 
			
		||||
	infows.onopen = function (mess) {
 | 
			
		||||
		console.log([tlid, ':Connect Streaming Info:', mess])
 | 
			
		||||
		infostreaming = true
 | 
			
		||||
	}
 | 
			
		||||
	infows.onmessage = function(mess) {
 | 
			
		||||
	infows.onmessage = function (mess) {
 | 
			
		||||
		console.log([tlid, ':Receive Streaming:', JSON.parse(mess.data)])
 | 
			
		||||
		var obj = JSON.parse(mess.data)
 | 
			
		||||
		const obj = JSON.parse(mess.data)
 | 
			
		||||
		localStorage.setItem('last-notice-id', obj.id)
 | 
			
		||||
		if (obj.type != 'counter') {
 | 
			
		||||
			if (obj.type == 'textv2') {
 | 
			
		||||
				if (~obj.languages.indexOf(lang.language)) {
 | 
			
		||||
					localStorage.setItem('last-notice-id', obj.id)
 | 
			
		||||
					var showVer = true
 | 
			
		||||
					if (obj.toot != '') {
 | 
			
		||||
						var toot =
 | 
			
		||||
							'<button class="btn-flat toast-action" onclick="detEx(\'' +
 | 
			
		||||
							obj.toot +
 | 
			
		||||
							"','main')\">Show</button>"
 | 
			
		||||
					} else {
 | 
			
		||||
						var toot = ''
 | 
			
		||||
					}
 | 
			
		||||
					if (obj.ver != '') {
 | 
			
		||||
						if (obj.ver == ver) {
 | 
			
		||||
							showVer = true
 | 
			
		||||
						} else {
 | 
			
		||||
							showVer = false
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					if (obj.domain != '') {
 | 
			
		||||
						var multi = localStorage.getItem('multi')
 | 
			
		||||
						if (multi) {
 | 
			
		||||
							showVer = false
 | 
			
		||||
							var accts = JSON.parse(multi)
 | 
			
		||||
							Object.keys(accts).forEach(function(key) {
 | 
			
		||||
								var acct = accts[key]
 | 
			
		||||
								if (acct.domain == obj.domain) {
 | 
			
		||||
									showVer = true
 | 
			
		||||
								}
 | 
			
		||||
							})
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					if (showVer) {
 | 
			
		||||
						console.log(obj.text)
 | 
			
		||||
						console.log(escapeHTML(obj.text))
 | 
			
		||||
						M.toast({
 | 
			
		||||
							html:
 | 
			
		||||
								escapeHTML(obj.text) +
 | 
			
		||||
								toot +
 | 
			
		||||
								'<span class="sml grey-text">(スライドして消去)</span>',
 | 
			
		||||
							displayLength: 86400
 | 
			
		||||
						})
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			toastInterpret(obj)
 | 
			
		||||
		} else {
 | 
			
		||||
			$('#persons').text(obj.text)
 | 
			
		||||
			const people = document.querySelector('#persons')
 | 
			
		||||
			if(people) {
 | 
			
		||||
				people.innerText = obj.text
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	infows.onerror = function(error) {
 | 
			
		||||
	infows.onerror = function (error) {
 | 
			
		||||
		infostreaming = false
 | 
			
		||||
		console.error('Error closing:info')
 | 
			
		||||
		console.error(error)
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	infows.onclose = function() {
 | 
			
		||||
	infows.onclose = function () {
 | 
			
		||||
		infostreaming = false
 | 
			
		||||
		console.error('Closing:info')
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
setInterval(function() {
 | 
			
		||||
setInterval(function () {
 | 
			
		||||
	if (!infostreaming) {
 | 
			
		||||
		console.log('try to connect to base-streaming')
 | 
			
		||||
		infowebsocket()
 | 
			
		||||
	}
 | 
			
		||||
}, 10000)
 | 
			
		||||
function openRN() {
 | 
			
		||||
	$('#releasenote').modal('open')
 | 
			
		||||
	if (lang.language == 'ja') {
 | 
			
		||||
		verp = ver.replace('(', '')
 | 
			
		||||
		verp = verp.replace('.', '-')
 | 
			
		||||
		verp = verp.replace('.', '-')
 | 
			
		||||
		verp = verp.replace('[', '-')
 | 
			
		||||
		verp = verp.replace(']', '')
 | 
			
		||||
		verp = verp.replace(')', '')
 | 
			
		||||
		verp = verp.replace(' ', '_')
 | 
			
		||||
		$('#release-' + verp).show()
 | 
			
		||||
	} else {
 | 
			
		||||
		$('#release-en').show()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
function closeSupport() {
 | 
			
		||||
	$('#support-btm').animate(
 | 
			
		||||
		{
 | 
			
		||||
			bottom: '-300px'
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			duration: 300,
 | 
			
		||||
			complete: function() {
 | 
			
		||||
				$('#support-btm').addClass('hide')
 | 
			
		||||
async function toastInterpret(obj) {
 | 
			
		||||
	if (obj.type == 'textv2') {
 | 
			
		||||
		if (~obj.languages.indexOf(lang.language)) {
 | 
			
		||||
			let showVer = true
 | 
			
		||||
			let toot = null
 | 
			
		||||
			if (obj.toot != '') {
 | 
			
		||||
				toot = `<button class="btn-flat toast-action" data-toot="${obj.toot}">Show</button>`
 | 
			
		||||
			}
 | 
			
		||||
			if (obj.ver == ver) {
 | 
			
		||||
				showVer = true
 | 
			
		||||
			} else {
 | 
			
		||||
				showVer = false
 | 
			
		||||
			}
 | 
			
		||||
			if (obj.domain != '') {
 | 
			
		||||
				const multi = localStorage.getItem('multi')
 | 
			
		||||
				if (multi) {
 | 
			
		||||
					showVer = false
 | 
			
		||||
					const accts = JSON.parse(multi)
 | 
			
		||||
					const keys = Object.keys(accts)
 | 
			
		||||
					for (let i = 0; i < accts.length; i++) {
 | 
			
		||||
						const key = keys[i]
 | 
			
		||||
						const acct = accts[key]
 | 
			
		||||
						if (acct.domain == obj.domain) {
 | 
			
		||||
							showVer = true
 | 
			
		||||
							break
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if (showVer) {
 | 
			
		||||
				M.toast({
 | 
			
		||||
					html: `${escapeHTML(obj.text)} ${toot} <span class="sml grey-text">(スライドして消去)</span>`,
 | 
			
		||||
					displayLength: 86400
 | 
			
		||||
				})
 | 
			
		||||
				await sleep(500)
 | 
			
		||||
				const targets = document.querySelectorAll('.toast-action')
 | 
			
		||||
				for (let j = 0; j < targets.length; j++) {
 | 
			
		||||
					const target = targets[j]
 | 
			
		||||
					const toot = target.getAttribute('data-toot')
 | 
			
		||||
					target.addEventListener('click', () => detEx(toot, 'main'))
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
function openRN() {
 | 
			
		||||
	console.log(kirishima)
 | 
			
		||||
	M.Modal.getInstance(document.querySelector('#releasenote')).open()
 | 
			
		||||
	if (lang.language == 'ja') {
 | 
			
		||||
		verp = ver.replace('(', '').replace('.', '-').replace('.', '-').replace('[', '-').replace(']', '').replace(')', '').replace(' ', '_')
 | 
			
		||||
		showElm(`#release-${verp}`)
 | 
			
		||||
	} else {
 | 
			
		||||
		showElm('#release-en')
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
async function closeSupport() {
 | 
			
		||||
	document.querySelector('#support-btm').animate([
 | 
			
		||||
		{
 | 
			
		||||
			bottom: '0'
 | 
			
		||||
		},
 | 
			
		||||
		{
 | 
			
		||||
			bottom: '-300px'
 | 
			
		||||
		}
 | 
			
		||||
	], 300);
 | 
			
		||||
	await sleep(300)
 | 
			
		||||
	document.querySelector('#support-btm').classList.add('hide')
 | 
			
		||||
}
 | 
			
		||||
function storeDialog(platform, ver) {
 | 
			
		||||
	if($('body').hasClass('accessibility')) return false
 | 
			
		||||
	if (document.querySelector('body').classList.contain('accessibility')) return false
 | 
			
		||||
	let mes = false
 | 
			
		||||
	if (platform == 'win32') {
 | 
			
		||||
		var mes = lang.lang_version_platform
 | 
			
		||||
		mes = lang.lang_version_platform
 | 
			
		||||
	} else if (platform == 'linux') {
 | 
			
		||||
		var mes = lang.lang_version_platform_linux
 | 
			
		||||
		mes = lang.lang_version_platform_linux
 | 
			
		||||
	} else if (platform == 'darwin') {
 | 
			
		||||
		var mes = lang.lang_version_platform_mac
 | 
			
		||||
	} else {
 | 
			
		||||
		var mes = false
 | 
			
		||||
		mes = lang.lang_version_platform_mac
 | 
			
		||||
	}
 | 
			
		||||
	if (mes) {
 | 
			
		||||
		Swal.fire({
 | 
			
		||||
@@ -354,52 +257,22 @@ function storeDialog(platform, ver) {
 | 
			
		||||
			}
 | 
			
		||||
			localStorage.setItem('ver', ver)
 | 
			
		||||
			showVer = true
 | 
			
		||||
			if(pwa) return false
 | 
			
		||||
			if (pwa) return false
 | 
			
		||||
			console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
 | 
			
		||||
			$(document).ready(function() {
 | 
			
		||||
				$('#releasenote').modal('open')
 | 
			
		||||
				verp = ver.replace('(', '')
 | 
			
		||||
				verp = verp.replace('.', '-')
 | 
			
		||||
				verp = verp.replace('.', '-')
 | 
			
		||||
				verp = verp.replace('[', '-')
 | 
			
		||||
				verp = verp.replace(']', '')
 | 
			
		||||
				verp = verp.replace(')', '')
 | 
			
		||||
				verp = verp.replace(' ', '_')
 | 
			
		||||
				console.log('%c ' + verp, 'color: red;font-size:200%;')
 | 
			
		||||
				if (lang.language == 'ja') {
 | 
			
		||||
					$('#release-' + verp).show()
 | 
			
		||||
				} else {
 | 
			
		||||
					$('#release-en').show()
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
			openRN()
 | 
			
		||||
		})
 | 
			
		||||
	} else {
 | 
			
		||||
		localStorage.setItem('ver', ver)
 | 
			
		||||
			showVer = true
 | 
			
		||||
			console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
 | 
			
		||||
			$(document).ready(function() {
 | 
			
		||||
				if(pwa) return false
 | 
			
		||||
				$('#releasenote').modal('open')
 | 
			
		||||
				verp = ver.replace('(', '')
 | 
			
		||||
				verp = verp.replace('.', '-')
 | 
			
		||||
				verp = verp.replace('.', '-')
 | 
			
		||||
				verp = verp.replace('[', '-')
 | 
			
		||||
				verp = verp.replace(']', '')
 | 
			
		||||
				verp = verp.replace(')', '')
 | 
			
		||||
				verp = verp.replace(' ', '_')
 | 
			
		||||
				console.log('%c ' + verp, 'color: red;font-size:200%;')
 | 
			
		||||
				if (lang.language == 'ja') {
 | 
			
		||||
					$('#release-' + verp).show()
 | 
			
		||||
				} else {
 | 
			
		||||
					$('#release-en').show()
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		showVer = true
 | 
			
		||||
		console.log('%c Thank you for your update🎉', 'color: red;font-size:200%;')
 | 
			
		||||
		openRN()
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
function closeStart() {
 | 
			
		||||
	$('#start').css('display', 'none')
 | 
			
		||||
	var platform = localStorage.getItem('platform')
 | 
			
		||||
	var ver = localStorage.getItem('ver')
 | 
			
		||||
	document.querySelector('#start').style.display = 'none'
 | 
			
		||||
	const platform = localStorage.getItem('platform')
 | 
			
		||||
	const ver = localStorage.getItem('ver')
 | 
			
		||||
	storeDialog(platform, ver)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
var defaultemojiList = ['activity', 'flag', 'food', 'nature', 'object', 'people', 'place', 'symbol']
 | 
			
		||||
var defaultemoji = {
 | 
			
		||||
const defaultemojiList = ['activity', 'flag', 'food', 'nature', 'object', 'people', 'place', 'symbol']
 | 
			
		||||
const defaultemoji = {
 | 
			
		||||
	activity: activity,
 | 
			
		||||
	flag: flag,
 | 
			
		||||
	food: food,
 | 
			
		||||
@@ -9,8 +9,18 @@ var defaultemoji = {
 | 
			
		||||
	place: place,
 | 
			
		||||
	symbol: symbol
 | 
			
		||||
}
 | 
			
		||||
let defaultemojiname = {
 | 
			
		||||
	activity: 'Activities',
 | 
			
		||||
	flag: 'Flags',
 | 
			
		||||
	food: 'Foods',
 | 
			
		||||
	nature: 'Nature',
 | 
			
		||||
	object: 'Tools',
 | 
			
		||||
	people: 'People',
 | 
			
		||||
	place: 'Places',
 | 
			
		||||
	symbol: 'Symbols'
 | 
			
		||||
}
 | 
			
		||||
if (lang == 'ja') {
 | 
			
		||||
	var defaultemojiname = {
 | 
			
		||||
	defaultemojiname = {
 | 
			
		||||
		activity: '活動',
 | 
			
		||||
		flag: '国旗',
 | 
			
		||||
		food: '食べ物',
 | 
			
		||||
@@ -20,33 +30,23 @@ if (lang == 'ja') {
 | 
			
		||||
		place: '場所',
 | 
			
		||||
		symbol: '記号'
 | 
			
		||||
	}
 | 
			
		||||
} else {
 | 
			
		||||
	var defaultemojiname = {
 | 
			
		||||
		activity: 'Activities',
 | 
			
		||||
		flag: 'Flags',
 | 
			
		||||
		food: 'Foods',
 | 
			
		||||
		nature: 'Nature',
 | 
			
		||||
		object: 'Tools',
 | 
			
		||||
		people: 'People',
 | 
			
		||||
		place: 'Places',
 | 
			
		||||
		symbol: 'Symbols'
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function defaultEmoji(target) {
 | 
			
		||||
    var announcement = false
 | 
			
		||||
    if ($('#media').val() == 'announcement') {
 | 
			
		||||
        announcement = true
 | 
			
		||||
    }
 | 
			
		||||
	var json = defaultemoji[target]
 | 
			
		||||
	var emojis = ''
 | 
			
		||||
	Object.keys(json).forEach(function(key) {
 | 
			
		||||
        var emoji = json[key]
 | 
			
		||||
        if (announcement) {
 | 
			
		||||
            var def = `<a onclick="emojiReactionDef('${emoji['shortcode']}')" class="pointer">`
 | 
			
		||||
        } else {
 | 
			
		||||
            var def = `<a onclick="defEmoji('${emoji['shortcode']}')" class="pointer">`
 | 
			
		||||
        }
 | 
			
		||||
	let announcement = false
 | 
			
		||||
	if (document.querySelector('#media').value == 'announcement') {
 | 
			
		||||
		announcement = true
 | 
			
		||||
	}
 | 
			
		||||
	const json = defaultemoji[target]
 | 
			
		||||
	const keymap = Object.keys(json)
 | 
			
		||||
	let emojis = ''
 | 
			
		||||
	for (let i = 0; i < json.length; i++) {
 | 
			
		||||
		const key = keymap[i]
 | 
			
		||||
		const emoji = json[key]
 | 
			
		||||
		let def = `<a data-shortcode="${emoji['shortcode']}" class="pointer defEmoji">`
 | 
			
		||||
		if (announcement) {
 | 
			
		||||
			def = `<a data-shortcode="${emoji['shortcode']}" class="pointer defEmoji">`
 | 
			
		||||
		}
 | 
			
		||||
		emojis =
 | 
			
		||||
			emojis +
 | 
			
		||||
			`${def}
 | 
			
		||||
@@ -54,52 +54,39 @@ function defaultEmoji(target) {
 | 
			
		||||
                width: 20px; height: 20px; display: inline-block; background-image: url('../../img/sheet.png'); background-size: 4900%;
 | 
			
		||||
                 background-position:${emoji['css']};"></span>
 | 
			
		||||
            </a>`
 | 
			
		||||
	})
 | 
			
		||||
	$('#emoji-list').html(emojis)
 | 
			
		||||
	$('#now-emoji').text(lang.lang_defaultemojis_text.replace('{{cat}}', defaultemojiname[target]))
 | 
			
		||||
	$('.emoji-control').addClass('hide')
 | 
			
		||||
	}
 | 
			
		||||
	document.querySelector('#emoji-list').innerHTML = emojis
 | 
			
		||||
	document.querySelector('#now-emoji').innerText = lang.lang_defaultemojis_text.replace('{{cat}}', defaultemojiname[target])
 | 
			
		||||
	document.querySelector('.emoji-control').classList.add('hide')
 | 
			
		||||
	const targets = document.querySelectorAll('.defEmoji')
 | 
			
		||||
	for (let j = 0; j < targets.length; j++) {
 | 
			
		||||
		const target = targets[j]
 | 
			
		||||
		const sc = target.getAttribute('data-shortcode')
 | 
			
		||||
		target.addEventListener('click', () => defEmoji(sc))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function customEmoji() {
 | 
			
		||||
	$('#emoji-suggest').val('')
 | 
			
		||||
	$('.emoji-control').removeClass('hide')
 | 
			
		||||
	document.querySelector('#emoji-suggest').value = ''
 | 
			
		||||
	document.querySelector('.emoji-control').classList.remove('hide')
 | 
			
		||||
	emojiList('home')
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function defEmoji(target) {
 | 
			
		||||
	var selin = $('#textarea').prop('selectionStart')
 | 
			
		||||
	const textarea = document.querySelector('#textarea')
 | 
			
		||||
	let selin = textarea.selectionStart
 | 
			
		||||
	if (!selin) {
 | 
			
		||||
		selin = 0
 | 
			
		||||
	}
 | 
			
		||||
	var emojiraw = newpack.filter(function(item, index) {
 | 
			
		||||
		if (item.short_name == target) return true
 | 
			
		||||
	})
 | 
			
		||||
	var hex = emojiraw[0].unified.split('-')
 | 
			
		||||
	const hex = emojipack[target].unified.split('-')
 | 
			
		||||
	let emoji = twemoji.convert.fromCodePoint(hex[0])
 | 
			
		||||
	if (hex.length === 2) {
 | 
			
		||||
		emoji = twemoji.convert.fromCodePoint(hex[0]) + twemoji.convert.fromCodePoint(hex[1])
 | 
			
		||||
	} else {
 | 
			
		||||
		emoji = twemoji.convert.fromCodePoint(hex[0])
 | 
			
		||||
	}
 | 
			
		||||
	var now = $('#textarea').val()
 | 
			
		||||
	var before = now.substr(0, selin)
 | 
			
		||||
	var after = now.substr(selin, now.length)
 | 
			
		||||
	newt = before + emoji + after
 | 
			
		||||
	$('#textarea').val(newt)
 | 
			
		||||
	$('#textarea').focus()
 | 
			
		||||
}
 | 
			
		||||
function faicon() {
 | 
			
		||||
	var json = faicons
 | 
			
		||||
	var emojis = ''
 | 
			
		||||
	Object.keys(json).forEach(function(key) {
 | 
			
		||||
		var emoji = json[key]
 | 
			
		||||
		var eje = emoji.replace(/fa-/g, '')
 | 
			
		||||
		emojis =
 | 
			
		||||
			emojis +
 | 
			
		||||
			'<a onclick="emojiInsert(\'[faicon]' +
 | 
			
		||||
			eje +
 | 
			
		||||
			'[/faicon]\')" class="pointer white-text" style="font-size:24px"><i class="fa ' +
 | 
			
		||||
			emoji +
 | 
			
		||||
			'"></i></a>'
 | 
			
		||||
	})
 | 
			
		||||
	$('#emoji-list').html(emojis)
 | 
			
		||||
	$('#now-emoji').text('faicon')
 | 
			
		||||
	$('.emoji-control').addClass('hide')
 | 
			
		||||
	const now = textarea.value
 | 
			
		||||
	const before = now.substr(0, selin)
 | 
			
		||||
	const after = now.substr(selin, now.length)
 | 
			
		||||
	const newt = before + emoji + after
 | 
			
		||||
	textarea.value = newt
 | 
			
		||||
	textarea.focus()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
//インスタンスリスト
 | 
			
		||||
var idata = {
 | 
			
		||||
const idata = {
 | 
			
		||||
	"kirishima.cloud": "instance",
 | 
			
		||||
	"kirishima.cloud_name": "アスタルテ",
 | 
			
		||||
	"kirishima.cloud_letters": "6229",
 | 
			
		||||
@@ -84,5 +84,3 @@ var idata = {
 | 
			
		||||
	"biwakodon.com_quote":"enabled",
 | 
			
		||||
	"comm.cx_quote":"enabled"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
localStorage.setItem("instance", JSON.stringify(idata));
 | 
			
		||||
 
 | 
			
		||||
@@ -1,617 +1,276 @@
 | 
			
		||||
/*ログイン処理・認証までのJS*/
 | 
			
		||||
//最初に読むやつ
 | 
			
		||||
//アスタルテ判定初期化
 | 
			
		||||
 | 
			
		||||
localStorage.removeItem('kirishima')
 | 
			
		||||
localStorage.removeItem('quoters')
 | 
			
		||||
localStorage.removeItem('imas')
 | 
			
		||||
localStorage.removeItem('image')
 | 
			
		||||
//stable, 固定タグのことらしい。ふざけるな。
 | 
			
		||||
localStorage.removeItem('stable')
 | 
			
		||||
localStorage.setItem('mode_misskey.xyz', 'misskey')
 | 
			
		||||
function ck() {
 | 
			
		||||
	var main = localStorage.getItem('main')
 | 
			
		||||
const acctList = JSON.parse(localStorage.getItem('multi'))
 | 
			
		||||
 | 
			
		||||
async function ck() {
 | 
			
		||||
	const main = localStorage.getItem('main')
 | 
			
		||||
	if (!main) {
 | 
			
		||||
		localStorage.setItem('main', 0)
 | 
			
		||||
		localStorage.setItem('main', '0')
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//コード受信
 | 
			
		||||
	if (location.search) {
 | 
			
		||||
		var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
 | 
			
		||||
		var mode = m[1]
 | 
			
		||||
		var codex = m[2]
 | 
			
		||||
		const m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/)
 | 
			
		||||
		const mode = m[1]
 | 
			
		||||
		const codex = m[2]
 | 
			
		||||
		if (mode == 'manager' || mode == 'login') {
 | 
			
		||||
			code(codex, mode)
 | 
			
		||||
		} else {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	var multi = localStorage.getItem('multi')
 | 
			
		||||
	const multi = localStorage.getItem('multi')
 | 
			
		||||
	if (!multi || multi == '[]') {
 | 
			
		||||
		var date = new Date()
 | 
			
		||||
		const date = new Date()
 | 
			
		||||
		localStorage.setItem('showSupportMe', date.getMonth() + 2)
 | 
			
		||||
		location.href = 'acct.html?mode=first&code=true'
 | 
			
		||||
	} else {
 | 
			
		||||
		var obj = JSON.parse(multi)
 | 
			
		||||
		var jp = false
 | 
			
		||||
		Object.keys(obj).forEach(function(key) {
 | 
			
		||||
			var acct = obj[key]
 | 
			
		||||
		const obj = JSON.parse(multi)
 | 
			
		||||
		const keymap = Object.keys(obj)
 | 
			
		||||
		let req = false
 | 
			
		||||
		for (let i = 0; i < keymap.length; i++) {
 | 
			
		||||
			const key = keymap[i]
 | 
			
		||||
			const acct = obj[key]
 | 
			
		||||
			if (acct.domain) {
 | 
			
		||||
				refresh(key, true)
 | 
			
		||||
				let refreshed = await refresh(key, true)
 | 
			
		||||
				if (refreshed) req = true
 | 
			
		||||
			}
 | 
			
		||||
			if (acct.domain == 'mstdn.jp') {
 | 
			
		||||
				jp = true
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
		}
 | 
			
		||||
		if (req) {
 | 
			
		||||
			Swal.fire({
 | 
			
		||||
				title: 'Reload required',
 | 
			
		||||
				text: lang.lang_login_changedData,
 | 
			
		||||
				type: 'info',
 | 
			
		||||
				showCancelButton: true,
 | 
			
		||||
				confirmButtonText: lang.lang_no,
 | 
			
		||||
				cancelButtonText: lang.lang_yesno
 | 
			
		||||
			}).then(result => {
 | 
			
		||||
				if (result) location.reload()
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
		if (obj[0].domain) {
 | 
			
		||||
			$('#tl').show()
 | 
			
		||||
			showElm('#tl')
 | 
			
		||||
			ticker()
 | 
			
		||||
			multiSelector(false)
 | 
			
		||||
			verck(ver, jp)
 | 
			
		||||
			$('.stw').show()
 | 
			
		||||
			if (localStorage.getItem('tips')) {
 | 
			
		||||
				tips(localStorage.getItem('tips'))
 | 
			
		||||
			parseColumn()
 | 
			
		||||
			verck(ver)
 | 
			
		||||
			showElm('.stw')
 | 
			
		||||
			const tipsType = localStorage.getItem('tips')
 | 
			
		||||
			if (tipsType) {
 | 
			
		||||
				tips(tipsType)
 | 
			
		||||
			}
 | 
			
		||||
			$('#something-wrong img').attr('src', '../../img/thinking.svg')
 | 
			
		||||
			document.querySelector('#something-wrong img').setAttribute('src', '../../img/thinking.svg')
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
ck()
 | 
			
		||||
 | 
			
		||||
//ログインポップアップ
 | 
			
		||||
function login(url) {
 | 
			
		||||
	if ($('#linux:checked').val() == 'on') {
 | 
			
		||||
		var red = 'urn:ietf:wg:oauth:2.0:oob'
 | 
			
		||||
	} else {
 | 
			
		||||
		var red = 'thedesk://login'
 | 
			
		||||
	}
 | 
			
		||||
	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)',
 | 
			
		||||
			redirect_uris: red,
 | 
			
		||||
			website: 'https://thedesk.top'
 | 
			
		||||
		})
 | 
			
		||||
	)
 | 
			
		||||
	httpreq.onreadystatechange = function() {
 | 
			
		||||
		if (httpreq.readyState === 4) {
 | 
			
		||||
			var json = httpreq.response
 | 
			
		||||
			if (this.status !== 200) {
 | 
			
		||||
				setLog(start, this.status, json)
 | 
			
		||||
			}
 | 
			
		||||
			var auth =
 | 
			
		||||
				'https://' +
 | 
			
		||||
				url +
 | 
			
		||||
				'/oauth/authorize?client_id=' +
 | 
			
		||||
				json['client_id'] +
 | 
			
		||||
				'&client_secret=' +
 | 
			
		||||
				json['client_secret'] +
 | 
			
		||||
				'&response_type=code&redirect_uri=' +
 | 
			
		||||
				red +
 | 
			
		||||
				'&scope=read+write+follow'
 | 
			
		||||
			localStorage.setItem('domain_' + acct_id, url)
 | 
			
		||||
			localStorage.setItem('client_id', json['client_id'])
 | 
			
		||||
			localStorage.setItem('client_secret', json['client_secret'])
 | 
			
		||||
			$('#auth').show()
 | 
			
		||||
			$('#masara').hide()
 | 
			
		||||
			postMessage(['openUrl', auth], '*')
 | 
			
		||||
 | 
			
		||||
			if ($('#linux:checked').val() == 'on') {
 | 
			
		||||
			} else {
 | 
			
		||||
				postMessage(['sendSinmpleIpc', 'quit'], '*')
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//テキストボックスにURL入れた
 | 
			
		||||
function instance() {
 | 
			
		||||
	var url = $('#url').val()
 | 
			
		||||
	login(url)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//コードを入れた後認証
 | 
			
		||||
function code(code, mode) {
 | 
			
		||||
	var red = localStorage.getItem('redirect')
 | 
			
		||||
	localStorage.removeItem('redirect')
 | 
			
		||||
	if (!code) {
 | 
			
		||||
		var code = $('#code').val()
 | 
			
		||||
	}
 | 
			
		||||
	if (localStorage.getItem('domain_tmp')) {
 | 
			
		||||
		var url = localStorage.getItem('domain_tmp')
 | 
			
		||||
	} else {
 | 
			
		||||
		var url = localStorage.getItem('domain_' + acct_id)
 | 
			
		||||
	}
 | 
			
		||||
	var start = 'https://' + url + '/oauth/token'
 | 
			
		||||
	var id = localStorage.getItem('client_id')
 | 
			
		||||
	var secret = localStorage.getItem('client_secret')
 | 
			
		||||
	fetch(start, {
 | 
			
		||||
		method: 'POST',
 | 
			
		||||
		headers: {
 | 
			
		||||
			'content-type': 'application/json'
 | 
			
		||||
		},
 | 
			
		||||
		body: JSON.stringify({
 | 
			
		||||
			grant_type: 'authorization_code',
 | 
			
		||||
			redirect_uri: red,
 | 
			
		||||
			client_id: id,
 | 
			
		||||
			client_secret: secret,
 | 
			
		||||
			code: code
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
					setLog(response.url, response.status, text)
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
			return response.json()
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(error) {
 | 
			
		||||
			todo(error)
 | 
			
		||||
			setLog(start, 'JSON', error)
 | 
			
		||||
			console.error(error)
 | 
			
		||||
		})
 | 
			
		||||
		.then(function(json) {
 | 
			
		||||
			todo(json)
 | 
			
		||||
			if (json['access_token']) {
 | 
			
		||||
				localStorage.setItem(url + '_at', json['access_token'])
 | 
			
		||||
				if (mode == 'manager') {
 | 
			
		||||
					getdataAdv(url, json['access_token'])
 | 
			
		||||
				} else {
 | 
			
		||||
					getdata()
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//ユーザーデータ取得(最初)
 | 
			
		||||
function getdata() {
 | 
			
		||||
	var acct_id = 0
 | 
			
		||||
	var domain = localStorage.getItem('domain_' + acct_id)
 | 
			
		||||
	var at = localStorage.getItem('acct_' + acct_id + '_at')
 | 
			
		||||
	var start = 'https://' + domain + '/api/v1/accounts/verify_credentials'
 | 
			
		||||
	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)
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
			return response.json()
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(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
 | 
			
		||||
			}
 | 
			
		||||
			var avatar = json['avatar']
 | 
			
		||||
			//missingがmissingなやつ
 | 
			
		||||
			if (avatar == '/avatars/original/missing.png') {
 | 
			
		||||
				avatar = './img/missing.svg'
 | 
			
		||||
			}
 | 
			
		||||
			var obj = [
 | 
			
		||||
				{
 | 
			
		||||
					at: at,
 | 
			
		||||
					name: json['display_name'],
 | 
			
		||||
					domain: domain,
 | 
			
		||||
					user: json['acct'],
 | 
			
		||||
					prof: avatar,
 | 
			
		||||
					id: json['id'],
 | 
			
		||||
					vis: json['source']['privacy']
 | 
			
		||||
				}
 | 
			
		||||
			]
 | 
			
		||||
			var json = JSON.stringify(obj)
 | 
			
		||||
			localStorage.setItem('multi', json)
 | 
			
		||||
			localStorage.setItem('name_' + acct_id, json['display_name'])
 | 
			
		||||
			localStorage.setItem('user_' + acct_id, json['acct'])
 | 
			
		||||
			localStorage.setItem('user-id_' + acct_id, json['id'])
 | 
			
		||||
			localStorage.setItem('prof_' + acct_id, avatar)
 | 
			
		||||
			$('#masara').hide()
 | 
			
		||||
			$('#auth').hide()
 | 
			
		||||
			$('#tl').show()
 | 
			
		||||
			parseColumn()
 | 
			
		||||
			ckdb()
 | 
			
		||||
		})
 | 
			
		||||
}
 | 
			
		||||
//ユーザーデータ取得(追加)
 | 
			
		||||
function getdataAdv(domain, at) {
 | 
			
		||||
	var start = 'https://' + domain + '/api/v1/accounts/verify_credentials'
 | 
			
		||||
	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)
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
			return response.json()
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(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
 | 
			
		||||
			}
 | 
			
		||||
			var avatar = json['avatar']
 | 
			
		||||
			//missingがmissingなやつ
 | 
			
		||||
			if (avatar == '/avatars/original/missing.png') {
 | 
			
		||||
				avatar = '../../img/missing.svg'
 | 
			
		||||
			}
 | 
			
		||||
			if (json['source']['privacy']) {
 | 
			
		||||
				var priv = json['source']['privacy']
 | 
			
		||||
			} else {
 | 
			
		||||
				var priv = 'public'
 | 
			
		||||
			}
 | 
			
		||||
			var add = {
 | 
			
		||||
				at: at,
 | 
			
		||||
				name: json['display_name'],
 | 
			
		||||
				domain: domain,
 | 
			
		||||
				user: json['acct'],
 | 
			
		||||
				prof: avatar,
 | 
			
		||||
				id: json['id'],
 | 
			
		||||
				vis: priv
 | 
			
		||||
			}
 | 
			
		||||
			var multi = localStorage.getItem('multi')
 | 
			
		||||
			var obj = JSON.parse(multi)
 | 
			
		||||
			var target = obj.lengtth
 | 
			
		||||
			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)
 | 
			
		||||
			location.href = 'index.html'
 | 
			
		||||
		})
 | 
			
		||||
}
 | 
			
		||||
//ユーザーデータ更新
 | 
			
		||||
function refresh(target, loadskip) {
 | 
			
		||||
	var multi = localStorage.getItem('multi')
 | 
			
		||||
	var obj = JSON.parse(multi)
 | 
			
		||||
	if (obj[target].mode == 'misskey') {
 | 
			
		||||
async function refresh(target, loadskip) {
 | 
			
		||||
	let obj = acctList
 | 
			
		||||
	let requireReload = false
 | 
			
		||||
	const { mode, domain, at, background, text, name, prof, vis } = obj[target]
 | 
			
		||||
	if (mode == 'misskey') {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	var start = 'https://' + obj[target].domain + '/api/v1/accounts/verify_credentials'
 | 
			
		||||
	fetch(start, {
 | 
			
		||||
		method: 'GET',
 | 
			
		||||
		headers: {
 | 
			
		||||
			'content-type': 'application/json',
 | 
			
		||||
			Authorization: 'Bearer ' + obj[target].at
 | 
			
		||||
	const start = `https://${domain}/api/v1/accounts/verify_credentials`
 | 
			
		||||
	let json
 | 
			
		||||
	try {
 | 
			
		||||
		json = await getApi(start, at)
 | 
			
		||||
	} catch {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	if (json.error) {
 | 
			
		||||
		console.error('Error:' + json.error)
 | 
			
		||||
		M.toast({ html: lang.lang_fatalerroroccured + 'Error:' + json.error, displayLength: 5000 })
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if (!json) return false
 | 
			
		||||
	let avatar = json['avatar']
 | 
			
		||||
	//missingがmissingなやつ
 | 
			
		||||
	if (avatar == '/avatars/original/missing.png' || !avatar) {
 | 
			
		||||
		avatar = './img/missing.svg'
 | 
			
		||||
	}
 | 
			
		||||
	const newName = json.display_name
 | 
			
		||||
	const newProf = avatar
 | 
			
		||||
	const newVis = json.source.privacy
 | 
			
		||||
	if (newName != name || newProf != prof || newVis != vis) {
 | 
			
		||||
		let ref = {
 | 
			
		||||
			at: at,
 | 
			
		||||
			name: newName,
 | 
			
		||||
			domain: domain,
 | 
			
		||||
			user: json['acct'],
 | 
			
		||||
			prof: avatar,
 | 
			
		||||
			id: json['id'],
 | 
			
		||||
			vis: newVis
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
					setLog(response.url, response.status, text)
 | 
			
		||||
				})
 | 
			
		||||
			}
 | 
			
		||||
			return response.json()
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(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
 | 
			
		||||
			}
 | 
			
		||||
			var avatar = json['avatar']
 | 
			
		||||
			//missingがmissingなやつ
 | 
			
		||||
			if (avatar == '/avatars/original/missing.png' || !avatar) {
 | 
			
		||||
				avatar = './img/missing.svg'
 | 
			
		||||
			}
 | 
			
		||||
			var ref = {
 | 
			
		||||
				at: obj[target].at,
 | 
			
		||||
				name: json['display_name'],
 | 
			
		||||
				domain: obj[target].domain,
 | 
			
		||||
				user: json['acct'],
 | 
			
		||||
				prof: avatar,
 | 
			
		||||
				id: json['id'],
 | 
			
		||||
				vis: json['source']['privacy']
 | 
			
		||||
			}
 | 
			
		||||
			if (obj[target].background) {
 | 
			
		||||
				ref.background = obj[target].background
 | 
			
		||||
			}
 | 
			
		||||
			if (obj[target].text) {
 | 
			
		||||
				ref.text = obj[target].text
 | 
			
		||||
			}
 | 
			
		||||
			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)
 | 
			
		||||
			localStorage.setItem('follow_' + target, json['following_count'])
 | 
			
		||||
			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)
 | 
			
		||||
			if (!loadskip) {
 | 
			
		||||
				load()
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
		if (background) {
 | 
			
		||||
			ref.background = background
 | 
			
		||||
		}
 | 
			
		||||
		if (text) {
 | 
			
		||||
			ref.text = text
 | 
			
		||||
		}
 | 
			
		||||
		if (json['source']['sensitive']) {
 | 
			
		||||
			localStorage.setItem('nsfw_' + target, true)
 | 
			
		||||
		} else {
 | 
			
		||||
			localStorage.removeItem('nsfw_' + target)
 | 
			
		||||
		}
 | 
			
		||||
		obj[target] = ref
 | 
			
		||||
		const save = JSON.stringify(obj)
 | 
			
		||||
		localStorage.setItem('multi', save)
 | 
			
		||||
		requireReload = true
 | 
			
		||||
	}
 | 
			
		||||
	if (!loadskip) {
 | 
			
		||||
		load()
 | 
			
		||||
	} else {
 | 
			
		||||
		return requireReload
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
//MarkdownやBBCodeの対応、文字数制限をチェック
 | 
			
		||||
//絶対ストリーミングを閉じさせないマン
 | 
			
		||||
function ckdb(acct_id) {
 | 
			
		||||
	var domain = localStorage.getItem('domain_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('home_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('bb_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('md_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('local_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('public_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('notification_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('post_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('fav_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('bt_' + acct_id)
 | 
			
		||||
	localStorage.removeItem('followlocale_' + acct_id)
 | 
			
		||||
async function ckdb(acct_id) {
 | 
			
		||||
	const domain = localStorage.getItem(`domain_${acct_id}`)
 | 
			
		||||
	if (domain == 'kirishima.cloud') {
 | 
			
		||||
		localStorage.setItem('kirishima', 'true')
 | 
			
		||||
		localStorage.setItem('kirishima', true)
 | 
			
		||||
	} else if (domain == 'imastodon.net') {
 | 
			
		||||
		localStorage.setItem('imas', 'true')
 | 
			
		||||
		$('.imasonly').show()
 | 
			
		||||
		localStorage.setItem('imas', true)
 | 
			
		||||
		showElm('.imasonly')
 | 
			
		||||
	}
 | 
			
		||||
	var at = localStorage.getItem('acct_' + acct_id + '_at')
 | 
			
		||||
	var bbcode = domain + '_bbcode'
 | 
			
		||||
	var letters = domain + '_letters'
 | 
			
		||||
	var quoteMarker = domain + '_quote'
 | 
			
		||||
	if (localStorage.getItem('instance')) {
 | 
			
		||||
		var json = JSON.parse(localStorage.getItem('instance'))
 | 
			
		||||
		if (json[quoteMarker] == 'enabled') {
 | 
			
		||||
			localStorage.setItem('quoters', 'true')
 | 
			
		||||
			localStorage.setItem('quote_' + acct_id, 'true')
 | 
			
		||||
		}
 | 
			
		||||
		if (json[bbcode]) {
 | 
			
		||||
			if (json[bbcode] == 'enabled') {
 | 
			
		||||
				localStorage.setItem('bb_' + acct_id, 'true')
 | 
			
		||||
			} else {
 | 
			
		||||
				localStorage.removeItem('bb_' + acct_id)
 | 
			
		||||
				$("[data-activates='bbcode']").addClass('disabled')
 | 
			
		||||
				$("[data-activates='bbcode']").prop('disabled', true)
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			localStorage.removeItem('bb_' + acct_id)
 | 
			
		||||
			$("[data-activates='bbcode']").addClass('disabled')
 | 
			
		||||
			$("[data-activates='bbcode']").addClass('disabled', true)
 | 
			
		||||
		}
 | 
			
		||||
	const at = localStorage.getItem(`acct_${acct_id}_at`)
 | 
			
		||||
	const letters = `${domain}_letters`
 | 
			
		||||
	const quoteMarker = `${domain}_quote`
 | 
			
		||||
 | 
			
		||||
		if (json[domain + '_markdown'] == 'enabled') {
 | 
			
		||||
			localStorage.setItem('md_' + acct_id, 'true')
 | 
			
		||||
			$('.markdown').show()
 | 
			
		||||
		} else {
 | 
			
		||||
			$('.anti-markdown').hide()
 | 
			
		||||
			$('.markdown').hide()
 | 
			
		||||
			localStorage.removeItem('bb_' + acct_id)
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_home']) {
 | 
			
		||||
			localStorage.setItem('home_' + acct_id, json[domain + '_home'])
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_local']) {
 | 
			
		||||
			localStorage.setItem('local_' + acct_id, json[domain + '_local'])
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_public']) {
 | 
			
		||||
			localStorage.setItem('public_' + acct_id, json[domain + '_public'])
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_notification']) {
 | 
			
		||||
			localStorage.setItem('notification_' + acct_id, json[domain + '_notification'])
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_post']) {
 | 
			
		||||
			localStorage.setItem('post_' + acct_id, json[domain + '_post'])
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_fav']) {
 | 
			
		||||
			localStorage.setItem('fav_' + acct_id, json[domain + '_fav'])
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_bt']) {
 | 
			
		||||
			localStorage.setItem('bt_' + acct_id, json[domain + '_bt'])
 | 
			
		||||
		}
 | 
			
		||||
		if (json[domain + '_follow']) {
 | 
			
		||||
			localStorage.setItem('followlocale_' + acct_id, json[domain + '_follow'])
 | 
			
		||||
	if (idata) {
 | 
			
		||||
		//check and replace json to idata
 | 
			
		||||
		const json = idata
 | 
			
		||||
		if (json[quoteMarker] == 'enabled') {
 | 
			
		||||
			localStorage.setItem('quoters', true)
 | 
			
		||||
			localStorage.setItem(quoteMarker, true)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (localStorage.getItem('mode_' + domain) != 'misskey') {
 | 
			
		||||
		var start = 'https://' + domain + '/api/v1/instance'
 | 
			
		||||
		fetch(start, {
 | 
			
		||||
			method: 'GET',
 | 
			
		||||
			headers: {
 | 
			
		||||
				'content-type': 'application/json'
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
			.then(function(response) {
 | 
			
		||||
				return response.json()
 | 
			
		||||
			})
 | 
			
		||||
			.catch(function(error) {
 | 
			
		||||
				console.error(error)
 | 
			
		||||
			})
 | 
			
		||||
			.then(function(json) {
 | 
			
		||||
				if (json.error) {
 | 
			
		||||
					console.error(json.error)
 | 
			
		||||
					return
 | 
			
		||||
				}
 | 
			
		||||
				if (json) {
 | 
			
		||||
					if (json['max_toot_chars']) {
 | 
			
		||||
						localStorage.setItem('letters_' + acct_id, json['max_toot_chars'])
 | 
			
		||||
					}
 | 
			
		||||
					if (json['urls']['streaming_api']) {
 | 
			
		||||
						localStorage.setItem('streaming_' + acct_id, json['urls']['streaming_api'])
 | 
			
		||||
					} else {
 | 
			
		||||
						localStorage.removeItem('streaming_' + acct_id)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
	} else {
 | 
			
		||||
	if (!isMisskey(domain)) {
 | 
			
		||||
		const start = `https://${domain}/api/v1/instance`
 | 
			
		||||
		let json
 | 
			
		||||
		try {
 | 
			
		||||
			json = await getApi(start, null)
 | 
			
		||||
		} catch {
 | 
			
		||||
			return null
 | 
			
		||||
		}
 | 
			
		||||
		if (!json || json.error) {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		const mtc = json['max_toot_chars']
 | 
			
		||||
		if (mtc) {
 | 
			
		||||
			localStorage.setItem(letters, mtc)
 | 
			
		||||
		}
 | 
			
		||||
		if (json['feature_quote']) {
 | 
			
		||||
			localStorage.setItem(quoteMarker, true)
 | 
			
		||||
		}
 | 
			
		||||
		const str = json['urls']['streaming_api']
 | 
			
		||||
		if (str) {
 | 
			
		||||
			localStorage.setItem(`streaming_${domain}`, str)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//アカウントを選択…を実装
 | 
			
		||||
function multiSelector(parseC) {
 | 
			
		||||
	var multi = localStorage.getItem('multi')
 | 
			
		||||
	if (!multi) {
 | 
			
		||||
		var obj = []
 | 
			
		||||
		var json = JSON.stringify(obj)
 | 
			
		||||
		localStorage.setItem('multi', json)
 | 
			
		||||
	} else {
 | 
			
		||||
		var obj = JSON.parse(multi)
 | 
			
		||||
	}
 | 
			
		||||
	var templete
 | 
			
		||||
function multiSelector() {
 | 
			
		||||
	let obj = acctList
 | 
			
		||||
	//if (!obj) obj = JSON.parse(localStorage.getItem('multi'))
 | 
			
		||||
	let template = ''
 | 
			
		||||
	//StringなのはlocalStorageがStringしか返さないから
 | 
			
		||||
	let lastUsed = '0'
 | 
			
		||||
	if (localStorage.getItem('mainuse') == 'main') {
 | 
			
		||||
		var last = localStorage.getItem('main')
 | 
			
		||||
		lastUsed = localStorage.getItem('main')
 | 
			
		||||
	} else if (localStorage.getItem('last-use')) {
 | 
			
		||||
		var last = localStorage.getItem('last-use')
 | 
			
		||||
		if (last == 'webview' || last == 'noauth') {
 | 
			
		||||
			last = '0'
 | 
			
		||||
		lastUsed = localStorage.getItem('last-use')
 | 
			
		||||
		if (lastUsed == 'webview' || lastUsed == 'noauth') {
 | 
			
		||||
			lastUsed = '0'
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		var last = '0'
 | 
			
		||||
		lastUsed = '0'
 | 
			
		||||
	}
 | 
			
		||||
	last = last + ''
 | 
			
		||||
	var sel
 | 
			
		||||
	let sel
 | 
			
		||||
	if (obj.length < 1) {
 | 
			
		||||
		$('#src-acct-sel').html('<option value="tootsearch">Tootsearch</option>')
 | 
			
		||||
		$('#add-acct-sel').html('<option value="noauth">' + lang.lang_login_noauth + '</option>')
 | 
			
		||||
		document.querySelector('#src-acct-sel').innerHTML = '<option value="tootsearch">Tootsearch</option>'
 | 
			
		||||
		document.querySelector('#add-acct-sel').innerHTML = `<option value="noauth">${lang.lang_login_noauth}</option>`
 | 
			
		||||
	} else {
 | 
			
		||||
		Object.keys(obj).forEach(function(key) {
 | 
			
		||||
			var acct = obj[key]
 | 
			
		||||
			var list = key * 1 + 1
 | 
			
		||||
			if (key + '' === last) {
 | 
			
		||||
		for (let i = 0; i < obj.length; i++) {
 | 
			
		||||
			const acct = obj[i]
 | 
			
		||||
			const strKey = i.toString()
 | 
			
		||||
			if (strKey == lastUsed) {
 | 
			
		||||
				sel = 'selected'
 | 
			
		||||
				var domain = acct.domain
 | 
			
		||||
				localStorage.setItem('domain_' + key, domain)
 | 
			
		||||
				if (idata[domain + '_letters']) {
 | 
			
		||||
					$('#textarea').attr('data-length', idata[domain + '_letters'])
 | 
			
		||||
				const domain = acct.domain
 | 
			
		||||
				const letters = idata[`${domain}_letters`]
 | 
			
		||||
				const textarea = document.querySelector('#textarea')
 | 
			
		||||
				if (letters) {
 | 
			
		||||
					textarea.setAttribute('data-length', letters)
 | 
			
		||||
				} else {
 | 
			
		||||
					var maxletters = localStorage.getItem('letters_' + key)
 | 
			
		||||
					if (maxletters > 0) {
 | 
			
		||||
						$('#textarea').attr('data-length', maxletters)
 | 
			
		||||
					//手動でアカマネで変えれちゃうから
 | 
			
		||||
					const maxLetters = localStorage.getItem(`${domain}_letters`)
 | 
			
		||||
					if (maxLetters > 0) {
 | 
			
		||||
						textarea.setAttribute('data-length', maxLetters)
 | 
			
		||||
					} else {
 | 
			
		||||
						$('#textarea').attr('data-length', 500)
 | 
			
		||||
						textarea.setAttribute('data-length', 500)
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				if (idata[domain + '_glitch']) {
 | 
			
		||||
					$('#local-button').removeClass('hide')
 | 
			
		||||
				if (idata[`${domain}_glitch`]) {
 | 
			
		||||
					document.querySelector('#local-button').classList.remove('hide')
 | 
			
		||||
				}
 | 
			
		||||
				var profimg = acct.prof
 | 
			
		||||
				//localStorage.setItem("prof_" + key, profimg);
 | 
			
		||||
				let profimg = acct.prof
 | 
			
		||||
				if (!profimg) {
 | 
			
		||||
					profimg = '../../img/missing.svg'
 | 
			
		||||
				}
 | 
			
		||||
				$('#acct-sel-prof').attr('src', profimg)
 | 
			
		||||
				document.querySelector('#acct-sel-prof').setAttribute('src', profimg)
 | 
			
		||||
				let cc = ''
 | 
			
		||||
				if (domain) {
 | 
			
		||||
					var cc = '(' + domain + ')'
 | 
			
		||||
				} else {
 | 
			
		||||
					var cc = ''
 | 
			
		||||
					cc = `(${domain})`
 | 
			
		||||
				}
 | 
			
		||||
				$('#toot-post-btn').text(lang.lang_toot + cc)
 | 
			
		||||
				const tpb = document.querySelector('#toot-post-btn')
 | 
			
		||||
				tpb.innerText = lang.lang_toot + cc
 | 
			
		||||
				if (acct.background && acct.background != 'def' && acct.text && acct.text != 'def') {
 | 
			
		||||
					$('#toot-post-btn').removeClass('indigo')
 | 
			
		||||
					$('#toot-post-btn').css('background-color', '#' + acct.background)
 | 
			
		||||
					$('#toot-post-btn').css('color', acct.text)
 | 
			
		||||
				} else {
 | 
			
		||||
				}
 | 
			
		||||
				if (domain == 'kirishima.cloud') {
 | 
			
		||||
					$('#faicon-btn').show()
 | 
			
		||||
				} else {
 | 
			
		||||
					$('#faicon-btn').hide()
 | 
			
		||||
					tpb.classList.remove('indigo')
 | 
			
		||||
					tpb.style.backgroundColor = `#${acct.background}`
 | 
			
		||||
					tpb.style.color = `#${acct.text}`
 | 
			
		||||
				}
 | 
			
		||||
				if (domain == 'imastodon.net') {
 | 
			
		||||
					trendTag()
 | 
			
		||||
				} else {
 | 
			
		||||
					$('#trendtag').html('')
 | 
			
		||||
					if (document.querySelector('#trendtag')) document.querySelector('#trendtag').innerHTML = ''
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				sel = ''
 | 
			
		||||
			}
 | 
			
		||||
			templete =
 | 
			
		||||
				'<option value="' +
 | 
			
		||||
				key +
 | 
			
		||||
				'" data-icon="' +
 | 
			
		||||
				acct.prof +
 | 
			
		||||
				'" class="left circle" ' +
 | 
			
		||||
				sel +
 | 
			
		||||
				'>' +
 | 
			
		||||
				acct.user +
 | 
			
		||||
				'@' +
 | 
			
		||||
				acct.domain +
 | 
			
		||||
				'</option>'
 | 
			
		||||
			$('.acct-sel').append(templete)
 | 
			
		||||
		})
 | 
			
		||||
		$('#src-acct-sel').append('<option value="tootsearch">Tootsearch</option>')
 | 
			
		||||
		$('#add-acct-sel').append(
 | 
			
		||||
			'<option value="noauth">' +
 | 
			
		||||
				lang.lang_login_noauth +
 | 
			
		||||
				'</option><option value="webview">Twitter</option>'
 | 
			
		||||
		)
 | 
			
		||||
		$('#dir-acct-sel').append('<option value="noauth">' + lang.lang_login_noauth + '</option>')
 | 
			
		||||
			template = template + `
 | 
			
		||||
			<option value="${strKey}" data-icon="${acct.prof}" class="left circle" ${sel}>@${acct.user}@${acct.domain}
 | 
			
		||||
			</option>
 | 
			
		||||
			`
 | 
			
		||||
		}
 | 
			
		||||
		const forSrc = template + '<option value="tootsearch">Tootsearch</option>'
 | 
			
		||||
		const forAdd = template + `
 | 
			
		||||
			<option value="noauth">${lang.lang_login_noauth}</option>
 | 
			
		||||
			<option value="webview">Twitter</option>
 | 
			
		||||
		`
 | 
			
		||||
		const forDir = template + `<option value="noauth">${lang.lang_login_noauth}</option>`
 | 
			
		||||
		document.querySelector('#post-acct-sel').innerHTML = template
 | 
			
		||||
		document.querySelector('#list-acct-sel').innerHTML = template
 | 
			
		||||
		document.querySelector('#filter-acct-sel').innerHTML = template
 | 
			
		||||
		document.querySelector('#src-acct-sel').innerHTML = forSrc
 | 
			
		||||
		document.querySelector('#add-acct-sel').innerHTML = forAdd
 | 
			
		||||
		document.querySelector('#dir-acct-sel').innerHTML = forDir
 | 
			
		||||
	}
 | 
			
		||||
	$('select').formSelect()
 | 
			
		||||
	if (!parseC) {
 | 
			
		||||
		parseColumn(null, true)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//バージョンエンコ
 | 
			
		||||
function enc(ver) {
 | 
			
		||||
	var ver = ver.replace(/\s/g, '')
 | 
			
		||||
	var ver = ver.replace(/\(/g, '-')
 | 
			
		||||
	var ver = ver.replace(/\)/g, '')
 | 
			
		||||
	var ver = ver.replace(/\[/g, '_')
 | 
			
		||||
	var ver = ver.replace(/\]/g, '')
 | 
			
		||||
	return ver
 | 
			
		||||
	const elems = document.querySelectorAll('select')
 | 
			
		||||
	M.FormSelect.init(elems, null)
 | 
			
		||||
}
 | 
			
		||||
//インスタンスティッカー
 | 
			
		||||
function ticker() {
 | 
			
		||||
	var start = 'https://toot.app/toot/index.php'
 | 
			
		||||
	fetch(start, {
 | 
			
		||||
		method: 'GET',
 | 
			
		||||
		cors: true,
 | 
			
		||||
		headers: {
 | 
			
		||||
			'content-type': 'application/json'
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
		.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) {
 | 
			
		||||
			if (json) {
 | 
			
		||||
				localStorage.setItem('ticker', JSON.stringify(json))
 | 
			
		||||
			}
 | 
			
		||||
		})
 | 
			
		||||
async function ticker() {
 | 
			
		||||
	const start = 'https://toot-app.thedesk.top/toot/index.php'
 | 
			
		||||
	const json = await getApi(start, null)
 | 
			
		||||
	if (json) localStorage.setItem('ticker', JSON.stringify(json))
 | 
			
		||||
}
 | 
			
		||||
function isMisskey(domain) {
 | 
			
		||||
	return localStorage.getItem(`mode_${domain}`) == 'misskey'
 | 
			
		||||
}
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
//ログアウトします
 | 
			
		||||
function logout() {
 | 
			
		||||
	localStorage.removeItem("acct_" + acct_id + "_at");
 | 
			
		||||
	localStorage.removeItem("domain_" + acct_id);
 | 
			
		||||
	location.href = "index.html";
 | 
			
		||||
	todc();
 | 
			
		||||
}
 | 
			
		||||
	localStorage.removeItem(`acct_${acct_id}_at`)
 | 
			
		||||
	localStorage.removeItem(`domain_${acct_id}`)
 | 
			
		||||
	location.href = 'index.html'
 | 
			
		||||
	todc()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,11 +1,11 @@
 | 
			
		||||
$.strip_tags = function(str, allowed) {
 | 
			
		||||
$.strip_tags = function (str, allowed) {
 | 
			
		||||
	if (!str) {
 | 
			
		||||
		return ''
 | 
			
		||||
	}
 | 
			
		||||
	allowed = (((allowed || '') + '').toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join('')
 | 
			
		||||
	var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>?/gi,
 | 
			
		||||
		commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi
 | 
			
		||||
	return str.replace(commentsAndPhpTags, '').replace(tags, function($0, $1) {
 | 
			
		||||
	return str.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
 | 
			
		||||
		return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
@@ -13,12 +13,7 @@ function escapeHTML(str) {
 | 
			
		||||
	if (!str) {
 | 
			
		||||
		return ''
 | 
			
		||||
	}
 | 
			
		||||
	return str
 | 
			
		||||
		.replace(/&/g, '&')
 | 
			
		||||
		.replace(/</g, '<')
 | 
			
		||||
		.replace(/>/g, '>')
 | 
			
		||||
		.replace(/"/g, '"')
 | 
			
		||||
		.replace(/'/g, ''')
 | 
			
		||||
	return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, ''')
 | 
			
		||||
}
 | 
			
		||||
//PHPのnl2brと同様
 | 
			
		||||
function nl2br(str) {
 | 
			
		||||
@@ -88,17 +83,18 @@ function formattimeutc(date) {
 | 
			
		||||
}
 | 
			
		||||
postMessage(['sendSinmpleIpc', 'custom-css-request'], '*')
 | 
			
		||||
function makeCID() {
 | 
			
		||||
	return (
 | 
			
		||||
		randomStr(8) +
 | 
			
		||||
		'-' +
 | 
			
		||||
		randomStr(4) +
 | 
			
		||||
		'-' +
 | 
			
		||||
		randomStr(4) +
 | 
			
		||||
		'-' +
 | 
			
		||||
		randomStr(4) +
 | 
			
		||||
		'-' +
 | 
			
		||||
		randomStr(12)
 | 
			
		||||
	)
 | 
			
		||||
	let chars = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.split('')
 | 
			
		||||
	for (let i = 0, len = chars.length; i < len; i++) {
 | 
			
		||||
		switch (chars[i]) {
 | 
			
		||||
			case 'x':
 | 
			
		||||
				chars[i] = Math.floor(Math.random() * 16).toString(16)
 | 
			
		||||
				break
 | 
			
		||||
			case 'y':
 | 
			
		||||
				chars[i] = (Math.floor(Math.random() * 4) + 8).toString(16)
 | 
			
		||||
				break
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return chars.join('')
 | 
			
		||||
}
 | 
			
		||||
function randomStr(l) {
 | 
			
		||||
	// 生成する文字列に含める文字セット
 | 
			
		||||
@@ -129,7 +125,7 @@ function rgbToHex(color) {
 | 
			
		||||
			// RGBからHEXへ変換
 | 
			
		||||
			parseInt(regex[1]).toString(16),
 | 
			
		||||
			parseInt(regex[2]).toString(16),
 | 
			
		||||
			parseInt(regex[3]).toString(16)
 | 
			
		||||
			parseInt(regex[3]).toString(16),
 | 
			
		||||
		]
 | 
			
		||||
 | 
			
		||||
		for (var i = 0; i < rgb.length; ++i) {
 | 
			
		||||
@@ -147,15 +143,15 @@ function rgbToHex(color) {
 | 
			
		||||
	console.error(color + ':第1引数はRGB形式で入力')
 | 
			
		||||
}
 | 
			
		||||
/*マルチバイト用切り出し*/
 | 
			
		||||
$.isSurrogatePear = function(upper, lower) {
 | 
			
		||||
$.isSurrogatePear = function (upper, lower) {
 | 
			
		||||
	return 0xd800 <= upper && upper <= 0xdbff && 0xdc00 <= lower && lower <= 0xdfff
 | 
			
		||||
}
 | 
			
		||||
$.mb_strlen = function(str) {
 | 
			
		||||
$.mb_strlen = function (str) {
 | 
			
		||||
	var splitter = new GraphemeSplitter()
 | 
			
		||||
	var arr = splitter.splitGraphemes(str)
 | 
			
		||||
	return arr.length
 | 
			
		||||
}
 | 
			
		||||
$.mb_substr = function(str, begin, end) {
 | 
			
		||||
$.mb_substr = function (str, begin, end) {
 | 
			
		||||
	//配列にする
 | 
			
		||||
	var splitter = new GraphemeSplitter()
 | 
			
		||||
	var arr = splitter.splitGraphemes(str)
 | 
			
		||||
@@ -175,7 +171,7 @@ function object_array_sort(data, key, order, fn) {
 | 
			
		||||
		num_a = 1
 | 
			
		||||
		num_b = -1
 | 
			
		||||
	}
 | 
			
		||||
	data = data.sort(function(a, b) {
 | 
			
		||||
	data = data.sort(function (a, b) {
 | 
			
		||||
		var x = a[key]
 | 
			
		||||
		var y = b[key]
 | 
			
		||||
		if (x > y) return num_a
 | 
			
		||||
@@ -252,7 +248,7 @@ function statusModel(now) {
 | 
			
		||||
		reblog: null,
 | 
			
		||||
		application: {
 | 
			
		||||
			name: null,
 | 
			
		||||
			website: null
 | 
			
		||||
			website: null,
 | 
			
		||||
		},
 | 
			
		||||
		account: {
 | 
			
		||||
			id: '',
 | 
			
		||||
@@ -273,12 +269,53 @@ function statusModel(now) {
 | 
			
		||||
			statuses_count: 0,
 | 
			
		||||
			last_status_at: now,
 | 
			
		||||
			emojis: [],
 | 
			
		||||
			fields: []
 | 
			
		||||
			fields: [],
 | 
			
		||||
		},
 | 
			
		||||
		media_attachments: [],
 | 
			
		||||
		mentions: [],
 | 
			
		||||
		tags: [],
 | 
			
		||||
		card: null,
 | 
			
		||||
		poll: null
 | 
			
		||||
		poll: null,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function isFocused(query) {
 | 
			
		||||
	const allTarget = document.querySelectorAll(query)
 | 
			
		||||
	const active = document.activeElement
 | 
			
		||||
	let is = false
 | 
			
		||||
	for (let i = 0; i < allTarget.length; i++) {
 | 
			
		||||
		if (allTarget[i] == active) {
 | 
			
		||||
			is = true
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return is
 | 
			
		||||
}
 | 
			
		||||
function getHeight(query) {
 | 
			
		||||
	const elm = document.querySelector(query)
 | 
			
		||||
	return parseFloat(getComputedStyle(elm, null).height.replace('px', ''))
 | 
			
		||||
}
 | 
			
		||||
function showElm(query) {
 | 
			
		||||
	const allTarget = document.querySelectorAll(query)
 | 
			
		||||
	for (let i = 0; i < allTarget.length; i++) {
 | 
			
		||||
		const target = allTarget[i]
 | 
			
		||||
		target.style.display = 'inherit'
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
function setAllClasses(query, className, action) {
 | 
			
		||||
	const allTarget = document.querySelectorAll(query)
 | 
			
		||||
	for (let i = 0; i < allTarget.length; i++) {
 | 
			
		||||
		const target = allTarget[i]
 | 
			
		||||
		if (action == 'add') target.classList.add(className)
 | 
			
		||||
		if (action == 'remove') target.classList.remove(className)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
function appendPrepend(query, elm, action) {
 | 
			
		||||
	const allTarget = document.querySelectorAll(query)
 | 
			
		||||
	for (let i = 0; i < allTarget.length; i++) {
 | 
			
		||||
		const target = allTarget[i]
 | 
			
		||||
		if (action == 'prepend') target.insertBefore(elm, target.firstChild)
 | 
			
		||||
		if (action == 'append') target.appendChild(document.createTextNode(elm))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
const sleep = (msec) => new Promise((resolve) => setTimeout(resolve, msec))
 | 
			
		||||
 
 | 
			
		||||
@@ -2,11 +2,12 @@
 | 
			
		||||
//アカウント変えた時にBBとかMDとか
 | 
			
		||||
function mdCheck() {
 | 
			
		||||
	var acct_id = $('#post-acct-sel').val()
 | 
			
		||||
	var profimg = localStorage.getItem('prof_' + acct_id)
 | 
			
		||||
	/*var profimg = localStorage.getItem('prof_' + acct_id)
 | 
			
		||||
	if (!profimg) {
 | 
			
		||||
		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) +
 | 
			
		||||
@@ -50,7 +51,7 @@ function mdCheck() {
 | 
			
		||||
	if (idata[domain + '_letters']) {
 | 
			
		||||
		$('#textarea').attr('data-length', idata[domain + '_letters'])
 | 
			
		||||
	} else {
 | 
			
		||||
		var maxletters = localStorage.getItem('letters_' + acct_id)
 | 
			
		||||
		var maxletters = localStorage.getItem(domain + 'letters_')
 | 
			
		||||
		if (maxletters > 0) {
 | 
			
		||||
			$('#textarea').attr('data-length', maxletters)
 | 
			
		||||
		} else {
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,6 @@ async function media(b64, type, no, stamped) {
 | 
			
		||||
	}
 | 
			
		||||
	$('.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()
 | 
			
		||||
@@ -159,7 +158,6 @@ async function media(b64, type, no, stamped) {
 | 
			
		||||
				M.toast({ html: '<span>' + lang.lang_postimg_sync + '</span><button class="btn-flat toast-action" onclick="syncDetail()">Click</button>', displayLength: 3000 })
 | 
			
		||||
				$('#imgup').text('')
 | 
			
		||||
				$('#imgsel').show()
 | 
			
		||||
				localStorage.removeItem('image')
 | 
			
		||||
			} 
 | 
			
		||||
		} catch {
 | 
			
		||||
			var start = 'https://' + domain + '/api/v1/media'
 | 
			
		||||
 
 | 
			
		||||
@@ -342,7 +342,6 @@ function clear() {
 | 
			
		||||
	$('.mastodon-choice').map(function() {
 | 
			
		||||
		$(this).val('')
 | 
			
		||||
	})
 | 
			
		||||
	localStorage.removeItem('image')
 | 
			
		||||
	if (localStorage.getItem('mainuse') == 'main') {
 | 
			
		||||
		$('#post-acct-sel').val(localStorage.getItem('main'))
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,6 @@ function parseColumn(target, dontclose) {
 | 
			
		||||
	var multi = localStorage.getItem('multi')
 | 
			
		||||
	if (multi) {
 | 
			
		||||
		var obj = JSON.parse(multi)
 | 
			
		||||
 | 
			
		||||
		var templete
 | 
			
		||||
		Object.keys(obj).forEach(function (key) {
 | 
			
		||||
			var acct = obj[key]
 | 
			
		||||
@@ -102,6 +101,7 @@ function parseColumn(target, dontclose) {
 | 
			
		||||
			$('.box, .boxIn').resizable('destroy')
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	console.log(obj)
 | 
			
		||||
	var basekey = 0
 | 
			
		||||
	for (var key = 0; key < obj.length; key++) {
 | 
			
		||||
		var next = key + 1
 | 
			
		||||
@@ -444,7 +444,7 @@ function parseColumn(target, dontclose) {
 | 
			
		||||
					<br>
 | 
			
		||||
					<div id="picker_${key}" class="color-picker"></div>
 | 
			
		||||
				</div>${if_tag}
 | 
			
		||||
				<div class="tl-box" tlid="${key}">
 | 
			
		||||
				<div class="tl-box" tlid="${key}" id="tlBox${key}">
 | 
			
		||||
					<div id="timeline_${key}" class="tl ${acct.type}-timeline " tlid="${key}" 
 | 
			
		||||
						data-type="${acct.type}" data-acct="${acct.domain}" data-const="${acct.type}_${acct.domain}">
 | 
			
		||||
						<div id="landing_${key}" style="text-align:center">
 | 
			
		||||
@@ -508,6 +508,8 @@ function parseColumn(target, dontclose) {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	console.log('multiSelector')
 | 
			
		||||
	multiSelector()
 | 
			
		||||
	$('.box, .boxIn').resizable({
 | 
			
		||||
		minHeight: 50,
 | 
			
		||||
		minWidth: 50,
 | 
			
		||||
@@ -804,7 +806,7 @@ function webviewParse(url, key, insert, icnsert, css) {
 | 
			
		||||
				<br>
 | 
			
		||||
				<div id="picker_${key}" class="color-picker"></div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="tl-box" tlid="${key}" style="width:100%;height:100%;">
 | 
			
		||||
			<div class="tl-box" tlid="${key}" style="width:100%;height:100%;" id="tlBox${key}">
 | 
			
		||||
				<div id="timeline_${key}" class="tl" tlid="${key}" data-type="webview" style="width:100%;height:100%;">
 | 
			
		||||
					<webview src="${url}" style="width:100%;height:100%;" id="webview" preload="./js/platform/twitter.js"></webview>
 | 
			
		||||
				</div>
 | 
			
		||||
@@ -866,7 +868,7 @@ function unstreamingTL(type, key, basekey, insert, icnsert, left_fold, css, anim
 | 
			
		||||
			${lang.lang_layout_headercolor}<br>
 | 
			
		||||
			<div id="picker_${key}" class="color-picker"></div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="tl-box" tlid="${key}">
 | 
			
		||||
		<div class="tl-box" tlid="${key}" id="tlBox${key}">
 | 
			
		||||
			<div id="timeline_${key}" class="tl ${type}-timeline" tlid="${key}" data-type="${type}" data-acct="${data}">
 | 
			
		||||
				<div id="landing_${key}" style="text-align:center">
 | 
			
		||||
					${lang.lang_layout_nodata}
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,6 @@ function mini() {
 | 
			
		||||
function show() {
 | 
			
		||||
	$('#post-box').addClass('appear')
 | 
			
		||||
	$('#textarea').focus()
 | 
			
		||||
	console.log('show' + localStorage.getItem('postbox-left'))
 | 
			
		||||
	var left = localStorage.getItem('postbox-left')
 | 
			
		||||
	if (left > $('body').width() - $('#post-box').width()) {
 | 
			
		||||
		left = $('body').width() - $('#post-box').width()
 | 
			
		||||
@@ -55,10 +54,12 @@ function show() {
 | 
			
		||||
	}
 | 
			
		||||
	$('#post-box').fadeIn()
 | 
			
		||||
	$('#textarea').characterCounter()
 | 
			
		||||
	
 | 
			
		||||
	mdCheck()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$(function () {
 | 
			
		||||
	
 | 
			
		||||
	$('#post-box').draggable({
 | 
			
		||||
		handle: '#post-bar',
 | 
			
		||||
		stop: function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -157,7 +157,7 @@ function spotifytips() {
 | 
			
		||||
				setLog(start, 'JSON', error)
 | 
			
		||||
				console.error(error)
 | 
			
		||||
			})
 | 
			
		||||
			.then(function(json) {
 | 
			
		||||
			.then(async function(json) {
 | 
			
		||||
				var ms = json.progress_ms
 | 
			
		||||
				if(!ms) {
 | 
			
		||||
					tips('ver')
 | 
			
		||||
@@ -175,7 +175,7 @@ function spotifytips() {
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				artisttxt = escapeHTML(artisttxt)
 | 
			
		||||
				sleep(last)
 | 
			
		||||
				await sleep(last)
 | 
			
		||||
				var tms = item.duration_ms
 | 
			
		||||
				var per = (ms / item.duration_ms) * 100
 | 
			
		||||
				ms = ms / 1000
 | 
			
		||||
@@ -251,10 +251,10 @@ function trendTagonTipInterval() {
 | 
			
		||||
}
 | 
			
		||||
//時計
 | 
			
		||||
var clockint
 | 
			
		||||
function clock() {
 | 
			
		||||
async function clock() {
 | 
			
		||||
	var now = new Date()
 | 
			
		||||
	var last = 1000 - (now.getTime() % 1000)
 | 
			
		||||
	sleep(last)
 | 
			
		||||
	await sleep(last)
 | 
			
		||||
	clockint = setInterval(clockStart, 1000)
 | 
			
		||||
}
 | 
			
		||||
function clockStart() {
 | 
			
		||||
@@ -286,10 +286,6 @@ function clockStart() {
 | 
			
		||||
		'</span>'
 | 
			
		||||
	$('#tips-text').html(msg)
 | 
			
		||||
}
 | 
			
		||||
function sleep(waitMsec) {
 | 
			
		||||
	var startMsec = new Date()
 | 
			
		||||
	while (new Date() - startMsec < waitMsec);
 | 
			
		||||
}
 | 
			
		||||
function tipsToggle() {
 | 
			
		||||
	$('#tips').toggleClass('hide')
 | 
			
		||||
	$('#tips-menu').toggleClass('hide')
 | 
			
		||||
 
 | 
			
		||||
@@ -1,65 +1,68 @@
 | 
			
		||||
//プロフ編集
 | 
			
		||||
//文字系
 | 
			
		||||
function profedit() {
 | 
			
		||||
	var acct_id = $('#his-data').attr("use-acct");
 | 
			
		||||
	todo("Updating...");
 | 
			
		||||
	var domain = localStorage.getItem("domain_" + acct_id);
 | 
			
		||||
	var at = localStorage.getItem("acct_" + acct_id + "_at");
 | 
			
		||||
	var start = "https://" + domain + "/api/v1/accounts/update_credentials";
 | 
			
		||||
	var name = $("#his-name-val").val();
 | 
			
		||||
	var des = $("#his-des-val").val();
 | 
			
		||||
	var httpreq = new XMLHttpRequest();
 | 
			
		||||
	httpreq.open('PATCH', start, true);
 | 
			
		||||
	httpreq.setRequestHeader('Content-Type', 'application/json');
 | 
			
		||||
	httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
 | 
			
		||||
	httpreq.responseType = "json";
 | 
			
		||||
	httpreq.send(JSON.stringify({
 | 
			
		||||
		display_name: name,
 | 
			
		||||
		note: des,
 | 
			
		||||
	}));
 | 
			
		||||
	var acct_id = $('#his-data').attr('use-acct')
 | 
			
		||||
	todo('Updating...')
 | 
			
		||||
	var domain = localStorage.getItem('domain_' + acct_id)
 | 
			
		||||
	var at = localStorage.getItem('acct_' + acct_id + '_at')
 | 
			
		||||
	var start = 'https://' + domain + '/api/v1/accounts/update_credentials'
 | 
			
		||||
	var name = $('#his-name-val').val()
 | 
			
		||||
	var des = $('#his-des-val').val()
 | 
			
		||||
	var httpreq = new XMLHttpRequest()
 | 
			
		||||
	httpreq.open('PATCH', start, true)
 | 
			
		||||
	httpreq.setRequestHeader('Content-Type', 'application/json')
 | 
			
		||||
	httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
 | 
			
		||||
	httpreq.responseType = 'json'
 | 
			
		||||
	httpreq.send(
 | 
			
		||||
		JSON.stringify({
 | 
			
		||||
			display_name: name,
 | 
			
		||||
			note: des,
 | 
			
		||||
		})
 | 
			
		||||
	)
 | 
			
		||||
	httpreq.onreadystatechange = function () {
 | 
			
		||||
		if (httpreq.readyState === 4) {
 | 
			
		||||
			$('#his-data').modal('close');
 | 
			
		||||
			todc();
 | 
			
		||||
			$('#his-data').modal('close')
 | 
			
		||||
			todc()
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//画像系
 | 
			
		||||
function imgChange(imgfile, target) {
 | 
			
		||||
	var acct_id = $('#his-data').attr("use-acct");
 | 
			
		||||
	todo("アップロードしています")
 | 
			
		||||
	var acct_id = $('#his-data').attr('use-acct')
 | 
			
		||||
	todo('アップロードしています')
 | 
			
		||||
	if (!imgfile.files.length) {
 | 
			
		||||
		console.warn("No Image to upload");
 | 
			
		||||
		return;
 | 
			
		||||
		console.warn('No Image to upload')
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	var file = imgfile.files[0];
 | 
			
		||||
	var fr = new FileReader();
 | 
			
		||||
	var file = imgfile.files[0]
 | 
			
		||||
	var fr = new FileReader()
 | 
			
		||||
	fr.onload = function (evt) {
 | 
			
		||||
		var b64 = this.result;
 | 
			
		||||
		var blob = toBlob(b64, 'image/png');
 | 
			
		||||
		var fd = new FormData();
 | 
			
		||||
		fd.append(target, blob);
 | 
			
		||||
		var domain = localStorage.getItem("domain_" + acct_id);
 | 
			
		||||
		var at = localStorage.getItem("acct_" + acct_id + "_at");
 | 
			
		||||
		var start = "https://" + domain + "/api/v1/accounts/update_credentials";
 | 
			
		||||
		var httpreq = new XMLHttpRequest();
 | 
			
		||||
		httpreq.open('PATCH', start, true);
 | 
			
		||||
		httpreq.upload.addEventListener("progress", progshow, false);
 | 
			
		||||
		httpreq.setRequestHeader('Authorization', 'Bearer ' + at);
 | 
			
		||||
		httpreq.responseType = "json";
 | 
			
		||||
		httpreq.send(fd);
 | 
			
		||||
		var b64 = this.result
 | 
			
		||||
		var blob = toBlob(b64, 'image/png')
 | 
			
		||||
		var fd = new FormData()
 | 
			
		||||
		fd.append(target, blob)
 | 
			
		||||
		var domain = localStorage.getItem('domain_' + acct_id)
 | 
			
		||||
		var at = localStorage.getItem('acct_' + acct_id + '_at')
 | 
			
		||||
		var start = 'https://' + domain + '/api/v1/accounts/update_credentials'
 | 
			
		||||
		var httpreq = new XMLHttpRequest()
 | 
			
		||||
		httpreq.open('PATCH', start, true)
 | 
			
		||||
		httpreq.upload.addEventListener('progress', progshow, false)
 | 
			
		||||
		httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
 | 
			
		||||
		httpreq.responseType = 'json'
 | 
			
		||||
		httpreq.send(fd)
 | 
			
		||||
		httpreq.onreadystatechange = function () {
 | 
			
		||||
			if (httpreq.readyState === 4) {
 | 
			
		||||
				var json = httpreq.response;
 | 
			
		||||
				if(this.status!==200){ setLog(start, this.status, this.response); }
 | 
			
		||||
				$('#his-data').modal('close');
 | 
			
		||||
				todc();
 | 
			
		||||
				localStorage.removeItem("image");
 | 
			
		||||
				var json = httpreq.response
 | 
			
		||||
				if (this.status !== 200) {
 | 
			
		||||
					setLog(start, this.status, this.response)
 | 
			
		||||
				}
 | 
			
		||||
				$('#his-data').modal('close')
 | 
			
		||||
				todc()
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	$("#prof-change").html($("#prof-change").html());
 | 
			
		||||
	$("#header-change").html($("#header-change").html());
 | 
			
		||||
	fr.readAsDataURL(file);
 | 
			
		||||
	$('#prof-change').html($('#prof-change').html())
 | 
			
		||||
	$('#header-change').html($('#header-change').html())
 | 
			
		||||
	fr.readAsDataURL(file)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -33,20 +33,20 @@ function udgEx(user, acct_id) {
 | 
			
		||||
			Authorization: "Bearer " + at
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
		.then(function (response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
				response.text().then(function (text) {
 | 
			
		||||
					setLog(response.url, response.status, text);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			return response.json();
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(error) {
 | 
			
		||||
		.catch(function (error) {
 | 
			
		||||
			todo(error);
 | 
			
		||||
			setLog(start, "JSON", error);
 | 
			
		||||
			console.error(error);
 | 
			
		||||
		})
 | 
			
		||||
		.then(function(json) {
 | 
			
		||||
		.then(function (json) {
 | 
			
		||||
			if (json.accounts[0]) {
 | 
			
		||||
				var id = json.accounts[0].id;
 | 
			
		||||
				udg(id, acct_id);
 | 
			
		||||
@@ -76,20 +76,20 @@ function udg(user, acct_id) {
 | 
			
		||||
			Authorization: "Bearer " + at
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
		.then(function (response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
				response.text().then(function (text) {
 | 
			
		||||
					setLog(response.url, response.status, text);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			return response.json();
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(error) {
 | 
			
		||||
		.catch(function (error) {
 | 
			
		||||
			todo(error);
 | 
			
		||||
			setLog(start, "JSON", error);
 | 
			
		||||
			console.error(error);
 | 
			
		||||
		})
 | 
			
		||||
		.then(function(json) {
 | 
			
		||||
		.then(function (json) {
 | 
			
		||||
			//一つ前のユーザーデータ
 | 
			
		||||
			if (!localStorage.getItem("history")) {
 | 
			
		||||
				$("#his-history-btn").prop("disabled", true);
 | 
			
		||||
@@ -129,7 +129,7 @@ function udg(user, acct_id) {
 | 
			
		||||
			}
 | 
			
		||||
			//絵文字があれば
 | 
			
		||||
			if (actemojick) {
 | 
			
		||||
				Object.keys(json.emojis).forEach(function(key5) {
 | 
			
		||||
				Object.keys(json.emojis).forEach(function (key5) {
 | 
			
		||||
					var emoji = json.emojis[key5];
 | 
			
		||||
					var shortcode = emoji.shortcode;
 | 
			
		||||
					var emoji_url = '<img src="' + emoji.url + '" class="emoji-img" data-emoji="' + shortcode + '" draggable="false">';
 | 
			
		||||
@@ -239,7 +239,7 @@ function udg(user, acct_id) {
 | 
			
		||||
				$(".only-his-data").show();
 | 
			
		||||
			}
 | 
			
		||||
			todc();
 | 
			
		||||
			if(json.locked) {
 | 
			
		||||
			if (json.locked) {
 | 
			
		||||
				$('#his-data').addClass('locked')
 | 
			
		||||
			} else {
 | 
			
		||||
				$('#his-data').removeClass('locked')
 | 
			
		||||
@@ -271,20 +271,20 @@ function misskeyUdg(user, acct_id) {
 | 
			
		||||
			userId: user
 | 
			
		||||
		})
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
		.then(function (response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
				response.text().then(function (text) {
 | 
			
		||||
					setLog(response.url, response.status, text);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			return response.json();
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(error) {
 | 
			
		||||
		.catch(function (error) {
 | 
			
		||||
			todo(error);
 | 
			
		||||
			setLog(start, "JSON", error);
 | 
			
		||||
			console.error(error);
 | 
			
		||||
		})
 | 
			
		||||
		.then(function(json) {
 | 
			
		||||
		.then(function (json) {
 | 
			
		||||
			//一つ前のユーザーデータ
 | 
			
		||||
			if (!localStorage.getItem("history")) {
 | 
			
		||||
				$("#his-history-btn").prop("disabled", true);
 | 
			
		||||
@@ -402,22 +402,22 @@ function relations(user, acct_id) {
 | 
			
		||||
			Authorization: "Bearer " + at
 | 
			
		||||
		}
 | 
			
		||||
	})
 | 
			
		||||
		.then(function(response) {
 | 
			
		||||
		.then(function (response) {
 | 
			
		||||
			if (!response.ok) {
 | 
			
		||||
				response.text().then(function(text) {
 | 
			
		||||
				response.text().then(function (text) {
 | 
			
		||||
					setLog(response.url, response.status, text);
 | 
			
		||||
				});
 | 
			
		||||
			}
 | 
			
		||||
			return response.json();
 | 
			
		||||
		})
 | 
			
		||||
		.catch(function(error) {
 | 
			
		||||
		.catch(function (error) {
 | 
			
		||||
			todo(error);
 | 
			
		||||
			setLog(start, "JSON", error);
 | 
			
		||||
			console.error(error);
 | 
			
		||||
		})
 | 
			
		||||
		.then(function(json) {
 | 
			
		||||
		.then(function (json) {
 | 
			
		||||
			var json = json[0];
 | 
			
		||||
			if(json.requested) {
 | 
			
		||||
			if (json.requested) {
 | 
			
		||||
				//フォロリク中
 | 
			
		||||
				$('#his-data').addClass('following')
 | 
			
		||||
				$("#his-follow-btn-text").text(lang.lang_status_requesting)
 | 
			
		||||
@@ -482,7 +482,7 @@ function profbrws() {
 | 
			
		||||
function setMain() {
 | 
			
		||||
	var acct_id = $("#his-data").attr("use-acct");
 | 
			
		||||
	localStorage.setItem("main", acct_id);
 | 
			
		||||
	multiSelector(true);
 | 
			
		||||
	multiSelector();
 | 
			
		||||
	M.toast({ html: lang.lang_manager_mainAcct, displayLength: 3000 });
 | 
			
		||||
}
 | 
			
		||||
//オールリセット
 | 
			
		||||
@@ -551,7 +551,7 @@ function reset() {
 | 
			
		||||
	$('#his-data').removeClass('locked')
 | 
			
		||||
	$('#his-data').removeClass('requesting')
 | 
			
		||||
}
 | 
			
		||||
$("#my-data-nav .anc-link").on("click", function() {
 | 
			
		||||
$("#my-data-nav .anc-link").on("click", function () {
 | 
			
		||||
	var target = $(this).attr("go");
 | 
			
		||||
	if (target) {
 | 
			
		||||
		$("#my-data-nav .anc-link").removeClass("active-back");
 | 
			
		||||
 
 | 
			
		||||
@@ -69,7 +69,7 @@
 | 
			
		||||
						<div class="pwa">
 | 
			
		||||
							@@codesetupwarn@@<br />
 | 
			
		||||
							<label>
 | 
			
		||||
								<input type="checkbox" class="filled-in" id="linux" />
 | 
			
		||||
								<input type="checkbox" class="filled-in checked" id="linux" checked />
 | 
			
		||||
								<span>@@codesetup@@</span>
 | 
			
		||||
							</label>
 | 
			
		||||
							<br />
 | 
			
		||||
@@ -128,17 +128,17 @@
 | 
			
		||||
			<div id="instance-data">
 | 
			
		||||
				Some instance data by
 | 
			
		||||
				<a href="https://instances.social" target="_blank">instances.social API</a><br />
 | 
			
		||||
				<h5 id="ins-title"></h5>
 | 
			
		||||
				Administered by:<a id="ins-admin"></a><br />
 | 
			
		||||
				<span id="ins-desc"></span><br />
 | 
			
		||||
				<h5 id="ins-title" class="ins-loading"></h5>
 | 
			
		||||
				Administered by:<a id="ins-admin" class="ins-loading"></a><br />
 | 
			
		||||
				<span id="ins-desc" class="ins-loading"></span><br />
 | 
			
		||||
				<img src="../../img/loading.svg" id="ins-prof" width="200" /><br />
 | 
			
		||||
				<br />
 | 
			
		||||
				@@domain@@:<span id="ins-name"></span><br />
 | 
			
		||||
				@@connect@@:<span id="ins-connect"></span>@@ko@@<br />
 | 
			
		||||
				@@toots@@:<span id="ins-toot"></span>@@ko@@<br />
 | 
			
		||||
				@@users@@:<span id="ins-user"></span>@@users@@<br />
 | 
			
		||||
				@@safety@@:<span id="ins-per"></span>%<br />
 | 
			
		||||
				@@ver@@:<span id="ins-ver"></span>@<span id="ins-upd"></span><br />
 | 
			
		||||
				@@domain@@:<span id="ins-name" class="ins-loading"></span><br />
 | 
			
		||||
				@@connect@@:<span id="ins-connect" class="ins-loading"></span>@@ko@@<br />
 | 
			
		||||
				@@toots@@:<span id="ins-toot" class="ins-loading"></span>@@ko@@<br />
 | 
			
		||||
				@@users@@:<span id="ins-user" class="ins-loading"></span>@@users@@<br />
 | 
			
		||||
				@@safety@@:<span id="ins-per" class="ins-loading"></span>%<br />
 | 
			
		||||
				@@ver@@:<span id="ins-ver" class="ins-loading"></span>@<span id="ins-upd" class="ins-loading"></span><br />
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
		<script type="text/javascript" src="../../js/ui/theme.js"></script>
 | 
			
		||||
 
 | 
			
		||||
@@ -1538,7 +1538,7 @@
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<a onclick="about()" class="nex waves-effect pwa">
 | 
			
		||||
			<a id="onClickAbout" class="nex waves-effect pwa">
 | 
			
		||||
				<i class="material-icons" style="font-size: 1rem;">info</i>@@about@@ </a
 | 
			
		||||
			> | 
 | 
			
		||||
			<a onclick="bottomReverse()" class="nex waves-effect">
 | 
			
		||||
@@ -1723,6 +1723,7 @@
 | 
			
		||||
		<!--JS-->
 | 
			
		||||
		<script type="text/javascript" src="../../@@node_base@@/jquery/dist/jquery.js"></script>
 | 
			
		||||
		<script type="text/javascript" src="../../js/platform/first.js"></script>
 | 
			
		||||
		<script type="text/javascript" src="../../js/common/api.js"></script>
 | 
			
		||||
		<script type="text/javascript" src="../../@@node_base@@/grapheme-splitter/index.js"></script>
 | 
			
		||||
		<script
 | 
			
		||||
			type="text/javascript"
 | 
			
		||||
 
 | 
			
		||||
@@ -3,8 +3,8 @@
 | 
			
		||||
    "lang_toot": "トゥート",
 | 
			
		||||
    "lang_there": "あり",
 | 
			
		||||
    "lang_nothing": "なし",
 | 
			
		||||
    "lang_yesno": "はい",
 | 
			
		||||
    "lang_no": "いいえ",
 | 
			
		||||
    "lang_yesno": "せやな",
 | 
			
		||||
    "lang_no": "ちゃうわ",
 | 
			
		||||
    "lang_progress": "処理中",
 | 
			
		||||
    "lang_edit": "編集",
 | 
			
		||||
    "lang_del": "削除",
 | 
			
		||||
@@ -38,6 +38,7 @@
 | 
			
		||||
    "lang_version_platform_linux": "このソフトウェアSnapcraftからダウンロードしたんか?普通はホームページからインストールするし「いいえ」でええんやけど。「はい」にしたらSnapcraftはんがアップデートするからTheDeskはアップデートせえへん?とか言わへんようになる。",
 | 
			
		||||
    "lang_version_platform_mac": "このソフトウェアHomebrew caskからダウンロードしたんか?普通はホームページからインストールするし「いいえ」でええんやけど。「はい」にしたらHomebrew caskはんがアップデートするからTheDeskはアップデートせえへん?とか言わへんようになる。",
 | 
			
		||||
    "lang_login_noauth": "認証せんと見る",
 | 
			
		||||
    "lang_login_changedData": "プロフの情報が変わってしもたけど、もっかい読み込んだ方がええんちゃうか?",
 | 
			
		||||
    "lang_manager_info": "インスタンス情報",
 | 
			
		||||
    "lang_manager_refresh": "情報更新",
 | 
			
		||||
    "lang_manager_delete": "削除",
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,7 @@
 | 
			
		||||
    "lang_version_platform_linux": "このソフトウェアはSnapcraft(snapd)からインストールしましたか?通常はホームページからインストールするため「いいえ」を選んでください。「はい」を選ぶとSnapcraftからアップデートが提供され、アップデートの通知を出しません。",
 | 
			
		||||
    "lang_version_platform_mac": "このソフトウェアはHomebrew Caskからインストールしましたか?通常はホームページからインストールするため「いいえ」を選んでください。「はい」を選ぶとアップデートの通知を出しません。",
 | 
			
		||||
    "lang_login_noauth": "認証せずに見る",
 | 
			
		||||
    "lang_login_changedData": "プロフィール情報が変更されました。再読み込みしますか?",
 | 
			
		||||
    "lang_manager_info": "インスタンス情報",
 | 
			
		||||
    "lang_manager_refresh": "情報更新",
 | 
			
		||||
    "lang_manager_delete": "削除",
 | 
			
		||||
 
 | 
			
		||||
@@ -515,7 +515,7 @@
 | 
			
		||||
	<button class="btn waves-effect red" style="width:100%; max-width:40rem;"
 | 
			
		||||
		onclick="if(confirm('@@resetconfirm@@')){ localStorage.clear(); location.href='index.html'; }"><i
 | 
			
		||||
			class="material-icons left">delete</i>@@reset@@</button><br><br>
 | 
			
		||||
	<button class="btn waves-effect indigo pwa" onclick="about()" style="width:100%; max-width:40rem;"><i
 | 
			
		||||
	<button class="btn waves-effect indigo pwa" id="onClickAbout" style="width:100%; max-width:40rem;"><i
 | 
			
		||||
			class="material-icons left">info</i>@@about@@</button>
 | 
			
		||||
	<a href="https://thedesk.top" class="btn waves-effect deep-purple lighten-2" style="width:100%; max-width:40rem;"><i
 | 
			
		||||
			class="material-icons left">web</i>@@hp@@</a>
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,7 @@
 | 
			
		||||
		<script type="text/javascript" src="../../@@node_base@@/jquery/dist/jquery.js"></script>
 | 
			
		||||
		<script type="text/javascript" src="../../js/platform/first.js"></script>
 | 
			
		||||
		<script type="text/javascript" src="../../@@node_base@@/materialize-css/dist/js/materialize.js"></script>
 | 
			
		||||
		<i class="material-icons pointer waves-effect" onclick="about();">info</i>
 | 
			
		||||
		<i class="material-icons pointer waves-effect" id="onClickAbout">info</i>
 | 
			
		||||
		<i class="material-icons pointer waves-effect" onclick="skipper();">clear</i>
 | 
			
		||||
		<!--a href="update.html">Reload</a-->
 | 
			
		||||
		<div id="start">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user