Skip to content

Commit

Permalink
1.0.rev37
Browse files Browse the repository at this point in the history
-This is a temporary/quick fix for #4. It's a fix in that if the sync button is just hidden, this will fix it and work properly by removing hidden attribute on profilist buttons and if set style to display:none inline it will be replaced AND THEN it will try to get the height from PUIfi and if it can't then will just assume 38 (i should probably insert my own toolbarbutton and get that height). It's temporary in that, if there is no PUIsync element at all then it just throws prompt that it will not work properly. I need to make it independent of PUIsync in future.
-It's actually more of a fix because even if PUIsync is hidden and in future when I am independent of it, when panel is ignoreMutations and expanded the calc was getting NaN for hidden elements so now it takes NaN elements as 0
  • Loading branch information
Noitidart committed May 3, 2014
1 parent 7cab523 commit ef8820c
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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));
}
}

Expand Down

0 comments on commit ef8820c

Please sign in to comment.