Changeset 6985


Ignore:
Timestamp:
Mar 9, 2018, 2:11:58 PM (20 months ago)
Author:
Juanma
Message:

Fix firefox first launch

Location:
lliurex-on-fire/trunk/fuentes
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • lliurex-on-fire/trunk/fuentes/chromium_addon/usr/share/chromium/extensions/akabjpjncgokcndehhncnbgginikpgdp.json

    r6891 r6985  
    11{
    22        "external_crx":"/usr/share/chromium/extensions/lliurex-on-fire.crx",
    3         "external_version":"0.1.0.1"
     3        "external_version":"0.1.0.7"
    44}
  • lliurex-on-fire/trunk/fuentes/chromium_addon/usr/share/google-chrome/extensions/akabjpjncgokcndehhncnbgginikpgdp.json

    r6892 r6985  
    11{
    22        "external_crx":"/usr/share/chromium/extensions/lliurex-on-fire.crx",
    3         "external_version":"0.1.0.1"
     3        "external_version":"0.1.0.7"
    44}
  • lliurex-on-fire/trunk/fuentes/lliurex-on-fire/lliurex_on_fire.js

    r6983 r6985  
    99var extra_bm_url_arr=Object.keys(extra_bm_url);
    1010var bm_treeNode=''
     11var max_tries=6
    1112
    1213function actionLog(e)
     
    2627function checkBookmarks(bm_item)
    2728{
     29        console.log("Lliurex-on-fire: check bm");
    2830        folder_id=bm_item.id;
    2931        lliurex_bm_url_arr.forEach(function loop(url){
     
    4345                                        });
    4446        },this);
     47        var query={'title':bm_folder_name};
     48        search=chrome.bookmarks.search(query,reload);
     49}
     50
     51function reload(bm_folder)
     52{
     53        if (! bm_folder[0])
     54        {
     55                if (max_tries)
     56                {
     57                        max_tries=max_tries-1;
     58                        chrome.runtime.reload();
     59                }
     60        }
    4561}
    4662
    4763function createBookmarksFolder(title)
    4864{
     65        console.log("Lliurex-on-fire: Add bm folder");
    4966        var bookmark_bar_id=0;
    5067        var bookmark_title='';
    5168        chrome.bookmarks.getTree(function(tree){
    52                 bookmark_bar_id=tree[0].children[0].id;
     69                bookmark_bar_id=""+tree[0].children[0].id;
    5370                bookmark_title=tree[0].children[0].title;
    54                 if (bookmark_bar_id==0)
     71                if (bookmark_bar_id=="menu________")
    5572                {
     73                        console.log("Lliurex-on-fire: Firefox toolbar");
    5674                        bookmark_bar_id='toolbar_____';
    5775                }
    58                 query={'title':""+bookmark_title};
    59                 chrome.bookmarks.search(query,wait_for_bm);
    60                 query={'title':title,'parentId':""+bookmark_bar_id};
    61                 bm_folder=chrome.bookmarks.create(query,function(newFolder){checkBookmarks(newFolder)});
     76                console.log("Lliurex-on-fire: Title "+bookmark_title+" id "+bookmark_bar_id);
     77                query={'title':title,'parentId':bookmark_bar_id};
     78                bm_folder=chrome.bookmarks.create(query,function(newFolder){checkBookmarks(newFolder)})
    6279                });
    63 }
    64 
    65 function sleep(ms)
    66 {
    67         return new Promise(resolve=>setTimeout(resolve,ms));
    68 }
    69 
    70 async function wait_for_bm(bm_folder)
    71 {
    72         if (! bm_folder[0])
    73         {
    74                 await sleep(100);
    75                 chrome.bookmarks.search(query,wait_for_bm);
    76         }
    7780}
    7881
     
    8386                checkBookmarks(bm_folder[0]);
    8487        } else {
     88                console.log("Lliurex-on-fire: Listener");
     89//              browser.bookmarks.onCreated.addListener(function(){createBookmarksFolder('Lliurex')});
    8590                createBookmarksFolder('LliureX');
    8691        }
     
    8893}
    8994
     95var search='';
    9096var query={'title':bm_folder_name};
    91 var search=chrome.bookmarks.search(query,processBookmarks);
     97console.log("Lliurex-on-fire: Init");
     98search=chrome.bookmarks.search(query,processBookmarks);
     99
  • lliurex-on-fire/trunk/fuentes/lliurex-on-fire/manifest.json

    r6983 r6985  
    33  "manifest_version": 2,
    44  "name": "LliurexOnFire",
    5   "version": "0.1.0.2",
     5  "version": "0.1.0.7",
    66
    77  "description": "Add custom settings for LliureX",
Note: See TracChangeset for help on using the changeset viewer.