@ lang (' toolfk.lang_text_send_error '): span>' + evt.data);
42 | }
43 | function formatDate (now) {
44 | var year = now.getFullYear ();
45 | var month = now.getMonth () + 1;
46 | var date = now.getDate ();
47 | var hour = now.getHours ();
48 | var minute = now.getMinutes ();
49 | var second = now.getSeconds ();
50 | return year + "-" + (month = month <10 ( "0" + month):? month) + "-" + (? date = date <10 ( "0" + date): date) + "" + ( hour = hour <10 ( "0" + hour):? hour) + ":" + (minute = minute <10 ( "0" + minute?): minute) + ":" + (second = second <10? ( "0" + second): second);
51 | }
52 | function writeToScreen (message) {
53 | var div = "" + message + " div>";
54 | var d = $ ( "# output");
55 | var d = d [0];
56 | var doScroll = d.scrollTop == d.scrollHeight - d.clientHeight;
57 | $ ( "# Output") append (div).;
58 | if (doScroll) {
59 | d.scrollTop = d.scrollHeight - d.clientHeight;
60 | }
61 | }
62 |
63 | $ (Function () {
64 | $ ( ". Btn-open"). Click (function () {
65 | var wsaddr = $ ( "# wsaddr") val ().;
66 | if (wsaddr == '') {
67 | layer.msg ( "@ lang ( 'toolfk.lang_text_websocket_empty')");
68 | return false;
69 | }
70 | StartWebSocket (wsaddr);
71 | });
72 |
73 | $ ( ". Btn-close"). Click (function () {
74 | websocket.close ();
75 | });
76 |
77 | $ ( ". Btn-clear"). Click (function () {
78 | . $ ( "# Wsaddr") val ( "");
79 | $ ( "# Output") empty ().;
80 | });
81 | $ ( ". Btn-demo"). Click (function () {
82 | $ ( "# Wsaddr") val ($ (this) .data ( "url")).;
83 | });
84 |
85 | $ ( ". Btn-send"). Click (function () {
86 | var message = $ ( "# message") val ().;
87 | if (message == '') {
88 | layer.msg ( "@ lang ( 'toolfk.lang_text_send_address')");
89 | $ ( "# Message") focus ().;
90 | return false;
91 | }
92 | if (typeof websocket === "undefined") {
93 | layer.msg ( "@ lang ( 'toolfk.lang_text_send_fail')");
94 | return false;
95 | }
96 | if (websocket.readyState == 3) {
97 | layer.msg ( "@ lang ( 'toolfk.lang_text_close_suc')");
98 | return false;
99 | }
100 | . $ ( "# Message") val ( '');
101 | writeToScreen ( ' @ lang (' toolfk.lang_text_send_info_ok ') & nbsp;' + formatDate (new Date ()) + ' span>
' + message);
102 | websocket.send (message);
103 | })
104 | });
105 | ```
106 |
107 |
108 | It is worth a try for three reasons:
109 | ------------------------------------
110 |
111 | 1. Integrate various programmers often used in development and testing tools.
112 |
113 | 2. Simple and beautiful atmosphere of the site pages
114 |
115 | 3. Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service
116 |
117 | 4. Also recommend its sister network [www.videofk.com](http://www.videofk.com/) video download Toolbox
118 |
119 |
120 | This link: [http://www.hihubs.com/article/373](http://www.hihubs.com/article/373)
121 |
--------------------------------------------------------------------------------
/Online SQL conversion CSV, XML, JSON, HTML programmer online tools network tools -toolfk online Programmer toolbox:
--------------------------------------------------------------------------------
1 | This paper to recommend \[ToolFk\] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports [BarCode Barcode generated online ](https://www.toolfk.com/tool-generator-barcode "BarCode Barcode generated online"), [QueryList collector ](https://www.toolfk.com/tool-run-reptile "QueryList collector"), [PHP code is run online ](https://www.toolfk.com/tool-online-runphp "PHP code online operation"), [PHP confusion, encryption, decryption ](https://www.toolfk.com/tool-convert-php "PHP confusion, encryption, decryption"), [Python code is run online ](https://www.toolfk.com/tool-online-runpython "Python code runs online"), [JavaScript online operation ](https://www.toolfk.com/tool-online-runjs "JavaScript online operation"),[YAML formatting tools](https://www.toolfk.com/tool-format-yaml "YAML formatting tools") , [HTTP simulation query tool ](https://www.toolfk.com/tool-online-http "HTTP query tool simulation"), [HTML online toolbox ](https://www.toolfk.com/tool-format-html "HTML Online Toolbox"), [JavaScript online Toolbox ](https://www.toolfk.com/tool-format-javascript "JavaScript toolkit online"),[CSS online toolbox ](https://www.toolfk.com/tool-format-css "CSS Online Toolbox"), [JSON online toolbox ](https://www.toolfk.com/tool-format-json "JSON Online Toolbox"), [unixtime timestamp conversion ](https://www.toolfk.com/tool-convert-unixtime "Unixtime timestamp conversion"), [Base64 / the URL of / native2ascii conversion ](https://www.toolfk.com/tool-encdec-transform "Base64 / URL / Native2Ascii conversion"), [CSV conversion kit ](https://www.toolfk.com/tool-convert-csv "CSV Converter Toolkit"), [XML online toolbox ](https://www.toolfk.com/tool-format-xml "XML Online Toolbox"), [the WebSocket online tools ](https://www.toolfk.com/tool-online-runwebsocket "WebSocket online tools"), [Markdown online toolbox ](https://www.toolfk.com/tool-convert-markdown "Markdown Online Toolbox"), [Htaccess2nginx conversion](https://www.toolfk.com/tool-convert-htaccess2nginx "Htaccess2nginx conversion"), [Hex conversion online ](https://www.toolfk.com/tool-convert-hexadecimal "Online hex conversion"), [online encryption toolkit ](https://www.toolfk.com/tool-convert-encryption "Online Encryption Toolkit"),[online pseudo-original tools ](https://www.toolfk.com/tool-convert-text "Online pseudo-original tool"), [online APK decompile ](https://www.toolfk.com/tool-decompile-apk "Online APK decompile"), [online web screenshot tool ](https://www.toolfk.com/tool-screen-captures "Online web screenshot tool"), [online random password generation ](https://www.toolfk.com/tool-password-generator "Online Random Password Generator"), [online generate two-dimensional code qrcode ](https://www.toolfk.com/tool-generate-qrcode "Online generated two-dimensional code Qrcode"), [online Crontab Expression Builder ](https://www.toolfk.com/tool-generate-crontab "Online Crontab Expression Builder"),[the online short URL Generator ](https://www.toolfk.com/tool-short-url "Online Short URL Generator"), [Online calculator tool](https://www.toolfk.com/tool-game-calculator "Online calculator tool") , [Linux common commands Daquan](https://www.toolfk.com/tool-find-linux "https://www.toolfk.com/tool-find-linux") , [online text comparison tool](https://www.toolfk.com/tool-online-difftext "https://www.toolfk.com/tool-online-difftext") , [online mind mapping tools](https://www.toolfk.com/tool-online-mind "https://www.toolfk.com/tool-online-mind") , [online database design tool](https://www.toolfk.com/tool-online-designer "https://www.toolfk.com/tool-online-designer") , [free CDN acceleration service](https://www.toolfk.com/tool-online-cdnjs "https://www.toolfk.com/tool-online-cdnjs") , [online stress test tool](https://www.toolfk.com/tool-online-bench "https://www.toolfk.com/tool-online-bench") , [map coordinates pick up tools](https://www.toolfk.com/tool-online-map "https://www.toolfk.com/tool-online-map") , [online SQL conversion tool ](https://www.toolfk.com/tool-convert-sql "https://www.toolfk.com/tool-convert-sql"). And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.
2 |
3 |
4 |
5 | Site name: ToolFk
6 | website links: [https://www.toolfk.com/](https://www.toolfk.com/)
7 | Tools link: [https://www.toolfk.com/tool-convert-sql](https://www.toolfk.com/tool-convert-sql)
8 |
9 | ? Teaching Code
10 | ---------------
11 |
12 | This tool \[Online SQL conversion tool -toolfk programmer tool\]? Dependent[https://github.com/kripken/sql.js](https://github.com/kripken/sql.js) library
13 |
14 | STEP 1
15 |
16 | [](https://2.bp.blogspot.com/-FGb27rdM27I/XA8trb2EFcI/AAAAAAAAAGM/n1WeD1HFIkwOn39NYws43nO6N9BrcEP4gCPcBGAYYCw/s1600/convert-sql.png)
17 |
18 |
19 |
20 |
21 |
22 | STEP 2
23 |
24 | ? THE CORE CODE IS AS FOLLOWS
25 |
26 | ```
27 | $ ( ". Sql-xml"). Click (function () {
28 | if (toolfk.beautify_default.beautify_in_progress) {
29 | return;
30 | }
31 | var source = sourceArea.getValue ();
32 | if (source == '') {
33 | return layer.msg (NOT_EMPTY);
34 | }
35 | var loading = layer.load ();
36 | toolfk.beautify_default.beautify_in_progress = true;
37 | sqlTOxml (source, targetArea);
38 | toolfk.beautify_default.beautify_in_progress = false;
39 | layer.close (loading);
40 | });
41 |
42 | $ ( ". Sql-csv"). Click (function () {
43 |
44 | if (toolfk.beautify_default.beautify_in_progress) {
45 | return;
46 | }
47 | var loading = layer.load ();
48 | var source = sourceArea.getValue ();
49 | if (source == '') {
50 | layer.close (loading);
51 | return layer.msg (NOT_EMPTY);
52 | }
53 |
54 | toolfk.beautify_default.beautify_in_progress = true;
55 | sqlTOcsv (source, targetArea);
56 | toolfk.beautify_default.beautify_in_progress = false;
57 | layer.close (loading);
58 | });
59 |
60 | $ ( ". Sql-json"). Click (function () {
61 |
62 | if (toolfk.beautify_default.beautify_in_progress) {
63 | return;
64 | }
65 | var loading = layer.load ();
66 | var source = sourceArea.getValue ();
67 | if (source == '') {
68 | layer.close (loading);
69 | return layer.msg (NOT_EMPTY);
70 | }
71 |
72 | toolfk.beautify_default.beautify_in_progress = true;
73 | sqlTOjson (source, targetArea);
74 | toolfk.beautify_default.beautify_in_progress = false;
75 | layer.close (loading);
76 | });
77 |
78 | $ ( ". Sql-yaml"). Click (function () {
79 |
80 | if (toolfk.beautify_default.beautify_in_progress) {
81 | return;
82 | }
83 | var loading = layer.load ();
84 | var source = sourceArea.getValue ();
85 | if (source == '') {
86 | layer.close (loading);
87 | return layer.msg (NOT_EMPTY);
88 | }
89 |
90 | toolfk.beautify_default.beautify_in_progress = true;
91 | sqlTOyaml (source, targetArea);
92 | toolfk.beautify_default.beautify_in_progress = false;
93 | layer.close (loading);
94 | });
95 |
96 | $ ( ". Sql-html"). Click (function () {
97 |
98 | if (toolfk.beautify_default.beautify_in_progress) {
99 | return;
100 | }
101 | var loading = layer.load ();
102 | var source = sourceArea.getValue ();
103 | if (source == '') {
104 | layer.close (loading);
105 | return layer.msg (NOT_EMPTY);
106 | }
107 |
108 | toolfk.beautify_default.beautify_in_progress = true;
109 | sqlTOhtml (source, targetArea);
110 | toolfk.beautify_default.beautify_in_progress = false;
111 | layer.close (loading);
112 | });
113 |
114 | ```
115 |
116 | It is worth a try for three reasons:
117 | ------------------------------------
118 |
119 | 1. Integrate various programmers often used in development and testing tools.
120 |
121 | 2. Simple and beautiful atmosphere of the site pages
122 |
123 | 3. Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service
124 |
125 | 4. Also recommend its sister network [www.videofk.com](http://www.videofk.com/) video download Toolbox
126 |
127 |
128 |
129 |
130 |
131 |
132 | > This link: [http://www.hihubs.com/article/398](http://www.hihubs.com/article/398)
133 |
--------------------------------------------------------------------------------
/Online implement JavaScript landscaping (format), compression, encryption, decryption, obfuscation tool -toolfk online Programmer toolbox:
--------------------------------------------------------------------------------
1 | This paper to recommend \[ToolFk\] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports [BarCode Barcode generated online ](https://www.toolfk.com/tool-generator-barcode "BarCode Barcode generated online"), [QueryList collector ](https://www.toolfk.com/tool-run-reptile "QueryList collector"), [PHP code is run online ](https://www.toolfk.com/tool-online-runphp "PHP code online operation"), [PHP confusion, encryption, decryption ](https://www.toolfk.com/tool-convert-php "PHP confusion, encryption, decryption"), [Python code is run online ](https://www.toolfk.com/tool-online-runpython "Python code runs online"), [JavaScript online operation ](https://www.toolfk.com/tool-online-runjs "JavaScript online operation"),[YAML formatting tools](https://www.toolfk.com/tool-format-yaml "YAML formatting tools") , [HTTP simulation query tool ](https://www.toolfk.com/tool-online-http "HTTP query tool simulation"), [HTML online toolbox ](https://www.toolfk.com/tool-format-html "HTML Online Toolbox"), [JavaScript online Toolbox ](https://www.toolfk.com/tool-format-javascript "JavaScript toolkit online"),[CSS online toolbox ](https://www.toolfk.com/tool-format-css "CSS Online Toolbox"), [JSON online toolbox ](https://www.toolfk.com/tool-format-json "JSON Online Toolbox"), [unixtime timestamp conversion ](https://www.toolfk.com/tool-convert-unixtime "Unixtime timestamp conversion"), [Base64 / the URL of / native2ascii conversion ](https://www.toolfk.com/tool-encdec-transform "Base64 / URL / Native2Ascii conversion"), [CSV conversion kit ](https://www.toolfk.com/tool-convert-csv "CSV Converter Toolkit"), [XML online toolbox ](https://www.toolfk.com/tool-format-xml "XML Online Toolbox"), [the WebSocket online tools ](https://www.toolfk.com/tool-online-runwebsocket "WebSocket online tools"), [Markdown online toolbox ](https://www.toolfk.com/tool-convert-markdown "Markdown Online Toolbox"), [Htaccess2nginx conversion](https://www.toolfk.com/tool-convert-htaccess2nginx "Htaccess2nginx conversion"), [Hex conversion online ](https://www.toolfk.com/tool-convert-hexadecimal "Online hex conversion"), [online encryption toolkit ](https://www.toolfk.com/tool-convert-encryption "Online Encryption Toolkit"),[online pseudo-original tools ](https://www.toolfk.com/tool-convert-text "Online pseudo-original tool"), [online APK decompile ](https://www.toolfk.com/tool-decompile-apk "Online APK decompile"), [online web screenshot tool ](https://www.toolfk.com/tool-screen-captures "Online web screenshot tool"), [online random password generation ](https://www.toolfk.com/tool-password-generator "Online Random Password Generator"), [online generate two-dimensional code qrcode ](https://www.toolfk.com/tool-generate-qrcode "Online generated two-dimensional code Qrcode"), [online Crontab Expression Builder ](https://www.toolfk.com/tool-generate-crontab "Online Crontab Expression Builder"),[the online short URL Generator ](https://www.toolfk.com/tool-short-url "Online Short URL Generator"), [Online calculator tool ](https://www.toolfk.com/tool-game-calculator "Online calculator tool"). And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.
2 |
3 | Site name: ToolFk
4 | website links: [https://www.toolfk.com/](https://www.toolfk.com/)
5 | Tools link: [https://www.toolfk.com/tool-format-javascript](https://www.toolfk.com/tool-format-javascript)
6 |
7 | ? Teaching Code
8 | ---------------
9 |
10 | This tool \[Online JavaScript landscaping (format) / encryption / decryption / confused\] depends on its Github Codemirror ,? address: [https://github.com/codemirror/CodeMirror, encryption, decryption to http: // dean .edwards.name / packer / ](https://github.com/codemirror/CodeMirror,%E5%8A%A0%E5%AF%86%E3%80%81%E8%A7%A3%E5%AF%86%E4%BD%BF%E7%94%A8%E5%88%B0http://dean.edwards.name/packer/) library, use landscaping to csso-browser library,[https://github.com/css/csso](https://github.com/css/csso) . Using the following code
11 |
12 | STEP 1
13 |
14 | [](https://4.bp.blogspot.com/-sbSReN4OQD8/XA8tsvCXM8I/AAAAAAAAAGM/ltKXa1OrNAEyTgi4jKuZHPeqQTUZ1vnPACPcBGAYYCw/s1600/format-js.png)
15 |
16 |
17 |
18 | STEP 2
19 |
20 | ? THE CORE CODE IS AS FOLLOWS
21 |
22 | ```
23 | beautify_start: function (options) {
24 | if (toolfk.beautify_default.beautify_in_progress) {
25 | return;
26 | }
27 | var opts = $ .extend ({}, toolfk.beautify_default, options);
28 | var source = opts.source.getValue ();
29 | if (source == '') {
30 | return layer.msg (NOT_EMPTY);
31 | }
32 | toolfk.beautify_default.beautify_in_progress = true;
33 | if (opts.language === 'html') {
34 | output = beautifier.html (source, opts);
35 | } Else if (opts.language === 'css') {
36 | output = beautifier.css (source, opts);
37 | } Else {
38 | if (opts.detect_packers) {
39 | source = toolfk.beautify_unpacker_filter (source);
40 | }
41 | output = beautifier.js (source, opts);
42 | }
43 | opts.target.setValue (output);
44 | toolfk.report ( 'beautify', output);
45 | toolfk.beautify_default.beautify_in_progress = false;
46 | },
47 | pack_js: function (options) {
48 | if (toolfk.beautify_default.beautify_in_progress) {
49 | return;
50 | }
51 | var opts = $ .extend ({}, toolfk.beautify_default, options);
52 | var source = opts.source.getValue ();
53 | if (source == '') {
54 | return layer.msg (NOT_EMPTY);
55 | }
56 | toolfk.beautify_default.beautify_in_progress = true;
57 | var packer = new Packer;
58 | if (opts.is_base64) {
59 | var output = packer.pack (source, 1, opts.is_shrink);
60 | } Else {
61 | var output = packer.pack (source, 0, opts.is_shrink);
62 | }
63 | opts.target.setValue (output);
64 | toolfk.report ( 'compress', output);
65 | toolfk.beautify_default.beautify_in_progress = false;
66 | },
67 | dec_pack: function (options) {
68 | if (toolfk.beautify_default.beautify_in_progress) {
69 | return;
70 | }
71 | var opts = $ .extend ({}, toolfk.beautify_default, options);
72 | var source = opts.source.getValue ();
73 | if (source == '') {
74 | return layer.msg (NOT_EMPTY);
75 | }
76 | toolfk.beautify_default.beautify_in_progress = true;
77 | try {
78 | eval ( 'var value = String' + source.slice (4));
79 | opts.target.setValue (value);
80 | toolfk.report ( 'deciphering-compress', value);
81 | } Catch (e) {
82 | layer.msg (TEXT_ERROR);
83 | }
84 | toolfk.beautify_default.beautify_in_progress = false;
85 | },
86 | dec_pack_shrink: function (options) {
87 | if (toolfk.beautify_default.beautify_in_progress) {
88 | return;
89 | }
90 | var opts = $ .extend ({}, toolfk.beautify_default, options);
91 | var source = opts.source.getValue ();
92 | if (source == '') {
93 | return layer.msg (NOT_EMPTY);
94 | }
95 | toolfk.beautify_default.beautify_in_progress = true;
96 | try {
97 | eval ( 'var value = String' + source.slice (4));
98 | var source = toolfk.beautify_unpacker_filter (value);
99 | output = beautifier.js (source, opts);
100 | opts.target.setValue (output);
101 | toolfk.report ( 'decode-code', output);
102 | } Catch (e) {
103 | layer.msg (TEXT_ERROR);
104 | }
105 | toolfk.beautify_default.beautify_in_progress = false;
106 | },
107 | code_code: function (options) {
108 | if (toolfk.beautify_default.beautify_in_progress) {
109 | return;
110 | }
111 | var opts = $ .extend ({}, toolfk.beautify_default, options);
112 | var target = opts.target.getValue ();
113 | if (target == '') {
114 | return layer.msg (NOT_EMPTY);
115 | }
116 | toolfk.beautify_default.beautify_in_progress = true;
117 | new ClipboardJS ( '. copy-code', {
118 | text: function (trigger) {
119 | layer.msg (COPY_SUCC);
120 | return target;
121 | }
122 | });
123 | toolfk.beautify_default.beautify_in_progress = false;
124 | },
125 | / * Css * /
126 | purify_css: function (options) {
127 | if (toolfk.beautify_default.beautify_in_progress) {
128 | return;
129 | }
130 | var opts = $ .extend ({}, toolfk.beautify_default, options);
131 | var source = opts.source.getValue ();
132 | if (source == '') {
133 | return layer.msg (NOT_EMPTY);
134 | }
135 | toolfk.beautify_default.beautify_in_progress = true;
136 | var value = toolfk.purify_encode (source) .replace (/ \} / g, '} \ n');
137 | opts.target.setValue (value);
138 | toolfk.report ( 'purify_css', value);
139 | toolfk.beautify_default.beautify_in_progress = false;
140 | },
141 | purify_encode: function (text) {
142 | var val = text;
143 | val = val.replace (/ \ / \ * (| \ n) * \ * \ // g, ''.?); // remove comments
144 | val = val.replace (/ ^ \ s + | \ s + $ / g, ''); // Clear both spaces
145 | val = val.replace (/ (:) \ s + / g, '$ 1'); // plurality of spaces such as the removal of the colon width: 100px => width: 100px
146 | val = val.replace (/ \ s {2,} / g, ''); // remove extra spaces, such as two or more margin: 10px 20px 30px => margin: 10px 20px 30px
147 | val = val.replace (/, \ s + | \ s +, / g, ','); // remove extra spaces, such as shared when a plurality of patterns h1, h2, h3 => h1, h2, h3
148 | val = val.replace (/; {2,} |; \ s + / g, ';'); // remove excess rear space as a plurality of semi-colon, or semicolon width: 200px ;; height: 100px => width: 200px; height: 100px
149 | val = val.replace (/ \ s * \ {\ s * / g, '{'); // remove excess space behind the selectors such as div {height: 100px} => div {height: 100px}
150 | val = val.replace (/ \ s *} \ s * / g, '}'); // remove extra spaces, such as in front of the selector div {height: 100px} a {} => div {height: 100px} a { }
151 | val = val.replace (/ [\ n \ t \ f \ r] / g, ''); // removing wrap, tabs, page breaks, the transport
152 | val = val.replace (/;} / g, '}');
153 | return val;
154 | },
155 | optimize_css: function (options) {
156 | if (toolfk.beautify_default.beautify_in_progress) {
157 | return;
158 | }
159 | var opts = $ .extend ({}, toolfk.beautify_default, options);
160 | var source = opts.source.getValue ();
161 | if (source == '') {
162 | return layer.msg (NOT_EMPTY);
163 | }
164 | toolfk.beautify_default.beautify_in_progress = true;
165 | var lastResult = csso.minify (source, {
166 | restructure: true
167 | });
168 | var value = lastResult.css;
169 | opts.target.setValue (value);
170 | toolfk.report ( 'optimize_css', value);
171 | toolfk.beautify_default.beautify_in_progress = false;
172 | },
173 |
174 | ```
175 |
176 | It is worth a try for three reasons:
177 | ------------------------------------
178 |
179 | 1. Integrate various programmers often used in development and testing tools.
180 |
181 | 2. Simple and beautiful atmosphere of the site pages
182 |
183 | 3. Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service
184 |
185 | 4. Also recommend its sister network [www.videofk.com](http://www.videofk.com/) video download Toolbox
186 |
187 |
188 |
189 |
190 | > This link: [http://www.hihubs.com/article/366](http://www.hihubs.com/article/366)
191 |
--------------------------------------------------------------------------------
/Online implement CSS beautification (format), compression, encryption, decryption, obfuscation tool - toolfk online Programmer toolbox:
--------------------------------------------------------------------------------
1 | This paper to recommend \[ToolFk\] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports [BarCode Barcode generated online ](https://www.toolfk.com/tool-generator-barcode "BarCode Barcode generated online"), [QueryList collector ](https://www.toolfk.com/tool-run-reptile "QueryList collector"), [PHP code is run online ](https://www.toolfk.com/tool-online-runphp "PHP code online operation"), [PHP confusion, encryption, decryption ](https://www.toolfk.com/tool-convert-php "PHP confusion, encryption, decryption"), [Python code is run online ](https://www.toolfk.com/tool-online-runpython "Python code runs online"), [JavaScript online operation ](https://www.toolfk.com/tool-online-runjs "JavaScript online operation"),[YAML formatting tools](https://www.toolfk.com/tool-format-yaml "YAML formatting tools") , [HTTP simulation query tool ](https://www.toolfk.com/tool-online-http "HTTP query tool simulation"), [HTML online toolbox ](https://www.toolfk.com/tool-format-html "HTML Online Toolbox"), [JavaScript online Toolbox ](https://www.toolfk.com/tool-format-javascript "JavaScript toolkit online"),[CSS online toolbox ](https://www.toolfk.com/tool-format-css "CSS Online Toolbox"), [JSON online toolbox ](https://www.toolfk.com/tool-format-json "JSON Online Toolbox"), [unixtime timestamp conversion ](https://www.toolfk.com/tool-convert-unixtime "Unixtime timestamp conversion"), [Base64 / the URL of / native2ascii conversion ](https://www.toolfk.com/tool-encdec-transform "Base64 / URL / Native2Ascii conversion"), [CSV conversion kit ](https://www.toolfk.com/tool-convert-csv "CSV Converter Toolkit"), [XML online toolbox ](https://www.toolfk.com/tool-format-xml "XML Online Toolbox"), [the WebSocket online tools ](https://www.toolfk.com/tool-online-runwebsocket "WebSocket online tools"), [Markdown online toolbox ](https://www.toolfk.com/tool-convert-markdown "Markdown Online Toolbox"), [Htaccess2nginx conversion](https://www.toolfk.com/tool-convert-htaccess2nginx "Htaccess2nginx conversion"), [Hex conversion online ](https://www.toolfk.com/tool-convert-hexadecimal "Online hex conversion"), [online encryption toolkit ](https://www.toolfk.com/tool-convert-encryption "Online Encryption Toolkit"),[online pseudo-original tools ](https://www.toolfk.com/tool-convert-text "Online pseudo-original tool"), [online APK decompile ](https://www.toolfk.com/tool-decompile-apk "Online APK decompile"), [online web screenshot tool ](https://www.toolfk.com/tool-screen-captures "Online web screenshot tool"), [online random password generation ](https://www.toolfk.com/tool-password-generator "Online Random Password Generator"), [online generate two-dimensional code qrcode ](https://www.toolfk.com/tool-generate-qrcode "Online generated two-dimensional code Qrcode"), [online Crontab Expression Builder ](https://www.toolfk.com/tool-generate-crontab "Online Crontab Expression Builder"),[the online short URL Generator ](https://www.toolfk.com/tool-short-url "Online Short URL Generator"), [Online calculator tool ](https://www.toolfk.com/tool-game-calculator "Online calculator tool"). And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.
2 |
3 | Site name: ToolFk
4 | website links: [https://www.toolfk.com/](https://www.toolfk.com/)
5 | Tools link: [https://www.toolfk.com/tool-format-css](https://www.toolfk.com/tool-format-css)
6 |
7 | Teaching Code
8 | --------------
9 |
10 | This tool \[Online CSS beautification (format) / encryption / decryption / confused\] depends on its Github Codemirror ,? address: [https://github.com/codemirror/CodeMirror, encryption, decryption to http: // dean .edwards.name / packer /](https://github.com/codemirror/CodeMirror,%E5%8A%A0%E5%AF%86%E3%80%81%E8%A7%A3%E5%AF%86%E4%BD%BF%E7%94%A8%E5%88%B0http://dean.edwards.name/packer/) library, use landscaping to csso-browser library, [https://github.com/css/csso](https://github.com/css/csso) .Using the following code
11 |
12 | STEP 1
13 |
14 | [](https://4.bp.blogspot.com/-PZh7jw7akZY/XA8tsqdlepI/AAAAAAAAAGM/NIVwIeV86cMReKsnXfR2KUxBphOBCE4kQCPcBGAYYCw/s1600/format-css.png)
15 |
16 |
17 |
18 | STEP 2
19 |
20 | ? THE CORE CODE IS AS FOLLOWS
21 |
22 | ```
23 | beautify_start: function (options) {
24 | if (toolfk.beautify_default.beautify_in_progress) {
25 | return;
26 | }
27 | var opts = $ .extend ({}, toolfk.beautify_default, options);
28 |
29 | var source = opts.source.getValue ();
30 | if (source == '') {
31 | return layer.msg (NOT_EMPTY);
32 | }
33 |
34 | toolfk.beautify_default.beautify_in_progress = true;
35 | if (opts.language === 'html') {
36 | output = beautifier.html (source, opts);
37 | } Else if (opts.language === 'css') {
38 | output = beautifier.css (source, opts);
39 | } Else {
40 | if (opts.detect_packers) {
41 | source = toolfk.beautify_unpacker_filter (source);
42 | }
43 | output = beautifier.js (source, opts);
44 | }
45 |
46 | opts.target.setValue (output);
47 | toolfk.report ( 'beautify', output);
48 | toolfk.beautify_default.beautify_in_progress = false;
49 | },
50 |
51 | pack_js: function (options) {
52 | if (toolfk.beautify_default.beautify_in_progress) {
53 | return;
54 | }
55 | var opts = $ .extend ({}, toolfk.beautify_default, options);
56 |
57 | var source = opts.source.getValue ();
58 | if (source == '') {
59 | return layer.msg (NOT_EMPTY);
60 | }
61 | toolfk.beautify_default.beautify_in_progress = true;
62 |
63 | var packer = new Packer;
64 | if (opts.is_base64) {
65 | var output = packer.pack (source, 1, opts.is_shrink);
66 | } Else {
67 | var output = packer.pack (source, 0, opts.is_shrink);
68 | }
69 | opts.target.setValue (output);
70 | toolfk.report ( 'compress', output);
71 | toolfk.beautify_default.beautify_in_progress = false;
72 | },
73 |
74 | dec_pack: function (options) {
75 | if (toolfk.beautify_default.beautify_in_progress) {
76 | return;
77 | }
78 | var opts = $ .extend ({}, toolfk.beautify_default, options);
79 |
80 | var source = opts.source.getValue ();
81 | if (source == '') {
82 | return layer.msg (NOT_EMPTY);
83 | }
84 | toolfk.beautify_default.beautify_in_progress = true;
85 | try {
86 | eval ( 'var value = String' + source.slice (4));
87 | opts.target.setValue (value);
88 | toolfk.report ( 'deciphering-compress', value);
89 | } Catch (e) {
90 | layer.msg (TEXT_ERROR);
91 | }
92 | toolfk.beautify_default.beautify_in_progress = false;
93 | },
94 |
95 | dec_pack_shrink: function (options) {
96 | if (toolfk.beautify_default.beautify_in_progress) {
97 | return;
98 | }
99 | var opts = $ .extend ({}, toolfk.beautify_default, options);
100 |
101 | var source = opts.source.getValue ();
102 | if (source == '') {
103 | return layer.msg (NOT_EMPTY);
104 | }
105 | toolfk.beautify_default.beautify_in_progress = true;
106 | try {
107 | eval ( 'var value = String' + source.slice (4));
108 | var source = toolfk.beautify_unpacker_filter (value);
109 | output = beautifier.js (source, opts);
110 | opts.target.setValue (output);
111 | toolfk.report ( 'decode-code', output);
112 | } Catch (e) {
113 | layer.msg (TEXT_ERROR);
114 | }
115 | toolfk.beautify_default.beautify_in_progress = false;
116 | },
117 |
118 | code_code: function (options) {
119 | if (toolfk.beautify_default.beautify_in_progress) {
120 | return;
121 | }
122 | var opts = $ .extend ({}, toolfk.beautify_default, options);
123 |
124 | var target = opts.target.getValue ();
125 | if (target == '') {
126 | return layer.msg (NOT_EMPTY);
127 | }
128 | toolfk.beautify_default.beautify_in_progress = true;
129 | new ClipboardJS ( '. copy-code', {
130 | text: function (trigger) {
131 | layer.msg (COPY_SUCC);
132 | return target;
133 | }
134 | });
135 | toolfk.beautify_default.beautify_in_progress = false;
136 | },
137 |
138 | / * Css * /
139 | purify_css: function (options) {
140 | if (toolfk.beautify_default.beautify_in_progress) {
141 | return;
142 | }
143 | var opts = $ .extend ({}, toolfk.beautify_default, options);
144 |
145 | var source = opts.source.getValue ();
146 | if (source == '') {
147 | return layer.msg (NOT_EMPTY);
148 | }
149 | toolfk.beautify_default.beautify_in_progress = true;
150 |
151 | var value = toolfk.purify_encode (source) .replace (/ \} / g, '} \ n');
152 | opts.target.setValue (value);
153 | toolfk.report ( 'purify_css', value);
154 | toolfk.beautify_default.beautify_in_progress = false;
155 | },
156 |
157 | purify_encode: function (text) {
158 | var val = text;
159 | val = val.replace (/ \ / \ * (| \ n) * \ * \ // g, ''.?); // remove comments
160 | val = val.replace (/ ^ \ s + | \ s + $ / g, ''); // Clear both spaces
161 | val = val.replace (/ (:) \ s + / g, '$ 1'); // plurality of spaces such as the removal of the colon width: 100px => width: 100px
162 | val = val.replace (/ \ s {2,} / g, ''); // remove extra spaces, such as two or more margin: 10px 20px 30px => margin: 10px 20px 30px
163 | val = val.replace (/, \ s + | \ s +, / g, ','); // remove extra spaces, such as shared when a plurality of patterns h1, h2, h3 => h1, h2, h3
164 | val = val.replace (/; {2,} |; \ s + / g, ';'); // remove excess rear space as a plurality of semi-colon, or semicolon width: 200px ;; height: 100px => width: 200px; height: 100px
165 | val = val.replace (/ \ s * \ {\ s * / g, '{'); // remove excess space behind the selectors such as div {height: 100px} => div {height: 100px}
166 | val = val.replace (/ \ s *} \ s * / g, '}'); // remove extra spaces, such as in front of the selector div {height: 100px} a {} => div {height: 100px} a { }
167 | val = val.replace (/ [\ n \ t \ f \ r] / g, ''); // removing wrap, tabs, page breaks, the transport
168 | val = val.replace (/;} / g, '}');
169 | return val;
170 | },
171 |
172 | optimize_css: function (options) {
173 | if (toolfk.beautify_default.beautify_in_progress) {
174 | return;
175 | }
176 | var opts = $ .extend ({}, toolfk.beautify_default, options);
177 |
178 | var source = opts.source.getValue ();
179 | if (source == '') {
180 | return layer.msg (NOT_EMPTY);
181 | }
182 | toolfk.beautify_default.beautify_in_progress = true;
183 |
184 | var lastResult = csso.minify (source, {
185 | restructure: true
186 | });
187 |
188 | var value = lastResult.css;
189 | opts.target.setValue (value);
190 | toolfk.report ( 'optimize_css', value);
191 | toolfk.beautify_default.beautify_in_progress = false;
192 | },
193 | ```
194 | It is worth a try for three reasons:
195 | ------------------------------------
196 |
197 | 1. Integrate various programmers often used in development and testing tools.
198 |
199 | 2. Simple and beautiful atmosphere of the site pages
200 |
201 | 3. Online support formatting code execution, APK online decompile, online high-strength password generator, two dozen screenshots online web tools service
202 |
203 | 4. Also recommend its sister network [www.videofk.com](http://www.videofk.com/) video download Toolbox
204 |
205 |
206 | > This link: [http://www.hihubs.com/article/367](http://www.hihubs.com/article/367)
207 |
--------------------------------------------------------------------------------
/JavaScritp achieve online calculator tool -toolfk online Programmer toolbox:
--------------------------------------------------------------------------------
1 | This paper to recommend \[ToolFk\] is a programmers often use a free online test kit, ToolFk feature is focused on everyday programmer development tools, without having to install any software, as long as the content execution affixed by a button, able to obtain the contents of the desired results.ToolFk also supports [BarCode Barcode generated online ](https://www.toolfk.com/tool-generator-barcode "BarCode Barcode generated online"), [QueryList collector ](https://www.toolfk.com/tool-run-reptile "QueryList collector"), [PHP code is run online ](https://www.toolfk.com/tool-online-runphp "PHP code online operation"), [PHP confusion, encryption, decryption ](https://www.toolfk.com/tool-convert-php "PHP confusion, encryption, decryption"), [Python code is run online ](https://www.toolfk.com/tool-online-runpython "Python code runs online"), [JavaScript online operation ](https://www.toolfk.com/tool-online-runjs "JavaScript online operation"),[YAML formatting tools](https://www.toolfk.com/tool-format-yaml "YAML formatting tools") , [HTTP simulation query tool ](https://www.toolfk.com/tool-online-http "HTTP query tool simulation"), [HTML online toolbox ](https://www.toolfk.com/tool-format-html "HTML Online Toolbox"), [JavaScript online Toolbox ](https://www.toolfk.com/tool-format-javascript "JavaScript toolkit online"),[CSS online toolbox ](https://www.toolfk.com/tool-format-css "CSS Online Toolbox"), [JSON online toolbox ](https://www.toolfk.com/tool-format-json "JSON Online Toolbox"), [unixtime timestamp conversion ](https://www.toolfk.com/tool-convert-unixtime "Unixtime timestamp conversion"), [Base64 / the URL of / native2ascii conversion ](https://www.toolfk.com/tool-encdec-transform "Base64 / URL / Native2Ascii conversion"), [CSV conversion kit ](https://www.toolfk.com/tool-convert-csv "CSV Converter Toolkit"), [XML online toolbox ](https://www.toolfk.com/tool-format-xml "XML Online Toolbox"), [the WebSocket online tools ](https://www.toolfk.com/tool-online-runwebsocket "WebSocket online tools"), [Markdown online toolbox ](https://www.toolfk.com/tool-convert-markdown "Markdown Online Toolbox"), [Htaccess2nginx conversion](https://www.toolfk.com/tool-convert-htaccess2nginx "Htaccess2nginx conversion"), [Hex conversion online ](https://www.toolfk.com/tool-convert-hexadecimal "Online hex conversion"), [online encryption toolkit ](https://www.toolfk.com/tool-convert-encryption "Online Encryption Toolkit"),[online pseudo-original tools ](https://www.toolfk.com/tool-convert-text "Online pseudo-original tool"), [online APK decompile ](https://www.toolfk.com/tool-decompile-apk "Online APK decompile"), [online web screenshot tool ](https://www.toolfk.com/tool-screen-captures "Online web screenshot tool"), [online random password generation ](https://www.toolfk.com/tool-password-generator "Online Random Password Generator"), [online generate two-dimensional code qrcode ](https://www.toolfk.com/tool-generate-qrcode "Online generated two-dimensional code Qrcode"), [online Crontab Expression Builder ](https://www.toolfk.com/tool-generate-crontab "Online Crontab Expression Builder"),[the online short URL Generator ](https://www.toolfk.com/tool-short-url "Online Short URL Generator"), [Online calculator tool ](https://www.toolfk.com/tool-game-calculator "Online calculator tool"). And more than 20 daily programmer development tools, can be considered a very comprehensive website programmer's toolbox.
2 |
3 |
4 |
5 | Site name: ToolFk
6 | website links: [https://www.toolfk.com/](https://www.toolfk.com/)
7 | Tools link: [https://www.toolfk.com/tool-game-calculator](https://www.toolfk.com/tool-game-calculator)
8 |
9 | ? Teaching Code
10 | ---------------
11 |
12 | This tool \[online scientific calculator tool\]?-Dependent code base is https://github.com/seaswalker/js\_calculator
13 |
14 | STEP 1
15 |
16 | [](https://2.bp.blogspot.com/-CxRERZJ6BE8/XA8tql446mI/AAAAAAAAAGA/Jfyjcp2H5Rw48U4ufhenBuFVjud7npC7wCPcBGAYYCw/s1600/canculator.png)
17 |
18 |
19 |
20 | STEP 2
21 |
22 | ? THE CORE CODE IS AS FOLLOWS
23 |
24 | ```
25 | // Global calculator objects
26 | var Calculator = (function () {
27 | var cal = {
28 | Calculator keys // coding
29 | keyCodes: {
30 | 0: '0',
31 | 1: '1',
32 | twenty two',
33 | 3: '3',
34 | 4: '4',
35 | 5: '5',
36 | 6: '6',
37 | 7: '7',
38 | 8: '8',
39 | 9: '9',
40 | 10:, '.'
41 | 11: '±',
42 | 12: '=',
43 | 13: '+'
44 | 14: '-',
45 | 15: '*',
46 | 16: '/',
47 | 17: '%',
48 | 18: '√',
49 | 19: 'x2',
50 | 20: '1 / x',
51 | twenty one: '(',
52 | twenty two: ')',
53 | 23: 'yroot',
54 | 24: 'n!',
55 | 25: 'Exp',
56 | 26: '^',
57 | 27: 'sin',
58 | 28: 'cos',
59 | 29: 'tan',
60 | 30: 'powten',
61 | 31: 'log',
62 | 32: 'sinh',
63 | 33: 'cosh',
64 | 34: 'tanh',
65 | 35: 'π',
66 | 36: '↑',
67 | 37: 'CE',
68 | 38: 'C',
69 | 39: 'Back',
70 | // The following is a programmer-type-specific keys
71 | 40: 'A',
72 | 41: 'B',
73 | 42: 'C',
74 | 43: 'D',
75 | 44: 'E',
76 | 45: 'F',
77 | 46: '&',
78 | 47: '|',
79 | 48: '~'
80 | },
81 | // for displaying map operators, such as * when calculation, while x showed better
82 | operatorFacade: {
83 | 13: '+'
84 | 14: '-',
85 | 15: '×',
86 | 16: '÷',
87 | 17: '%',
88 | 23: 'yroot',
89 | 26: '^',
90 | 46: '&',
91 | 47: '|'
92 | },
93 | // current calculator type 1 -> Standard 2 -> science-based, 3 -> programmer type, the default standard
94 | type: 1,
95 | // calculator type prefix, used to obtain elements from the page
96 | typePrefix: {
97 | 1: "std-",
98 | 2: "sci-",
99 | 3: "pro-"
100 | },
101 | // record whether each type of calculator event listener is already bound, key: typpe value, value: The default standard is true (Loaded)
102 | hasInited: {
103 | 1: true,
104 | 2: false,
105 | 3: false
106 | },
107 | //constant
108 | constants: {
109 | // color when the mouse hovers
110 | mouseHoverColor: "#CFCFCF",
111 | // color calculator below the first row and the other row is different, this is the background color of the first row
112 | firstMouseOutColor: "# F2F2F2",
113 | // remaining background color of each row
114 | mouseOutColor: "# E6E6E6"
115 | },
116 | cache: {
117 | // display the contents of the input element
118 | showInput: null,
119 | // Previous calculations show area
120 | preStep: null,
121 | // display span four kinds of binary values, only valid in the programmer type
122 | scaleSpans: null
123 | },
124 | / **
125 | * Get the content cache.showInput
126 | * @Return String
127 | * /
128 | getShowInput: function () {
129 | return cal.cache.showInput.innerHTML;
130 | },
131 | / **
132 | * Set showInput value
133 | * @Param value
134 | * /
135 | setShowInput: function (value) {
136 | cal.cache.showInput.innerHTML = value;
137 | },
138 | / **
139 | * Get the content cache.preStep
140 | * @Return String
141 | * /
142 | getPreStep: function () {
143 | return cal.cache.preStep.innerHTML;
144 | },
145 | setPreStep: function (value) {
146 | cal.cache.preStep.innerHTML = value;
147 | },
148 | // operand stack
149 | operandStack: [],
150 | // operator stack
151 | operatorStack: [],
152 | // once the input is a binary operator, if it is a binary operator and enter again, this input is ignored
153 | isPreInputBinaryOperator: false,
154 | // if the last key pressed a meta-operation
155 | isPreInputUnaryOperator: false,
156 | // equal sign can not double-click
157 | isPreInputEquals: false,
158 | // If true, then the next digital input on the need to cover showInput, rather than appending
159 | // the last calculated result (=)
160 | preResult: 0,
161 | // band currently used (only valid for programmers), the default decimal (DEC)
162 | currentScale: 10,
163 | isOverride: false,
164 | // int check
165 | intPattern:? / ^ - \ d + $ /,
166 | // decimal check
167 | floatPattern: /^-?\d+\.\d+$/,
168 | // scientific notation check
169 | scientificPattern: /^\d+\.\d+e(\+|-)\d+$/,
170 | // check digit hexadecimal
171 | hexPattern: / ^ [0-9A-F] + $ /,
172 | // Auxiliary operator priority determination
173 | operatorPriority: {
174 | ")": 0,
175 | "|": 1,
176 | "&": 2,
177 | "+": 3,
178 | "-": 3,
179 | "*": 4,
180 | "%": 4,
181 | "/": 4,
182 | "^": 5,
183 | "Yroot": 5,
184 | "(": 6
185 | },
186 | / **
187 | * Initialize the cache object (cal.cache)
188 | * /
189 | initCache: function () {
190 | var prefix = cal.typePrefix [cal.type];
191 | cal.cache.showInput = document.getElementById (prefix + "show-input");
192 | cal.cache.preStep = document.getElementById (prefix + "pre-step");
193 | if (cal.type == 3) {
194 | cal.cache.scaleSpans = document.getElementById ( "pro-scales") getElementsByTagName ( "span").;
195 | }
196 | },
197 | // various event listener function
198 | listeners: {
199 | / **
200 | * Hover color effect of the keys
201 | * /
202 | mouseHoverListener: function (e) {
203 | var event = e || window.event;
204 | event.currentTarget.style.backgroundColor = cal.constants.mouseHoverColor;
205 | },
206 | / **
207 | * Mouse removed from the row of symbols color effect
208 | * /
209 | firstMouseOutListener: function (e) {
210 | var event = e || window.event;
211 | event.currentTarget.style.backgroundColor = cal.constants.firstMouseOutColor;
212 | },
213 | / **
214 | * Mouse out from the lower row of numbers, symbols color effect
215 | * /
216 | mouseOutListener: function (e) {
217 | var event = e || window.event;
218 | event.currentTarget.style.backgroundColor = cal.constants.mouseOutColor;
219 | },
220 | / **
221 | * Press the button event listener
222 | * /
223 | keyPressListener: function (e) {
224 | var event = e || window.event;
225 | cal.handleKey (event.currentTarget.value);
226 | },
227 | / **
228 | * Show / Hide calculator type selection bar
229 | * /
230 | toggleTypeBarListener: function () {
231 | var bar = document.getElementById (cal.typePrefix [cal.type] + "type-bar");
232 | if (bar.style.display === "block") {
233 | bar.style.display = "none";
234 | } Else {
235 | bar.style.display = "block";
236 | }
237 | },
238 | / **
239 | * Switch the calculator type Listener
240 | * /
241 | switchTypeListener: function (e) {
242 | var event = e || window.event;
243 | cal.switchType (parseInt (event.currentTarget.value));
244 | },
245 | / **
246 | * Hexadecimal switch (special programmer)
247 | * /
248 | switchScaleListener: function (e) {
249 | var event = e || window.event;
250 | var scales = document.getElementById ( "pro-scales"). getElementsByTagName ( "div"),
251 | Returns the child elements of the case // here you should use the currentTarget property because the target attribute element binding events are sub-elements
252 | scale = parseInt (event.currentTarget.getAttribute ( "scale")),
253 | oldScale = cal.currentScale;
254 | // switch the selected style
255 | for (var i = 0, l = scales.length; i 8) {
275 | . Lis = document.getElementById ( "pro-top-symbol") getElementsByTagName ( "li");
276 | cal.disableButtons (lis, cal.listeners.firstMouseOutListener);
277 | // Disable 8 and 9
278 | btns = cal.getElementsByAttribute ( "li", "oct-disable", document.getElementById ( "pro-num-symbol"));
279 | cal.disableButtons (btns, cal.listeners.mouseOutListener);
280 | } Else {
281 | cal.listeners._initSecondRowListeners ();
282 | }
283 | } Else if (scale === 2) {
284 | if (oldScale === 16) {
285 | . Lis = document.getElementById ( "pro-top-symbol") getElementsByTagName ( "li");
286 | cal.disableButtons (lis, cal.listeners.firstMouseOutListener);
287 | }
288 | // Disable 2-9
289 | btns = cal.getElementsByAttribute ( "li", "bin-disable", document.getElementById ( "pro-num-symbol"));
290 | cal.disableButtons (btns, cal.listeners.mouseOutListener);
291 | }
292 | cal.currentScale = scale;
293 | },
294 | / **
295 | * Initialize first discharge event listener operator operator
296 | * @Private
297 | * /
298 | _initFirstRowListeners: function () {
299 | . Var lis = document.getElementById (cal.typePrefix [cal.type] + "top-symbol") getElementsByTagName ( "li");
300 | cal.rebuildButtons (lis, cal.listeners.firstMouseOutListener);
301 | },
302 | / **
303 | * Initialize the second row operator event listeners
304 | * @Private
305 | * /
306 | _initSecondRowListeners: function () {
307 | var lis = document.getElementById (cal.typePrefix [cal.type] + "num-symbol") getElementsByTagName ( "li").;
308 | cal.rebuildButtons (lis, cal.listeners.mouseOutListener);
309 | if (cal.type === 3) {
310 | // programmer type decimal point is disabled
311 | cal.disableButtons ([document.getElementById ( "pro-point")], cal.listeners.mouseOutListener);
312 | }
313 | }
314 | },
315 | // Initialize event listener
316 | initListeners: function () {
317 | var prefix = cal.typePrefix [cal.type];
318 | // set the row operator event listener, if a programmer type, because the default is 10 decimal, and hexadecimal numbers on the row, there is no need to set an event listener
319 | if (cal.type <3) {
320 | cal.listeners._initFirstRowListeners ();
321 | }
322 | // set below a column of figures, four arithmetic event listeners
323 | cal.listeners._initSecondRowListeners ();
324 | // Show / Hide sidebar calculator type selection
325 | cal.addEvent (document.getElementById (prefix + "show-bar"), "click", cal.listeners.toggleTypeBarListener);
326 | // switch the type of event is bound to the sidebar li
327 | var bar = document.getElementById (prefix + "type-bar");
328 | lis = bar.getElementsByTagName ( "li");
329 | var li;
330 | for (var i = 0, l = lis.length; i 39 && keyCode <46)) {
355 | cal.showInput (cal.keyCodes [keyCode]);
356 | if (cal.type === 3) {
357 | // If a programmer type, you need to synchronize the display in hexadecimal value 4
358 | cal.showScales (cal.getShowInput ());
359 | }
360 | } Else {
361 | switch (keyCode) {
362 | // sign
363 | case 11:
364 | cal.unaryOperate (function (oldValue) {
365 | oldValue + = "";
366 | if (oldValue === "0") {
367 | return [oldValue];
368 | }
369 | if (oldValue.charAt (0) === '-') {
370 | return [oldValue.substring (1)];
371 | } Else {
372 | return [ "-" + oldValue];
373 | }
374 | });
375 | break;
376 | // open the root
377 | case 18:
378 | cal.unaryOperate (function (si) {
379 | return [Math.sqrt (si), "sqrt"];
380 | });
381 | break;
382 | //square
383 | case 19:
384 | cal.unaryOperate (function (si) {
385 | return [Math.pow (si, 2), "sqr"];
386 | });
387 | break;
388 | // take reciprocal
389 | case 20:
390 | cal.unaryOperate (function (si) {
391 | return [si === 0 ZERO_ERR: 1 / si, "1 /"?];
392 | });
393 | break;
394 | //factorial
395 | case 24:
396 | cal.unaryOperate (function (si) {
397 | if (si <0) {
398 | si = (0 - si);
399 | }
400 | if (cal.isFloat (si + "")) {
401 | si = Math.floor (si);
402 | }
403 | return [cal.fact (si), "fact"];
404 | });
405 | break;
406 | // Exp into scientific notation
407 | case 25:
408 | cal.unaryOperate (function (si) {
409 | return [si.toExponential (7)];
410 | });
411 | break;
412 | // sin
413 | case 27:
414 | cal.unaryOperate (function (si) {
415 | return [Math.sin (si), "sin"];
416 | });
417 | break;
418 | // cos
419 | case 28:
420 | cal.unaryOperate (function (si) {
421 | return [Math.cos (si), "cos"];
422 | });
423 | break;
424 | // tan
425 | case 29:
426 | cal.unaryOperate (function (si) {
427 | return [Math.tan (si), "tan"];
428 | });
429 | break;
430 | x power // 10
431 | case 30:
432 | cal.unaryOperate (function (si) {
433 | return [Math.pow (10, si), "powten"];
434 | });
435 | break;
436 | // log
437 | case 31:
438 | cal.unaryOperate (function (si) {
439 | // js Math.log is the number e, the Windows Calculator is the number 10, where reference Windows
440 | return [Math.log10 (si), "log"];
441 | });
442 | break;
443 | // sinh (hyperbolic sine function)
444 | case 32:
445 | cal.unaryOperate (function (si) {
446 | return [Math.sinh (si), "sinh"];
447 | });
448 | break;
449 | // cosh (hyperbolic cosine function)
450 | case 33:
451 | cal.unaryOperate (function (si) {
452 | return [Math.cosh (si), "cosh"];
453 | });
454 | break;
455 | // tanh (hyperbolic cotangent function)
456 | case 34:
457 | cal.unaryOperate (function (si) {
458 | return [Math.tanh (si), "tanh"];
459 | });
460 | break;
461 | // π
462 | case 35:
463 | cal.unaryOperate (function (si) {
464 | return [Math.PI];
465 | });
466 | & Nb
467 | ```
468 |
469 | > This link: [http://www.hihubs.com/article/385](http://www.hihubs.com/article/385)
470 |
--------------------------------------------------------------------------------