Ignore:
Timestamp:
2013-01-21T19:07:55+13:00 (11 years ago)
Author:
davidb
Message:

Work done on linking collection browsing frames as well as linking to matching collection item frames.

File:
1 edited

Legend:

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

    r26749 r26767  
    139139    var jsonNode = null;
    140140   
     141   
    141142    if (node.nodeType == 3) { /* text node */
    142    
    143        
     143               
    144144        var text = node.nodeValue;
    145145
     
    155155        jsonNode.yb = pyb;
    156156       
    157         var link = node.link;
    158         if(link !== null && link !== undefined){
    159             jsonNode.link = link;
    160             console.log("Adding link");
    161         }else{
    162             console.log("no link found");
    163         }
    164        
    165157        var parent = node.parentNode;
    166158       
    167159        if (parent != null) {
     160       
     161            //set a frame link attribute
     162            var link = parent.attributes["link"];
     163           
     164            if(link !== null && link !== undefined){
     165                console.log(link.value);
     166                jsonNode.link = link.value;
     167            }
    168168       
    169169            if(compute_font){
     
    189189                    font_weight = new_font_weight;
    190190               
     191                //TODO: if parent node is an <i> element, then set style["font-style"] to be "italic".
    191192                if(new_font_style !== undefined && new_font_style !== null)
    192193                    font_style = new_font_style;
     
    233234    }
    234235
    235         var elemName = node.nodeName.toLowerCase();
     236    var elemName = node.nodeName.toLowerCase();
    236237
    237238    if (!elemName.match(/script/)) {
     
    259260        jsonNode.rect = rect;
    260261   
     262        //TODO: Set link attribute for images.
    261263        if (elemName.match("img")) {
     264           
     265            var getLink = node.getAttribute("link");
     266            if(getLink !== null && getLink !== undefined){
     267                jsonNode.link = getLink;
     268            }
     269           
    262270            jsonNode.img = node.src;
     271           
     272           
    263273        }
    264274
    265275        var style = {};
    266        
    267         //style["font-family"]      = getStyle(node,"font-family");
    268         //style["font-size"]        = getStyle(node,"font-size");
     276   
    269277        style["background-color"] = getStyle(node,"background-color");
    270278       
     
    272280
    273281        var attr = node.attributes["attr"];
    274         if (attr != null) {
    275         // console.log("attr = " + attr.value);
    276         jsonNode.attr = attr.value;
     282       
     283        if (attr != null) {
     284            jsonNode.attr = attr.value;
    277285        }
    278 
    279 
    280             var jsonChildNodes = [];
     286       
     287        var jsonChildNodes = [];
    281288
    282289        var cnode = node.firstChild;
Note: See TracChangeset for help on using the changeset viewer.