網頁的網址自動重導,幫你省時間

在台灣受限於要保護青少年的法令,所以上 ptt 很麻煩會彈出確認網頁:

您即將進入之看板內容需滿十八歲方可瀏覽

需要多點一個確定,要如何省下點確定的時間?

請在瀏覽器裡安裝 Redirector 的擴充元件:
https://chrome.google.com/webstore/detail/redirector/ocgpenflpmgnfapjedencafcfakcekcd

使用方法:

在 chrome 瀏覽器點 Redirector extension 的 Options 進行設定, 彈出畫面後, 按 “Create new redirect”(建立新的重導)

輸入我幫你準備好的規則後, 按 “Save”(存檔) 就結束了, 以後不用在 ptt 上按確定:

Redirector 官方的教學網頁

Web browser extension (Firefox, Vivaldi, Chrome, Opera, Edge) to redirect URLs based on regex or wildcard patterns.

https://github.com/einaregilsson/Redirector

使用範例:

De-mobilizer

  • Example URL: https://en.m.wikipedia.org/
  • Include pattern: ^(https?://)([a-z0-9-]*\.)m(?:obile)?\.(.*)
  • Redirect to: $1$2$3
  • Pattern type: Regular Expression
  • Description: Always show the desktop site of a webpage

AMP redirect

  • Example URL: https://www.google.com/amp/www.example.com/amp/document
  • Include pattern: ^(?:https?://)www.(?:google|bing).com/amp/(?:s/)?(.*)
  • Redirect to: https://$1
  • Pattern type: Regular Expression
  • Description: AMP is bad: https://80×24.net/post/the-problem-with-amp/

Doubleclick escaper

  • Example URL: https://ad.doubleclick.net/ddm/trackclk/N135005.2681608PRIVATENETWORK/B20244?https://www.example.com
  • Include pattern: ^(?:https?://)ad.doubleclick.net/.*\?(http?s://.*)
  • Redirect to: $1
  • Pattern type: Regular Expression
  • Description: Remove doubleclick link tracking / fix problems with doubleclick host based blocking

YouTube Shorts to YouTube

  • Example URL: https://www.youtube.com/shorts/video-id
  • Include pattern: ^(?:https?://)(?:www.)?youtube.com/shorts/([a-zA-Z0-9_-]+)(.*)
  • Redirect to: https://www.youtube.com/watch?v=$1$2
  • Pattern type: Regular Expression
  • Description: Redirect YouTube Shorts to regular YouTube

Fun with !bangs

What are bangs?: https://duckduckgo.com/bangs

Use DuckDuckGo.com !bangs on Google

  • Example URL: https://www.google.com/search?&ei=-FvkXcOVMo6RRwW5p5DgBg&q=asdfasdf%21+sadfas&oq=%21asdfasdf+sadfas&gs_l=asdfsadfafsgaf
  • Include pattern: ^(?:https?://)(?:www.)google\.(?:com|au|de|co\.uk)/search\?(?:.*)?(?:oq|q)=([^\&]*\+)?((?:%21|!)[^\&]*)
  • Redirect to: https://duckduckgo.com/?q=$1$2
  • Pattern type: Regular Expression
  • Description: Redirect any Google query with a !bang to DDG

Custom DuckDuckGo.com !bangs

DDG !example Base

  • Example URL: https://duckduckgo.com/?q=!example&get=other
  • Include pattern: ^(?:https?://)(?:.*\.)?duckduckgo.com/\?q=(?:%21|!)example(?=[^\+]|$)(?=\W|$)
  • Redirect to: https://example.com/
  • Pattern type: Regular Expression
  • Description: Redirect to the base site when !bang is the only search parameter

DDG !example Search

  • Example URL: https://duckduckgo.com/?q=searchterm+!example+searchterm2&get=other
  • Include pattern: ^(?:https?://)(?:.*\.)?duckduckgo.com/\?q=(.*\+)?(?:(?:%21|!)example)(?:\+([^\&\?\#]*))?(?:\W|$)
  • Redirect to: https://example.com/?query=$1$2
  • Pattern type: Regular Expression
  • Description: Redirect to custom site search

DDG !ghh git-history

  • Example URL: https://duckduckgo.com/?q=!ghh+https%3A%2F%2Fgithub.com%2Fbabel%2Fbabel%2Fblob%2Fmaster%2Fpackages%2Fbabel-core%2FREADME.md&adfasfasd
  • Include pattern: ^(?:https?://)duckduckgo.com/\?q=(?:(?:%21|!)ghh\+)(?:.*)(github|gitlab|bitbucket)(?:\.org|\.com)(.*?(?=\&))
  • Redirect to: https://$1.githistory.xyz$2
  • Pattern type: Regular Expression
  • Description: Create new !ghh bang that redirects to https://githistory.xyz
  • Advanced:
    • Process matches: URL decode

使用 Redirector 重導網頁的解法, 遇到chrome 瀏覽器重開之後的第一次進入 ptt 還是需要手動按一次 “已滿18歲”, 所以我移掉 Redirector 網頁擴充元件了.

另一個作法是直接在網頁中執行 javascript, 你需要在 chrome 瀏覽器安裝下面的網頁擴充元件:

Custom JavaScript for Websites 2
https://chrome.google.com/webstore/detail/custom-javascript-for-web/ddbjnfjiigjmcpcpkmhogomapikjbjdk

使用網頁擴充元件的好處是在手機與平板的瀏覽器上也可以使用.

執行方法

1:先連到 ptt 的網站,

2:執行 CJS extension,

3:輸入下面的 javascript 腳本:

const el_btn = document.querySelector("button[type='submit'][value='yes']");
if(el_btn) { el_btn.click();}

4:按 Save (存檔).


Q: ptt 的這個自動化功能,可以使用 adblock plus 來處理嗎?
A: Max有挑戰過,但失敗,試不出來,因為 adblock 無法像 CJS 一樣 inject javascript, 相對 adblock plus 安全性會較高,同時也失去部份的功能性。

Facebook網友回應

您可能也會感興趣的文章...

LINE 免費貼圖 2023-10-24

生活小事

這周滿多可愛貼圖,馬克滿可愛的, 馬可先生畫的滿好吃的樣子. 這周滿多可愛貼圖,鴨力山大與馬克都很可愛的, 馬可先生畫的滿好吃的樣子. 日本的話小狗冒出愛心的貼圖有2組超 […]

Read More

LINE 免費貼圖 2022-05-31

生活小事

  這周的日本貼圖,滿可愛的。 星期五(2022-06-03)就是端午節了,預祝大家佳節愉快。 * 目前LINE App暫時無法解除電話的綁定。 * 加完好友下載完貼圖, […]

Read More

LINE 免費貼圖 2019-04-30

生活小事

這周貼圖大爆發,首推日本和台灣地區的貼圖。日本的有小丸子、蠟筆小新和秀逗魔導士,可是這幾組都要解任務。LINE的業務好廣泛,除了購物、電視、手機電信還有售票和旅遊。 令和 […]

Read More

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *