2018-01-28 23:22:43 +11:00
|
|
|
|
$(function($) {
|
2018-01-31 03:43:01 +11:00
|
|
|
|
//キーボードショートカット
|
|
|
|
|
$(window).keydown(function(e) {
|
|
|
|
|
var hasFocus = $('input').is(':focus');
|
|
|
|
|
var hasFocus2 = $('textarea').is(':focus');
|
2018-09-10 03:06:00 +10:00
|
|
|
|
if(document.getElementById("webview")){
|
|
|
|
|
var webview=document.getElementById("webview");
|
|
|
|
|
if(webview.getURL()=="https://mobile.twitter.com/compose/tweet" || webview.getURL()=="https://mobile.twitter.com"){
|
|
|
|
|
if (e.keyCode === 8) {
|
|
|
|
|
webview.sendInputEvent({
|
|
|
|
|
type: "keyDown",
|
|
|
|
|
keyCode: '\u0008'
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-31 03:43:01 +11:00
|
|
|
|
//Ctrl+Enter:投稿
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if (event.metaKey || event.ctrlKey) {
|
2018-01-31 03:43:01 +11:00
|
|
|
|
if (e.keyCode === 13) {
|
|
|
|
|
post();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-05 01:56:31 +11:00
|
|
|
|
//Shift+Enter:Markdown
|
|
|
|
|
if (event.shiftKey) {
|
|
|
|
|
if (e.keyCode === 13) {
|
|
|
|
|
brInsert(" \n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-13 06:16:46 +11:00
|
|
|
|
//Shift+Space:Markdownゼロ幅スペース
|
|
|
|
|
if (event.shiftKey) {
|
|
|
|
|
if (e.keyCode === 32) {
|
|
|
|
|
brInsert("");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-31 03:43:01 +11:00
|
|
|
|
//Esc:消す
|
|
|
|
|
if (e.keyCode === 27) {
|
|
|
|
|
hide();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-02-09 03:43:11 +11:00
|
|
|
|
//F5リロード
|
2018-01-31 03:43:01 +11:00
|
|
|
|
if (e.keyCode === 116) {
|
|
|
|
|
location.href = "index.html";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-02-09 03:43:11 +11:00
|
|
|
|
//Ctrl+R:ランキング
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if (event.metaKey || event.ctrlKey) {
|
2018-02-09 03:43:11 +11:00
|
|
|
|
if (e.keyCode === 82) {
|
|
|
|
|
if(localStorage.getItem("kirishima")){
|
2018-02-17 00:08:43 +11:00
|
|
|
|
window.open("https://astarte.thedesk.top");
|
2018-02-09 03:43:11 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-21 16:36:02 +11:00
|
|
|
|
//Ctrl+Sift+C:全消し
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
2018-03-21 16:36:02 +11:00
|
|
|
|
if (e.keyCode === 67) {
|
|
|
|
|
clear();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//Ctrl+Sift+N:NowPlaying
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
2018-03-21 16:36:02 +11:00
|
|
|
|
if (e.keyCode === 78) {
|
2018-07-28 07:25:12 +10:00
|
|
|
|
show();
|
2018-03-21 16:36:02 +11:00
|
|
|
|
nowplaying()
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-31 03:43:01 +11:00
|
|
|
|
//input/textareaにフォーカスなし時
|
|
|
|
|
if (!hasFocus && !hasFocus2) {
|
2018-07-28 07:25:12 +10:00
|
|
|
|
//Ctrl+V:いつもの
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if (event.metaKey || event.ctrlKey) {
|
2018-07-28 07:25:12 +10:00
|
|
|
|
if (e.keyCode === 86) {
|
|
|
|
|
show();
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-31 03:43:01 +11:00
|
|
|
|
//X:開閉
|
|
|
|
|
if (e.keyCode === 88) {
|
2018-07-28 07:25:12 +10:00
|
|
|
|
if (!$("#post-box").hasClass("appear")) {
|
2018-01-31 03:43:01 +11:00
|
|
|
|
show();
|
|
|
|
|
} else {
|
|
|
|
|
hide();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//N:新トゥート
|
|
|
|
|
if (e.keyCode === 78) {
|
2018-07-28 07:25:12 +10:00
|
|
|
|
if (!$("#post-box").hasClass("appear")) {
|
2018-01-31 03:43:01 +11:00
|
|
|
|
show();
|
|
|
|
|
}
|
|
|
|
|
$('textarea').focus();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-07-28 07:25:12 +10:00
|
|
|
|
//Ctrl+E:全ての通知未読を既読にする
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if (event.metaKey || event.ctrlKey) {
|
2018-07-28 07:25:12 +10:00
|
|
|
|
if (e.keyCode === 69) {
|
|
|
|
|
allNotfRead();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-01-31 03:43:01 +11:00
|
|
|
|
}
|
|
|
|
|
//Ctrl+Space:読み込み
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if (event.metaKey || event.ctrlKey) {
|
2018-01-31 03:43:01 +11:00
|
|
|
|
if (e.keyCode === 32) {
|
|
|
|
|
parseColumn();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-21 16:36:02 +11:00
|
|
|
|
//Ctrl+Sift+S:設定
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
2018-03-21 16:36:02 +11:00
|
|
|
|
if (e.keyCode === 83) {
|
|
|
|
|
location.href = "setting.html";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//Ctrl+Sift+M:アカマネ
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
2018-03-21 16:36:02 +11:00
|
|
|
|
if (e.keyCode === 77) {
|
|
|
|
|
location.href = "acct.html";
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//Ctrl+Sift+P:プロフ
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if ((event.ctrlKey) && event.shiftKey) {
|
2018-03-21 16:36:02 +11:00
|
|
|
|
if (e.keyCode === 80) {
|
|
|
|
|
profShow()
|
2018-01-31 03:43:01 +11:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-03-27 13:39:35 +11:00
|
|
|
|
//数字:TL
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if (event.metaKey || event.ctrlKey) {
|
2018-03-27 13:39:35 +11:00
|
|
|
|
if (e.keyCode >= 49 && e.keyCode <= 57) {
|
|
|
|
|
var kz=e.keyCode-49;
|
2018-04-07 14:31:09 +10:00
|
|
|
|
goColumn(kz);
|
2018-03-27 13:39:35 +11:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-31 03:43:01 +11:00
|
|
|
|
}
|
|
|
|
|
//textareaフォーカス時
|
|
|
|
|
if (hasFocus2) {
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if (event.metaKey || event.ctrlKey) {
|
2018-01-31 03:43:01 +11:00
|
|
|
|
//Ctrl+B:太字
|
|
|
|
|
if (e.keyCode === 66) {
|
|
|
|
|
tagsel('b');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//Ctrl+I:斜字
|
|
|
|
|
if (e.keyCode === 73) {
|
|
|
|
|
tagsel('i');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//Ctrl+U:下線
|
|
|
|
|
if (e.keyCode === 85) {
|
|
|
|
|
tagsel('u');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//Ctrl+S:取り消し線
|
|
|
|
|
if (e.keyCode === 83) {
|
|
|
|
|
tagsel('s');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2018-06-12 01:44:28 +10:00
|
|
|
|
//C+S+(No):ワンクリ
|
2018-08-23 03:29:39 +10:00
|
|
|
|
if ((event.metaKey || event.ctrlKey) && event.shiftKey) {
|
2018-06-12 01:44:28 +10:00
|
|
|
|
if (e.keyCode >= 49 && e.keyCode <= 51) {
|
|
|
|
|
var no=e.keyCode-48;
|
2018-06-18 00:26:45 +10:00
|
|
|
|
if(localStorage.getItem("oks-"+no)){$("#textarea").val($("#textarea").val()+localStorage.getItem("oks-"+no))}
|
2018-06-12 01:44:28 +10:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-31 03:43:01 +11:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-02-09 03:54:24 +11:00
|
|
|
|
//イメージビューワー切り替え
|
2018-01-31 03:43:01 +11:00
|
|
|
|
if (e.keyCode === 37) {
|
|
|
|
|
if ($("#imagemodal").hasClass("open")) {
|
|
|
|
|
imgCont('prev');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (e.keyCode === 39) {
|
|
|
|
|
if ($("#imagemodal").hasClass("open")) {
|
|
|
|
|
imgCont('next');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//クリアボタン
|
|
|
|
|
$("#clear").click(function() {
|
|
|
|
|
clear();
|
|
|
|
|
});
|
2018-03-27 13:39:35 +11:00
|
|
|
|
});
|