CN112650435A - Page content rolling processing method and device, computer equipment and storage medium - Google Patents

Page content rolling processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112650435A
CN112650435A CN202011540128.9A CN202011540128A CN112650435A CN 112650435 A CN112650435 A CN 112650435A CN 202011540128 A CN202011540128 A CN 202011540128A CN 112650435 A CN112650435 A CN 112650435A
Authority
CN
China
Prior art keywords
target
page
array
new value
value
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
CN202011540128.9A
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011540128.9A priority Critical patent/CN112650435A/en
Publication of CN112650435A publication Critical patent/CN112650435A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0484Interaction techniques based on graphical user interfaces [GUI] for the control of specific functions or operations, e.g. selecting or manipulating an object, an image or a displayed text element, setting a parameter value or selecting a range
    • G06F3/0485Scrolling or panning

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the technical field of data processing, and discloses a page content rolling processing method, a page content rolling processing device, a computer device and a storage medium, wherein the page content rolling processing method comprises the following steps: acquiring a descriptive text corresponding to a page needing to be rolled, and generating a tree structure corresponding to the descriptive text; traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure; in response to a monitored change in the state of a target attribute, triggering a data processing function and comparing a new value of the target attribute with an old value; generating a target array according to the result obtained by comparison; triggering a rendering page function and rendering the descriptive text according to the target array to obtain a target page; and calling a loop traversal rendering style and performing rolling display on the target page. The invention can improve the processing speed and accuracy of page content scrolling.

Description

Page content rolling processing method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a page content scroll processing method and apparatus, a computer device, and a storage medium.
Background
Most of page content scrolling components in the current market are rendered in a picture format, are limited in size and specification, poor in extensibility, low in flexibility, difficult to change, and high in requirements during use, and need a large number of incoming attributes to control characteristic display. And the problem that the page content scrolling cannot meet the automatic adaptive resolution of the content often occurs. On the basis of the method, the page content rolling code is changed, so that not only is manpower wasted and huge time is needed, but also the cost of modification is increased, whether other problems occur in the modified function or not can not be guaranteed, and the risk of the function cannot be predicted.
Therefore, how to increase the processing speed of page content scrolling becomes an urgent problem to be solved.
Disclosure of Invention
In view of the above, there is a need for a page content scrolling processing method, apparatus, computer device and storage medium, which can improve the processing rate and accuracy of page content scrolling.
The first aspect of the present invention provides a page content scroll processing method, where the page content scroll processing method includes:
acquiring a descriptive text corresponding to a page needing to be rolled, and generating a tree structure corresponding to the descriptive text;
traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure;
in response to a monitored change in the state of a target attribute, triggering a data processing function and comparing a new value of the target attribute with an old value;
generating a target array according to the result obtained by comparison;
triggering a rendering page function and rendering the descriptive text according to the target array to obtain a target page;
and calling a loop traversal rendering style and performing rolling display on the target page.
According to an alternative embodiment of the present invention, the generating the tree structure corresponding to the descriptive text includes:
analyzing the descriptive text to obtain a plurality of attributes and attribute tags corresponding to the attributes;
determining a label level corresponding to an attribute label corresponding to each attribute in a preset label system, and determining the importance of each attribute according to the level of the label level;
determining the node level of each attribute in the tree structure according to the importance;
and generating a tree structure corresponding to the descriptive text according to the node level corresponding to each attribute.
According to an alternative embodiment of the invention, said triggering a data processing function and comparing the new value of the target property with the old value comprises:
acquiring a new value of the target attribute and a first storage parameter of the new value;
acquiring an old value of the target attribute and a second storage parameter of the old value;
determining a first digit corresponding to the first storage parameter and determining a second digit corresponding to the second storage parameter;
triggering the data processing function to perform a comparison of the new value and the old value based on the first number of bits and the second number of bits.
According to an alternative embodiment of the present invention, the generating the target array according to the result of the comparison comprises:
when the result obtained by comparison shows that the first digit is greater than the second digit, calculating the digit difference between the first digit and the second digit; performing bit complement processing on the old value according to the bit number difference; generating an old value array according to the old value after bit complementing processing;
when the result obtained by comparison shows that the first digit is smaller than the second digit, intercepting the old value according to the first digit; generating an old value array according to the intercepted old value;
carrying out data conversion on the new value to obtain a new value array;
and carrying out data splicing on the old value array and the new value array to obtain a target array.
According to an optional embodiment of the present invention, after the data splicing is performed on the old value array and the new value array to obtain a target array, the method further includes:
judging whether the target array is larger than a preset length threshold value or not;
and when the target array is larger than the preset length threshold, carrying out partition marking processing on the target array according to a preset sliding step length to obtain a partition marked target array.
According to an optional embodiment of the present invention, the triggering a render page function to render the descriptive text according to the target array to obtain a target page includes:
analyzing a cascading style sheet corresponding to the descriptive text to construct a cascading tree;
generating a rendering tree according to the tree structure corresponding to the laminated tree and the descriptive text;
and triggering a rendering page function to render the rendering tree according to the target array to obtain a target page.
According to an alternative embodiment of the present invention, the invoking of the loop traversal rendering style to scroll-display the target page includes:
judging whether the digit of the new value is larger than a preset digit threshold value;
when the digit of the new value is larger than the preset digit threshold value, the new value array corresponding to the new value is divided to obtain a plurality of new value sub-arrays;
calling a cyclic traversal rendering style to traverse each new value element in each new value sub-array;
determining a content tag element in the target page that is co-located with each of the new value elements;
splicing each content label element, and writing the spliced content label elements into the descriptive text;
and using a dom element example to perform scrolling display on the target page according to the descriptive text.
A second aspect of the present invention provides a page content scroll processing apparatus, including:
the page processing module is used for acquiring descriptive texts corresponding to pages needing to be rolled and generating tree structures corresponding to the descriptive texts;
the attribute monitoring module is used for traversing the tree structure layer by layer and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure;
the attribute comparison module is used for responding to the monitored state change of the target attribute, triggering a data processing function and comparing a new value of the target attribute with an old value;
the array generating module is used for generating a target array according to the result obtained by the comparison;
the page rendering module is used for triggering a page rendering function and rendering the descriptive text according to the target array to obtain a target page;
and the page display module is used for calling a circular traversal rendering style and carrying out rolling display on the target page.
A third aspect of the invention provides a computer device comprising a memory and a processor; the memory is used for storing a computer program; the processor is used for executing the computer program and realizing the page content scrolling processing method when the computer program is executed.
A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to implement the page content scroll processing method as described above.
The embodiment of the invention discloses a page content rolling processing method, a device, a computer device and a storage medium, which can be used for comprehensively expressing the structure of a descriptive text by acquiring the descriptive text corresponding to a page to be rolled and generating a tree structure corresponding to the descriptive text by using the tree structure, thereby facilitating the operations of accessing, modifying, adding, deleting and the like of the descriptive text, accelerating the processing efficiency of rolling the page content, traversing the tree structure layer by layer, monitoring a plurality of attributes corresponding to the traversed layer in the tree structure, acquiring the change of the attributes in the tree structure in time by monitoring the attribute values in the tree structure, accelerating the data rolling processing speed, responding to the state change of the monitored target attribute, triggering a data processing function and comparing the new value with the old value of the target attribute, and generating a target array according to a result obtained by comparison, obtaining a more accurate target array by comparing a new value with an old value so as to improve the rendering accuracy, then triggering a rendering page function to render the descriptive text according to the target array to obtain a target page, and finally calling a circular traversal rendering style to perform rolling display on the target page. The invention can improve the processing speed and accuracy of page content scrolling.
Drawings
Fig. 1 is a schematic flowchart of a page content scrolling processing method according to an embodiment of the present invention;
fig. 2 is a schematic block diagram of a page content scroll processing apparatus according to an embodiment of the present invention;
fig. 3 is a schematic block diagram of a structure of a computer device according to an embodiment of the present invention.
Detailed Description
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 some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the invention provides a page content rolling processing method and device, computer equipment and a computer readable storage medium. The page content rolling processing method can be applied to terminal equipment or a server, the terminal equipment can be electronic equipment such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and wearable equipment, and the server can be a single server or a server cluster consisting of a plurality of servers. The following explains the page content scroll processing method applied to a server as an example.
Some embodiments of the invention are described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flow chart of a page content scrolling processing method according to an embodiment of the present invention.
As shown in fig. 1, the page content scrolling processing method specifically includes steps S11 to S16, and the order of the steps in the flowchart may be changed or some steps may be omitted according to different requirements.
S11, obtaining the descriptive text corresponding to the page needing to be rolled, and generating the tree structure corresponding to the descriptive text.
The method comprises the steps of obtaining a text of a page needing scrolling processing, such as a descriptive text (html text), and generating a tree structure corresponding to the descriptive text according to the descriptive text. The tree structure may include a Document Object Model (DOM). The tree structure can comprehensively express the structure of the descriptive text, and facilitates the operations of accessing, modifying, adding, deleting and the like of the descriptive text, thereby accelerating the processing efficiency of scrolling the page content.
In some embodiments, the generating the tree structure corresponding to the descriptive text includes:
analyzing the descriptive text to obtain a plurality of attributes and attribute tags corresponding to the attributes;
determining a label level corresponding to an attribute label corresponding to each attribute in a preset label system, and determining the importance of each attribute according to the level of the label level;
determining the node level of each attribute in the tree structure according to the importance;
and generating a tree structure corresponding to the descriptive text according to the node level corresponding to each attribute.
The attributes may include a TITLE class (TITLE), a text Class (CONTENT), a visual class (VISION), a BLOCK class (BLOCK), a hyperlink class (LINK), OTHER classes (OTHER), and the like, a label system is preset, the label system includes a plurality of attribute labels and label hierarchies corresponding to the attribute labels, such as a primary label, a secondary label, and the like, exemplarily, the importance degree corresponding to the attributes with the label hierarchy is also large, and the label system may be customized by a user. The higher the node hierarchy corresponding to the attribute with the higher importance. And generating a tree structure corresponding to the descriptive text according to the attribute tags corresponding to the attributes in the descriptive text, so that the tree structure can more accurately express the structure of the descriptive text.
And S12, traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure.
Illustratively, the attribute values in the tree structure may be monitored by means of event (watch) monitoring, for example, the attribute values in the tree structure may be monitored by means of deep (deep) monitoring in event monitoring, that is, the tree structure is traversed hierarchically, and monitoring is added to each attribute in the tree structure, and the deep monitoring may monitor the tree structure comprehensively, so as to avoid missing information, thereby improving accuracy of digital scroll processing.
S13, in response to a change in the state of the target attribute being monitored, triggering a data processing function and comparing the new value of the target attribute with the old value.
Any attribute whose state changes is referred to as a target attribute. The states may include: the value of the attribute, the attribute tag of the attribute.
When monitoring that the attribute value in the tree structure changes, responding to the change of the attribute value, acquiring a new attribute value, namely a new value, and triggering a data processing function to compare the new value with an old value.
In some embodiments, the triggering a data processing function and comparing the new value of the target attribute to the old value comprises:
acquiring a new value of the target attribute and a first storage parameter of the new value;
acquiring an old value of the target attribute and a second storage parameter of the old value;
determining a first digit corresponding to the first storage parameter and determining a second digit corresponding to the second storage parameter;
triggering the data processing function to perform a comparison of the new value and the old value based on the first number of bits and the second number of bits.
For example, the number of bits of a value may be determined based on a stored parameter of the value. For example, the data processing function determines the number of bits of the new value according to the storage parameter of the new value, determines the number of bits of the old value according to the storage parameter of the old value, and compares the number of bits of the new value with the number of bits of the old value to obtain a comparison result.
Wherein, the result obtained by comparison comprises: the first number of bits is greater than the second number of bits, the first number of bits is equal to the first number of bits or the first number of bits is less than the second number of bits.
And S14, generating a target array according to the result obtained by comparison.
And processing the new value and the old value according to the result obtained by the comparison to obtain a target array, wherein the target array is used for rendering the descriptive text.
In some embodiments, the generating the target array according to the result of the comparison includes:
when the result obtained by comparison shows that the first digit is greater than the second digit, calculating the digit difference between the first digit and the second digit; performing bit complement processing on the old value according to the bit number difference; generating an old value array according to the old value after bit complementing processing;
when the result obtained by comparison shows that the first digit is smaller than the second digit, intercepting the old value according to the first digit; generating an old value array according to the intercepted old value;
carrying out data conversion on the new value to obtain a new value array;
and carrying out data splicing on the old value array and the new value array to obtain a target array.
For example, when it is determined that the new value has a greater number of bits than the old value according to the comparison result, that is, the first number of bits is greater than the second number of bits, a bit complementing operation is performed on the old value according to a bit number difference, for example, when the bit number difference is 1, a preset arabic number, such as 0, is added to the leftmost of the old value, and the old value array is obtained according to the old value after the bit complementing operation. For example, if the new value is 1000 and the old value is 100, then the bit-complemented old value is 0100, resulting in an array of [0, 1, 0, 0] old values.
For example, when it is determined that the new value has a bit number smaller than the old value according to the comparison result, that is, the first bit number is smaller than the second bit number, the old value is intercepted according to the bit number of the new value, for example, when the new value has a bit number of 3, the old value is intercepted by 3 bits from the rightmost side of the old value as the processed old value, and the old value array is obtained according to the processed old value. For example, if the new value is 100 and the old value is 1000, then the old value after the process is truncated to 000, resulting in an array of old values of [0, 0, 0 ].
For example, when the comparison result determines that the new value has a bit number equal to the old value, that is, the first bit number is equal to the second bit number, the old value is directly converted into an array form without processing the old value, and an old value array is generated.
Illustratively, the new value is converted to an array form, such as a new value of 1000, resulting in a new value array of [1, 0, 0, 0 ].
In this optional embodiment, the old value is processed according to the result obtained by the comparison to obtain an old value array; the old value is processed according to the result obtained by comparison, so that the new value and the old value are unified in format, the target array is obtained based on the generated old value array and the generated new value array, the error rate in rendering is reduced when the page to be rolled is rendered according to the target array, and the processing efficiency of digital rolling is improved.
For example, a value may be selected from the old value array and the new value array as a target array according to a preset selection rule.
By splicing the data in the old value array and the data in the new value array, data information can be effectively fused, so that the information content contained in the target array is more comprehensive, the rendering success rate is favorably improved, and the processing efficiency of digital scrolling is improved.
In some embodiments, after obtaining the target array according to the result of the comparison, the method further includes:
judging whether the target array is larger than a preset length threshold value or not;
and when the target array is larger than the preset length threshold, carrying out partition marking processing on the target array according to a preset sliding step length to obtain a partition marked target array.
For example, the preset length threshold is 3, the target array is [1, 0, 0, 0, 0, 0], the target array is greater than the preset length threshold, the target array is subjected to partition marking processing according to a preset sliding step length, the sliding step length may be the same as the preset length threshold and is 3, and certainly, the user-defined setting may also be performed according to the user's requirement. For example, a thousand-bit separator may be added to the target array as a partition marker for the target array.
By marking the target array exceeding the preset length threshold in a partitioning manner, the situation that the interrupted position information in the target array cannot be quickly found out when the rendering process is interrupted accidentally due to the overlong target array can be avoided.
And S15, triggering a page rendering function and rendering the descriptive text according to the target array to obtain a target page.
Illustratively, the render page function may include a render function.
In some embodiments, the triggering the render page function to render the descriptive text according to the target array to obtain a target page includes:
analyzing a cascading style sheet corresponding to the descriptive text to construct a cascading tree;
generating a rendering tree according to the tree structure corresponding to the laminated tree and the descriptive text;
and triggering a rendering page function to render the rendering tree according to the target array to obtain a target page.
Illustratively, the cascading style sheet includes a CSS, the cascading tree includes a CSS tree, when the CSS is obtained, a node (Token) in the CSS is read, and the CSS tree is constructed according to the node, where the CSS may be an ID or a class.
The descriptive text is rendered by constructing the rendering tree, so that the efficiency of traversing the descriptive text can be improved, and the rendering efficiency of the descriptive text is accelerated.
And S16, calling a loop to traverse the rendering style and displaying the target page in a rolling way.
Illustratively, the rendered descriptive text may be scroll-exposed using a loop traversal rendering style of SASS, such as using the for-loop syntax in SASS. The cycle traversal rendering style of the SASS can reduce the writing quantity of codes in the data scroll processing and accelerate the data scroll processing speed.
In an optional embodiment, the invoking of the loop traversal rendering style to scroll-display the target page includes:
judging whether the digit of the new value is larger than a preset digit threshold value;
when the digit of the new value is larger than the preset digit threshold value, the new value array corresponding to the new value is divided to obtain a plurality of new value sub-arrays;
calling a cyclic traversal rendering style to traverse each new value element in each new value sub-array;
determining content tag elements in the target page having the same number of bits as each of the new value subarrays;
splicing each content label element, and writing the spliced content label elements into the descriptive text;
and using a dom element example to perform scrolling display on the target page according to the descriptive text.
Illustratively, a bit number threshold corresponding to the bit number of a new value is preset, and when the bit number of the new value is greater than the preset bit number threshold, a new value array corresponding to the new value is segmented to obtain a plurality of new value sub-arrays; and the new value array is segmented according to the preset digit threshold value, so that the condition that rendering fails due to overlong new value array is avoided, and the rendering efficiency is improved. For example, the preset length threshold is 3, the new value is 10000, the number of bits is 5 greater than the preset length threshold 1, and the new value array corresponding to the new value is divided to obtain two new value sub-arrays [1, 0, 0], [0, 0 ].
And calling a loop traversal rendering style to traverse each new value element in each new value sub-array, such as the loop traversal rendering style of the SASS. And determining content tag elements with the same position as each new value element in the target page, splicing each determined content tag element, and writing the spliced content tag elements into a descriptive text corresponding to the target page. And using a dom element example to perform scrolling display on the target page according to the descriptive text. Dom element instances may be obtained using this $ refs.
It should be noted that, in order to ensure the privacy and security of the data in the page content scrolling process, such as the descriptive text, the tree structure, the attribute, the target array, and the like, may be stored in the block chain.
In the page content scrolling processing method provided in the above embodiment, by obtaining the descriptive text corresponding to the page to be scrolled, and generating the tree structure corresponding to the descriptive text, the tree structure can be used to comprehensively represent the structure of the descriptive text, thereby facilitating operations such as access, modification, addition, deletion and the like of the descriptive text, so as to increase the processing efficiency of scrolling the page content, then traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layer in the tree structure, and by monitoring the attribute values in the tree structure, the change of the attributes in the tree structure can be timely obtained, thereby increasing the data scrolling processing rate, in response to the change of the state of the monitored target attribute, triggering the data processing function, comparing the new value of the target attribute with the old value, and generating the target array according to the result obtained by comparison, and a more accurate target array can be obtained by comparing the new value with the old value, so that the rendering accuracy is improved, then a rendering page function is triggered to render the descriptive text according to the target array to obtain a target page, and finally a circular traversal rendering style is called to perform rolling display on the target page. The invention can improve the processing speed and accuracy of page content scrolling.
Referring to fig. 2, fig. 2 is a schematic block diagram of a page content scrolling processing device according to an embodiment of the present invention.
In some embodiments, the page content scroll processing apparatus 20 may include a plurality of functional modules formed by computer program segments, the computer program segments of the page content scroll processing apparatus 20 may be stored in a memory of the electronic device and executed by at least one processor to perform (see fig. 1 for details) the page content scroll processing function, and the page content scroll processing apparatus may be configured in a server or a terminal.
The server may be an independent server or a server cluster. The terminal can be an electronic device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device.
In the present embodiment, the page content scroll processing device 20 may be divided into a plurality of functional modules according to the functions performed by the device. As shown in fig. 2, the functional module may include: the system comprises a page processing module 201, an attribute monitoring module 202, an attribute comparison module 203, an array generation module 204, a page rendering module 205 and a page presentation module 206. The module referred to herein is a series of computer program segments capable of being executed by at least one processor and capable of performing a fixed function and is stored in memory. In the present embodiment, the functions of the modules will be described in detail in the following embodiments.
The page processing module 201 is configured to obtain a descriptive text corresponding to a page to be scrolled, and generate a tree structure corresponding to the descriptive text.
The method comprises the steps of obtaining a text of a page needing scrolling processing, such as a descriptive text (html text), and generating a tree structure corresponding to the descriptive text according to the descriptive text. The tree structure may include a Document Object Model (DOM). The tree structure can comprehensively express the structure of the descriptive text, and facilitates the operations of accessing, modifying, adding, deleting and the like of the descriptive text, thereby accelerating the processing efficiency of scrolling the page content.
In some embodiments, the page processing module 201 generating the tree structure corresponding to the descriptive text includes:
analyzing the descriptive text to obtain a plurality of attributes and attribute tags corresponding to the attributes;
determining a label level corresponding to an attribute label corresponding to each attribute in a preset label system, and determining the importance of each attribute according to the level of the label level;
determining the node level of each attribute in the tree structure according to the importance;
and generating a tree structure corresponding to the descriptive text according to the node level corresponding to each attribute.
The attributes may include a TITLE class (TITLE), a text Class (CONTENT), a visual class (VISION), a BLOCK class (BLOCK), a hyperlink class (LINK), OTHER classes (OTHER), and the like, a label system is preset, the label system includes a plurality of attribute labels and label hierarchies corresponding to the attribute labels, such as a primary label, a secondary label, and the like, exemplarily, the importance degree corresponding to the attributes with the label hierarchy is also large, and the label system may be customized by a user. The higher the node hierarchy corresponding to the attribute with the higher importance. And generating a tree structure corresponding to the descriptive text according to the attribute tags corresponding to the attributes in the descriptive text, so that the tree structure can more accurately express the structure of the descriptive text.
The attribute monitoring module 202 is configured to traverse the tree structure layer by layer, and monitor a plurality of attributes corresponding to the traversed layer in the tree structure.
Illustratively, the attribute values in the tree structure may be monitored by means of event (watch) monitoring, for example, the attribute values in the tree structure may be monitored by means of deep (deep) monitoring in event monitoring, that is, the tree structure is traversed hierarchically, and monitoring is added to each attribute in the tree structure, and the deep monitoring may monitor the tree structure comprehensively, so as to avoid missing information, thereby improving accuracy of digital scroll processing.
And the attribute comparison module 203 is used for responding to the monitored state change of the target attribute, triggering a data processing function and comparing the new value of the target attribute with the old value.
Any attribute whose state changes is referred to as a target attribute. The states may include: the value of the attribute, the attribute tag of the attribute.
When monitoring that the attribute value in the tree structure changes, responding to the change of the attribute value, acquiring a new attribute value, namely a new value, and triggering a data processing function to compare the new value with an old value.
In some embodiments, the attribute comparison module 203 triggers a data processing function and comparing the new value of the target attribute to the old value comprises:
acquiring a new value of the target attribute and a first storage parameter of the new value;
acquiring an old value of the target attribute and a second storage parameter of the old value;
determining a first digit corresponding to the first storage parameter and determining a second digit corresponding to the second storage parameter;
triggering the data processing function to perform a comparison of the new value and the old value based on the first number of bits and the second number of bits.
For example, the number of bits of a value may be determined based on a stored parameter of the value. For example, the data processing function determines the number of bits of the new value according to the storage parameter of the new value, determines the number of bits of the old value according to the storage parameter of the old value, and compares the number of bits of the new value with the number of bits of the old value to obtain a comparison result.
Wherein, the result obtained by comparison comprises: the first number of bits is greater than the second number of bits, the first number of bits is equal to the first number of bits or the first number of bits is less than the second number of bits.
And an array generating module 204, configured to generate a target array according to the result obtained by the comparison.
And processing the new value and the old value according to the result obtained by the comparison to obtain a target array, wherein the target array is used for rendering the descriptive text.
In some embodiments, the generating the target array by the array generating module 204 according to the comparison result includes:
when the result obtained by comparison shows that the first digit is greater than the second digit, calculating the digit difference between the first digit and the second digit; performing bit complement processing on the old value according to the bit number difference; generating an old value array according to the old value after bit complementing processing;
when the result obtained by comparison shows that the first digit is smaller than the second digit, intercepting the old value according to the first digit; generating an old value array according to the intercepted old value;
carrying out data conversion on the new value to obtain a new value array;
and carrying out data splicing on the old value array and the new value array to obtain a target array.
For example, when it is determined that the new value has a greater number of bits than the old value according to the comparison result, that is, the first number of bits is greater than the second number of bits, a bit complementing operation is performed on the old value according to a bit number difference, for example, when the bit number difference is 1, a preset arabic number, such as 0, is added to the leftmost of the old value, and the old value array is obtained according to the old value after the bit complementing operation. For example, if the new value is 1000 and the old value is 100, then the bit-complemented old value is 0100, resulting in an array of [0, 1, 0, 0] old values.
For example, when it is determined that the new value has a bit number smaller than the old value according to the comparison result, that is, the first bit number is smaller than the second bit number, the old value is intercepted according to the bit number of the new value, for example, when the new value has a bit number of 3, the old value is intercepted by 3 bits from the rightmost side of the old value as the processed old value, and the old value array is obtained according to the processed old value. For example, if the new value is 100 and the old value is 1000, then the old value after the process is truncated to 000, resulting in an array of old values of [0, 0, 0 ].
For example, when the comparison result determines that the new value has a bit number equal to the old value, that is, the first bit number is equal to the second bit number, the old value is directly converted into an array form without processing the old value, and an old value array is generated.
Illustratively, the new value is converted to an array form, such as a new value of 1000, resulting in a new value array of [1, 0, 0, 0 ]. In this optional embodiment, the old value is processed according to the result obtained by the comparison to obtain an old value array; the old value is processed according to the result obtained by comparison, so that the new value and the old value are unified in format, the target array is obtained based on the generated old value array and the generated new value array, the error rate in rendering is reduced when the page to be rolled is rendered according to the target array, and the processing efficiency of digital rolling is improved.
For example, a value may be selected from the old value array and the new value array as a target array according to a preset selection rule.
By splicing the data in the old value array and the data in the new value array, data information can be effectively fused, so that the information content contained in the target array is more comprehensive, the rendering success rate is favorably improved, and the processing efficiency of digital scrolling is improved.
In some embodiments, after the array generating module 204 obtains the target array according to the result of the comparison, the array generating module 204 is further configured to:
judging whether the target array is larger than a preset length threshold value or not;
and when the target array is larger than the preset length threshold, carrying out partition marking processing on the target array according to a preset sliding step length to obtain a partition marked target array.
For example, the preset length threshold is 3, the target array is [1, 0, 0, 0, 0, 0], the target array is greater than the preset length threshold, the target array is subjected to partition marking processing according to a preset sliding step length, the sliding step length may be the same as the preset length threshold and is 3, and certainly, the user-defined setting may also be performed according to the user's requirement. For example, a thousand-bit separator may be added to the target array as a partition marker for the target array.
By marking the target array exceeding the preset length threshold in a partitioning manner, the situation that the interrupted position information in the target array cannot be quickly found out when the rendering process is interrupted accidentally due to the overlong target array can be avoided.
And the text rendering module 205 is configured to trigger a render page function and render the descriptive text according to the target array to obtain a target page.
Illustratively, the render page function may include a render function.
In some embodiments, the triggering, by the text rendering module 205, a render page function to render the descriptive text according to the target array to obtain a target page includes:
analyzing a cascading style sheet corresponding to the descriptive text to construct a cascading tree;
generating a rendering tree according to the tree structure corresponding to the laminated tree and the descriptive text;
and triggering a rendering page function to render the rendering tree according to the target array to obtain a target page.
Illustratively, the cascading style sheet includes a CSS, the cascading tree includes a CSS tree, when the CSS is obtained, a node (Token) in the CSS is read, and the CSS tree is constructed according to the node, where the CSS may be an ID or a class.
The descriptive text is rendered by constructing the rendering tree, so that the efficiency of traversing the descriptive text can be improved, and the rendering efficiency of the descriptive text is accelerated.
And the page display module 206 is used for calling a loop traversal rendering style and performing scroll display on the target page. Illustratively, the rendered descriptive text may be scroll-exposed using a loop traversal rendering style of SASS, such as using the for-loop syntax in SASS. The cycle traversal rendering style of the SASS can reduce the writing quantity of codes in the data scroll processing and accelerate the data scroll processing speed.
In an alternative embodiment, the page presentation module 206 invoking a loop traversal rendering style to scroll-present the target page includes:
judging whether the digit of the new value is larger than a preset digit threshold value;
when the digit of the new value is larger than the preset digit threshold value, the new value array corresponding to the new value is divided to obtain a plurality of new value sub-arrays;
calling a cyclic traversal rendering style to traverse each new value element in each new value sub-array;
determining content tag elements in the target page having the same number of bits as each of the new value subarrays;
splicing each content label element, and writing the spliced content label elements into the descriptive text;
and using a dom element example to perform scrolling display on the target page according to the descriptive text.
Illustratively, a bit number threshold corresponding to the bit number of a new value is preset, and when the bit number of the new value is greater than the preset bit number threshold, a new value array corresponding to the new value is segmented to obtain a plurality of new value sub-arrays; and the new value array is segmented according to the preset digit threshold value, so that the condition that rendering fails due to overlong new value array is avoided, and the rendering efficiency is improved. For example, the preset length threshold is 3, the new value is 10000, the number of bits is 5 greater than the preset length threshold 1, and the new value array corresponding to the new value is divided to obtain two new value sub-arrays [1, 0, 0], [0, 0 ].
And calling a loop traversal rendering style to traverse each new value element in each new value sub-array, such as the loop traversal rendering style of the SASS. And determining content tag elements with the same position as each new value element in the target page, splicing each determined content tag element, and writing the spliced content tag elements into a descriptive text corresponding to the target page. And using a dom element example to perform scrolling display on the target page according to the descriptive text. Dom element instances may be obtained using this $ refs.
It should be noted that, in order to ensure the privacy and security of the data in the page content scrolling process, such as the descriptive text, the tree structure, the attribute, the target array, and the like, may be stored in the block chain.
The page content scroll processing apparatus provided by the above embodiment may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in fig. 3.
Referring to fig. 3, fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device may be a server or a terminal device.
As shown in fig. 3, the computer device 30 includes a processor 301 and a memory 302 connected by a system bus, wherein the memory 302 may include a nonvolatile storage medium and a volatile storage medium.
The memory 302 may store an operating system and computer programs. The computer program comprises computer readable instructions which, when executed, cause the processor 301 to perform the page content scroll processing method.
The processor 301 is used to provide computing and control capabilities, supporting the operation of the overall computer device.
In a possible embodiment, the computer device further comprises a network interface for performing network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that the configuration shown in fig. 3 is a block diagram of only a portion of the configuration associated with aspects of the present invention and is not intended to limit the computing devices to which aspects of the present invention may be applied, and that a particular computing device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that Processor 301 is a Central Processing Unit (CPU), and may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor executes a computer program stored in the memory to implement the steps of:
acquiring a descriptive text corresponding to a page needing to be rolled, and generating a tree structure corresponding to the descriptive text;
traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure;
in response to a monitored change in the state of a target attribute, triggering a data processing function and comparing a new value of the target attribute with an old value;
generating a target array according to the result obtained by comparison;
triggering a rendering page function and rendering the descriptive text according to the target array to obtain a target page;
and calling a loop traversal rendering style and performing rolling display on the target page.
Specifically, the processor may refer to the description of the relevant steps in the foregoing embodiment of the page content scrolling processing method, which is not described herein again.
Embodiments of the present invention further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes computer-readable instructions, and when the computer instructions are executed, a method implemented by the computer program may refer to the embodiments of the page content scrolling processing method in the present invention.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
Further, the computer-readable storage medium may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function, and the like; the storage data area may store data created according to the use of the blockchain node, and the like.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The page content scrolling processing apparatus, the computer device, and the computer-readable storage medium provided in the foregoing embodiments can accelerate the processing efficiency of scrolling the page content by acquiring the descriptive text corresponding to the page to be scrolled and generating the tree structure corresponding to the descriptive text, so that the structure of the descriptive text can be comprehensively represented by using the tree structure, and operations such as accessing, modifying, adding, and deleting the descriptive text are facilitated, and then the tree structure is traversed layer by layer, and a plurality of attributes corresponding to the traversed layer in the tree structure are monitored, and the change of the attribute in the tree structure can be timely acquired by monitoring the attribute value in the tree structure, so that the rate of data scrolling is accelerated, in response to the monitored state change of the target attribute, a data processing function is triggered and the new value of the target attribute is compared with the old value, and generating a target array according to a result obtained by comparison, obtaining a more accurate target array by comparing a new value with an old value so as to improve the rendering accuracy, then triggering a rendering page function to render the descriptive text according to the target array to obtain a target page, and finally calling a circular traversal rendering style to perform rolling display on the target page. The invention can improve the processing speed and accuracy of page content scrolling.
It is to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the specification of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
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. While the invention has been described with reference to specific embodiments, the invention is not limited thereto, and various equivalent modifications and substitutions can be easily made by those skilled in the art within the technical scope of the invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A page content scrolling processing method is characterized by comprising the following steps:
acquiring a descriptive text corresponding to a page needing to be rolled, and generating a tree structure corresponding to the descriptive text;
traversing the tree structure layer by layer, and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure;
in response to a monitored change in the state of a target attribute, triggering a data processing function and comparing a new value of the target attribute with an old value;
generating a target array according to the result obtained by comparison;
triggering a rendering page function and rendering the descriptive text according to the target array to obtain a target page;
and calling a loop traversal rendering style and performing rolling display on the target page.
2. The page content scrolling processing method according to claim 1, wherein the generating of the tree structure corresponding to the descriptive text comprises:
analyzing the descriptive text to obtain a plurality of attributes and attribute tags corresponding to the attributes;
determining a label level corresponding to an attribute label corresponding to each attribute in a preset label system, and determining the importance of each attribute according to the level of the label level;
determining the node level of each attribute in the tree structure according to the importance;
and generating a tree structure corresponding to the descriptive text according to the node level corresponding to each attribute.
3. The page content scrolling processing method of claim 1, wherein said triggering a data processing function and comparing a new value of said target attribute with an old value comprises:
acquiring a new value of the target attribute and a first storage parameter of the new value;
acquiring an old value of the target attribute and a second storage parameter of the old value;
determining a first digit corresponding to the first storage parameter and determining a second digit corresponding to the second storage parameter;
triggering the data processing function to perform a comparison of the new value and the old value based on the first number of bits and the second number of bits.
4. The page content scrolling processing method according to claim 3, wherein the generating a target array according to the comparison result comprises:
when the result obtained by comparison shows that the first digit is greater than the second digit, calculating the digit difference between the first digit and the second digit; performing bit complement processing on the old value according to the bit number difference; generating an old value array according to the old value after bit complementing processing;
when the result obtained by comparison shows that the first digit is smaller than the second digit, intercepting the old value according to the first digit; generating an old value array according to the intercepted old value;
carrying out data conversion on the new value to obtain a new value array;
and carrying out data splicing on the old value array and the new value array to obtain a target array.
5. The page content scrolling processing method according to claim 4, wherein after the data splicing of the old value array and the new value array to obtain a target array, the method further comprises:
judging whether the target array is larger than a preset length threshold value or not;
and when the target array is larger than the preset length threshold, carrying out partition marking processing on the target array according to a preset sliding step length to obtain a partition marked target array.
6. The method for scrolling page content according to claim 1, wherein the triggering a render page function and rendering the descriptive text according to the destination array to obtain a destination page comprises:
analyzing a cascading style sheet corresponding to the descriptive text to construct a cascading tree;
generating a rendering tree according to the tree structure corresponding to the laminated tree and the descriptive text;
and triggering a rendering page function and rendering the rendering tree according to the target array to obtain a target page.
7. The page content scroll processing method according to any one of claims 1 to 6, wherein the calling a loop to traverse a rendering style and scroll-display the target page includes:
judging whether the digit of the new value is larger than a preset digit threshold value;
when the digit of the new value is larger than the preset digit threshold value, the new value array corresponding to the new value is divided to obtain a plurality of new value sub-arrays;
calling a cyclic traversal rendering style to traverse each new value element in each new value sub-array;
determining a content tag element in the target page that is co-located with each of the new value elements;
splicing each content label element, and writing the spliced content label elements into the descriptive text;
and using a dom element example to perform scrolling display on the target page according to the descriptive text.
8. A page content scroll processing apparatus, comprising:
the page processing module is used for acquiring descriptive texts corresponding to pages needing to be rolled and generating tree structures corresponding to the descriptive texts;
the attribute monitoring module is used for traversing the tree structure layer by layer and monitoring a plurality of attributes corresponding to the traversed layers in the tree structure;
the attribute comparison module is used for responding to the monitored state change of the target attribute, triggering a data processing function and comparing a new value of the target attribute with an old value;
the array generating module is used for generating a target array according to a result obtained by comparison;
the page rendering module is used for triggering a page rendering function and rendering the descriptive text according to the target array to obtain a target page;
and the page display module is used for calling a circular traversal rendering style and carrying out rolling display on the target page.
9. A computer device, wherein the computer device comprises a memory and a processor;
the memory for storing a computer program;
the processor, when executing the computer program, is configured to implement the page content scrolling processing method according to any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the page content scroll processing method according to any one of claims 1 to 7.
CN202011540128.9A 2020-12-23 2020-12-23 Page content rolling processing method and device, computer equipment and storage medium Pending CN112650435A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011540128.9A CN112650435A (en) 2020-12-23 2020-12-23 Page content rolling processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011540128.9A CN112650435A (en) 2020-12-23 2020-12-23 Page content rolling processing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112650435A true CN112650435A (en) 2021-04-13

Family

ID=75359558

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011540128.9A Pending CN112650435A (en) 2020-12-23 2020-12-23 Page content rolling processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112650435A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB201110458D0 (en) * 2011-06-21 2011-08-03 Canon Kk Method for processing a structured document to render, and corresponding processor
CN102663002A (en) * 2012-03-16 2012-09-12 掌中帷幄(北京)科技有限公司 Method and system for structured-document rendering
US20160062963A1 (en) * 2014-08-26 2016-03-03 Adobe Systems Incorporated Synchronizing DOM Element References
CN106599016A (en) * 2016-09-30 2017-04-26 浙江大学 Front-end element maintenance method based on virtual DOM
CN109522018A (en) * 2018-11-14 2019-03-26 腾讯科技(深圳)有限公司 Page processing method, device and storage medium
US20190197068A1 (en) * 2016-11-25 2019-06-27 Tencent Technology (Shenzhen) Company Limited Page rendering method, device, and data storage medium
CN111639287A (en) * 2020-04-29 2020-09-08 深圳壹账通智能科技有限公司 Page processing method and device, terminal equipment and readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB201110458D0 (en) * 2011-06-21 2011-08-03 Canon Kk Method for processing a structured document to render, and corresponding processor
CN102663002A (en) * 2012-03-16 2012-09-12 掌中帷幄(北京)科技有限公司 Method and system for structured-document rendering
US20160062963A1 (en) * 2014-08-26 2016-03-03 Adobe Systems Incorporated Synchronizing DOM Element References
CN106599016A (en) * 2016-09-30 2017-04-26 浙江大学 Front-end element maintenance method based on virtual DOM
US20190197068A1 (en) * 2016-11-25 2019-06-27 Tencent Technology (Shenzhen) Company Limited Page rendering method, device, and data storage medium
CN109522018A (en) * 2018-11-14 2019-03-26 腾讯科技(深圳)有限公司 Page processing method, device and storage medium
CN111639287A (en) * 2020-04-29 2020-09-08 深圳壹账通智能科技有限公司 Page processing method and device, terminal equipment and readable storage medium

Similar Documents

Publication Publication Date Title
US11200130B2 (en) Automatic entity control in a machine data driven service monitoring system
CN110447035B (en) User content obfuscation in structured user data files
CN110377851B (en) Method and device for realizing multi-stage linkage drop-down frame and computer equipment
US10417108B2 (en) Portable control modules in a machine data driven service monitoring system
KR20190131032A (en) Configurable annotations for privacy sensitive user content
CN111800492A (en) Method and device for marking characters in web page, computer equipment and storage medium
CN112965645A (en) Page dragging method and device, computer equipment and storage medium
CN115329381A (en) Sensitive data-based analysis and early warning method and device, computer equipment and medium
CN112528189B (en) Data-based component packaging method and device, computer equipment and storage medium
CN112130944A (en) Page abnormity detection method, device, equipment and storage medium
CN113268949B (en) Form display method and device based on dynamic fields, computer equipment and medium
CN112650435A (en) Page content rolling processing method and device, computer equipment and storage medium
JP6994138B2 (en) Information management device and file management method
CN113132241B (en) ACL template dynamic configuration method and device
JP6948492B2 (en) Information management device and file management method
CN115471582A (en) Map generation method and device, computer equipment and storage medium
CN114417226A (en) Page generation method, display method, device, electronic equipment and storage medium
US20170331776A1 (en) Decomposed layouts for attention management
CN110908570B (en) Image processing method, device, terminal and storage medium
CN113065086A (en) Webpage text extraction method and device, electronic equipment and storage medium
CN113761415A (en) Page display method and device
CN113779438B (en) Webpage text information processing method and device and terminal equipment
CN112199350B (en) Function verification method and device based on data screening, computer equipment and medium
CN110851346B (en) Query statement boundary problem detection method, device, equipment and storage medium
CN117251159A (en) Rule page generation method, 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