You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.4 KiB

  1. // Generated by CoffeeScript 1.6.2
  2. var ElementsCollection, StylesCollection, typeChecker, _ref,
  3. __hasProp = {}.hasOwnProperty,
  4. __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
  5. typeChecker = require('typechecker');
  6. ElementsCollection = require(__dirname + '/elements');
  7. StylesCollection = (function(_super) {
  8. __extends(StylesCollection, _super);
  9. function StylesCollection() {
  10. _ref = StylesCollection.__super__.constructor.apply(this, arguments);
  11. return _ref;
  12. }
  13. StylesCollection.prototype.add = function(values, opts) {
  14. var key, value, _i, _len;
  15. opts || (opts = {});
  16. opts.attrs || (opts.attrs = '');
  17. if (typeChecker.isArray(values)) {
  18. values = values.slice();
  19. } else {
  20. values = [values];
  21. }
  22. for (key = _i = 0, _len = values.length; _i < _len; key = ++_i) {
  23. value = values[key];
  24. if (typeChecker.isString(value) && /^\</.test(value) === false) {
  25. values[key] = "<link " + opts.attrs + " rel=\"stylesheet\" href=\"" + value + "\" />";
  26. }
  27. }
  28. return StylesCollection.__super__.add.call(this, values, opts);
  29. };
  30. return StylesCollection;
  31. })(ElementsCollection);
  32. module.exports = StylesCollection;