Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
失焦处理改为可设置选项
Browse files Browse the repository at this point in the history
  • Loading branch information
kooritea committed Aug 4, 2018
1 parent b024594 commit 699e77f
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@

>34、修复右键复制无效问题(仅限文字消息,不包括链接)
>35、可以正确的使用是否允许多实例运行
>35、可以正确地使用是否允许多实例运行
<br>
<br>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electronic-wechat",
"version": "2.1.6",
"version": "2.1.7",
"description": "An Electron application for WeChat",
"main": "src/main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fi

ignore_list="dist|scripts|\.idea|.*\.md|.*\.yml|node_modules/nodejieba|install"

electron-packager . "${APP_NAME}" --platform=$PLATFORM --arch=$ARCH --electronVersion=2.0.0 --app-version=2.1.6 --asar --icon=assets/icon.icns --overwrite --out=./dist --ignore=${ignore_list}
electron-packager . "${APP_NAME}" --platform=$PLATFORM --arch=$ARCH --electronVersion=2.0.0 --app-version=2.1.7 --asar --icon=assets/icon.icns --overwrite --out=./dist --ignore=${ignore_list}

if [ $? -eq 0 ]; then
echo -e "$(tput setaf 2)Packaging for $PLATFORM $ARCH succeeded.$(tput sgr0)\n"
Expand Down
2 changes: 2 additions & 0 deletions src/common_en.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ Common.trayTitle = 'Tray Icon color (Black/White)';
Common.trayDesc = 'Select a color to match your desktop theme';
Common.proxyTitle = 'Set Proxy'
Common.proxyDesc = 'Select Proxy Mode'
Common.blurTitle = 'Blur Processing'
Common.blurDesc = 'Whether to go into suspended state when blur'

Common.UPGRADE = 'UPGRADE';
Common.FEEDBACK = 'FEEDBACK';
Expand Down
3 changes: 2 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class ElectronicWeChat {
}

initSetting(){
if (!AppConfig.readSettings('chat-area-offset-y')) {
if (!AppConfig.readSettings('blur')) {
AppConfig.saveSettings('language', AppConfig.readSettings('language')||'zh-CN');
AppConfig.saveSettings('prevent-recall', AppConfig.readSettings('prevent-recall')||'on');
AppConfig.saveSettings('icon', AppConfig.readSettings('icon')||'black');
Expand All @@ -64,6 +64,7 @@ class ElectronicWeChat {
AppConfig.saveSettings('proxy',AppConfig.readSettings('proxy')||'on')
AppConfig.saveSettings('proxy-url',AppConfig.readSettings('proxy-url')||'socks5://127.0.0.1:1080')
AppConfig.saveSettings('chat-area-offset-y',AppConfig.readSettings('chat-area-offset-y')||'0')
AppConfig.saveSettings('blur',AppConfig.readSettings('blur')||'on')
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/windows/controllers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ class SettingsWindow {
this.settingsWindow = null;
this.isShown = false;
});
// debug
// this.settingsWindow.once('ready-to-show', () => {
// this.settingsWindow.show();
// this.settingsWindow.toggleDevTools();
// });
}

Expand All @@ -55,7 +57,6 @@ class SettingsWindow {
}
this.settingsWindow.show();
this.isShown = true;
//this.settingsWindow.toggleDevTools();
}

hide() {
Expand Down
6 changes: 4 additions & 2 deletions src/windows/controllers/wechat.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@ class WeChatWindow {
});

this.wechatWindow.on('blur', () => {
this.isShown = false;
this.wechatWindow.webContents.send('hide-wechat-window');
if(AppConfig.readSettings('blur') === 'on'){
this.isShown = false;
this.wechatWindow.webContents.send('hide-wechat-window');
}
});

this.wechatWindow.on('resize',(event) => {
Expand Down
26 changes: 25 additions & 1 deletion src/windows/views/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="top-bar-middle">
<ul class="title-list">
<li>
<h1>Electronic Wechat V2.1.6</h1></li>
<h1>Electronic Wechat V2.1.7</h1></li>
<li>
<h1 style="font-size:95%;">Powered by Electron V<span id="top-title-electron-ver">process.versions.electron</span></h1></li>
</ul>
Expand Down Expand Up @@ -184,6 +184,22 @@ <h4 id="app-tray-desc">选择一个适合当前主题的颜色</h4>
</li>
</ul>
</section>
<section>
<ul>
<li class="menu-title">
<h3 id="app-blur-title">失焦处理</h3>
</li>
<li class="menu-desc">
<h4 id="app-blur-desc">在失去焦点的时候是否进入挂起状态</h4>
</li>
<li class="menu-button">
<select id="app-blur-select" onchange="changefun('blur')">
<option value="on">On</option>
<option value="off">Off</option>
</select>
</li>
</ul>
</section>
</div>

<script>
Expand All @@ -204,6 +220,7 @@ <h4 id="app-tray-desc">选择一个适合当前主题的颜色</h4>
const update = AppConfig.readSettings('update');
const proxy = AppConfig.readSettings('proxy');
const proxyURl = AppConfig.readSettings('proxy-url');
const blur = AppConfig.readSettings('blur');

const lanSelect = $('app-language-select');
const recallSelect = $('app-recall-select');
Expand All @@ -215,6 +232,7 @@ <h4 id="app-tray-desc">选择一个适合当前主题的颜色</h4>
const updateSelect = $('app-update-select');
const proxySelect = $('app-proxy-select');
const proxyInput = $('app-proxy-input');
const blurSelect = $('app-blur-select');

function $(id) {
return document.getElementById(id);
Expand Down Expand Up @@ -289,6 +307,9 @@ <h4 id="app-tray-desc">选择一个适合当前主题的颜色</h4>
$('app-proxy-input').style.display='none'
}
break
case 'blur':
AppConfig.saveSettings('blur', blurSelect.value)
break
}
}

Expand All @@ -304,6 +325,7 @@ <h4 id="app-tray-desc">选择一个适合当前主题的颜色</h4>
$('app-proxy-select').value = proxy;
$('app-proxy-input').value = proxyURl;
$('app-proxy-input').style.display = (proxy==='setProxy')?'block':'none'
$('app-blur-select').value = blur;
}

function setLocale() {
Expand All @@ -329,6 +351,8 @@ <h4 id="app-tray-desc">选择一个适合当前主题的颜色</h4>
$('app-tray-desc').innerHTML = Common.trayDesc;
$('upgrade-btn').innerHTML = Common.UPGRADE;
$('feedback-btn').innerHTML = Common.FEEDBACK;
$('app-blur-title').innerHTML = Common.blurTitle;
$('app-blur-desc').innerHTML = Common.blurDesc;
}

function setProxy(){
Expand Down

0 comments on commit 699e77f

Please sign in to comment.