Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Browse like Xerces the God King of the Persians

Browse like Xerces the God King of the Persians

Historical fact: 2500 years ago Xerces, the God-King of the Persians, built an empire based entirely on Chrome Extensions. In this talk, we recreate history.

Mike MacCana

March 07, 2014
Tweet

More Decks by Mike MacCana

Other Decks in Technology

Transcript

  1. "Darius was an active emperor, busy with building programs in

    Persepolis, Susa, Egypt, and writing many Extensions in the Chrome Web Store." Wikipedia (retrieved just now)
  2. An extension Make a folder Make a manifest.js " c

    o n t e n t _ s c r i p t s " : [ { " m a t c h e s " : [ " h t t p : / / * / * " , " h t t p s : / / * / * " ] , " j s " : [ " j s / s u p e r a g e n t . j s " , " j s / e y e s . j s " ] , " r u n _ a t " : " d o c u m e n t _ e n d " } ] , Add some JS as a content script Load chrome:///extensions, click 'developer mode', pick folder
  3. Eye Size Calc v a r e y e S

    i z e = ( M a t h . s q r t ( M a t h . p o w ( e y e D i s t a n c e X , 2 ) + M a t h . p o w ( e y e D i s t a n c e Y , 2 ) ) ) / E Y E _ S I Z E _ T O _ D I S T A N C E _ R A T I O ;
  4. King of Persia King of Media Great King King of

    Kings King of Nations Fastest Typist
  5. Jumping the wall v a r i n j e

    c t J S F i l e = f u n c t i o n ( f i l e ) { v a r u r l = c h r o m e . e x t e n s i o n . g e t U R L ( f i l e ) ; v a r s c r i p t = d o c u m e n t . c r e a t e E l e m e n t ( ' s c r i p t ' ) ; s c r i p t . s r c = u r l ; d o c u m e n t . q u e r y S e l e c t o r ( ' h e a d ' ) . a p p e n d C h i l d ( s c r i p t ) ; } i n j e c t J S F i l e ( ' i n j e c t m e . j s ' ) In your manifest.json: " w e b _ a c c e s s i b l e _ r e s o u r c e s " : [ " i n j e c t m e . j s " ]
  6. Soon Chrome will have keyboard shortcuts for extensions So you

    can listen directly from the background app
  7. Make an API for anything with MutationSummary v a r

    o b s e r v e r = n e w M u t a t i o n S u m m a r y ( { c a l l b a c k : f u n c t i o n ( s u m m a r i e s ) { / / O n l y 1 q u e r y , s o o n l y o n e s u m m a r y . l o g ( ' s u m m a r y ' , s u m m a r i e s [ 0 ] ) s u m m a r i e s [ 0 ] . a d d e d . f o r E a c h ( f u n c t i o n ( a d d e d E l e m e n t ) { … } ) } , q u e r i e s : [ { e l e m e n t : ' s o m e e l e m e n t y p e . s o m e c l a s s ' } ] } ) ;
  8. Browsing tips from 2500 year old Zoroastrians: Change what you

    don't like Automate the stuff that bores you Control your data online Extend and control the web apps you use
  9. Thanks. @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana

    @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana @mikemaccana