Skip to content

Commit ce41626

Browse files
committed
Update Picviewer CE+.user.js
1 parent e5bd746 commit ce41626

File tree

1 file changed

+98
-96
lines changed

1 file changed

+98
-96
lines changed

Picviewer CE+/Picviewer CE+.user.js

Lines changed: 98 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// @description:ja 画像を強力に閲覧できるツール。ポップアップ表示、拡大・縮小、回転、一括保存などの機能を自動で実行できます
1313
// @description:pt-BR Poderosa ferramenta de visualização de imagens on-line, que pode pop-up/dimensionar/girar/salvar em lote imagens automaticamente
1414
// @description:ru Мощный онлайн-инструмент для просмотра изображений, который может автоматически отображать/масштабировать/вращать/пакетно сохранять изображения
15-
// @version 2025.4.11.1
15+
// @version 2025.4.14.1
1616
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAV1BMVEUAAAD////29vbKysoqKioiIiKysrKhoaGTk5N9fX3z8/Pv7+/r6+vk5OTb29vOzs6Ojo5UVFQzMzMZGRkREREMDAy4uLisrKylpaV4eHhkZGRPT08/Pz/IfxjQAAAAgklEQVQoz53RRw7DIBBAUb5pxr2m3/+ckfDImwyJlL9DDzQgDIUMRu1vWOxTBdeM+onApENF0qHjpkOk2VTwLVEF40Kbfj1wK8AVu2pQA1aBBYDHJ1wy9Cf4cXD5chzNAvsAnc8TjoLAhIzsBao9w1rlVTIvkOYMd9nm6xPi168t9AYkbANdajpjcwAAAABJRU5ErkJggg==
1717
// @namespace https://github.com/hoothin/UserScripts
1818
// @homepage https://github.com/hoothin/UserScripts/tree/master/Picviewer%20CE%2B
@@ -46,7 +46,7 @@
4646
// @grant GM.notification
4747
// @grant unsafeWindow
4848
// @require https://update.greasyfork.org/scripts/6158/23710/GM_config%20CN.js
49-
// @require https://update.greasyfork.org/scripts/438080/1552062/pvcep_rules.js
49+
// @require https://update.greasyfork.org/scripts/438080/1570604/pvcep_rules.js
5050
// @require https://update.greasyfork.org/scripts/440698/1427239/pvcep_lang.js
5151
// @downloadURL https://greasyfork.org/scripts/24204-picviewer-ce/code/Picviewer%20CE+.user.js
5252
// @updateURL https://greasyfork.org/scripts/24204-picviewer-ce/code/Picviewer%20CE+.meta.js
@@ -12333,7 +12333,7 @@ ImgOps | https://imgops.com/#b#`;
1233312333
sizeLimitOr:false,
1233412334

1233512335
keys: {
12336-
enable: true,
12336+
enable: false,
1233712337
actual: 'a', // 当出现悬浮条时按下 `a` 打开原图
1233812338
search: 's',
1233912339
current: 'c',
@@ -22434,25 +22434,14 @@ ImgOps | https://imgops.com/#b#`;
2243422434
},
2243522435
focusedKeydown:async function(e){
2243622436
var keyCode=e.keyCode;
22437+
if (!prefs.floatBar.keys.enable) return;
2243722438
if (this.data && this.data.img && e.key.toLowerCase() == prefs.floatBar.keys.download) {
2243822439
downloadImg(this.img.src, (this.data.img.title || this.data.img.alt), prefs.saveName);
2243922440
e.preventDefault();
2244022441
e.stopPropagation();
2244122442
return;
2244222443
}
22443-
var valid=[32,82,72,90,18,16,17,27,67,71];//有效的按键
22444-
if(valid.indexOf(keyCode)==-1) return;
22445-
22446-
e.preventDefault();
22447-
22448-
if(this.working){//working的时候也可以接受按下shift键,以便旋转的时候可以任何时候按下
22449-
if(keyCode==16){//shift键
22450-
this.shiftKeyUp=false;
22451-
};
22452-
return;
22453-
};
22454-
22455-
if (e.key == prefs.floatBar.keys.gallery) {
22444+
if (e.key.toLowerCase() == prefs.floatBar.keys.gallery) {
2245622445
if (!gallery) {
2245722446
gallery = new GalleryC();
2245822447
gallery.data = [];
@@ -22463,89 +22452,102 @@ ImgOps | https://imgops.com/#b#`;
2246322452
gallery.data = allData;
2246422453
gallery.load(gallery.data);
2246522454
this.remove();
22466-
} else {
22467-
switch(keyCode){
22468-
case 82:{//r键,切换到旋转工具
22469-
if(this.rKeyUp){
22470-
this.rKeyUp=false;
22471-
this.beforeTool=this.selectedTool;
22472-
if (this.beforeTool != 'rotate') {
22473-
this.selectTool('rotate');
22474-
}
22475-
var PI = Math.PI;
22476-
var value = this.rotatedRadians + (e.shiftKey ? -90 : 90) * PI / 180;
22477-
if (value >= 2 * PI) {
22478-
value -= 2 * PI;
22479-
} else if (value < 0) {
22480-
value += 2 * PI;
22481-
}
22482-
this.rotate(value,true);
22483-
};
22484-
}break;
22485-
case 72:{//h键,切换到抓手工具
22486-
if(this.hKeyUp){
22487-
this.hKeyUp=false;
22488-
this.beforeTool=this.selectedTool;
22489-
this.selectTool('hand');
22490-
};
22491-
}break;
22492-
case 90:{//z键,切换到缩放工具
22493-
if(this.zKeyUp){
22494-
this.zKeyUp=false;
22495-
this.beforeTool=this.selectedTool;
22496-
this.selectTool('zoom');
22497-
let level = e.shiftKey ? (this.zoomLevel - 0.5) : (this.zoomLevel + 0.5);
22498-
if (typeof level != 'undefined') {
22499-
this.zoom(level, { x: 0, y: 0});
22500-
}
22501-
if (uniqueImgWin && uniqueImgWin == this) {
22502-
if (prefs.floatBar.globalkeys.previewFollowMouse) {
22503-
this.followPos(uniqueImgWinInitX, uniqueImgWinInitY, true);
22504-
} else {
22505-
this.center(true, true);
22506-
}
22455+
e.preventDefault();
22456+
e.stopPropagation();
22457+
return;
22458+
}
22459+
var valid=[32,82,72,90,18,16,17,27,67];//有效的按键
22460+
if(valid.indexOf(keyCode)==-1) return;
22461+
22462+
e.preventDefault();
22463+
22464+
if(this.working){//working的时候也可以接受按下shift键,以便旋转的时候可以任何时候按下
22465+
if(keyCode==16){//shift键
22466+
this.shiftKeyUp=false;
22467+
};
22468+
return;
22469+
};
22470+
switch(keyCode){
22471+
case 82:{//r键,切换到旋转工具
22472+
if(this.rKeyUp){
22473+
this.rKeyUp=false;
22474+
this.beforeTool=this.selectedTool;
22475+
if (this.beforeTool != 'rotate') {
22476+
this.selectTool('rotate');
22477+
}
22478+
var PI = Math.PI;
22479+
var value = this.rotatedRadians + (e.shiftKey ? -90 : 90) * PI / 180;
22480+
if (value >= 2 * PI) {
22481+
value -= 2 * PI;
22482+
} else if (value < 0) {
22483+
value += 2 * PI;
22484+
}
22485+
this.rotate(value,true);
22486+
};
22487+
}break;
22488+
case 72:{//h键,切换到抓手工具
22489+
if(this.hKeyUp){
22490+
this.hKeyUp=false;
22491+
this.beforeTool=this.selectedTool;
22492+
this.selectTool('hand');
22493+
};
22494+
}break;
22495+
case 90:{//z键,切换到缩放工具
22496+
if(this.zKeyUp){
22497+
this.zKeyUp=false;
22498+
this.beforeTool=this.selectedTool;
22499+
this.selectTool('zoom');
22500+
let level = e.shiftKey ? (this.zoomLevel - 0.5) : (this.zoomLevel + 0.5);
22501+
if (typeof level != 'undefined') {
22502+
this.zoom(level, { x: 0, y: 0});
22503+
}
22504+
if (uniqueImgWin && uniqueImgWin == this) {
22505+
if (prefs.floatBar.globalkeys.previewFollowMouse) {
22506+
this.followPos(uniqueImgWinInitX, uniqueImgWinInitY, true);
22507+
} else {
22508+
this.center(true, true);
2250722509
}
22510+
}
22511+
};
22512+
}break;
22513+
case 32:{//空格键阻止,临时切换到抓手功能
22514+
if(this.spaceKeyUp){
22515+
this.spaceKeyUp=false;
22516+
if(this.selectedTool!='hand'){
22517+
this.tempHand=true;
22518+
this.changeCursor('hand');
2250822519
};
22509-
}break;
22510-
case 32:{//空格键阻止,临时切换到抓手功能
22511-
if(this.spaceKeyUp){
22512-
this.spaceKeyUp=false;
22513-
if(this.selectedTool!='hand'){
22514-
this.tempHand=true;
22515-
this.changeCursor('hand');
22520+
};
22521+
}break;
22522+
case 18:{//alt键,在当前选择是缩放工具的时候,按下的时候切换到缩小功能
22523+
if(this.altKeyUp){
22524+
if((this.selectedTool!='zoom' && !this.tempZoom) || this.zoomOut)return;
22525+
this.zoomOut=true;
22526+
this.altKeyUp=false;
22527+
this.changeCursor('zoom',true);
22528+
};
22529+
}break;
22530+
case 17:{//ctrl键临时切换到缩放工具
22531+
if(this.ctrlKeyUp){
22532+
var self=this;
22533+
this.ctrlkeyDownTimer=setTimeout(function(){//规避词典软件的ctrl+c,一瞬间切换到缩放的问题
22534+
self.ctrlKeyUp=false;
22535+
if(self.selectedTool!='zoom'){
22536+
self.tempZoom=true;
22537+
self.changeCursor('zoom');
2251622538
};
22517-
};
22518-
}break;
22519-
case 18:{//alt键,在当前选择是缩放工具的时候,按下的时候切换到缩小功能
22520-
if(this.altKeyUp){
22521-
if((this.selectedTool!='zoom' && !this.tempZoom) || this.zoomOut)return;
22522-
this.zoomOut=true;
22523-
this.altKeyUp=false;
22524-
this.changeCursor('zoom',true);
22525-
};
22526-
}break;
22527-
case 17:{//ctrl键临时切换到缩放工具
22528-
if(this.ctrlKeyUp){
22529-
var self=this;
22530-
this.ctrlkeyDownTimer=setTimeout(function(){//规避词典软件的ctrl+c,一瞬间切换到缩放的问题
22531-
self.ctrlKeyUp=false;
22532-
if(self.selectedTool!='zoom'){
22533-
self.tempZoom=true;
22534-
self.changeCursor('zoom');
22535-
};
22536-
},100);
22537-
};
22538-
}break;
22539-
case 67:{//c键
22540-
clearTimeout(this.ctrlkeyDownTimer);
22541-
}break;
22542-
case 27:{//ese关闭窗口
22543-
if(prefs.imgWindow.close.escKey){
22544-
this.remove();
22545-
};
22546-
}break;
22547-
default:break;
22548-
}
22539+
},100);
22540+
};
22541+
}break;
22542+
case 67:{//c键
22543+
clearTimeout(this.ctrlkeyDownTimer);
22544+
}break;
22545+
case 27:{//ese关闭窗口
22546+
if(prefs.imgWindow.close.escKey){
22547+
this.remove();
22548+
};
22549+
}break;
22550+
default:break;
2254922551
}
2255022552
e.stopPropagation();
2255122553
return false;

0 commit comments

Comments
 (0)