• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

mcdamo/tab-image-saver: Firefox addon to save images from open tabs

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

mcdamo/tab-image-saver

开源软件地址:

https://github.com/mcdamo/tab-image-saver

开源编程语言:

JavaScript 96.5%

开源软件介绍:

tab-image-saver Addon Version Build Status

Tab Image Saver is a Firefox addon that makes it easy to save images from browser tabs you have open.

Download from Firefox Addons.

Features

By default this addon saves the largest image found on the active tab.

You may control how this functions by changing the addon preferences at in Firefox > Add-ons > Extensions > Tab Image Saver > Preferences or right-click the toolbar icon.

  • Multitasking Support - run addon concurrently in separate windows
  • Keyboard shortcut options
  • Select from active tab, tabs to the left/right of current tab, or all tabs.
  • Cancel running operations
  • Set minimum image size in pixels
  • Option to only save tabs with images, ignoring tabs with webpages
  • Filenames renamed automatically
  • Display badge on icon with runtime information and count of downloads
  • Close tabs after saving
  • Hide saved images from download history
  • Show notification when complete

Path rules

Path rules are a flexible method for setting the image filenames when downloading.

The Path rules syntax is based off template strings, this will be familiar to anyone who has coded Javascript.

Path rules are processed top-down: if the first rule does not evaluate to a valid path then it will proceed to the next rule in the list and so on.

Variables

The following variables are available for use in Path rules

Variable Description Example*
alt image's alt content Caption
name image's url filename without extension filename
xName image's filename from Content-Disposition header filename
ext image's url extension jpg
xExt image's extension from Content-Disposition header jpg
xMimeExt image's extension from Content-Type header jpg
host image's url hostname example.com
path image's url path path/to
index image number starting at '1', incremented for each image 1
tabTitle tab's page title (JPEG Image, 500 x 500 pixels)
tabHost tab's url hostname example.com
tabPath tab's url path path/to
tabFile tab's url filename without extension filename
tabExt tab's url extension jpg

*Example source:

<img src="http://example.com/path/to/filename.jpg" alt="Caption">

Boolean logic

Empty variables can be skipped with boolean logic using double-pipe: ||

Example
${name}.${ext||xExt||xMimeExt||'jpg'}

This will attempt to find the filename extension from the URL, Content-Disposition header, Content-Type header, and finally if all else fails will use jpg

Methods

String methods can be chained to variables or strings in the Path rule.

Zero padding

The padStart method can be used to string pad the index variable.

Example
img_${index.padStart(4, 0)}.jpg

This will use the index of the image in the active download session. The index is incremented for each image saved and processed in tab order. The output will be zero padded, such as img_0001.jpg

String replacement and regular expressions

The replace method can use regular expresions on variables.

Example

Using replace(), if alt variable contains a pipe symbol | then it and any trailing characters are removed:

${alt.replace(/\s*\|.*/, '')}

Rulesets

Rulesets can apply rules and options to a specific domain or url of the tab page.

Rulesets are tested in order from top to bottom. Any pages that are unmatched by a Ruleset will default to the Global settings.

The standard form of domain rule allows for simple wildcard matching (*).

Domain rules can also be interpreted as a regular expression by wrapping in hash characters (#).

Matching domains

The following examples are for https://example.com/page.html

Domain rule Match
example.com/ Yes
example.co Yes
example.co/ No
ample.com/ Yes
e*e.com/ Yes
/page.html Yes
#//example.[^/]{3}/# Yes

FAQ

Filenames are _name_._ext_

Path rules are not in the latest format. Follow the update instructions

Cache is not used

Since Firefox 85.0 the network partitioning means that the addon cannot access the browser cache and images are re-fetched from the network for every download.

This security feature can be disabled to improve download performance by editing Firefox config:

about:config -> privacy.partition.network_state -> false

Images fail to download

If images load in the browser but fail to download this is often caused by Tracking Protection.

In Firefox settings try reducing the protection level from Strict or adding a site exception.

Acknowledgements

Libraries:

Graphics:




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap