videomail-client 9.2.13 → 9.2.14
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
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
<form action="/contact" method="post" id="someForm">
|
|
30
30
|
<input name="from" type="email" placeholder="Enter your email address" required />
|
|
31
31
|
<input name="subject" type="text" placeholder="Enter a subject" required />
|
|
32
|
+
<!-- Just for testing the isRegisteredFormField function, not relevant -->
|
|
33
|
+
<input name="phone" type="text" placeholder="Enter a phone number" />
|
|
32
34
|
<fieldset>
|
|
33
35
|
<legend>How do you want to contact us?</legend>
|
|
34
36
|
<p>
|
|
@@ -17267,7 +17267,7 @@ function wrappy (fn, cb) {
|
|
|
17267
17267
|
},{}],116:[function(_dereq_,module,exports){
|
|
17268
17268
|
module.exports={
|
|
17269
17269
|
"name": "videomail-client",
|
|
17270
|
-
"version": "9.2.
|
|
17270
|
+
"version": "9.2.14",
|
|
17271
17271
|
"description": "A wicked npm package to record videos directly in the browser, wohooo!",
|
|
17272
17272
|
"keywords": [
|
|
17273
17273
|
"webcam",
|
|
@@ -19875,6 +19875,8 @@ var Container = function Container(options) {
|
|
|
19875
19875
|
if (options.enableAutoUnload) {
|
|
19876
19876
|
window.addEventListener("beforeunload", function (e) {
|
|
19877
19877
|
self.unload(e);
|
|
19878
|
+
}, {
|
|
19879
|
+
once: true
|
|
19878
19880
|
});
|
|
19879
19881
|
}
|
|
19880
19882
|
if (!playerOnly) {
|
|
@@ -20617,6 +20619,17 @@ var Form = function Form(container, formElement, options) {
|
|
|
20617
20619
|
_eventEmitter.default.call(this, options, "Form");
|
|
20618
20620
|
var debug = options.debug;
|
|
20619
20621
|
var self = this;
|
|
20622
|
+
var FORM_FIELDS = {
|
|
20623
|
+
subject: options.selectors.subjectInputName,
|
|
20624
|
+
from: options.selectors.fromInputName,
|
|
20625
|
+
to: options.selectors.toInputName,
|
|
20626
|
+
cc: options.selectors.ccInputName,
|
|
20627
|
+
bcc: options.selectors.bccInputName,
|
|
20628
|
+
body: options.selectors.bodyInputName,
|
|
20629
|
+
key: options.selectors.keyInputName,
|
|
20630
|
+
parentKey: options.selectors.parentKeyInputName,
|
|
20631
|
+
sendCopy: options.selectors.sendCopyInputName
|
|
20632
|
+
};
|
|
20620
20633
|
var keyInput;
|
|
20621
20634
|
function getData() {
|
|
20622
20635
|
return (0, _getFormData.default)(formElement, {
|
|
@@ -20624,17 +20637,6 @@ var Form = function Form(container, formElement, options) {
|
|
|
20624
20637
|
});
|
|
20625
20638
|
}
|
|
20626
20639
|
this.transformFormData = function (formData) {
|
|
20627
|
-
var FORM_FIELDS = {
|
|
20628
|
-
subject: options.selectors.subjectInputName,
|
|
20629
|
-
from: options.selectors.fromInputName,
|
|
20630
|
-
to: options.selectors.toInputName,
|
|
20631
|
-
cc: options.selectors.ccInputName,
|
|
20632
|
-
bcc: options.selectors.bccInputName,
|
|
20633
|
-
body: options.selectors.bodyInputName,
|
|
20634
|
-
key: options.selectors.keyInputName,
|
|
20635
|
-
parentKey: options.selectors.parentKeyInputName,
|
|
20636
|
-
sendCopy: options.selectors.sendCopyInputName
|
|
20637
|
-
};
|
|
20638
20640
|
var transformedFormData = {};
|
|
20639
20641
|
Object.keys(FORM_FIELDS).forEach(function (key) {
|
|
20640
20642
|
var formFieldValue = FORM_FIELDS[key];
|
|
@@ -20722,46 +20724,47 @@ var Form = function Form(container, formElement, options) {
|
|
|
20722
20724
|
this.enable = function (buttonsToo) {
|
|
20723
20725
|
setDisabled(false, buttonsToo);
|
|
20724
20726
|
};
|
|
20725
|
-
function
|
|
20726
|
-
var
|
|
20727
|
-
|
|
20728
|
-
|
|
20729
|
-
|
|
20730
|
-
inputElement.removeEventListener("change", container.validate);
|
|
20731
|
-
} else {
|
|
20732
|
-
inputElement.removeEventListener("input", container.validate);
|
|
20733
|
-
}
|
|
20734
|
-
}
|
|
20735
|
-
var selectElements = getSelectElements();
|
|
20736
|
-
for (var j = 0, len2 = selectElements.length; j < len2; j++) {
|
|
20737
|
-
selectElements[j].removeEventListener("change", container.validate);
|
|
20738
|
-
}
|
|
20727
|
+
function isRegisteredFormField(formElement) {
|
|
20728
|
+
var formElementName = formElement.name;
|
|
20729
|
+
var registeredFormFieldNames = Object.values(FORM_FIELDS);
|
|
20730
|
+
var isRegistered = registeredFormFieldNames.includes(formElementName);
|
|
20731
|
+
return isRegistered;
|
|
20739
20732
|
}
|
|
20740
20733
|
this.build = function () {
|
|
20741
20734
|
debug("Form: build()");
|
|
20735
|
+
keyInput = formElement.querySelector("input[name=\"".concat(options.selectors.keyInputName, "\"]"));
|
|
20736
|
+
if (!keyInput) {
|
|
20737
|
+
keyInput = (0, _hyperscript.default)("input", {
|
|
20738
|
+
name: options.selectors.keyInputName,
|
|
20739
|
+
type: "hidden"
|
|
20740
|
+
});
|
|
20741
|
+
formElement.appendChild(keyInput);
|
|
20742
|
+
}
|
|
20742
20743
|
if (options.enableAutoValidation) {
|
|
20743
20744
|
var inputElements = getInputElements();
|
|
20744
20745
|
for (var i = 0, len = inputElements.length; i < len; i++) {
|
|
20745
20746
|
var inputElement = inputElements[i];
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20747
|
+
|
|
20748
|
+
// Only listen to form inputs we are interested in,
|
|
20749
|
+
// ignore the others, like multi email input in videomail
|
|
20750
|
+
if (isRegisteredFormField(inputElement)) {
|
|
20751
|
+
if (inputElement.type === "radio") {
|
|
20752
|
+
inputElement.addEventListener("change", container.validate);
|
|
20753
|
+
} else {
|
|
20754
|
+
inputElement.addEventListener("input", container.validate);
|
|
20755
|
+
}
|
|
20750
20756
|
}
|
|
20751
20757
|
}
|
|
20752
20758
|
var selectElements = getSelectElements();
|
|
20753
20759
|
for (var j = 0, len2 = selectElements.length; j < len2; j++) {
|
|
20754
|
-
selectElements[j]
|
|
20760
|
+
var selectElement = selectElements[j];
|
|
20761
|
+
|
|
20762
|
+
// Only listen to form selects we are interested in, ignore the others
|
|
20763
|
+
if (isRegisteredFormField(selectElement)) {
|
|
20764
|
+
selectElement.addEventListener("change", container.validate);
|
|
20765
|
+
}
|
|
20755
20766
|
}
|
|
20756
20767
|
}
|
|
20757
|
-
keyInput = formElement.querySelector("input[name=\"".concat(options.selectors.keyInputName, "\"]"));
|
|
20758
|
-
if (!keyInput) {
|
|
20759
|
-
keyInput = (0, _hyperscript.default)("input", {
|
|
20760
|
-
name: options.selectors.keyInputName,
|
|
20761
|
-
type: "hidden"
|
|
20762
|
-
});
|
|
20763
|
-
formElement.appendChild(keyInput);
|
|
20764
|
-
}
|
|
20765
20768
|
this.on(_events.default.PREVIEW, function (videomailKey) {
|
|
20766
20769
|
/*
|
|
20767
20770
|
* beware that preview doesn't always come with a key, i.E.
|
|
@@ -20813,6 +20816,21 @@ var Form = function Form(container, formElement, options) {
|
|
|
20813
20816
|
startListeningToSubmitEvents();
|
|
20814
20817
|
});
|
|
20815
20818
|
};
|
|
20819
|
+
function removeAllInputListeners() {
|
|
20820
|
+
var inputElements = getInputElements();
|
|
20821
|
+
for (var i = 0, len = inputElements.length; i < len; i++) {
|
|
20822
|
+
var inputElement = inputElements[i];
|
|
20823
|
+
if (inputElement.type === "radio") {
|
|
20824
|
+
inputElement.removeEventListener("change", container.validate);
|
|
20825
|
+
} else {
|
|
20826
|
+
inputElement.removeEventListener("input", container.validate);
|
|
20827
|
+
}
|
|
20828
|
+
}
|
|
20829
|
+
var selectElements = getSelectElements();
|
|
20830
|
+
for (var j = 0, len2 = selectElements.length; j < len2; j++) {
|
|
20831
|
+
selectElements[j].removeEventListener("change", container.validate);
|
|
20832
|
+
}
|
|
20833
|
+
}
|
|
20816
20834
|
function hideSubmitButton() {
|
|
20817
20835
|
var submitButton = self.findSubmitButton();
|
|
20818
20836
|
(0, _hidden.default)(submitButton, true);
|
|
@@ -23261,12 +23279,16 @@ var Replay = function Replay(parentElement, options) {
|
|
|
23261
23279
|
// this forces to actually fetch the videos from the server
|
|
23262
23280
|
replayElement.load();
|
|
23263
23281
|
if (!videomail) {
|
|
23264
|
-
replayElement.addEventListener("canplaythrough", function (
|
|
23265
|
-
self.emit(_events.default.PREVIEW_SHOWN
|
|
23282
|
+
replayElement.addEventListener("canplaythrough", function () {
|
|
23283
|
+
self.emit(_events.default.PREVIEW_SHOWN);
|
|
23284
|
+
}, {
|
|
23285
|
+
once: true
|
|
23266
23286
|
});
|
|
23267
23287
|
} else {
|
|
23268
|
-
replayElement.addEventListener("canplaythrough", function (
|
|
23269
|
-
self.emit(_events.default.REPLAY_SHOWN
|
|
23288
|
+
replayElement.addEventListener("canplaythrough", function () {
|
|
23289
|
+
self.emit(_events.default.REPLAY_SHOWN);
|
|
23290
|
+
}, {
|
|
23291
|
+
once: true
|
|
23270
23292
|
});
|
|
23271
23293
|
}
|
|
23272
23294
|
};
|