This commit is contained in:
Mr. Stallion 2021-01-23 11:45:36 -06:00
parent 3f8d84803c
commit 450dadb486
5 changed files with 40 additions and 29 deletions

View File

@ -89,7 +89,7 @@
</select>
</div>
</modal>
<modal :buttons="false" ref="wordDefinitionViewer" dialogClass="w-100 word-definition-viewer">
<modal :buttons="false" ref="wordDefinitionViewer" dialogClass="word-definition-viewer">
<word-definition :expression="wordDefinitionLookup" ref="wordDefinitionLookup"></word-definition>
<template slot="title">
{{wordDefinitionLookup}}
@ -671,7 +671,7 @@
.word-definition-viewer {
.modal-content {
min-height: 60%;
min-height: 75%;
}
.definition-wrapper {

View File

@ -105,10 +105,6 @@
log.debug('init.window.languages');
await this.addTab();
log.debug('init.window.tab');
electron.ipcRenderer.on('settings', (_e: Event, settings: GeneralSettings) => {
this.settings = settings;
@ -116,7 +112,10 @@
log.transports.console.level = settings.risingSystemLogLevel;
});
electron.ipcRenderer.on('rising-upgrade-complete', () => { this.hasCompletedUpgrades = true; });
electron.ipcRenderer.on('rising-upgrade-complete', () => {
// console.log('RISING COMPLETE RECV');
this.hasCompletedUpgrades = true;
});
electron.ipcRenderer.on('allow-new-tabs', (_e: Event, allow: boolean) => this.canOpenTab = allow);
electron.ipcRenderer.on('open-tab', () => this.addTab());
electron.ipcRenderer.on('update-available', (_e: Event, available: boolean) => this.hasUpdate = available);
@ -172,6 +171,13 @@
document.addEventListener('click', () => this.activeTab!.view.webContents.focus());
window.addEventListener('focus', () => this.activeTab!.view.webContents.focus());
log.debug('init.window.listeners');
await this.addTab();
log.debug('init.window.tab');
// console.log('SORTABLE', Sortable);
Sortable.create(<HTMLElement>this.$refs['tabs'], {

View File

@ -238,7 +238,8 @@ function createWindow(): Electron.BrowserWindow | undefined {
// Temp fix -- manually override adblocker's preload script
// to point to CJS that has been copied over with config in webpack.config.js
const preloadScript = './preview/assets/adblocker/preload.cjs.js'; // require.resolve('@cliqz/adblocker-electron-preload');
// require.resolve('@cliqz/adblocker-electron-preload');
const preloadScript = path.join(electron.app.getAppPath(), './preview/assets/adblocker/preload.cjs.js');
// const originPath = require.resolve('@cliqz/adblocker-electron-preload');
// const preloadScript = path.resolve(path.dirname(originPath), 'preload.cjs.js');
@ -652,6 +653,7 @@ function onReady(): void {
});
electron.ipcMain.on('rising-upgrade-complete', () => {
// console.log('RISING COMPLETE SHARE');
hasCompletedUpgrades = true;
for(const w of electron.webContents.getAllWebContents()) w.send('rising-upgrade-complete');
});

View File

@ -44,15 +44,14 @@ export default class WordDefinition extends Vue {
mounted(): void {
const webview = this.getWebview();
webview.addEventListener(
'update-target-url', // 'did-navigate', // 'dom-ready',
(event: EventBusEvent) => {
const js = this.wrapJs(this.getMutator(this.mode));
const eventProcessor = async (event: EventBusEvent): Promise<void> => {
const js = this.wrapJs(this.getMutator(this.mode));
// tslint:disable-next-line
this.executeJavaScript(js, event);
}
);
return this.executeJavaScript(js, event);
};
webview.addEventListener('update-target-url', eventProcessor);
webview.addEventListener('dom-ready', eventProcessor);
}
@ -62,6 +61,10 @@ export default class WordDefinition extends Vue {
getWebUrl(): string {
if (!this.expression) {
return 'about:blank';
}
switch(this.mode) {
case 'dictionary':
return `https://www.dictionary.com/browse/${encodeURI(this.getCleanedWordDefinition())}`;

View File

@ -1,31 +1,31 @@
class FChatDefinitionMutator {
mutateDictionary() {
document.querySelectorAll('html')[0].setAttribute('style', 'border: 0 !important; padding: 0 !important; margin: 0 !important;');
document.querySelectorAll('body')[0].setAttribute('style', 'border: 0 !important; padding: 0 !important; margin: 0 !important;');
document.querySelectorAll('.app-base')[0].setAttribute('style', 'padding: 0 !important; margin: 0 !important;');
document.querySelectorAll('html, body').forEach(e => e.setAttribute('style', 'border: 0 !important; padding: 0 !important; margin: 0 !important;'));
document.querySelectorAll('.app-base').forEach(e => e.setAttribute('style', 'padding: 0 !important; margin: 0 !important;'));
document.querySelectorAll('header, footer, .serp-nav-button, aside, .sailthru-overlay-container, .bxc, #marketingBanner-right, #marketingBanner-right-button')
.forEach(e => e.setAttribute('style', 'display: none !important'));
const headword = document.querySelector('.entry-headword');
const parent = headword.parentElement.parentElement;
let el = headword.parentElement.nextElementSibling;
while (el) {
const dEl = el;
if (headword) {
const parent = headword.parentElement.parentElement;
let el = headword.parentElement.nextElementSibling;
el = el.nextElementSibling;
parent.removeChild(dEl);
while (el) {
const dEl = el;
el = el.nextElementSibling;
parent.removeChild(dEl);
}
}
}
mutateThesaurus() {
document.querySelectorAll('html')[0].setAttribute('style', 'border: 0 !important; padding: 0 !important; margin: 0 !important;');
document.querySelectorAll('body')[0].setAttribute('style', 'border: 0 !important; padding: 0 !important; margin: 0 !important;');
document.querySelectorAll('.app-base')[0].setAttribute('style', 'padding: 0 !important; margin: 0 !important;');
document.querySelectorAll('html, body').forEach(e => e.setAttribute('style', 'border: 0 !important; padding: 0 !important; margin: 0 !important;'));
document.querySelectorAll('.app-base').forEach(e => e.setAttribute('style', 'padding: 0 !important; margin: 0 !important;'));
document.querySelectorAll('header, footer, .serp-nav-button, aside, button, .sailthru-overlay-container, .bxc, #marketingBanner-right, #marketingBanner-right-button')
.forEach(e => e.setAttribute('style', 'display: none !important'));