Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name IP 快速查詢 (ip-api.com)
- // @namespace https://www.plurk.com/SpyMomiji
- // @version 1.0
- // @description 現在你可以從之前複製 IP 的地方查詢更多訊息了 (資料由 ip-api.com 提供)
- // @author SpyMomiji
- // @match https://forum.gamer.com.tw/C.php?*
- // @match https://forum.gamer.com.tw/Co.php?*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=gamer.com.tw
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- jQuery('head')
- .append(jQuery(
- `<style>
- div.post-info .p_ip{
- color: #0089ac;
- cursor: pointer;
- }
- div.post-info .p_ip:hover{
- text-decoration-line: underline;
- }
- </style>`
- ))
- .append(jQuery(
- `<script>
- function postInfo_IP_click(dom){
- var ip = jQuery(dom).text().split('.');
- ip = ip.map( s => {
- var a = parseInt(s);
- if(isNaN(s)) return 1;
- if(s>255||s<1) return 1;
- return a;
- })
- window.open(\`https://ip-api.com/#\${ip.join('.')}\`, '_blank').focus();
- }
- </script>`
- ))
- jQuery('#postInfo div.post-info p').eq(0)
- .addClass('p_ip')
- .attr('onclick','postInfo_IP_click(this)');
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement