src/client/vogue-client.js
function getLocalStylesheets() {

      /**
       * Checks if the stylesheet is local.
       *
       * @param {Object} link The link to check for.
       * @returns {Boolean}
       */
      function isLocalStylesheet(link) {
        var href, i, isExternal = true;
        if (link.getAttribute("rel") !== "stylesheet") {
          return false;
        }
        href = link.href;

        for (i = 0; i < script.bases.length; i += 1) {
          if (href.indexOf(script.bases[i]) > -1) {
            isExternal = false;
            break;
          }
        }

        return !(isExternal && href.match(/^https?:/));
      }

      /**
       * Checks if the stylesheet's media attribute is 'print'
       *
       * @param (Object) link The stylesheet element to check.
       * @returns (Boolean)
       */
      function isPrintStylesheet(link) {
        return link.getAttribute("media") === "print";
      }

      /**
       * Get the link's base URL.
       *
       * @param {String} href The URL to check.
       * @returns {String|Boolean} The base URL, or false if no matches found.
       */
      function getBase(href) {
        var base, j;
        for (j = 0; j < script.bases.length; j += 1) {
          base = script.bases[j];
          if (href.indexOf(base) > -1) {
            return href.substr(base.length);
          }
        }
        return false;
      }

      function getProperty(property) {
        return this[property];
      }

      var stylesheets = {},
          reImport = /@import\s+url\(["']?([^"'\)]+)["']?\)/g,
          links = document.getElementsByTagName("link"),
          link, href, matches, content, i, m;

      // Go through all the links in the page, looking for stylesheets.
      for (i = 0, m = links.length; i < m; i += 1) {
        link = links[i];
        if (isPrintStylesheet(link)) continue;
        if (!isLocalStylesheet(link)) continue;
        // Link is local, get the base URL.
        href = getBase(link.href);
        if (href !== false) {
          stylesheets[href] = link;
        }
      }

      // Go through all the style tags, looking for @import tags.
      links = document.getElementsByTagName("style");
      for (i = 0, m = links.length; i < m; i += 1) {
        if (isPrintStylesheet(links[i])) continue;
        content = links[i].text || links[i].textContent;
        while ((matches = reImport.exec(content))) {
          link = {
            rel: "stylesheet",
            href: matches[1],
            getAttribute: getProperty
          };
          if (isLocalStylesheet(link)) {
            // Link is local, get the base URL.
            href = getBase(link.href);
            if (href !== false) {
              stylesheets[href] = link;
            }
          }
        }
      }
      return stylesheets;
    }
function getLocalStylesheets() {

      /**
       * Checks if the stylesheet is local.
       *
       * @param {Object} link The link to check for.
       * @returns {Boolean}
       */
      function isLocalStylesheet(link) {
        var href, i, isExternal = true;
        if (link.getAttribute("rel") !== "stylesheet") {
          return false;
        }
        href = link.href;

        for (i = 0; i < script.bases.length; i += 1) {
          if (href.indexOf(script.bases[i]) > -1) {
            isExternal = false;
            break;
          }
        }

        return !(isExternal && href.match(/^https?:/));
      }

      /**
       * Checks if the stylesheet's media attribute is 'print'
       *
       * @param (Object) link The stylesheet element to check.
       * @returns (Boolean)
       */
      function isPrintStylesheet(link) {
        return link.getAttribute("media") === "print";
      }

      /**
       * Get the link's base URL.
       *
       * @param {String} href The URL to check.
       * @returns {String|Boolean} The base URL, or false if no matches found.
       */
      function getBase(href) {
        var base, j;
        for (j = 0; j < script.bases.length; j += 1) {
          base = script.bases[j];
          if (href.indexOf(base) > -1) {
            return href.substr(base.length);
          }
        }
        return false;
      }

      function getProperty(property) {
        return this[property];
      }

      var stylesheets = {},
          reImport = /@import\s+url\(["']?([^"'\)]+)["']?\)/g,
          links = document.getElementsByTagName("link"),
          link, href, matches, content, i, m;

      // Go through all the links in the page, looking for stylesheets.
      for (i = 0, m = links.length; i < m; i += 1) {
        link = links[i];
        if (isPrintStylesheet(link)) continue;
        if (!isLocalStylesheet(link)) continue;
        // Link is local, get the base URL.
        href = getBase(link.href);
        if (href !== false) {
          stylesheets[href] = link;
        }
      }

      // Go through all the style tags, looking for @import tags.
      links = document.getElementsByTagName("style");
      for (i = 0, m = links.length; i < m; i += 1) {
        if (isPrintStylesheet(links[i])) continue;
        content = links[i].text || links[i].textContent;
        while ((matches = reImport.exec(content))) {
          link = {
            rel: "stylesheet",
            href: matches[1],
            getAttribute: getProperty
          };
          if (isLocalStylesheet(link)) {
            // Link is local, get the base URL.
            href = getBase(link.href);
            if (href !== false) {
              stylesheets[href] = link;
            }
          }
        }
      }
      return stylesheets;
    }
function getLocalStylesheets ( ) { /**
       * Checks if the stylesheet is local.
       *
       * @param {Object} link The link to check for.
       * @returns {Boolean}
       */ function isLocalStylesheet ( link ) { var href , i , isExternal = true ; if ( link . getAttribute ( "rel" ) !== "stylesheet" ) { return false ; } href = link . href ; for ( i = 0 ; i < script . bases . length ; i += 1 ) { if ( href . indexOf ( script . bases [ i ] ) > - 1 ) { isExternal = false ; break ; } } return ! ( isExternal && href . match ( / ^https?: / ) ) ; } /**
       * Checks if the stylesheet's media attribute is 'print'
       *
       * @param (Object) link The stylesheet element to check.
       * @returns (Boolean)
       */ function isPrintStylesheet ( link ) { return link . getAttribute ( "media" ) === "print" ; } /**
       * Get the link's base URL.
       *
       * @param {String} href The URL to check.
       * @returns {String|Boolean} The base URL, or false if no matches found.
       */ function getBase ( href ) { var base , j ; for ( j = 0 ; j < script . bases . length ; j += 1 ) { base = script . bases [ j ] ; if ( href . indexOf ( base ) > - 1 ) { return href . substr ( base . length ) ; } } return false ; } function getProperty ( property ) { return this [ property ] ; } var stylesheets = { } , reImport = / @import\s+url\(["']?([^"'\)]+)["']?\) / g , links = document . getElementsByTagName ( "link" ) , link , href , matches , content , i , m ; // Go through all the links in the page, looking for stylesheets. for ( i = 0 , m = links . length ; i < m ; i += 1 ) { link = links [ i ] ; if ( isPrintStylesheet ( link ) ) continue ; if ( ! isLocalStylesheet ( link ) ) continue ; // Link is local, get the base URL. href = getBase ( link . href ) ; if ( href !== false ) { stylesheets [ href ] = link ; } } // Go through all the style tags, looking for @import tags. links = document . getElementsByTagName ( "style" ) ; for ( i = 0 , m = links . length ; i < m ; i += 1 ) { if ( isPrintStylesheet ( links [ i ] ) ) continue ; content = links [ i ] . text || links [ i ] . textContent ; while ( ( matches = reImport . exec ( content ) ) ) { link = { rel : "stylesheet" , href : matches [ 1 ] , getAttribute : getProperty } ; if ( isLocalStylesheet ( link ) ) { // Link is local, get the base URL. href = getBase ( link . href ) ; if ( href !== false ) { stylesheets [ href ] = link ; } } } } return stylesheets ; }
Fetch all the local stylesheets from the page.

@returns {Object} The list of local stylesheets keyed by their base URL.
Fetch all the local stylesheets from the page .