myconfig.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. var version = +new Date();
  2. var myconfig = {
  3. path: '/static/js/',
  4. alias: {
  5. 'jquery': 'dist/jquery/jquery-1.11.1.min',
  6. 'jquery.form': 'dist/jquery/jquery.form',
  7. 'jquery.gcjs': 'dist/jquery/jquery.gcjs',
  8. 'jquery.validate': 'dist/jquery/jquery.validate.min',
  9. 'jquery.nestable': 'dist/jquery/nestable/jquery.nestable',
  10. 'jquery.qrcode':'../dist/jquery/jquery.qrcode.min',
  11. 'bootstrap': 'dist/bootstrap/bootstrap.min',
  12. 'bootstrap.suggest': 'dist/bootstrap/bootstrap-suggest.min',
  13. 'bootbox': 'dist/bootbox/bootbox.min',
  14. 'sweet': 'dist/sweetalert/sweetalert.min',
  15. 'select2': 'dist/select2/select2.min',
  16. 'jquery.confirm': 'dist/jquery/confirm/jquery-confirm',
  17. 'jquery.contextMenu': 'dist/jquery/contextMenu/jquery.contextMenu',
  18. 'switchery': 'dist/switchery/switchery',
  19. 'echarts': 'dist/echarts/echarts-all',
  20. 'echarts.min': 'dist/echarts/echarts.min',
  21. 'toast': 'dist/jquery/toastr.min',
  22. 'clipboard': 'dist/clipboard.min',
  23. 'tpl': 'dist/tmodjs',
  24. 'daterangepicker': 'dist/daterangepicker/daterangepicker',
  25. 'datetimepicker': 'dist/datetimepicker/jquery.datetimepicker',
  26. 'ueditor': 'dist/ueditor/ueditor.parse.min',
  27. 'tooltipbox': 'dist/tooltipbox',
  28. },
  29. map: {
  30. 'js': '.js?v=' + version,
  31. 'css': '.css?v=' + version
  32. },
  33. css: {
  34. 'jquery.confirm': 'dist/jquery/confirm/jquery-confirm',
  35. 'sweet': 'dist/sweetalert/sweetalert',
  36. 'select2': 'dist/select2/select2,dist/select2/select2-bootstrap',
  37. 'jquery.nestable': 'dist/jquery/nestable/nestable',
  38. 'jquery.contextMenu': 'dist/jquery/contextMenu/jquery.contextMenu',
  39. // 'daterangepicker': 'dist/daterangepicker/daterangepicker',
  40. // 'datetimepicker': 'dist/datetimepicker/jquery.datetimepicker',
  41. 'ueditor': 'dist/ueditor/themes/default/css/ueditor.min',
  42. 'switchery': 'dist/switchery/switchery'
  43. }
  44. , preload: ['jquery']
  45. };
  46. var myrequire = function (arr, callback) {
  47. var newarr = [];
  48. $.each(arr, function () {
  49. var js = this;
  50. if (myconfig.css[js]) {
  51. var css = myconfig.css[js].split(',');
  52. $.each(css, function () {
  53. if(typeof myrequire.systemVersion !== 'undefined'){
  54. if (myrequire.systemVersion === '1.0.0' || myrequire.systemVersion <= '0.8')
  55. {
  56. newarr.push("css!" + myconfig.path + this + myconfig.map['css']);
  57. }
  58. else
  59. {
  60. newarr.push("loadcss!" + myconfig.path + this + myconfig.map['css']);
  61. }
  62. }else{
  63. newarr.push("css!" + myconfig.path + this + myconfig.map['css']);
  64. }
  65. });
  66. }
  67. var jsitem = this;
  68. if (myconfig.alias[js]) {
  69. jsitem = myconfig.alias[js];
  70. }
  71. newarr.push(myconfig.path + jsitem + myconfig.map['js']);
  72. });
  73. require(newarr, callback);
  74. }