Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Redo preventBlink in WebView with textContent instead of innerHTML.
Browse files Browse the repository at this point in the history
If it ever comes up again, look into Trusted Types to set the value.

Fixes #287.
  • Loading branch information
TheGoddessInari committed Nov 19, 2021
1 parent d86d4ef commit 297f0f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/ux/WebView.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,13 @@ Ext.define('Hamsket.ux.WebView',{

// Prevent Title blinking (some services have) and only allow when the title have an unread regex match: "(3) Title"
if ( Ext.getStore('ServicesList').getById(me.record.get('type')).get('titleBlink') ) {
const js_preventBlink = `const originalTitle=document.title;Object.defineProperty(document,"title",{configurable:!0,set(a){null===a.match(new RegExp("[(]([0-9•]+)[)][ ](.*)","g"))&&a!==originalTitle||(document.getElementsByTagName("title")[0].innerHTML=a)},get:()=>document.getElementsByTagName("title")[0].innerHTML});`;
js_inject += js_preventBlink;
const js_preventBlink = `const originalTitle=document.title;Object.defineProperty(document,"title",{configurable:!0,set(a){null===a.match(new RegExp("[(]([0-9•]+)[)][ ](.*)","g"))&&a!==originalTitle||(document.getElementsByTagName("title")[0].textContent=a)},get:()=>document.getElementsByTagName("title")[0].textContent});`;
js_inject += '{' + js_preventBlink + '}';
}


// Scroll always to top (bug)
js_inject += 'document.body.scrollTop=0;';
js_inject += '{document.body.scrollTop=0;}';

// Handles Certificate Errors
me.getWebContents().on('certificate-error', function(event, url, error, certificate, callback) {
Expand Down

0 comments on commit 297f0f0

Please sign in to comment.