create href to local file path specified by lfp scheme

after register hanlder for lfp, we need to construct the scheme url corresponding to local file path, the path consist on 2 key part, formated date in YYYY-MM-DD and bgm japanese name(jpn), this the user script the construct the path based existing info on the page

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

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

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

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

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

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

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

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

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

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

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

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

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

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

作者
oscardoudou
今日安裝
0
安裝總數
0
評價
0 0 0
版本
0.1
建立日期
2025-06-24
更新日期
2025-06-24
尺寸
3.5 KB
授權條款
未知
腳本執行於

This only works for mac. create href to local file. so you can redirect to a file by click a link in browser. This is only the browser side of the work, you will need a url scheme defined to handle the href to local file path conversion as well as file opening.

My solution:

  1. create a url scheme, eg. call it lfp(://). SwiftDefaultsApp can do this.
  2. delegate an applescript/app to handle the url scheme, you might need to grant this app automation/terminal access in settings/privacy.
  3. create a python script that open file based on href input , which would be invoked in applescript as shell script

your chrome might need to start with an extra parameter for this process to work: -user-data-dir="/Users/$(whoami)/Library/Application Support/Google/Chrome" --enable-logging --v=2 --disable-features=StandardCompliantNonSpecialSchemeURLParsing