@Yan-Han-Chu 其實cad不會吃很多效能
<未討論>一二站轉換網頁書籤
-
大家換站是怎樣換呢?之前都是自己在網址欄的www後面加2,感覺不方便
另一個方法:
1.新增書籤,網址填:
javascript:(function()%7Blet%20str%3Dwindow.location.href%3Bif%20(str.indexOf(%22voofd.%22)!%3D-1)%7Blet%20res%3Bif%20(str.indexOf(%22www.%22)!%3D-1)%7Blet%20n%3Dstr.indexOf(%22www.%22)%3Bres%3Dstr.substring(0%2Cn%2B3)%2B%222%22%2Bstr.substring(n%2B3%2Cstr.length-1)%3B%7Delse%7Blet%20n%3Dstr.indexOf(%22www2.%22)%3Bres%3Dstr.substring(0%2Cn%2B3)%2Bstr.substring(n%2B4%2Cstr.length-1)%3B%7Dwindow.location.href%20%3Dres%3B%7D%7D)()
2.然後再在書籤列點一下書籤,就會一站換成二站 or 二站換成一站
原始碼(記錄用):
let str=window.location.href; if (str.indexOf("voofd.")!=-1){ let res; if (str.indexOf("www.")!=-1){ let n=str.indexOf("www."); res=str.substring(0,n+3)+"2"+str.substring(n+3,str.length-1); }else{ let n=str.indexOf("www2."); res=str.substring(0,n+3)+str.substring(n+4,str.length-1); } window.location.href =res; }
但是比較方便的辦法還是在網站上有個按鈕拉
-
好羨慕會寫code的人…
只是切換後好像還是要重新登入就是了T.T -
不用這麼麻煩啊 直接設書籤 然後把其他v站記錄清掉 搜尋的時候就會優先跳出書籤的了
-
@biling-dog 應該是你二站沒登入過吧?有登入過應該就不用在重新登入
-
@這裡水很深 設書籤?但是你瀏覽的文章網址不是固定的耶
-
@didi 我發現我寫錯了,是str.length不是str.length-1
修改:
javascript:(function()%7Blet%20str%3Dwindow.location.href%3Bif%20(str.indexOf(%22voofd.%22)!%3D-1)%7Blet%20res%3Bif%20(str.indexOf(%22www.%22)!%3D-1)%7Blet%20n%3Dstr.indexOf(%22www.%22)%3Bres%3Dstr.substring(0%2Cn%2B3)%2B%222%22%2Bstr.substring(n%2B3%2Cstr.length)%3B%7Delse%7Blet%20n%3Dstr.indexOf(%22www2.%22)%3Bres%3Dstr.substring(0%2Cn%2B3)%2Bstr.substring(n%2B4%2Cstr.length)%3B%7Dwindow.location.href%20%3Dres%3B%7D%7D)()
補個書籤製作網站:
https://mrcoles.com/bookmarklet/ -
-
-
想問問你願不願意重新做一個更完整的教學,之後可頂置軟件台