Last active
October 26, 2019 09:52
-
-
Save deymosD/8ae60c75dd57b51667a4f696a3d083b2 to your computer and use it in GitHub Desktop.
Prints keywords in text format, so they can be copied
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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(", "); | |
} |
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(", ");
}
Does not work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
28: jQuery is not defined !
48: console is not defined !
?!