isite 2022.3.7 → 2022.4.10

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.
@@ -54,7 +54,7 @@
54
54
  };
55
55
  }
56
56
 
57
- if (typeof SOCIALBROWSER === 'object') {
57
+ if (window.SOCIALBROWSER) {
58
58
  SOCIALBROWSER.var = SOCIALBROWSER.var || {};
59
59
  SOCIALBROWSER.var.white_list = SOCIALBROWSER.var.white_list || [];
60
60
  if (document.location.hostname) {
@@ -92,6 +92,25 @@
92
92
  }
93
93
 
94
94
  let site = {};
95
+ site.printerList = [];
96
+ site.getPrinters = function () {
97
+ if (window.SOCIALBROWSER && SOCIALBROWSER.currentWindow.webContents.getPrintersAsync) {
98
+ SOCIALBROWSER.currentWindow.webContents.getPrintersAsync().then((arr0) => {
99
+ site.printerList = arr0;
100
+ });
101
+ } else if (window.SOCIALBROWSER && SOCIALBROWSER.currentWindow.webContents.getPrinters) {
102
+ site.printerList = SOCIALBROWSER.currentWindow.webContents.getPrinters();
103
+ } else {
104
+ fetch('http://127.0.0.1:60080/printers/all')
105
+ .then((res) => res.json())
106
+ .then((data) => {
107
+ site.printerList = data.list;
108
+ });
109
+ }
110
+
111
+ return site.printerList;
112
+ };
113
+ site.getPrinters();
95
114
  site.render = function (selector, data) {
96
115
  let template = document.querySelector(selector);
97
116
  if (template) {
@@ -1161,9 +1180,9 @@
1161
1180
  let dom = typeof options.selector == 'string' ? document.querySelector(options.selector) : options.selector;
1162
1181
  if (dom) {
1163
1182
  dom.innerHTML = '';
1164
- if (192 <= options.text.length <= 217) {
1183
+ /*if (192 <= options.text.length <= 217) {
1165
1184
  options.text = options.text.padEnd(220);
1166
- }
1185
+ }*/
1167
1186
 
1168
1187
  return new QRCode(dom, {
1169
1188
  text: options.text,
@@ -1 +1 @@
1
- (function(e,t,n,r){function o(e){return e?("string"!=typeof e&&(e=e.toString()),e.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function a(e,t){let n="";return g.forEach(r=>{r.n==e&&(n=r.i0[t])}),n}function l(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+=p.strings.space[t]+p.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]+p.strings.space[t])});let r=l(e.substring(1),t);return r&&(n&&(n+=p.strings.and[t]),n+=r),n}function c(e,t){let n="";g.forEach(r=>{r.n==e[0]&&(n=r.i3[t]+p.strings.space[t])});let r=s(e.substring(1),t);return r&&(n&&(n+=p.strings.and[t]),n+=r),n}function u(e,t){let n=l(e.substring(0,2),t)+p.strings.space[t];1==e[0]?n+=p.strings[10][t]+p.strings.space[t]:n+=p.strings[20][t]+p.strings.space[t];let r=s(e.substring(2),t);return r&&(n+=p.strings.and[t]+r),n}function f(e,t){let n=s(e.substring(0,3),t)+p.strings.space[t];n+=p.strings[100][t]+p.strings.space[t];let r=s(e.substring(3),t);return r&&(n+=p.strings.and[t]+r),n}if(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}),"object"==typeof SOCIALBROWSER){if(SOCIALBROWSER.var=SOCIALBROWSER.var||{},SOCIALBROWSER.var.white_list=SOCIALBROWSER.var.white_list||[],t.location.hostname){let e=`*${t.location.hostname}*`,n=!1;SOCIALBROWSER.var.white_list.forEach(t=>{t.url==e&&(n=!0)}),n||(SOCIALBROWSER.var.white_list.push({url:e}),SOCIALBROWSER.call("set_var",{name:"white_list",data:SOCIALBROWSER.var.white_list}))}SOCIALBROWSER.var.blocking=SOCIALBROWSER.var.blocking||{},SOCIALBROWSER.var.blocking.block_ads=!1,SOCIALBROWSER.var.blocking.block_empty_iframe=!1,SOCIALBROWSER.var.blocking.remove_external_iframe=!1,SOCIALBROWSER.var.blocking.skip_video_ads=!1,SOCIALBROWSER.var.blocking.popup=SOCIALBROWSER.var.blocking.popup||{},SOCIALBROWSER.var.blocking.popup.allow_external=!0,SOCIALBROWSER.var.blocking.popup.allow_internal=!0,SOCIALBROWSER.var.blocking.javascript=SOCIALBROWSER.var.blocking.javascript||{},SOCIALBROWSER.var.blocking.javascript.block_window_open=!1,SOCIALBROWSER.var.blocking.javascript.block_eval=!1,SOCIALBROWSER.var.blocking.javascript.block_console_output=!1}let p={render:function(e,n){let r=t.querySelector(e);return r?Mustache.render(r.innerHTML,n):""},html:function(e,t){return Mustache.render(e,t)},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},$:function(e){let n=t.querySelectorAll(e);return n}},d=999999;p.showModal=function(t){r(t).click(()=>{r("popup").hide()}),d++;let n=p.$(t);if(0===n.length)return;n[0].style.zIndex=d,n[0].style.display="block";let o=n[0].getAttribute("fixed");""!==o&&n[0].addEventListener("click",function(){p.hideModal(t)});let a=p.$(t+" i-control input");a.length>0&&a[0].focus(),p.$(t+" .close").forEach(e=>{e.addEventListener("click",function(){p.hideModal(t)})}),p.$(t+" .modal-header").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),p.$(t+" .modal-body").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})}),p.$(t+" .modal-footer").forEach(t=>{t.addEventListener("click",function(t){t=t||e.event,t.stopPropagation()})})},p.hideModal=function(e){r("popup").hide();let t=p.$(e);t.length>0&&(t[0].style.display="none")},p.eventList=[],p.on=function(e,t){t=t||function(){},p.eventList.push({name:e,callback:t})},p.call=function(e,t){for(var n=0;n<p.eventList.length;n++){var r=p.eventList[n];r.name==e&&r.callback(t)}},p.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}`,p.getData(e,t)},p.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=p.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)})},p.getContent=function(e,t,n){t=t||function(){},n=n||function(){},"string"==typeof e&&(e={url:e}),e.url=p.handle_url(e.url),fetch(e.url,{mode:"cors",method:"get"}).then(function(e){return e.text()}).then(function(e){t(e)})},p.handle_url=function(t){if("string"!=typeof t)return t;if(t=t.trim(),t.like("http*")||0===t.indexOf("//")||0===t.indexOf("data:"))t=t;else if(0===t.indexOf("/"))t=e.location.origin+t;else if(t.split("?")[0].split(".").length<3){let n=e.location.pathname.split("/").pop();t=e.location.origin+e.location.pathname.replace(n,"")+t}return t},p.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=p.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)})},p.typeOf=function(e){return Object.prototype.toString.call(e).slice(8,-1)},p.toDateTime=function(e){return e?new Date(e):new Date},p.toDateX=function(e){let t=p.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()},p.toDateXT=function(e){let t=p.toDateTime(e);return t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},p.toDateXF=function(e){let t=p.toDateTime(e);return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()},p.toDateOnly=function(e){let t=p.toDateTime(e);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0)},p.toDateT=function(e){return p.toDateOnly(e).getTime()},p.toDateF=function(e){return p.toDateTime(e).getTime()},p.addZero=function(e,t){let n=t-e.toString().length;for(let t=0;t<n;t++)e="0"+e.toString();return e},p.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},p.fixed=2,p.to_number=p.toNumber=function(e,t){let n=t||p.fixed,r=0;return e&&(r=parseFloat(e).toFixed(n)),parseFloat(r)},p.to_money=p.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?p.to_float(n):n},p.to_float=p.toFloat=function(e){return e?parseFloat(e):0},p.to_int=p.toInt=function(e){return e?parseInt(e):0},p.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p.$base64Numbers=[];for(let e=11;e<99;e++)e%10!=0&&e%11!=0&&p.$base64Numbers.push(e);p.toJson=(e=>typeof e===n||null===e?"":JSON.stringify(e)),p.fromJson=(e=>"string"!=typeof e?e:JSON.parse(e)),p.toBase64=(e=>typeof e===n||null===e||""===e?"":("string"!=typeof e&&(e=p.toJson(e)),Base64.encode(e))),p.fromBase64=(e=>typeof e===n||null===e||""===e?"":Base64.decode(e)),p.to123=(e=>{e=p.toBase64(e);let t="";for(let n=0;n<e.length;n++){let r=e[n];t+=p.$base64Numbers[p.$base64Letter.indexOf(r)]}return t}),p.from123=(e=>{let t="";for(let n=0;n<e.length;n++){let r=e[n]+e[n+1],o=p.$base64Numbers.indexOf(parseInt(r));t+=p.$base64Letter[o],n++}return t=p.fromBase64(t),t}),p.typeOf=p.typeof=function(e){return Object.prototype.toString.call(e).slice(8,-1)},p.showTabContent=function(e,n){let r=t.querySelectorAll(".tab-content");for(i=0;i<r.length;i++)r[i].style.display="none";let o=t.querySelectorAll(".tab-link");for(i=0;i<o.length;i++)o[i].className=o[i].className.replace(" active","");t.querySelectorAll(n+".tab-content").forEach(e=>{e.style.display="inline-block"}),e&&(e.currentTarget.className+=" active")},p.showTabs=function(e,t){e&&e.stopPropagation(),r(".main-menu .tabs").hide(),r(t).show(100)},p.toHtmlTable=function(e){if(e===n||null===e)return"";if("Object"==p.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"==p.typeOf(e[r])||"Array"==p.typeOf(e[r])?t+=`<td><p> ${p.toHtmlTable(e[r])} </p></td>`:t+=`<td><p> ${e[r]} </p></td>`,t+="</tr>"}return t+="</table>",t}if("Array"==p.typeOf(e)){let t='<table class="table">';for(let n=0;n<e.length;n++)"Object"==p.typeOf(e[n])||"Array"==p.typeOf(e[n])?t+=`<tr><td><p>${p.toHtmlTable(e[n])}</p></td></tr>`:t+=`<tr><td><p>${e[n]}</p></td></tr>`;return t+="</table>",t}return""},p.vControles=[],p.validated=function(e){const n={ok:!0,messages:[]};p.vControles.forEach(e=>{e.el.style.border=e.border}),p.vControles=[],e=e||"body";const r=t.querySelectorAll(e+" [v]");return r.forEach(e=>{const t=e.style.border,r=e.getAttribute("v"),o=r.split(" ");o.forEach(r=>{if(r=r.toLowerCase().trim(),"r"===r)"INPUT"!==e.nodeName&&"SELECT"!==e.nodeName||e.value&&!e.value.like("*undefined*")||(p.vControles.push({el:e,border:t}),e.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(r.like("ml*")){const o=parseInt(r.replace("ml",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length>o)||(p.vControles.push({el:e,border:t}),e.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+o,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+o}))}else if(r.like("ll*")){const o=parseInt(r.replace("ll",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&!(e.value.length<o)||(p.vControles.push({el:e,border:t}),e.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+o,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+o}))}else if(r.like("l*")){const o=parseInt(r.replace("l",""));"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName||e.value&&e.value.length===o||(p.vControles.push({el:e,border:t}),e.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Letter Count Must be = "+o,ar:"عدد الاحرف يجب ان يساوى "+o}))}})}),n};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:"اثنى عشر"}}];p.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},p.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=a(n,t):2==n.length?o=l(n,t):3==n.length?o=s(n,t):4==n.length?o=c(n,t):5==n.length?o=u(n,t):6==n.length&&(o=f(n,t));let i="";return r&&(1==r.length&&(r+="0"),1==r.length?i=a(r,t)+p.strings.from10[t]:2==r.length?i=l(r,t)+p.strings.from100[t]:3==r.length&&(i=s(r,t)+p.strings.from1000[t])),o+=p.strings.currency[t],i&&(o+=p.strings.space[t]+p.strings.and[t]+p.strings.space[t]+i),o},p.ws=function(t,n){if("WebSocket"in e){"string"==typeof t&&(t={url:t});var r=new WebSocket(t.url);let e={ws:r,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(()=>{p.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 ... ")},send:function(e){if(this.closed)return!1;"object"!=typeof e&&(e={type:"text",content:e}),this.ws.send(JSON.stringify(e))}};r.onerror=function(t){e.onError(t)},r.onclose=function(t){e.closed=!0,e.onClose(t)},r.onopen=function(){e.closed=!1,e.onOpen()},r.onmessage=function(t){t instanceof Blob?e.onData(t):e.onMessage(JSON.parse(t.data))},n(e)}else console.error("WebSocket Not Supported")},p.barcode=function(e){if(e&&e.selector&&e.text)return JsBarcode(e.selector,e.selector);console.error("qrcode need {selector , text}")},p.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="",192<=e.text.length<=217&&(e.text=e.text.padEnd(220)),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.L})):void 0},e.site=p})(window,document,"undefined",jQuery);
1
+ (function(t,e,n,r){function o(t){return t?("string"!=typeof t&&(t=t.toString()),t.replace(/[\/\\^$*+?.()\[\]{}]/g,"\\$&")):""}function a(t,e){let n="";return g.forEach(r=>{r.n==t&&(n=r.i0[e])}),n}function l(t,e){let n="";return 11==t?g.forEach(r=>{r.n==t&&(n=r.i0[e])}):12==t?g.forEach(r=>{r.n==t&&(n=r.i0[e])}):(g.forEach(r=>{r.n==t[1]&&(n=r.i0[e])}),g.forEach(r=>{r.n==t[0]&&(t[1]>0&&t[0]>1?n+=p.strings.space[e]+p.strings.and[e]:n+="",n+=r.i1[e])})),n}function s(t,e){let n="";g.forEach(r=>{r.n==t[0]&&(n=r.i2[e]+p.strings.space[e])});let r=l(t.substring(1),e);return r&&(n&&(n+=p.strings.and[e]),n+=r),n}function c(t,e){let n="";g.forEach(r=>{r.n==t[0]&&(n=r.i3[e]+p.strings.space[e])});let r=s(t.substring(1),e);return r&&(n&&(n+=p.strings.and[e]),n+=r),n}function u(t,e){let n=l(t.substring(0,2),e)+p.strings.space[e];1==t[0]?n+=p.strings[10][e]+p.strings.space[e]:n+=p.strings[20][e]+p.strings.space[e];let r=s(t.substring(2),e);return r&&(n+=p.strings.and[e]+r),n}function f(t,e){let n=s(t.substring(0,3),e)+p.strings.space[e];n+=p.strings[100][e]+p.strings.space[e];let r=s(t.substring(3),e);return r&&(n+=p.strings.and[e]+r),n}if(String.prototype.test||(String.prototype.test=function(t,e="gium"){try{return new RegExp(t,e).test(this)}catch(t){return!1}}),String.prototype.like||(String.prototype.like=function(t){if(!t)return!1;let e=!1;return t.split("|").forEach(t=>{t=t.split("*"),t.forEach((e,n)=>{t[n]=o(e)}),t=t.join(".*"),this.test("^"+t+"$","gium")&&(e=!0)}),e}),String.prototype.contains||(String.prototype.contains=function(t){let e=!1;return t?(t.split("|").forEach(t=>{t&&this.test("^.*"+o(t)+".*$","gium")&&(e=!0)}),e):e}),"object"==typeof SOCIALBROWSER){if(SOCIALBROWSER.var=SOCIALBROWSER.var||{},SOCIALBROWSER.var.white_list=SOCIALBROWSER.var.white_list||[],e.location.hostname){let t=`*${e.location.hostname}*`,n=!1;SOCIALBROWSER.var.white_list.forEach(e=>{e.url==t&&(n=!0)}),n||(SOCIALBROWSER.var.white_list.push({url:t}),SOCIALBROWSER.call("set_var",{name:"white_list",data:SOCIALBROWSER.var.white_list}))}SOCIALBROWSER.var.blocking=SOCIALBROWSER.var.blocking||{},SOCIALBROWSER.var.blocking.block_ads=!1,SOCIALBROWSER.var.blocking.block_empty_iframe=!1,SOCIALBROWSER.var.blocking.remove_external_iframe=!1,SOCIALBROWSER.var.blocking.skip_video_ads=!1,SOCIALBROWSER.var.blocking.popup=SOCIALBROWSER.var.blocking.popup||{},SOCIALBROWSER.var.blocking.popup.allow_external=!0,SOCIALBROWSER.var.blocking.popup.allow_internal=!0,SOCIALBROWSER.var.blocking.javascript=SOCIALBROWSER.var.blocking.javascript||{},SOCIALBROWSER.var.blocking.javascript.block_window_open=!1,SOCIALBROWSER.var.blocking.javascript.block_eval=!1,SOCIALBROWSER.var.blocking.javascript.block_console_output=!1}let p={render:function(t,n){let r=e.querySelector(t);return r?Mustache.render(r.innerHTML,n):""},html:function(t,e){return Mustache.render(t,e)},getUniqueObjects:function(t,e){const n=t.map(t=>t[e]).map((t,e,n)=>n.indexOf(t)===e&&e).filter(e=>t[e]).map(e=>t[e]);return n},$:function(t){let n=e.querySelectorAll(t);return n}},d=999999;p.showModal=function(e){r(e).click(()=>{r("popup").hide()}),d++;let n=p.$(e);if(0===n.length)return;n[0].style.zIndex=d,n[0].style.display="block";let o=n[0].getAttribute("fixed");""!==o&&n[0].addEventListener("click",function(){p.hideModal(e)});let a=p.$(e+" i-control input");a.length>0&&a[0].focus(),p.$(e+" .close").forEach(t=>{t.addEventListener("click",function(){p.hideModal(e)})}),p.$(e+" .modal-header").forEach(e=>{e.addEventListener("click",function(e){e=e||t.event,e.stopPropagation()})}),p.$(e+" .modal-body").forEach(e=>{e.addEventListener("click",function(e){e=e||t.event,e.stopPropagation()})}),p.$(e+" .modal-footer").forEach(e=>{e.addEventListener("click",function(e){e=e||t.event,e.stopPropagation()})})},p.hideModal=function(t){r("popup").hide();let e=p.$(t);e.length>0&&(e[0].style.display="none")},p.eventList=[],p.on=function(t,e){e=e||function(){},p.eventList.push({name:t,callback:e})},p.call=function(t,e){for(var n=0;n<p.eventList.length;n++){var r=p.eventList[n];r.name==t&&r.callback(e)}},p.translate=function(t,e){"string"==typeof t&&(t={text:t,lang:"ar"}),t.url=`https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=${t.lang}&dt=t&dt=bd&dj=1&q=${t.text}`,p.getData(t,e)},p.getData=function(t,e,n){e=e||function(){},n=n||function(){},"string"==typeof t&&(t={url:t}),t.headers=t.headers||{Accept:"application/json","Content-Type":"application/json"},t.url=p.handle_url(t.url),fetch(t.url,{mode:"cors",method:"get",headers:t.headers}).then(t=>t.json()).then(t=>{e(t)}).catch(t=>{n(t)})},p.getContent=function(t,e,n){e=e||function(){},n=n||function(){},"string"==typeof t&&(t={url:t}),t.url=p.handle_url(t.url),fetch(t.url,{mode:"cors",method:"get"}).then(function(t){return t.text()}).then(function(t){e(t)})},p.handle_url=function(e){if("string"!=typeof e)return e;if(e=e.trim(),e.like("http*")||0===e.indexOf("//")||0===e.indexOf("data:"))e=e;else if(0===e.indexOf("/"))e=t.location.origin+e;else if(e.split("?")[0].split(".").length<3){let n=t.location.pathname.split("/").pop();e=t.location.origin+t.location.pathname.replace(n,"")+e}return e},p.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=e.cookie}catch(o){console.log(o)}n.method="post",n.redirect="follow",n.mode="cors",n.url=p.handle_url(n.url),t.SOCIALBROWSER&&t.SOCIALBROWSER.fetchJson?SOCIALBROWSER.fetchJson(n,t=>{r(t)}):fetch(n.url,{mode:n.mode,method:n.method,headers:n.headers,body:n.data,redirect:n.redirect}).then(t=>t.json()).then(t=>{r(t)}).catch(t=>{o(t)})},p.typeOf=function(t){return Object.prototype.toString.call(t).slice(8,-1)},p.toDateTime=function(t){return t?new Date(t):new Date},p.toDateX=function(t){let e=p.toDateTime(t);return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()},p.toDateXT=function(t){let e=p.toDateTime(t);return e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()},p.toDateXF=function(t){let e=p.toDateTime(t);return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()+" "+e.getHours()+":"+e.getMinutes()+":"+e.getSeconds()},p.toDateOnly=function(t){let e=p.toDateTime(t);return new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0,0)},p.toDateT=function(t){return p.toDateOnly(t).getTime()},p.toDateF=function(t){return p.toDateTime(t).getTime()},p.addZero=function(t,e){let n=e-t.toString().length;for(let e=0;e<n;e++)t="0"+t.toString();return t},p.addSubZero=function(t,e){let n=e;if(2==t.toString().split(".").length){t.toString().split(".")[1].length;t=t.toString()}else t=t.toString()+".";for(let e=0;e<n;e++)t=t.toString()+0;return t},p.fixed=2,p.to_number=p.toNumber=function(t,e){let n=e||p.fixed,r=0;return t&&(r=parseFloat(t).toFixed(n)),parseFloat(r)},p.to_money=p.toMoney=function(t,e=!0){let n=0;if(t){t=t.toFixed(2).split(".");t[0];let e=t[1]||"00";if(e){let n=e[0]||"0",r=e[1]||"0";r&&parseInt(r)>5?(n=parseInt(n)+1,n*=10,100==n?(n=0,t[0]=parseInt(t[0])+1,t[1]=""):t[1]=n):r&&5==parseInt(r)?t[1]=e:r&&parseInt(r)>2?(r=5,t[1]=n+r):t[1]=n+"0"}n=t.join(".")}return e?p.to_float(n):n},p.to_float=p.toFloat=function(t){return t?parseFloat(t):0},p.to_int=p.toInt=function(t){return t?parseInt(t):0},p.$base64Letter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p.$base64Numbers=[];for(let t=11;t<99;t++)t%10!=0&&t%11!=0&&p.$base64Numbers.push(t);p.toJson=(t=>typeof t===n||null===t?"":JSON.stringify(t)),p.fromJson=(t=>"string"!=typeof t?t:JSON.parse(t)),p.toBase64=(t=>typeof t===n||null===t||""===t?"":("string"!=typeof t&&(t=p.toJson(t)),Base64.encode(t))),p.fromBase64=(t=>typeof t===n||null===t||""===t?"":Base64.decode(t)),p.to123=(t=>{t=p.toBase64(t);let e="";for(let n=0;n<t.length;n++){let r=t[n];e+=p.$base64Numbers[p.$base64Letter.indexOf(r)]}return e}),p.from123=(t=>{let e="";for(let n=0;n<t.length;n++){let r=t[n]+t[n+1],o=p.$base64Numbers.indexOf(parseInt(r));e+=p.$base64Letter[o],n++}return e=p.fromBase64(e),e}),p.typeOf=p.typeof=function(t){return Object.prototype.toString.call(t).slice(8,-1)},p.showTabContent=function(t,n){let r=e.querySelectorAll(".tab-content");for(i=0;i<r.length;i++)r[i].style.display="none";let o=e.querySelectorAll(".tab-link");for(i=0;i<o.length;i++)o[i].className=o[i].className.replace(" active","");e.querySelectorAll(n+".tab-content").forEach(t=>{t.style.display="inline-block"}),t&&(t.currentTarget.className+=" active")},p.showTabs=function(t,e){t&&t.stopPropagation(),r(".main-menu .tabs").hide(),r(e).show(100)},p.toHtmlTable=function(t){if(t===n||null===t)return"";if("Object"==p.typeOf(t)){let e='<table class="table">';for(let n=0;n<Object.getOwnPropertyNames(t).length;n++){let r=Object.getOwnPropertyNames(t)[n];e+="<tr>",e+=`<td><p> ${r} </p></td>`,"Object"==p.typeOf(t[r])||"Array"==p.typeOf(t[r])?e+=`<td><p> ${p.toHtmlTable(t[r])} </p></td>`:e+=`<td><p> ${t[r]} </p></td>`,e+="</tr>"}return e+="</table>",e}if("Array"==p.typeOf(t)){let e='<table class="table">';for(let n=0;n<t.length;n++)"Object"==p.typeOf(t[n])||"Array"==p.typeOf(t[n])?e+=`<tr><td><p>${p.toHtmlTable(t[n])}</p></td></tr>`:e+=`<tr><td><p>${t[n]}</p></td></tr>`;return e+="</table>",e}return""},p.vControles=[],p.validated=function(t){const n={ok:!0,messages:[]};p.vControles.forEach(t=>{t.el.style.border=t.border}),p.vControles=[],t=t||"body";const r=e.querySelectorAll(t+" [v]");return r.forEach(t=>{const e=t.style.border,r=t.getAttribute("v"),o=r.split(" ");o.forEach(r=>{if(r=r.toLowerCase().trim(),"r"===r)"INPUT"!==t.nodeName&&"SELECT"!==t.nodeName||t.value&&!t.value.like("*undefined*")||(p.vControles.push({el:t,border:e}),t.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Data Is Required",ar:"هذا البيان مطلوب"}));else if(r.like("ml*")){const o=parseInt(r.replace("ml",""));"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName||t.value&&!(t.value.length>o)||(p.vControles.push({el:t,border:e}),t.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Letter Count Must be <= "+o,ar:"عدد الاحرف يجب ان يكون أقل من أو يساوى "+o}))}else if(r.like("ll*")){const o=parseInt(r.replace("ll",""));"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName||t.value&&!(t.value.length<o)||(p.vControles.push({el:t,border:e}),t.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Letter Count Must be >= "+o,ar:"عدد الاحرف يجب ان يكون اكبر من أو يساوى "+o}))}else if(r.like("l*")){const o=parseInt(r.replace("l",""));"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName||t.value&&t.value.length===o||(p.vControles.push({el:t,border:e}),t.style.border="2px solid #ff1100",n.ok=!1,n.messages.push({en:"Letter Count Must be = "+o,ar:"عدد الاحرف يجب ان يساوى "+o}))}})}),n};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:"اثنى عشر"}}];p.strings={and:{ar:"و"},space:{ar:" "},10:{ar:"آلاف"},20:{ar:"ألفاً"},100:{ar:"ألف"},currency:{ar:" جنيها مصريا فقط لاغير "},from10:{ar:" قروش "},from100:{ar:" قرش "},from1000:{ar:" من الف "}},p.stringfiy=function(t,e){t=t||"",e=e||"ar",t=t.toString().split(".");let n=t[0],r=t[1],o="";1==n.length?o=a(n,e):2==n.length?o=l(n,e):3==n.length?o=s(n,e):4==n.length?o=c(n,e):5==n.length?o=u(n,e):6==n.length&&(o=f(n,e));let i="";return r&&(1==r.length&&(r+="0"),1==r.length?i=a(r,e)+p.strings.from10[e]:2==r.length?i=l(r,e)+p.strings.from100[e]:3==r.length&&(i=s(r,e)+p.strings.from1000[e])),o+=p.strings.currency[e],i&&(o+=p.strings.space[e]+p.strings.and[e]+p.strings.space[e]+i),o},p.ws=function(e,n){if("WebSocket"in t){"string"==typeof e&&(e={url:e});var r=new WebSocket(e.url);let t={ws:r,options:e,closed:!0,onError:t=>{console.log("server.onError Not Implement ... ")},onClose:function(t){t.wasClean?console.log(`[ws closed] Connection closed cleanly, code=${t.code} reason=${t.reason}`):(console.warn("[ws closed] Connection died"),setTimeout(()=>{p.ws(e,n)},5e3))},onOpen:()=>{console.log("server.onOpen Not Implement ... ")},onMessage:()=>{console.log("server.onMessage Not Implement ... ")},onData:()=>{console.log("server.onData Not Implement ... ")},send:function(t){if(this.closed)return!1;"object"!=typeof t&&(t={type:"text",content:t}),this.ws.send(JSON.stringify(t))}};r.onerror=function(e){t.onError(e)},r.onclose=function(e){t.closed=!0,t.onClose(e)},r.onopen=function(){t.closed=!1,t.onOpen()},r.onmessage=function(e){e instanceof Blob?t.onData(e):t.onMessage(JSON.parse(e.data))},n(t)}else console.error("WebSocket Not Supported")},p.hex=function(t){if("string"==typeof t){const e=new TextEncoder;return Array.from(e.encode(t)).map(t=>t.toString(16).padStart(2,"0")).join("")}if("number"==typeof t){let e=t.toString(16);return 1==e.length&&(e="0"+e),e}},p.zakat=function(t){let e="";return t.name&&(e+="01"+p.hex(t.name.length)+p.hex(t.name)),t.vat_number&&(e+="02"+p.hex(t.vat_number.length)+p.hex(t.vat_number)),t.time&&(e+="03"+p.hex(t.time.length)+p.hex(t.time)),t.total&&(e+="04"+p.hex(t.total.length)+p.hex(t.total)),t.vat_total&&(e+="05"+p.hex(t.vat_total.length)+p.hex(t.vat_total)),p.toBase64(e)},p.zakat2=function(t,e){fetch("/x-api/zakat",{method:"POST",body:JSON.stringify(t)}).then(t=>t.json()).then(t=>{e(t)})},p.barcode=function(t){if(t&&t.selector&&t.text)return JsBarcode(t.selector,t.selector,t.options);console.error("qrcode need {selector , text}")},p.qrcode=function(t){if(!t||!t.selector||!t.text)return void console.error("qrcode need {selector , text}");let n="string"==typeof t.selector?e.querySelector(t.selector):t.selector;return n?(n.innerHTML="",new QRCode(n,{text:t.text,width:t.width||256,height:t.height||256,colorDark:t.colorDark||"#000000",colorLight:t.colorLight||"#ffffff",correctLevel:t.correctLevel||QRCode.CorrectLevel.H})):void 0},t.site=p})(window,document,"undefined",jQuery);
package/index.js CHANGED
@@ -16,6 +16,7 @@ module.exports = function init(options) {
16
16
  ____0.querystring = require('querystring');
17
17
  ____0.formidable = require('formidable');
18
18
  ____0.mv = require('mv');
19
+ ____0.utf8 = require('utf8');
19
20
  ____0.request = ____0.fetch = ____0.x0ftox = require('node-fetch');
20
21
  ____0.$ = ____0.cheerio = require('cheerio');
21
22
  ____0.md5 = ____0.hash = ____0.x0md50x = require('md5');
package/lib/security.js CHANGED
@@ -46,7 +46,7 @@ module.exports = function init(____0) {
46
46
  );
47
47
  return;
48
48
  }
49
-
49
+ u.email = u.email.trim().toLowerCase();
50
50
  security.getUser(
51
51
  {
52
52
  email: u.email,
@@ -127,9 +127,9 @@ module.exports = function init(____0) {
127
127
  profile: {
128
128
  name: key,
129
129
  },
130
- ref_info : {
131
- _id : ''
132
- }
130
+ ref_info: {
131
+ _id: '',
132
+ },
133
133
  });
134
134
  };
135
135
  ____0.options.security.keys.forEach((key) => {
@@ -166,9 +166,9 @@ module.exports = function init(____0) {
166
166
  profile: {
167
167
  name: key,
168
168
  },
169
- ref_info : {
170
- _id : ''
171
- }
169
+ ref_info: {
170
+ _id: '',
171
+ },
172
172
  });
173
173
  });
174
174
  ____0.options.security.users.forEach((user) => {
@@ -382,11 +382,11 @@ module.exports = function init(____0) {
382
382
 
383
383
  if (
384
384
  (userArgs.id && user.id === userArgs.id) ||
385
- (!user.key && userArgs.email && user.email === userArgs.email) ||
386
- (!user.key && userArgs.userName && user.userName === userArgs.userName) ||
387
- (!user.key && userArgs.mobile && user.mobile === userArgs.mobile) ||
385
+ (!user.key && userArgs.email && user.email === userArgs.email.trim().toLowerCase()) ||
386
+ (!user.key && userArgs.userName && user.userName === userArgs.userName.trim().toLowerCase()) ||
387
+ (!user.key && userArgs.mobile && user.mobile === userArgs.mobile.trim().toLowerCase()) ||
388
388
  (user.key && userArgs.key && user.key === userArgs.key) ||
389
- (user.key && userArgs.email && user.key === ____0.x0md50x(userArgs.email))
389
+ (user.key && userArgs.email && user.key === ____0.x0md50x(userArgs.email.trim().toLowerCase()))
390
390
  ) {
391
391
  user.$memory = !0;
392
392
  user = security.handleUser(user);
@@ -421,7 +421,7 @@ module.exports = function init(____0) {
421
421
 
422
422
  for (var i = 0; i < security.users.length; i++) {
423
423
  var _user = security.users[i];
424
- if (_user.email == user.email && _user.password == user.password) {
424
+ if (_user.email == user.email.trim().toLowerCase() && _user.password == user.password) {
425
425
  callback(null, { ..._user });
426
426
  return;
427
427
  }
@@ -543,7 +543,7 @@ module.exports = function init(____0) {
543
543
  callback(err);
544
544
  } else {
545
545
  callback({
546
- message: 'email or password error',
546
+ message: 'email or password error ',
547
547
  });
548
548
  }
549
549
 
@@ -712,11 +712,11 @@ module.exports = function init(____0) {
712
712
  if (user.id) {
713
713
  where.id = user.id;
714
714
  } else if (user.email) {
715
- where.email = user.email;
715
+ where.email = user.email.trim().toLowerCase();
716
716
  } else if (user.mobile) {
717
- where.mobile = user.mobile;
717
+ where.mobile = user.mobile.trim().toLowerCase();
718
718
  } else if (user.userName) {
719
- where.userName = user.userName;
719
+ where.userName = user.userName.trim().toLowerCase();
720
720
  } else {
721
721
  callback({
722
722
  message: 'User Info Not Correct',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isite",
3
- "version": "2022.03.07",
3
+ "version": "2022.04.10",
4
4
  "description": "Create Enterprise Multi-Language Web Site [Fast and Easy] ",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -43,6 +43,7 @@
43
43
  "mongodb": "^4.2.2",
44
44
  "mv": "^2.1.1",
45
45
  "node-fetch": "^2.6.1",
46
+ "utf8": "^3.0.0",
46
47
  "ws": "^8.2.3",
47
48
  "xlsx": "^0.17.4"
48
49
  }