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.

getCSSProperty.js 1.3KB

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const css_shorthand_properties_1 = __importDefault(require("css-shorthand-properties"));
  7. const utils_1 = require("../../utils");
  8. async function getCSSProperty(cssProperty) {
  9. if (!css_shorthand_properties_1.default.isShorthand(cssProperty)) {
  10. const cssValue = await this.getElementCSSValue(this.elementId, cssProperty);
  11. return utils_1.parseCSS(cssValue, cssProperty);
  12. }
  13. const properties = css_shorthand_properties_1.default.expand(cssProperty);
  14. let cssValues = await Promise.all(properties.map((prop) => this.getElementCSSValue(this.elementId, prop)));
  15. while ((cssValues.length % 2) === 0) {
  16. const mergedValues = [
  17. cssValues.slice(0, cssValues.length / 2).join(' '),
  18. cssValues.slice(cssValues.length / 2).join(' ')
  19. ];
  20. const hasEqualProperties = mergedValues.every((v) => v === mergedValues[0]);
  21. if (!hasEqualProperties) {
  22. break;
  23. }
  24. cssValues = cssValues.slice(0, cssValues.length / 2);
  25. }
  26. return utils_1.parseCSS(cssValues.join(' '), cssProperty);
  27. }
  28. exports.default = getCSSProperty;