Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

MediaList.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //.CommonJS
  2. var CSSOM = {};
  3. ///CommonJS
  4. /**
  5. * @constructor
  6. * @see http://dev.w3.org/csswg/cssom/#the-medialist-interface
  7. */
  8. CSSOM.MediaList = function MediaList(){
  9. this.length = 0;
  10. };
  11. CSSOM.MediaList.prototype = {
  12. constructor: CSSOM.MediaList,
  13. /**
  14. * @return {string}
  15. */
  16. get mediaText() {
  17. return Array.prototype.join.call(this, ", ");
  18. },
  19. /**
  20. * @param {string} value
  21. */
  22. set mediaText(value) {
  23. var values = value.split(",");
  24. var length = this.length = values.length;
  25. for (var i=0; i<length; i++) {
  26. this[i] = values[i].trim();
  27. }
  28. },
  29. /**
  30. * @param {string} medium
  31. */
  32. appendMedium: function(medium) {
  33. if (Array.prototype.indexOf.call(this, medium) === -1) {
  34. this[this.length] = medium;
  35. this.length++;
  36. }
  37. },
  38. /**
  39. * @param {string} medium
  40. */
  41. deleteMedium: function(medium) {
  42. var index = Array.prototype.indexOf.call(this, medium);
  43. if (index !== -1) {
  44. Array.prototype.splice.call(this, index, 1);
  45. }
  46. }
  47. };
  48. //.CommonJS
  49. exports.MediaList = CSSOM.MediaList;
  50. ///CommonJS