Last active
November 25, 2015 07:46
-
-
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.
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
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