right click

This commit is contained in:
cutls 2021-04-18 04:24:52 +09:00
parent 28f6ccbfee
commit f5956fed06
8 changed files with 102 additions and 68 deletions

View File

@ -359,8 +359,8 @@ iframe,
grid-area: actions; grid-area: actions;
} }
.area-actions .btn-flat { .area-actions .btn-flat {
height: 1rem; height: 1.3rem;
line-height: 1rem; line-height: 1.3rem;
} }
.area-actions .btn-flat, .area-actions .btn-flat,
.area-vis i, .area-vis i,
@ -384,7 +384,14 @@ iframe,
margin: 0.15rem; margin: 0.15rem;
grid-area: side; grid-area: side;
} }
.notf-udg-text {
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-word;
overflow: hidden;
max-width: calc(100% - 150px);
display: inline-block;
}
.cusr { .cusr {
user-select: text; user-select: text;
padding-left: 0.4rem; padding-left: 0.4rem;
@ -578,9 +585,6 @@ p:not(:last-child) {
width: 8rem; width: 8rem;
display: flex; display: flex;
} }
.area-sta .hide {
display: inline-block !important;
}
.small-header .area-sta::-webkit-scrollbar { .small-header .area-sta::-webkit-scrollbar {
height: 5px; height: 5px;
} }
@ -676,13 +680,24 @@ p:not(:last-child) {
padding-left: 23px !important; padding-left: 23px !important;
margin-right: 5px; margin-right: 5px;
} }
.columnSettings {
display: flex;
flex-wrap: wrap;
}
.notf-indv-box .setting { .notf-indv-box .setting {
font-size: 1rem; font-size: 1rem;
width: calc(25% - 3px); width: calc(25% - 6px);
text-align: left; margin: 3px;
padding: 5px; height: 100px;
height: 70px;
text-align: center; text-align: center;
display: flex;
flex-direction: column;
padding-top: 17px;
border: 1px solid;
border-radius: 5px;
}
.notf-indv-box .setting:hover {
color: var(--text);
} }
.notf-exclude-btn { .notf-exclude-btn {
border: 1px solid; border: 1px solid;
@ -721,6 +736,9 @@ p:not(:last-child) {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
} }
.dropdown-content li {
padding-top: 0.4rem;
}
.fa-2x > .emoji-img { .fa-2x > .emoji-img {
width: 2.3rem !important; width: 2.3rem !important;
height: 2.3rem !important; height: 2.3rem !important;

View File

@ -83,6 +83,8 @@ onmessage = function(e) {
ipc.send('log', e.data[1]) ipc.send('log', e.data[1])
} else if (e.data[0] == 'twitterLogin') { } else if (e.data[0] == 'twitterLogin') {
ipc.send('twitterLogin', e.data[1]) ipc.send('twitterLogin', e.data[1])
} else if (e.data[0] == 'textareaContextMenu') {
ipc.send('textareaContextMenu', e.data[1])
} }
} }
//version.js //version.js
@ -236,3 +238,9 @@ ipc.on('accessibility', function(event, arg) {
ipc.on('twitterLoginComplete', function(event, arg) { ipc.on('twitterLoginComplete', function(event, arg) {
postMessage(['twitterLoginComplete', ''], '*') postMessage(['twitterLoginComplete', ''], '*')
}) })
ipc.on('alert', function(event, arg) {
postMessage(['alert', arg], '*')
})
ipc.on('customUrl', function(event, args) {
postMessage(['customUrl', args], '*')
})

View File

@ -314,39 +314,19 @@ function trend() {
}) })
} }
function srcBox(mode) { function srcBox(mode) {
var selectedText = window.getSelection().toString()
if (mode == 'open') { if (mode == 'open') {
$('#pageSrc').removeClass('hide') $('#pageSrc').removeClass('hide')
} else if (mode == 'close') { } else if (mode == 'close') {
if(!selectedText) {
$('#pageSrc').addClass('hide') $('#pageSrc').addClass('hide')
$('#pageSrc').removeClass('keep') $('#pageSrc').removeClass('keep')
}
} else { } else {
$('#pageSrc').toggleClass('hide') $('#pageSrc').toggleClass('hide')
} }
if(!$('#pageSrc').hasClass('keep')) {
$('#pageSrcInput').val(selectedText)
} }
}
$('#pageSrcInput').click(function() {
$('#pageSrc').addClass('keep')
})
$('#pageSrcInput').on('input', function(evt) {
if(!$('#pageSrcInput').val()) {
$('#pageSrc').removeClass('keep')
}
})
document.addEventListener('selectionchange', function() {
var selectedText = window.getSelection().toString()
if (selectedText && !$('input').is(':focus') && !$('textarea').is(':focus')) {
srcBox('open')
}
})
function doSrc(type) { function doSrc(type) {
$('#pageSrc').addClass('hide') $('#pageSrc').addClass('hide')
$('#pageSrc').removeClass('keep') $('#pageSrc').removeClass('keep')
var q = $('#pageSrcInput').val() var q = $('.srcQ').text()
if(type == 'web') { if(type == 'web') {
var start = localStorage.getItem('srcUrl') var start = localStorage.getItem('srcUrl')
if(!start) { if(!start) {
@ -356,5 +336,9 @@ function doSrc(type) {
postMessage(["openUrl", start], "*") postMessage(["openUrl", start], "*")
} else if(type == 'ts') { } else if(type == 'ts') {
tsAdd(q) tsAdd(q)
} else if(type == 'copy') {
execCopy(q)
} else if(type == 'toot') {
brInsert(q)
} }
} }

View File

@ -4,10 +4,8 @@ function templete(lang, mainWindow, packaged, dir, dirname) {
if (lang != "ja" && lang != "en") { if (lang != "ja" && lang != "en") {
lang = "en" lang = "en"
} }
const electron = require("electron"); const electron = require("electron")
const ipc = electron.ipcMain; const { Menu, MenuItem, ipcMain, BrowserWindow, app } = electron
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const join = require('path').join; const join = require('path').join;
const dict = { const dict = {
"application": { "application": {
@ -84,7 +82,7 @@ function templete(lang, mainWindow, packaged, dir, dirname) {
{ {
label: 'Toggle Developer Tools', label: 'Toggle Developer Tools',
accelerator: 'Alt+Command+I', accelerator: 'Alt+Command+I',
click: function () { if (!packaged) { mainWindow.toggleDevTools(); } } click: function () { mainWindow.toggleDevTools(); }
}, },
{ {
label: dict.reload[lang], label: dict.reload[lang],
@ -150,6 +148,28 @@ function templete(lang, mainWindow, packaged, dir, dirname) {
] ]
} }
]; ];
// コピペメニュー
const ctxMenu = new Menu()
ctxMenu.append(new MenuItem({
label: dict.cut[lang],
role: 'cut',
click: () => { console.log('Cut clicked!') }
}))
ctxMenu.append(new MenuItem({
label: dict.copy[lang],
role: 'copy',
click: () => { console.log('Copy clicked!') }
}))
ctxMenu.append(new MenuItem({
label: dict.paste[lang],
role: 'paste',
click: () => { console.log('Paste clicked!') }
}))
ipcMain.on('textareaContextMenu', function (e, params) {
ctxMenu.popup(mainWindow, params.x, params.y)
})
return menu; return menu;
} }

View File

@ -36,13 +36,11 @@
<textarea id="copy" style="top:-100px; position:fixed;"></textarea> <textarea id="copy" style="top:-100px; position:fixed;"></textarea>
<canvas id="canvas" style="top:-100px; position:fixed;width:32px;height:32px" width="32" height="32"></canvas> <canvas id="canvas" style="top:-100px; position:fixed;width:32px;height:32px" width="32" height="32"></canvas>
<div id="pageSrc" class="hide z-depth-5"> <div id="pageSrc" class="hide z-depth-5">
<input type="text" id="pageSrcInput" placeholder="@@search@@" /> <div class="srcQ"></div>
<button class="btn waves-effect" onclick="doSrc('web')" title="@@webSrc@@"> <div class="pageSrcBtn pointer" onclick="doSrc('web')">@@webSrc@@</div>
<i class="material-icons">open_in_browser</i> <div class="pageSrcBtn pointer" onclick="doSrc('ts')">@@tsSrc@@</div>
</button> <div class="pageSrcBtn pointer" onclick="doSrc('copy')">@@copy@@</div>
<button class="btn waves-effect" onclick="doSrc('ts')" title="@@tsSrc@@"> <div class="pageSrcBtn pointer lastPSB" onclick="doSrc('toot')">@@toot@@</div>
<i class="material-icons">chat</i>
</button>
</div> </div>
<div id="offline" class="hide"> <div id="offline" class="hide">
@@nowOffline@@ @@nowOffline@@
@ -571,11 +569,17 @@
<a go="#his-follower-list" title="@@follower@@" class="btn anc-link waves-effect"><i <a go="#his-follower-list" title="@@follower@@" class="btn anc-link waves-effect"><i
class="material-icons">people</i>←@@follower@@</a> class="material-icons">people</i>←@@follower@@</a>
<a go="#his-fav-list" title="@@favRegist@@" <a go="#his-fav-list" title="@@favRegist@@"
class="btn only-my-data anc-link waves-effect"><i class="btn only-my-data anc-link waves-effect">
class="material-icons">star</i>@@favRegist@@</a> <i class="material-icons">star</i>@@favRegist@@</a>
<a class="dropdown-trigger btn waves-effect" href="#" data-target="hisdropdown"><i <a class="dropdown-trigger btn waves-effect" href="#" data-target="hisdropdown"><i
class="material-icons">more_vert</i>@@more@@</a> class="material-icons">more_vert</i>@@more@@</a>
<div id="his-data-title"><i class="material-icons">timeline</i>@@timeline@@</div> <div id="his-data-title-wrap">
<span id="his-data-title"><i class="material-icons">timeline</i>@@timeline@@</span>
<button class="btn waves-effect grey darken-2" style="width: 180px" id="util-add" onclick="utlAdd()">
<i class="material-icons">add</i>
@@utlColumn@@
</button>
</div>
<!-- Dropdown Structure --> <!-- Dropdown Structure -->
<ul id="hisdropdown" class="dropdown-content"> <ul id="hisdropdown" class="dropdown-content">
<li class="anc-link only-his-data" go="#his-list"> <li class="anc-link only-his-data" go="#his-list">
@ -612,9 +616,6 @@
</ul> </ul>
</div> </div>
<div id="his-tl" class="his-var-content"> <div id="his-tl" class="his-var-content">
<button class="btn waves-effect grey" style="width:100%; padding:0;" onclick="utlAdd()">
@@utlColumn@@
</button>
<div id="his-tl-contents" class="cont-series"></div> <div id="his-tl-contents" class="cont-series"></div>
<button class="btn waves-effect " style="width:100%; padding:0;" <button class="btn waves-effect " style="width:100%; padding:0;"
onclick="utlShow('--now','more')"> onclick="utlShow('--now','more')">
@ -893,43 +894,43 @@
<input type="hidden" value="local" id="type-sel" /> <input type="hidden" value="local" id="type-sel" />
@@showThisTL@@ @@showThisTL@@
<div id="tltype"> <div id="tltype">
<a class="type waves-effect active" data-type="local"> <a class="type waves-effect active" data-type="local" title="@@local@@">
<div><i class="material-icons" aria-hidden="true">people_outline</i></div> <div><i class="material-icons" aria-hidden="true">people_outline</i></div>
<span>@@local@@</span> <span>@@local@@</span>
</a> </a>
<a class="type waves-effect" data-type="local-media"> <a class="type waves-effect" data-type="local-media" title="@@localMedia@@">
<div><i class="material-icons" aria-hidden="true">perm_media</i></div> <div><i class="material-icons" aria-hidden="true">perm_media</i></div>
<span>@@localMedia@@</span> <span>@@localMedia@@</span>
</a> </a>
<a class="type waves-effect" data-type="home"> <a class="type waves-effect" data-type="home" title="@@home@@">
<div><i class="material-icons" aria-hidden="true">home</i></div> <div><i class="material-icons" aria-hidden="true">home</i></div>
<span>@@home@@</span> <span>@@home@@</span>
</a> </a>
<a class="type waves-effect" data-type="pub"> <a class="type waves-effect" data-type="pub" title="@@fed@@">
<div><i class="material-icons" aria-hidden="true">language</i></div> <div><i class="material-icons" aria-hidden="true">language</i></div>
<span>@@fed@@</span> <span>@@fed@@</span>
</a> </a>
<a class="type waves-effect" data-type="pub-media"> <a class="type waves-effect" data-type="pub-media" title="@@fedMedia@@">
<div><i class="material-icons" aria-hidden="true">perm_media</i></div> <div><i class="material-icons" aria-hidden="true">perm_media</i></div>
<span>@@fedMedia@@</span> <span>@@fedMedia@@</span>
</a> </a>
<a class="type waves-effect" data-type="dm"> <a class="type waves-effect" data-type="dm" title="@@dm@@">
<div><i class="material-icons" aria-hidden="true">mail_outline</i></div> <div><i class="material-icons" aria-hidden="true">mail_outline</i></div>
<span>@@dm@@</span> <span>@@dm@@</span>
</a> </a>
<a class="type waves-effect" data-type="mix"> <a class="type waves-effect" data-type="mix" title="@@integratedTLDes@@">
<div><i class="material-icons" aria-hidden="true">merge_type</i></div> <div><i class="material-icons" aria-hidden="true">merge_type</i></div>
<span>@@integratedTLDes@@</span> <span>@@integratedTLDes@@</span>
</a> </a>
<a class="type waves-effect" data-type="plus"> <a class="type waves-effect" data-type="plus" title="@@localPlusDes@@">
<div><i class="material-icons" aria-hidden="true">reply</i></div> <div><i class="material-icons" aria-hidden="true">reply</i></div>
<span>@@localPlusDes@@</span> <span>@@localPlusDes@@</span>
</a> </a>
<a class="type waves-effect" data-type="notf"> <a class="type waves-effect" data-type="notf" title="@@notf@@">
<div><i class="material-icons" aria-hidden="true">notifications</i></div> <div><i class="material-icons" aria-hidden="true">notifications</i></div>
<span>@@notf@@</span> <span>@@notf@@</span>
</a> </a>
<a class="type waves-effect" data-type="bookmark"> <a class="type waves-effect" data-type="bookmark" title="@@bookmark@@">
<div><i class="material-icons" aria-hidden="true">bookmark</i></div> <div><i class="material-icons" aria-hidden="true">bookmark</i></div>
<span>@@bookmark@@</span> <span>@@bookmark@@</span>
</a> </a>
@ -955,7 +956,7 @@
<select id="src-acct-sel" class="acct-sel" onchange="trend()"></select> <select id="src-acct-sel" class="acct-sel" onchange="trend()"></select>
</div> </div>
<div class="input-field"> <div class="input-field">
<input id="src" type="text" class="validate" style="width:57%" /> <input id="src" type="text" class="validate" style="width:calc(100% - 150px)" />
<label for="src" data-trans="src">@@search@@</label> <label for="src" data-trans="src">@@search@@</label>
<button class="btn waves-effect indigo" style="width: 36%;padding: 0;padding-left: 1.15rem;" <button class="btn waves-effect indigo" style="width: 36%;padding: 0;padding-left: 1.15rem;"
onclick="src()" data-trans-i="src"> onclick="src()" data-trans-i="src">
@ -1023,7 +1024,7 @@
<br /><br /> <br /><br />
<div id="lists"></div> <div id="lists"></div>
<div id="lists-user"></div> <div id="lists-user"></div>
<input type="text" style="width:150px" id="list-add" placeholder="@@name@@" /> <input type="text" style="width: calc(100% - 143px)" id="list-add" placeholder="@@name@@" />
<button class="btn waves-effect" style="width:120px;" onclick="makeNewList()"> <button class="btn waves-effect" style="width:120px;" onclick="makeNewList()">
@@makeNew@@ @@makeNew@@
</button> </button>

View File

@ -74,6 +74,7 @@
"openBrowser":"Open in browser", "openBrowser":"Open in browser",
"screenshot":"Take a screenshot", "screenshot":"Take a screenshot",
"copyURL":"Copy the URL", "copyURL":"Copy the URL",
"copy":"Copy",
"embed":"Embed", "embed":"Embed",
"toots":"Toots", "toots":"Toots",
"follow":"Follow", "follow":"Follow",

View File

@ -72,6 +72,7 @@
"openBrowser":"ブラウザで開く", "openBrowser":"ブラウザで開く",
"screenshot":"スクリーンショット", "screenshot":"スクリーンショット",
"copyURL":"URLをコピー", "copyURL":"URLをコピー",
"copy":"コピー",
"embed":"埋め込む", "embed":"埋め込む",
"toots":"トゥート", "toots":"トゥート",
"follow":"フォロー", "follow":"フォロー",

View File

@ -74,6 +74,7 @@
"openBrowser":"ブラウザで開く", "openBrowser":"ブラウザで開く",
"screenshot":"スクリーンショット", "screenshot":"スクリーンショット",
"copyURL":"URLをコピー", "copyURL":"URLをコピー",
"copy":"コピー",
"embed":"埋め込む", "embed":"埋め込む",
"toots":"トゥート", "toots":"トゥート",
"follow":"フォロー", "follow":"フォロー",