Skip to content

Commit c9708c0

Browse files
committed
fix
1 parent e90eadc commit c9708c0

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Highlight Every Code/Highlight Every Code.user.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
// @name:zh-CN 代码片段高亮
44
// @name:zh-TW 程式碼片斷高亮
55
// @namespace hoothin
6-
// @version 1.1
6+
// @version 1.2
77
// @description Add a icon to popup a window that allows syntax highlighting and beautify and word count of source code snippets on current page
88
// @description:zh-CN 选择代码片段后点击图标弹出新窗口显示语法高亮美化与格式化后的代码与字数统计
99
// @description:zh-TW 選擇程式碼片段後點選圖示彈出新視窗顯示語法高亮美化與格式化後的程式碼與字數統計
1010
// @author Hoothin
1111
// @grant GM_openInTab
1212
// @compatible chrome
1313
// @compatible firefox
14+
// @license MIT License
1415
// @contributionURL https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=rixixi@sina.com&item_name=Greasy+Fork+donation
1516
// @contributionAmount 1
1617
// @include *
@@ -30,9 +31,9 @@
3031
'<script>var code,codeStr;window.onload=function(){code=document.querySelector("#code");codeStr=code.innerHTML.replace(/&amp;/g, "&").replace(/&(nbsp;|amp;|#39;|quot;)/g, "&amp;$1");prettyPrint();'+
3132
'document.querySelector("body>a:nth-child(1)").onclick=function(){'+
3233
'code.innerHTML=js_beautify('+
33-
'codeStr.replace(/&gt;/g, \'>\').replace(/&lt;/g, \'<\').replace(/\'[^\']*?\'/g, function(word){'+
34+
'codeStr.replace(/&gt;/g, \'>\').replace(/&lt;/g, \'<\').replace(/\'(\\\\\'|[^\'])*?\'/g, function(word){'+
3435
'return word.replace(/>/g, \'&gt;\').replace(/</g, \'&lt;\');}'+
35-
').replace(/\"[^\"]*?\"/g, function(word){'+
36+
').replace(/\"(\\\\\"|[^\"])*?\"/g, function(word){'+
3637
'return word.replace(/>/g, \'&gt;\').replace(/</g, \'&lt;\');}'+
3738
'));code.className=\'prettyprint linenums\';prettyPrint();return false;'+
3839
'};}</script>'+

0 commit comments

Comments
 (0)