// ==UserScript== // @name display the image of tumblr in HD revolution and copy http url of images in one post // @description 直接显示tumblr的图片为高清版,并可以复制一个博文的所有图片地址 // @version 0.9 // @include http://*.tumblr.com/* // @include https://*.tumblr.com/* // @author yechenyin // @namespace https://greasyfork.org/users/3586-yechenyin // @require https://code.jquery.com/jquery-1.11.2.min.js // @grant GM_setClipboard // @downloadURL none // ==/UserScript== $(".post_wrapper").each(function() { console.log($(this).find(".post_media img").length); if ($(this).find(".post_media img").length > 0) { $(this).find(".photoset_photo img").each(function() { if (this.src != this.parentNode.href) this.src = this.parentNode.href; }); $(this).find(".post_media_photo").each(function() { if ($(this).parent().attr("data-big-photo") && this.src != $(this).parent().attr("data-big-photo")) { this.src = $(this).parent().attr("data-big-photo"); console.log(this.src); } }); $(this).find(".post_notes_label").eq(0).after($("", {text:"copy images", class:"copy_images", css:{display:"inline", cursor:"pointer"}})); if ($(this).find(".note_link_current").html() !== '') $(this).find(".note_link_current").css({display:"inline", marginRight:"10px"}); if ($(this).find(".copy_images").length > 0) console.log('added copy images'); //http_images = window.open(''); //http_images.document.write(' //'); } }); $(document).on('click', '.copy_images', copy_images); $(document).on('DOMNodeInserted', '.post_container', function(e) { if ($(e.target).hasClass('post_container')) { //console.log($(this).html()); //setTimeout(function(){console.log($(this).find(".post_notes_label").length)}, 3000); if ($(this).find(".post_media img").length > 0) { $(this).find(".photoset_photo img").each(function() { if (this.src != this.parentNode.href) this.src = this.parentNode.href; }); $(this).find(".post_media_photo").each(function() { if ($(this).parent().attr("data-big-photo") && this.src != $(this).parent().attr("data-big-photo")) { this.src = $(this).parent().attr("data-big-photo"); console.log(this.src); } }); $(this).find(".post_notes_label").eq(0).after($("", {text:"copy images", class:"copy_images", css:{display:"inline", cursor:"pointer"}})); if ($(this).find(".note_link_current").html() !== '') $(this).find(".note_link_current").css({display:"inline", marginRight:"10px"}); if ($(this).find(".copy_images").length > 0) console.log('added copy images'); } } }); function copy_images() { images=''; $(this).parents('.post_wrapper').find("a>img").each(function() { images += this.src.replace(/https:\/\//g, "http://") + '\n'; }); if (typeof GM_setClipboard === "undefined") console.log('images:' +images); else GM_setClipboard(images); }