CN106775826A - A kind of method and system of use note mode loading code file - Google Patents

A kind of method and system of use note mode loading code file Download PDF

Info

Publication number
CN106775826A
CN106775826A CN201611050662.5A CN201611050662A CN106775826A CN 106775826 A CN106775826 A CN 106775826A CN 201611050662 A CN201611050662 A CN 201611050662A CN 106775826 A CN106775826 A CN 106775826A
Authority
CN
China
Prior art keywords
code file
note
download
mode
browser
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201611050662.5A
Other languages
Chinese (zh)
Other versions
CN106775826B (en
Inventor
于立甫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201611050662.5A priority Critical patent/CN106775826B/en
Publication of CN106775826A publication Critical patent/CN106775826A/en
Application granted granted Critical
Publication of CN106775826B publication Critical patent/CN106775826B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present invention relates to browser application field, a kind of method of use note mode loading code file is disclosed, including:Step S1:Download code file to browser in and perform, wherein, have note defined in the code file be associated with other code files, in the note containing sensing associated code file download address;Step S2:Judge whether defined note in code file;Step S3:If so, in then downloading code file to the browser pointed by note and performing, step S2 is then back to, if it is not, then terminating.The invention also discloses a kind of system of use note mode loading code file.The present invention can effectively improve the speed that browser loads webpage.

Description

A kind of method and system of use note mode loading code file
Technical field
The present invention relates to browser application field, and in particular to a kind of method of use note mode loading code file and A kind of system of use note mode loading code file.
Background technology
Some code files are frequently necessary in the webpage of browser, as some are used for realizing that webpage dynamically waits other functions Javascript files, and some beautify the css files of webpage pattern.Generally, browser is in parsing javascript When file and css files, dependence is Webpage<script>With<link>Mark,<script>Browsed for informing Device needs to load javascript files,<link>For informing that browser needs to load css files.
But with the development of webpage diversification, the complexity of webpage also more and more higher, it is necessary to using substantial amounts of Function between javascript files and css files, and each javascript file or between each css file intersects, Realization such as certain function in a javascript file also needs to rely on certain function in another javascript file, Now must assure that that the javascript file being relied on is loaded, certain function of webpage could be realized, with each Relation is intricate between javascript files or css files, and using this kind of analysis mode, the ruin probabilty of browser is also big It is big to increase.
The content of the invention
For defect present in prior art, note mode loading code is used it is an object of the invention to provide one kind The method of file and a kind of system of use note mode loading code file, can effectively improve the speed that browser loads webpage Degree.
To achieve the above objectives, the present invention adopts the technical scheme that, including:
Step S1:Download in code file to browser and perform, wherein, the code that be associated with other code files is literary There is note defined in part, the download address for pointing to associated code file is contained in the note;
Step S2:Judge whether defined note in code file;
Step S3:If so, in then downloading code file to the browser pointed by note and performing, step is then back to S2, if it is not, then terminating.
On the basis of above-mentioned technical proposal, the code file includes javascript files and css files.
On the basis of above-mentioned technical proposal, the note includes the downloading mode of the code file pointed by note.
On the basis of above-mentioned technical proposal, the downloading mode includes synchronous download and asynchronous download.
On the basis of above-mentioned technical proposal, in step S1, code file is downloaded in browser with synchronous downloading mode.
On the basis of above-mentioned technical proposal, in step S3, before the code file pointed by explaining is downloaded, in note The downloading mode of code file is judged:
If synchronous download, then explain pointed code file and downloaded by the way of synchronously downloading;
If asynchronous download, then explain pointed code file and downloaded by the way of asynchronous download.
The invention also discloses a kind of system of use note mode loading code file, including:
Load-on module, it is used to download code file to browser;
Judge module, whether it is used to judge defined note in code file, if so, then the judge module is additionally operable to Controlled loading module is downloaded in code file to the browser pointed by explaining.
On the basis of above-mentioned technical proposal, the code file includes javascript files and css files.
On the basis of above-mentioned technical proposal, the note includes the downloading mode of code file and download address, described Downloading mode includes synchronous download and asynchronous download.
On the basis of above-mentioned technical proposal, the judge module is additionally operable to judge the download side of code file in note Formula, if synchronous download, then downloads the code file pointed by explaining, if asynchronous download, then by the way of synchronously downloading Code file pointed by being explained using the download of asynchronous downloading mode.
Compared with prior art, a kind of advantage of the method for use note mode loading code file of the invention is:Side Method management code file by the way of explaining, by the note defined in code file, is used to show when current code text Part upon execution, inform browser need to load other code files to coordinate current code realize webpage dynamic etc. its Its function, in considerably reducing webpage<script>Mark and<link>Mark, the relation between each code file is patrolled Collect also more clear, improve browser and load the speed of webpage, and reduce maintenance difficulties of the later stage to webpage, reduce out The workload of hair personnel.
A kind of advantage of the system of the method for use note mode loading code file of the invention is:By what is explained Mode management code file, judges the note in code file, loads the code file pointed by note, effectively improves clear Device of looking at loads the speed of webpage.
Brief description of the drawings
Fig. 1 is a kind of flow chart of the method for use note mode loading code file of the invention.
Specific embodiment
The present invention is described in further detail below in conjunction with accompanying drawing.
Shown in Figure 1, the present invention provides a kind of method of use note mode loading code file, for by browsing When device browses webpage, the subsidiary functional code file of browser loading webpage, in the present embodiment, code file includes Javascript files and css files, javascript files are used to realize the functions such as the dynamic of webpage, and css files are to real Now the function such as pattern of beautification website, after browser is downloaded javascript files and css files and parsed, just can realize net Some particular display functions of page.The method of the present invention includes:
Step S1:Download in code file to browser and perform, wherein, the code that be associated with other code files is literary There is note defined in part, containing the download address for pointing to associated code file in note, if specifically, a certain code file work( The realization of energy needs to rely on other code files, then the code file is associated with other code files, then in the code file Definition has note.The mode that code file is downloaded in browser includes synchronous download and asynchronous download, and synchronous download is when clear Device is look at when the down operation of file is carried out, now suspends other programs in browser, after file download is finished, other Program is further continued for performing;Asynchronous download is other programs in browser when browser is while file download operation is carried out Also can continue to perform simultaneously.In the step, the mode downloaded using synchronization is downloaded in code file to browser.
, when webpage is loaded, the javascript files not relied on by other javascript are to that should have one for browser <script>Mark,<script>Mark for informing that browser needs to download javascript files, not by other css files The css files for being relied on are to that should have one<link>Mark,<link>Mark is used to inform that browser needs to download css files.
<script>The complete form of mark is<Script src=" file addresses ">, src=" and file address " represent Should<script>Address where the corresponding javascript files of mark, when browser is in analyzing web page, recognizes webpage Entrained<script>During mark, the src on the mark will be matched, so as to obtain the address of javascript files, from And by javascript file downloads to browser.
<link>The complete form of mark is<Link href=" file addresses ">, href=" and file address " representing should< link>Address where the corresponding css files of mark, when browser is in analyzing web page, recognizes entrained by webpage<link >During mark, the href on the mark will be matched, so as to obtain the address of jcss files, so as to by css file downloads to browsing In device.
Step S2:Judge whether defined note in code file.
Note includes the downloading mode and download address of the code file pointed by note, specifically, explaining for right Javascript files or css files are managed, and note is generally present in the beginning portion of javascript files or css files Point, the composition of note includes:One is necessary "@" symbol, a necessary note title, an optional other information. Form shape is such as:
/**
*@dependson javascript or css file addresses 1
*@async
*@dependson javascript or css file addresses 2
*@dependson javascript or css file addresses 3
*/
* under the code file that@async are used for representing pointed by the@dependson of lower section need to be by the way of the asynchronous download Carry, if not having@async, the code file pointed by the@dependson of lower section needs to be downloaded by the way of synchronously downloading.
Step S3:If being explained without definition in code file, terminate;If there is note defined in code file, download Explain in pointed code file to browser and perform, be then back to step S2, and downloading the code pointed by explaining Before file, also need to judge the downloading mode of code file in note, if synchronous download, then explain pointed code File is downloaded by the way of synchronously downloading, if asynchronous download, then explains pointed code file using asynchronous download Mode is downloaded.
If specifically, being explained without definition in code file, terminating, i.e., code file is loaded into browser, is being held Without finding there is note defined in code file in capable process, then current code file terminates to code file after having performed Operation;If code file is loaded into browser, find there is note defined in code file during execution, then to explaining Parsed to obtain annotating information, if finding@async ,@in the annotating information in the annotating information that parsing is obtained The dependent file pointed by@dependson below async, that is, explaining pointed code file needs with asynchronous download Downloading mode is downloaded in browser, and the composition of@dependson is:@+note name+other information, by@dependson The interception of character string is carried out, the download address of code file is obtained, then browser reads the download address, with asynchronous download Mode is downloaded in code file to browser and performed, and then goes to step S2, is circulated, until no longer being sent out in code file Now definition has note, if not finding@async in the annotating information that parsing is obtained, the@below the annotating information Dependent file pointed by dependson, that is, explaining pointed code file needs to be downloaded with the synchronous downloading mode downloaded To in browser and perform, then go to step S2, be circulated, until no longer finding that definition has note in code file.
This method management code file by the way of explaining, by the note defined in code file, is used to show When current code file upon execution, inform that browser needs to load other code files to coordinate current code to realize net Some functions of page.If current code is upon execution, find there is note defined in code file, then load the generation pointed by note Performed in code file to browser, and judge whether contain note in the code file pointed by note, if so, then continuing to download Corresponding code file is performed and judged, is circulated successively, until code file is no longer containing explaining, then whole code file is held Row process terminates.
The mode of management code file by the way of explaining, the code file not relied on by other code files, i.e., Other code files need not be coordinated to realize the code file of some functions to that should have<script>Mark or<link>Mark, and phase Coordinate the code file for realizing some functions between mutually, latter codes' file has been free from<script>Mark or<link>Mark, The latter codes' file recorded to inform browser to need by the note of the former code file, so as to considerably reduce webpage In<script>Mark and<link>Mark, and logical relation between each associated code file is also more clear, Improve browser and load the speed of webpage, and reduce maintenance difficulties of the later stage to webpage, reduce the work of developer Amount.
Present invention additionally comprises a kind of system of the use note mode loading code file of use above method, the system bag Include load-on module and judge module.
Load-on module is used to download code file to browser;Whether judge module is used to judge defined in code file Explain, if so, then judge module is additionally operable in code file to the browser that controlled loading module is downloaded pointed by note.
Code file includes javascript files and css files, and note includes the downloading mode of code file and download Address, downloading mode includes that synchronous download is additionally operable to the download side of code file during judgement is explained with asynchronous download, judge module Formula, if synchronous download, then downloads the code file pointed by explaining, if asynchronous download, then by the way of synchronously downloading Code file pointed by being explained using the download of asynchronous downloading mode.
The management code file by way of explaining, judges the note in code file, loads pointed by explaining Code file, effectively improves the speed that browser loads webpage.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from On the premise of the principle of the invention, some improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention Within the scope of.The content not being described in detail in this specification belongs to prior art known to professional and technical personnel in the field.

Claims (10)

1. a kind of method of use note mode loading code file, it is characterised in that including:
Step S1:Download code file to browser in and perform, wherein, in the code file being associated with other code files Definition has note, and the download address for pointing to associated code file is contained in the note;
Step S2:Judge whether defined note in code file;
Step S3:If so, in then downloading code file to the browser pointed by note and performing, step S2 is then back to, if It is no, then terminate.
2. a kind of method of use note mode loading code file as claimed in claim 1, it is characterised in that:The code File includes javascript files and css files.
3. a kind of method of use note mode loading code file as claimed in claim 1, it is characterised in that:The note Downloading mode including the code file pointed by note.
4. a kind of method of use note mode loading code file as claimed in claim 3, it is characterised in that:The download Mode includes synchronous download and asynchronous download.
5. a kind of method of use note mode loading code file as claimed in claim 4, it is characterised in that:Step S1 In, code file is downloaded in browser with synchronous downloading mode.
6. a kind of method of use note mode loading code file as claimed in claim 4, it is characterised in that:Step S3 In, before the code file pointed by explaining is downloaded, the downloading mode to code file in note judges:
If synchronous download, then explain pointed code file and downloaded by the way of synchronously downloading;
If asynchronous download, then explain pointed code file and downloaded by the way of asynchronous download.
7. a kind of system of the use note mode loading code file based on claim 1 methods described, it is characterised in that bag Include:
Load-on module, it is used to download code file to browser;
Judge module, whether it is used to judge defined note in code file, if so, then the judge module is additionally operable to control Load-on module is downloaded in code file to the browser pointed by explaining.
8. a kind of system of use note mode loading code file as claimed in claim 7, it is characterised in that:The code File includes javascript files and css files.
9. a kind of system of use note mode loading code file as claimed in claim 7, it is characterised in that:The note Downloading mode and download address including code file, the downloading mode include synchronous download and asynchronous download.
10. a kind of system of use note mode loading code file as claimed in claim 7, it is characterised in that:It is described to sentence Disconnected module is additionally operable to judge the downloading mode of code file in note, if synchronous download, then under by the way of synchronously downloading The code file pointed by note is carried, if asynchronous download, then using the code pointed by explaining of downloading of asynchronous downloading mode File.
CN201611050662.5A 2016-11-22 2016-11-22 Method and system for loading code file by annotation mode Active CN106775826B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611050662.5A CN106775826B (en) 2016-11-22 2016-11-22 Method and system for loading code file by annotation mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611050662.5A CN106775826B (en) 2016-11-22 2016-11-22 Method and system for loading code file by annotation mode

Publications (2)

Publication Number Publication Date
CN106775826A true CN106775826A (en) 2017-05-31
CN106775826B CN106775826B (en) 2020-12-15

Family

ID=58912756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611050662.5A Active CN106775826B (en) 2016-11-22 2016-11-22 Method and system for loading code file by annotation mode

Country Status (1)

Country Link
CN (1) CN106775826B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170756A (en) * 2017-12-22 2018-06-15 南京邮电大学 The implementation method of various dimensions, various visual angles and visualization annotation system based on Git warehouses
CN108228231A (en) * 2018-01-08 2018-06-29 南京邮电大学 A kind of visualization shift algorithm of Git warehouses file annotation system
CN112784270A (en) * 2021-01-18 2021-05-11 仙境文化传媒(武汉)有限公司 System and method for loading code file by annotation mode

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1808439A (en) * 2006-02-21 2006-07-26 西安迪戈科技有限责任公司 Method of adding searchable deep labels in web pages in conjunction with browser plug-ins and scripts
US20090132949A1 (en) * 2007-11-16 2009-05-21 Jason Bosarge Methods and systems for transmitting, receiving and annotating internet content
US20120257249A1 (en) * 2011-04-08 2012-10-11 Sundaram Natarajan Cloud and html based fax and document management system
CN104317941A (en) * 2014-10-31 2015-01-28 新华瑞德(北京)网络科技有限公司 Resource injection method and device of applications
CN105677326A (en) * 2015-12-28 2016-06-15 国云科技股份有限公司 Software interface parameter validation method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1808439A (en) * 2006-02-21 2006-07-26 西安迪戈科技有限责任公司 Method of adding searchable deep labels in web pages in conjunction with browser plug-ins and scripts
US20090132949A1 (en) * 2007-11-16 2009-05-21 Jason Bosarge Methods and systems for transmitting, receiving and annotating internet content
US20120257249A1 (en) * 2011-04-08 2012-10-11 Sundaram Natarajan Cloud and html based fax and document management system
CN104317941A (en) * 2014-10-31 2015-01-28 新华瑞德(北京)网络科技有限公司 Resource injection method and device of applications
CN105677326A (en) * 2015-12-28 2016-06-15 国云科技股份有限公司 Software interface parameter validation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
何明贵 刘莉 冯先成 孙睿 编著: "《Web技术原理与应用》", 31 July 2016, 西南师范大学出版社 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170756A (en) * 2017-12-22 2018-06-15 南京邮电大学 The implementation method of various dimensions, various visual angles and visualization annotation system based on Git warehouses
CN108170756B (en) * 2017-12-22 2021-12-03 南京邮电大学 Implementation method of multidimensional, multi-view and visual annotation system based on Git warehouse
CN108228231A (en) * 2018-01-08 2018-06-29 南京邮电大学 A kind of visualization shift algorithm of Git warehouses file annotation system
CN108228231B (en) * 2018-01-08 2021-07-27 南京邮电大学 Visualization drifting method of Git warehouse file annotation system
CN112784270A (en) * 2021-01-18 2021-05-11 仙境文化传媒(武汉)有限公司 System and method for loading code file by annotation mode

Also Published As

Publication number Publication date
CN106775826B (en) 2020-12-15

Similar Documents

Publication Publication Date Title
US20220318336A1 (en) Method and Terminal Device for Extracting Web Page Content
CN105824787B (en) A kind of control method and system of html template dynamic configuration
CN102200971B (en) Method and equipment for realizing webpage content previewing
CN104461484B (en) The implementation method and device of front-end template
CN104461412B (en) Web page designated area Method of printing and system
CN102096581B (en) Method and device for generating widget
CN104035753A (en) Double-WebView customized page display method and system
CN105094786A (en) Method and system for customizing page based on JavaScript
CN102663050B (en) Method and device for processing electronic book data
CN106775826A (en) A kind of method and system of use note mode loading code file
CN103383691B (en) A kind of online editing method and apparatus of webpage
US10528688B1 (en) System and method for schematic-driven generation of input/output models
CN103412857A (en) System and method for realizing Chinese-English translation of webpage
CN103678698A (en) Method and device for improving on-line browsing loading speed of PDF document
CN108052539A (en) A kind of browser page switching method and browser
CN104376061B (en) A kind of method for extracting Web page text
CN108804469A (en) A kind of web page identification method and electronic equipment
CN109445773A (en) A kind of language based on programming promotes the method and electronic equipment of browser performance
CN109683890A (en) The modular method, apparatus of cascading style sheets, storage medium and equipment
CN105068802A (en) Cross device running Web application software implementation system and method
CN108037915A (en) A kind of method and terminal of acquisition json configuration files
CN102955852A (en) Method, device and equipment for webpage resource processing
CN110347390A (en) A kind of method quickly generating WEB page, storage medium, equipment and system
CN103309741B (en) Call the method and apparatus of pin function
CN105022667A (en) Embedded browser CSS (Cascading Style Sheets) based engine parallelization method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant