暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

helpers.js 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. const uid = function(){
  2. return Date.now().toString(36) + Math.random().toString(36).substr(2);
  3. }
  4. function loadScript(src) {
  5. return new Promise(function (resolve, reject) {
  6. var s;
  7. s = document.createElement('script');
  8. s.src = src;
  9. s.onload = resolve;
  10. s.onerror = reject;
  11. document.head.appendChild(s);
  12. });
  13. }
  14. function shuffleArray(array) {
  15. for (let i = array.length - 1; i > 0; i--) {
  16. const j = Math.floor(Math.random() * (i + 1));
  17. [array[i], array[j]] = [array[j], array[i]];
  18. }
  19. }
  20. function getCurrencySymbol(value=0) {
  21. let type = 'INR'
  22. if (type) {
  23. const ans = new Intl.NumberFormat('en-IN', { style: 'currency', currency: type }).format(value);;
  24. const res = ans.split(/(\D+)/);
  25. const currencySymbol = res[1];
  26. const amount = res.slice(2,res.length).join('')
  27. return [currencySymbol,amount]
  28. } else {
  29. console.log("errrrrrrrrrrrrrrrrrrrrrrrrr",type);
  30. return ['',0];
  31. }
  32. }
  33. function toasterHelper(type,message,align='toast-top-center'){
  34. // toasterOpts()
  35. debugger;
  36. toastr.clear()
  37. toasterOpts(align);
  38. Command: toastr[type](message);
  39. function toasterOpts(align){
  40. toastr.options = {
  41. "closeButton": true,
  42. "debug": false,
  43. "newestOnTop": true,
  44. "progressBar": true,
  45. "positionClass": align,
  46. "preventDuplicates": true,
  47. "onclick": null,
  48. "showDuration": "300",
  49. "hideDuration": "1000",
  50. "timeOut": "5000",
  51. "extendedTimeOut": "1000",
  52. "showEasing": "swing",
  53. "hideEasing": "linear",
  54. "showMethod": "fadeIn",
  55. "hideMethod": "fadeOut"
  56. }
  57. }
  58. }