Changeset 1031 for branches/new-dialogs


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
  • branches/new-dialogs/plugins/Stylist/stylist.js

    r1008 r1031  
    453453Xinha.ripStylesFromCSSFile = function(URL) 
    454454{ 
    455   Xinha.setLoadingMessage('Loading Styles'); 
    456455  var css = Xinha._geturlcontent(URL); 
     456  var RE_atimport = '@import\\s*(url\\()?["\'](.*)["\'].*'; 
     457  var imports = css.match(new RegExp(RE_atimport,'ig')); 
     458  var m, file, re = new RegExp(RE_atimport,'i'); 
     459 
     460  if (imports) 
     461  { 
     462    var path = URL.replace(/\?.*$/,'').split("/"); 
     463    path.pop(); 
     464    path = path.join('/'); 
     465    for (var i=0;i<imports.length;i++) 
     466    { 
     467      m = imports[i].match(re); 
     468      file = m[2]; 
     469      if (!file.match(/^([^:]+\:)?\//)) 
     470      { 
     471        file = Xinha._resolveRelativeUrl(path,file); 
     472      } 
     473      css += Xinha._geturlcontent(file); 
     474    } 
     475  } 
     476 
    457477  return Xinha.ripStylesFromCSSString(css); 
    458478}; 
Note: See TracChangeset for help on using the changeset viewer.