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

在台灣受限於要保護青少年的法令,所以上 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的電話綁定

生活小事

已經綁定手機門號的 LINE 帳號,會變成只能下載與門號相同國家的貼圖。想要跨區下載貼圖,就要解除門號的綁定,分享透過該門號的註冊新帳號來解除LINE的電話綁定的詳細步驟 […]

Read More

上傳到Youtube的影片因太長被刪除

生活小事

花了好幾個小時弄了一段影片,傳上YouTube 後,被刪了,Q_Q; 因為有看到「上傳成功」,所以就把硬碟裡的原始檔刪了。所以,下次上傳後,最好要先保留一份在備份專用的硬 […]

Read More

關鍵少數 Hidden Figures (2016)

生活小事

似乎是一部很勵志的傳記電影。 imdb: http://www.imdb.com/title/tt4846340 開眼電影:http://www.atmovies.com […]

Read More

發佈留言

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