Coder Social home page Coder Social logo

save_tabbed_images's Introduction

save tabbed images icon

Save Tabbed Images

A simple and easy-to-use chrome extension to download all images opened as tabs in one click.

Get the extension at the Chrome web store.

demo gif

Development

Install node modules:

yarn install

Compile and watch for javascript changes:

yarn run watch

Check for linting errors:

yarn run lint

Packaging for Chrome web store release

  • Update version in dist/manifest.json
  • Summarize the changes made from the last release (list pull requests) in CHANGELOG.md
  • Create git tag with git tag x.x.x and push it with git push origin --tags
  • Build a production version of webpack bundle with yarn run package
  • Create a .zip file of the dist folder named save_tabbed_images_<version>.zip
  • Create a new release in github and attach the .zip file. In the description, add the summary from CHANGELOG.md.
  • Upload the .zip file to the chrome web store

License

Save Tabbed Images is MIT licensed.

save_tabbed_images's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

save_tabbed_images's Issues

Modified extension for saving images in chronological order

I have modified this extension to save images opened in tabs and rename them to full date/time down to milliseconds, so that sorting by filename would order them from oldest opened in browser to newest opened (in case your browser is set to open new tabs always directly to the right from current tab). I have attached the resulting extension to this post.

HOW TO INSTALL:
Download and unpack "hhcoikfhkkadkgklepjkfgafmjoggefh.zip" to folder, then load that folder in chrome://extensions/ page in developer mode in Chrome Dev, Chrome Canary, Cent browser or Slimjet (official release version of Chrome will be nagging you to disable customized unsigned extension).

FURTHER DETAILS:
I'm not a web developer, I don't know JS, HTML or Node.js and this was among my first attempts at modifying code of extension and among my first attempts on modifying JS code. However, I know how to program in C, so that helped. Therefore, the quality of code is pretty shitty, and I couldn't even figure out how to compile a package in Node.js from source code, so I had to torture myself and edit code directly in minified code of unpacked extension. That is why I didn't submit a code commit.

WHAT THIS THING DOES DIFFERENTLY COMPARED TO VANILLA EXTENSION:

  1. It always saves images in subfolder of Downloads folder, instead of saving directly in Downloads folder. This subfolder is named "Saved tabbed images". It is automatically created if it doesn’t exist.
  2. It saves images from tabs in the order tabs are ordered on tab bar, beginning from the rightmost tab with image, and ending on the leftmost tab with image. (Vanilla extension saves images asynchronously, so if you order them by date created (or modified) (even with millisecond precision), they will be sorted in random order.)
  3. Every saved image is renamed to full date/time ("24h" format) with millisecond precision, for example: "2018.12.21 18.58.21.145.png". Original filename as on website is truncated completely, only extension of filename is left, and converted to lowercase. As a result, sorting by filename will order images in the order you initially opened them in browser. That time in filename is the instant an image was added into chromium downloads stack (not the instant it was downloaded).
  4. There is no need to click "Close downloaded tabs" button, it gets clicked automatically 0,5 seconds after starting the process of going through tabs and adding images into chromium downloads stack. So, overall, just two clicks - one to open extension panel, another to hit "Download" button. In certain rare situations, this time (500 ms) might be insufficient to save all images, read further if there's a problem with that.

IF YOUR BROWSER IS NOT SET TO OPEN TABS DIRECTLY TO THE RIGHT FROM CURRENT TAB:
In file "*/js/index.js" delete or comment line
t.reverse(),
Delete only the occurrence of this text that is on a separate line, leave another occurrence untouched. That will make extension to cycle through tabs with images from left to right.

IF 500 ms DELAY UNTIL AUTOCLICKING "Close downloaded tabs" BUTTON LEAVES SOME TABS WITH IMAGES UNSAVED:
Generally, 500 ms delay should be enough to save more than even a hundred tabs with images, but from my observation, it may sometimes be insufficient with one of these factors:

  1. Using VPN
  2. Torrent is being downloaded
  3. More than 50 images are being saved

So, if that problem appears, change "500" in line
setTimeout(function(){e.onClickCloseDownloadedTabs()},500)
to something larger, like 800 or 1200, or even more. This delay is, unfortunately, a compromise between amount of images saved at once and quickness of the process of saving.

WHAT SIMILAR TOOL EXISTED BEFORE THIS:
In preQuantum Firefox there was an add-on "Bazzacuda Image Saver Plus". Because all old add-ons were deleted from AMO, I've attached modified version of this add-on to this post as well, in case anyone wants it.
If you, for example, download Firefox version 42 (or any up to version 56, but it is more difficult to install unsigned add-ons in later versions) and install Bazzacuda from this file, in its options:

  1. Check flags "Rename duplicate images" and "Rename images even if their names don’t duplicate"
  2. By clicking "Set" button, paste this new "Rename pattern":
    &YYYY;.&MM;.&DD;-&hh;.&mm;.&ss;,&ms; &filename;&[;(&dupnum;)&];
    After that, just a single click on Bazzacuda add-on button does pretty much the same thing as this modification (also going through tabs from rightmost to leftmost - this is what I've modified, and this is why the attached Bazzacuda add-on is unsigned by Mozilla).

WHY THIS IS THE BEST THINKABLE WAY TO SAVE IMAGES OFF THE INTERNET:
You control which images will get saved from a page by middle-clicking them.
You can preview images in full size in browser before they will be saved.
You fully control the order, in which images are shown in image viewers and file explorers after saving them, by opening them in browser in order you want them saved, and if needed, by rearranging opened tabs in required order.

SOME NOTABLE TECHNICAL DETAILS OF IMPLEMENTATION, AND HOW THIS CAN BE MADE BETTER:
This is probably not interesting to anybody, I'm writing this in case anybody wants to implement these modifications better than I am capable of, and, of course, by using original source code instead of minified code which I used.

The only file I modified is "*/js/index.js". Others are untouched.

In original extension, onDeterminingFilename event handler ( https://developer.chrome.com/extensions/downloads#event-onDeterminingFilename ) is when naming of file (path) happens. It is an unsuitable place for renaming if we want files to be chronologically named, because there is no way to insert 1 ms pause between renaming events (it's asynchronously called) and because the order it is called in is usually not the order the file was put in downloads stack. The suitable place is downloads.download() method ( https://developer.chrome.com/extensions/downloads#method-download ). I used renaming in downloads.download() method in my modification, works perfectly.

To ensure that all filenames are unique, I inserted a 1 ms pause after each instant the image gets put into downloads stack, so that filenames are at least 1 millisecond apart.

I've tried to make this extension to close saved tabs and its panel after all images are put into downloads stack, instead of after predefined amount of time (500 ms), but these attempts were not successful (because I don't know anything about how all this stuff works:) ).
I also wanted not to open the extension panel at all, I wanted just a single click on the extension's button to save images (like Bazzacuda did), but, again, I have no idea how to do this.

Nevertheless, even as is, this modification works great, it has proven to be very useful to me in batch saving images from Tumblr, which has just died:)

hhcoikfhkkadkgklepjkfgafmjoggefh.zip
bazzacuda_image_saver_plus-0.65-fx.zip

Add option to isolate images into tabs in the first place

i use the following to automatically open a thumbnail clicked in Google Image Search directly in a new tab at full size:

...and I was curious if the same functionality could be added to your extension, so one wouldn't require both? That extension only works with Google Images, but it would amazing if you could give users the option to whitelist other domains/criteria in which images should be opened directly in their own tabs.

Be able to reproduce and handle download failures

  • Add a way to systematically trigger download failures
    • happens for gmail images? reports "done" instead of failure, server not found?
  • Handle failures - add "retry failed images" button
  • Write a JS test for it

Help expanding potential applications for this extension

Great work! I'm particularly fond of any extension that can automate menial tasks in general, but sorting and closing tabs after they are no longer needed has helped me enormously. I'm not even a developer. but by inspecting your code, I've managed to tweak a few forks of this repo to expand the number and types of files to save. I will upload and credit you when finished.

I would like to apply the same conditional logic that sorts tabs by their filetype to a new extension that sorts all tabs containing another variable, such as the domain. My goal is to grab all tabbed Wikipedia articles by the pattern .wikipedia.org/wiki/ and then programatically export them using Wikipedia's own Save As PDF feature.

Automating the first part of this process is simple enough: simply insert the article name (underscored if more than one word) into a url structured like so:

https://en.wikipedia.org/w/index.php?title=Special:ElectronPdf&page=Github&action=show-download-screen

In this example I am using the Github article at https://en.wikipedia.org/wiki/Github

However that's only part of a solution, I still need a way to programatically click the button to save the Github.pdf article, and plug that functionality into an extension that behaves like Save_Tabbed_Images and can export pdfs for all tabbed Wiki articles as simply as saving tabbed images...that is, with the click of a button.

I may not be a developer, but I am happy to put in the work myself: I would just appreciate some help getting started and your extension seemed like the best starting point out of the open source repos I've found.

Thanks in advance.

Webm support

Thanks a lot for this amazing extension)
I was wondering if you're going to add webm support? I can make a pull request with this feature.
Too lazy to download this repo and get to know how React works(

Download location bug

When trying to download images in "Subfolder within default location" if you close the extension window quickly by pressing "Close all downloaded tabs" button some of the file will be downloaded in default location instead of selected subfolder.
Happens often when downloading 25+ tabs and low on RAM (so downloads are initiated with delay).

Chromium-specific bugs

Using this extension in several versions of Chromium built with flags set to higher security and privacy settings fails after downloading the first image. I have also had this problem in official Chrome builds if my personal settings are configured similarly.

Should not close tabs for which download fails

gmail image attachments (with domain gm1.ggpht.com) seem to fail with a download error "forbidden", but after the extension attempts to download, it marks it as "done" and closes the tab.

Improve build process

  • Write script to generate correct .zip file name
  • Remove dist/js/*.map files from zip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.