File tree Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Expand file tree Collapse file tree 3 files changed +18
-8
lines changed Original file line number Diff line number Diff line change 3131 */
3232
3333/*jshint eqeqeq:true, forin:true, strict:true */
34- /*global chrome, console */
34+ /*global browser, chrome, console */
3535
3636( function ( ) {
3737
4747 TYPE_NULL = 6
4848 ;
4949
50+ function getBrowser ( ) {
51+ return typeof browser !== 'undefined' ? browser : chrome ;
52+ }
53+
5054 // Utility functions
5155 function removeComments ( str ) {
5256 str = ( '__' + str + '__' ) . split ( '' ) ;
395399 }
396400
397401 // Listen for requests from content pages wanting to set up a port
398- chrome . extension . onConnect . addListener ( function ( port ) {
402+ getBrowser ( ) . runtime . onConnect . addListener ( function ( port ) {
399403
400404 if ( port . name !== 'jf' ) {
401405 console . log ( 'JSON Formatter error - unknown port name ' + port . name , port ) ;
Original file line number Diff line number Diff line change 3131 */
3232
3333/*jshint eqeqeq:true, forin:true, strict:true */
34- /*global chrome, console */
34+ /*global browser, chrome, console */
3535
3636( function ( ) {
3737
3838 "use strict" ;
3939
40+ function getBrowser ( ) {
41+ return typeof browser !== 'undefined' ? browser : chrome ;
42+ }
43+
4044 var jfContent ,
4145 pre ,
4246 jfStyleEl ,
5155
5256 // Open the port "jf" now, ready for when we need it
5357 // console.time('established port') ;
54- port = chrome . extension . connect ( { name : 'jf' } ) ;
58+ port = getBrowser ( ) . runtime . connect ( { name : 'jf' } ) ;
5559
5660 // Add listener to receive response from BG when ready
5761 port . onMessage . addListener ( function ( msg ) {
Original file line number Diff line number Diff line change 11{
22 "name" : " JSON Formatter" ,
3- "version" : " 0.6.0 " ,
3+ "version" : " 0.6.1 " ,
44 "manifest_version" : 2 ,
55 "description" : " Makes JSON easy to read. Open source." ,
6- "homepage_url" : " https://github.com/callumlocke/json-formatter" ,
7- "minimum_chrome_version" : " 21" ,
6+ "homepage_url" : " https://github.com/nikrolls/json-formatter" ,
7+ "author" : " Nik Rolls, Callum Locke" ,
8+ "minimum_edge_version" : " 38" ,
89 "icons" : {
910 "128" : " icons/128.png" ,
1011 "32" : " icons/32.png"
1112 },
1213 "background" : {
13- "scripts" : [" js/background.js" ]
14+ "scripts" : [" js/background.js" ],
15+ "persistent" : false
1416 },
1517 "content_scripts" : [
1618 { "matches" : [" <all_urls>" ], "js" : [" js/content.js" ], "run_at" : " document_start" }
You can’t perform that action at this time.
0 commit comments