Browse Source

Replace shipped js_unread with user js_unread if supplied.

Also go back to isolation between js_unread and custom_js as a result.
This counts as a FLAG DAY. js_unread NOT being used for badge updates
needs to be moved to custom_js.
If you don't want the host website to be able to access your
functions and variables, use block-scoped declarations such as 'let'
and 'const' instead of 'var'.
pull/3202/head
TheGoddessInari 7 years ago
parent
commit
dced9324e2
  1. 20
      app/ux/WebView.js

20
app/ux/WebView.js

@ -417,21 +417,18 @@ Ext.define('Rambox.ux.WebView',{
var js_inject = '';
var css_inject = '';
let js_injected = false;
// Injected code to detect new messages
if ( me.record ) {
let js_unread = Ext.getStore('ServicesList').getById(me.record.get('type')).get('js_unread');
js_unread += me.record.get('js_unread');
let js_unread = me.record.get('js_unread');
if (!js_unread) {
js_unread += Ext.getStore('ServicesList').getById(me.record.get('type')).get('js_unread');
}
if ( js_unread !== '' ) {
console.groupCollapsed(me.record.get('type').toUpperCase() + ' - JS Injected to Detect New Messages');
console.info(me.type);
console.log(js_unread);
console.groupEnd();
if (!js_injected) {
js_injected=true;
js_inject += '{';
}
js_inject += js_unread;
js_inject += '{' + js_unread + '}';
}
let custom_js = Ext.getStore('ServicesList').getById(me.record.get('type')).get('custom_js');
custom_js += me.record.get('custom_js');
@ -440,11 +437,7 @@ Ext.define('Rambox.ux.WebView',{
console.info(me.type);
console.log(custom_js);
console.groupEnd();
if (!js_injected) {
js_injected=true;
js_inject += '{';
}
js_inject += custom_js;
js_inject += '{' + custom_js + '}';
}
const custom_css_complex = me.record.get('custom_css_complex');
if (custom_css_complex === false) {
@ -458,7 +451,6 @@ Ext.define('Rambox.ux.WebView',{
css_inject += custom_css;
}
}
if (js_injected) js_inject += '}';
}
// Prevent Title blinking (some services have) and only allow when the title have an unread regex match: "(3) Title"

Loading…
Cancel
Save