Skip to content

Instantly share code, notes, and snippets.

@davidjb
Last active November 25, 2015 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidjb/04067a9cb47ac3dfd701 to your computer and use it in GitHub Desktop.
Save davidjb/04067a9cb47ac3dfd701 to your computer and use it in GitHub Desktop.
Short JS snippet for changing all descriptions on a Flickr mass edit page.
function changeDescriptions(text) {
var elements = document.getElementsByClassName('together_description');
for (var j = 0; j < 2; j++) {
// Do this twice because Flickr needs it (probably 2 x keyup events)
for (var i = 0; i < elements.length; i++) {
var event = new Event('keyup');
elements[i].dispatchEvent(event);
elements[i].value = text;
}
}
var next_button = document.evaluate('//input[@value="SAVE AND GO TO NEXT PAGE"]', document).iterateNext();
if (next_button) {
next_button.click()
} else {
document.evaluate('//input[@value="SAVE AND BE DONE"]', document).iterateNext().click();
}
}
var text = 'Photography by Suzie from <a href="http://countrypix.com.au" rel="nofollow">Country Pix Photography</a>.';
changeDescriptions(text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment