fantasti.cc load images from thumbnails

Shows images instead of thumbnails

当前为 2015-04-25 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           fantasti.cc load images from thumbnails
// @namespace      https://greasyfork.org/users/5174-jesuis-parapluie
// @author         jesuis-parapluie
// @description	   Shows images instead of thumbnails
//
// @include        http://fantasti.cc/images/*
// @include        http://fantasti.cc/*/images/*
// @exclude        http://fantasti.cc/category/tagcloud/images/*
//

// @require        http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
//
// @version	   0.3
// @grant          none
// ==/UserScript==
function loadImgs()
{
  var query = $('div#loop');
  var q = $('div[id*="post_"]');
  if (!query.size())
  {
      query = $('div#archive');
      q = $('.xxx').parent();
  }
  query.each(function (i)
  {
    if (!$(this).hasClass('done'))
    {
      $(this).addClass('done');
      var imgs = $('<div>', {
        'class': 'images'
      });
      
      
      var p = $(this).find('.pages').last();
      if (p.size())
      {
          $(this).before(p.parent(), imgs);
      }
      else
      {
          imgs.appendTo($(this));
      }
      $(this).find(q).each(function (i) {
        if (!$(this).hasClass('imgdone'))
        {
          $(this).addClass('imgdone');
          $.get($(this).find('a').attr('href'), function (data) {
            imgs.append($(data).find('div.s').find('img') [1]);
          });
        }
      });
    }
  });
}
$(function ()
{
    
  var l = $('<div>', {
    id: 'loadImgs',
    style: 'margin-left: 110px;text-decoration: underline;color:#f00;cursor:pointer;font-weight: bolder;',
    text: 'Show images'
  }).click(function (e)
  {
    if ($('div#loadImgs').hasClass('imagesVisible')) {
      $('div#loadImgs').removeClass('imagesVisible');
      $('div#loadImgs').html('Show images');
      $('div.images').hide();
      var query = $('div[id*="post_"]');
      if (!query.size()) query = $('.xxx').parent();
      query.show();
    } else {
      $('div#loadImgs').addClass('imagesVisible');
      $('div#loadImgs').html('Show thumbnails');
      $('div.images').show();
      var query = $('div[id*="post_"]');
      if (!query.size()) query = $('.xxx').parent();
      query.hide();
      loadImgs();
    }
  });
  var query = $('.search_result_cams_2');
  if (!query.size()) query = $('#search').parent();
  l.insertAfter(query);
  
  $(document).bind('DOMNodeInserted', function (e)
  {
    if ($('div#loadImgs').hasClass('imagesVisible') && e.target.tagName === 'DIV' && e.target.getAttribute('id') && e.target.getAttribute('id') == 'loop' || e.target.getAttribute('id') == 'archive')
    {
      $('div.images').show();
      $('div[id*="post_"]').hide();
      var query = $('div[id*="post_"]');
      if (!query.size()) query = $('.xxx').parent();
      query.hide();
      loadImgs();
    }
  });
});