123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
-
- const uid = function () {
- return Date.now().toString(36) + Math.random().toString(36).substr(2);
- }
-
- function loadScript(src) {
- return new Promise(function (resolve, reject) {
- var s;
- s = document.createElement('script');
- s.src = src;
- s.onload = resolve;
- s.onerror = reject;
- document.head.appendChild(s);
- });
- }
-
-
- function shuffleArray(array) {
- for (let i = array.length - 1; i > 0; i--) {
- const j = Math.floor(Math.random() * (i + 1));
- [array[i], array[j]] = [array[j], array[i]];
- }
- }
-
- function debounce(func, delay=500) {
- let timeoutId;
- return function(...args) {
- const context = this;
- clearTimeout(timeoutId);
- timeoutId = setTimeout(() => {
- func.apply(context, args);
- }, delay);
- };
- }
-
- function getCurrencySymbol(value = 0) {
- let type = 'INR'
- if (type) {
- const ans = new Intl.NumberFormat('en-IN', { style: 'currency', currency: type }).format(value);;
- const res = ans.split(/(\D+)/);
- const currencySymbol = res[1];
- const amount = res.slice(2, res.length).join('')
-
-
- return [currencySymbol, amount]
- } else {
- console.log("errrrrrrrrrrrrrrrrrrrrrrrrr", type);
- return ['', 0];
- }
- }
-
- function toasterHelper(type, message, align = 'toast-top-center') {
- // toasterOpts()
- debugger;
- toastr.clear()
- toasterOpts(align);
- Command: toastr[type](message);
-
- function toasterOpts(align) {
- toastr.options = {
- "closeButton": true,
- "debug": false,
- "newestOnTop": true,
- "progressBar": true,
- "positionClass": align,
- "preventDuplicates": true,
- "onclick": null,
- "showDuration": "300",
- "hideDuration": "1000",
- "timeOut": "5000",
- "extendedTimeOut": "1000",
- "showEasing": "swing",
- "hideEasing": "linear",
- "showMethod": "fadeIn",
- "hideMethod": "fadeOut"
- }
- }
- }
-
- async function getMulFileToGetBase64(event) {
- let files = event.target.files;
- let filePromise = [];
- for (let i = 0; i < files.length; i++) {
- let currFile = files[i];
- let currFilePromise = new Promise((resolve, reject) => {
- const reader = new FileReader();
- reader.readAsDataURL(currFile);
- // Wait till complete
- reader.onloadend = function () {
- let base64String = reader.result
- .toString()
- .replace(/^data:.+;base64,/, "");
- let fileReq = {
- FileData: base64String,
- FileName: currFile.name.split(".").slice(0, -1).join("."),
- FileType: currFile.name.split(".").pop(),
- RefId: 0,
- "ByteData": null,
- "FilePath": ""
- };
- resolve(fileReq);
- };
- // Make sure to handle error states
- reader.onerror = function (e) {
- reject(e);
- };
- });
- filePromise.push(currFilePromise)
- }
-
- return Promise.all(filePromise);
- }
-
-
- function containsSpecialCharsHelper(str) {
- const specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/;
- return specialChars.test(str);
- }
- const isUpperCaseHelper = (string) => /^(?=.*[A-Z])/.test(string);
- const isLowerCaseHelper = (string) => /^(?=.*[a-z])/.test(string);
- const isNumberContainsHelper = (string) => /\d/.test(string);
-
- function swapSectionsVideo(){
- function swapSections() {
- var sectionOne = document.querySelector('.section-one');
- var sectionTwo = document.querySelector('.section-two');
-
- let nextSibling = sectionOne.nextSibling;
- var isMobile = window.matchMedia("(max-width: 768px)").matches;
- if(!isMobile) return;
-
- if(nextSibling){
- sectionOne.insertAdjacentElement("beforeBegin",sectionTwo)
- }else{
- sectionOne.parentNode.insertBefore(sectionOne, sectionTwo);
- }
-
- // sectionOne.parentNode.insertBefore(sectionOne, sectionTwo);
- }
- swapSections();
-
- // Call the swapSections function on load and resize
- // window.addEventListener('load', swapSections);
- window.addEventListener('resize', swapSections);
-
- setTimeout(function (){
- document.querySelector('auth-loader').hide();
- $('.loading-main').removeClass('d-none');
- },1000);
- }
|