@osimatic/helpers-js 1.1.1 → 1.1.2

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.
Files changed (3) hide show
  1. package/index.js +2 -2
  2. package/media.js +20 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -10,7 +10,7 @@ require('./number');
10
10
  const { HTTPClient } = require('./http_client');
11
11
  const { HTTPRequest, Cookie, UrlAndQueryString } = require('./network');
12
12
  const { IBAN, BankCard } = require('./bank');
13
- const { AudioMedia, UserMedia } = require('./media');
13
+ const { AudioMedia, VideoMedia, UserMedia } = require('./media');
14
14
  const { PersonName, Email, TelephoneNumber } = require('./contact_details');
15
15
  const { DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime } = require('./date_time');
16
16
  const { Duration } = require('./duration');
@@ -48,7 +48,7 @@ const { WebSocket } = require('./web_socket');
48
48
 
49
49
  module.exports = {
50
50
  Array, Object, Number, String,
51
- HTTPClient, HTTPRequest, Cookie, UrlAndQueryString, IBAN, BankCard, AudioMedia, UserMedia, PersonName, Email, TelephoneNumber, DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, Duration, File, CSV, Img, FormHelper, Country, PostalAddress, GeographicCoordinates, HexColor, RgbColor, SocialNetwork,
51
+ HTTPClient, HTTPRequest, Cookie, UrlAndQueryString, IBAN, BankCard, AudioMedia, VideoMedia, UserMedia, PersonName, Email, TelephoneNumber, DateTime, TimestampUnix, SqlDate, SqlTime, SqlDateTime, Duration, File, CSV, Img, FormHelper, Country, PostalAddress, GeographicCoordinates, HexColor, RgbColor, SocialNetwork,
52
52
  Browser, DataTable, Pagination, Navigation, DetailsSubArray, SelectAll, MultipleActionInTable, MultipleActionInDivList, EditValue, FormDate, InputPeriod, ShoppingCart, FlashMessage, CountDown, ImportFromCsv, JwtToken, JwtSession, ApiTokenSession, ListBox, WebRTC, WebSocket, EventBus,
53
53
  sleep, refresh, chr, ord, trim, empty,
54
54
  GoogleCharts, GoogleRecaptcha, GoogleMap, OpenStreetMap
package/media.js CHANGED
@@ -115,6 +115,25 @@ class AudioMedia {
115
115
  }
116
116
  }
117
117
 
118
+ class VideoMedia {
119
+ static initPlayPauseClick(videoElement) {
120
+ $(videoElement).click(function(e) {
121
+ // handle click if not Firefox (Firefox supports this feature natively)
122
+ if (typeof InstallTrigger === 'undefined') {
123
+ // get click position
124
+ let clickY = (e.pageY - $(this).offset().top);
125
+ let height = parseFloat( $(this).height() );
126
+
127
+ // avoids interference with controls
128
+ if (clickY > 0.82*height) return;
129
+
130
+ // toggles play / pause
131
+ this.paused ? this.play() : this.pause();
132
+ }
133
+ });
134
+ }
135
+ }
136
+
118
137
  //Source : https://www.npmjs.com/package/mic-check
119
138
  class UserMedia {
120
139
  static hasGetUserMedia() {
@@ -196,4 +215,4 @@ class UserMedia {
196
215
  }
197
216
  }
198
217
 
199
- module.exports = { AudioMedia, UserMedia };
218
+ module.exports = { AudioMedia, VideoMedia, UserMedia };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osimatic/helpers-js",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "main": "main.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"