CN104007963B - The method and apparatus for generating the skin file of browser readable - Google Patents

The method and apparatus for generating the skin file of browser readable Download PDF

Info

Publication number
CN104007963B
CN104007963B CN201410188879.7A CN201410188879A CN104007963B CN 104007963 B CN104007963 B CN 104007963B CN 201410188879 A CN201410188879 A CN 201410188879A CN 104007963 B CN104007963 B CN 104007963B
Authority
CN
China
Prior art keywords
document element
group
file
document
skin
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.)
Active
Application number
CN201410188879.7A
Other languages
Chinese (zh)
Other versions
CN104007963A (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.)
Beijing Liebao Network Technology Co Ltd
Original Assignee
Beijing Liebao 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 Beijing Liebao Network Technology Co Ltd filed Critical Beijing Liebao Network Technology Co Ltd
Priority to CN201410188879.7A priority Critical patent/CN104007963B/en
Publication of CN104007963A publication Critical patent/CN104007963A/en
Application granted granted Critical
Publication of CN104007963B publication Critical patent/CN104007963B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention proposes a kind of method and apparatus for the skin file for generating browser readable, the method of the skin file of the generation browser readable includes obtaining first group of document element, first group of document element includes obtaining document element after the skin file parsing to the first form, and the skin file of first form is the skin file of designer's design;Second group of document element is obtained, second group of document element includes the document element obtained after being parsed to browser prototype;Processing is combined to first group of document element and second group of document element, the file after being combined;The skin file of the second form is obtained according to the file after the combination, the skin file of second form is the skin file of browser readable.This method can realize that the skin file designed by designer, to the automatic conversion of the skin file of browser readable, reduces cost of labor, realize procedure and the systematization of the conversion of skin file form.

Description

The method and apparatus for generating the skin file of browser readable
Technical field
The present invention relates to network communication technology field, more particularly to a kind of method for the skin file for generating browser readable And device.
Background technology
In order to provide more preferable Consumer's Experience, many browsers, which are both provided, at present changes skin function.In correlation technique, generally It is that designer first designs browser skin, then gives the code that programmer is written as browser readable, to be in a browser The skin of existing designer's design.
This mode needs constantly to link up between designer and programmer, it is necessary to which artificial operation and intervention, are realized cumbersome.
The content of the invention
It is contemplated that at least solving one of technical problem in correlation technique to a certain extent.
Therefore, it is an object of the present invention to propose a kind of method for the skin file for generating browser readable, the party Method can realize the skin file that is designed by designer to the automatic conversion of the skin file of browser readable, reduction it is artificial into This, realizes procedure and the systematization of skin file form conversion.
It is another object of the present invention to propose a kind of device for the skin file for generating browser readable.
To reach above-mentioned purpose, the side of the skin file for the generation browser readable that first aspect present invention embodiment is proposed Method, including:First group of document element is obtained, first group of document element is obtained after including the skin file parsing to the first form To document element, the skin file of first form is the skin file of designer's design;Obtain second group of document element, institute State the document element that second group of document element includes obtaining after parsing browser prototype;To first group of document element and institute State second group of document element and be combined processing, the file after being combined;Second lattice are obtained according to the file after the combination The skin file of formula, the skin file of second form is the skin file of browser readable.
The method of the skin file for the generation browser readable that first aspect present invention embodiment is proposed, by obtaining first Group document element and second group of document element, and processing is combined to first group of document element and second group of document element, can Skin file present in browser prototype is replaced with the document element for designing designer, and then generates the skin of browser readable Skin file, so as to realize that the skin file designed by designer, to the automatic conversion of the skin file of browser readable, reduces people Work cost, realizes procedure and the systematization of skin file form conversion.
To reach above-mentioned purpose, the dress of the skin file for the generation browser readable that second aspect of the present invention embodiment is proposed Put, including:First acquisition module, for obtaining first group of document element, first group of document element is included to the first form Skin file parsing after obtain document element, the skin file of first form is the skin file of designer's design;The Two acquisition modules, for obtaining second group of document element, second group of document element includes obtaining after parsing browser prototype The document element arrived;Composite module, for being combined place to first group of document element and second group of document element Reason, the file after being combined;Generation module, the skin file for obtaining the second form according to the file after the combination, The skin file of second form is the skin file of browser readable.
The device of the skin file for the generation browser readable that second aspect of the present invention embodiment is proposed, by obtaining first Group document element and second group of document element, and processing is combined to first group of document element and second group of document element, can Skin file present in browser prototype is replaced with the document element for designing designer, and then generates the skin of browser readable Skin file, so as to realize that the skin file designed by designer, to the automatic conversion of the skin file of browser readable, reduces people Work cost, realizes procedure and the systematization of skin file form conversion.
To reach above-mentioned purpose, the client device that third aspect present invention embodiment is proposed, including:Housing, processor, Memory, circuit board and power circuit, wherein, circuit board is placed in the interior volume that housing is surrounded, and processor and memory are set Put on circuit boards;Power circuit, for being powered for each circuit or device of client device;Memory is used to store and can hold Line program code;The executable program code that processor is stored by reading in memory is run and executable program code pair The program answered, for performing following steps:First group of document element is obtained, first group of document element is included to the first lattice Document element is obtained after the skin file parsing of formula, the skin file of first form is the skin file of designer's design; Second group of document element is obtained, second group of document element includes the document element obtained after being parsed to browser prototype;It is right First group of document element and second group of document element are combined processing, the file after being combined;According to described File after combination obtains the skin file of the second form, and the skin file of second form is the skin text of browser readable Part.
The client device that third aspect present invention embodiment is proposed, by obtaining first group of document element and second group of text Part element, and processing is combined to first group of document element and second group of document element, the file that designer can be designed Element replaces skin file present in browser prototype, and then generates the skin file of browser readable, so as to realize by setting The skin file of teacher's design is counted to the automatic conversion of the skin file of browser readable, cost of labor is reduced, realizes skin file The procedure of form conversion and systematization.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partly become from the following description Obtain substantially, or recognized by the practice of the present invention.
Brief description of the drawings
Of the invention above-mentioned and/or additional aspect and advantage will become from the following description of the accompanying drawings of embodiments Substantially and be readily appreciated that, wherein:
Fig. 1 is the schematic flow sheet of the method for the skin file for the generation browser readable that one embodiment of the invention is proposed;
Fig. 2 is the schematic diagram of figure layer that includes of skin file of PSD forms in the embodiment of the present invention;
Fig. 3 is the flow signal of the method for the skin file for the generation browser readable that another embodiment of the present invention is proposed Figure;
Fig. 4 is the schematic flow sheet of combined treatment in the embodiment of the present invention;
Fig. 5 is the structural representation of the device of the skin file for the generation browser readable that another embodiment of the present invention is proposed Figure;
Fig. 6 is the structural representation of the device of the skin file for the generation browser readable that another embodiment of the present invention is proposed Figure.
Embodiment
Embodiments of the invention are described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to end Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached The embodiment of figure description is exemplary, is only used for explaining the present invention, and is not considered as limiting the invention.On the contrary, this All changes in the range of spirit and intension that the embodiment of invention includes falling into attached claims, modification and equivalent Thing.
Fig. 1 is the schematic flow sheet of the method for the skin file for the generation browser readable that one embodiment of the invention is proposed, This method includes:
S11:First group of document element is obtained, first group of document element includes parsing the skin file of the first form After obtain document element, the skin file of first form is the skin file of designer's design.
Wherein, the skin file of the first form can refer to the skin file of PSD forms.
The skin file of PSD forms is made up of multiple figure layers.
For example, with reference to Fig. 2, the skin file 20 of PSD forms can include Background From Layer 21 and module figure layer 22, module map Layer 22 can include back, forwarding button, refresh button, maximization button, minimum button and X button etc..Specifically , each figure layer can be made up of pattern, color and word etc..
First group of document element can refer to that the skin file of the PSD forms designed designer obtained after figure layer parsing The one group of document element arrived.For example, first group of document element includes back, forwarding button and the refreshing that designer designs Button etc..
S12:Second group of document element is obtained, second group of document element includes what is obtained after being parsed to browser prototype Document element.
Wherein, designer is that the browser prototype based on setting is designed when designing browser skin, for example, clear Look at and name, size of each module etc. are specified in device prototype, designer can be designed according to this.Wherein, designer is in design Need to continue to use the module name specified in browser prototype, for example, back described in browser prototype is named as The module figure layer, can be named as " BACK " by " BACK " when designer moves back button after design.For size, designer can be with Design is different from the size in prototype, for example, for back, the size in browser prototype is size _ 1, and designer can To be designed to size _ 2.
Specifically, browser prototype includes that in its inventory file (mainfest.json), the inventory file phase can be recorded The information for each document element that browser prototype includes is answered, can be with by reading the inventory file for example, name, size etc. Obtain second group of document element.
S11 and S12 is without sequential restriction relation.
S13:Processing is combined to first group of document element and second group of document element, after being combined File.
Wherein, if designer devises some document element in browser prototype, the replacement designed with designer Corresponding document element in browser prototype, it is, of course, understood that in the document element needs and browser prototype replaced Document element name it is identical with size, replacement after size can be adjusted when size is different.For example, designer devises one New back, the size of back of the size of the new back with being recorded in browser prototype is identical, then uses The back of designer's design replaces the back recorded in browser prototype.By that analogy, the text designed with designer Part element is replaced in browser prototype after corresponding document element, it is possible to the file after being combined.
S14:The skin file of the second form, the skin file of second form are obtained according to the file after the combination It is the skin file of browser readable.
Wherein, the skin file of the second form can refer to the skin file of CRX forms.
The file of CRX forms is the zip compressed packages of a special format, the various configuration statements comprising similar .json, with And substantial amounts of picture file, then it is encrypted according to overall data, and the signature of Chrome demand of technical standard is included, The head of zip file writes special data, is packed in other words so as to complete legal generation.
Therefore, with least part file member after at least part document element in first group of document element or adjustment Element, is replaced after the corresponding document element in second group of document element, it is possible to according to the inventory file of browser prototype (maintfest.json) index picture file, (generates), obtains in other words after all picture files of index are packed The skin file of CRX forms.
The present embodiment is by obtaining first group of document element and second group of document element, and to first group of document element and the Two groups of document elements are combined processing, and the document element that can design designer replaces skin present in browser prototype File, and then the skin file of browser readable is generated, so as to realize the skin file that is designed by designer to browser readable Skin file automatic conversion, reduce cost of labor, realize skin file form conversion procedure and systematization.
Fig. 3 is the flow signal of the method for the skin file for the generation browser readable that another embodiment of the present invention is proposed Figure, this method includes:
S31:Designer designs browser skin, obtains the skin file of PSD forms.
Wherein, designer can carry out browser skin design with photoshop, to generate the skin file of PSD forms.
S32:Figure layer resolver carries out figure layer parsing to the skin file of the PSD forms.
Wherein, figure layer resolver can be local file, realize file local parsing;Or designer can pass through network The skin file of PSD forms is uploaded to the equipment for including figure layer resolver.
Figure layer resolver has the function that figure layer parsing is carried out to the file of PSD forms, to realize what designer was designed The figure layer parsing of the browser skin file of PSD forms.
Parsed by figure layer, can obtain constituting each figure layer of the skin file of PSD forms, for example, obtaining designer Background, back, forwarding button and refresh button of design etc..
S33:Each figure layer that figure layer resolver is obtained is stored in the file of setting by pel follower.
Wherein it is possible to preset a file, this document is pressed from both sides for preserving the figure layer obtained after parsing.
When stored, pel follower can one by one be protected according to configuration set in advance to each figure layer after parsing Deposit, configuration set in advance can be the value of pel name-picture to relation, wherein, pel name value it is identical with the name of figure layer, The value of picture can be specially the storing path of the picture.
For example, the figure layer obtained after parsing includes background, back and forwarding button, configuration set in advance includes: Background-path _ 1, back-path _ 2, forwarding button-path _ 3, then, background can be stored in what path _ 1 was specified Position, the position that path _ 2 are specified is stored in by back, and forwarding button is stored in into the position that path _ 3 are specified.
S34:Obtain browser prototype.
Wherein, browser prototype is referred to as extending prototype.
The each browser of correspondence, can all have a browser prototype, so that designer is designed based on this.
S35:Extension resolver is parsed to browser prototype.
Remember wherein it is possible to be extracted from browser prototype in mainfest.json files, the mainfest.json files The information of each document element in browser prototype is recorded, for example, name, size of each file etc..Pass through parsing, it is possible to obtain Take the document element in browser prototype.
S31-33 and S34-S35 is without sequential restriction relation.
S36:Patterned sets device is to the document element that is preserved in pel follower, and the file member that extension resolver is obtained Element is combined processing.
Referring to Fig. 4, the flow of combined treatment can include:
S401:Second document element is selected, wherein, the second document element is obtained after being parsed to browser prototype The document element arrived.
Wherein it is possible to be one the second document element of random selection, or, it is to select second document element successively.
S402:Default file is traveled through, judges whether to name identical one first with second document element Document element, if so, performing S404, otherwise, performs S403, wherein, the first document element is that the file that designer designs is entered The document element obtained after row parsing.
S403:Keep the second document element constant.
That is, when designer does not design respective element, with the element given tacit consent in browser prototype.For example, designer does not have There is design back, that is just using the back given tacit consent in browser prototype.
S404:The first document element born the same name is judged whether, if so, performing S405, S406 is otherwise performed.
For example, for back, designer may devise multiple, and the plurality of back is located at different layerings On.
S405:Using the first document element of the superiors in duplication of name.
Wherein, due to the superiors be typically it is newest, it is therefore, last as designer using the document element of the superiors The document element of design.
S406:Judge whether the size of first document element is identical with the ability size of the second document element, if so, performing S408, otherwise performs S407.
S407:Adjust the size of the first document element so that the size after adjustment is identical with the size of the second document element.
For example, when the size of the first document element is more than the size of the second document element, can be by the first document element Scaled down to identical with the size of the second document element, or, when the size of the first document element is less than the second file member During the size of element, the first document element equal proportion can be amplified to identical with the size of the second document element.
S408:Replaced with the first document element and name the identical and document element of size identical second.
For example, the back of designer's design is identical with the name of back in browser prototype and size is identical, The back then designed with designer replaces the back in browser prototype.
S409:Nonoptional second document element is judged whether, if so, repeating S401 and its follow-up step Suddenly, S410 is otherwise performed.
S410:Terminate, the file after being combined.
S37:Extend skin file of the maker according to the file generated CRX forms after combination.
Wherein it is possible to according to the information of the document element recorded in mainfest.json, gradually obtain each file member Element, wherein can include the first document element and keep the second constant document element, is afterwards beaten these document elements The skin file of CRX forms is can be obtained by after bag.
The present embodiment is by above-mentioned design phase, resolution phase, matching stage and completes the stage, just realizes by PSD lattice The skin file of formula improves the producing efficiency of browser skin, optimizes life to the automatic conversion of the skin file of CRX forms Into process, without artificial participation, reduction personnel cost and running cost are realized from PSD files to the procedure of CRX files and are Systemization.
Fig. 5 is the structural representation of the device of the skin file for the generation browser readable that another embodiment of the present invention is proposed Figure, the device 50 includes the first acquisition module 51, the second acquisition module 52, composite module 53 and generation module 54.
First acquisition module 51 is used to obtain first group of document element, and first group of document element is included to the first form Skin file parsing after obtain document element, the skin file of first form is the skin file of designer's design;
Wherein, the skin file of the first form can refer to the skin file of PSD forms.
The skin file of PSD forms is made up of multiple figure layers.
For example, with reference to Fig. 2, the skin file 20 of PSD forms can include Background From Layer 21 and module figure layer 22, module map Layer 22 can include back, forwarding button, refresh button, maximization button, minimum button and X button etc..Specifically , each figure layer can be made up of pattern, color and word etc..
First group of document element can refer to that the skin file of the PSD forms designed designer obtained after figure layer parsing The one group of document element arrived.For example, first group of document element includes back, forwarding button and the refreshing that designer designs Button etc..
Second acquisition module 52 is used to obtain second group of document element, and second group of document element includes former to browser The document element obtained after type parsing;
Wherein, designer is that the browser prototype based on setting is designed when designing browser skin, for example, clear Look at and name, size of each module etc. are specified in device prototype, designer can be designed according to this.Wherein, designer is in design Need to continue to use the module name specified in browser prototype, for example, back described in browser prototype is named as The module figure layer, can be named as " BACK " by " BACK " when designer moves back button after design.For size, designer can be with Design is different from the size in prototype, for example, for back, the size in browser prototype is size _ 1, and designer can To be designed to size _ 2.
Specifically, browser prototype includes that in its inventory file (mainfest.json), the inventory file phase can be recorded The information for each document element that browser prototype includes is answered, can be with by reading the inventory file for example, name, size etc. Obtain second group of document element.
Composite module 53 is used to be combined processing to first group of document element and second group of document element, obtains File after to combination;
Wherein, if designer devises some document element in browser prototype, the replacement designed with designer Corresponding document element in browser prototype, it is, of course, understood that in the document element needs and browser prototype replaced Document element name it is identical with size, replacement after size can be adjusted when size is different.For example, designer devises one New back, the size of back of the size of the new back with being recorded in browser prototype is identical, then uses The back of designer's design replaces the back recorded in browser prototype.By that analogy, the text designed with designer Part element is replaced in browser prototype after corresponding document element, it is possible to the file after being combined.
Generation module 54 is used for the skin file that the second form is obtained according to the file after the combination, second form Skin file be browser readable skin file.
Wherein, the skin file of the second form can refer to the skin file of CRX forms.
The file of CRX forms is the zip compressed packages of a special format, the various configuration statements comprising similar .json, with And substantial amounts of picture file, then it is encrypted according to overall data, and the signature of Chrome demand of technical standard is included, The head of zip file writes special data, is packed in other words so as to complete legal generation.
Therefore, with least part file member after at least part document element in first group of document element or adjustment Element, is replaced after the corresponding document element in second group of document element, it is possible to according to the inventory file of browser prototype (maintfest.json) index picture file, (generates), obtains in other words after all picture files of index are packed The skin file of CRX forms.
The present embodiment is by obtaining first group of document element and second group of document element, and to first group of document element and the Two groups of document elements are combined processing, and the document element that can design designer replaces skin present in browser prototype File, and then the skin file of browser readable is generated, so as to realize the skin file that is designed by designer to browser readable Skin file automatic conversion, reduce cost of labor, realize skin file form conversion procedure and systematization.
Fig. 6 is the structural representation of the device of the skin file for the generation browser readable that another embodiment of the present invention is proposed Figure, on the basis of a upper embodiment, the first acquisition module 51 can specifically include first module 511, second unit 512 and the Three units 513.
First module 511 is used for the skin file for obtaining first form, and the skin file of first form is by more Individual file figure layer composition;
Wherein, the skin file of the first form can be the skin file of the PSD forms of designer's design.
Designer can carry out browser skin design with photoshop, to generate the skin file of PSD forms.
Second unit 512 is used to carry out figure layer parsing to the skin file of first form, obtains composition described first Each file figure layer of the skin file of form;
Wherein, second unit 512 can be specially figure layer resolver, and figure layer resolver can be local file, realize text Part local parsing;Or the skin file of PSD forms can be uploaded to setting comprising figure layer resolver by designer by network It is standby.
Figure layer resolver has the function that figure layer parsing is carried out to the file of PSD forms, to realize what designer was designed The figure layer parsing of the browser skin file of PSD forms.
Parsed by figure layer, can obtain constituting each figure layer of the skin file of PSD forms, for example, obtaining designer Background, back, forwarding button and refresh button of design etc..
Third unit 513 is used to the element in each file figure layer constituting first group of document element.
Wherein, third unit can be specially pel follower.
A file can be preset, this document is pressed from both sides for preserving the figure layer obtained after parsing.
When stored, third unit can one by one be protected according to configuration set in advance to each figure layer after parsing Deposit, configuration set in advance can be the value of pel name-picture to relation, wherein, pel name value it is identical with the name of figure layer, The value of picture can be specially the storing path of the picture.
For example, the figure layer obtained after parsing includes background, back and forwarding button, configuration set in advance includes: Background-path _ 1, back-path _ 2, forwarding button-path _ 3, then, background can be stored in what path _ 1 was specified Position, the position that path _ 2 are specified is stored in by back, and forwarding button is stored in into the position that path _ 3 are specified.
In another embodiment, the second acquisition module 52 can include the 4th unit 521 and the 5th unit 522.
4th unit 521 is used to obtain the browser prototype, and the browser prototype includes inventory file;
Wherein, browser prototype is referred to as extending prototype.
The each browser of correspondence, can all have a browser prototype, so that designer is designed based on this.
5th unit 522 is used to the document element that the inventory file includes constituting second group of document element.
5th unit 522 can be specially extension resolver.
5th unit 522 can extract mainfest.json files, mainfest.json texts from browser prototype The information of each document element in browser prototype is recorded in part, for example, name, size of each file etc..By parsing, just The document element in browser prototype can be obtained.
In another embodiment, composite module 53 can be specially patterned sets device.
First group of document element and second group of document element all include multiple document elements, and described first group The naming rule of document element in document element is identical with the naming rule of the document element in second group of document element.
In another embodiment, the composite module specifically for:The second document element of correspondence, if there is the first file member Element, and first document element is identical with the name of second document element, and first document element and described the The size of two document elements is identical, then replaces second text with first document element in second group of document element Part element, wherein, second document element is a document element in second group of document element, first file Element is a document element in first group of document element.
For example, the back of designer's design is identical with the name of back in browser prototype and size is identical, The back then designed with designer replaces the back in browser prototype.
In another embodiment, the composite module specifically for:The second document element of correspondence, if there is the first file member Element, and first document element is identical with the name of second document element, but first document element and described the The size of two document elements is differed, then first document element is adjusted so that the first document element after adjustment Size it is identical with the size of second document element;With the first text after the adjustment in second group of document element Part element replaces second document element, wherein, second document element is one in second group of document element Document element, first document element is a document element in first group of document element.
For example, when the size of the first document element is more than the size of the second document element, can be by the first document element Scaled down to identical with the size of the second document element, or, when the size of the first document element is less than the second file member During the size of element, the first document element equal proportion can be amplified to identical with the size of the second document element.
In another embodiment, the composite module further specifically for:If existed in first group of document element It is multiple to name identical document element with second document element, it is determined that the document element of the superiors is first file Element.
Wherein, due to the superiors be typically it is newest, it is therefore, last as designer using the document element of the superiors The document element of design.
In another embodiment, the composite module specifically for:The second document element of correspondence, if there is no with described the Two document elements name the document element of identical first, then keep second document element in second group of document element It is constant, wherein, second document element is a document element in second group of document element, the first file member Element is a document element in first group of document element.
That is, when designer does not design respective element, with the element given tacit consent in browser prototype.For example, designer does not have There is design back, that is just using the back given tacit consent in browser prototype.
In another embodiment, the generation module specifically for:According to the inventory file of the browser prototype, institute is obtained State each document element recorded in inventory file;The skin of the second form is obtained after being packed to the All Files element of acquisition Skin file.
Wherein, first form is PSD forms, and second form is CRX forms.Can basis The information of the document element recorded in mainfest.json, gradually obtains each document element, wherein can include the first file Element and the second constant document element of holding, can be obtained by CRX forms after these document elements are packed afterwards Skin file.
The present embodiment is by above-mentioned design phase, resolution phase, matching stage and completes the stage, just realizes by PSD lattice The skin file of formula improves the producing efficiency of browser skin, optimizes life to the automatic conversion of the skin file of CRX forms Into process, without artificial participation, reduction personnel cost and running cost are realized from PSD files to the procedure of CRX files and are Systemization.
The embodiment of the present invention additionally provides a kind of client device, and the client device includes housing, processor, storage Device, circuit board and power circuit, wherein, circuit board is placed in the interior volume that housing is surrounded, and processor and memory are arranged on On circuit board;Power circuit, for being powered for each circuit or device of client device;Memory is used to store executable journey Sequence code;The executable program code that processor is stored by reading in memory is corresponding with executable program code to run Program, for performing following steps:
S11’:First group of document element is obtained, first group of document element includes the skin file solution to the first form Document element is obtained after analysis, the skin file of first form is the skin file of designer's design.
Wherein, the skin file of the first form can refer to the skin file of PSD forms.
The skin file of PSD forms is made up of multiple figure layers.
For example, with reference to Fig. 2, the skin file 20 of PSD forms can include Background From Layer 21 and module figure layer 22, module map Layer 22 can include back, forwarding button, refresh button, maximization button, minimum button and X button etc..Specifically , each figure layer can be made up of pattern, color and word etc..
First group of document element can refer to that the skin file of the PSD forms designed designer obtained after figure layer parsing The one group of document element arrived.For example, first group of document element includes back, forwarding button and the refreshing that designer designs Button etc..
S12’:Second group of document element is obtained, second group of document element includes obtaining after parsing browser prototype Document element.
Wherein, designer is that the browser prototype based on setting is designed when designing browser skin, for example, clear Look at and name, size of each module etc. are specified in device prototype, designer can be designed according to this.Wherein, designer is in design Need to continue to use the module name specified in browser prototype, for example, back described in browser prototype is named as The module figure layer, can be named as " BACK " by " BACK " when designer moves back button after design.For size, designer can be with Design is different from the size in prototype, for example, for back, the size in browser prototype is size _ 1, and designer can To be designed to size _ 2.
Specifically, browser prototype includes that in its inventory file (mainfest.json), the inventory file phase can be recorded The information for each document element that browser prototype includes is answered, can be with by reading the inventory file for example, name, size etc. Obtain second group of document element.
S11 ' and S12 ' is without sequential restriction relation.
S13’:Processing is combined to first group of document element and second group of document element, the text after being combined Part.
Wherein, if designer devises some document element in browser prototype, the replacement designed with designer Corresponding document element in browser prototype, it is, of course, understood that in the document element needs and browser prototype replaced Document element name it is identical with size, replacement after size can be adjusted when size is different.For example, designer devises one New back, the size of back of the size of the new back with being recorded in browser prototype is identical, then uses The back of designer's design replaces the back recorded in browser prototype.By that analogy, the text designed with designer Part element is replaced in browser prototype after corresponding document element, it is possible to the file after being combined.
S14’:The skin file of the second form, the skin text of second form are obtained according to the file after the combination Part is the skin file of browser readable.
Wherein, the skin file of the second form can refer to the skin file of CRX forms.
The file of CRX forms is the zip compressed packages of a special format, the various configuration statements comprising similar .json, with And substantial amounts of picture file, then it is encrypted according to overall data, and the signature of Chrome demand of technical standard is included, The head of zip file writes special data, is packed in other words so as to complete legal generation.
Therefore, with least part file member after at least part document element in first group of document element or adjustment Element, is replaced after the corresponding document element in second group of document element, it is possible to according to the inventory file of browser prototype (maintfest.json) index picture file, (generates), obtains in other words after all picture files of index are packed The skin file of CRX forms.
The present embodiment is by obtaining first group of document element and second group of document element, and to first group of document element and the Two groups of document elements are combined processing, and the document element that can design designer replaces skin present in browser prototype File, and then the skin file of browser readable is generated, so as to realize the skin file that is designed by designer to browser readable Skin file automatic conversion, reduce cost of labor, realize skin file form conversion procedure and systematization.
In another embodiment, the executable program code that processor is stored by reading in memory runs and can perform The corresponding program of program code, for performing following steps:
S31’:Designer designs browser skin, obtains the skin file of PSD forms.
Wherein, designer can carry out browser skin design with photoshop, to generate the skin file of PSD forms.
S32’:Figure layer resolver carries out figure layer parsing to the skin file of the PSD forms.
Wherein, figure layer resolver can be local file, realize file local parsing;Or designer can pass through network The skin file of PSD forms is uploaded to the equipment for including figure layer resolver.
Figure layer resolver has the function that figure layer parsing is carried out to the file of PSD forms, to realize what designer was designed The figure layer parsing of the browser skin file of PSD forms.
Parsed by figure layer, can obtain constituting each figure layer of the skin file of PSD forms, for example, obtaining designer Background, back, forwarding button and refresh button of design etc..
S33’:Each figure layer that figure layer resolver is obtained is stored in the file of setting by pel follower.
Wherein it is possible to preset a file, this document is pressed from both sides for preserving the figure layer obtained after parsing.
When stored, pel follower can one by one be protected according to configuration set in advance to each figure layer after parsing Deposit, configuration set in advance can be the value of pel name-picture to relation, wherein, pel name value it is identical with the name of figure layer, The value of picture can be specially the storing path of the picture.
For example, the figure layer obtained after parsing includes background, back and forwarding button, configuration set in advance includes: Background-path _ 1, back-path _ 2, forwarding button-path _ 3, then, background can be stored in what path _ 1 was specified Position, the position that path _ 2 are specified is stored in by back, and forwarding button is stored in into the position that path _ 3 are specified.
S34’:Obtain browser prototype.
Wherein, browser prototype is referred to as extending prototype.
The each browser of correspondence, can all have a browser prototype, so that designer is designed based on this.
S35’:Extension resolver is parsed to browser prototype.
Remember wherein it is possible to be extracted from browser prototype in mainfest.json files, the mainfest.json files The information of each document element in browser prototype is recorded, for example, name, size of each file etc..Pass through parsing, it is possible to obtain Take the document element in browser prototype.
S31 ' -33 ' and S34 '-S35 ' are without sequential restriction relation.
S36’:Patterned sets device is to the document element that is preserved in pel follower, and the file that extension resolver is obtained Element is combined processing.
The flow of combined treatment can include:
S401’:Second document element is selected, wherein, the second document element is after being parsed to browser prototype Obtained document element.
Wherein it is possible to be one the second document element of random selection, or, it is to select second document element successively.
S402’:Default file is traveled through, judges whether to name identical one first with second document element Document element, if so, performing S404 ', otherwise, performs S403 ', wherein, the first document element is the file designed designer The document element obtained after being parsed.
S403’:Keep the second document element constant.
That is, when designer does not design respective element, with the element given tacit consent in browser prototype.For example, designer does not have There is design back, that is just using the back given tacit consent in browser prototype.
S404’:The first document element born the same name is judged whether, if so, performing S405 ', S406 ' is otherwise performed.
For example, for back, designer may devise multiple, and the plurality of back is located at different layerings On.
S405’:Using the first document element of the superiors in duplication of name.
Wherein, due to the superiors be typically it is newest, it is therefore, last as designer using the document element of the superiors The document element of design.
S406’:Judge whether the size of first document element is identical with the size of the second document element, if so, performing S408 ', otherwise performs S407 '.
S407’:Adjust the size of the first document element so that size and the size phase of the second document element after adjustment Together.
For example, when the size of the first document element is more than the size of the second document element, can be by the first document element Scaled down to identical with the size of the second document element, or, when the size of the first document element is less than the second file member During the size of element, the first document element equal proportion can be amplified to identical with the size of the second document element.
S408’:Replaced with the first document element and name the identical and document element of size identical second.
For example, the back of designer's design is identical with the name of back in browser prototype and size is identical, The back then designed with designer replaces the back in browser prototype.
S409’:Nonoptional second document element is judged whether, if so, repeating S401 and its follow-up step Suddenly, S410 ' is otherwise performed.
S410’:Terminate, the file after being combined.
S37’:Extend skin file of the maker according to the file generated CRX forms after combination.
Wherein it is possible to according to the information of the document element recorded in mainfest.json, gradually obtain each file member Element, wherein can include the first document element and keep the second constant document element, is afterwards beaten these document elements The skin file of CRX forms is can be obtained by after bag.
The present embodiment is by above-mentioned design phase, resolution phase, matching stage and completes the stage, just realizes by PSD lattice The skin file of formula improves the producing efficiency of browser skin, optimizes life to the automatic conversion of the skin file of CRX forms Into process, without artificial participation, reduction personnel cost and running cost are realized from PSD files to the procedure of CRX files and are Systemization.
It should be noted that in the description of the invention, term " first ", " second " etc. are only used for describing purpose, without It is understood that to indicate or imply relative importance.In addition, in the description of the invention, unless otherwise indicated, the implication of " multiple " It is two or more.
Any process described otherwise above or method description are construed as in flow chart or herein, represent to include Module, fragment or the portion of the code of one or more executable instructions for the step of realizing specific logical function or process Point, and the scope of the preferred embodiment of the present invention includes other realization, wherein can not be by shown or discussion suitable Sequence, including according to involved function by it is basic simultaneously in the way of or in the opposite order, carry out perform function, this should be of the invention Embodiment person of ordinary skill in the field understood.
It should be appreciated that each several part of the present invention can be realized with hardware, software, firmware or combinations thereof.Above-mentioned In embodiment, the software that multiple steps or method can in memory and by suitable instruction execution system be performed with storage Or firmware is realized.If, and in another embodiment, can be with well known in the art for example, realized with hardware Any one of row technology or their combination are realized:With the logic gates for realizing logic function to data-signal Discrete logic, the application specific integrated circuit with suitable combinational logic gate circuit, programmable gate array (PGA), scene Programmable gate array (FPGA) etc..
Those skilled in the art are appreciated that to realize all or part of step that above-described embodiment method is carried Rapid to can be by program to instruct the hardware of correlation to complete, described program can be stored in a kind of computer-readable storage medium In matter, the program upon execution, including one or a combination set of the step of embodiment of the method.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing module, can also That unit is individually physically present, can also two or more units be integrated in a module.Above-mentioned integrated mould Block can both be realized in the form of hardware, it would however also be possible to employ the form of software function module is realized.The integrated module is such as Fruit is realized using in the form of software function module and as independent production marketing or in use, can also be stored in a computer In read/write memory medium.
Storage medium mentioned above can be read-only storage, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show The description of example " or " some examples " etc. means to combine specific features, structure, material or the spy that the embodiment or example are described Point is contained at least one embodiment of the present invention or example.In this manual, to the schematic representation of above-mentioned term not Necessarily refer to identical embodiment or example.Moreover, specific features, structure, material or the feature of description can be any One or more embodiments or example in combine in an appropriate manner.
Although embodiments of the invention have been shown and described above, it is to be understood that above-described embodiment is example Property, it is impossible to limitation of the present invention is interpreted as, one of ordinary skill in the art within the scope of the invention can be to above-mentioned Embodiment is changed, changed, replacing and modification.

Claims (18)

1. a kind of method for the skin file for generating browser readable, it is characterised in that including:
First group of document element is obtained, first group of document element obtains text after including the skin file parsing to the first form Part element, the skin file of first form is the skin file of designer's design;
Second group of document element is obtained, second group of document element includes the file member obtained after being parsed to browser prototype Element;
Processing is combined to first group of document element and second group of document element, the file after being combined, its In, first group of document element and second group of document element all include multiple document elements, and first group of file The naming rule of document element in element is identical with the naming rule of the document element in second group of document element, described Processing is combined to first group of document element and second group of document element, including:The second document element of correspondence, such as There is the first document element in fruit, and first document element is identical with the name of second document element, and described first Document element is identical with the size of second document element, then with first file member in second group of document element Element replaces second document element, wherein, second document element is a file in second group of document element Element, first document element is a document element in first group of document element;
The skin file of the second form is obtained according to the file after the combination, the skin file of second form is browser Readable skin file.
2. according to the method described in claim 1, it is characterised in that first group of document element of the acquisition, including:
The skin file of first form is obtained, the skin file of first form is made up of multiple file figure layers;
Figure layer parsing is carried out to the skin file of first form, obtain constituting first form skin file it is each File figure layer;
Element in each file figure layer is constituted into first group of document element.
3. according to the method described in claim 1, it is characterised in that second group of document element of the acquisition, including:
The browser prototype is obtained, the browser prototype includes inventory file;
The document element that the inventory file includes is constituted into second group of document element.
4. according to the method described in claim 1, it is characterised in that described to first group of document element and described second group Document element is combined processing, including:
The second document element of correspondence, if there is the first document element, and first document element and second file are first The name of element is identical, but the size of first document element and second document element is differed, then to the described first text Part element is adjusted so that the size of the first document element after adjustment is identical with the size of second document element;
Second document element is replaced with the first document element after the adjustment in second group of document element, its In, second document element is a document element in second group of document element, and first document element is institute State a document element in first group of document element.
5. the method according to claim 1 or 4, it is characterised in that
If there is multiple and second document element in first group of document element names identical document element, really The document element for determining the superiors is first document element.
6. according to the method described in claim 1, it is characterised in that described to first group of document element and described second group Document element is combined processing, including:
The second document element of correspondence, names the document element of identical first if there is no with second document element, then exists Keep second document element constant in second group of document element, wherein, second document element is described second A document element in group document element, first document element is a file member in first group of document element Element.
7. according to the method described in claim 1, it is characterised in that the file according to after the combination obtains the second form Skin file, including:
According to the inventory file of the browser prototype, each document element recorded in the inventory file is obtained;
The skin file of the second form is obtained after being packed to the All Files element of acquisition.
8. the method according to Claims 1-4 and 6 to 7 any one, it is characterised in that
First form is PSD forms.
9. the method according to Claims 1-4 and 6 to 7 any one, it is characterised in that
Second form is CRX forms.
10. a kind of device for the skin file for generating browser readable, it is characterised in that including:
First acquisition module, for obtaining first group of document element, first group of document element includes the skin to the first form Document element is obtained after skin document analysis, the skin file of first form is the skin file of designer's design;
Second acquisition module, for obtaining second group of document element, second group of document element is included to browser prototype solution The document element obtained after analysis;
Composite module, for being combined processing to first group of document element and second group of document element, obtains group File after conjunction, wherein, first group of document element and second group of document element all include multiple document elements, and institute State naming rule and the name of the document element in second group of document element of document element in first group of document element Rule it is identical, the composite module specifically for:The second document element of correspondence, if there is the first document element, and described the One document element is identical with the name of second document element, and first document element and second document element Size is identical, then replaces second document element with first document element in second group of document element, wherein, Second document element is a document element in second group of document element, and first document element is described A document element in one group of document element;
Generation module, the skin file for obtaining the second form according to the file after the combination, the skin of second form Skin file is the skin file of browser readable.
11. device according to claim 10, it is characterised in that first acquisition module includes:
First module, the skin file for obtaining first form, the skin file of first form is by multiple files Figure layer is constituted;
Second unit, carries out figure layer parsing for the skin file to first form, obtains composition first form Each file figure layer of skin file;
Third unit, for the element in each file figure layer to be constituted into first group of document element.
12. device according to claim 10, it is characterised in that second acquisition module includes:
Unit the 4th, for obtaining the browser prototype, the browser prototype includes inventory file;
Unit the 5th, the document element for the inventory file to be included constitutes second group of document element.
13. device according to claim 10, it is characterised in that the composite module specifically for:
The second document element of correspondence, if there is the first document element, and first document element and second file are first The name of element is identical, but the size of first document element and second document element is differed, then to the described first text Part element is adjusted so that the size of the first document element after adjustment is identical with the size of second document element;
Second document element is replaced with the first document element after the adjustment in second group of document element, its In, second document element is a document element in second group of document element, and first document element is institute State a document element in first group of document element.
14. the device according to claim 10 or 13, it is characterised in that the composite module further specifically for:
If there is multiple and second document element in first group of document element names identical document element, really The document element for determining the superiors is first document element.
15. device according to claim 10, it is characterised in that the composite module specifically for:
The second document element of correspondence, names the document element of identical first if there is no with second document element, then exists Keep second document element constant in second group of document element, wherein, second document element is described second A document element in group document element, first document element is a file member in first group of document element Element.
16. device according to claim 10, it is characterised in that the generation module specifically for:
According to the inventory file of the browser prototype, each document element recorded in the inventory file is obtained;
The skin file of the second form is obtained after being packed to the All Files element of acquisition.
17. the device according to claim 10 to 13 and 15 to 16 any one, it is characterised in that first form is PSD forms.
18. the device according to claim 10 to 13 and 15 to 16 any one, it is characterised in that second form is CRX forms.
CN201410188879.7A 2014-05-06 2014-05-06 The method and apparatus for generating the skin file of browser readable Active CN104007963B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410188879.7A CN104007963B (en) 2014-05-06 2014-05-06 The method and apparatus for generating the skin file of browser readable

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410188879.7A CN104007963B (en) 2014-05-06 2014-05-06 The method and apparatus for generating the skin file of browser readable

Publications (2)

Publication Number Publication Date
CN104007963A CN104007963A (en) 2014-08-27
CN104007963B true CN104007963B (en) 2017-11-07

Family

ID=51368630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410188879.7A Active CN104007963B (en) 2014-05-06 2014-05-06 The method and apparatus for generating the skin file of browser readable

Country Status (1)

Country Link
CN (1) CN104007963B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111128402A (en) * 2019-12-20 2020-05-08 天津新开心生活科技有限公司 Data format conversion method and device, storage medium and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101135968A (en) * 2007-09-28 2008-03-05 腾讯科技(深圳)有限公司 Method and apparatus for generating advertisement
WO2008085011A2 (en) * 2007-01-12 2008-07-17 Kyung-Yang Park Method and system for replacing advertisement skin in mobile advertising game
CN102521218A (en) * 2011-12-15 2012-06-27 方正国际软件有限公司 File combining method and file combining device
CN102662672A (en) * 2012-04-05 2012-09-12 广州市动景计算机科技有限公司 Method and device for conducting skin changing process to webpages as well as mobile terminal
CN102685600A (en) * 2012-04-26 2012-09-19 青岛海信电器股份有限公司 Data overlaying display and synthesis method and system and display equipment
CN102810060A (en) * 2011-06-01 2012-12-05 腾讯科技(深圳)有限公司 Method and device for configuring Android picture resource
CN103177078A (en) * 2013-02-05 2013-06-26 北京小米科技有限责任公司 Method and system for processing theme package

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014005610A1 (en) * 2012-07-06 2014-01-09 Microsoft Corporation Multi-level list detection engine
CN103092603B (en) * 2012-12-10 2016-08-10 乐视网信息技术(北京)股份有限公司 Player collocation method and system and corresponding player
CN103235797B (en) * 2013-04-09 2015-12-23 四三九九网络股份有限公司 A kind of method and apparatus of batch processing picture size

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008085011A2 (en) * 2007-01-12 2008-07-17 Kyung-Yang Park Method and system for replacing advertisement skin in mobile advertising game
CN101135968A (en) * 2007-09-28 2008-03-05 腾讯科技(深圳)有限公司 Method and apparatus for generating advertisement
CN102810060A (en) * 2011-06-01 2012-12-05 腾讯科技(深圳)有限公司 Method and device for configuring Android picture resource
CN102521218A (en) * 2011-12-15 2012-06-27 方正国际软件有限公司 File combining method and file combining device
CN102662672A (en) * 2012-04-05 2012-09-12 广州市动景计算机科技有限公司 Method and device for conducting skin changing process to webpages as well as mobile terminal
CN102685600A (en) * 2012-04-26 2012-09-19 青岛海信电器股份有限公司 Data overlaying display and synthesis method and system and display equipment
CN103177078A (en) * 2013-02-05 2013-06-26 北京小米科技有限责任公司 Method and system for processing theme package

Also Published As

Publication number Publication date
CN104007963A (en) 2014-08-27

Similar Documents

Publication Publication Date Title
US9224222B2 (en) Interactive multidimensional drilldown analysis
US8649427B2 (en) Image processor, image generator and computer program
CN107688493A (en) Train the method, apparatus and system of deep neural network
Holmgren et al. Mediterranean Holocene climate, environment and human societies
JP6402408B2 (en) Tag processing method and tag processing apparatus
CN104462036B (en) A kind of method and system of the format information of synchro edit document
CN107526604A (en) A kind of self-defined generation method of meeting room order of seats figure
CN104007963B (en) The method and apparatus for generating the skin file of browser readable
CN108694050A (en) The method and system that the software package of storage system is updated
CN108153572A (en) GIS display methods, device and system
CN105976322A (en) Power grid comprehensive information monitoring graph generation system and method
CN103699016A (en) Method for generating initial working condition for simulating digital control system in full scope manner
CN104598351B (en) The method of testing of 3D engine compatibility and device
Frank et al. Digital sculpting for historical representation: Neville tomb case study
CN109634610A (en) A kind of generation method and device of interface labeled data
CN105551011A (en) Method and apparatus for setting dominant tone
CN105955996A (en) Image processing method and device
Li et al. Self-adaptive slicing algorithm for 3D printing of FGM components
US20070211937A1 (en) Hybrid Image Compression Method
CN110297811A (en) Data processing method and device, computer system and computer readable storage medium storing program for executing
CN109784131B (en) Object detection method, device, storage medium and processor
CN115984949A (en) Low-quality face image recognition method and device with attention mechanism
IL257119A (en) News production system with dynamic character generator output
CN107291712A (en) The generation method and device of data
Djamal et al. Optimization of a linear function over the set of stochastic efficient solutions

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100041 room 1592A, building, No. 3 West Road, Badachu hi tech park, Beijing, Shijingshan District, China

Applicant after: BEIJING LIEBAO NETWORK TECHNOLOGY CO., LTD.

Address before: 100041 room 1592A, building, No. 3 West Road, Badachu hi tech park, Beijing, Shijingshan District, China

Applicant before: Beijing Kingsoft Internet Science and Technology Co., Ltd.

GR01 Patent grant
GR01 Patent grant