eligius 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -425,20 +425,26 @@ function prepareValueForSerialization(value) {
425
425
  } else if (value instanceof $) {
426
426
  return 'jQuery object';
427
427
  } else if (value !== null && typeof value === 'object') {
428
+ if (value.constructor.toString().substring(0, 5) === 'class' || !value.constructor.toString().startsWith('function Object()')) {
429
+ var funcString = value.constructor.toString();
430
+ return funcString.substring(0, funcString.indexOf('{') + 1);
431
+ }
432
+
428
433
  return Object.fromEntries(Object.entries(value).map(function (_ref) {
429
434
  var propName = _ref[0],
430
435
  propValue = _ref[1];
431
436
  return [propName, prepareValueForSerialization(propValue)];
432
437
  }));
433
438
  } else if (typeof value === 'function') {
434
- var funcString = value.toString();
435
- var paranIndex = funcString.indexOf('{');
439
+ var _funcString = value.toString();
440
+
441
+ var paranIndex = _funcString.indexOf('{');
436
442
 
437
443
  if (paranIndex > -1) {
438
- return funcString.substring(0, funcString.indexOf('{') + 1);
444
+ return _funcString.substring(0, _funcString.indexOf('{') + 1);
439
445
  }
440
446
 
441
- return funcString;
447
+ return _funcString;
442
448
  }
443
449
 
444
450
  return value;
@@ -1733,6 +1739,7 @@ var ProgressbarController = /*#__PURE__*/function () {
1733
1739
  this.selectedElement = null;
1734
1740
  this.textElement = null;
1735
1741
  this.detachers = [];
1742
+ this.duration = 0;
1736
1743
  }
1737
1744
 
1738
1745
  var _proto = ProgressbarController.prototype;
@@ -1743,17 +1750,20 @@ var ProgressbarController = /*#__PURE__*/function () {
1743
1750
  };
1744
1751
 
1745
1752
  _proto.attach = function attach(eventbus) {
1746
- var _this$selectedElement,
1747
- _this = this;
1753
+ var _this = this,
1754
+ _this$selectedElement;
1748
1755
 
1749
1756
  this.detachers.push(eventbus.on(TimelineEventNames.POSITION_UPDATE, this.positionUpdateHandler.bind(this)));
1750
- var clickHandler = this.clickHandler.bind(this);
1757
+ eventbus.broadcast(TimelineEventNames.DURATION_REQUEST, [function (duration) {
1758
+ return _this.duration = duration;
1759
+ }]);
1760
+ var clickHandler = this.clickHandler.bind(this, eventbus);
1751
1761
  (_this$selectedElement = this.selectedElement) == null ? void 0 : _this$selectedElement.on('click', clickHandler);
1752
1762
  this.detachers.push(function () {
1753
1763
  var _this$selectedElement2;
1754
1764
 
1755
- return (_this$selectedElement2 = _this.selectedElement) == null ? void 0 : _this$selectedElement2.off('click');
1756
- }, clickHandler);
1765
+ return (_this$selectedElement2 = _this.selectedElement) == null ? void 0 : _this$selectedElement2.off('click', clickHandler);
1766
+ });
1757
1767
  };
1758
1768
 
1759
1769
  _proto.detach = function detach(_eventbus) {
@@ -1772,7 +1782,14 @@ var ProgressbarController = /*#__PURE__*/function () {
1772
1782
  (_this$textElement = this.textElement) == null ? void 0 : _this$textElement.text(Math.floor(percentage) + "%");
1773
1783
  };
1774
1784
 
1775
- _proto.clickHandler = function clickHandler() {};
1785
+ _proto.clickHandler = function clickHandler(eventbus, event) {
1786
+ var element = event.target;
1787
+ var rect = element.getBoundingClientRect();
1788
+ var x = event.clientX - rect.left; //x position within the element.
1789
+
1790
+ var percentage = 100 / rect.width * x;
1791
+ eventbus.broadcast(TimelineEventNames.SEEK_REQUEST, [Math.floor(this.duration / 100 * percentage)]);
1792
+ };
1776
1793
 
1777
1794
  return ProgressbarController;
1778
1795
  }();
@@ -5374,7 +5391,7 @@ function setElementAttributes() {
5374
5391
  function setElementContent() {
5375
5392
  return {
5376
5393
  description: 'Sets the given HTML content in the selected element',
5377
- dependentProperties: ['selectedElement'],
5394
+ dependentProperties: ['selectedElement', 'template'],
5378
5395
  properties: {
5379
5396
  insertionType: [{
5380
5397
  value: 'overwrite',
@@ -5386,11 +5403,7 @@ function setElementContent() {
5386
5403
  }, {
5387
5404
  value: 'prepend',
5388
5405
  description: 'the new content will be inserted before the current content'
5389
- }],
5390
- template: {
5391
- type: 'ParameterType:htmlContent',
5392
- required: true
5393
- }
5406
+ }]
5394
5407
  }
5395
5408
  };
5396
5409
  }