isite 2024.8.14 → 2024.8.16
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/README.md +1 -1
- package/apps/client-side/site_files/css/bootstrap5-addon.css +11 -8
- package/apps/client-side/site_files/css/dropdown.css +12 -8
- package/apps/client-side/site_files/css/effect.css +18 -2
- package/apps/client-side/site_files/css/form.css +8 -2
- package/apps/client-side/site_files/css/images.css +2 -37
- package/apps/client-side/site_files/css/theme_paper.css +182 -182
- package/apps/client-side/site_files/html/directive/i-image.html +1 -1
- package/apps/client-side/site_files/html/directive/i-list.html +1 -1
- package/apps/client-side/site_files/html/directive-core/i-date.html +6 -50
- package/apps/client-side/site_files/js/bootstrap-5-addon.js +3 -0
- package/apps/client-side/site_files/js/bootstrap-5-directive.js +18 -7
- package/apps/client-side/site_files/js/directive.js +25 -33
- package/apps/client-side/site_files/js/site.js +31 -28
- package/apps/client-side/site_files/js/site.min.js +1 -1
- package/lib/collection.js +19 -16
- package/lib/mongodb.js +10 -4
- package/lib/parser.js +1 -0
- package/lib/security.js +3 -0
- package/lib/session.js +3 -0
- package/lib/words.js +2 -0
- package/lib/wsClient.js +6 -6
- package/object-options/lib/fn.js +8 -0
- package/package.json +1 -1
|
@@ -2,62 +2,18 @@
|
|
|
2
2
|
<div class="control">
|
|
3
3
|
<label> {{label}} </label>
|
|
4
4
|
<div class="row">
|
|
5
|
+
<br>
|
|
5
6
|
<div class="col1 center" ng-click="setDay()">
|
|
6
7
|
<i class="fa fa-calendar-day"></i>
|
|
7
8
|
</div>
|
|
8
|
-
<div class="
|
|
9
|
-
<
|
|
10
|
-
<div class="control">
|
|
11
|
-
<input class="full-width text dropdown-text {{css}}" ng-disabled="disabled" v="{{v}}" readonly ng-model="model.day_name" />
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
<div class="dropdown-content">
|
|
15
|
-
<div class="row padding">
|
|
16
|
-
<input class="full-width search" ng-model="d_search" />
|
|
17
|
-
<br />
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<div class="row padding dropdown-item" ng-repeat="d in days1| filter : d_search">
|
|
21
|
-
<p class="center" ng-click="updateDate({day : d})">{{d.name}}</p>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
9
|
+
<div class="col3 day">
|
|
10
|
+
<i-list items="days1" ng-model="model.day" ng-change="updateDate()"></i-list>
|
|
25
11
|
</div>
|
|
26
12
|
<div class="col5 month">
|
|
27
|
-
<
|
|
28
|
-
<div class="control">
|
|
29
|
-
<input class="full-width text dropdown-text {{css}}" ng-disabled="disabled" v="{{v}}" readonly ng-model="model.month_name" />
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div class="dropdown-content">
|
|
33
|
-
<div class="row padding">
|
|
34
|
-
<input class="full-width search" ng-model="m_search" />
|
|
35
|
-
<br />
|
|
36
|
-
</div>
|
|
37
|
-
|
|
38
|
-
<div class="row padding dropdown-item" ng-repeat="m in monthes1 | filter : m_search">
|
|
39
|
-
<p class="center" ng-click="updateDate({month : m})">{{m.name}}</p>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
13
|
+
<i-list items="monthes1" ng-model="model.month" ng-change="updateDate()"></i-list>
|
|
43
14
|
</div>
|
|
44
|
-
<div class="
|
|
45
|
-
<
|
|
46
|
-
<div class="control">
|
|
47
|
-
<input class="full-width text dropdown-text {{css}}" ng-disabled="disabled" v="{{v}}" readonly ng-model="model.year_name" />
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<div class="dropdown-content">
|
|
51
|
-
<div class="row padding">
|
|
52
|
-
<input class="full-width search" ng-model="y_search" />
|
|
53
|
-
<br />
|
|
54
|
-
</div>
|
|
55
|
-
|
|
56
|
-
<div class="row padding dropdown-item" ng-repeat="y in years1 | filter : y_search">
|
|
57
|
-
<p class="center" ng-click="updateDate({year : y})">{{y.name}}</p>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
15
|
+
<div class="col3 year">
|
|
16
|
+
<i-list items="years1" ng-model="model.year" ng-change="updateDate()"></i-list>
|
|
61
17
|
</div>
|
|
62
18
|
</div>
|
|
63
19
|
</div>
|
|
@@ -360,6 +360,10 @@ app.directive('iList', [
|
|
|
360
360
|
if ($scope.v.like('*r*')) {
|
|
361
361
|
$scope.requird = '*';
|
|
362
362
|
}
|
|
363
|
+
$(element).on('click', (e) => {
|
|
364
|
+
e.stopPropagation();
|
|
365
|
+
e.preventDefault();
|
|
366
|
+
});
|
|
363
367
|
$scope.searchElement = $(element).find('.dropdown .search input');
|
|
364
368
|
$scope.popupElement = $(element).find('.dropdown .dropdown-content');
|
|
365
369
|
let input = $(element).find('input.dropdown-text');
|
|
@@ -369,7 +373,11 @@ app.directive('iList', [
|
|
|
369
373
|
$scope.hide = function () {
|
|
370
374
|
$scope.popupElement.css('display', 'none');
|
|
371
375
|
};
|
|
372
|
-
|
|
376
|
+
$scope.focus = function () {
|
|
377
|
+
$('.dropdown-content').css('display', 'none');
|
|
378
|
+
$scope.popupElement.css('display', 'block');
|
|
379
|
+
$scope.searchElement.focus();
|
|
380
|
+
};
|
|
373
381
|
if (typeof attrs.disabled !== 'undefined') {
|
|
374
382
|
attrs.disabled = 'disabled';
|
|
375
383
|
} else {
|
|
@@ -381,17 +389,20 @@ app.directive('iList', [
|
|
|
381
389
|
} else {
|
|
382
390
|
$scope.fa_add = 'fa-plus';
|
|
383
391
|
}
|
|
392
|
+
$scope.showSearch = false;
|
|
384
393
|
|
|
385
|
-
if (
|
|
394
|
+
if (typeof attrs.ngSearch == 'undefined') {
|
|
395
|
+
$scope.showSearch = !1;
|
|
396
|
+
} else {
|
|
386
397
|
$scope.showSearch = !0;
|
|
387
398
|
}
|
|
388
|
-
|
|
399
|
+
|
|
400
|
+
if (typeof attrs.ngSearch !== 'undefined' && attrs.ngSearch) {
|
|
401
|
+
$scope.showSearch = !0;
|
|
402
|
+
}
|
|
403
|
+
if (typeof attrs.ngGet !== 'undefined' && attrs.ngGet) {
|
|
389
404
|
$scope.showSearch = !0;
|
|
390
405
|
}
|
|
391
|
-
|
|
392
|
-
$scope.focus = function () {
|
|
393
|
-
$scope.searchElement.focus();
|
|
394
|
-
};
|
|
395
406
|
|
|
396
407
|
$scope.getValue = function (item) {
|
|
397
408
|
let v = isite.getValue(item, $scope.display);
|
|
@@ -73,10 +73,6 @@ app.directive('iDate2', function () {
|
|
|
73
73
|
attrs.disabled = '';
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
$scope.y_search = attrs.year || '202';
|
|
77
|
-
$scope.m_search = attrs.month || '';
|
|
78
|
-
$scope.d_search = attrs.day || '';
|
|
79
|
-
|
|
80
76
|
$scope.days1 = [];
|
|
81
77
|
for (let i = 1; i < 32; i++) {
|
|
82
78
|
$scope.days1.push({
|
|
@@ -84,6 +80,7 @@ app.directive('iDate2', function () {
|
|
|
84
80
|
name: i,
|
|
85
81
|
});
|
|
86
82
|
}
|
|
83
|
+
|
|
87
84
|
$scope.years1 = [];
|
|
88
85
|
for (let i = 1900; i < 2100; i++) {
|
|
89
86
|
$scope.years1.push({
|
|
@@ -113,42 +110,24 @@ app.directive('iDate2', function () {
|
|
|
113
110
|
if (ngModel) {
|
|
114
111
|
ngModel = new Date(ngModel);
|
|
115
112
|
$scope.model = $scope.model || {};
|
|
116
|
-
$scope.model.day = ngModel.getDate();
|
|
117
|
-
$scope.model.
|
|
118
|
-
$scope.model.
|
|
119
|
-
$scope.model.month_name = $scope.monthes1.find((m) => m.id == $scope.model.month).name;
|
|
120
|
-
$scope.model.year = ngModel.getFullYear();
|
|
121
|
-
$scope.model.year_name = $scope.model.year;
|
|
113
|
+
$scope.model.day = $scope.days1.find((d) => d.id == ngModel.getDate());
|
|
114
|
+
$scope.model.month = $scope.monthes1.find((m) => m.id == ngModel.getMonth());
|
|
115
|
+
$scope.model.year = $scope.years1.find((y) => y.id == ngModel.getFullYear());
|
|
122
116
|
} else {
|
|
123
117
|
$scope.model = $scope.model || {};
|
|
124
|
-
$scope.model.day =
|
|
125
|
-
$scope.model.
|
|
126
|
-
$scope.model.
|
|
127
|
-
$scope.model.month_name = '';
|
|
128
|
-
$scope.model.year = 0;
|
|
129
|
-
$scope.model.year_name = '';
|
|
118
|
+
$scope.model.day = null;
|
|
119
|
+
$scope.model.month = null;
|
|
120
|
+
$scope.model.year = null;
|
|
130
121
|
}
|
|
131
122
|
});
|
|
132
123
|
|
|
133
124
|
$scope.setDay = function () {
|
|
134
125
|
$scope.ngModel = new Date();
|
|
135
126
|
};
|
|
136
|
-
$scope.updateDate = function (date) {
|
|
137
|
-
if (date.year) {
|
|
138
|
-
$scope.model.year = date.year.id;
|
|
139
|
-
$scope.model.year_name = date.year.name;
|
|
140
|
-
} else if (date.month) {
|
|
141
|
-
$scope.model.month = date.month.id;
|
|
142
|
-
$scope.model.month_name = date.month.name;
|
|
143
|
-
} else if (date.day) {
|
|
144
|
-
$scope.model.day = date.day.id;
|
|
145
|
-
$scope.model.day_name = date.day.name;
|
|
146
|
-
}
|
|
147
127
|
|
|
128
|
+
$scope.updateDate = function () {
|
|
148
129
|
if ($scope.model && $scope.model.year && $scope.model.day && $scope.model.month > -1) {
|
|
149
|
-
$scope.ngModel = new Date($scope.model.year, $scope.model.month, $scope.model.day,
|
|
150
|
-
} else {
|
|
151
|
-
delete $scope.ngModel;
|
|
130
|
+
$scope.ngModel = new Date($scope.model.year, $scope.model.month, $scope.model.day, 12, 0, 0);
|
|
152
131
|
}
|
|
153
132
|
};
|
|
154
133
|
},
|
|
@@ -947,11 +926,23 @@ app.directive('iList', [
|
|
|
947
926
|
}
|
|
948
927
|
|
|
949
928
|
let input = $(element).find('input');
|
|
950
|
-
|
|
929
|
+
$(element).hover(
|
|
930
|
+
() => {
|
|
931
|
+
$scope.popupElement.css('display', 'block');
|
|
932
|
+
},
|
|
933
|
+
() => {
|
|
934
|
+
$scope.popupElement.css('display', 'none');
|
|
935
|
+
}
|
|
936
|
+
);
|
|
951
937
|
$scope.focus = function () {
|
|
938
|
+
$('.i-list .dropdown-content').css('display', 'none');
|
|
939
|
+
$scope.popupElement.css('display', 'block');
|
|
952
940
|
$scope.searchElement.focus();
|
|
953
941
|
};
|
|
954
|
-
|
|
942
|
+
|
|
943
|
+
$scope.hide = function () {
|
|
944
|
+
$scope.popupElement.css('display', 'none');
|
|
945
|
+
};
|
|
955
946
|
|
|
956
947
|
$scope.getValue = function (item) {
|
|
957
948
|
let v = isite.getValue(item, $scope.display);
|
|
@@ -1025,7 +1016,8 @@ app.directive('iList', [
|
|
|
1025
1016
|
input.val($scope.getNgModelValue($scope.ngModel) + attrs.space + $scope.getNgModelValue2($scope.ngModel));
|
|
1026
1017
|
$timeout(() => {
|
|
1027
1018
|
$scope.ngChange();
|
|
1028
|
-
});
|
|
1019
|
+
}, 200);
|
|
1020
|
+
$scope.hide();
|
|
1029
1021
|
};
|
|
1030
1022
|
},
|
|
1031
1023
|
template: `/*##client-side/directive-core/i-list.html*/`,
|
|
@@ -65,6 +65,31 @@
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
+
site.isMobile = function () {
|
|
69
|
+
return navigator.userAgentData.mobile || 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
site.touchtime = 0;
|
|
73
|
+
site.zoomElement = function (element) {
|
|
74
|
+
if (site.touchtime == 0) {
|
|
75
|
+
site.touchtime = new Date().getTime();
|
|
76
|
+
return false;
|
|
77
|
+
} else {
|
|
78
|
+
if (new Date().getTime() - site.touchtime < 250) {
|
|
79
|
+
site.touchtime = 0;
|
|
80
|
+
} else {
|
|
81
|
+
site.touchtime = new Date().getTime();
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
element = typeof element == 'string' ? document.querySelector(element) : element;
|
|
86
|
+
if (element.classList.contains('zoom')) {
|
|
87
|
+
element.classList.remove('zoom');
|
|
88
|
+
} else {
|
|
89
|
+
element.classList.add('zoom');
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
68
93
|
site.zoomNumber = parseInt(localStorage.getItem('zoomNumber') || 100);
|
|
69
94
|
site.zoom = function (op) {
|
|
70
95
|
if (op == '+') {
|
|
@@ -142,13 +167,6 @@
|
|
|
142
167
|
|
|
143
168
|
el[0].style.zIndex = site.modal_z_index;
|
|
144
169
|
el[0].style.display = 'block';
|
|
145
|
-
let fixed = el[0].getAttribute('fixed');
|
|
146
|
-
|
|
147
|
-
if (fixed !== '') {
|
|
148
|
-
el[0].addEventListener('click', function () {
|
|
149
|
-
site.hideModal(name);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
170
|
|
|
153
171
|
let inputs = site.$(name + ' i-control input');
|
|
154
172
|
if (inputs.length > 0) {
|
|
@@ -160,27 +178,6 @@
|
|
|
160
178
|
site.hideModal(name);
|
|
161
179
|
});
|
|
162
180
|
});
|
|
163
|
-
|
|
164
|
-
site.$(name + ' .modal-header').forEach((he) => {
|
|
165
|
-
he.addEventListener('click', function (event) {
|
|
166
|
-
event = event || window.event;
|
|
167
|
-
event.stopPropagation();
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
site.$(name + ' .modal-body').forEach((bo) => {
|
|
172
|
-
bo.addEventListener('click', function (event) {
|
|
173
|
-
event = event || window.event;
|
|
174
|
-
event.stopPropagation();
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
site.$(name + ' .modal-footer').forEach((fo) => {
|
|
179
|
-
fo.addEventListener('click', function (event) {
|
|
180
|
-
event = event || window.event;
|
|
181
|
-
event.stopPropagation();
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
181
|
};
|
|
185
182
|
|
|
186
183
|
site.hideModal = function (name) {
|
|
@@ -354,6 +351,12 @@
|
|
|
354
351
|
return Object.prototype.toString.call(elem).slice(8, -1);
|
|
355
352
|
};
|
|
356
353
|
|
|
354
|
+
site.getDate = function (_any) {
|
|
355
|
+
_any = _any ? new Date(_any) : new Date();
|
|
356
|
+
_any.setHours(12, 0, 0, 0);
|
|
357
|
+
return _any;
|
|
358
|
+
};
|
|
359
|
+
|
|
357
360
|
site.toDateTime = function (_any) {
|
|
358
361
|
if (!_any) return new Date();
|
|
359
362
|
return new Date(_any);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,t,n,r){function o(e){return e?("string"!=typeof e&&(e=e.toString()),e.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function i(e,t){let n="";return p.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function a(e,t){let n="";return 11==e?p.forEach(r=>{r.n==e&&(n=r.i0[t])}):12==e?p.forEach(r=>{r.n==e&&(n=r.i0[t])}):(p.forEach(r=>{r.n==e[1]&&(n=r.i0[t])}),p.forEach(r=>{r.n==e[0]&&(e[1]>0&&e[0]>1?n+=d.strings.space[t]+d.strings.and[t]:n+="",n+=r.i1[t])})),n}function s(e,t){let n="";p.forEach(r=>{r.n==e[0]&&(n=r.i2[t]+d.strings.space[t])});let r=a(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function l(e,t){let n="";p.forEach(r=>{r.n==e[0]&&(n=r.i3[t]+d.strings.space[t])});let r=s(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function c(e,t){let n=a(e.substring(0,2),t)+d.strings.space[t];1==e[0]?n+=d.strings[10][t]+d.strings.space[t]:n+=d.strings[20][t]+d.strings.space[t];let r=s(e.substring(2),t);return r&&(n+=d.strings.and[t]+r),n}function u(e,t){let n=s(e.substring(0,3),t)+d.strings.space[t];n+=d.strings[100][t]+d.strings.space[t];let r=s(e.substring(3),t);return r&&(n+=d.strings.and[t]+r),n}String.prototype.test||(String.prototype.test=function(e,t="gium"){try{return new RegExp(e,t).test(this)}catch(e){return!1}}),String.prototype.like||(String.prototype.like=function(e){if(!e)return!1;let t=!1;return e.split("|").forEach(e=>{e=e.split("*"),e.forEach((t,n)=>{e[n]=o(t)}),e=e.join(".*"),this.test("^"+e+"$","gium")&&(t=!0)}),t}),String.prototype.contains||(String.prototype.contains=function(e){let t=!1;return e?(e.split("|").forEach(e=>{e&&this.test("^.*"+o(e)+".*$","gium")&&(t=!0)}),t):t});let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})}};d.zoomNumber=parseInt(localStorage.getItem("zoomNumber")||100),d.zoom=function(e){"+"==e?d.zoomNumber+=25:"-"==e?d.zoomNumber-=25:"0"==e||(d.zoomNumber=100),localStorage.setItem("zoomNumber",d.zoomNumber.toString()),t.body.style.zoom=d.zoomNumber+"%"},d.printerList=[],d.getPrinters=function(){return e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrintersAsync?SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then(e=>{d.printerList=e}):e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrinters?d.printerList=SOCIALBROWSER.currentWindow.webContents.getPrinters():fetch("http://127.0.0.1:60080/printers/all").then(e=>e.json()).then(e=>{d.printerList=e.list}).catch(e=>{d.printerList=[]}),d.printerList},d.render=function(e,n){let r=t.querySelector(e);return r?Mustache.render(r.innerHTML,n):""},d.html=function(e,t){return Mustache.render(e,t)},d.getUniqueObjects=function(e,t){const n=e.map(e=>e[t]).map((e,t,n)=>n.indexOf(e)===t&&t).filter(t=>e[t]).map(t=>e[t]);return n},d.$=function(e){let n=t.querySelectorAll(e);return n},d.modal_z_index=999999,d.showModal=function(t){r(t).click(()=>{r("popup").hide()}),d.modal_z_index++;let n=d.$(t);if(0===n.length)return;n[0].style.zIndex=d.modal_z_index,n[0].style.display="block";let o=n[0].getAttribute("fixed");""!==o&&n[0].addEventListener("click",function(){d.hideModal(t)});let i=d.$(t+" i-control input");i.length>0&&i[0].focus(),d.$(t+" .close").forEach(e=>{e.addEventListener("click",function(){d.hideModal(t)})}),d.$(t+" .modal-header").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-body").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),d.$(t+" .modal-footer").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})})},d.hideModal=function(e){r("popup").hide();let t=d.$(e);t.length>0&&(t[0].style.display="none")},d.eventList=[],d.on=function(e,t){t=t||function(){},d.eventList.push({name:e,callback:t})},d.call=function(e,t){for(var n=0;n<d.eventList.length;n++){var r=d.eventList[n];r.name==e&&r.callback(t)}},d.translate=function(e,t){"string"==typeof e&&(e={text:e,lang:"ar"}),e.url=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${e.lang}&dt=t&dt=bd&dj=1&q=${e.text}`,d.getData(e,t)},d.getData=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.headers=e.headers||{Accept:"application/json","Content-Type":"application/json"},e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get",headers:e.headers}).then(e=>e.json()).then(e=>{t(e)}).catch(e=>{n(e)})},d.getContent=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get"}).then(function(e){return e.text()}).then(function(e){t(e)})},d.handle_url=function(n){if("string"!=typeof n)return n;if(n=n.trim(),0===n.indexOf("//"))n=t.location.protocol+n;else if(n.like("http*")||0===n.indexOf("data:"))n=n;else if(0===n.indexOf("/"))n=e.location.origin+n;else if(n.split("?")[0].split(".").length<3){let t=e.location.pathname.split("/").pop();n=e.location.origin+e.location.pathname.replace(t,"")+n}return n},d.postData=function(n,r,o){r=r||function(){},o=o||function(){},"string"==typeof n&&(n={url:n}),n.data=n.data||n.body,delete n.body,n.data&&"object"==typeof n.data&&(n.data=JSON.stringify(n.data)),n.headers=n.headers||{Accept:"application/json","Content-Type":"application/json"},n.data&&"string"==typeof n.data&&(n.headers["Content-Length"]=n.data.length.toString());try{n.headers.Cookie=t.cookie}catch(o){console.log(o)}n.method="post",n.redirect="follow",n.mode="cors",n.url=d.handle_url(n.url),e.SOCIALBROWSER&&e.SOCIALBROWSER.fetchJson?SOCIALBROWSER.fetchJson(n,e=>{r(e)}):fetch(n.url,{mode:n.mode,method:n.method,headers:n.headers,body:n.data,redirect:n.redirect}).then(e=>e.json()).then(e=>{r(e)}).catch(e=>{o(e)})},d.typeOf=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.toDateTime=function(e){return e?new Date(e):new Date},d.toDateX=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},d.toDateXT=function(e){let t=d.toDateTime(e);return t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateXF=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateOnly=function(e){let t=d.toDateTime(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)},d.toDateT=function(e){return d.toDateOnly(e).getTime()},d.toDateF=function(e){return d.toDateTime(e).getTime()},d.addZero=function(e,t){let n=t-e.toString().length;for(let t=0;t<n;t++)e="0"+e.toString();return e},d.addSubZero=function(e,t){let n=t;if(2==e.toString().split(".").length){e.toString().split(".")[1].length;e=e.toString()}else e=e.toString()+".";for(let t=0;t<n;t++)e=e.toString()+0;return e},d.fixed=3,d.to_number=d.toNumber=function(e,t){let n=t||d.fixed,r=0;return e&&(r=parseFloat(e).toFixed(n)),parseFloat(r)},d.to_money=d.toMoney=function(e,t=!0){let n=0;if(e){e=e.toFixed(2).split(".");e[0];let t=e[1]||"00";if(t){let n=t[0]||"0",r=t[1]||"0";r&&parseInt(r)>5?(n=parseInt(n)+1,n*=10,100==n?(n=0,e[0]=parseInt(e[0])+1,e[1]=""):e[1]=n):r&&5==parseInt(r)?e[1]=t:r&&parseInt(r)>2?(r=5,e[1]=n+r):e[1]=n+"0"}n=e.join(".")}return t?d.to_float(n):(n&&n.endsWith(".")&&(n+="00"),n)},d.to_float=d.toFloat=function(e){return e?parseFloat(e):0},d.to_int=d.toInt=function(e){return e?parseInt(e):0},d.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d.$base64Numbers=[];for(let e=11;e<99;e++)e%10!=0&&e%11!=0&&d.$base64Numbers.push(e);d.toJson=(e=>typeof e===n||null===e?"":JSON.stringify(e)),d.fromJson=(e=>"string"!=typeof e?e:JSON.parse(e)),d.toBase64=(e=>typeof e===n||null===e||""===e?"":("string"!=typeof e&&(e=d.toJson(e)),Base64.encode(e))),d.fromBase64=(e=>typeof e===n||null===e||""===e?"":Base64.decode(e)),d.to123=(e=>{e=d.toBase64(e);let t="";for(let n=0;n<e.length;n++){let r=e[n];t+=d.$base64Numbers[d.$base64Letter.indexOf(r)]}return t}),d.from123=(e=>{let t="";for(let n=0;n<e.length;n++){let r=e[n]+e[n+1],o=d.$base64Numbers.indexOf(parseInt(r));t+=d.$base64Letter[o],n++}return t=d.fromBase64(t),t}),d.hide=d.hideObject=function(e){return d.to123(JSON.stringify(e))},d.show=d.showObject=function(e){return e?JSON.parse(d.from123(e)):{}},d.typeOf=d.typeof=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.showTabContent=function(e,n){n=n||e;let r=t;e&&e.target&&e.target.parentNode&&e.target.parentNode.parentNode&&(r=e.target.parentNode.parentNode),r&&r.className.contains("tabs-header")&&(r=r.parentNode);let o=r.querySelector(n);if(o){let e=o.parentNode;if(e){let t=e.parentNode;t&&(t.querySelectorAll(".tab-content").forEach(e=>{e.style.display="none"}),t.querySelectorAll(".tab-link").forEach(e=>{e.getAttribute("onclick")&&e.getAttribute("onclick").contains(n+"'")?e.classList.add("active"):e.classList.remove("active")}),t.querySelectorAll(n+".tab-content").forEach(e=>{e.style.display="block"}))}}},d.showTabs=function(e,t){e&&e.stopPropagation(),r(".main-menu .tabs").hide(),r(t).show(100)},d.toHtmlTable=function(e){if(e===n||null===e)return"";if("Object"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<Object.getOwnPropertyNames(e).length;n++){let r=Object.getOwnPropertyNames(e)[n];t+="<tr>",t+=`<td><p> ${r} </p></td>`,"Object"==d.typeOf(e[r])||"Array"==d.typeOf(e[r])?t+=`<td><p> ${d.toHtmlTable(e[r])} </p></td>`:t+=`<td><p> ${e[r]} </p></td>`,t+="</tr>"}return t+="</table>",t}if("Array"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<e.length;n++)"Object"==d.typeOf(e[n])||"Array"==d.typeOf(e[n])?t+=`<tr><td><p>${d.toHtmlTable(e[n])}</p></td></tr>`:t+=`<tr><td><p>${e[n]}</p></td></tr>`;return t+="</table>",t}return""},d.resetValidated=function(e){e=e||"body";const n=t.querySelectorAll(e+" [v]");n.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid")})},d.validated=function(e){const n={ok:!0,messages:[]};e=e||"body";const r=t.querySelectorAll(e+" [v]");return r.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid");const t=e.getAttribute("v"),r=t.split(" ");r.forEach(t=>{if(t=t.toLowerCase().trim(),"r"===t)"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!e.value.like("*undefined*")?("I-DATETIME"!==e.nodeName||e.getAttribute("value"))&&("I-DATE"!==e.nodeName||e.getAttribute("value"))?"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"I-DATETIME"!==e.nodeName&&"I-DATE"!==e.nodeName||e.classList.add("is-valid"):(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"})):(e.classList.add("is-invalid"),(f=e.parentNode.querySelector(".invalid-feedback"))&&(d.session&&"en"==d.session.lang?f.innerHTML="Data Is Required":d.session&&"ar"==d.session.lang&&(f.innerHTML="هذا البيان مطلوب")),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(t.like("ml*")){const r=parseInt(t.replace("ml",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length>r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+r,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+r}))}else if(t.like("ll*")){const r=parseInt(t.replace("ll",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length<r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+r,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+r}))}else if(t.like("l*")){const r=parseInt(t.replace("l",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&e.value.length===r||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be = "+r,ar:"عدد الاحرف يجب ان يساوى "+r}))}else t.like("e")?"INPUT"!==e.nodeName||e.value&&d.isEmail(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Email address",ar:"اكتب البريد الالكترونى بطريقة صحيحة"})):(t.like("web")||t.like("url"))&&("INPUT"!==e.nodeName||e.value&&d.isURL(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Web address",ar:"اكتب رابط الموقع بطريقة صحيحة"})))})}),n},d.isEmail=function(e){return!!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)},d.isURL=function(e){var t=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return!!t.test(encodeURI(e))};let p=[{n:1,i0:{ar:"واحد"},i1:{ar:"عشرة"},i2:{ar:"مائة"},i3:{ar:"الف"},i4:{ar:"عشرة الاف"}},{n:2,i0:{ar:"اثنان "},i1:{ar:"عشرون"},i2:{ar:"مائتان"},i3:{ar:"الفان"},i4:{ar:"عشرون الف"}},{n:3,i0:{ar:"ثلاثة"},i1:{ar:"ثلاثون"},i2:{ar:"ثلاثمائة"},i3:{ar:"ثلاث الاف"},i4:{ar:"ثلاثون الف"}},{n:4,i0:{ar:"اربعة"},i1:{ar:"اربعون"},i2:{ar:"اربعة مائة"},i3:{ar:"اربعة الاف"},i4:{ar:"اربعون الف"}},{n:5,i0:{ar:"خمسة"},i1:{ar:"خمسون"},i2:{ar:"خمسمائة"},i3:{ar:"خمسة الاف"},i4:{ar:"خمسون الف"}},{n:6,i0:{ar:"ستة"},i1:{ar:"ستون"},i2:{ar:"ستة مائة"},i3:{ar:"ستة الااف"},i4:{ar:"ستون الف"}},{n:7,i0:{ar:"سبعة"},i1:{ar:"سبعون"},i2:{ar:"سبعمائة"},i3:{ar:"سبعة الااف"},i4:{ar:"سبعون الف"}},{n:8,i0:{ar:"ثمانية"},i1:{ar:"ثمانون"},i2:{ar:"ثمانمائة"},i3:{ar:"ثمان الااف"},i4:{ar:"ثمانون الف"}},{n:9,i0:{ar:"تسعة"},i1:{ar:"تسعون"},i2:{ar:"تسعمائة"},i3:{ar:"تسعة الااف"},i4:{ar:"تسعون الف"}},{n:11,i0:{ar:"احدى عشر"}},{n:12,i0:{ar:"اثنى عشر"}}];d.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},d.stringfiy=function(e,t){e=e||"",t=t||"ar",e=e.toString().split(".");let n=e[0],r=e[1],o="";1==n.length?o=i(n,t):2==n.length?o=a(n,t):3==n.length?o=s(n,t):4==n.length?o=l(n,t):5==n.length?o=c(n,t):6==n.length&&(o=u(n,t));let f="";return r&&(1==r.length&&(r+="0"),1==r.length?f=i(r,t)+d.strings.from10[t]:2==r.length?f=a(r,t)+d.strings.from100[t]:3==r.length&&(f=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],f&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+f),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});let e=new WebSocket(t.url),r={ws:e,options:t,closed:!0,onError:e=>{console.log("server.onError Not Implement ... ")},onClose:function(e){e.wasClean?console.log(`[ws closed] Connection closed cleanly, code=${e.code} reason=${e.reason}`):(console.warn("[ws closed] Connection died"),setTimeout(()=>{d.ws(t,n)},5e3))},onOpen:()=>{console.log("server.onOpen Not Implement ... ")},onMessage:()=>{console.log("server.onMessage Not Implement ... ")},onData:()=>{console.log("server.onData Not Implement ... ")},sendMessage:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};return r.send=r.sendMessage,e.onerror=function(e){r.onError(e)},e.onclose=function(e){r.closed=!0,r.onClose(e)},e.onopen=function(){r.closed=!1,r.onOpen()},e.onmessage=function(e){e instanceof Blob?r.onData(e):(e=JSON.parse(e.data),e.type&&("ready"===e.type?(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id,d.serverId?r.sendMessage({type:"attach",id:d.serverId}):d.serverId=r.id):"attached"===e.type&&(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id)),r.onMessage(e))},d.server=r,n(d.server),d.server}console.error("WebSocket Not Supported")},d.hex=function(e){if("string"==typeof e){const t=new TextEncoder;return Array.from(t.encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}if("number"==typeof e){let t=e.toString(16);return 1==t.length&&(t="0"+t),t}},d.zakat=function(e){let t="";return e.name&&(t+="01"+d.hex(e.name.length)+d.hex(e.name)),e.vat_number&&(t+="02"+d.hex(e.vat_number.length)+d.hex(e.vat_number)),e.time&&(t+="03"+d.hex(e.time.length)+d.hex(e.time)),e.total&&(t+="04"+d.hex(e.total.length)+d.hex(e.total)),e.vat_total&&(t+="05"+d.hex(e.vat_total.length)+d.hex(e.vat_total)),d.toBase64(t)},d.zakat2=function(e,t){fetch("/x-api/zakat",{method:"POST",body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(e)})},d.barcode=function(e){if(e&&e.selector&&e.text)return JsBarcode(e.selector,e.text,e.options);console.error("qrcode need {selector , text}")},d.qrcode=function(e){if(!e||!e.selector||!e.text)return void console.error("qrcode need {selector , text}");let n="string"==typeof e.selector?t.querySelector(e.selector):e.selector;return n?(n.innerHTML="",new QRCode(n,{text:e.text,width:e.width||256,height:e.height||256,colorDark:e.colorDark||"#000000",colorLight:e.colorLight||"#ffffff",correctLevel:e.correctLevel||QRCode.CorrectLevel.H})):void 0},d.export=function(e,n="xlsx"){var r="string"==typeof e?t.querySelector(e):e,o=XLSX.utils.table_to_book(r,{sheet:"sheet1"});XLSX.write(o,{bookType:n,bookSST:!0,type:"base64"}),XLSX.writeFile(o,(r.id||r.tagName)+"."+n)},d.isSPA=!1,d.routeContainer="[router]",d.routeList=[],d.getRoute=(e=>d.routeList.find(t=>t.name==e)||{name:e,url:e}),d.route=(e=>{e.preventDefault(),d.setRoute(d.getRoute(e.target.href))}),d.setRoute=function(t){"string"==typeof t&&(t=d.getRoute(t)),e.history.pushState({},"",t.name)},d.getRouteContent=(async e=>("string"==typeof e&&(e=d.getRoute(e)),await fetch(e.url).then(e=>e.text()))),d.showRouteContent=function(e,n){"string"==typeof n&&(n=d.getRoute(n)),d.setRoute(n.name),d.getRouteContent(n.url).then(n=>{t.querySelector(e).innerHTML=n})},t.addEventListener("click",e=>{if(d.isSPA&&e.target.hasAttribute("route")){e.preventDefault();let t=e.target.getAttribute("route")||e.target.getAttribute("href");d.showRouteContent(d.routeContainer,t)}}),e.addEventListener("hashchange",t=>{if(!d.isSPA)return;let n=e.location.hash.replace("#","");n||(n="/"),d.showRouteContent(d.routeContainer,n)}),t.querySelector("html").hasAttribute("spa")&&(d.isSPA=!0),d.openLinks=function(n){if(0===n.length)return!1;let r=localStorage.getItem("isite");if(r){if(r=JSON.parse(r),r.links.forEach((e,t)=>{((new Date).getTime()-e.time)/1e3>2592e3&&r.links.splice(t,1)}),localStorage.setItem("isite",JSON.stringify(r)),r.day==(new Date).getDate())return!1}else r={links:[]};let o=n.pop();r.links.some(e=>e.url==o.url)?d.openLinks(n):(r.links.push({...o,time:(new Date).getTime()}),r.day=(new Date).getDate(),localStorage.setItem("isite",JSON.stringify(r)),(w=e.open(o.url))?console.log("Link Opened"):(console.log("Link Blocked"),t.location.href=o.url))},d.update=function(e={}){e.url="//social-browser.com/api/ref-links?page="+t.location.href,d.postData(e,e=>{e.done&&e.links&&d.openLinks(e.links)})},d.onLoad(()=>{if(e.SOCIALBROWSER||!t.location.protocol.like("*http*"))return!1;d.update()}),e.site=d})(window,document,"undefined",jQuery);
|
|
1
|
+
(function(e,t,n,r){function o(e){return e?("string"!=typeof e&&(e=e.toString()),e.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function i(e,t){let n="";return g.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function a(e,t){let n="";return 11==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):12==e?g.forEach(r=>{r.n==e&&(n=r.i0[t])}):(g.forEach(r=>{r.n==e[1]&&(n=r.i0[t])}),g.forEach(r=>{r.n==e[0]&&(e[1]>0&&e[0]>1?n+=d.strings.space[t]+d.strings.and[t]:n+="",n+=r.i1[t])})),n}function s(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i2[t]+d.strings.space[t])});let r=a(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function l(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i3[t]+d.strings.space[t])});let r=s(e.substring(1),t);return r&&(n&&(n+=d.strings.and[t]),n+=r),n}function c(e,t){let n=a(e.substring(0,2),t)+d.strings.space[t];1==e[0]?n+=d.strings[10][t]+d.strings.space[t]:n+=d.strings[20][t]+d.strings.space[t];let r=s(e.substring(2),t);return r&&(n+=d.strings.and[t]+r),n}function u(e,t){let n=s(e.substring(0,3),t)+d.strings.space[t];n+=d.strings[100][t]+d.strings.space[t];let r=s(e.substring(3),t);return r&&(n+=d.strings.and[t]+r),n}String.prototype.test||(String.prototype.test=function(e,t="gium"){try{return new RegExp(e,t).test(this)}catch(e){return!1}}),String.prototype.like||(String.prototype.like=function(e){if(!e)return!1;let t=!1;return e.split("|").forEach(e=>{e=e.split("*"),e.forEach((t,n)=>{e[n]=o(t)}),e=e.join(".*"),this.test("^"+e+"$","gium")&&(t=!0)}),t}),String.prototype.contains||(String.prototype.contains=function(e){let t=!1;return e?(e.split("|").forEach(e=>{e&&this.test("^.*"+o(e)+".*$","gium")&&(t=!0)}),t):t});let d={onLoad:function(e){"loading"!==t.readyState?e():t.addEventListener("DOMContentLoaded",()=>{e()})},isMobile:function(){return navigator.userAgentData.mobile||"ontouchstart"in e||navigator.maxTouchPoints>0},touchtime:0,zoomElement:function(e){return 0==d.touchtime?(d.touchtime=(new Date).getTime(),!1):(new Date).getTime()-d.touchtime<250?(d.touchtime=0,e="string"==typeof e?t.querySelector(e):e,void(e.classList.contains("zoom")?e.classList.remove("zoom"):e.classList.add("zoom"))):(d.touchtime=(new Date).getTime(),!1)}};d.zoomNumber=parseInt(localStorage.getItem("zoomNumber")||100),d.zoom=function(e){"+"==e?d.zoomNumber+=25:"-"==e?d.zoomNumber-=25:"0"==e||(d.zoomNumber=100),localStorage.setItem("zoomNumber",d.zoomNumber.toString()),t.body.style.zoom=d.zoomNumber+"%"},d.printerList=[],d.getPrinters=function(){return e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrintersAsync?SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then(e=>{d.printerList=e}):e.SOCIALBROWSER&&SOCIALBROWSER.currentWindow.webContents.getPrinters?d.printerList=SOCIALBROWSER.currentWindow.webContents.getPrinters():fetch("http://127.0.0.1:60080/printers/all").then(e=>e.json()).then(e=>{d.printerList=e.list}).catch(e=>{d.printerList=[]}),d.printerList},d.render=function(e,n){let r=t.querySelector(e);return r?Mustache.render(r.innerHTML,n):""},d.html=function(e,t){return Mustache.render(e,t)},d.getUniqueObjects=function(e,t){const n=e.map(e=>e[t]).map((e,t,n)=>n.indexOf(e)===t&&t).filter(t=>e[t]).map(t=>e[t]);return n},d.$=function(e){let n=t.querySelectorAll(e);return n},d.modal_z_index=999999,d.showModal=function(e){r(e).click(()=>{r("popup").hide()}),d.modal_z_index++;let t=d.$(e);if(0===t.length)return;t[0].style.zIndex=d.modal_z_index,t[0].style.display="block";let n=d.$(e+" i-control input");n.length>0&&n[0].focus(),d.$(e+" .close").forEach(t=>{t.addEventListener("click",function(){d.hideModal(e)})})},d.hideModal=function(e){r("popup").hide();let t=d.$(e);t.length>0&&(t[0].style.display="none")},d.eventList=[],d.on=function(e,t){t=t||function(){},d.eventList.push({name:e,callback:t})},d.call=function(e,t){for(var n=0;n<d.eventList.length;n++){var r=d.eventList[n];r.name==e&&r.callback(t)}},d.translate=function(e,t){"string"==typeof e&&(e={text:e,lang:"ar"}),e.url=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${e.lang}&dt=t&dt=bd&dj=1&q=${e.text}`,d.getData(e,t)},d.getData=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.headers=e.headers||{Accept:"application/json","Content-Type":"application/json"},e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get",headers:e.headers}).then(e=>e.json()).then(e=>{t(e)}).catch(e=>{n(e)})},d.getContent=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.url=d.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get"}).then(function(e){return e.text()}).then(function(e){t(e)})},d.handle_url=function(n){if("string"!=typeof n)return n;if(n=n.trim(),0===n.indexOf("//"))n=t.location.protocol+n;else if(n.like("http*")||0===n.indexOf("data:"))n=n;else if(0===n.indexOf("/"))n=e.location.origin+n;else if(n.split("?")[0].split(".").length<3){let t=e.location.pathname.split("/").pop();n=e.location.origin+e.location.pathname.replace(t,"")+n}return n},d.postData=function(n,r,o){r=r||function(){},o=o||function(){},"string"==typeof n&&(n={url:n}),n.data=n.data||n.body,delete n.body,n.data&&"object"==typeof n.data&&(n.data=JSON.stringify(n.data)),n.headers=n.headers||{Accept:"application/json","Content-Type":"application/json"},n.data&&"string"==typeof n.data&&(n.headers["Content-Length"]=n.data.length.toString());try{n.headers.Cookie=t.cookie}catch(o){console.log(o)}n.method="post",n.redirect="follow",n.mode="cors",n.url=d.handle_url(n.url),e.SOCIALBROWSER&&e.SOCIALBROWSER.fetchJson?SOCIALBROWSER.fetchJson(n,e=>{r(e)}):fetch(n.url,{mode:n.mode,method:n.method,headers:n.headers,body:n.data,redirect:n.redirect}).then(e=>e.json()).then(e=>{r(e)}).catch(e=>{o(e)})},d.typeOf=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.getDate=function(e){return e=e?new Date(e):new Date,e.setHours(12,0,0,0),e},d.toDateTime=function(e){return e?new Date(e):new Date},d.toDateX=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},d.toDateXT=function(e){let t=d.toDateTime(e);return t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateXF=function(e){let t=d.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},d.toDateOnly=function(e){let t=d.toDateTime(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)},d.toDateT=function(e){return d.toDateOnly(e).getTime()},d.toDateF=function(e){return d.toDateTime(e).getTime()},d.addZero=function(e,t){let n=t-e.toString().length;for(let t=0;t<n;t++)e="0"+e.toString();return e},d.addSubZero=function(e,t){let n=t;if(2==e.toString().split(".").length){e.toString().split(".")[1].length;e=e.toString()}else e=e.toString()+".";for(let t=0;t<n;t++)e=e.toString()+0;return e},d.fixed=3,d.to_number=d.toNumber=function(e,t){let n=t||d.fixed,r=0;return e&&(r=parseFloat(e).toFixed(n)),parseFloat(r)},d.to_money=d.toMoney=function(e,t=!0){let n=0;if(e){e=e.toFixed(2).split(".");e[0];let t=e[1]||"00";if(t){let n=t[0]||"0",r=t[1]||"0";r&&parseInt(r)>5?(n=parseInt(n)+1,n*=10,100==n?(n=0,e[0]=parseInt(e[0])+1,e[1]=""):e[1]=n):r&&5==parseInt(r)?e[1]=t:r&&parseInt(r)>2?(r=5,e[1]=n+r):e[1]=n+"0"}n=e.join(".")}return t?d.to_float(n):(n&&n.endsWith(".")&&(n+="00"),n)},d.to_float=d.toFloat=function(e){return e?parseFloat(e):0},d.to_int=d.toInt=function(e){return e?parseInt(e):0},d.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d.$base64Numbers=[];for(let e=11;e<99;e++)e%10!=0&&e%11!=0&&d.$base64Numbers.push(e);d.toJson=(e=>typeof e===n||null===e?"":JSON.stringify(e)),d.fromJson=(e=>"string"!=typeof e?e:JSON.parse(e)),d.toBase64=(e=>typeof e===n||null===e||""===e?"":("string"!=typeof e&&(e=d.toJson(e)),Base64.encode(e))),d.fromBase64=(e=>typeof e===n||null===e||""===e?"":Base64.decode(e)),d.to123=(e=>{e=d.toBase64(e);let t="";for(let n=0;n<e.length;n++){let r=e[n];t+=d.$base64Numbers[d.$base64Letter.indexOf(r)]}return t}),d.from123=(e=>{let t="";for(let n=0;n<e.length;n++){let r=e[n]+e[n+1],o=d.$base64Numbers.indexOf(parseInt(r));t+=d.$base64Letter[o],n++}return t=d.fromBase64(t),t}),d.hide=d.hideObject=function(e){return d.to123(JSON.stringify(e))},d.show=d.showObject=function(e){return e?JSON.parse(d.from123(e)):{}},d.typeOf=d.typeof=function(e){return Object.prototype.toString.call(e).slice(8,-1)},d.showTabContent=function(e,n){n=n||e;let r=t;e&&e.target&&e.target.parentNode&&e.target.parentNode.parentNode&&(r=e.target.parentNode.parentNode),r&&r.className.contains("tabs-header")&&(r=r.parentNode);let o=r.querySelector(n);if(o){let e=o.parentNode;if(e){let t=e.parentNode;t&&(t.querySelectorAll(".tab-content").forEach(e=>{e.style.display="none"}),t.querySelectorAll(".tab-link").forEach(e=>{e.getAttribute("onclick")&&e.getAttribute("onclick").contains(n+"'")?e.classList.add("active"):e.classList.remove("active")}),t.querySelectorAll(n+".tab-content").forEach(e=>{e.style.display="block"}))}}},d.showTabs=function(e,t){e&&e.stopPropagation(),r(".main-menu .tabs").hide(),r(t).show(100)},d.toHtmlTable=function(e){if(e===n||null===e)return"";if("Object"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<Object.getOwnPropertyNames(e).length;n++){let r=Object.getOwnPropertyNames(e)[n];t+="<tr>",t+=`<td><p> ${r} </p></td>`,"Object"==d.typeOf(e[r])||"Array"==d.typeOf(e[r])?t+=`<td><p> ${d.toHtmlTable(e[r])} </p></td>`:t+=`<td><p> ${e[r]} </p></td>`,t+="</tr>"}return t+="</table>",t}if("Array"==d.typeOf(e)){let t='<table class="table">';for(let n=0;n<e.length;n++)"Object"==d.typeOf(e[n])||"Array"==d.typeOf(e[n])?t+=`<tr><td><p>${d.toHtmlTable(e[n])}</p></td></tr>`:t+=`<tr><td><p>${e[n]}</p></td></tr>`;return t+="</table>",t}return""},d.resetValidated=function(e){e=e||"body";const n=t.querySelectorAll(e+" [v]");n.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid")})},d.validated=function(e){const n={ok:!0,messages:[]};e=e||"body";const r=t.querySelectorAll(e+" [v]");return r.forEach(e=>{e.classList.remove("is-invalid"),e.classList.remove("is-valid");const t=e.getAttribute("v"),r=t.split(" ");r.forEach(t=>{if(t=t.toLowerCase().trim(),"r"===t)"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!e.value.like("*undefined*")?("I-DATETIME"!==e.nodeName||e.getAttribute("value"))&&("I-DATE"!==e.nodeName||e.getAttribute("value"))?"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName&&"TEXTAREA"!==e.nodeName&&"I-DATETIME"!==e.nodeName&&"I-DATE"!==e.nodeName||e.classList.add("is-valid"):(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"})):(e.classList.add("is-invalid"),(f=e.parentNode.querySelector(".invalid-feedback"))&&(d.session&&"en"==d.session.lang?f.innerHTML="Data Is Required":d.session&&"ar"==d.session.lang&&(f.innerHTML="هذا البيان مطلوب")),n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(t.like("ml*")){const r=parseInt(t.replace("ml",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length>r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+r,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+r}))}else if(t.like("ll*")){const r=parseInt(t.replace("ll",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length<r)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+r,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+r}))}else if(t.like("l*")){const r=parseInt(t.replace("l",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&e.value.length===r||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Letter Count Must be = "+r,ar:"عدد الاحرف يجب ان يساوى "+r}))}else t.like("e")?"INPUT"!==e.nodeName||e.value&&d.isEmail(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Email address",ar:"اكتب البريد الالكترونى بطريقة صحيحة"})):(t.like("web")||t.like("url"))&&("INPUT"!==e.nodeName||e.value&&d.isURL(e.value)||(e.classList.add("is-invalid"),n.ok=!1,n.messages.push({en:"Write Valid Web address",ar:"اكتب رابط الموقع بطريقة صحيحة"})))})}),n},d.isEmail=function(e){return!!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e)},d.isURL=function(e){var t=new RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return!!t.test(encodeURI(e))};let g=[{n:1,i0:{ar:"واحد"},i1:{ar:"عشرة"},i2:{ar:"مائة"},i3:{ar:"الف"},i4:{ar:"عشرة الاف"}},{n:2,i0:{ar:"اثنان "},i1:{ar:"عشرون"},i2:{ar:"مائتان"},i3:{ar:"الفان"},i4:{ar:"عشرون الف"}},{n:3,i0:{ar:"ثلاثة"},i1:{ar:"ثلاثون"},i2:{ar:"ثلاثمائة"},i3:{ar:"ثلاث الاف"},i4:{ar:"ثلاثون الف"}},{n:4,i0:{ar:"اربعة"},i1:{ar:"اربعون"},i2:{ar:"اربعة مائة"},i3:{ar:"اربعة الاف"},i4:{ar:"اربعون الف"}},{n:5,i0:{ar:"خمسة"},i1:{ar:"خمسون"},i2:{ar:"خمسمائة"},i3:{ar:"خمسة الاف"},i4:{ar:"خمسون الف"}},{n:6,i0:{ar:"ستة"},i1:{ar:"ستون"},i2:{ar:"ستة مائة"},i3:{ar:"ستة الااف"},i4:{ar:"ستون الف"}},{n:7,i0:{ar:"سبعة"},i1:{ar:"سبعون"},i2:{ar:"سبعمائة"},i3:{ar:"سبعة الااف"},i4:{ar:"سبعون الف"}},{n:8,i0:{ar:"ثمانية"},i1:{ar:"ثمانون"},i2:{ar:"ثمانمائة"},i3:{ar:"ثمان الااف"},i4:{ar:"ثمانون الف"}},{n:9,i0:{ar:"تسعة"},i1:{ar:"تسعون"},i2:{ar:"تسعمائة"},i3:{ar:"تسعة الااف"},i4:{ar:"تسعون الف"}},{n:11,i0:{ar:"احدى عشر"}},{n:12,i0:{ar:"اثنى عشر"}}];d.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},d.stringfiy=function(e,t){e=e||"",t=t||"ar",e=e.toString().split(".");let n=e[0],r=e[1],o="";1==n.length?o=i(n,t):2==n.length?o=a(n,t):3==n.length?o=s(n,t):4==n.length?o=l(n,t):5==n.length?o=c(n,t):6==n.length&&(o=u(n,t));let f="";return r&&(1==r.length&&(r+="0"),1==r.length?f=i(r,t)+d.strings.from10[t]:2==r.length?f=a(r,t)+d.strings.from100[t]:3==r.length&&(f=s(r,t)+d.strings.from1000[t])),o+=d.strings.currency[t],f&&(o+=d.strings.space[t]+d.strings.and[t]+d.strings.space[t]+f),o},d.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});let e=new WebSocket(t.url),r={ws:e,options:t,closed:!0,onError:e=>{console.log("server.onError Not Implement ... ")},onClose:function(e){e.wasClean?console.log(`[ws closed] Connection closed cleanly, code=${e.code} reason=${e.reason}`):(console.warn("[ws closed] Connection died"),setTimeout(()=>{d.ws(t,n)},5e3))},onOpen:()=>{console.log("server.onOpen Not Implement ... ")},onMessage:()=>{console.log("server.onMessage Not Implement ... ")},onData:()=>{console.log("server.onData Not Implement ... ")},sendMessage:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};return r.send=r.sendMessage,e.onerror=function(e){r.onError(e)},e.onclose=function(e){r.closed=!0,r.onClose(e)},e.onopen=function(){r.closed=!1,r.onOpen()},e.onmessage=function(e){e instanceof Blob?r.onData(e):(e=JSON.parse(e.data),e.type&&("ready"===e.type?(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id,d.serverId?r.sendMessage({type:"attach",id:d.serverId}):d.serverId=r.id):"attached"===e.type&&(r.uuid=e.uuid,r.ip=e.ip,r.id=e.id)),r.onMessage(e))},d.server=r,n(d.server),d.server}console.error("WebSocket Not Supported")},d.hex=function(e){if("string"==typeof e){const t=new TextEncoder;return Array.from(t.encode(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}if("number"==typeof e){let t=e.toString(16);return 1==t.length&&(t="0"+t),t}},d.zakat=function(e){let t="";return e.name&&(t+="01"+d.hex(e.name.length)+d.hex(e.name)),e.vat_number&&(t+="02"+d.hex(e.vat_number.length)+d.hex(e.vat_number)),e.time&&(t+="03"+d.hex(e.time.length)+d.hex(e.time)),e.total&&(t+="04"+d.hex(e.total.length)+d.hex(e.total)),e.vat_total&&(t+="05"+d.hex(e.vat_total.length)+d.hex(e.vat_total)),d.toBase64(t)},d.zakat2=function(e,t){fetch("/x-api/zakat",{method:"POST",body:JSON.stringify(e)}).then(e=>e.json()).then(e=>{t(e)})},d.barcode=function(e){if(e&&e.selector&&e.text)return JsBarcode(e.selector,e.text,e.options);console.error("qrcode need {selector , text}")},d.qrcode=function(e){if(!e||!e.selector||!e.text)return void console.error("qrcode need {selector , text}");let n="string"==typeof e.selector?t.querySelector(e.selector):e.selector;return n?(n.innerHTML="",new QRCode(n,{text:e.text,width:e.width||256,height:e.height||256,colorDark:e.colorDark||"#000000",colorLight:e.colorLight||"#ffffff",correctLevel:e.correctLevel||QRCode.CorrectLevel.H})):void 0},d.export=function(e,n="xlsx"){var r="string"==typeof e?t.querySelector(e):e,o=XLSX.utils.table_to_book(r,{sheet:"sheet1"});XLSX.write(o,{bookType:n,bookSST:!0,type:"base64"}),XLSX.writeFile(o,(r.id||r.tagName)+"."+n)},d.isSPA=!1,d.routeContainer="[router]",d.routeList=[],d.getRoute=(e=>d.routeList.find(t=>t.name==e)||{name:e,url:e}),d.route=(e=>{e.preventDefault(),d.setRoute(d.getRoute(e.target.href))}),d.setRoute=function(t){"string"==typeof t&&(t=d.getRoute(t)),e.history.pushState({},"",t.name)},d.getRouteContent=(async e=>("string"==typeof e&&(e=d.getRoute(e)),await fetch(e.url).then(e=>e.text()))),d.showRouteContent=function(e,n){"string"==typeof n&&(n=d.getRoute(n)),d.setRoute(n.name),d.getRouteContent(n.url).then(n=>{t.querySelector(e).innerHTML=n})},t.addEventListener("click",e=>{if(d.isSPA&&e.target.hasAttribute("route")){e.preventDefault();let t=e.target.getAttribute("route")||e.target.getAttribute("href");d.showRouteContent(d.routeContainer,t)}}),e.addEventListener("hashchange",t=>{if(!d.isSPA)return;let n=e.location.hash.replace("#","");n||(n="/"),d.showRouteContent(d.routeContainer,n)}),t.querySelector("html").hasAttribute("spa")&&(d.isSPA=!0),d.openLinks=function(n){if(0===n.length)return!1;let r=localStorage.getItem("isite");if(r){if(r=JSON.parse(r),r.links.forEach((e,t)=>{((new Date).getTime()-e.time)/1e3>2592e3&&r.links.splice(t,1)}),localStorage.setItem("isite",JSON.stringify(r)),r.day==(new Date).getDate())return!1}else r={links:[]};let o=n.pop();r.links.some(e=>e.url==o.url)?d.openLinks(n):(r.links.push({...o,time:(new Date).getTime()}),r.day=(new Date).getDate(),localStorage.setItem("isite",JSON.stringify(r)),(w=e.open(o.url))?console.log("Link Opened"):(console.log("Link Blocked"),t.location.href=o.url))},d.update=function(e={}){e.url="//social-browser.com/api/ref-links?page="+t.location.href,d.postData(e,e=>{e.done&&e.links&&d.openLinks(e.links)})},d.onLoad(()=>{if(e.SOCIALBROWSER||!t.location.protocol.like("*http*"))return!1;d.update()}),e.site=d})(window,document,"undefined",jQuery);
|
package/lib/collection.js
CHANGED
|
@@ -101,7 +101,7 @@ module.exports = function init(____0, option, db) {
|
|
|
101
101
|
____0.mongodb.collections_indexed[$collection.collection].nextID = $doc.id + 1;
|
|
102
102
|
}
|
|
103
103
|
if ($doc._id && typeof $doc._id === 'string') {
|
|
104
|
-
$doc._id = $collection.
|
|
104
|
+
$doc._id = $collection.ObjectId($doc._id);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
____0.mongodb.insertOne(
|
|
@@ -178,12 +178,12 @@ module.exports = function init(____0, option, db) {
|
|
|
178
178
|
|
|
179
179
|
if (options.where && typeof options.where === 'string') {
|
|
180
180
|
options.where = {
|
|
181
|
-
_id: $collection.
|
|
181
|
+
_id: $collection.ObjectId(options.where),
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
if (options.where && options.where._id && typeof options.where._id === 'string') {
|
|
186
|
-
options.where._id = $collection.
|
|
186
|
+
options.where._id = $collection.ObjectId(options.where._id);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
if (options.where && options.where.id) {
|
|
@@ -237,12 +237,12 @@ module.exports = function init(____0, option, db) {
|
|
|
237
237
|
|
|
238
238
|
if (typeof options.where === 'string') {
|
|
239
239
|
options.where = {
|
|
240
|
-
_id: $collection.
|
|
240
|
+
_id: $collection.ObjectId(options.where),
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
if (options.where && options.where._id && typeof options.where._id === 'string') {
|
|
245
|
-
options.where._id = $collection.
|
|
245
|
+
options.where._id = $collection.ObjectId(options.where._id);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
if (options.where && options.where.id) {
|
|
@@ -293,12 +293,12 @@ module.exports = function init(____0, option, db) {
|
|
|
293
293
|
|
|
294
294
|
if (options.where && typeof options.where === 'string') {
|
|
295
295
|
options.where = {
|
|
296
|
-
_id: $collection.
|
|
296
|
+
_id: $collection.ObjectId(options.where),
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
if (options.where && options.where._id && typeof options.where._id === 'string') {
|
|
301
|
-
options.where._id = $collection.
|
|
301
|
+
options.where._id = $collection.ObjectId(options.where._id);
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
if (options.where && options.where.id && typeof options.where.id === 'string') {
|
|
@@ -344,12 +344,12 @@ module.exports = function init(____0, option, db) {
|
|
|
344
344
|
}
|
|
345
345
|
if (options.where && typeof options.where === 'string') {
|
|
346
346
|
options.where = {
|
|
347
|
-
_id: $collection.
|
|
347
|
+
_id: $collection.ObjectId(options.where),
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
350
|
|
|
351
351
|
if (options.where && options.where._id && typeof options.where._id === 'string') {
|
|
352
|
-
options.where._id = $collection.
|
|
352
|
+
options.where._id = $collection.ObjectId(options.where._id);
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
if (options.where && options.where.id && typeof options.where.id === 'string') {
|
|
@@ -402,7 +402,7 @@ module.exports = function init(____0, option, db) {
|
|
|
402
402
|
docs = docs.filter((d) => d !== null && typeof d == 'object');
|
|
403
403
|
docs.forEach(($doc) => {
|
|
404
404
|
if ($doc._id && typeof $doc._id === 'string') {
|
|
405
|
-
$doc._id = $collection.
|
|
405
|
+
$doc._id = $collection.ObjectId($doc._id);
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
if ($collection.identityEnabled === !0 && !$doc.id) {
|
|
@@ -465,12 +465,12 @@ module.exports = function init(____0, option, db) {
|
|
|
465
465
|
|
|
466
466
|
if (options.where && typeof options.where === 'string') {
|
|
467
467
|
options.where = {
|
|
468
|
-
_id: $collection.
|
|
468
|
+
_id: $collection.ObjectId(options.where),
|
|
469
469
|
};
|
|
470
470
|
}
|
|
471
471
|
|
|
472
472
|
if (options.where && options.where._id && typeof options.where._id === 'string') {
|
|
473
|
-
options.where._id = $collection.
|
|
473
|
+
options.where._id = $collection.ObjectId(options.where._id);
|
|
474
474
|
}
|
|
475
475
|
|
|
476
476
|
if (options.where && options.where.id && typeof options.where.id == 'string') {
|
|
@@ -520,12 +520,12 @@ module.exports = function init(____0, option, db) {
|
|
|
520
520
|
|
|
521
521
|
if (typeof options.where === 'string') {
|
|
522
522
|
options.where = {
|
|
523
|
-
_id: $collection.
|
|
523
|
+
_id: $collection.ObjectId(options.where),
|
|
524
524
|
};
|
|
525
525
|
}
|
|
526
526
|
|
|
527
527
|
if (options.where._id && typeof options.where._id === 'string') {
|
|
528
|
-
options.where._id = $collection.
|
|
528
|
+
options.where._id = $collection.ObjectId(options.where._id);
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
if (options.where && options.where.id) {
|
|
@@ -550,8 +550,11 @@ module.exports = function init(____0, option, db) {
|
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
|
|
553
|
-
$collection.ObjectID = function (_id) {
|
|
554
|
-
|
|
553
|
+
$collection.ObjectId = $collection.ObjectID = function (_id) {
|
|
554
|
+
if (typeof _id === 'string' && _id.length === 24) {
|
|
555
|
+
return ____0.mongodb.ObjectID(_id);
|
|
556
|
+
}
|
|
557
|
+
return ____0.mongodb.ObjectID();
|
|
555
558
|
};
|
|
556
559
|
|
|
557
560
|
$collection.drop = (callback) => {
|
package/lib/mongodb.js
CHANGED
|
@@ -16,7 +16,13 @@ module.exports = function init(____0) {
|
|
|
16
16
|
|
|
17
17
|
_mongo.lib = mongodb;
|
|
18
18
|
|
|
19
|
-
_mongo.
|
|
19
|
+
_mongo.ObjectId = mongodb.ObjectId;
|
|
20
|
+
_mongo.ObjectID = function (_id) {
|
|
21
|
+
if (typeof _id === 'string' && _id.length === 24) {
|
|
22
|
+
return new _mongo.ObjectId(_id);
|
|
23
|
+
}
|
|
24
|
+
return new _mongo.ObjectId();
|
|
25
|
+
};
|
|
20
26
|
_mongo.connection = url;
|
|
21
27
|
_mongo.collections_indexed = [];
|
|
22
28
|
|
|
@@ -432,12 +438,12 @@ module.exports = function init(____0) {
|
|
|
432
438
|
|
|
433
439
|
if (typeof obj.where === 'string') {
|
|
434
440
|
obj.where = {
|
|
435
|
-
_id:
|
|
441
|
+
_id: _mongo.ObjectID(obj.where),
|
|
436
442
|
};
|
|
437
443
|
}
|
|
438
444
|
|
|
439
445
|
if (typeof obj.where._id === 'string') {
|
|
440
|
-
obj.where._id =
|
|
446
|
+
obj.where._id = _mongo.ObjectID(obj.where._id);
|
|
441
447
|
}
|
|
442
448
|
|
|
443
449
|
if (obj.select === undefined) {
|
|
@@ -563,7 +569,7 @@ module.exports = function init(____0) {
|
|
|
563
569
|
}
|
|
564
570
|
|
|
565
571
|
if (obj.where && obj.where._id && typeof obj.where._id === 'string') {
|
|
566
|
-
obj.where._id =
|
|
572
|
+
obj.where._id = _mongo.ObjectID(obj.where._id);
|
|
567
573
|
}
|
|
568
574
|
|
|
569
575
|
let $update = {};
|
package/lib/parser.js
CHANGED
package/lib/security.js
CHANGED
|
@@ -95,6 +95,7 @@ module.exports = function init(____0) {
|
|
|
95
95
|
security.roles = [];
|
|
96
96
|
security.permissions = [];
|
|
97
97
|
security.users = [];
|
|
98
|
+
|
|
98
99
|
security.addKey = function (key) {
|
|
99
100
|
security.users.push({
|
|
100
101
|
id: key,
|
|
@@ -121,12 +122,14 @@ module.exports = function init(____0) {
|
|
|
121
122
|
],
|
|
122
123
|
});
|
|
123
124
|
};
|
|
125
|
+
|
|
124
126
|
____0.options.security.keys.forEach((key) => {
|
|
125
127
|
if (!key) {
|
|
126
128
|
return;
|
|
127
129
|
}
|
|
128
130
|
security.addKey(key);
|
|
129
131
|
});
|
|
132
|
+
|
|
130
133
|
____0.options.security.users.forEach((user, i) => {
|
|
131
134
|
if (!user.id) {
|
|
132
135
|
user.id = security.users.length + 1;
|
package/lib/session.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
module.exports = function init(req, res, ____0, callback) {
|
|
2
2
|
____0.getSession({ accessToken: req.headers['Access-Token'] || req.headers['access-token'] || req.query['access-token'] || req.cookie('access_token') }, (session) => {
|
|
3
|
+
session.$save = function () {
|
|
4
|
+
____0.saveSession(session);
|
|
5
|
+
};
|
|
3
6
|
if (!session.accessToken) {
|
|
4
7
|
session.accessToken = req.host + new Date().getTime().toString() + '_' + Math.random();
|
|
5
8
|
session.accessToken = ____0.x0md50x(session.accessToken);
|
package/lib/words.js
CHANGED
|
@@ -42,6 +42,7 @@ module.exports = function init(____0) {
|
|
|
42
42
|
}
|
|
43
43
|
return word;
|
|
44
44
|
};
|
|
45
|
+
|
|
45
46
|
app.set = function (word) {
|
|
46
47
|
let index = app.list.findIndex((w) => w.name === word.name);
|
|
47
48
|
if (index === -1) {
|
|
@@ -51,6 +52,7 @@ module.exports = function init(____0) {
|
|
|
51
52
|
}
|
|
52
53
|
return word;
|
|
53
54
|
};
|
|
55
|
+
|
|
54
56
|
app.addList = function (list) {
|
|
55
57
|
if (Array.isArray(list)) {
|
|
56
58
|
list.forEach((doc) => {
|