Changeset 1031 for trunk/plugins


Ignore:
Timestamp:
08/23/08 20:13:52 (11 years ago)
Author:
ray
Message:

#1227 @import rule & stylistLoadStylesheet

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/Stylist/stylist.js

    r1000 r1031  
    453453{ 
    454454  var css = Xinha._geturlcontent(URL); 
     455  var RE_atimport = '@import\\s*(url\\()?["\'](.*)["\'].*'; 
     456  var imports = css.match(new RegExp(RE_atimport,'ig')); 
     457  var m, file, re = new RegExp(RE_atimport,'i'); 
     458 
     459  if (imports) 
     460  { 
     461    var path = URL.replace(/\?.*$/,'').split("/"); 
     462    path.pop(); 
     463    path = path.join('/'); 
     464    for (var i=0;i<imports.length;i++) 
     465    { 
     466      m = imports[i].match(re); 
     467      file = m[2]; 
     468      if (!file.match(/^([^:]+\:)?\//)) 
     469      { 
     470        file = Xinha._resolveRelativeUrl(path,file); 
     471      } 
     472      css += Xinha._geturlcontent(file); 
     473    } 
     474  } 
     475 
    455476  return Xinha.ripStylesFromCSSString(css); 
    456477}; 
     
    462483  RE_comment = /\/\*(.|\r|\n)*?\*\//g; 
    463484  RE_rule    = /\{(.|\r|\n)*?\}/g; 
     485  css = css.replace(RE_comment, ''); 
    464486  css = css.replace(RE_comment, ''); 
    465487  css = css.replace(RE_rule, ','); 
Note: See TracChangeset for help on using the changeset viewer.