vipexam no ip limit

中科vipexam no ip limit

当前为 2019-12-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name vipexam no ip limit
  3. // @namespace https://github.com/maiersk
  4. // @version 0.1.1
  5. // @description 中科vipexam no ip limit
  6. // @author ABTTEX
  7. // @match http://www.vipexam.org/*
  8. // @match http://www.vipexam.cn/*
  9. // @match http://lib.vipexam.org/*
  10. // @match http://lib.vipexam.cn/*
  11. // @match http://vipexam.org/*
  12. // @match http://vipexam.cn/*
  13. // @require https://code.jquery.com/jquery-3.4.1.min.js
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. var _vipexam = null;
  20.  
  21. layui.use(['form','layer','jquery','cookie'], function(){
  22. var $ = layui.jquery,
  23. form = layui.form,
  24. layer = layui.layer,
  25. cookie = layui.cookie;
  26.  
  27. _vipexam = $.cookie("vipexam");
  28. var _storage = !!_vipexam ? JSON.parse(_vipexam) : _veuser;
  29. var _vid = _storage.user.account;
  30.  
  31. function RequestJson(url, params, callback) {
  32. var _idx = layer.load(1);
  33. $.ajax({ type: "post", data: params, url: url, dataType: "json", global: false, success: function (data) { callback && callback(data); }, complete: function () { layer.close(_idx); },error:function (XMLHttpRequest, textStatus, errorThrown){layer.close(_idx);} });
  34. }
  35.  
  36. //代替原有登录function
  37. form.on('submit(crashlogin)', function(data){
  38. _vid = $("#username").val();
  39. //ipValidates();
  40. RequestJson("user/login.action",{account:$("#username").val(),password:$("#password").val()},function(data){
  41. if(data.code == "1"){
  42. //if(_flag){
  43. //alert(JSON.stringify(data))
  44. $.cookie("vipexam", JSON.stringify(data), { path: '/', expires: 7});
  45. _vipexam = $.cookie("vipexam");
  46. document.location = "index.html";
  47. //}else{
  48. // layer.msg("抱歉!IP:"+_ip+" 不在系统授权范围内!",{icon:2});
  49. //}
  50. }else{
  51. layer.msg(data.msg,{icon:2});
  52. }
  53. });
  54. return false;
  55. });
  56.  
  57. //关闭ip问题弹窗
  58. $(function(){
  59. setTimeout(function () {
  60. layer.closeAll();
  61. }, 350);
  62. });
  63.  
  64. //显示已登录信息
  65. if(_vid != "f46354b31ec64c9c96919e12a9bbd610"){
  66. $("#person").text(_vid);
  67. $("#rtbox").hide();
  68. $("#rtbox2").show();
  69. }
  70. });
  71.  
  72. $(document).ready(function() {
  73.  
  74. var div = $(".layui-form-item-center")
  75. var buthtml = '<input type="button" id="crashlogin" lay-submit lay-filter="crashlogin" value="crashlogin" />';
  76. //var buthtml = '<input type="button" id="crashlogin" value="crashlogin" />';
  77. div.append(buthtml);
  78.  
  79. // var but = $("#crashlogin")
  80.  
  81. // _vipexam = ""
  82.  
  83. // but.click(function(){
  84. // alert(JSON.stringify({account:$("#username").val(),password:$("#password").val()}))
  85. // $.ajax({
  86. // type: "post",
  87. // data: {account:$("#username").val(),password:$("#password").val()},
  88. // url: "user/login.action",
  89. // dataType: "json",
  90. // global: false,
  91. // success: function (data) {
  92. // if(data.code == "1"){
  93.  
  94. // alert(JSON.stringify(data))
  95. // $.cookie("vipexam", JSON.stringify(data), { path: '/', expires: 7});
  96. // _vipexam = $.cookie("vipexam");
  97. // document.location = "index.html";
  98.  
  99.  
  100. // }else{
  101. // layer.msg(data.msg,{icon:2});
  102. // }
  103. // },
  104. // complete: function () { },
  105. // error:function (XMLHttpRequest, textStatus, errorThrown){ }
  106. // });
  107. // })
  108.  
  109. })
  110.  
  111. })();