There is some code I would like to set to NULL before a page has loaded possible turning this into a chrome extension or grease monkey script. Here is the code in question:
if (/*@cc_on!@*/false) {
document.onfocusin = onFocus;
document.onfocusout = onBlur;
} else {
window.onload = window.onfocus = onFocus;
window.onblur = onBlur;
}
}
function onBlur() {
var vidnowApp = document.getElementById("vidnow");
if (vidnowApp && vidnowApp.onAppDeactivate) {
vidnowApp.onAppDeactivate();
}
}
function onFocus() {
var vidnowApp = document.getElementById("vidnow");
if (vidnowApp && vidnowApp.onAppActivate) {
vidnowApp.onAppActivate();
}
}
What is the best solution to set onBlur to null so that onFocus is always set?
Do it ASAP (as in, in a script tag in body), but, focus the element you want to on the document being ready.