{"id":1422,"date":"2021-08-15T21:06:29","date_gmt":"2021-08-15T13:06:29","guid":{"rendered":"http:\/\/diuut.com\/?p=1422"},"modified":"2021-08-29T06:00:22","modified_gmt":"2021-08-28T22:00:22","slug":"f12-console%e6%89%93%e5%8d%b0%e5%bd%a9%e8%89%b2%e5%9b%be%e7%94%bb","status":"publish","type":"post","link":"https:\/\/diuut.com\/?p=1422","title":{"rendered":"console\u63a7\u5236\u53f0\u6253\u5370\u81ea\u5b9a\u4e49\u6837\u5f0f\u56fe\u6848"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote\"><p>\u9700\u6c42\uff1a<\/p><cite><strong>F12\u63a7\u5236\u53f0\u6253\u5370\u5f69\u8272\u81ea\u5b9a\u4e49\u56fe\u7247<\/strong><\/cite><\/blockquote>\n\n\n\n<p>\u5b9e\u73b0\u662f\u4f2a\u5b9e\u73b0\uff0c\u8fd8\u5f97\u57fa\u4e8e\u522b\u4eba\u7684\u7a0b\u5e8f\u628a\u56fe\u7247\u8f6c\u6362\u6210\u5b57\u7b26\u5316\u4ee5\u540e\u81ea\u5df1\u518d\u8f6c\u6362\u6210console\u5c55\u793a\u3002\u4ee5\u4e0b\u63cf\u8ff0\u5b9e\u73b0\u65b9\u5f0f\u3002<\/p>\n\n\n\n<p><a href=\"http:\/\/life.chacuo.net\/convertphoto2char\">\u56fe\u7247\u8f6c\u5b57\u7b26\u5316\u7f51\u7ad9<\/a><\/p>\n\n\n\n<p>\u5148\u53bb\u8be5\u7f51\u7ad9\u4e0a\u5c06\u81ea\u5df1\u56fe\u7247\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\uff0c\u7136\u540eF12\u53bb\u62ff\u5230\u4ed6\u7684html\u683c\u5f0f\u6837\u5f0f\u6587\u4ef6<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img src=\"https:\/\/blog-diuut-xyz.oss-cn-beijing.aliyuncs.com\/image\/2021\/8\/20210815205151.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u62ff\u5230\u8be5\u6bb5\u6837\u5f0f\u6587\u4ef6 copy Element\uff0c\u590d\u5236\u5230\u672c\u5730\u4e00\u4e2atxt\u6587\u4ef6\u4e2d\u3002<br>\u5c06\u8be5\u6bb5\u6837\u5f0fUedit\u6216\u8005\u5176\u4ed6\u6587\u672c\u8f6f\u4ef6\u4e2d\uff0c\u8fdb\u884cXML\u683c\u5f0f\u5316\u3002\u7136\u540e\u53bb\u6389\u5934\u5c3e\u7684&lt;div>&lt;\/div>\u6807\u7b7e\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img src=\"https:\/\/blog-diuut-xyz.oss-cn-beijing.aliyuncs.com\/image\/2021\/8\/20210815205429.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>\u7136\u540e\u5230\u5199\u7684\u4e00\u4e2a\u5de5\u5177\u7c7b\u4e2d\u8dd1\u4e00\u4e0b\uff0c\u5f97\u5230console\u7248\u672c\u7684\u6253\u5370\u4ee3\u7801\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; title: ; notranslate\" title=\"\">\npackage xyz.diuut;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.List;\n\n\/**\n * @Author Diuut\n * @Date 2020\/8\/15  19:32\n *\/\npublic class consoleUtil {\n\n    \/\/console\u6253\u5370\u56fe\u753b\n\n    public static void main(String&#91;] args) {\n        \/\/\u6b64\u5904\u5c31\u662f\u5904\u7406\u4e86\u5934\u5c3e\u7684txt\u6837\u5f0f\u6587\u4ef6\n        List&lt;String&gt; strList = getList(&quot;C:\\\\Users\\\\82425\\\\Desktop\\\\test.txt&quot;);\n        StringBuilder result = new StringBuilder();\n        StringBuilder temp3 = new StringBuilder();\n        for (String s : strList) {\n            if (!s.contains(&quot;&lt;br&gt;&quot;)) {\n                temp3.append(s + &quot;&amp;&amp;&quot;);\n            }\n            if (s.contains(&quot;&lt;br&gt;&quot;)) {\n                if (temp3 == null) {\n                    continue;\n                }\n                String consoleStr = getConsoleStr(temp3.toString());\n                result.append(consoleStr);\n                temp3 = new StringBuilder();\n            }\n        }\n        System.out.println(result);\n        \/\/\u8fd9\u91cc\u53ef\u4ee5\u8f93\u5165\u5230\u6587\u4ef6\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u76f4\u63a5\u63a7\u5236\u53f0\u53d6\uff0c\u6211\u5077\u61d2\u76f4\u63a5\u63a7\u5236\u53f0\u590d\u5236\u5f97\u4e86\u3002\n    }\n\n    public static String getConsoleStr(String strr) {\n        List&lt;String&gt; urlList = Arrays.asList(strr.split(&quot;&amp;&amp;&quot;));\n        List colorList = new LinkedList();\n        List strList = new LinkedList();\n\n        for (String s : urlList) {\n            int index1 = s.indexOf('&quot;');\n            if (s.length() &lt; 14) {\n                continue;\n            }\n            String color = s.substring(index1 + 1, index1 + 8);\n            colorList.add(color);\n            int index2 = s.indexOf('&gt;');\n            int index3 = s.indexOf(&quot;&lt;\/&quot;);\n            String str = s.substring(index2 + 1, index3);\n            strList.add(str);\n        }\n        String perString = &quot;console.log(&quot;;\n        String endString = &quot;);&quot;;\n        String andString = &quot;,&quot;;\n        StringBuilder colorString = new StringBuilder();\n        StringBuilder strString = new StringBuilder();\n        StringBuilder sumStr = new StringBuilder();\n        for (int i = 0; i &lt; colorList.size(); i++) {\n            String tempStr1 = (String) colorList.get(i);\n            String tempStr2 = (String) strList.get(i);\n            if (i != colorList.size() - 1) {\n                colorString.append(&quot;\\&quot;color:&quot; + tempStr1 + &quot;\\&quot;,&quot;);\n                sumStr.append(&quot;\\&quot;%c&quot; + tempStr2 + &quot;\\&quot;+&quot;);\n            } else {\n                colorString.append(&quot;\\&quot;color:&quot; + tempStr1 + &quot;\\&quot;&quot;);\n                sumStr.append(&quot;\\&quot;%c&quot; + tempStr2 + &quot;\\&quot;&quot;);\n            }\n        }\n        String result = perString + sumStr + andString + colorString + endString;\n        return result;\n    }\n\n    \/**\n     * \u6839\u636e\u8def\u5f84\u6587\u4ef6\u751f\u6210\u5217\u8868\n     *\n     * @param path \u5730\u5740\n     * @return\n     *\/\n    public static List&lt;String&gt; getList(String path) {\n        File listFile = new File(path);\n        List&lt;String&gt; urlList = new ArrayList&lt;String&gt;();\n        if (listFile.exists()) {\n            try {\n                urlList = Files.readAllLines(listFile.toPath());\n            } catch (IOException ex) {\n                ex.printStackTrace();\n            }\n            if (urlList.isEmpty()) {\n                System.out.println(&quot;\u8def\u5f84\u6587\u4ef6\u751f\u6210\u4e3a\u7a7a&quot;);\n                return null;\n            }\n        }\n        return urlList;\n    }\n}\n<\/pre><\/div>\n\n\n<p>\u5c06\u683c\u5f0f\u5316\u540e\u7684\u4ee3\u7801\u590d\u5236\u4e0b\u6765,\u5efa\u8bae\u518d\u5c06\u4ee3\u7801\u6839\u636econsole.log\u8fdb\u884c\u6362\u884c\u66ff\u6362^pconsole.log\uff08^p \u6362\u884c\u7b26\uff09\uff0c\u4ee5\u514d\u4e00\u884c\u5185\u5bb9\u8fc7\u591a\u7f16\u8f91\u5668\u65e0\u6cd5\u6b63\u5e38\u5c55\u793a\u3002\u7136\u540e\u5c31\u53ef\u4ee5\u53bb\u81ea\u5df1\u60f3\u8981\u5c55\u793a\u7684\u9875\u9762\u4e0a\u6253\u5370\u4e86\uff0c\u5934\u5c3e\u8981\u5305\u4e00\u4e0b<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;script type=&quot;text\/javascript&quot; language=&quot;javascript&quot;&gt;\n\tif(window.console&amp;&amp;window.console.log){\n     &lt;!--\u4e2d\u95f4\u5c31\u5c06\u4e0a\u9762\u683c\u5f0f\u5316\u5f97\u5230\u7684\u4ee3\u7801\u590d\u5236\u8fdb\u6765-&gt;\n     console.log(&quot;%c00&quot;,&quot;color:#FDFDFD&quot;);\n     &lt;!--\u4e2d\u95f4\u5c31\u5c06\u4e0a\u9762\u683c\u5f0f\u5316\u5f97\u5230\u7684\u4ee3\u7801\u590d\u5236\u8fdb\u6765--&gt;\n    }\n&lt;\/script&gt;\n<\/pre><\/div>\n\n\n<p>\u5176\u5b9e\u5b9e\u73b0\u6253\u5370\u5f88\u7b80\u5355\uff0c\u76f4\u63a5\u5199\u90fd\u53ef\u4ee5\uff0c\u4f46\u56fe\u7247\u7684\u8bdd\u8272\u5f69\u4e30\u5bcc\uff0c\u5de5\u4f5c\u91cf\u592a\u5927\u4e86\uff0c\u4f5c\u4e3a\u7a0b\u5e8f\u5458\u5c31\u6ca1\u5fc5\u8981\u505a\u90a3\u79cd\u91cd\u590d\u65e0\u8111\uff0c\u4fbf\u5199\u4e00\u4e2a\u7c7b\u5904\u7406\u4e0b\uff0c\u867d\u7136\u53ef\u80fd\u5176\u4ed6\u5730\u65b9\u6ca1\u4ec0\u4e48\u7528\uff0c\u4e5f\u6ca1\u4ec0\u4e48\u5b66\u4e60\u610f\u4e49\uff0c\u6216\u8bb8\uff0c\u8fd9\u5c31\u662f\u5feb\u4e50\u5427\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9700\u6c42\uff1a F12\u63a7\u5236\u53f0\u6253\u5370\u5f69\u8272\u81ea\u5b9a\u4e49\u56fe\u7247 \u5b9e\u73b0\u662f\u4f2a\u5b9e\u73b0\uff0c\u8fd8\u5f97\u57fa\u4e8e\u522b\u4eba\u7684\u7a0b\u5e8f\u628a\u56fe\u7247\u8f6c\u6362\u6210\u5b57\u7b26\u5316\u4ee5\u540e\u81ea\u5df1\u518d\u8f6c\u6362\u6210co<span class=\"more-button\"><a href=\"https:\/\/diuut.com\/?p=1422\" class=\"more-link\">view all . . .<span class=\"screen-reader-text\">console\u63a7\u5236\u53f0\u6253\u5370\u81ea\u5b9a\u4e49\u6837\u5f0f\u56fe\u6848<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":1424,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[41,42],"_links":{"self":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1422"}],"collection":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1422"}],"version-history":[{"count":4,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1422\/revisions"}],"predecessor-version":[{"id":1435,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/posts\/1422\/revisions\/1435"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=\/wp\/v2\/media\/1424"}],"wp:attachment":[{"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/diuut.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}