This repository has been archived by the owner on Nov 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save work and prepare for pre-release 0.1.
- Loading branch information
Zhongyi Tong
committed
Feb 18, 2016
1 parent
947424e
commit 1133567
Showing
13 changed files
with
182 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.DS_Store | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# CHANGELOG | ||
|
||
**v0.1 (2016.02.19)** | ||
|
||
1. Create the project. | ||
2. Auto resize web content. | ||
3. Drag to send pictures. | ||
4. Open inhibited links without additional redirect. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,39 @@ | ||
# electron-quick-start | ||
# WeChat Electron | ||
|
||
**Clone and run for a quick way to see an Electron in action.** | ||
**A better WeChat client on Mac OS X.** | ||
|
||
This is a minimal Electron application based on the [Quick Start Guide](http://electron.atom.io/docs/latest/tutorial/quick-start) within the Electron documentation. | ||
This is an ***unofficial*** client wrapped with Electron. The web app embedded inside is from the official WeChat team. | ||
|
||
A basic Electron application needs just these files: | ||
## Features | ||
|
||
- `index.html` - A web page to render. | ||
- `main.js` - Starts the app and creates a browser window to render HTML. | ||
- `package.json` - Points to the app's main file and lists its details and dependencies. | ||
- Modern UI and full features from the Web platform. | ||
- Auto resize window. | ||
- Drag-to-send pictures. | ||
- Open inhibited websites without redirects (including taobao.com, etc). | ||
|
||
You can learn more about each of these components within the [Quick Start Guide](http://electron.atom.io/docs/latest/tutorial/quick-start). | ||
 | ||
|
||
## To Use | ||
## How To Use | ||
|
||
To clone and run this repository you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line: | ||
|
||
```bash | ||
``` bash | ||
# Clone this repository | ||
git clone https://github.com/atom/electron-quick-start | ||
git clone https://github.com/geeeeeeeeek/wechat-electron | ||
# Go into the repository | ||
cd electron-quick-start | ||
cd wechat-electron | ||
# Install dependencies and run the app | ||
npm install && npm start | ||
``` | ||
|
||
Learn more about Electron and its API in the [documentation](http://electron.atom.io/docs/latest). | ||
**Or**, if electron has already been installed, you can simply type: | ||
|
||
#### License [CC0 (Public Domain)](LICENSE.md) | ||
``` bash | ||
electron . | ||
``` | ||
|
||
#### Download App | ||
|
||
If you only cares about the app, you can find it out in the [release](https://github.com/geeeeeeeeek/wechat-electron/releases) section. | ||
|
||
#### License [MIT](LICENSE.md) |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"osx" : { | ||
"title": "Wechat Electron", | ||
"background": "icon.png", | ||
"icon": "icon.icns", | ||
"icon-size": 80, | ||
"contents": [ | ||
{ "x": 438, "y": 344, "type": "link", "path": "/Applications" }, | ||
{ "x": 192, "y": 344, "type": "file" } | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict'; | ||
|
||
const electron = require('electron'); | ||
const app = electron.app; | ||
const BrowserWindow = electron.BrowserWindow; | ||
|
||
let mainWindow; | ||
|
||
function createWindow () { | ||
mainWindow = new BrowserWindow({ | ||
title: 'WeChat', | ||
width: 800, | ||
height: 600, | ||
resizable: true, | ||
center: true, | ||
show: true, | ||
frame: true, | ||
icon: 'icon.png' | ||
}); | ||
|
||
mainWindow.loadURL('file://' + __dirname + '/index.html'); | ||
|
||
mainWindow.webContents.on('will-navigate', ev => { | ||
ev.preventDefault(); | ||
}); | ||
|
||
mainWindow.on('closed', function() { | ||
mainWindow = null; | ||
app.quit(); | ||
}); | ||
} | ||
|
||
app.on('ready', createWindow); | ||
|
||
app.on('window-all-closed', function () { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
app.on('activate', function () { | ||
if (mainWindow === null) { | ||
createWindow(); | ||
} | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
"use strict"; | ||
|
||
const shell = require('electron').shell; | ||
|
||
const wechatCSS = ` | ||
div.main { | ||
height: 100% !important; | ||
min-height: 0 !important; | ||
padding-top: 0 !important; | ||
} | ||
div.main_inner { | ||
max-width: none !important; | ||
min-width: 0 !important; | ||
} | ||
div.message_empty { | ||
margin-top: 50px; | ||
} | ||
div.img_preview_container div.img_opr_container { | ||
bottom: 50px !important; | ||
} | ||
p.copyright { | ||
display: none !important | ||
} | ||
a.web_wechat_screencut { | ||
display: none !important; | ||
} | ||
* { | ||
-webkit-user-select: none; | ||
} | ||
pre, span, p { | ||
-webkit-user-select: initial; | ||
} | ||
`; | ||
|
||
const loginCSS = ` | ||
div.login_box { | ||
top: initial; | ||
left: initial; | ||
margin-left: initial; | ||
margin-top: initial; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
div.login { | ||
min-width: 0; | ||
min-height: 0; | ||
width: 100%; | ||
height: 100%; | ||
overflow: hidden; | ||
} | ||
div.lang, div.copyright { | ||
display: none !important | ||
} | ||
`; | ||
|
||
let getParameterByName = (url, name) => { | ||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); | ||
let regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), | ||
results = regex.exec(url); | ||
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); | ||
} | ||
|
||
onload = () => { | ||
let webview = document.getElementById("webview"); | ||
|
||
webview.addEventListener('dom-ready', () => { | ||
webview.insertCSS(wechatCSS); | ||
webview.insertCSS(loginCSS); | ||
webview.executeJavaScript('injectJS.getBadge()'); | ||
}); | ||
|
||
webview.addEventListener('new-window', (e) => { | ||
let url = getParameterByName(e.url, 'requrl'); | ||
if (url.length > 1) { | ||
shell.openExternal(url); | ||
} else { | ||
shell.openExternal(e.url); | ||
} | ||
}) | ||
|
||
webview.addEventListener('new-window', function (e) { | ||
var url = getParameterByName(e.url, 'requrl'); | ||
if (url.length > 1) { | ||
shell.openExternal(url); | ||
} else { | ||
shell.openExternal(e.url); | ||
} | ||
}) | ||
}; |