diff --git a/bootstrap.js b/bootstrap.js index 20d93fe..a17392b 100644 --- a/bootstrap.js +++ b/bootstrap.js @@ -633,7 +633,24 @@ function updateOnPanelShowing(e, aDOMWindow, dontUpdateIni) { } /*if edit anything here make sure to copy updateOnPanelShowing*/ PUIsync = PanelUI.querySelector('#PanelUI-fxa-status'); + if (!PUIsync) { + Services.prompt.alert(null, self.name + ' - ' + 'Menu Creation Failed', 'Profilist will not work properly because the "Sync" button was not found. Profilist creates its menu by cloning this element.'); + return new Error('Profilist will not work properly because the "Sync" button was not found. Profilist creates its menu by cloning this element.'); + } var puisynch = PUIsync.boxObject.height; + if (puisynch == 0) { + //try to get height from 'PanelUI-footer-inner' + console.warn('cannot figure out puisynch height from PUIsync so trying PUIfi'); + var PUIfi = PanelUI.querySelector('#PanelUI-footer-inner'); + if (PUIfi) { + puisynch = PUIfi.boxObject.height; + console.log('puifi gave height of ' + puisynch); + } + } + if (puisynch == 0) { + console.warn('cannot figure out puisynch height from PUIsync OR PUIfi so just going with 38'); + puisynch = 38; + } if (puisynch != 0 && PUIsync_height != puisynch) { console.log('PUIsync_height updated == ' + puisynch); PUIsync_height = puisynch; @@ -774,8 +791,8 @@ function updateStackDOMJson_basedOnToolkit(dontUpdateStack, iDOMWindow) { //and console.log('stackDOMJson is 0 length', stackDOMJson); console.log('profToolkit=',profToolkit); stackDOMJson = [ - {nodeToClone:'PUIsync', identifier:'[label="Create New Profile"]', label:'Create New Profile', class:'PanelUI-profilist create', id:null, oncommand:null, status:null, tooltiptext:null, signedin:null, defaultlabel:null, errorlabel:null, addEventListener:['command',createUnnamedProfile,false], style:'-moz-appearance:none; padding:10px 0 10px 15px; margin-bottom:-1px; border-top:1px solid rgba(24,25,26,0.14); border-bottom:1px solid transparent; border-right:0 none rgb(0,0,0); border-left:0 none rgb(0,0,0);'}, - {nodeToClone:'PUIsync', identifier:'[path="' + ini[profToolkit.selectedProfile.name].props.Path + '"]', label:profToolkit.selectedProfile.name, class:'PanelUI-profilist', id:null, oncommand:null, tooltiptext:null, signedin:null, defaultlabel:null, errorlabel:null, status:'active', addEventListener:['command', makeRename, false], style:'-moz-appearance:none; padding:10px 0 10px 15px; margin-bottom:-1px; border-top:1px solid rgba(24,25,26,0.14); border-bottom:1px solid transparent; border-right:0 none rgb(0,0,0); border-left:0 none rgb(0,0,0);', props:{profpath:ini[profToolkit.selectedProfile.name].props.Path}} + {nodeToClone:'PUIsync', identifier:'[label="Create New Profile"]', label:'Create New Profile', class:'PanelUI-profilist create', hidden:null, id:null, oncommand:null, status:null, tooltiptext:null, signedin:null, defaultlabel:null, errorlabel:null, addEventListener:['command',createUnnamedProfile,false], style:'-moz-appearance:none; padding:10px 0 10px 15px; margin-bottom:-1px; border-top:1px solid rgba(24,25,26,0.14); border-bottom:1px solid transparent; border-right:0 none rgb(0,0,0); border-left:0 none rgb(0,0,0);'}, + {nodeToClone:'PUIsync', identifier:'[path="' + ini[profToolkit.selectedProfile.name].props.Path + '"]', label:profToolkit.selectedProfile.name, class:'PanelUI-profilist', hidden:null, id:null, oncommand:null, tooltiptext:null, signedin:null, defaultlabel:null, errorlabel:null, status:'active', addEventListener:['command', makeRename, false], style:'-moz-appearance:none; padding:10px 0 10px 15px; margin-bottom:-1px; border-top:1px solid rgba(24,25,26,0.14); border-bottom:1px solid transparent; border-right:0 none rgb(0,0,0); border-left:0 none rgb(0,0,0);', props:{profpath:ini[profToolkit.selectedProfile.name].props.Path}} ]; var profNamesCurrentlyInMenu = [ini[profToolkit.selectedProfile.name].props.Path]; stackUpdated = true; @@ -840,7 +857,7 @@ function updateStackDOMJson_basedOnToolkit(dontUpdateStack, iDOMWindow) { //and console.log('splicing p = ', ini[p], 'stackDOMjson=', stackDOMJson); stackUpdated = true; (function(pClosure) { - var objToSplice = {nodeToClone:'PUIsync', identifier:'[path="' + ini[pClosure].props.Path + '"]', label:p, class:'PanelUI-profilist', id:null, oncommand:null, tooltiptext:null, signedin:null, defaultlabel:null, errorlabel:null, status:'inactive', addEventListener:['command', launchProfile, false], addEventListener2:['mousedown', makeRename, false], style:'-moz-appearance:none; padding:10px 0 10px 15px; margin-bottom:-1px; border-top:1px solid rgba(24,25,26,0.14); border-bottom:1px solid transparent; border-right:0 none rgb(0,0,0); border-left:0 none rgb(0,0,0);', props:{profpath:ini[pClosure].props.Path}}; + var objToSplice = {nodeToClone:'PUIsync', identifier:'[path="' + ini[pClosure].props.Path + '"]', label:p, class:'PanelUI-profilist', hidden:null, id:null, oncommand:null, tooltiptext:null, signedin:null, defaultlabel:null, errorlabel:null, status:'inactive', addEventListener:['command', launchProfile, false], addEventListener2:['mousedown', makeRename, false], style:'-moz-appearance:none; padding:10px 0 10px 15px; margin-bottom:-1px; border-top:1px solid rgba(24,25,26,0.14); border-bottom:1px solid transparent; border-right:0 none rgb(0,0,0); border-left:0 none rgb(0,0,0);', props:{profpath:ini[pClosure].props.Path}}; if (pClosure == profToolkit.selectedProfile.name) { //should never happend because stackDOMJson length was not 0 if in this else of the parent if IT WIL CONTNIUE on this: if (profIdsCurrentlyInMenu.indexOf(p.id) > -1) { continue } @@ -1453,7 +1470,13 @@ var windowListener = { profilistBoxFound = true; } else { //expandedFooterHeight += heightChildren[i].boxObject.height; - expandedFooterHeight += Math.floor(parseFloat(aDOMWindow.getComputedStyle(heightChildren[i],null).getPropertyValue('height'))); + var childHeight = parseFloat(aDOMWindow.getComputedStyle(heightChildren[i],null).getPropertyValue('height')); + if (isNaN(childHeight)) { + console.log('childHeight is NaN so set it to 0. childHeight = ', childHeight) + childHeight = 0; + } + console.info('PARSEFLOAT = ' + parseFloat(childHeight)) + expandedFooterHeight += Math.floor(parseFloat(childHeight)); } }