解決 「新同文堂」網頁繁、簡中文轉換按鈕 無法使用的問題

重灌狂人 Blog 介紹 免裝軟體,「新同文堂」網頁繁、簡中文轉換按鈕!(書籤小工具) 內的 Javascript 放置在 OpenFoundry 新同文堂 專案的檔案空間 (備份網頁)。因為  OpenFoundry 已經沒有在維運,連帶導致專案檔案無法使用。只要把 Javascript 改成其他空間網址,就可以解決問題。



問題狀況:

[簡轉繁] 書籤小工具使用的 javascript 檔案位置,已經無法使用

javascript:(function(){var s=document.getElementById("tongwenlet_tw");if(s!=null){document.body.removeChild(s);}var s=document.createElement("script");s.language="javascript";s.type="text/javascript";s.src="http://tongwen.openfoundry.org/NewTongWen/tools/bookmarklet_tw.js";s.id="tongwenlet_tw";document.body.appendChild(s); })();

解決方式:

方法1:
改用瀏覽器的擴充套件: 新同文堂 - Chrome 線上應用程式商店新同文堂 – 下載 🦊 Firefox 擴充套件(zh-TW)

方法2:
1. 感謝熱心網友備份: 同文堂 Bookmarklet 工具 - 備份  (1) 簡→繁 和 (2) 繁→簡 兩個檔案
(1) 簡→繁:
https://github.com/skofkyo/userChromeJS/raw/master/UserScriptLoader/bookmarklet_tw.js
(2) 繁→簡:
https://github.com/skofkyo/userChromeJS/raw/master/UserScriptLoader/bookmarklet_cn.js

2. 書籤小工具內的語法,直接替換成上方網址 Google chrome 瀏覽器會遇到「MIME type不符合」錯誤訊息
Refused to execute script from 'https://github.com/skofkyo/userChromeJS/raw/master/UserScriptLoader/bookmarklet_tw.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

或是 Firefox 瀏覽器錯誤訊息:
MIME 類型不符合,所以來自「https://raw.githubusercontent.com/skofkyo/userChromeJS/master/UserScriptLoader/bookmarklet_tw.js」的資源被封鎖(X-Content-Type-Options: nosniff)。

3. 參考 The Will Will Web | 如何從 GitHub, Gist, JSBin, CODEPEN 載入 JavaScript 檔案 教學,解決 MIME type不符合 錯誤訊息。網址改成
(1) 簡→繁:
https://rawgit.com/skofkyo/userChromeJS/master/UserScriptLoader/bookmarklet_tw.js
(2) 繁→簡:
https://rawgit.com/skofkyo/userChromeJS/master/UserScriptLoader/bookmarklet_cn.js

4. 如果要直接替換書籤小工具內的語法,請將 javascript: ... ; 替換原本書籤的網址欄位。


[更新 2017/7/6] 另外提供網頁版本,可將書籤連結直接拖曳到瀏覽器的書籤工具列
(1) 簡體中文轉成繁體字: [簡→繁]

javascript:(function(){var s=document.getElementById("tongwenlet_tw");if(s!=null){document.body.removeChild(s);}var s=document.createElement("script");s.language="javascript";s.type="text/javascript";s.src="https://rawgit.com/skofkyo/userChromeJS/master/UserScriptLoader/bookmarklet_tw.js";s.id="tongwenlet_tw";document.body.appendChild(s); })();

(2) 繁體中文轉成簡體字: [繁→簡]

javascript:(function(){var s=document.getElementById("tongwenlet_cn");if(s!=null){document.body.removeChild(s);}var s=document.createElement("script");s.language="javascript";s.type="text/javascript";s.src="https://rawgit.com/skofkyo/userChromeJS/master/UserScriptLoader/bookmarklet_cn.js";s.id="tongwenlet_cn";document.body.appendChild(s);})();


相關資料

留言

  1. 解決了我無法轉換的困擾謝謝你!!!

    回覆刪除
    回覆
    1. 後來發現有瀏覽器擴充套件,也可以試試:
      新同文堂 - Chrome 線上應用程式商店 https://chrome.google.com/webstore/detail/new-tong-wen-tang/ldmgbgaoglmaiblpnphffibpbfchjaeg

      刪除
  2. 官方github就是不修復這問題,還要使用者自己找解決方法,
    一般使用者誰會為了這個東西去搞java script, 爛得要死

    回覆刪除

張貼留言