Skip to content

Instantly share code, notes, and snippets.

@jsbain
Created January 10, 2017 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsbain/85a26b89b01dfe9a488c4bdc6f6827c6 to your computer and use it in GitHub Desktop.
Save jsbain/85a26b89b01dfe9a488c4bdc6f6827c6 to your computer and use it in GitHub Desktop.
Untitled_112.py
import ui,console
def show_firebug(w,sender):
console.hud_alert('button')
w.eval_js('''
(function(F,i,r,e,b,u,g,L,I,T,E){
if(F.getElementById(b)){
// TODO: Figure out how to redisplay debugger
return;
}
E=F[i+'NS'] && F.documentElement.namespaceURI;
E=E?F[i+'NS'](E,'script'):F[i]('script');
E[r]('id',b);
E[r]('src',I+g+T);
E[r](b,u);
(F[e]('head')[0]||F[e]('body')[0]).appendChild(E);
E=new Image;
E[r]('src',I+L);
})(document,
'createElement',
'setAttribute',
'getElementsByTagName',
'FirebugLite',
'4',
'firebug-lite.js',
'releases/lite/latest/skin/xp/sprite.png',
'https://getfirebug.com/',
'#startOpened');''')
def main():
b=ui.ButtonItem()
b.title='Show Debugger'
b.action=lambda sender:show_firebug(w,sender)
w=ui.WebView()
w.load_url('http://getfirebug.com/firebug-lite.js')
w.right_button_items=b,
w.present()
return w
if __name__=='__main__':
w=main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment