フォーラムをより効率的に読むのに役立つ、Greasemonkey のスクリプトを作成するのに助けが必要です。
で終わるすべてのページをリダイレクト.html
:
http://www.site.com/thread-category/4525-url.html
この印刷可能なバージョンの URL へ:
http://www.site.com/thread-category/4525-url-print.html
-print
( を末尾の直前に
追加し.html
ます。
フォーラムをより効率的に読むのに役立つ、Greasemonkey のスクリプトを作成するのに助けが必要です。
で終わるすべてのページをリダイレクト.html
:
http://www.site.com/thread-category/4525-url.html
この印刷可能なバージョンの URL へ:
http://www.site.com/thread-category/4525-url-print.html
-print
( を末尾の直前に
追加し.html
ます。
可能な URL パラメーターとハッシュ タグのこのアカウンティングを行うには、次のようにします。
// ==UserScript==
// @name _Redirect site.com to print.html URL's
// @include /site\.com\/thread.+?\.html\b/
// @grant none
// @run-at document-start
// ==/UserScript==
if ( ! /print\.html$/i.test (location.pathname) ) {
var printPath = location.pathname.replace (/(\.html)$/, "-print$1");
var newURL = location.protocol + "//"
+ location.host
+ printPath
+ location.search
+ location.hash
;
location.replace (newURL);
}
の正規表現バージョンを使用していることに注意してください@include
。