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;
}
.area-actions .btn-flat {
height: 1rem;
line-height: 1rem;
height: 1.3rem;
line-height: 1.3rem;
}
.area-actions .btn-flat,
.area-vis i,
@ -384,7 +384,14 @@ iframe,
margin: 0.15rem;
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 {
user-select: text;
padding-left: 0.4rem;
@ -578,9 +585,6 @@ p:not(:last-child) {
width: 8rem;
display: flex;
}
.area-sta .hide {
display: inline-block !important;
}
.small-header .area-sta::-webkit-scrollbar {
height: 5px;
}
@ -676,13 +680,24 @@ p:not(:last-child) {
padding-left: 23px !important;
margin-right: 5px;
}
.columnSettings {
display: flex;
flex-wrap: wrap;
}
.notf-indv-box .setting {
font-size: 1rem;
width: calc(25% - 3px);
text-align: left;
padding: 5px;
height: 70px;
width: calc(25% - 6px);
margin: 3px;
height: 100px;
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 {
border: 1px solid;
@ -721,6 +736,9 @@ p:not(:last-child) {
overflow: hidden;
position: relative;
}
.dropdown-content li {
padding-top: 0.4rem;
}
.fa-2x > .emoji-img {
width: 2.3rem !important;
height: 2.3rem !important;

View File

@ -83,6 +83,8 @@ onmessage = function(e) {
ipc.send('log', e.data[1])
} else if (e.data[0] == 'twitterLogin') {
ipc.send('twitterLogin', e.data[1])
} else if (e.data[0] == 'textareaContextMenu') {
ipc.send('textareaContextMenu', e.data[1])
}
}
//version.js
@ -236,3 +238,9 @@ ipc.on('accessibility', function(event, arg) {
ipc.on('twitterLoginComplete', function(event, arg) {
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) {
var selectedText = window.getSelection().toString()
if (mode == 'open') {
$('#pageSrc').removeClass('hide')
} else if (mode == 'close') {
if(!selectedText) {
$('#pageSrc').addClass('hide')
$('#pageSrc').removeClass('keep')
}
} else {
$('#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) {
$('#pageSrc').addClass('hide')
$('#pageSrc').removeClass('keep')
var q = $('#pageSrcInput').val()
var q = $('.srcQ').text()
if(type == 'web') {
var start = localStorage.getItem('srcUrl')
if(!start) {
@ -356,5 +336,9 @@ function doSrc(type) {
postMessage(["openUrl", start], "*")
} else if(type == 'ts') {
tsAdd(q)
} else if(type == 'copy') {
execCopy(q)
} else if(type == 'toot') {
brInsert(q)
}
}

View File

@ -1,13 +1,11 @@
// Create the Application's main menu
function templete(lang, mainWindow, packaged, dir, dirname) {
//フレーム
if(lang !="ja" && lang != "en"){
if (lang != "ja" && lang != "en") {
lang = "en"
}
const electron = require("electron");
const ipc = electron.ipcMain;
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const electron = require("electron")
const { Menu, MenuItem, ipcMain, BrowserWindow, app } = electron
const join = require('path').join;
const dict = {
"application": {
@ -71,7 +69,7 @@ function templete(lang, mainWindow, packaged, dir, dirname) {
"en": "Close"
}
}
if(packaged){
if (packaged) {
var ifDev = [
{
label: dict.reload[lang],
@ -79,12 +77,12 @@ function templete(lang, mainWindow, packaged, dir, dirname) {
click: function () { mainWindow.reload(); }
}
]
}else{
} else {
var ifDev = [
{
label: 'Toggle Developer Tools',
accelerator: 'Alt+Command+I',
click: function () { if (!packaged) { mainWindow.toggleDevTools(); } }
click: function () { mainWindow.toggleDevTools(); }
},
{
label: dict.reload[lang],
@ -104,7 +102,7 @@ function templete(lang, mainWindow, packaged, dir, dirname) {
webviewTag: false,
nodeIntegration: false,
contextIsolation: true,
preload: join(dirname , "js", "platform", "preload.js")
preload: join(dirname, "js", "platform", "preload.js")
},
width: 300, height: 500,
"transparent": false, // ウィンドウの背景を透過
@ -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;
}

View File

@ -36,13 +36,11 @@
<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>
<div id="pageSrc" class="hide z-depth-5">
<input type="text" id="pageSrcInput" placeholder="@@search@@" />
<button class="btn waves-effect" onclick="doSrc('web')" title="@@webSrc@@">
<i class="material-icons">open_in_browser</i>
</button>
<button class="btn waves-effect" onclick="doSrc('ts')" title="@@tsSrc@@">
<i class="material-icons">chat</i>
</button>
<div class="srcQ"></div>
<div class="pageSrcBtn pointer" onclick="doSrc('web')">@@webSrc@@</div>
<div class="pageSrcBtn pointer" onclick="doSrc('ts')">@@tsSrc@@</div>
<div class="pageSrcBtn pointer" onclick="doSrc('copy')">@@copy@@</div>
<div class="pageSrcBtn pointer lastPSB" onclick="doSrc('toot')">@@toot@@</div>
</div>
<div id="offline" class="hide">
@@nowOffline@@
@ -571,11 +569,17 @@
<a go="#his-follower-list" title="@@follower@@" class="btn anc-link waves-effect"><i
class="material-icons">people</i>←@@follower@@</a>
<a go="#his-fav-list" title="@@favRegist@@"
class="btn only-my-data anc-link waves-effect"><i
class="material-icons">star</i>@@favRegist@@</a>
class="btn only-my-data anc-link waves-effect">
<i class="material-icons">star</i>@@favRegist@@</a>
<a class="dropdown-trigger btn waves-effect" href="#" data-target="hisdropdown"><i
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 -->
<ul id="hisdropdown" class="dropdown-content">
<li class="anc-link only-his-data" go="#his-list">
@ -612,9 +616,6 @@
</ul>
</div>
<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>
<button class="btn waves-effect " style="width:100%; padding:0;"
onclick="utlShow('--now','more')">
@ -893,43 +894,43 @@
<input type="hidden" value="local" id="type-sel" />
@@showThisTL@@
<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>
<span>@@local@@</span>
</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>
<span>@@localMedia@@</span>
</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>
<span>@@home@@</span>
</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>
<span>@@fed@@</span>
</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>
<span>@@fedMedia@@</span>
</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>
<span>@@dm@@</span>
</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>
<span>@@integratedTLDes@@</span>
</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>
<span>@@localPlusDes@@</span>
</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>
<span>@@notf@@</span>
</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>
<span>@@bookmark@@</span>
</a>
@ -955,7 +956,7 @@
<select id="src-acct-sel" class="acct-sel" onchange="trend()"></select>
</div>
<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>
<button class="btn waves-effect indigo" style="width: 36%;padding: 0;padding-left: 1.15rem;"
onclick="src()" data-trans-i="src">
@ -1023,7 +1024,7 @@
<br /><br />
<div id="lists"></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()">
@@makeNew@@
</button>

View File

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

View File

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

View File

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