Redirect to UNSW Library

Redirect ACM, IEEE, Springer and ScienceDirect to UNSW Library.

当前为 2024-04-19 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Redirect to UNSW Library
  3. // @namespace https://github.com/Caikun-Peng/Redirect-to-UNSW-Library/blob/main/redirection.js
  4. // @version 1.0
  5. // @description Redirect ACM, IEEE, Springer and ScienceDirect to UNSW Library.
  6. // @author Caikun-Peng
  7. // @match https://dl.acm.org/*
  8. // @match https://ieeexplore.ieee.org/*
  9. // @match https://link.springer.com/*
  10. // @match https://www.sciencedirect.com/*
  11. // @grant GM_xmlhttpRequest
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function(){
  16. 'use strict';
  17.  
  18. var origin
  19. var newURL
  20. var flag
  21.  
  22. function main() {
  23. GM_xmlhttpRequest({ // Get IP address
  24. method: "GET",
  25. url: "https://api.ipify.org?format=json",
  26. onload: function(response) {
  27. var ip = JSON.parse(response.responseText).ip;
  28. if (ip.includes("129.94")) {
  29. flag = 0;
  30. } else{
  31. flag = 1;
  32. }
  33. if (flag) {
  34. newURL = changeURL();
  35. window.location.href = newURL;
  36. }
  37. }
  38. });
  39. }
  40.  
  41. function changeURL(){
  42. if (origin.startsWith("https://dl.acm.org/")) {
  43. return origin.replace("https://dl.acm.org/", "https://dl-acm-org.wwwproxy1.library.unsw.edu.au/");
  44. }
  45. else if (origin.startsWith("https://ieeexplore.ieee.org/")) {
  46. return origin.replace("https://ieeexplore.ieee.org/", "https://ieeexplore-ieee-org.wwwproxy1.library.unsw.edu.au/");
  47. }
  48. else if (origin.startsWith("https://link.springer.com/")) {
  49. return origin.replace("https://link.springer.com/", "https://link-springer-com.wwwproxy1.library.unsw.edu.au/");
  50. }
  51. else if (origin.startsWith("https://www.sciencedirect.com/")) {
  52. return origin.replace("https://www.sciencedirect.com/", "https://www-sciencedirect-com.wwwproxy1.library.unsw.edu.au/");
  53. }
  54. }
  55.  
  56. origin = window.location.href;
  57. main();
  58.  
  59. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址