Changeset 368

Show
Ignore:
Timestamp:
04/14/08 20:53:54 (3 months ago)
Author:
t-bone
Message:

Refs #128

  • Fix list of menu IDs, for FF 2.0/3.0, and detection of which version is running.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • extension/tinymenu/chrome.manifest

    r359 r368  
    66overlay chrome://messenger/content/mailWindowOverlay.xul chrome://tinymenu/content/tinymenu-tbfix.xul   application={3550f703-e582-4d05-9a08-453d09bdfdc6} 
    77 
    8 overlay chrome://tinymenu/content/tinymenu-options.xul   chrome://tinymenu/content/tinymenu-options-ff.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} 
    9 overlay chrome://tinymenu/content/tinymenu-options.xul   chrome://tinymenu/content/tinymenu-options-tb.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6} 
     8overlay chrome://tinymenu/content/tinymenu-options.xul   chrome://tinymenu/content/tinymenu-options-ff2.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} appversion<3.0a5 
     9overlay chrome://tinymenu/content/tinymenu-options.xul   chrome://tinymenu/content/tinymenu-options-ff3.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384} appversion>=3.0a5 
     10overlay chrome://tinymenu/content/tinymenu-options.xul   chrome://tinymenu/content/tinymenu-options-tb.xul  application={3550f703-e582-4d05-9a08-453d09bdfdc6} 
    1011 
    1112locale tinymenu cs-CZ locale/cs-CZ/ 
  • extension/tinymenu/content/tinymenu-options.js

    r360 r368  
     1function loadOptions() { 
     2    tinymenu.initPref(); 
     3 
     4    // set checkboxes 
     5    var r, id; 
     6    for (var i in tinymenu.menuIds) { 
     7        id=tinymenu.menuIds[i]; 
     8        r=new RegExp('\\b'+id+'\\b'); 
     9        document.getElementById('pref-'+id).checked= 
     10            (null!=r.exec(tinymenu.doNotCollapse)); 
     11    } 
     12 
     13    // set radio 
     14    if ('image'==tinymenu.viewMode) { 
     15        document.getElementById('view_text').setAttribute('selected', false); 
     16        document.getElementById('view_image').setAttribute('selected', true); 
     17    } 
     18} 
     19 
     20function saveOptions() { 
     21    // build doNotCollapse string 
     22    var doNotCollapse='tinymenu'; 
     23    var r, id; 
     24    for (var i in tinymenu.menuIds) { 
     25        id=tinymenu.menuIds[i]; 
     26 
     27        if (document.getElementById('pref-'+id).checked) { 
     28            doNotCollapse+=' '+id; 
     29        } 
     30    } 
     31    tinymenu.doNotCollapse=doNotCollapse; 
     32 
     33    tinymenu.viewMode= 
     34        document.getElementById('view_image').getAttribute('selected')? 
     35        'image':'text'; 
     36 
     37    // save all the bits 
     38    var prefs=Components.classes["@mozilla.org/preferences-service;1"] 
     39        .getService(Components.interfaces.nsIPrefService) 
     40        .getBranch("tinymenu."); 
     41 
     42    prefs.setCharPref('doNotCollapse', tinymenu.doNotCollapse); 
     43    prefs.setCharPref('viewMode', tinymenu.viewMode); 
     44 
     45    // will fail in default case, so silently catch 
     46    try { 
     47        if (tinymenu.iconFile && 
     48            tinymenu.iconFile.QueryInterface(Components.interfaces.nsILocalFile) 
     49        ) { 
     50            prefs.setComplexValue('iconFile', Components.interfaces.nsILocalFile, tinymenu.iconFile); 
     51        } 
     52    } catch (e) {  } 
     53} 
     54 
    155function browseImage() { 
    256    // based on sample from 
     
    3286} 
    3387 
    34 window.addEventListener('load', tinymenu.loadOptions, false); 
     88window.addEventListener('load', loadOptions, false); 
  • extension/tinymenu/content/tinymenu-options.xul

    r351 r368  
    1414    buttons="accept, cancel" 
    1515    persist="width height screenX screenY" 
    16     ondialogaccept="tinymenu.saveOptions();" 
     16    ondialogaccept="saveOptions();" 
    1717> 
    1818 
  • extension/tinymenu/content/tinymenu.js

    r359 r368  
    6161}, 
    6262 
    63 loadOptions:function() { 
    64     tinymenu.initPref(); 
    65  
    66     // set checkboxes 
    67     var r, id; 
    68     for (var i in tinymenu.menuIds) { 
    69         id=tinymenu.menuIds[i]; 
    70         r=new RegExp('\\b'+id+'\\b'); 
    71         document.getElementById('pref-'+id).checked= 
    72             (null!=r.exec(tinymenu.doNotCollapse)); 
    73     } 
    74  
    75     // set radio 
    76     if ('image'==tinymenu.viewMode) { 
    77         document.getElementById('view_text').setAttribute('selected', false); 
    78         document.getElementById('view_image').setAttribute('selected', true); 
    79     } 
    80 }, 
    81  
    82 saveOptions:function() { 
    83     // build doNotCollapse string 
    84     var doNotCollapse='tinymenu'; 
    85     var r, id; 
    86     for (var i in tinymenu.menuIds) { 
    87         id=tinymenu.menuIds[i]; 
    88  
    89         if (document.getElementById('pref-'+id).checked) { 
    90             doNotCollapse+=' '+id; 
    91         } 
    92     } 
    93     tinymenu.doNotCollapse=doNotCollapse; 
    94  
    95     tinymenu.viewMode= 
    96         document.getElementById('view_image').getAttribute('selected')? 
    97         'image':'text'; 
    98  
    99     // save all the bits 
    100     var prefs=Components.classes["@mozilla.org/preferences-service;1"] 
    101         .getService(Components.interfaces.nsIPrefService) 
    102         .getBranch("tinymenu."); 
    103  
    104     prefs.setCharPref('doNotCollapse', tinymenu.doNotCollapse); 
    105     prefs.setCharPref('viewMode', tinymenu.viewMode); 
    106  
    107     // will fail in default case, so silently catch 
    108     try { 
    109         if (tinymenu.iconFile && 
    110             tinymenu.iconFile.QueryInterface(Components.interfaces.nsILocalFile) 
    111         ) { 
    112             prefs.setComplexValue('iconFile', Components.interfaces.nsILocalFile, tinymenu.iconFile); 
    113         } 
    114     } catch (e) {  } 
    115 }, 
    116  
    11763mimeForFile:function(file) { 
    11864    var mime=Components.classes["@mozilla.org/mime;1"]