iStock XL Comps

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

  1. // ==UserScript==
  2. // @name iStock XL Comps
  3. // @description Get a full size comp from iStock to include it in your development work.
  4. // @copyright 2014, Giammarco Galletti (http://dotsqr.co)
  5. // @icon http://i.imgur.com/5aXOn7y.png
  6. // @license MIT License
  7. // @homepageURL https://gist.github.com/gallettigr/8693df7ce9ed2da21415
  8. // @supportURL http://dotsqr.co
  9. // @namespace istock-xl-comps
  10. // @oujs:author gallettigr
  11. // @version 0.1
  12. // @match http://www.istockphoto.com/photo/*
  13. // @match http://www.istockphoto.com/vector/*
  14. // @require http://code.jquery.com/jquery-latest.min.js
  15. // ==/UserScript==
  16.  
  17. jQuery.noConflict();
  18. jQuery(document).ready( function() {
  19. var istockCompHTML = '<div id="istock-xl-comp"><p>Zoom the image to desired size. </p><a href="javascript:();">Grab Image</a></div>';
  20. var istockCompButtonLabel = {
  21. 'opacity' : '0',
  22. 'margin' : '15px 0 0',
  23. 'padding' : '10px 10px 12px',
  24. 'border' : '1px solid #ccd3d3',
  25. 'font' : '300 16px/33px "iStock Maquette", Arial, Tahoma, sans-serif',
  26. 'background' : '#f3f3f3',
  27. 'height' : '0',
  28. 'width' : '360px'
  29. };
  30. var istockCompText = {
  31. 'float' : 'left',
  32. 'margin' : '0',
  33. 'font' : '300 14px/37px Arial, Tahoma, sans-serif'
  34. }
  35. var istockCompButton = {
  36. 'float' : 'right',
  37. 'width' : '125px',
  38. 'height' : '32px',
  39. 'margin' : '0',
  40. 'background' : '#2a98ed',
  41. 'color' : '#fafafa',
  42. 'font-weight' : 'bold',
  43. 'text-align' : 'center',
  44. 'text-decoration' : 'none',
  45. 'border' : '1px solid #2473b0',
  46. 'border-radius' : '4px'
  47. };
  48. var istockCompButtonHoverCSS = {
  49. 'background' : '#268FE0'
  50. };
  51. jQuery(istockCompHTML).appendTo('#file-preview').css(istockCompButtonLabel).not(':animated').animate({opacity: '1', height: '32px'}, 300);
  52. jQuery("#istock-xl-comp > p").css(istockCompText);
  53. jQuery("#istock-xl-comp > a").css(istockCompButton);
  54. jQuery("#istock-xl-comp > a").hover( function() {
  55. jQuery(this).css(istockCompButtonHoverCSS);
  56. }, function() {
  57. jQuery(this).css(istockCompButton);
  58. });
  59. var iStockBaseURL = 'http://www.istockphoto.com';
  60.  
  61. jQuery("#istock-xl-comp > a").on('click', function(){
  62. if (jQuery('#ZoomDraggableDiv > div[id^="s"]:visible').size() > 0) {
  63. var generatedURL = jQuery('#ZoomDraggableDiv > div[id^="s"]:visible > div:first-child img').attr('src');
  64. window.open(iStockBaseURL + generatedURL, '_blank');
  65. }
  66. else
  67. alert('First click on the image to zoom and generate image size.');
  68. });
  69. });