Skip to content

Instantly share code, notes, and snippets.

@jnv
Created October 12, 2013 13:00
Show Gist options
  • Save jnv/6949790 to your computer and use it in GitHub Desktop.
Save jnv/6949790 to your computer and use it in GitHub Desktop.
Get numerical filenames of pictures in Dropbox gallery (thumbnails view)
var thumbs = document.querySelectorAll("#gallery-view-media a[onclick^=Lightbox]");
var ids = [];
for (var i = 0; i < thumbs.length; ++i)
{
var item = thumbs[i];
var fname = item.href.split('/').pop();
var id = fname.match(/^\d+/)[0];
ids.push(id);
}
console.log(ids);
var txt = document.createElement('textarea');
document.body.insertBefore(txt, document.body.childNodes[0]);
txt.value = ids.join("\n");
txt.setAttribute("style","position: absolute; top:0; z-index: 999; height: 10em;");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment