Skip to content

Commit 3f2ec8a

Browse files
committed
Update Highlight Every Code.user.js
1 parent 50d1488 commit 3f2ec8a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Highlight Every Code/Highlight Every Code.user.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:zh-CN 代码片段高亮
44
// @name:zh-TW 程式碼片斷高亮
55
// @namespace hoothin
6-
// @version 2.2.3
6+
// @version 2.2.3.1
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 選擇程式碼片段後點選圖示彈出新視窗顯示語法高亮美化與格式化後的程式碼與字數統計
@@ -122,9 +122,9 @@
122122
codes=selStr.replace(/&/g, "&amp;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;");
123123
}
124124
let html='<title>Code Snippet</title>'+
125-
'<link rel="stylesheet" href="https://cdn.rawgit.com/google/code-prettify/master/styles/sons-of-obsidian.css"/>'+
126-
'<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();'+
127-
'document.querySelector("body>a:nth-child(1)").onclick=function(){'+
125+
'<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css"/>'+
126+
'<script>var code,codeStr;window.onload=function(){code=document.querySelector("#code");codeStr=code.innerHTML.replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&(nbsp;|amp;|#39;|quot;)/g, "&amp;$1");prettyPrint();'+
127+
'document.querySelector("#js").onclick=function(){'+
128128
'code.innerHTML=js_beautify('+
129129
'codeStr.replace(/&gt;/g, \'>\').replace(/&lt;/g, \'<\').replace(/\'(\\\\\'|[^\'])*?\'/g, function(word){'+
130130
'return word.replace(/>/g, \'&gt;\').replace(/</g, \'&lt;\');}'+
@@ -136,7 +136,7 @@
136136
'<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.4/beautify.min.js"></script>'+
137137
'<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.4/beautify-html.min.js"></script>'+
138138
'<script src="https://cdnjs.cloudflare.com/ajax/libs/js-beautify/1.6.4/beautify-css.min.js"></script>'+
139-
'Code formatting: <a href="#">Javaspcript</a> '+
139+
'Code formatting: <a id="js" href="#">Javaspcript</a> '+
140140
'<a href="#" onclick="code.innerHTML=html_beautify(codeStr);code.className=\'prettyprint linenums\';prettyPrint();return false;">Html</a> '+
141141
'<a href="#" onclick="code.innerHTML=css_beautify(codeStr);code.className=\'prettyprint linenums\';prettyPrint();return false;">Css</a> '+
142142
'<a href="#" onclick="code.innerHTML=codeStr;code.className=\'prettyprint linenums\';prettyPrint();return false;">Raw</a> <b style="color:red">('+selStr.replace(/\s/g,"").length+' words)</b>'+

0 commit comments

Comments
 (0)