Greasy Fork

Greasy Fork is available in English.

tumblr img enlarger

Replace images in tumblr post with 1280px version if exists

当前为 2016-05-27 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==ГыукЫскшзе==
// ==UserScript==
// @name        tumblr img enlarger
// @namespace   tie
// @include     http://*.tumblr.com/post/*
// @include     https://*.tumblr.com/post/*
// @version     0.3
// @grant       none
//@require      http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @description Replace images in tumblr post with 1280px version if exists
// ==/UserScript==
var $;
// Add jQuery
(function () {
  if (typeof unsafeWindow.jQuery == 'undefined') {
    var GM_Head = document.getElementsByTagName('head') [0] || document.documentElement,
    GM_JQ = document.createElement('script');
    GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js';
    GM_JQ.type = 'text/javascript';
    GM_JQ.async = true;
    GM_Head.insertBefore(GM_JQ, GM_Head.firstChild);
  }
  GM_wait();
}) ();
// Check if jQuery's loaded
function GM_wait() {
  if (typeof unsafeWindow.jQuery == 'undefined') {
    window.setTimeout(GM_wait, 100);
  } else {
    $ = unsafeWindow.jQuery.noConflict(true);
    letsJQuery();
  }
}// All your GM code must be inside this function

function letsJQuery() {
  /*begin*/
  $('img').each(function () {
    var src1 = $(this).attr('src');
    var img = $(this);
    img.removeAttr('class');
    img.off('click');
    img.parent().off("click", "**");
    var width1 = img.width();
    if (src1.indexOf('_500') != - 1)
    {
      //alert('500 found at '+src1);
      var src2 = src1.replace(/_500/g, '_1280');
      //alert("new url "+ src2);
      /*replace with big image url*/
      img.attr('src', src2);
      img.width(width1);
    }
    var wrap = img.parent();
    if (wrap.is('a')) {
    img.unwrap();
    }
    img.wrap('<a href=\'' + img.attr('src') + '\' target=\'_blank\' id=\'ioioi\'></a>');
    //img.insertAfter('<a href=\'' + img.attr('src') + '\' target=\'_blank\' id=\'ioioi\'>link</a>');
    //img.parent().off("click", "**");
  });
  /*end*/
}