vipexam no ip limit

中科vipexam no ip limit

目前为 2022-07-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name vipexam no ip limit
  3. // @namespace https://github.com/maiersk
  4. // @version 0.2.0
  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. // @match http://www.umajor.org/*
  14. // @require https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18. (function () {
  19. 'use strict';
  20.  
  21. var _vipexam = null;
  22. var _umajor = null;
  23.  
  24. var _veuser = { code: "", user: { "account": "f46354b31ec64c9c96919e12a9bbd610", "username": "游客(受限)", collegename: "北京大学" } };
  25. var _umuser = { code: "1", user: { "account": "f46354b31ec64c9c96919e12a9bbd610", "username": "游客(受限)", collegename: "1111" } };
  26.  
  27. layui.use(['form', 'layer', 'jquery', 'cookie', 'element'], function () {
  28. var $ = layui.jquery,
  29. element = layui.element,
  30. form = layui.form,
  31. layer = layui.layer,
  32.  
  33. _vipexam = $.cookie("vipexam");
  34. _umajor = $.cookie("umajor");
  35. var vipexam_storage = !!_vipexam ? JSON.parse(_vipexam) : _veuser;
  36. var umajor_storage = _umajor ? JSON.parse(_umajor) : _umuser;
  37. var _vid = vipexam_storage.user.account;
  38. var _umid = umajor_storage.user.account;
  39.  
  40. //vipexam账号角色id,3是教师账号id,4是普通账号id
  41. var _role = 2;
  42.  
  43. function RequestJson(url, params, callback) {
  44. var _idx = layer.load(1);
  45. $.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); } });
  46. }
  47.  
  48. //vipexam登录
  49. form.on('submit(vipexam_crashlogin)', function (data) {
  50. _vid = $("#username").val();
  51.  
  52. RequestJson("user/login.action", { account: $("#username").val(), password: $("#password").val() }, function (data) {
  53. if (data.code == "1") {
  54. data.user.role = _role
  55. $.cookie("vipexam", JSON.stringify(data), { path: '/', expires: 7 });
  56. _vipexam = $.cookie("vipexam");
  57. document.location = "index.html";
  58. } else {
  59. layer.msg(data.msg, { icon: 2 });
  60. }
  61. });
  62. return false;
  63. });
  64.  
  65. // umajor登录
  66. form.on('submit(umajor_crashlogin)', function (data) {
  67. _umid = $("#username").val();
  68.  
  69. RequestJson("user/login.action", { account: $("#username").val(), password: $("#password").val() }, function (data) {
  70. if (data.code == "1") {
  71. $.cookie("umajor", JSON.stringify(data), { path: '/', expires: 7 });
  72. _umajor = $.cookie("umajor");
  73. document.location = "index.html";
  74. } else {
  75. layer.msg(data.msg, { icon: 2 });
  76. }
  77. });
  78. return false;
  79. });
  80.  
  81. //关闭ip问题弹窗
  82. $(function () {
  83. setTimeout(function () {
  84. layer.closeAll();
  85. }, 350);
  86. });
  87.  
  88. //显示已登录信息
  89. if (_vid != "f46354b31ec64c9c96919e12a9bbd610" || _umid != "f46354b31ec64c9c96919e12a9bbd610") {
  90. if (window.location.host.indexOf('vipexam') !== -1) {
  91. $("#person").text(_vid);
  92. $("#rtbox").hide();
  93. $("#rtbox2").show();
  94. }
  95.  
  96. if (window.location.host.indexOf('umajor') !== -1) {
  97. $("#personid").text(_umid);
  98. $("#login").hide();
  99. $("#person").show();
  100. $("#personid").hover(function () {
  101. layer.tips("<a href='personal_center.html' style='color:#fff;'>个人中心</a>", this, { tips: [3, '#666'], time: 3000, area: ['80px', '40px'] });
  102. }, function () { });
  103. }
  104. }
  105. });
  106.  
  107. $(document).ready(function () {
  108. if (window.location.host.indexOf('vipexam') !== -1) {
  109. var div = $(".layui-form-item-center");
  110. var vipexam_crashlogin = '<div id="vipexam_crashlogin" lay-submit lay-filter="vipexam_crashlogin" class="layui-btn" >crashlogin</div>';
  111. div.append(vipexam_crashlogin);
  112. }
  113.  
  114. if (window.location.host.indexOf('umajor') !== -1 && window.location.pathname.indexOf('login') !== -1) {
  115. var umajor_crashlogin = '<div id="umajor_crashlogin" lay-submit lay-filter="umajor_crashlogin" class="layui-btn" >crashlogin</div>';
  116. $(".layui-form").append(umajor_crashlogin);
  117. }
  118. })
  119. })();