Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mobile_global.js 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // 当分页不足以显示隐藏div
  2. $(function() {
  3. if (parseInt($('div.dataTables_paginate li').length) > 0) {
  4. $('div.dataTables_paginate').show();
  5. }
  6. });
  7. // 正在加载中的圈圈提示
  8. function showLayerLoad() {
  9. var result = layer.load(1, {anim: 2, shade: [0.1, '#fff']});
  10. return result;
  11. }
  12. // 内容提示(无确认按钮)
  13. function showLayerMsg(msg, anim, callback) {
  14. if (!anim && anim != 0) anim = 2;
  15. layer.msg(msg, {anim: anim, time: 1500}, function(index) {
  16. if (typeof callback !== 'undefined') callback();
  17. layer.close(index);
  18. });
  19. }
  20. // 内容提示(有确认按钮)
  21. function showLayerAlert(msg, anim, icon, callback) {
  22. if (!anim && anim != 0) anim = 2;
  23. if (!icon && icon != 0) icon = 5;
  24. layer.alert(msg, {anim: anim, icon: icon, title: false, closeBtn: false}, function(index) {
  25. if (typeof callback !== 'undefined') callback();
  26. layer.close(index);
  27. });
  28. }
  29. // 统一提示确认框
  30. function showConfirmBox(msg, btn, callback_1, callback_2) {
  31. if (typeof msg === 'undefined' || !msg) msg = '确认执行此操作?';
  32. if (typeof btn === 'undefined' || !btn) btn = ['确定', '取消'];
  33. layer.confirm(msg, {
  34. anim: 2,
  35. btn: btn,
  36. closeBtn: 0,
  37. title: false,
  38. shadeClose: true,
  39. skin: 'xin-demo-btn'
  40. }, function (index) {
  41. // 确认操作
  42. if (typeof callback_1 !== 'undefined') callback_1();
  43. layer.close(index);
  44. }, function (index) {
  45. // 取消操作
  46. if (typeof callback_2 !== 'undefined') callback_2();
  47. layer.close(index);
  48. });
  49. }
  50. // 处理验证邮箱格式
  51. function handleEmailFormat(email) {
  52. var reg = /^[a-z0-9]([a-z0-9\\.]*[-_]{0,4}?[a-z0-9-_\\.]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+([\.][\w_-]+){1,5}$/i;
  53. return reg.test(email);
  54. }
  55. // 处理验证码刷新,默认获取会员登录的验证码,可传入type类型(admin_login、users_reg、users_login、users_retrieve_password、guestbook)
  56. function handleVerifyRefresh(id, type) {
  57. id = !id ? 'imgVerifys' : id;
  58. type = !type ? 'users_login' : type;
  59. var src = eyou_basefile + "?m=api&c=Ajax&a=vertify&type=" + type;
  60. src = src + '&r=' + Math.floor(Math.random() * 100);
  61. $('#' + id).attr('src', src);
  62. }
  63. // 渲染编辑器
  64. function showLoadEditor(elemtid) {
  65. var content = '';
  66. try{
  67. content = UE.getEditor(elemtid).getContent();
  68. UE.getEditor(elemtid).destroy();
  69. }catch(e){}
  70. var options = {
  71. serverUrl : __root_dir__+'/index.php?m=user&c=Uploadify&a=index&savepath=ueditor&lang='+__lang__,
  72. zIndex: 999,
  73. initialFrameWidth: "100%",
  74. initialFrameHeight: 450,
  75. focus: false,
  76. maximumWords: 99999,
  77. removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',
  78. pasteplain: false,
  79. autoHeightEnabled: false,
  80. toolbars: [['fullscreen', 'forecolor', 'backcolor', 'removeformat', '|', 'simpleupload', 'unlink', '|', 'paragraph', 'fontfamily', 'fontsize']],
  81. xssFilterRules: true,
  82. inputXssFilter: true,
  83. outputXssFilter: true
  84. };
  85. eval("ue_"+elemtid+" = UE.getEditor(elemtid, options);ue_"+elemtid+".ready(function() {ue_"+elemtid+".setContent(content);});");
  86. }
  87. // 发送(短信、邮箱)提醒
  88. function eyUnifiedSendRemind(result) {
  89. if (result) {
  90. $.ajax({
  91. url: result.url,
  92. data: result.data,
  93. type: 'post',
  94. dataType: 'json'
  95. });
  96. }
  97. }