view pixiv-direct-external-link.user.js @ 66:444b17e657be

Standardize code style
author nanaya <me@nanaya.pro>
date Wed, 10 Jul 2019 22:36:31 +0900
parents 3381a9cb88d1
children 521dda0a0b6f
line wrap: on
line source

// ==UserScript==
// @name         pixiv direct external link
// @namespace    https://myconan.net
// @version      1.1.2
// @description  Make proper link on pixiv pages
// @author       nanaya
// @match        http://www.pixiv.net/*
// @grant        none
// @downloadURL  https://bitbucket.org/nanayapro/ec-userscripts/raw/tip/pixiv-direct-external-link.user.js
// ==/UserScript==

/* global $ */
;(function () {
  'use strict'

  var fixLink = function (_i, el) {
    var $el = $(el)
    var url = decodeURIComponent($el.attr('href').replace(/^\/?jump.php\?/, ''))

    $el.attr('href', url)
  }

  $("[href^='jump.php?']").each(fixLink)
  $("[href^='/jump.php?']").each(fixLink)
}).call()