This file ( 3kB ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
const remote = require('@electron/remote')
const p3xDarkInvertCss = 'img, video, image, svg image, picture, canvas, [style*="background-image"], [role="img"] { filter: invert(1) hue-rotate(180deg) !important; }';
const p3xDarkInvertJs = `
(function(enabled) {
var existing = document.getElementById('p3x-dark-invert-css');
if (existing) existing.remove();
if (enabled) {
var style = document.createElement('style');
style.id = 'p3x-dark-invert-css';
style.textContent = ${JSON.stringify(p3xDarkInvertCss)};
(document.head || document.documentElement).appendChild(style);
}
})`;
function p3xInjectDarkInvertAllFrames(webview, enabled) {
try {
const wc = remote.webContents.fromId(webview.getWebContentsId());
const frames = wc.mainFrame.framesInSubtree;
for (const frame of frames) {
try {
frame.executeJavaScript(`(${p3xDarkInvertJs})(${enabled})`);
} catch(e) {}
}
} catch(e) {}
}
const multiActions = (data) => {
const webview = global.p3x.onenote.webview;
switch (data.action) {
/*
case 'focus-save':
//console.log('focus-save')
webview.getWebContents().executeJavaScript(`window.p3xOnenoteActiveElement = document.activeElement; window.p3xIframe = document.getElementById('sdx_ow_iframe'); window.p3xIframeDoc = window.p3xIframe.contentDocument || window.p3xIframe.contentWindow.document; console.log(window.p3xIframeDoc.activeElement);`)
break;
*/
case 'focus':
// webview.openDevTools();
if (webview !== undefined) {
webview.focus()
/*
webview.getWebContents().executeJavaScript(`var a = 'foo'; Promise.resolve(a);`).then(result => {
console.log(result)
}).catch(e => console.error(e))
*/
//webview.getWebContents().executeJavaScript(`console.log(window.p3xOnenoteActiveElement)`)
//document.activeElement
}
break;
case 'restart':
//const session = webview.getWebContents().session;
const session = remote.webContents.fromId(webview.getWebContentsId()).session
session.clearStorageData().then(() => {
webview.reload()
})
break;
case 'home':
webview.src = global.p3x.onenote.url.notebooks
break;
case 'corporate':
webview.src = 'https://www.onenote.com/notebooks?auth=2'
break;
case 'get-location':
require('./multi-action/get-location')()
break;
case 'toast':
require('./multi-action/toast')(data)
break;
case 'dark-theme-invert':
document.body.classList.remove('p3x-dark-mode-invert-quirks')
if (data.darkThemeInvert === true) {
document.body.classList.add('p3x-dark-mode-invert-quirks')
}
if (webview !== undefined) {
p3xInjectDarkInvertAllFrames(webview, data.darkThemeInvert === true);
}
break;
}
}
module.exports = multiActions;