Advertisement
SpyMomiji

IP 快速查詢 (ip-api.com)

Sep 10th, 2022
1,006
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name         IP 快速查詢 (ip-api.com)
  3. // @namespace    https://www.plurk.com/SpyMomiji
  4. // @version      1.0
  5. // @description  現在你可以從之前複製 IP 的地方查詢更多訊息了 (資料由 ip-api.com 提供)
  6. // @author       SpyMomiji
  7. // @match        https://forum.gamer.com.tw/C.php?*
  8. // @match        https://forum.gamer.com.tw/Co.php?*
  9. // @icon         https://www.google.com/s2/favicons?sz=64&domain=gamer.com.tw
  10. // @grant        none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14.     'use strict';
  15.  
  16. jQuery('head')
  17. .append(jQuery(
  18. `<style>
  19. div.post-info .p_ip{
  20.     color: #0089ac;
  21.     cursor: pointer;
  22. }
  23. div.post-info .p_ip:hover{
  24.     text-decoration-line: underline;
  25. }
  26.  
  27. </style>`
  28. ))
  29. .append(jQuery(
  30. `<script>
  31. function postInfo_IP_click(dom){
  32.     var ip = jQuery(dom).text().split('.');
  33.     ip = ip.map( s => {
  34.         var a = parseInt(s);
  35.         if(isNaN(s)) return 1;
  36.         if(s>255||s<1) return 1;
  37.         return a;
  38.     })
  39.     window.open(\`https://ip-api.com/#\${ip.join('.')}\`, '_blank').focus();
  40. }
  41. </script>`
  42. ))
  43.  
  44. jQuery('#postInfo div.post-info p').eq(0)
  45. .addClass('p_ip')
  46. .attr('onclick','postInfo_IP_click(this)');
  47.  
  48. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement