Skip to content

Instantly share code, notes, and snippets.

@deymosD
Last active October 26, 2019 09:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save deymosD/8ae60c75dd57b51667a4f696a3d083b2 to your computer and use it in GitHub Desktop.
Save deymosD/8ae60c75dd57b51667a4f696a3d083b2 to your computer and use it in GitHub Desktop.
Prints keywords in text format, so they can be copied
// ==UserScript==
// @name Shutterstock.FixKeywords
// @namespace
// @version 1.0.4
// @updateURL https://gist.github.com/deymosD/8ae60c75dd57b51667a4f696a3d083b2
// @description Allows copying keywords
// @author GG
// @match https://www.shutterstock.com/image-photo*
// @match https://www.shutterstock.com/image-vector*
// @match https://www.shutterstock.com/image-illustration*
// @require https://code.jquery.com/jquery-latest.min.js
// @require https://code.jquery.com/ui/1.11.4/jquery-ui.min.js
// @grant none
// ==/UserScript==
// NEW:
// v1.0
// TBD:
// load tabs immediatelly
// show everything on one page, as it should be
'use strict';
var $j = jQuery.noConflict();
// =========== PARAMETERS ===========
var enableDatePicker = true; // if you don't need date picker, set this to false
var enableTableSorter = true; // SS sorts on stupid things, this enables sort by ID (puts newest on top)
var addRows = true; // load all rows to earnings table
var timeout = 2000; // wait so many ms before applying tablesorter - gotta do it, because of the async calls
// ==/UserScript==
// i use smoothness theme for the datepicker and here we load external CSS
$j(document).ready(function() {
var kw = CopyKeywords();
console.log(kw);
$j("div.product-page-keywords").parent().append("<div id=\"kwords\" style=\"width: 100%; background-color: #ececec; margin: 60px 0 10px 0; padding: 3px; text-align: left;\"></div>");
$j("div#kwords").text(kw);
});
function CopyKeywords() {
var keywords = [];
$j("div.product-page-keywords > div.col-xs-12.text-left a").each(
function() {
keywords.push($j(this).text());
}
);
return keywords.join(", ");
}
@straannick
Copy link

28: jQuery is not defined !
48: console is not defined !
?!

@UltimaGaina
Copy link

UltimaGaina commented Sep 5, 2019

SS modified the structure of their page. A couple lines must be changed to keep this script working.
Here is my solution with the two changes highlighted:

$j(document).ready(function() {
var kw = CopyKeywords();
console.log(kw);
$j(".m_f_q").append("<div id="kwords" style="width: 100%; background-color: #ececec; margin: 60px 0 10px 0; padding: 3px; text-align: left;">");
$j("div#kwords").text(kw);
});

function CopyKeywords() {
var keywords = [];
$j(".m_f_q .o_button_theme_button:gt(0)").each(
function() {
keywords.push($j(this).text());
}
);
return keywords.join(", ");
}

@perdolka
Copy link

Does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment