Three ways to solve Android help document open slowly

Source: Internet
Author: User

This is because the local documents in the page has the following two-segment JS code will be networked loading information, comments out after it is good

<link rel= "stylesheet" href= "Http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic, Mediumitalic,bold "title=" Roboto ">

<script src= "Http://www.google.com/jsapi" type= "Text/javascript" ></script>

Use the following Java code to bulk annotate

/* * Remove JavaScript code that requires networking in Android documents */import Java.io.bufferedreader;import Java.io.bufferedwriter;import java.io.File ; Import Java.io.filenotfoundexception;import Java.io.filereader;import Java.io.filewriter;import    Java.io.ioexception;public class Formatdoc {public static int j=1; /** * @param args */public static void main (string[] args) {File file = new file ("d:/android/a        Ndroid-sdk-windows/docs/");        Searchdirectory (file, 0);    System.out.println ("over"); } public static void Searchdirectory (File f, int depth) {if (!f.isdirectory ()) {String fileName = f            . GetName (); if (Filename.matches (". *.{ 1}html ")) {String src= < (link rel) [=]\" (stylesheet) \ "\ n (HREF) [=]\] (HTTP)://(FONTS.GOOGLEAPIS.COM/CSS) [ ?] (family) [=] (Roboto) [:]                (Regular,medium,thin,italic,mediumitalic,bold) \ "(title) [=]\" roboto\ ">"; String src1 = "<script src=\" http://www.google.com/jsapi\ "type=\" Text/javascript\ "></script>";                String DST = "";                If it is an HTML file, comment out the specific JavaScript code annotation (f, SRC, DST);            Annotation (f, src1, DST);            }} else {file[] fs = F.listfiles ();            depth++;                for (int i = 0; i < fs.length; ++i) {File file = Fs[i];            Searchdirectory (file, depth); }}}//* F to modify the contents of the file * src will be replaced content * DST will be replaced with the content of the layer */public static void annotation (File F, string src, string dst)        {String content = Formatdoc.read (f);        Content = Content.replacefirst (src, DST);        int Ll=content.lastindexof (SRC);        System.out.println (LL);        Formatdoc.write (content, f);        System.out.println (j + +);    Return        public static String read (File src) {stringbuffer res = new StringBuffer ();        String line = null; try {BufferedReader reader = new BufferedreadER (new FileReader (SRC));            int i=0;                while (line = Reader.readline ()) = null) {if (i!=0) {res.append (' \ n ');                } res.append (line);            i++;        } reader.close ();        } catch (FileNotFoundException e) {e.printstacktrace ();        } catch (IOException e) {e.printstacktrace ();    } return res.tostring (); public static Boolean write (String cont, File Dist) {try {bufferedwriter writer = new Bufferedwri            ter (new FileWriter (Dist));            Writer.write (cont);            Writer.flush ();            Writer.close ();        return true;            } catch (IOException e) {e.printstacktrace ();        return false; }    }}

Online there is a way to remove the line of JS code through the shell, very simple and convenient, 100 times times more convenient than the Java above, but can not delete the first section JS code

Find. -name "*.html" |xargs grep-l "Jsapi" |xargs sed-i '/jsapi/d '

The other way is to break the net, or use Ie,firefox offline browsing

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.