ameblo image opener

Shift+click to open full-size ameblo image in new tab.

目前為 2020-04-28 提交的版本,檢視 最新版本

// ==UserScript==
// @author      CTQY
// @name        ameblo image opener
// @namespace   ct.qy
// @version     1.0.0
// @include     http://ameblo.jp/*
// @include     https://ameblo.jp/*
// @description Shift+click to open full-size ameblo image in new tab.
// @icon        https://ameblo.jp/favicon.ico
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// ==/UserScript==

var timestamp = 0;

(function($){

$(document).on('click', '.userImageLink, article, img', function(e, a) {
  if (!e) e = window.event;
  if (!e.shiftKey) return;
  e.preventDefault();
  if (e.timeStamp <= timestamp) return;
  timestamp = e.timeStamp;
  var target = $(e.currentTarget);
  var img = target.is('img') ? target : target.find('img').last();
  var url = img.attr('src');
  if (url) {
    window.open(url.split('?')[0], '_blank');
  }
});

})(jQuery);