Dropbox Direct Downloader

Convert Dropbox file sharing links to direct download links.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
sharmanhall
今日安裝
2
安裝總數
303
評價
0 0 0
版本
1.0
建立日期
2023-04-30
更新日期
2023-04-30
尺寸
1.0 KB
授權條款
MIT
腳本執行於

Dropbox Direct Downloader

This script is a userscript that modifies Dropbox file sharing links to directly download the shared file instead of opening the file preview page. Userscripts are small pieces of JavaScript code that run in the context of a web page and can modify the behavior or appearance of that page. Userscripts are typically installed and managed using browser extensions such as Greasemonkey or Tampermonkey.

Here's a breakdown of what this userscript does:

  • The script metadata at the top of the file specifies the script's name, author, version, description, and other information. Notably, the @match directive specifies that the script should only run on Dropbox URLs that match the pattern https://www.dropbox.com/s/*/*.*?dl=0. This pattern corresponds to Dropbox file sharing links with the dl=0 query parameter, which opens the file preview page.

  • The script specifies that it should run when the user selects the "Run script" option from the context menu (right-click menu) using the @run-at context-menu directive.

  • The script retrieves the current URL of the page using window.location.href.

  • It then performs a series of string replacements on the URL:

    • It replaces "www" with "dl" to change the subdomain.
    • It replaces "dropbox" with "dropboxusercontent" to change the domain.
    • It removes the last five characters from the URL, which corresponds to the "?dl=0" query parameter.
  • The script then uses window.location.assign(final) to navigate to the modified URL, which directly downloads the shared file.

Overall, this userscript provides a convenient way for users to directly download files from Dropbox sharing links by modifying the URL to bypass the file preview page. Note that the script is designed to run when the user selects the "Run script" option from the context menu, so it won't automatically run when the page loads.