Set stylesheet for the given subreddit.

        :returns: The json response from the server.
162249
def set_stylesheet(self, subreddit, stylesheet):
        
        subreddit = six.text_type(subreddit)
        data = {'r': subreddit,
                'stylesheet_contents': stylesheet,
                'op': 'save'}  # Options: save / preview
        self.evict(self.config['stylesheet'].format(subreddit=subreddit))
        return self.request_json(self.config['subreddit_css'], data=data)
1042999
function resolveStylesheet(file, pathes) {
    var filePath = file.path,
        linkStr = '';

    for(var i = 0, len = pathes.length; i < len; i ++) {
        linkStr += '<link rel="stylesheet" href="' + path.relative(path.dirname(filePath), pathes[i]) + '"/>\r\n';
    }

    return linkStr;
}
1260622
def import_styles(self, subs, overwrite=True):
        
        if not isinstance(subs, SSAFile):
            raise TypeError("Must supply an SSAFile.")

        for name, style in subs.styles.items():
            if name not in self.styles or overwrite:
                self.styles[name] = style
1163613
function stylesheets(options) {
    return this.stylesheets.reduce(function reduce(links, sheet) {
      return links + options.fn(sheet);
    }, '');
  }
186901
function addLinkedStyleSheet(url, deferred) {
        var attributes = {
            type: "text/css",
            rel:  "stylesheet",
            href: url
        };

        var $link = $("<link/>").attr(attributes);

        if (deferred) {
            $link.on('load', deferred.resolve).on('error', deferred.reject);
        }

        $link.appendTo("head");

        return $link[0];
    }
956060
function setStylesheet(s) {
	var id = "AMMLcustomStyleSheet";
	var n = document.getElementById(id);
	if(document.createStyleSheet) {
		// Test for IE's non-standard createStyleSheet method
		if(n)
			n.parentNode.removeChild(n);
		// This failed without the &nbsp;
		document.getElementsByTagName("head")[0].insertAdjacentHTML("beforeEnd","&nbsp;<style id='" + id + "'>" + s + "</style>");
	} else {
		if(n) {
			n.replaceChild(document.createTextNode(s),n.firstChild);
		} else {
			n = document.createElement("style");
			n.type = "text/css";
			n.id = id;
			n.appendChild(document.createTextNode(s));
			document.getElementsByTagName("head")[0].appendChild(n);
		}
	}
}
835358
function processStylesheet(ss) {
      // cssRules respects same-origin policy, as per
      // https://code.google.com/p/chromium/issues/detail?id=49001#c10.
      try {
        if (!ss.cssRules) { return; }
      } catch (e) {
        if (e.name !== 'SecurityError') { throw e; }
        return;
      }
      // ss.cssRules is available, so proceed with desired operations.
      var rules = [];
      for (var i = 0; i < ss.cssRules.length; i++) {
        var rule = ss.cssRules[i];
        rules.push(rule);
      }
      return rules;
    }
341387
def as_json(self):
        # type: () -> dict
        """"""
        self._config['applyCss'] = self.applyCss
        self._json['config'] = self._config
        return self._json
420308
function () {
                var added = {},
                    current,
                    newStatus;

                current = this.stylesheets;
                newStatus = related().stylesheets;

                Object.keys(newStatus).forEach(function (v, i) {
                    if (!current[v]) {
                        added[v] = newStatus[v];
                    }
                });

                Object.keys(added).forEach(function (v, i) {
                    _transport.send(JSON.stringify({
                        method: "StylesheetAdded",
                        href: v,
                        roots: [added[v]]
                    }));
                });

                this.stylesheets = newStatus;
            }
1180764
def get_sticky(self, subreddit, bottom=False):
        
        url = self.config['sticky'].format(subreddit=six.text_type(subreddit))
        param = {'num': 2} if bottom else None
        return objects.Submission.from_json(self.request_json(url,
                                                              params=param))
226670
def get_traffic(self, subreddit):
        
        url = self.config['subreddit_traffic'].format(
            subreddit=six.text_type(subreddit))
        return self.request_json(url)
917119
def add_flair_template(self, subreddit, text='', css_class='',
                           text_editable=False, is_link=False):
        
        data = {'r': six.text_type(subreddit),
                'text': text,
                'css_class': css_class,
                'text_editable': six.text_type(text_editable),
                'flair_type': 'LINK_FLAIR' if is_link else 'USER_FLAIR'}
        return self.request_json(self.config['flairtemplate'], data=data)
555748
function stylesheetOverride(stylesheet, props, themeData) {
  return {
    ...stylesheet,
    pointerBorder: { fill: themeData["tooltip.backgroundColor"] },
    pointerBody: { fill: themeData["tooltip.backgroundColor"] }
  };
}
1184214
def add_stylesheets(self, *css_files):
        """"""
        for css_file in css_files:
            self.main_soup.style.append(self._text_file(css_file))
951487
function styleForURL(url) {
        var styleSheetId, styles = {};
        url = _canonicalize(url);
        for (styleSheetId in _styleSheetDetails) {
            if (_styleSheetDetails[styleSheetId].canonicalizedURL === url) {
                styles[styleSheetId] = _styleSheetDetails[styleSheetId];
            }
        }
        return styles;
    }
318034
def get_settings(self, *args, **kwargs):
        
        url = self.reddit_session.config['wiki_page_settings']
        url = url.format(subreddit=six.text_type(self.subreddit),
                         page=self.page)
        return self.reddit_session.request_json(url, *args, **kwargs)['data']
651687
function formatUserstyleCSSHeader(metadata) {
  const CSSmeta = JSON.parse(JSON.stringify(metadata)); // Local copy

  let header = '';
  header += '/* ==UserStyle==\n';

  let documentRules;

  Object.keys(userstyleSpec).forEach(prop => {
    if (_safePropGet(prop, CSSmeta) && _isAllowedCSSMetaProp(prop)) {
      if (prop === 'match') {
        documentRules = CSSmeta.match;
      } else {
        header += `@${_padPropName(prop, longestPropLength)} ${CSSmeta[prop]}\n`;
      }
    }
  });

  header += '==/UserStyle== */\n';
  if (documentRules && Object.keys(documentRules).length) {
    header += `@-moz-document\n  ${documentRules.join(',\n  ')}\n{\n`;
  }
  return header;
}