Skip to content

Commit dd1d9b3

Browse files
committed
robo8x [chore] 12/31/2018, 5:46:52 PM
1 parent 1921dbf commit dd1d9b3

File tree

9 files changed

+128
-8
lines changed

9 files changed

+128
-8
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111

12-
# 📚 P3X Onenote Linux v2018.12.31-0
12+
# 📚 P3X Onenote Linux v2018.12.31-2
1313

1414

1515
This is an open-source project. Star this repository, if you like it, or even donate! Thank you so much! :)
@@ -161,7 +161,7 @@ Since Electron v3 the try click is executing the right click, for some reason.
161161

162162
---
163163

164-
[**P3X-ONENOTE**](https://pages.corifeus.com/onenote) Build v2018.12.31-0
164+
[**P3X-ONENOTE**](https://pages.corifeus.com/onenote) Build v2018.12.31-2
165165

166166
[![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)
167167

artifacts/npm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Though, I am using it, but some distros are different and I only use Linux Mint
2727

2828
---
2929

30-
[**P3X-ONENOTE**](https://pages.corifeus.com/onenote) Build v2018.12.31-0
30+
[**P3X-ONENOTE**](https://pages.corifeus.com/onenote) Build v2018.12.31-2
3131

3232
[![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact)
3333

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "p3x-onenote",
3-
"version": "2018.12.31-0",
3+
"version": "2018.12.31-2",
44
"description": "📚 P3X Onenote Linux",
55
"main": "src/electron/app.js",
66
"corifeus": {
@@ -38,15 +38,17 @@
3838
},
3939
"homepage": "https://pages.corifeus.com/onenote",
4040
"dependencies": {
41-
"electron": "^4.0.0",
41+
"@fortawesome/fontawesome-free": "^5.6.3",
4242
"angular": "^1.7.5",
4343
"angular-animate": "^1.7.5",
4444
"angular-aria": "^1.7.5",
4545
"angular-material": "^1.1.11",
4646
"angular-messages": "^1.7.5",
4747
"configstore": "^4.0.0",
4848
"corifeus-utils": "^2018.12.30-2",
49+
"electron": "^4.0.0",
4950
"electron-updater": "^4.0.6",
51+
"jquery": "^3.3.1",
5052
"opencollective": "^1.0.3",
5153
"semver": "^5.6.0",
5254
"typeface-roboto": "0.0.54"
@@ -83,4 +85,4 @@
8385
"type": "opencollective",
8486
"url": "https://opencollective.com/p3x-onenote"
8587
}
86-
}
88+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
#p3xr-overlay {
3+
z-index: 999999;
4+
font-size: 125%;
5+
position: fixed;
6+
left: 0;
7+
top: 0;
8+
width: 100vw;
9+
height: 100vh;
10+
text-align:center;
11+
/*Flexbox*/
12+
display: flex;
13+
flex-direction: column;
14+
align-items: center;
15+
align-content: center;
16+
justify-content: center;
17+
background-color: rgba(0, 0, 0, 0.9);
18+
z-index: 99999;
19+
color: rgba(128, 128, 128, 0.5);
20+
}
21+
22+
#p3xr-overlay i {
23+
font-size: 400% !important;
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
let shown = false
2+
let hideTimeout
3+
const ipc = require('electron').ipcRenderer;
4+
let showCount = 0
5+
6+
p3x.onenote.ui.overlay = new function() {
7+
const template = (options = {}) => {
8+
9+
return `
10+
<div id="p3xr-overlay">
11+
<div id="p3xr-overlay-info">
12+
<i class="fas fa-cog fa-spin fa-4x"></i>
13+
${options.hasOwnProperty('message') ? "<br/><br/>" : ''}
14+
${options.hasOwnProperty('message') ? options.message : ''}
15+
</div>
16+
</div>
17+
18+
`
19+
}
20+
21+
this.show = (options = {}) => {
22+
/*
23+
ipc.send('p3x-debug', {
24+
'overlay show': shown,
25+
})
26+
*/
27+
showCount++
28+
29+
if (showCount > 5) {
30+
require('../action/multi-actions')({
31+
action: 'home'
32+
})
33+
this.hide()
34+
}
35+
36+
if (shown) {
37+
return
38+
}
39+
shown = true
40+
///this.hide()
41+
//console.warn('p3xr.ui.overlay show')
42+
$body.append(template(options))
43+
}
44+
45+
this.hide = () => {
46+
47+
/*
48+
ipc.send('p3x-debug', {
49+
'overlay hide': 'done',
50+
})
51+
*/
52+
//console.warn('p3xr.ui.overlay hide')
53+
$body.find('#p3xr-overlay').remove()
54+
shown = false
55+
}
56+
}

src/electron/window/onenote/event/handler.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,22 @@ const handler = (options) => {
1010
// webview.insertCSS(window.cssData);
1111
});
1212
*/
13+
const allowedUrlRegex = /^((https?:\/\/((onedrive\.live\.com\/((redir\?resid\=)|((redir|edit).aspx\?)))|((www\.)?onenote\.com))|(about\:blank)))/i
14+
const disalledUrl = /^((https?:\/\/))/i
15+
1316

1417
setInterval(() => {
1518
//console.log(webview.src, global.p3x.onenote.root.p3x.onenote.location)
19+
20+
if (!allowedUrlRegex.test(webview.src) && (webview.src.startsWith('https://onedrive.live.com') || webview.src.startsWith('http://onedrive.live.com'))) {
21+
p3x.onenote.ui.overlay.show({
22+
message: p3x.onenote.lang.label.disallowedContent
23+
})
24+
} else {
25+
p3x.onenote.ui.overlay.hide()
26+
}
27+
28+
1629
if (global.p3x.onenote.root.p3x.onenote.location !== webview.src) {
1730
global.p3x.onenote.root.p3x.onenote.location = webview.src
1831
global.p3x.onenote.data.url = webview.src
@@ -23,7 +36,7 @@ const handler = (options) => {
2336

2437
/*
2538
webview.addEventListener('did-stop-loading', function(event) {
26-
webview.insertCSS(p3x.onenote.hackCss);
39+
// webview.insertCSS(p3x.onenote.hackCss);
2740
});
2841
2942
webview.addEventListener('will-navigate', function(event, url) {
@@ -42,10 +55,12 @@ const handler = (options) => {
4255
*/
4356

4457
webview.addEventListener('did-navigate', function(event, url) {
58+
/*
4559
ipc.send('p3x-debug', {
4660
'did-navigate': event,
4761
url: url,
4862
});
63+
*/
4964

5065
global.p3x.onenote.data.url = webview.src;
5166
ipc.send('p3x-onenote-save', global.p3x.onenote.data);
@@ -54,12 +69,13 @@ const handler = (options) => {
5469
global.p3x.onenote.root.$digest()
5570
});
5671

57-
const allowedUrlRegex = /^((https?:\/\/((onedrive\.live\.com\/redir\?resid\=)|((www\.)?onenote\.com))|(about\:blank)))/
5872
webview.addEventListener('new-window', function(event) {
73+
/*
5974
ipc.send('p3x-debug', {
6075
'new-window': event,
6176
allowed: allowedUrlRegex.test(event.url)
6277
})
78+
*/
6379
event.preventDefault()
6480
//console.log(event.url)
6581
if (allowedUrlRegex.test(event.url) ) {

src/electron/window/onenote/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<link rel="stylesheet" href="../../../../node_modules/angular/angular-csp.css">
1111
<link rel="stylesheet" href="../../../../node_modules/angular-material/angular-material.css">
1212
<link rel="stylesheet" href="./style.css">
13+
<link rel="stylesheet" href="./core/overlay.css ">
1314

1415
<!-- must be last -->
1516
<link rel="icon" type="image/png" href="../../images/256x256.png" />

src/electron/window/onenote/load.js

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
const { ipcRenderer } = require('electron');
22

3+
// fontawesome
4+
require('@fortawesome/fontawesome-free/js/all')
5+
6+
// jquery
7+
global.$ = require('jquery/dist/jquery.slim')
8+
global.jQuery = global.$
9+
310
/*
411
const fs = require('fs')
512
@@ -16,6 +23,9 @@ fs.readFile(__dirname + '/hack.css', 'utf-8', function(err, data) {
1623

1724
global.p3x = {
1825
onenote: {
26+
ui: {
27+
28+
},
1929
hackCss: undefined,
2030
ng:undefined,
2131
webview: undefined,
@@ -31,11 +41,21 @@ global.p3x = {
3141
}
3242
}
3343

44+
3445
document.title = `${global.p3x.onenote.lang.title} v${global.p3x.onenote.pkg.version}`;
3546

47+
48+
require('./core/overlay')
3649
require('./angular')
3750

3851
window.p3xOneNoteOnLoad = function() {
52+
53+
54+
$(() => {
55+
global.$body = $('body');
56+
})
57+
58+
3959
const webview = document.getElementById("p3x-onenote-webview");
4060
global.p3x.onenote.webview = webview;
4161
webview.focus()

src/translation/english/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const translation = {
2525
hide: 'Hide',
2626
copyLocation: 'Copy this location to the clipboard',
2727
copyLocationCopied: 'The location is copied to the clipboard.',
28+
disallowedContent: 'Disallowed content, soon redirecting to home ...'
2829
},
2930
dialog: {
3031
minimizationBehavior: {

0 commit comments

Comments
 (0)