Ignore:
Timestamp:
2013-01-15T22:49:23+13:00 (11 years ago)
Author:
davidb
Message:

Can now successfully obtain font size, font weight, font colour and font family information about each piece of text on a web page and convert to a corresponding text item on an Expeditee frame. Still need to account for text nodes with parents such as bold elements or heading elements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/html-to-expeditee/trunk/src/src/js/html-to-expeditee.js

    r26726 r26728  
    55var font_size;
    66var font_color;
     7var font_weight;
    78
    89Element.prototype.getElementWidth = function() {
     
    159160            var new_font_color = getStyle(parent,"color");
    160161           
     162            var new_font_weight = getStyle(parent,"font-weight");
     163           
    161164            if(new_font_family !== undefined && new_font_family !== null)
    162165                font_family = new_font_family;
     
    167170            if(new_font_color !== undefined && new_font_color !== null)
    168171                font_color = new_font_color;
     172               
     173            if(new_font_weight !== undefined && new_font_weight !== null)
     174                font_weight = new_font_weight;
    169175           
    170176            var data = parent.attributes["data"];
     
    173179                jsonNode.data = data.value;
    174180            }
    175             jsonNode.style = style;
    176         }
    177     }
    178    
     181           
    179182            var style = {};
    180183            style["font-family"]      = font_family;
    181184            style["font-size"]        = font_size;
    182185            style["color"]            = font_color;
     186            style["font-weight"]      = font_weight;
     187           
     188            //TODO: if parent node is a <b> element, then set style["font-weight"] to be "bold".
     189           
     190            jsonNode.style = style;
     191        }
     192    }
     193   
     194           
    183195   
    184196    }
Note: See TracChangeset for help on using the changeset viewer.