Browse Source

Fixes #108

pull/116/merge
Ramiro Saenz 9 years ago
parent
commit
6eb143d9e2
  1. 22
      app/ux/WebView.js

22
app/ux/WebView.js

@ -59,6 +59,14 @@ Ext.define('Rambox.ux.WebView',{
,scope: me ,scope: me
,handler: me.reloadService ,handler: me.reloadService
} }
,{
text: localStorage.getItem('offline_'+me.id.replace('tab_', '')) ? 'Go Online' : 'Go Offline'
,glyph: 'xf0ac@FontAwesome'
,scope: me
,offline: localStorage.getItem('offline_'+me.id.replace('tab_', '')) ? true : false
,handler: me.setOffline
}
,'-'
,{ ,{
text: 'Toogle Developers Tools' text: 'Toogle Developers Tools'
,glyph: 'xf121@FontAwesome' ,glyph: 'xf121@FontAwesome'
@ -210,4 +218,18 @@ Ext.define('Rambox.ux.WebView',{
webview.executeJavaScript('(function() { Notification = originalNotification })();'); webview.executeJavaScript('(function() { Notification = originalNotification })();');
} }
} }
,setOffline: function(btn, e) {
var me = this;
var webview = me.down('component').el.dom;
console.log(btn, e);
console.info(me.type, 'Going '+ (!btn.offline ? 'offline' : 'online') + '...');
webview.getWebContents().session.setProxy({ proxyRules: !btn.offline ? 'offline' : '' }, Ext.emptyFn);
btn.offline = !btn.offline;
btn.setText(Ext.String.toggle(btn.text, 'Go Online', 'Go Offline'));
btn.offline ? localStorage.setItem('offline_'+me.id.replace('tab_', ''), true) : localStorage.removeItem('offline_'+me.id.replace('tab_', ''));
}
}); });

Loading…
Cancel
Save