Changeset 220


Ignore:
Timestamp:
10/10/13 18:58:28 (6 years ago)
Author:
nhoyt
Message:

Fixed problems with icon image transparency and border styling; moved the CSS string to the initHighlight function; renamed variables in the insertDIV function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/proto-14/chrome/content/highlight/highlight-icon.js

    r219 r220  
    5050    }; 
    5151 
    52     var containerDiv = 'padding: 2px; position: relative; border-collapse: separate; border: 4px solid '; 
    53     var fixedPosDiv  = 'border: 2px dotted '; 
     52    var containerDiv = 'border-collapse: separate; padding: 2px; position: relative; '; 
     53    var fixedPosDiv  = 'border-collapse: separate; '; 
    5454 
    5555    this.STYLES = { 
    56       violations:   containerDiv + 'crimson', 
    57       warnings:     containerDiv + 'gold',  
    58       manualChecks: containerDiv + 'mediumblue', 
    59       passes:       containerDiv + 'seagreen',  
    60       hidden:       fixedPosDiv  + 'grey', 
    61       noResults:    fixedPosDiv  + 'black', 
    62       offScreen:    'top: 2em; left: 2em; width: 40%; padding: 10px; margin: 2px; ' + 
     56      violations:   containerDiv + 'border: 2px solid crimson', 
     57      warnings:     containerDiv + 'border: 2px solid gold',  
     58      manualChecks: containerDiv + 'border: 2px solid mediumblue', 
     59      passes:       containerDiv + 'border: 2px solid seagreen',  
     60      hidden:       fixedPosDiv  + 'border: 2px dotted grey', 
     61      noResults:    fixedPosDiv  + 'border: 2px dotted black', 
     62  
     63      offScreen:    'width: 40%; padding: 10px; margin: 2px; opacity: 0.85; ' + 
    6364                    'background-color: white; color: black; font-size: 12pt; ' + 
    64                     'position: fixed; z-index: 100; opacity: 0.85;' 
     65                    'position: fixed; top: 2em; left: 2em; z-index: 100' , 
     66  
     67      iconImage:    'background-color: transparent; border: 0; ' + 
     68                    'position: absolute; top: 2px; right: 2px; ' + 
     69                    'width: 16px; height: 16px' 
    6570    }; 
    6671  }, 
     
    474479  insertDIV: function (document, node, style, v, w, m, p, h) { 
    475480 
    476     var parent_node = null; 
     481    var parentNode = null; 
    477482    var title = this.getResultValueMessage(v, w, m, p, h); 
    478483 
    479484    // Create the div element 
    480     var new_div_element = document.createElement('div'); 
    481     new_div_element.setAttribute("class", this.highlightDivClass); 
    482     new_div_element.setAttribute("style", style); 
    483     new_div_element.setAttribute("title", title); 
     485    var divElement = document.createElement('div'); 
     486    divElement.setAttribute("class", this.highlightDivClass); 
     487    divElement.setAttribute("style", style); 
     488    divElement.setAttribute("title", title); 
    484489 
    485490    // Get the corresponding info icon 
     
    491496 
    492497    // Create the info image 
    493     var info_image = document.createElement('img'); 
    494     info_image.setAttribute("src", "data:image/png;base64," + imageData); 
    495     info_image.setAttribute("class", this.highlightDivClass); 
    496     info_image.setAttribute("style", "position: absolute; top: 2px; right: 2px"); 
    497  
     498    var iconImage = document.createElement('img'); 
     499    iconImage.setAttribute("src", "data:image/png;base64," + imageData); 
     500    iconImage.setAttribute("class", this.highlightDivClass); 
     501    iconImage.setAttribute("style", this.STYLES.iconImage); 
     502     
    498503    // Replace the node with the div containing the node and append image 
    499     parent_node = node.parentNode; 
    500     parent_node.insertBefore(new_div_element, node); 
    501     new_div_element.appendChild(node); 
    502     new_div_element.appendChild(info_image); 
     504    parentNode = node.parentNode; 
     505    parentNode.insertBefore(divElement, node); 
     506    divElement.appendChild(node); 
     507    divElement.appendChild(iconImage); 
    503508 
    504509  }, 
Note: See TracChangeset for help on using the changeset viewer.