Beispiel #1
0
 skip = function ( key, silent ) {
     console.error('skip site', key, silent);
     Sites.get('skipped')[ key ] = {
         time: _bt.getTimestamp()
     };
     Sites.save();
 },
Beispiel #2
0
            detect = function ( key, site, silent ) {
                console.error('detect in sites.js', key, site, silent);
                //remove site from skip list
                var skipped = Sites.get('skipped');
                delete skipped[ key ];

                Sites.get('detected')[ key ] = {
                    time: _bt.getTimestamp(),
                    data: site
                };

                if ( !silent ) {
                    send();
                    observer.trigger( 'detected', site );
                }
                Sites.save();
            },
Beispiel #3
0
        var init = function () {
                if ( !inited ) {
                    inited = true;

                    //getting manifest info is a special case for storage.  
                    //it is loaded to run this sandbox tab, so don't need
                    //to listen for any reset events to get data right away
                    var manifest = _sandbox.storage.load('sources').get('manifest');

                    //set some 'globals' -ish
                    Message = _sandbox.message;
                    observer = _sandbox.observer.load('sites');
                    //start the parser
                    Parser.init(); //could make this an observer event
                    parser_observer = _sandbox.observer.load('parser');

                    to_inject = manifest.cscripts.inject;

                    Sites = _sandbox.storage.load('sites', {
                        defaults: {
                            added:    {
                                archive: {
                                    data: {
                                        favicon: "http://www.archive-it.org/static/icons/logo_IA.png",
                                        hidden_els: {output : 'json', rows : '50', page : '1', 'fl[]' : 'identifier,title'},
                                        param: 'q',
                                        url: 'http://archive.org/advancedsearch.php'
                                    },
                                    time: _bt.getTimestamp()
                                },
                                btfc: {
                                    data: {
                                        //favicon: config.data_path + "app/img/16x16-bt-icon-purple.png",
                                        favicon: "../img/16x16-bt-icon-purple.png",
                                        // t = term, nr = number of results, th = threshold
                                        hidden_els: {},
                                        type: 'GET',
                                        url: config.app.btfc_url[ config.env ]
                                    },
                                    time: _bt.getTimestamp()
                                }
                            },
                            detected: {},
                            declined: {},
                            skipped:  {},
                            defaults: {
                                google: {
                                    data: {
                                        favicon: null,
                                        hidden_els: {},
                                        param: 'q',
                                        url: 'http://www.google.com/search'                                    
                                    },
                                    time: _bt.getTimestamp()
                                },
                                bing: {
                                    data: {
                                        favicon: null,
                                        hidden_els: {},
                                        param: 'q',
                                        url: 'http://www.bing.com/search'
                                    },
                                    time: _bt.getTimestamp()
                                },
                                yahoo: {
                                    data: {
                                        favicon: null,
                                        hidden_els: {},
                                        param: 'p',
                                        url: 'http://search.yahoo.com/search'
                                    },
                                    time: _bt.getTimestamp()
                                }
                            }
                        }
                    }).on('reset', notify_detected ); //push any detected sites to notifications

                    Tabs = _sandbox.tabs.init();

                    bind_events();

                    //temp clear sites while developing
                    // Sites.clear();

                    console.log('sites init', Tabs, Sites );
                }
            },