iStock XL Comps

Get a full size comp from iStock to include it in your development work.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name       		iStock XL Comps
// @description  	Get a full size comp from iStock to include it in your development work.
// @copyright  		2014, Giammarco Galletti (http://dotsqr.co)
// @icon            http://i.imgur.com/5aXOn7y.png
// @license         MIT License
// @homepageURL     https://gist.github.com/gallettigr/8693df7ce9ed2da21415
// @supportURL      http://dotsqr.co
// @namespace       istock-xl-comps
// @oujs:author     gallettigr
// @version         0.1
// @match           http://www.istockphoto.com/photo/*
// @match           http://www.istockphoto.com/vector/*
// @require    		http://code.jquery.com/jquery-latest.min.js
// ==/UserScript==

jQuery.noConflict();
jQuery(document).ready( function() {
    var istockCompHTML = '<div id="istock-xl-comp"><p>Zoom the image to desired size. </p><a href="javascript:();">Grab Image</a></div>';
    
    var istockCompButtonLabel = {
        'opacity' : '0',
        'margin' : '15px 0 0',
        'padding' : '10px 10px 12px',
        'border' : '1px solid #ccd3d3',
        'font' : '300 16px/33px "iStock Maquette", Arial, Tahoma, sans-serif',
        'background' : '#f3f3f3',
        'height' : '0',
        'width' : '360px'
    };
    
    var istockCompText = {
        'float' : 'left',
        'margin' : '0',
        'font' : '300 14px/37px Arial, Tahoma, sans-serif'
    }
    
    var istockCompButton = {
		'float' : 'right',
        'width' : '125px',
        'height' : '32px',
        'margin' : '0',
		'background' : '#2a98ed',
        'color' : '#fafafa',
        'font-weight' : 'bold',
        'text-align' : 'center',
        'text-decoration' : 'none',
        'border' : '1px solid #2473b0',
        'border-radius' : '4px'
    };
    
    var istockCompButtonHoverCSS = {
		'background' : '#268FE0'
    };
    
    jQuery(istockCompHTML).appendTo('#file-preview').css(istockCompButtonLabel).not(':animated').animate({opacity: '1', height: '32px'}, 300);
    jQuery("#istock-xl-comp > p").css(istockCompText);
    jQuery("#istock-xl-comp > a").css(istockCompButton);
    jQuery("#istock-xl-comp > a").hover( function() {
        jQuery(this).css(istockCompButtonHoverCSS);
    }, function() {
        jQuery(this).css(istockCompButton);
    });
    
    var iStockBaseURL = 'http://www.istockphoto.com';

    jQuery("#istock-xl-comp > a").on('click', function(){
        if (jQuery('#ZoomDraggableDiv > div[id^="s"]:visible').size() > 0) {
			var generatedURL = jQuery('#ZoomDraggableDiv > div[id^="s"]:visible > div:first-child img').attr('src');
            window.open(iStockBaseURL + generatedURL, '_blank');
        }
        else
            alert('First click on the image to zoom and generate image size.');
    });
    
});