Mercurial > ec-userscripts
comparison pixiv-direct-external-link.user.js @ 109:ef21ef445fc6
Cleanups
- wrap everything in function and call them last
- fix namespace and update url
| author | nanaya <me@nanaya.net> |
|---|---|
| date | Sun, 15 Jan 2023 23:33:41 +0900 |
| parents | 2c4470b73ad9 |
| children | d9dc190bccaf |
comparison
equal
deleted
inserted
replaced
| 108:2c4470b73ad9 | 109:ef21ef445fc6 |
|---|---|
| 1 // ==UserScript== | 1 // ==UserScript== |
| 2 // @name pixiv direct external link | 2 // @name pixiv direct external link |
| 3 // @namespace https://myconan.net | 3 // @namespace https://nanaya.net |
| 4 // @version 1.1.5 | 4 // @version 1.1.5 |
| 5 // @description Make proper link on pixiv pages | 5 // @description Make proper link on pixiv pages |
| 6 // @author nanaya | 6 // @author nanaya |
| 7 // @match http://www.pixiv.net/* | 7 // @match http://www.pixiv.net/* |
| 8 // @grant none | 8 // @grant none |
| 9 // @downloadURL https://hg.myconan.net/ec-userscripts/raw-file/tip/pixiv-direct-external-link.user.js | 9 // @downloadURL https://hg.nanaya.net/ec-userscripts/raw-file/tip/pixiv-direct-external-link.user.js |
| 10 // ==/UserScript== | 10 // ==/UserScript== |
| 11 | 11 |
| 12 'use strict'; | |
| 13 | |
| 12 /* global $ */ | 14 /* global $ */ |
| 13 (function () { | 15 function directLink () { |
| 14 'use strict'; | |
| 15 | |
| 16 const fixLink = function (_i, el) { | 16 const fixLink = function (_i, el) { |
| 17 const $el = $(el); | 17 const $el = $(el); |
| 18 const url = decodeURIComponent($el.attr('href').replace(/^\/?jump.php\?/, '')); | 18 const url = decodeURIComponent($el.attr('href').replace(/^\/?jump.php\?/, '')); |
| 19 | 19 |
| 20 $el.attr('href', url); | 20 $el.attr('href', url); |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 $("[href^='jump.php?']").each(fixLink); | 23 $("[href^='jump.php?']").each(fixLink); |
| 24 $("[href^='/jump.php?']").each(fixLink); | 24 $("[href^='/jump.php?']").each(fixLink); |
| 25 }).call(); | 25 } |
| 26 | |
| 27 directLink(); |
