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.

padding.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 'use strict';
  2. var parsers = require('../parsers.js');
  3. var TYPES = parsers.TYPES;
  4. var isValid = function(v) {
  5. var type = parsers.valueType(v);
  6. return (
  7. type === TYPES.LENGTH ||
  8. type === TYPES.PERCENT ||
  9. (type === TYPES.INTEGER && (v === '0' || v === 0))
  10. );
  11. };
  12. var parser = function(v) {
  13. return parsers.parseMeasurement(v);
  14. };
  15. var mySetter = parsers.implicitSetter('padding', '', isValid, parser);
  16. var myGlobal = parsers.implicitSetter(
  17. 'padding',
  18. '',
  19. function() {
  20. return true;
  21. },
  22. function(v) {
  23. return v;
  24. }
  25. );
  26. module.exports.definition = {
  27. set: function(v) {
  28. if (typeof v === 'number') {
  29. v = String(v);
  30. }
  31. if (typeof v !== 'string') {
  32. return;
  33. }
  34. var V = v.toLowerCase();
  35. switch (V) {
  36. case 'inherit':
  37. case 'initial':
  38. case 'unset':
  39. case '':
  40. myGlobal.call(this, V);
  41. break;
  42. default:
  43. mySetter.call(this, v);
  44. break;
  45. }
  46. },
  47. get: function() {
  48. return this.getPropertyValue('padding');
  49. },
  50. enumerable: true,
  51. configurable: true,
  52. };
  53. module.exports.isValid = isValid;
  54. module.exports.parser = parser;