Sha256: 620d16e63e4d2c0a18a44f5adaa6cd7ce2a43119de38c12847baaeacf91fe2b1

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

(function() {
  var KssStateGenerator;
  KssStateGenerator = (function() {
    function KssStateGenerator() {
      var idx, idxs, pseudos, replaceRule, rule, stylesheet, _i, _len, _len2, _ref, _ref2;
      pseudos = /(\:hover|\:disabled|\:active|\:visited)/g;
      try {
        _ref = document.styleSheets;
        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
          stylesheet = _ref[_i];
          idxs = [];
          _ref2 = stylesheet.cssRules;
          for (idx = 0, _len2 = _ref2.length; idx < _len2; idx++) {
            rule = _ref2[idx];
            if ((rule.type === CSSRule.STYLE_RULE) && pseudos.test(rule.selectorText)) {
              replaceRule = function(matched, stuff) {
                return ".pseudo-class-" + matched.replace(':', '');
              };
              this.insertRule(rule.cssText.replace(pseudos, replaceRule));
            }
          }
        }
      } catch (_e) {}
    }
    KssStateGenerator.prototype.insertRule = function(rule) {
      var headEl, styleEl;
      headEl = document.getElementsByTagName('head')[0];
      styleEl = document.createElement('style');
      styleEl.type = 'text/css';
      if (styleEl.styleSheet) {
        styleEl.styleSheet.cssText = rule;
      } else {
        styleEl.appendChild(document.createTextNode(rule));
      }
      return headEl.appendChild(styleEl);
    };
    return KssStateGenerator;
  })();
  new KssStateGenerator;
}).call(this);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
colorgy_style-0.0.0.4 styleguide/javascripts/styleguide/kss.js
colorgy_style-0.0.0.2 styleguide/javascripts/styleguide/kss.js
colorgy_style-0.0.0.1 styleguide/javascripts/styleguide/kss.js