This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
appcat
/
dtalk-app
Archived
1
0
Fork 0

钉钉Linux版

master
宇天 2017-06-09 19:28:19 +08:00
commit ad3a1d37d7
6 changed files with 233 additions and 0 deletions

21
Readme.md Normal file
View File

@ -0,0 +1,21 @@
# 钉钉App - Linux版
> `非官方版`
> 该版本用nwjs基于网页版钉钉封装而成, 通过js注入的方式,实现记住密码(自动登录)功能,
> 关闭驻留,最小化到托盘等实用功能。
该修改版并不对钉钉现有功能进行任何的修改,也不收集任何信息。
代码量很少, 而且完全开源, 请放心使用。
## 使用方法
> 下载nwjs,编译运行,或直接使用nwjs运行。
> nwjs具体方法请自行"网上搜索答案"
**注:** 本程序只是为了方便个人使用而进行的封装, 现在应网友要求上传到github供学习参考之用, 请勿用于非法途径, 由此产生的一切后果与本人无关。

15
blank.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="/css/base.css">
<style type="text/css">
body {overflow:hidden;position:absolute;width:100%;height:100%;}
.webview {display:block;width:100%;height:100%;}
</style>
</head>
<body>
</body>
</html>

47
css/base.css Normal file
View File

@ -0,0 +1,47 @@
@charset "UTF-8";
/**
*
* @authors yutent (yutent@doui.cc)
* @date 2014-10-10 00:45:09
*
* douiCSS
*
* ,
* do-st-*
* do-fn-*
* do-mod-modname
* UIdo-uiname, .do-uiname
* .do-layer .body { ... }
*
*
* 1 display float position overflow z-index /
* 2 width height margin padding border
* 3 line-height font-size vertical-align text-align user-select outline ....
* 4 color background opacity cursor ...
* 5 content list-style quotes ...
*
*/
* {margin: 0;padding: 0;vertical-align: baseline;box-sizing:border-box;}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section,content {display: block;}
img {border:0;display:inline-block;}
ol, ul {list-style: none;}
blockquote, q {quotes: none;}
blockquote:before, blockquote:after,
q:before, q:after {content: '';content: none;}
table {border-collapse: collapse;border-spacing: 0;}
.do-fn-cl { *zoom: 1; }
.do-fn-cl:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; overflow:hidden;}
.do-fn-clear {clear:both;display:inline;}
.do-fn-show{display:block;}
.do-fn-hide{display:none;}
.do-fn-fl{float:left;}
.do-fn-fr{float:right;}
.do-fn-noselect {-webkit-touch-callout: none;-webkit-user-select: none;-moz-user-select: none;user-select: none;}
.do-fn-noselect img, .do-fn-noselect a {-webkit-user-drag:none;}
.do-fn-ell {overflow:hidden; white-space:nowrap; text-overflow:ellipsis }
.do-st-thin {-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
.do-st-hand {cursor:pointer;}

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

122
index.html Normal file
View File

@ -0,0 +1,122 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="stylesheet" type="text/css" href="/css/base.css">
<style type="text/css">
body {overflow:hidden;position:absolute;width:1000px;height:662px;}
.webview {display:block;width:1000px;height:602px;}
</style>
</head>
<body>
<webview class="webview" src="https://im.dingtalk.com" partition="persist:googlepluswidgets"></webview>
<script type="text/javascript">
let win = nw.Window.get();
let $wv = document.querySelector('.webview');
let tray = new nw.Tray({ title: '钉钉', icon: 'icon.png' });
let menu = new nw.Menu();
let show = new nw.MenuItem({label: '显示钉钉'})
let quit = new nw.MenuItem({label: '退出钉钉'})
show.click = function(){
win.show()
}
quit.click = function(){
win.close(true)
}
menu.append(show)
menu.append(quit)
tray.menu = menu
tray.on('click', function(){
win.show()
})
$wv.addEventListener('permissionrequest', function(ev) {
ev.request.allow();
});
function dialog(o, ev){
let res = o[ev.messageType](ev.messageText)
if(ev.messageType === 'confirm' || ev.messageType === 'prompt'){
if(res){
ev.dialog.ok(res);
}else{
ev.dialog.cancel();
}
}
}
$wv.addEventListener('dialog', function(ev) {
dialog(window, ev)
});
$wv.addEventListener('newwindow', function(ev){
ev.preventDefault();
if(ev.targetUrl !== 'about:blank'){
nw.Window.open(ev.targetUrl, {width: 1200, height: 700, resizable: true})
}else{
let elem = document.createElement('webview');
elem.className = 'webview';
elem.addEventListener('permissionrequest', function(ev) {
ev.request.allow();
});
elem.setAttribute('partition', 'persist:googlepluswidgets')
ev.window.attach(elem)
nw.Window.open('blank.html', {width: 1200, height: 700, resizable: true, title: '钉钉邮箱'}, function(w){
elem.addEventListener('dialog', function(ev) {
dialog(w.window, ev)
});
w.window.addEventListener('load', function(){
w.window.document.body.appendChild(elem)
})
})
}
})
$wv.addEventListener('contentload', function(ev){
$wv.executeScript({ code: `
nw.gui = nw.gui || nw;
let pwd = localStorage.getItem("pwd") || ''
localStorage.setItem("isBeepOpen", "true");
localStorage.setItem("notification", "true");
localStorage.setItem("newUserState", "secTip");
document.querySelectorAll('.tab-items li')[1].click()
let $form = document.querySelector('form[name=passwordForm]'), $pwd;
for(let i = 0,el;el = $form.elements[i++];){
if(el.type === 'password'){
$pwd = el;
el.value = pwd;
if(el.value){
let ev = document.createEvent('Event')
ev.initEvent('change', false, false)
el.dispatchEvent(ev);
}
}else if(el.type === 'submit'){
el.onclick = function(){
localStorage.setItem('pwd', $pwd.value)
}
// el.click()
}
}
`});
})
win.on('close', function(ev){
this.hide()
})
win.on('maximize', function(ev){
this.restore()
})
</script>
</body>
</html>

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "dtalk",
"main": "index.html",
"domain": "localhost",
"version": "3.2.3",
"description": "钉钉-Linux版",
"window": {
"title": "钉钉-Linux版",
"width": 1000,
"height": 602,
"max_width": 1000,
"max_height": 602,
"min_width": 1000,
"min_height": 602,
"as_desktop": true,
"resizable": false,
"show_in_taskbar": true,
"icon": "icon.png"
},
"webview": {
"partitions": [
{
"name": "trusted",
"accessible_resources": [ "<all_urls>" ]
}
]
}
}