|
3 | 3 | // @name:zh-CN 代码片段高亮 |
4 | 4 | // @name:zh-TW 程式碼片斷高亮 |
5 | 5 | // @namespace hoothin |
6 | | -// @version 2.1 |
| 6 | +// @version 2.2 |
7 | 7 | // @description Add a icon to popup a window that allows syntax highlighting and beautify and word count of source code snippets on current page |
8 | 8 | // @description:zh-CN 选择代码片段后点击图标弹出新窗口显示语法高亮美化与格式化后的代码与字数统计 |
9 | 9 | // @description:zh-TW 選擇程式碼片段後點選圖示彈出新視窗顯示語法高亮美化與格式化後的程式碼與字數統計 |
|
128 | 128 | return { 'x': x, 'y': y }; |
129 | 129 | } |
130 | 130 |
|
131 | | - var _GM_getValue,_GM_setValue,_GM_registerMenuCommand; |
132 | | - if(typeof GM_getValue!='undefined'){ |
133 | | - _GM_getValue=GM_getValue; |
134 | | - _GM_setValue=GM_setValue; |
| 131 | + var _GM_registerMenuCommand; |
| 132 | + if(typeof GM_registerMenuCommand!='undefined'){ |
135 | 133 | _GM_registerMenuCommand=GM_registerMenuCommand; |
136 | | - }else if(typeof GM!='undefined' && typeof GM.getValue!='undefined'){ |
137 | | - _GM_getValue=GM.getValue; |
138 | | - _GM_setValue=GM.setValue; |
| 134 | + }else if(typeof GM!='undefined' && typeof GM.registerMenuCommand!='undefined'){ |
139 | 135 | _GM_registerMenuCommand=GM.registerMenuCommand; |
140 | 136 | } |
141 | 137 | if(typeof _GM_registerMenuCommand=='undefined')_GM_registerMenuCommand=(s,f)=>{}; |
|
159 | 155 | this.operaUJSStorage.setItem(key,value); |
160 | 156 | }else if(this.mxAppStorage){ |
161 | 157 | this.mxAppStorage.setConfig(key,value); |
162 | | - }else if(this.supportGM || this.supportGMPromise){ |
163 | | - _GM_setValue(key,value); |
| 158 | + }else if(this.supportGM){ |
| 159 | + GM_setValue(key,value); |
| 160 | + }else if(this.supportGMPromise){ |
| 161 | + GM.setValue(key,value); |
164 | 162 | }else if(window.localStorage){ |
165 | 163 | window.localStorage.setItem(key,value); |
166 | 164 | }; |
|
232 | 230 | } |
233 | 231 | }); |
234 | 232 |
|
235 | | - _GM_registerMenuCommand("Highlight", ()=>{ |
| 233 | + _GM_registerMenuCommand("Custom input to highlight", ()=>{ |
236 | 234 | selStr=document.getSelection().toString(); |
237 | 235 | codes=selStr.replace(/&/g, "&").replace(/\</g,"<").replace(/\>/g,">"); |
238 | 236 | if(!codes){ |
|
0 commit comments