2018-01-28 23:22:43 +11:00
|
|
|
//プラットフォーム別 最後に読むやつ
|
|
|
|
//リンクを外部で開くか内部で出すか
|
2019-05-19 17:39:30 +10:00
|
|
|
$(document).on('click', 'a', e => {
|
|
|
|
var $a = $(e.target);
|
|
|
|
var url = $a.attr('href');
|
|
|
|
if (!url) {
|
|
|
|
var url = $a.parent().attr('href');
|
|
|
|
}
|
|
|
|
var urls = [];
|
|
|
|
if (url) {
|
2018-07-05 11:26:07 +10:00
|
|
|
urls = url.match(/https?:\/\/(.+)/);
|
2018-04-07 14:31:09 +10:00
|
|
|
//トゥートのURLぽかったら
|
|
|
|
toot = url.match(/https:\/\/([a-zA-Z0-9.-]+)\/@([a-zA-Z0-9_]+)\/([0-9]+)/);
|
2018-05-12 04:12:25 +10:00
|
|
|
//タグのURLぽかったら
|
2019-05-19 17:39:30 +10:00
|
|
|
var tags = [];
|
|
|
|
tags = url.match(
|
|
|
|
/https:\/\/([-a-zA-Z0-9@.]+)\/tags\/([-_.!~*\'()a-zA-Z0-9;\/?:\&=+\$,%#]+)/
|
|
|
|
);
|
2018-05-12 04:12:25 +10:00
|
|
|
//メンションっぽかったら
|
2019-05-19 17:39:30 +10:00
|
|
|
var ats = [];
|
|
|
|
ats = url.match(
|
|
|
|
/https:\/\/([-a-zA-Z0-9.]+)\/@([-_.!~*\'()a-zA-Z0-9;\/?:\&=+\$,%#@]+)/
|
|
|
|
);
|
|
|
|
if (toot) {
|
|
|
|
if (toot[1]) {
|
|
|
|
var acct_id = $a.parent().attr("data-acct");
|
|
|
|
if (!acct_id) {
|
|
|
|
acct_id = 0;
|
2018-04-09 00:17:33 +10:00
|
|
|
}
|
|
|
|
$a.parent().addClass("loadp")
|
|
|
|
$a.parent().text("Loading...")
|
2019-05-19 17:39:30 +10:00
|
|
|
detEx(url, acct_id);
|
2018-04-07 14:31:09 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
|
|
} else if (tags) {
|
|
|
|
if (tags[2]) {
|
|
|
|
var acct_id = $a.parent().attr("data-acct");
|
|
|
|
if (!acct_id) {
|
|
|
|
acct_id = 0;
|
2019-04-14 02:42:18 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
tl('tag', decodeURI(tags[2]), acct_id, 'add')
|
2018-05-12 04:12:25 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
} else if (ats) {
|
|
|
|
if (ats[2]) {
|
2019-04-04 03:07:07 +11:00
|
|
|
//Quesdon判定
|
2019-05-19 17:39:30 +10:00
|
|
|
if (!~ats[2].indexOf("@")) {
|
|
|
|
udgEx(ats[2] + "@" + ats[1], "main");
|
2018-06-12 01:44:28 +10:00
|
|
|
return false
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2018-06-12 01:44:28 +10:00
|
|
|
const {
|
|
|
|
shell
|
|
|
|
} = require('electron');
|
2019-05-19 17:39:30 +10:00
|
|
|
|
2018-06-12 01:44:28 +10:00
|
|
|
shell.openExternal(url);
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
|
|
|
2018-09-11 04:59:44 +10:00
|
|
|
}
|
2018-02-18 05:44:20 +11:00
|
|
|
} else {
|
2019-05-19 17:39:30 +10:00
|
|
|
//hrefがhttp/httpsならブラウザで
|
|
|
|
if (urls) {
|
|
|
|
if (urls[0]) {
|
|
|
|
const { shell } = require('electron');
|
|
|
|
if (~url.indexOf("thedeks.top")) {
|
|
|
|
//alert("If you recieve this alert, let the developer(Cutls@kirishima.cloud) know it with a screenshot.");
|
|
|
|
url = "https://thedesk.top";
|
|
|
|
}
|
|
|
|
shell.openExternal(url);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
location.href = url;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
location.href = url;
|
|
|
|
}
|
2018-02-18 05:44:20 +11:00
|
|
|
}
|
2018-02-26 00:37:04 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
|
|
|
//よく使うライブラリ
|
2018-12-09 05:46:01 +11:00
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
//コピー
|
|
|
|
function execCopy(string) {
|
2018-02-25 19:41:34 +11:00
|
|
|
var temp = $("#copy");
|
|
|
|
temp.val(string);
|
|
|
|
temp.select();
|
2018-02-18 03:44:03 +11:00
|
|
|
var result = document.execCommand('copy');
|
|
|
|
return result;
|
2019-05-19 17:39:30 +10:00
|
|
|
}
|
|
|
|
//Nano
|
|
|
|
function nano() {
|
|
|
|
var electron = require("electron");
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
ipc.send('nano', "");
|
2018-04-17 03:10:35 +10:00
|
|
|
}
|
|
|
|
function progshow(e) {
|
|
|
|
if (e.lengthComputable) {
|
2019-05-19 17:39:30 +10:00
|
|
|
var percent = e.loaded / e.total;
|
|
|
|
console.log("Progress: " + percent * 100);
|
|
|
|
$("#imgsel").hide();
|
|
|
|
if (percent < 1) {
|
|
|
|
$("#imgup").text(Math.floor(percent * 100) + "%");
|
|
|
|
} else {
|
|
|
|
$("#imgup").text(lang.lang_progress);
|
|
|
|
}
|
2018-04-17 03:10:35 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
}
|
2018-06-18 00:48:33 +10:00
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
var electron = require("electron");
|
|
|
|
var ipc = electron.ipcRenderer;
|
|
|
|
ipc.on('reload', function (event, arg) {
|
2018-06-18 00:48:33 +10:00
|
|
|
location.reload();
|
|
|
|
})
|
2018-08-05 02:26:34 +10:00
|
|
|
ipc.on('mess', function (event, arg) {
|
2019-05-19 17:39:30 +10:00
|
|
|
if (arg == "unzip") {
|
|
|
|
if (lang == "ja") {
|
2018-08-05 02:26:34 +10:00
|
|
|
$("body").text("アップデートを展開中です。");
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2018-08-05 02:26:34 +10:00
|
|
|
$("body").text("Unzipping...");
|
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
|
|
|
|
}
|
2018-09-10 03:06:00 +10:00
|
|
|
})
|
|
|
|
//Native Notf
|
|
|
|
ipc.on('shownotf', function (event, args) {
|
2019-05-19 17:39:30 +10:00
|
|
|
if (args["type"] == "toot") {
|
2018-09-10 03:06:00 +10:00
|
|
|
details(id, acct_id)
|
2019-05-19 17:39:30 +10:00
|
|
|
} else if (args["type"] == "userdata") {
|
2018-09-10 03:06:00 +10:00
|
|
|
udg(user, acct_id)
|
|
|
|
}
|
|
|
|
})
|
2019-05-19 17:39:30 +10:00
|
|
|
function opendev() {
|
2018-09-10 03:06:00 +10:00
|
|
|
var webview = document.getElementById("webview");
|
2018-09-11 04:59:44 +10:00
|
|
|
webview.openDevTools();
|
|
|
|
/*webview.sendInputEvent({
|
2018-09-10 03:06:00 +10:00
|
|
|
type: "keyDown",
|
2018-09-11 04:59:44 +10:00
|
|
|
keyCode: '2'
|
2018-09-10 03:06:00 +10:00
|
|
|
});
|
2018-09-11 04:59:44 +10:00
|
|
|
*/
|
2019-02-28 04:02:23 +11:00
|
|
|
}
|
|
|
|
|
2019-03-21 16:21:02 +11:00
|
|
|
var webviewDom = document.getElementById('webview');
|
2019-02-28 04:02:23 +11:00
|
|
|
const {
|
|
|
|
shell
|
|
|
|
} = require('electron');
|
2019-05-19 17:39:30 +10:00
|
|
|
webviewDom.addEventListener('new-window', function (e) {
|
|
|
|
shell.openExternal(e.url);
|
2019-04-15 01:45:04 +10:00
|
|
|
});
|
|
|
|
function playSound() {
|
|
|
|
window.AudioContext = window.AudioContext || window.webkitAudioContext;
|
|
|
|
context = new AudioContext();
|
|
|
|
context.createBufferSource().start(0);
|
|
|
|
context.decodeAudioData(request.response, function (buf) {
|
2019-05-19 17:39:30 +10:00
|
|
|
console.log("Playing:" + source)
|
2019-04-15 01:45:04 +10:00
|
|
|
source.buffer = buf;
|
|
|
|
source.loop = false;
|
|
|
|
});
|
|
|
|
source = context.createBufferSource();
|
|
|
|
volumeControl = context.createGain();
|
|
|
|
source.connect(volumeControl);
|
|
|
|
volumeControl.connect(context.destination);
|
2019-05-19 17:39:30 +10:00
|
|
|
volumeControl.gain.value = 0.8
|
2019-04-15 01:45:04 +10:00
|
|
|
source.start(0);
|
|
|
|
}
|