isobit-ui 0.0.287 → 0.0.288

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 (2) hide show
  1. package/dist/index.js +211 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * isobit-ui v0.0.287
2
+ * isobit-ui v0.0.288
3
3
  * (c) Erik Alarcon Pinedo
4
4
  * Released under the MIT License.
5
5
  */
@@ -4831,6 +4831,19 @@ function HTML2Canvas(props) {
4831
4831
  };
4832
4832
  }
4833
4833
 
4834
+ var f = {
4835
+ value: function value(v) {
4836
+ var a = this;
4837
+
4838
+ for (var i = 0; i < a.length; i++) {
4839
+ if (a[i] == v) return true;
4840
+ }
4841
+
4842
+ return false;
4843
+ }
4844
+ };
4845
+ if (![].contains) Object.defineProperty(Array.prototype, 'contains', f);
4846
+ if (!"".contains) Object.defineProperty(String.prototype, 'contains', f);
4834
4847
  _ = Object.assign(_, {
4835
4848
  remoteServer: '',
4836
4849
  _id: 0,
@@ -4851,6 +4864,18 @@ _ = Object.assign(_, {
4851
4864
 
4852
4865
  return parent;
4853
4866
  },
4867
+ contains: function contains(a, b) {
4868
+ return a && a.includes(b);
4869
+ },
4870
+ uiParent: function uiParent(e) {
4871
+ return e.ui || !e ? e : _.uiParent(e.$parent);
4872
+ },
4873
+ closest: function closest(el, sel) {
4874
+ while ((el = el.parentElement) && !(el.matches || el.matchesSelector).call(el, sel)) {
4875
+ }
4876
+
4877
+ return el;
4878
+ },
4854
4879
  fadeOut: function fadeOut(id, val) {
4855
4880
  if (isNaN(val)) {
4856
4881
  val = 9;
@@ -4892,16 +4917,193 @@ _ = Object.assign(_, {
4892
4917
  }
4893
4918
 
4894
4919
  return i;
4895
- }
4896
- });
4920
+ },
4921
+ mask: function mask(ms, cfg) {
4922
+ if (!document.body) return;
4923
+ var center = document.createElement("div");
4924
+ center.style = 'top:50%;transform:translate(-50%,-50%);position:absolute;width:100%;z-index:2';
4925
+ var s = center.style;
4926
+ s.left = '50%';
4927
+ s.textAlign = 'center';
4928
+
4929
+ if (ms !== false) {
4930
+ if (ms instanceof Element) {
4931
+ center = ms; //.append(ms);
4932
+ } else {
4933
+ if (ms) {
4934
+ var d = document.createElement('div');
4935
+ d.innerHTML = ms;
4936
+ center.append(d);
4937
+ center.style = "padding:4px;margin-bottom:5px;color:white;font-size:24px;text-align:center";
4938
+ }
4897
4939
 
4898
- _.sum = function (c) {
4899
- return this.reduce(function (a, b) {
4900
- b = c ? b[c] : b;
4901
- return a + (b ? Number(b) : 0);
4902
- }, 0);
4903
- };
4940
+ var img = document.createElement('div');
4941
+ s = img.style;
4942
+ s.width = '100%';
4943
+ s.height = '180px';
4944
+ img.className = 'loading';
4945
+ }
4946
+ }
4947
+
4948
+ var p = document.createElement('div');
4949
+ s = p.style;
4950
+ s.height = '100%';
4951
+ s.top = '0px';
4952
+ s.position = 'absolute';
4953
+ s.left = '0';
4954
+ s.zIndex = 10000;
4955
+ s.width = '100%';
4956
+ var bg = document.createElement('div');
4957
+ s = bg.style;
4958
+ s.height = '100%';
4959
+ s.width = '100%';
4960
+ s.top = '0';
4961
+ s.position = 'absolute';
4962
+ s.left = '0';
4963
+ s.backgroundColor = 'rgba(0,0,0,0.5)';
4964
+ if (cfg && cfg.opacity) s.opacity = cfg.opacity;
4965
+ if (cfg && cfg.backgroundColor) s.backgroundColor = cfg.backgroundColor;
4966
+ p.appendChild(bg);
4967
+ p.appendChild(center);
4968
+ if (img) center.appendChild(img);
4969
+ document.body.appendChild(p);
4970
+ return p;
4971
+ },
4972
+ unmask: function unmask(m) {
4973
+ if (m) {
4974
+ m.style.display = "none";
4975
+ if (m.parentNode) m.parentNode.removeChild(m);
4976
+ }
4977
+ },
4978
+ clean: function clean(obj) {
4979
+ for (var propName in obj) {
4980
+ if (obj[propName] === '' || obj[propName] === null || obj[propName] === undefined) {
4981
+ delete obj[propName];
4982
+ }
4983
+ }
4984
+
4985
+ return obj;
4986
+ },
4987
+ processURL: function processURL(s) {
4988
+ //console.log(s);
4989
+ return s;
4990
+ },
4991
+ loadCSS: function loadCSS(url) {
4992
+ var head = document.getElementsByTagName('head')[0];
4993
+ var link = document.createElement('link'); //link.id = cssId;
4994
+
4995
+ link.rel = 'stylesheet';
4996
+ link.type = 'text/css';
4997
+ link.href = url;
4998
+ link.media = 'all';
4999
+ head.appendChild(link);
5000
+ },
5001
+ go: function go(u) {
5002
+ window.location = u;
5003
+ },
5004
+ getCurrentPosition: function getCurrentPosition() {
5005
+ return new Promise(function (res, rej) {
5006
+ if (_.location) {
5007
+ var id = 'result' + _.id();
5008
+
5009
+ _[id] = function (r) {
5010
+ delete _[id];
5011
+
5012
+ if (r.coords) {
5013
+ res(r);
5014
+ } else rej(r);
5015
+ };
5016
+
5017
+ _.location(id);
5018
+ } else if (navigator.geolocation) {
5019
+ navigator.geolocation.getCurrentPosition(res, rej);
5020
+ }
5021
+ });
5022
+ },
5023
+ URL: function URL(path) {
5024
+ var me = this;
5025
+ me.location = window.location;
5026
+ me.path = path ? path : window.location.pathname;
5027
+ var h = me.path.split('?');
5028
+
5029
+ if (h.length > 1) {
5030
+ me.path = h[0];
5031
+ h = h[1].split('#');
5032
+ me.query = h[0];
5033
+ } else {
5034
+ h = h[0].split('#');
5035
+ me.path = h[0];
5036
+ }
5037
+
5038
+ me.get = function (key, def) {
5039
+ if (me.query) {
5040
+ var kvp = me.query.split('&');
5041
+ var i = kvp.length;
5042
+ var x;
5043
+
5044
+ while (i--) {
5045
+ x = kvp[i].split('=');
5046
+
5047
+ if (x[0] == key) {
5048
+ return x[1];
5049
+ }
5050
+ }
5051
+ }
5052
+
5053
+ return def;
5054
+ };
5055
+
5056
+ me.put = function (key, value) {
5057
+ key = encodeURI(key);
5058
+ value = encodeURI(value);
5059
+ var kvp = me.path.split('?');
5060
+ if (kvp.length > 1) kvp = kvp[1].split('&');
5061
+ var i = kvp.length;
5062
+ var x;
4904
5063
 
5064
+ while (i--) {
5065
+ x = kvp[i].split('=');
5066
+
5067
+ if (x[0] == key) {
5068
+ x[1] = value;
5069
+ kvp[i] = x.join('=');
5070
+ break;
5071
+ }
5072
+ }
5073
+
5074
+ if (i < 0) {
5075
+ kvp[kvp.length] = [key, value].join('=');
5076
+ } //this will reload the page, it's likely better to store this until finished
5077
+ //document.location.search = kvp.join('&');
5078
+ //console.log('pathname='+me.location.pathname);
5079
+ //console.log('query='+kvp.join('&'));
5080
+ //console.log('hash='+me.location.hash);
5081
+
5082
+
5083
+ return me.location.pathname + '?' + kvp.join('&') + me.location.hash;
5084
+ };
5085
+ },
5086
+ loadScript: function loadScript(url, callback) {
5087
+ // adding the script tag to the head as suggested before
5088
+ var head = document.getElementsByTagName('head')[0];
5089
+ var script = document.createElement('script');
5090
+ script.type = 'text/javascript';
5091
+ script.src = url; // then bind the event to the callback function
5092
+ // there are several events for cross browser compatibility
5093
+
5094
+ script.onreadystatechange = callback;
5095
+ script.onload = callback; // fire the loading
5096
+
5097
+ head.appendChild(script);
5098
+ },
5099
+ sum: function sum(c) {
5100
+ return this.reduce(function (a, b) {
5101
+ b = c ? b[c] : b;
5102
+ return a + (b ? Number(b) : 0);
5103
+ }, 0);
5104
+ }
5105
+ });
5106
+ _.getLocation = _.getCurrentPosition;
4905
5107
  Vue.id = _.id;
4906
5108
 
4907
5109
  Vue.pad = function (num, size) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isobit-ui",
3
- "version": "0.0.287",
3
+ "version": "0.0.288",
4
4
  "description": "Vue component to play videos",
5
5
  "keywords": [
6
6
  "ui",