Changeset 223


Ignore:
Timestamp:
10/11/13 19:55:36 (6 years ago)
Author:
nhoyt
Message:
  • added offscreenDivId property for initHighlight function
  • fixed problem with CSS style string concatenation
  • deleted unused fn. showOffScreenCacheItems
  • added call to scrollIntoView in fn. positionDIV
Location:
trunk/proto-14/chrome/content
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/proto-14/chrome/content/ai-sidebar.js

    r219 r223  
    121121    stringBundleId:    "ainspector-highlight-properties", 
    122122    highlightDivClass: "ainspector-highlight", 
    123     offScreenDivClass: "ainspector-offscreen" 
     123    offScreenDivClass: "ainspector-offscreen", 
     124    offScreenDivId:    "ainspector-offscreen" 
    124125  }; 
    125126  ainspectorSidebar.highlightModule.initHighlight(highlightProps); 
  • trunk/proto-14/chrome/content/highlight/highlight.js

    r222 r223  
    2323    this.highlightDivClass = properties.highlightDivClass; 
    2424    this.offScreenDivClass = properties.offScreenDivClass; 
     25    this.offScreenDivId    = properties.offScreenDivId; 
    2526 
    2627    this.show_element_manual_check = true; 
     
    4041    }; 
    4142 
    42     var containerDiv = 'height: 100%; border-collapse: separate; padding: 2px; position: relative; '; 
    43     var fixedPosDiv  = 'border-collapse: separate; '; 
    44  
    4543    this.STYLES = { 
    46       violations:   containerDiv + 'border: 2px solid crimson', 
    47       warnings:     containerDiv + 'border: 2px solid gold',  
    48       manualChecks: containerDiv + 'border: 2px solid mediumblue', 
    49       passes:       containerDiv + 'border: 2px solid seagreen',  
    50       hidden:       fixedPosDiv  + 'border: 2px dotted grey', 
    51       noResults:    fixedPosDiv  + 'border: 2px dotted black', 
     44      violations:   'border-collapse: separate; border: 2px solid crimson;', 
     45      warnings:     'border-collapse: separate; border: 2px solid gold;',  
     46      manualChecks: 'border-collapse: separate; border: 2px solid mediumblue;', 
     47      passes:       'border-collapse: separate; border: 2px solid seagreen;',  
     48      hidden:       'border-collapse: separate; border: 2px dotted grey;', 
     49      noResults:    'border-collapse: separate; border: 2px dotted black;', 
    5250  
     51      visibleDiv:   'position: relative; height: 100%; padding: 2px;', 
     52 
    5353      offScreen:    'width: 40%; padding: 10px; margin: 2px; opacity: 0.85; ' + 
    5454                    'background-color: white; color: black; font-size: 12pt; ' + 
    55                     'position: fixed; top: 2em; left: 2em; z-index: 100' , 
     55                    'position: fixed; top: 2em; left: 2em; z-index: 100;' , 
    5656  
    5757      iconImage:    'background-color: transparent; border: 0; ' + 
    5858                    'position: absolute; top: 2px; right: 2px; ' + 
    59                     'width: 16px; height: 16px' 
     59                    'width: 16px; height: 16px;' 
    6060    }; 
    6161 
     
    344344 
    345345  /** 
    346    * @function showOffScreenCacheItems 
    347    * 
    348    * @desc Display information about a list of cache item results using the 
    349    *       worst result value of each cache item's node results 
    350    *       Designed to provide information about cache items that are not 
    351    *       visible on screen 
    352    * 
    353    * @param {Object} document - the DOM to remove highlighting from 
    354    * @param {Array} cache_items - list of cache items or dom element objects 
    355    * @param {Number} v - number of total violations in all the rules 
    356    *                     associated with all the cache_items 
    357    * @param {Number} w - number of total warnings in all the rules associated 
    358    *                     with all the cache_items 
    359    * @param {Number} m - number of total manual checks in all the rules 
    360    *                     associated with all the cache_items 
    361    * @param {Number} p - number of total pass in all the rules associated with 
    362    *                     all the cache_items 
    363    * @param {Number} h - number of total hidden in all the rules associated 
    364    *                     with all the cache_items 
    365    */ 
    366   showOffScreenCacheItems: function (document, cache_items, v, w, m, p, h) { 
    367  
    368     if (!document) return; 
    369  
    370     var len = cache_items.length; 
    371     var style = this.STYLES.offScreen + ' '; 
    372     var eval_result, tag_name, message; 
    373  
    374     if (v > 0) { 
    375       style += this.STYLES.violations; 
    376       eval_result = PluralForm.get(len, this.STRINGS.violations); 
    377     } else if (w > 0) { 
    378       style += this.STYLES.warnings; 
    379       eval_result = PluralForm.get(len, this.STRINGS.warnings); 
    380     } else if (m > 0) { 
    381       style += this.STYLES.manualChecks; 
    382       eval_result = PluralForm.get(len, this.STRINGS.manualChecks); 
    383     } else if (p > 0) { 
    384       style += this.STYLES.passed; 
    385       eval_result = PluralForm.get(len, this.STRINGS.passes); 
    386     } else if (h > 0) { 
    387       style += this.STYLES.hidden; 
    388       eval_result = PluralForm.get(len, this.STRINGS.hidden); 
    389     } 
    390  
    391     if (len === 1) { 
    392       if (cache_items[0].dom_element) 
    393         tag_name = cache_items[0].dom_element.tag_name; 
    394       else 
    395         tag_name = cache_items[0].tag_name; 
    396  
    397       message = tag_name + ' ' + this.STRINGS.notVisible + ' (' + eval_result + ')'; 
    398     } 
    399     else { 
    400       message = len + ' ' + PluralForm.get(len, this.STRINGS.offScreen); 
    401     } 
    402  
    403     this.positionDIV(document, style, message); 
    404   }, 
    405  
    406   /** 
    407346   * @function showOffScreenNodeResults 
    408347   * 
     
    421360  showOffScreenNodeResults: function (document, node_results, v, w, m, p, h) { 
    422361 
    423     if (!document) return; 
    424  
    425362    var node_results_plural = 
    426363      PluralForm.get(node_results.length, this.STRINGS.offScreen); 
     
    456393  positionDIV : function (document, style, result_value_message) { 
    457394 
    458     if (!document.createElement) return; 
    459395    var div_element = document.createElement('div'); 
    460     div_element.id = 'oaa_web_accessibility_off_screen_id'; 
     396    div_element.id = this.offScreenDivId; 
    461397 
    462398    div_element.setAttribute("class", this.offScreenDivClass); 
     
    466402    div_element.appendChild(text_node); 
    467403 
    468     document.body.insertBefore(div_element,document.body.childNodes[0]); 
     404    document.body.insertBefore(div_element, document.body.childNodes[0]); 
     405 
     406    // scroll into view aligned with top of viewport 
     407    div_element.scrollIntoView(true); 
     408 
    469409  }, 
    470410 
     
    489429    var parentNode = null; 
    490430    var title = this.getResultValueMessage(v, w, m, p, h); 
     431    var divStyle = this.STYLES.visibleDiv + ' '; 
    491432 
    492433    // Create the div element 
    493434    var divElement = document.createElement('div'); 
    494435    divElement.setAttribute("class", this.highlightDivClass); 
    495     divElement.setAttribute("style", style); 
     436    divElement.setAttribute("style", divStyle + style); 
    496437    divElement.setAttribute("title", title); 
    497438 
     
    559500    else 
    560501      return this.STYLES.noResults; 
    561  
    562502  }, 
    563503 
Note: See TracChangeset for help on using the changeset viewer.