Skip to content

Commit

Permalink
定义RPC,加入chrome历史记录实时读取,修改readme
Browse files Browse the repository at this point in the history
  • Loading branch information
LikeNeko committed Jul 23, 2020
1 parent 19f53e2 commit a855344
Show file tree
Hide file tree
Showing 21 changed files with 7,302 additions and 348 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
12. `cron` 定时任务库引入
13. `Volume.js` 声音控制
14. 谷歌浏览器历史记录实时获取
15. sqlite3加入
15. `sqlite3`加入
16. 引入`openBES`弹幕系统
17. 快捷键`cmd+p`打开debug模式

## 项目开始

Expand All @@ -42,6 +44,7 @@
```git
# 项目根目录运行
git apply --ignore-whitespace patches/imap+0.8.19.patch
git apply --ignore-whitespace patches/applescript+1.0.0.patch
```

> tips
Expand Down Expand Up @@ -76,6 +79,14 @@ git apply --ignore-whitespace patches/imap+0.8.19.patch
![](https://raw.githubusercontent.com/LikeNeko/L2dPetForMac/master/images/2020-07-20-030601.png)

> cmd + p 打开关闭debug
![](https://raw.githubusercontent.com/LikeNeko/L2dPetForMac/master/images/Snipaste_2020-07-23_19-35-50.jpg)

> 弹幕
![](https://raw.githubusercontent.com/LikeNeko/L2dPetForMac/master/images/2020-07-23-114246.png)

> 左边是model模型,右边是model3模型 ps:实验性测试,结论是ok的
![图片](https://raw.githubusercontent.com/LikeNeko/L2dPetForMac/master/images/2020-07-02-094546.jpeg)
Expand Down
4 changes: 3 additions & 1 deletion app/RPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ let RPC = {
close_dev_tools:"close_dev_tools",
show_mtn:'show_mtn',
mail:'mail',
chrome_history:"chrome_history"
chrome_history:"chrome_history",
focus:"focus",// 获得焦点
is_debug:"is_debugs"
}
module.exports = {
RPC
Expand Down
5 changes: 4 additions & 1 deletion app/main/loads/IpcMainServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ ipcMain.on(RPC.open_dev_tools, (event, arg) => {
ipcMain.on(RPC.close_dev_tools, (event, arg) => {
main.webContents.closeDevTools()
})

ipcMain.on(RPC.focus,(event, args) => {
main.focus()
event.returnValue = 0;
})

14 changes: 11 additions & 3 deletions app/main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,22 @@ app.whenReady().then(() => {
// process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true'
loadServers()
// testNetwork();
app.dock.hide()
Chrome.begin();
global.main = main_window.createWindow()
menu.create_menu()

// 注册快捷键
// globalShortcut.register('CommandOrControl+Return', () => {
// })
let is_debug = Config.debug;
globalShortcut.register('CommandOrControl+P', () => {
if (is_debug){
is_debug = false;
main.webContents.send(RPC.is_debug,{state:0})
}else {
is_debug = true;
main.webContents.send(RPC.is_debug,{state:1})
main.webContents.openDevTools()
}
})
// 展示一个notify
// showNotification();

Expand Down
2 changes: 1 addition & 1 deletion app/main/main_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class main_window {
let file = path.join(path.renderer_views, 'index.html');
log(file)
mainWindow.loadFile(file).finally(function () {
mainWindow.show()
mainWindow.showInactive()
})


Expand Down
5 changes: 3 additions & 2 deletions app/main/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
let tray;
class menu {
static create_menu() {
app.dock.hide()
let icon_path = path.join(path.res,'/image/[email protected]')
tray = new Tray(icon_path)

Expand All @@ -26,8 +27,8 @@ class menu {
},

])
tray.setToolTip('This is my application.')
tray.setTitle("\u001b[34m")
// tray.setToolTip('This is my application.')
// tray.setTitle("\u001b[34m")
tray.setContextMenu(contextMenu)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function queue(promise_list) {
function queue(promise_list=[]) {
let res = [];
let sequence = Promise.resolve();
promise_list.forEach(function (item) {
Expand Down
94 changes: 94 additions & 0 deletions app/renderer/js/jquery.barrager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*!
*@name jquery.barrager.js
*@version 1.1
*@author [email protected]
*@url https://github.com/yaseng/jquery.barrager.js
*/
(function($) {

$.fn.barrager = function(barrage) {
barrage = $.extend({
close:true,
bottom: 0,
max: 10,
speed: 8,
color: '#fff',
old_ie_color : '#000000'
}, barrage || {});

var time = new Date().getTime();
var barrager_id = 'barrage_' + time;
var id = '#' + barrager_id;
var div_barrager = $("<div class='barrage' id='" + barrager_id + "'></div>").appendTo($(this));
var window_height = $(window).height() - 100;
var this_height = (window_height > this.height()) ? this.height() : window_height;
var window_width = $(window).width() + 500;
var this_width = (window_width > this.width()) ? this.width() : window_width;
var bottom = (barrage.bottom == 0) ? Math.floor(Math.random() * this_height + 40) : barrage.bottom;
div_barrager.css("bottom", bottom + "px");

div_barrager_box = $("<div class='barrage_box cl'></div>").appendTo(div_barrager);
if(barrage.img){

div_barrager_box.append("<a class='portrait z' href='javascript:;'></a>");
var img = $("<img src='' >").appendTo(id + " .barrage_box .portrait");
img.attr('src', barrage.img);
}
div_barrager_box.append(" <div class='z p'></div>");
if(barrage.close){

div_barrager_box.append(" <div class='close z'></div>");

}

var content = $("<a title='' href='' target='_blank'></a>").appendTo(id + " .barrage_box .p");
content.attr({
'href': barrage.href,
'id': barrage.id
}).empty().append(barrage.info);
if(navigator.userAgent.indexOf("MSIE 6.0")>0 || navigator.userAgent.indexOf("MSIE 7.0")>0 || navigator.userAgent.indexOf("MSIE 8.0")>0 ){

content.css('color', barrage.old_ie_color);

}else{

content.css('color', barrage.color);

}

var i = 0;
div_barrager.css('margin-right', 0);

$(id).animate({right:this_width},barrage.speed*1000,function(){

$(id).remove();
});

div_barrager_box.mouseover(function() {
$(id).stop(true);
});

div_barrager_box.mouseout(function() {

$(id).animate({right:this_width},barrage.speed*1000,function(){

$(id).remove();
});

});

$(id+'.barrage .barrage_box .close').click(function(){

$(id).remove();

})

}

$.fn.barrager.removeAll=function(){

$('.barrage').remove();

}

})(jQuery);
Loading

0 comments on commit a855344

Please sign in to comment.