CN115904167A - Processing method and device of webpage icon, storage medium and electronic equipment - Google Patents

Processing method and device of webpage icon, storage medium and electronic equipment Download PDF

Info

Publication number
CN115904167A
CN115904167A CN202211422910.XA CN202211422910A CN115904167A CN 115904167 A CN115904167 A CN 115904167A CN 202211422910 A CN202211422910 A CN 202211422910A CN 115904167 A CN115904167 A CN 115904167A
Authority
CN
China
Prior art keywords
icon
displayed
code data
target
resource
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.)
Pending
Application number
CN202211422910.XA
Other languages
Chinese (zh)
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.)
Caxa Technology Co Ltd
Original Assignee
Caxa 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 Caxa Technology Co Ltd filed Critical Caxa Technology Co Ltd
Priority to CN202211422910.XA priority Critical patent/CN115904167A/en
Publication of CN115904167A publication Critical patent/CN115904167A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a method and a device for processing webpage icons, a storage medium and electronic equipment, wherein the method comprises the following steps: detecting whether an icon set of a target webpage contains an icon identifier of an icon to be displayed; if the icon set does not contain the icon identification, detecting whether the document object model of the target webpage contains the icon identification; if the document object model does not contain the icon identification, acquiring icon code data of the icon to be displayed from the network server, generating icon resources of the icon to be displayed based on the icon code data, and displaying the icon to be displayed in the target webpage based on the icon resources; and if the icon set comprises an icon identifier or the document object model comprises the icon identifier, acquiring the target Scalable Vector Graphics (SVG) according to the icon identifier, and displaying the icon to be displayed in the target webpage based on the target Scalable Vector Graphics (SVG). The invention solves the technical problem that the user experience is influenced because the user cannot change the webpage icon in a self-defining way.

Description

Processing method and device of webpage icon, storage medium and electronic equipment
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for processing a webpage icon, a storage medium and electronic equipment.
Background
At present, in the related art, the display of the icons in the web page is realized through Scalable Vector Graphics (SVG) pictures, and the method integrates locally stored SVG picture resources and converts the locally stored SVG picture resources into the icons, so that the requirements of changing the size of the icons in the web page and the like can be well met.
However, in the actual use process of the web page, there is a need that the user wants to perform the custom setting on the icon in the web page (for example, add a certain icon), and when the user does not have the SVG picture resource locally, the custom setting cannot be realized. In addition, in the prior art, icon resources in a character string format cannot be converted into icon resources in a Scalable Vector Graphics (SVG) format, so that a user cannot achieve customized change of a webpage icon by acquiring the icon resources in the character string format, and negative influence is generated on the use experience of the user.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a method and a device for processing a webpage icon, a storage medium and electronic equipment, which are used for at least solving the technical problem that in the prior art, icon resources in a character string format cannot be converted into icon resources in a Scalable Vector Graphics (SVG) format, so that a user cannot change the webpage icon in a self-defining manner, and the user experience is influenced.
According to an aspect of the embodiments of the present invention, a method for processing a webpage icon is provided, including: detecting whether an icon set of a target webpage contains an icon identifier of an icon to be displayed; if the icon set does not contain the icon identification, detecting whether the document object model of the target webpage contains the icon identification; if the document object model does not contain the icon identification, acquiring icon code data of the icon to be displayed from the network server, generating icon resources of the icon to be displayed based on the icon code data, and displaying the icon to be displayed in the target webpage based on the icon resources, wherein the icon code data are data in a character string format; and if the icon set comprises an icon identifier or the document object model comprises the icon identifier, acquiring the target Scalable Vector Graphics (SVG) according to the icon identifier, and displaying the icon to be displayed in the target webpage based on the target Scalable Vector Graphics (SVG).
Further, the processing method of the webpage icon further comprises the following steps: constructing a code data processor according to a preset construction function; and converting the icon code data based on the code data processor to obtain the icon resource.
Further, the processing method of the webpage icon further comprises the following steps: removing target data in the icon code data to obtain target source code data; based on the code data processor, carrying out format conversion processing on the target source code data to obtain a document object of the Scalable Vector Graphics (SVG) file; and processing the attribute information of the document object of the SVG file to obtain the icon resource.
Further, the processing method of the webpage icon further comprises the following steps: and removing the styles and colors of the document objects of the SVG file to obtain the icon resources.
Further, the processing method of the webpage icon further comprises the following steps: acquiring position information of a position reserved for an icon to be displayed in a target webpage; determining the display position of the icon to be displayed in the target webpage based on the position information; and displaying the icon to be displayed at the display position based on the icon resource.
Further, the processing method of the webpage icon further comprises the following steps: in the document object model, the icon resources are stored.
According to another aspect of the embodiments of the present invention, there is also provided a device for processing a webpage icon, including: the first detection module is used for detecting whether the icon set of the target webpage contains the icon identification of the icon to be displayed; the second detection module is used for detecting whether the document object model of the target webpage contains the icon identification or not if the icon set does not contain the icon identification; the first processing module is used for acquiring icon code data of an icon to be displayed from the network server if the document object model does not contain the icon identification, generating icon resources of the icon to be displayed based on the icon code data, and displaying the icon to be displayed in a target webpage based on the icon resources, wherein the icon code data are data in a character string format; and the second processing module is used for acquiring the target Scalable Vector Graphics (SVG) according to the icon identifier if the icon identifier is contained in the icon set or the icon identifier is contained in the document object model, and displaying the icon to be displayed in the target webpage based on the target Scalable Vector Graphics (SVG).
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the above-mentioned processing method for a webpage icon when running.
According to another aspect of embodiments of the present invention, there is also provided an electronic device, including one or more processors; a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a processing method for executing the program, wherein the program is configured to execute the above-mentioned processing method for the webpage icon when executed.
According to another aspect of the embodiments of the present invention, there is also provided a computer program product, which includes computer programs/instructions, wherein the computer programs/instructions, when executed by a processor, implement the above-mentioned processing method for a webpage icon.
In the embodiment of the invention, a mode of displaying an icon to be displayed in a target webpage by acquiring an icon resource through a local mode and a remote mode is adopted, firstly, whether an icon identification of the icon to be displayed is contained in an icon set of the target webpage is detected, if the icon identification is not contained in the icon set, whether an icon identification is contained in a document object model of the target webpage is detected, if the icon identification is not contained in the document object model, icon code data of the icon to be displayed is acquired from a network server, the icon resource of the icon to be displayed is generated based on the icon code data, the icon to be displayed is displayed in the target webpage based on the icon resource, if the icon identification is contained in the icon set or the icon identification is contained in the document object model, a target scalable vector graphics SVG is acquired according to the icon identification, and the icon to be displayed is displayed in the target webpage based on the target scalable vector graphics SVG. The icon code data is data in a character string format.
In the process, whether the icon set and the document object model contain the icon identifier of the icon to be displayed or not is detected, and the corresponding target scalable vector graphics SVG can be obtained through the icon identifier under the condition that the icon set or the document object model contains the icon identifier, so that the icon to be displayed can be displayed in a target webpage based on the target scalable vector graphics SVG, and the icon resource can be obtained in a local mode and the icon to be displayed can be displayed in the target webpage; the icon resource of the icon to be displayed is generated by acquiring the icon code data of the icon to be displayed from the network server and based on the icon code data, the data in the character string format is converted into the icon resource of the icon to be displayed, namely, the icon resource is acquired in a remote mode and the icon to be displayed is displayed in a target webpage, great convenience is brought to user-defined setting of the icon for a user, user-defined requirements of the user on the webpage icon can be well met, and therefore user experience can be improved.
Therefore, through the technical scheme of the invention, the purpose of displaying the icon to be displayed in the target webpage through a local mode and a remote mode is achieved, so that the technical effect of improving the user experience is realized, and the technical problem that the user cannot realize self-defining change of the webpage icon and the user experience is influenced because the icon resource in the character string format cannot be converted into the icon resource in the Scalable Vector Graphics (SVG) format in the prior art is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a method for processing selectable Web page icons according to an embodiment of the present invention;
FIG. 2 is a flow diagram of an alternative presentation icon in a web page in accordance with an embodiment of the present invention;
FIG. 3 is a flow diagram of an alternative construct icon resource in accordance with embodiments of the invention;
fig. 4 is a schematic diagram of a processing device for selecting a webpage icon according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) related to the present invention are information and data authorized by the user or sufficiently authorized by each party. For example, an interface is provided between the system and the relevant user or institution, and before obtaining the relevant information, an obtaining request needs to be sent to the user or institution through the interface, and after receiving the consent information fed back by the user or institution, the relevant information needs to be obtained.
Example 1
In accordance with an embodiment of the present invention, there is provided a method embodiment of a method for processing a web page icon, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 1 is a flowchart of a processing method of a selectable web page icon according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S101, detecting whether the icon set of the target webpage contains the icon identification of the icon to be displayed.
In the above steps, it may be detected, through an application system, a processor, an electronic device, or the like, whether an icon set of the target webpage includes an icon identifier of an icon to be displayed. Alternatively, the target webpage may be a webpage that the user wants to open through a browser, and the icon to be displayed may be an icon included in the target webpage. Optionally, which icons are included in the target webpage may be predetermined by the program script, for example, the icon a and the icon B are displayed on the webpage, and icon identifiers corresponding to the icon a and the icon B may be written into the icon display component part in the program script, respectively, so as to implement unique determination of the icons.
Optionally, the icon identifier may be an icon resource ID, for example, the icon resource ID of the icon a is 1, and the icon resource ID of the icon B is 2. Optionally, the icon set may be a sprite chart (CSS sprite), which may also be called a CSS sprite, and is a web page picture application processing method, and may include scattered pictures related to a page in a large picture for loading, so as to increase the loading speed of the web page icon. According to the icon resource ID, the corresponding icon can be found from the Sprite chart, and therefore the icon is displayed in the webpage.
Step S102, if the icon set does not contain the icon identification, whether the document object model of the target webpage contains the icon identification is detected.
In the above steps, the Document Object Model may be Document Object Model, DOM for short, which is another form of markup language such as HTML generated by a browser and existing in a memory, and is an API Document based on a tree, that is, the Document is used as a tree structure to allow a code to read, process and modify the HTML Document. For ease of understanding, it can be considered as a database storing icon resources.
Optionally, under the condition that no icon identifier is detected in the icon set, that is, the sprite graph, whether the DOM of the current webpage, that is, the target webpage, contains the icon identifier is detected.
Step S103, if the document object model does not contain the icon identification, acquiring icon code data of the icon to be displayed from the network server, generating an icon resource of the icon to be displayed based on the icon code data, and displaying the icon to be displayed in the target webpage based on the icon resource, wherein the icon code data is data in a character string format.
In the above steps, the icon code data may be Base64 character string data, base64 is one of the most common encoding modes for transmitting 8-Bit byte codes on a network, and is a method for representing binary data based on 64 printable characters. Optionally, the icon resource of the icon to be displayed may be a built SVG DOM icon resource.
It should be noted that, in the above process, the data in the character string format is converted into the icon resource of the icon to be displayed, that is, the icon resource is obtained in a remote manner and the icon to be displayed is displayed in the target webpage, which brings great convenience to the user for the user-defined setting of the icon.
And step S104, if the icon set comprises an icon identifier or the document object model comprises an icon identifier, acquiring the target Scalable Vector Graphics (SVG) according to the icon identifier, and displaying the icon to be displayed in the target webpage based on the target Scalable Vector Graphics (SVG).
In the above steps, the target scalable vector graphics SVG may be a picture in SVG format corresponding to the icon identifier, and when the icon set, i.e., the sprite or the document object model, i.e., the DOM, includes the icon identifier, the corresponding picture in SVG format is obtained according to the icon identifier, and the icon to be displayed is displayed in the target web page based on the picture. For example, if the icon resource ID of the icon a is 1 and the icon resource ID of the icon B is 2, and the icon resource ID1 and the icon resource ID2 are detected in the snowy Bill chart or the DOM, obtaining the SVG-format pictures corresponding to the icon resource ID1 and the icon resource ID2, that is, displaying the icon a and the icon B in the target webpage.
It should be noted that, in the embodiment of the present invention, two forms of displaying icons are supported, that is, an SVG picture is directly obtained from a local place, or Base64 string data is obtained remotely, and the Base64 string data is processed into an SVG DOM.
Based on the schemes defined in the above steps S101 to S104, it can be known that, in the embodiment of the present invention, a manner of displaying an icon to be displayed in a target web page is implemented by acquiring an icon resource through a local manner and a remote manner, first, whether an icon identifier of the icon to be displayed is included in an icon set of the target web page is detected, if the icon identifier is not included in the icon set, whether an icon identifier is included in a document object model of the target web page is detected, if the icon identifier is not included in the document object model, icon code data of the icon to be displayed is acquired from a network server, the icon resource of the icon to be displayed is generated based on the icon code data, the icon to be displayed is displayed in the target web page based on the icon resource, and if the icon identifier is included in the icon set or the icon identifier is included in the document object model, a target scalable vector graphics SVG is acquired according to the icon identifier, and the icon to be displayed is displayed in the target web page based on the target scalable vector graphics SVG. The icon code data is data in a character string format.
It is easy to note that, in the above process, by detecting whether the icon set and the document object model contain the icon identifier of the icon to be displayed, the corresponding target scalable vector graphics SVG can be obtained through the icon identifier under the condition that the icon set or the document object model contains the icon identifier, so that the icon to be displayed can be displayed in the target webpage based on the target scalable vector graphics SVG, and the local acquisition of the icon resource and the display of the icon to be displayed in the target webpage are realized; the icon resource of the icon to be displayed is generated by acquiring the icon code data of the icon to be displayed from the network server and based on the icon code data, the data in the character string format is converted into the icon resource of the icon to be displayed, namely, the icon resource is acquired in a remote mode and the icon to be displayed is displayed in the target webpage, great convenience is brought to the user-defined setting of the icon by the user, the user-defined requirement of the user on the webpage icon can be well met, and therefore the user experience can be improved.
Therefore, through the technical scheme of the invention, the purpose of displaying the icon to be displayed in the target webpage through a local mode and a remote mode is achieved, so that the technical effect of improving the user experience is realized, and the technical problem that the user cannot realize self-defining change of the webpage icon and the user experience is influenced because the icon resource in the character string format cannot be converted into the icon resource in the Scalable Vector Graphics (SVG) format in the prior art is solved.
In an optional embodiment, in the process of generating the icon resource of the icon to be displayed based on the icon code data, firstly, a code data processor is constructed according to a preset constructor, and then, based on the code data processor, the icon code data is subjected to conversion processing to obtain the icon resource.
Optionally, the preset constructor may be a function dompalser (), the code data processor may be an object instance, namely a parser, established by the function dompalser (), and the icon code data, namely Base64 string data, may be converted by the parser to obtain the icon resource.
Specifically, in an optional embodiment, in the process of converting icon code data to obtain an icon resource based on the code data processor, the target data in the icon code data is first removed to obtain target source code data, then format conversion processing is performed on the target source code data based on the code data processor to obtain a document object of a scalable vector graphics SVG file, and then attribute information of the document object of the SVG file is processed to obtain the icon resource.
Optionally, the target data may be a prefix in icon code data, i.e., base64 string data, for example, the Base64 string data is: data is image/png; and base64, representing a png format picture resource, wherein the target data can be data image/png. Alternatively, the target source code data may be data from which a prefix of Base64 string data is removed, and the document object of the scalable vector graphics SVG file may be an SVG DOM object.
Specifically, firstly, a prefix in Base64 character string data is deleted to obtain target source code data, then format conversion processing is carried out on the target source code data based on a code data processor, namely a parser, an SVG DOM object can be obtained, then attribute information of the SVG DOM object is processed, and icon resources can be obtained. The format conversion processing of the target source code data may be performed by calling a parsefrom () method of the parser, and parsing the target source code data, which is data from which the prefix of the Base64 string data is removed, into a DOM object. Further, the DOM object is processed, and icon resources, namely the established SVG DOM icon resources, can be obtained.
It should be noted that, the DOM objects include other DOM objects besides the SVG DOM object, and in the embodiment of the present invention, the SVG DOM object is only selected from the DOM objects for use.
Optionally, the attribute information of the document object of the SVG file, i.e., the SVG DOM object, may be a style, a color, and the like.
Specifically, in an optional embodiment, in the process of processing the attribute information of the document object of the SVG file to obtain the icon resource, the style and the color of the document object of the SVG file are removed to obtain the icon resource.
Optionally, the attribute information of the SVG DOM object is processed, that is, the style and color of the SVG DOM object are deleted, so that the created SVG DOM icon resource can be obtained, and thus, an icon user (for example, a user with a user-defined requirement) can modify the style and color of the icon by endowing the style and color of the SVG DOM object again.
In an optional embodiment, after processing attribute information of a document object of the SVG file to obtain an icon resource, obtaining position information of a position reserved for an icon to be displayed in a target webpage, then determining a display position of the icon to be displayed in the target webpage based on the position information, and then displaying the icon to be displayed at the display position based on the icon resource.
Optionally, the display position may be occupied HTML, and the occupied HTML is a reserved position in the web page and is replaced by the built SVG icon. The location information may be information corresponding to placeholder HTML.
Specifically, after the Base64 character string data is converted into the established SVG DOM icon resources in the process, the established SVG DOM icon resources are used for replacing the occupied HTML, and the display of the icon to be displayed is achieved.
In an alternative embodiment, after processing the attribute information of the document object of the SVG file to obtain the icon resource, the icon resource is stored in the document object model.
Optionally, in Document Object Model (DOM), the SVG DOM icon resources built up are stored, so that the user can directly obtain the SVG DOM icon resources from the DOM when wanting to use the icon resources next time, the conversion process of converting the Base64 character string data into the built SVG DOM icon resources is not needed to be carried out again, the icon display efficiency can be improved, and the user experience is improved.
Optionally, fig. 2 is a flowchart of displaying icons in an optional web page according to an embodiment of the present invention, and as shown in fig. 2, the method mainly includes three steps:
the method comprises the steps of firstly, judging whether a page has a Sprite map icon resource, namely detecting whether the Sprite map contains the needed icon resource, if so, performing no processing, rendering the icon resource by utilizing a graphics rendering technology widely used in the field to realize icon display, and if not, entering the second step;
the second step, judging whether the page has the constructed icon resources, namely detecting whether the DOM of the current page contains the required icon resources, if so, cloning the icon resources, replacing the occupied HTML with the icon resources, and if not, entering the third step;
and a third step of constructing an icon resource, namely constructing an SVG DOM by using a Base64 character string data resource, wherein the SVG DOM is used as the icon resource, and replaces the occupied HTML after corresponding data processing.
Optionally, fig. 3 is a flowchart of an optional construction icon resource according to an embodiment of the present invention, and as shown in fig. 3, the construction icon resource mainly includes: and generating a resolver, converting the Base64 resource into a source code, resolving the source code by the resolver, processing styles and colors to obtain a constructed icon resource, cloning the icon resource, and pasting the icon resource in a page DOM.
Specifically, a parser is generated through a dompar class in the browser program code, and an XML or HTML source code stored in a Base64 string is parsed into a DOM object through the parser.
Further, data preprocessing needs to be performed on the Base64 character string, so that the processed Base64 character string can meet the parsing requirement of the parser, and specifically, the prefix of the Base64 character string is removed to obtain the source code character string.
Further, the parsefrom string method of the parser is called to parse the source code character string into a DOM object, and the needed SVG DOM resources are taken out of the DOM object. And the SVG DOM resources obtained by analysis have styles and colors.
Furthermore, the styles and colors of the SVG DOM resources are deleted, so that the corresponding styles and colors can be endowed to icon users again.
And further, replacing the occupied HTML by the SVG DOM resource with the style and the color deleted, cloning the SVG DOM resource, and then pasting the SVG DOM resource in the DOM of the current page for storage.
Therefore, through the technical scheme of the invention, the purpose of displaying the icon to be displayed in the target webpage through a local mode and a remote mode is achieved, so that the technical effect of improving the user experience is realized, and the technical problem that the user cannot realize self-definition change of the webpage icon and the user experience is influenced because the icon resource in the character string format cannot be converted into the icon resource in the Scalable Vector Graphics (SVG) format in the prior art is solved.
Example 2
According to an embodiment of the present invention, an embodiment of a device for processing a webpage icon is provided, where fig. 4 is a schematic diagram of a device for processing a selectable webpage icon according to an embodiment of the present invention, and as shown in fig. 4, the device includes: a first detection module 401, configured to detect whether an icon set of a target webpage includes an icon identifier of an icon to be displayed; a second detecting module 402, configured to detect whether a document object model of the target webpage includes an icon identifier if the icon set does not include the icon identifier; a first processing module 403, configured to, if the document object model does not include an icon identifier, obtain icon code data of an icon to be displayed from a network server, generate an icon resource of the icon to be displayed based on the icon code data, and display the icon to be displayed in a target webpage based on the icon resource, where the icon code data is data in a string format; and a second processing module 404, configured to, if the icon set includes an icon identifier or the document object model includes an icon identifier, obtain the target scalable vector graphics SVG according to the icon identifier, and display the icon to be displayed in the target webpage based on the target scalable vector graphics SVG.
It should be noted that the first detection module 401, the second detection module 402, the first processing module 403, and the second processing module 404 correspond to steps S101 to S104 in the foregoing embodiment, and the four modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure in embodiment 1.
Optionally, the first processing module includes: the construction module is used for constructing the code data processor according to a preset construction function; and the third processing module is used for carrying out conversion processing on the icon code data based on the code data processor to obtain the icon resource.
Optionally, the third processing module includes: the fourth processing module is used for removing the target data in the icon code data to obtain target source code data; the fifth processing module is used for carrying out format conversion processing on the target source code data based on the code data processor to obtain a document object of the Scalable Vector Graphics (SVG) file; and the sixth processing module is used for processing the attribute information of the document object of the SVG file to obtain the icon resource.
Optionally, the sixth processing module includes: and the seventh processing module is used for removing the styles and colors of the document objects of the SVG files to obtain the icon resources.
Optionally, the processing device for the webpage icon further includes: the acquisition module is used for acquiring the position information of the position reserved for the icon to be displayed in the target webpage; the determining module is used for determining the display position of the icon to be displayed in the target webpage based on the position information; and the display module is used for displaying the icon to be displayed at the display position based on the icon resource.
Optionally, the processing device for the webpage icon further includes: and the storage module is used for storing the icon resources in the document object model.
Example 3
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the processing method of the above-mentioned webpage icon when running.
Example 4
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors; a memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a processing method for executing the program, wherein the program is configured to execute the above-mentioned processing method for the webpage icon when executed.
Example 5
According to another aspect of the embodiments of the present invention, there is also provided a computer program product, which includes computer programs/instructions, wherein the computer programs/instructions, when executed by a processor, implement the method for processing a webpage icon.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention, which is substantially or partly contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for processing a webpage icon is characterized by comprising the following steps:
detecting whether an icon set of a target webpage contains an icon identifier of an icon to be displayed;
if the icon identification is not contained in the icon set, detecting whether a document object model of the target webpage contains the icon identification;
if the document object model does not contain the icon identification, acquiring icon code data of the icon to be displayed from a network server, generating an icon resource of the icon to be displayed based on the icon code data, and displaying the icon to be displayed in the target webpage based on the icon resource, wherein the icon code data are data in a character string format;
and if the icon set comprises the icon identifier or the document object model comprises the icon identifier, acquiring a target Scalable Vector Graphics (SVG) according to the icon identifier, and displaying the icon to be displayed in the target webpage based on the target Scalable Vector Graphics (SVG).
2. The method of claim 1, wherein generating the icon resource of the icon to be displayed based on the icon code data comprises:
constructing a code data processor according to a preset construction function;
and based on the code data processor, converting the icon code data to obtain the icon resource.
3. The method of claim 2, wherein converting the icon code data based on the code data processor to obtain the icon resource comprises:
removing target data in the icon code data to obtain target source code data;
based on the code data processor, carrying out format conversion processing on the target source code data to obtain a document object of the Scalable Vector Graphics (SVG) file;
and processing the attribute information of the document object of the SVG file to obtain the icon resource.
4. The method of claim 3, wherein processing the attribute information of the document object of the SVG file to obtain the icon resource comprises:
and removing the styles and colors of the document objects of the SVG file to obtain the icon resources.
5. The method according to claim 3, wherein after processing the attribute information of the document object of the SVG file to obtain the icon resource, the method further comprises:
acquiring position information of a position reserved for the icon to be displayed in the target webpage;
determining the display position of the icon to be displayed in the target webpage based on the position information;
and displaying the icon to be displayed at the display position based on the icon resource.
6. The method according to claim 3, wherein after processing the attribute information of the document object of the SVG file to obtain the icon resource, the method further comprises:
and storing the icon resource in the document object model.
7. A device for processing a webpage icon, comprising:
the first detection module is used for detecting whether the icon set of the target webpage contains the icon identification of the icon to be displayed;
the second detection module is used for detecting whether the document object model of the target webpage contains the icon identifier or not if the icon identifier is not contained in the icon set;
the first processing module is used for acquiring icon code data of the icon to be displayed from a network server if the document object model does not contain the icon identifier, generating an icon resource of the icon to be displayed based on the icon code data, and displaying the icon to be displayed in the target webpage based on the icon resource, wherein the icon code data is data in a character string format;
and the second processing module is used for acquiring a target Scalable Vector Graphics (SVG) according to the icon identifier if the icon identifier is contained in the icon set or the icon identifier is contained in the document object model, and displaying the icon to be displayed in the target webpage based on the target Scalable Vector Graphics (SVG).
8. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the processing method of the web page icon according to any one of claims 1 to 6 when the computer program is executed.
9. An electronic device, wherein the electronic device comprises one or more processors; memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method for running a program, wherein the program is arranged to perform the method of processing a web page icon as claimed in any one of claims 1 to 6 when run.
10. A computer program product comprising computer programs/instructions, characterized in that the computer programs/instructions, when executed by a processor, implement the method of processing a web page icon according to any one of claims 1 to 6.
CN202211422910.XA 2022-11-14 2022-11-14 Processing method and device of webpage icon, storage medium and electronic equipment Pending CN115904167A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211422910.XA CN115904167A (en) 2022-11-14 2022-11-14 Processing method and device of webpage icon, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211422910.XA CN115904167A (en) 2022-11-14 2022-11-14 Processing method and device of webpage icon, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115904167A true CN115904167A (en) 2023-04-04

Family

ID=86472220

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211422910.XA Pending CN115904167A (en) 2022-11-14 2022-11-14 Processing method and device of webpage icon, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115904167A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116679852A (en) * 2023-08-03 2023-09-01 民航成都信息技术有限公司 Project icon quotation method and device, electronic equipment and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116679852A (en) * 2023-08-03 2023-09-01 民航成都信息技术有限公司 Project icon quotation method and device, electronic equipment and medium
CN116679852B (en) * 2023-08-03 2023-10-27 民航成都信息技术有限公司 Project icon quotation method and device, electronic equipment and medium

Similar Documents

Publication Publication Date Title
US20160283499A1 (en) Webpage advertisement interception method, device and browser
US20120042236A1 (en) Integrated document viewer
US8910036B1 (en) Web based copy protection
CN108399072B (en) Application page updating method and device
US8671389B1 (en) Web application resource manager on the web and localizable components
CN104866512A (en) Method, device and system for extracting webpage content
CN104243273A (en) Method and device for displaying information on instant messaging client and information display system
CN106951270B (en) Code processing method, system and server
US20150154159A1 (en) Identification of In-Context Resources that are not Fully Localized
CN105094775A (en) Webpage generation method and apparatus
US20150161160A1 (en) Application Localization
CN115904167A (en) Processing method and device of webpage icon, storage medium and electronic equipment
Fu et al. Digital forensics of Microsoft Office 2007–2013 documents to prevent covert communication
CN103493042A (en) Browsing system, terminal, image server, program, computer-readable recording medium recording said program, and method
CA2602749C (en) System and method of report representation
US8452814B1 (en) Gathering context in action to support in-context localization
CN115065945B (en) Short message link generation method and device, electronic equipment and storage medium
CN109740074B (en) Method, device and equipment for processing parameter configuration information
US9965446B1 (en) Formatting a content item having a scalable object
CN109614592B (en) Text processing method and device, storage medium and electronic equipment
CN114741144B (en) Web-side complex form display method, device and system
JP7029557B1 (en) Judgment device, judgment method and judgment program
CN113139145B (en) Page generation method and device, electronic equipment and readable storage medium
CN102099806B (en) Information output apparatus, information output method, and recording medium
CN111783482A (en) Text translation method and device, computer equipment and storage medium

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