videomail-client 9.1.9 → 9.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "9.1.9",
3
+ "version": "9.1.11",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -451,6 +451,15 @@
451
451
  ><span class="date">2019-9-13 11:11:53</span></a
452
452
  >
453
453
  </li>
454
+ <li>
455
+ <a
456
+ href="/player_only_with_form.html"
457
+ class=""
458
+ title="player_only_with_form.html"
459
+ ><span class="name">player_only_with_form.html</span
460
+ ><span class="size">???</span><span class="date">???</span></a
461
+ >
462
+ </li>
454
463
  <li>
455
464
  <a href="/predefined.html" class="" title="predefined.html"
456
465
  ><span class="name">predefined.html</span><span class="size">2257</span
@@ -17305,7 +17305,7 @@ function wrappy (fn, cb) {
17305
17305
  },{}],117:[function(_dereq_,module,exports){
17306
17306
  module.exports={
17307
17307
  "name": "videomail-client",
17308
- "version": "9.1.9",
17308
+ "version": "9.1.11",
17309
17309
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
17310
17310
  "keywords": [
17311
17311
  "webcam",
@@ -17485,13 +17485,13 @@ var VideomailClient = function VideomailClient(options) {
17485
17485
  _eventEmitter.default.call(this, localOptions, "VideomailClient");
17486
17486
  this.build = function () {
17487
17487
  var building = false;
17488
- debug("Client: build(),", "!building =", "".concat(!building, ","), "!isBuilt() =", !container.isBuilt());
17489
17488
 
17490
17489
  /*
17491
17490
  * it can happen that it gets called twice, i.E. when an error is thrown
17492
17491
  * in the middle of the build() fn
17493
17492
  */
17494
17493
  if (!building && !container.isBuilt()) {
17494
+ debug("Client: build()");
17495
17495
  building = true;
17496
17496
  container.build();
17497
17497
  building = false;
@@ -17534,14 +17534,8 @@ var VideomailClient = function VideomailClient(options) {
17534
17534
  if (videomail) {
17535
17535
  videomail = container.addPlayerDimensions(videomail, parentElement);
17536
17536
  }
17537
- if (container.isOutsideElementOf(parentElement)) {
17538
- // replay element must be outside of the container
17539
- container.hideForm({
17540
- deep: true
17541
- });
17542
- } else {
17543
- container.loadForm(videomail);
17544
- }
17537
+ container.buildForm(videomail);
17538
+ container.loadForm(videomail);
17545
17539
 
17546
17540
  // slight delay needed to avoid HTTP 416 errors (request range unavailable)
17547
17541
  setTimeout(function () {
@@ -19811,7 +19805,7 @@ var Container = function Container(options) {
19811
19805
  }
19812
19806
  function getFormElement() {
19813
19807
  var formElement;
19814
- if (containerElement.tagName === "FORM") {
19808
+ if (containerElement && containerElement.tagName === "FORM") {
19815
19809
  formElement = containerElement;
19816
19810
  } else if (options.selectors.formId) {
19817
19811
  formElement = document.getElementById(options.selectors.formId);
@@ -19820,7 +19814,10 @@ var Container = function Container(options) {
19820
19814
  }
19821
19815
  return formElement;
19822
19816
  }
19823
- function buildForm() {
19817
+ this.buildForm = function () {
19818
+ if (form) {
19819
+ return; // already built
19820
+ }
19824
19821
  var formElement = getFormElement();
19825
19822
  if (formElement) {
19826
19823
  debug("Container: buildForm()");
@@ -19831,7 +19828,7 @@ var Container = function Container(options) {
19831
19828
  }
19832
19829
  form.build();
19833
19830
  }
19834
- }
19831
+ };
19835
19832
  function buildChildren() {
19836
19833
  var playerOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
19837
19834
  debug("Container: buildChildren (playerOnly = ".concat(playerOnly, ")"));
@@ -19892,7 +19889,7 @@ var Container = function Container(options) {
19892
19889
 
19893
19890
  // beware of rich text editors, hence the isEditable check (wordpress plugin issue)
19894
19891
  if (!isEditable && tagName !== "INPUT" && tagName !== "TEXTAREA") {
19895
- var code = e.keyCode ? e.keyCode : e.which;
19892
+ var code = e.code;
19896
19893
  if (code === 32) {
19897
19894
  e.preventDefault();
19898
19895
  if (options.enablePause) {
@@ -20077,7 +20074,7 @@ var Container = function Container(options) {
20077
20074
  };
20078
20075
  this.build = function () {
20079
20076
  var playerOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
20080
- debug("Container: build(playerOnly = ".concat(playerOnly, ")"));
20077
+ debug("Container: build (playerOnly = ".concat(playerOnly, ")"));
20081
20078
  try {
20082
20079
  containerElement = document.getElementById(options.selectors.containerId);
20083
20080
 
@@ -20093,7 +20090,7 @@ var Container = function Container(options) {
20093
20090
 
20094
20091
  // Building form also applies for when `playerOnly` because of
20095
20092
  // correcting mode on Videomail. This function will skip if there is no form. Easy.
20096
- buildForm();
20093
+ this.buildForm();
20097
20094
  buildChildren(playerOnly);
20098
20095
  if (!hasError) {
20099
20096
  debug("Container: built.");
@@ -20297,11 +20294,11 @@ var Container = function Container(options) {
20297
20294
  } else if (bccIsConfigured) {
20298
20295
  // Skip as it's hidden
20299
20296
  } else {
20300
- whyInvalid = "Please configure form to have at least one recipient";
20301
- valid = false;
20297
+ // Form has no input fields for recipients, so don't validate
20298
+ // recipients at all
20302
20299
  }
20303
20300
  if (!valid) {
20304
- whyInvalid = "Please enter at least one recipient";
20301
+ whyInvalid = "At least one recipient is required";
20305
20302
  }
20306
20303
  }
20307
20304
  } else {
@@ -20635,6 +20632,7 @@ var Form = function Form(container, formElement, options) {
20635
20632
  return recipients;
20636
20633
  };
20637
20634
  this.loadVideomail = function (videomail) {
20635
+ debug("Form: loadVideomail()");
20638
20636
  var limit = formElement.elements.length;
20639
20637
  var input;
20640
20638
  var name;
@@ -20643,10 +20641,6 @@ var Form = function Form(container, formElement, options) {
20643
20641
  name = input.name;
20644
20642
  if (videomail[name]) {
20645
20643
  input.value = videomail[name];
20646
- // Important so that any other JS framework can detect changes
20647
- input.dispatchEvent(new Event("input", {
20648
- bubbles: true
20649
- }));
20650
20644
  }
20651
20645
  if (name === options.selectors.subjectInputName || name === options.selectors.bodyInputName) {
20652
20646
  input.disabled = true;
@@ -20684,27 +20678,36 @@ var Form = function Form(container, formElement, options) {
20684
20678
  this.enable = function (buttonsToo) {
20685
20679
  setDisabled(false, buttonsToo);
20686
20680
  };
20681
+ function removeAllInputListeners() {
20682
+ var inputElements = getInputElements();
20683
+ for (var i = 0, len = inputElements.length; i < len; i++) {
20684
+ var inputElement = inputElements[i];
20685
+ if (inputElement.type === "radio") {
20686
+ inputElement.removeEventListener("change", container.validate.bind(container));
20687
+ } else {
20688
+ inputElement.removeEventListener("input", container.validate.bind(container));
20689
+ }
20690
+ }
20691
+ var selectElements = getSelectElements();
20692
+ for (var j = 0, len2 = selectElements.length; j < len2; j++) {
20693
+ selectElements[j].removeEventListener("change", container.validate.bind(container));
20694
+ }
20695
+ }
20687
20696
  this.build = function () {
20697
+ debug("Form: build()");
20688
20698
  if (options.enableAutoValidation) {
20689
20699
  var inputElements = getInputElements();
20690
- var inputElement;
20691
20700
  for (var i = 0, len = inputElements.length; i < len; i++) {
20692
- inputElement = inputElements[i];
20701
+ var inputElement = inputElements[i];
20693
20702
  if (inputElement.type === "radio") {
20694
- inputElement.addEventListener("change", function () {
20695
- container.validate();
20696
- });
20703
+ inputElement.addEventListener("change", container.validate.bind(container));
20697
20704
  } else {
20698
- inputElement.addEventListener("input", function () {
20699
- container.validate();
20700
- });
20705
+ inputElement.addEventListener("input", container.validate.bind(container));
20701
20706
  }
20702
20707
  }
20703
20708
  var selectElements = getSelectElements();
20704
20709
  for (var j = 0, len2 = selectElements.length; j < len2; j++) {
20705
- selectElements[j].addEventListener("change", function () {
20706
- container.validate();
20707
- });
20710
+ selectElements[j].addEventListener("change", container.validate.bind(container));
20708
20711
  }
20709
20712
  }
20710
20713
  keyInput = formElement.querySelector("input[name=\"".concat(options.selectors.keyInputName, "\"]"));
@@ -20772,6 +20775,7 @@ var Form = function Form(container, formElement, options) {
20772
20775
  }
20773
20776
  this.unload = function () {
20774
20777
  debug("Form: unload()");
20778
+ removeAllInputListeners();
20775
20779
  this.removeAllListeners();
20776
20780
  stopListeningToSubmitEvents();
20777
20781
  };