summaryrefslogtreecommitdiff
path: root/overrides/endless_private
diff options
context:
space:
mode:
authorWill Greenberg <will@endlessm.com>2014-07-10 18:56:03 -0700
committerWill Greenberg <will@endlessm.com>2014-07-10 18:56:03 -0700
commitde53c768b7315bfdd884871eb6f2699dbf0d9634 (patch)
treec18f79584b7ac617ff805b7d6757978629d3558a /overrides/endless_private
parent5b2cc64e43d16d0ac54fd2def0c5a821bb7391ea (diff)
Inject CSS at the committed event
We can inject CSS earlier than we can run javascript that expects a loaded DOM. COMMITTED is fired whenever data first starts being received, so we should be able to append the CSS style tags at that point [endlessm/eos-sdk#1622]
Diffstat (limited to 'overrides/endless_private')
-rw-r--r--overrides/endless_private/injectable_webview.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/overrides/endless_private/injectable_webview.js b/overrides/endless_private/injectable_webview.js
index 9cf30b5..41772d7 100644
--- a/overrides/endless_private/injectable_webview.js
+++ b/overrides/endless_private/injectable_webview.js
@@ -38,7 +38,7 @@ const InjectableWebview = new Lang.Class({
*/
inject_js_from_resource: function (js_uri) {
let js_str = this._read_gresource_file(js_uri);
- this._run_js_on_loaded_page(js_str);
+ this._run_js_on_loaded_page(js_str, WebKit2.LoadEvent.FINISHED);
},
/**
@@ -64,7 +64,7 @@ const InjectableWebview = new Lang.Class({
].join('\n').replace('CSS_TEXT', css_str.toSource());
// exec the javascript
- this._run_js_on_loaded_page(inject_css_script);
+ this._run_js_on_loaded_page(inject_css_script, WebKit2.LoadEvent.COMMITTED);
},
/**
@@ -90,12 +90,12 @@ const InjectableWebview = new Lang.Class({
// javascript on the page. Also attach a handler to run the javascript
// whenever the webview's load-changed indicates it's finished loading
// something
- _run_js_on_loaded_page: function (script) {
+ _run_js_on_loaded_page: function (script, event) {
if (this.uri !== null && !this.is_loading) {
this.run_javascript(script, null, null);
}
let handler = this.connect('load-changed', function (webview, status) {
- if (status == WebKit2.LoadEvent.FINISHED) {
+ if (status == event) {
this.run_javascript(script, null, null);
}
}.bind(this));