A method and device for processing page information
By creating a reference container in the page information, rendering the page information and calculating the demarcation value, and dynamically determining the displayed and hidden elements, the problem of inconsistent folding effects and poor compatibility in the existing technology is solved, and the page development efficiency and user experience are improved.
Patent Information
- Application Number
- CN202110363718.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-02
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-04-02
AI Technical Summary
When the existing technology displays long page information, the folding effect is inconsistent and the compatibility of different screen sizes is poor, which affects the user experience.
By creating a reference container, rendering the page information to obtain the actual display size, and calculating the boundary value of the page information based on the set display size and folding components, dynamically determine the display and hidden elements.
It solves the problems of inconsistent folding effects and poor compatibility, and improves page development efficiency and user experience.
Smart Images

Figure CN113110837B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for processing page information. Background Art
[0002] With the popularization of Internet technology, Internet applications have become an indispensable tool for people's work and life. Internet applications can display various page information through pages. Due to the limited size of the terminal screen for displaying pages, when one or more pages of information to be displayed are long, part of the page information is usually displayed by folding, and a folding component is provided to allow users to switch between folding and unfolding the content.
[0003] At present, the method for realizing folding is usually to control the content of the page information displayed on the page by setting a display threshold, for example, a threshold for the number of characters to be displayed is set, and characters below the threshold are displayed, while other characters are hidden; due to the difference in width of different characters contained in the page information and the difference in screen sizes, the method of realizing folding by setting a threshold in existing development may lead to inconsistent folding effects and poor compatibility with different screen sizes, thereby affecting the user's experience of browsing the page. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method and device for processing page information, which can add page information to be processed in an application to a reference container, obtain the actual display size of the page information by rendering the reference container, and calculate the boundary value of the corresponding element of the page information according to the set display size, folding component, and actual display size, so as to dynamically determine the display elements and hidden elements of the page information according to the boundary value; overcome the problem of inconsistent folding effects displayed by page information containing different characters, and overcome the problem of poor compatibility of different terminal screen sizes, thereby improving the efficiency of developing pages and improving the user experience of browsing page information.
[0005] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for processing page information is provided, which is characterized by comprising:
[0006] Create a reference container; obtain page information to be processed and add the page information to the reference container; determine the container size of the reference container by rendering the page information contained in the reference container; when the container size is larger than the set display size, add a folding component to the reference container; based on the folding component and the set display size, calculate the actual display size of the page information for the reference container so that the sum of the actual display size and the size of the folding component is not larger than the set display size; process the page information to be processed according to the folding component and the actual display size included in the reference container.
[0007] Optionally, the method for processing page information is characterized in that:
[0008] Calculating the actual display size of the page information for the reference container includes:
[0009] Obtain each element of the page information and number each element in sequence; obtain the maximum value of the numbers; calculate the demarcation value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value; determine the display element using the demarcation value, wherein the element whose number is not greater than the demarcation value is the display element, and the element whose number is greater than the demarcation value is the hidden element; calculate the actual display size of the display element.
[0010] Optionally, the method for processing page information is characterized in that:
[0011] Calculating the demarcation value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value, including:
[0012] According to the preset numbering strategy and the maximum value, the intermediate value of the numbering is calculated; and the following steps are executed in a loop until the demarcation value is obtained:
[0013] A: Get the element with a number less than or equal to the middle value as the current display content;
[0014] B: Rendering the current display content and the folding component for the reference container, and obtaining the current size of the reference container according to the rendering result;
[0015] C: Determine whether the current size is greater than the set display size. If so, calculate the intermediate value of the number according to the preset numbering strategy and the intermediate value, use the intermediate value as the intermediate value, and execute step A; otherwise, execute step D;
[0016] D: Calculate the number of elements whose numbers are less than or equal to the middle value, and determine the demarcation value based on the number of elements.
[0017] Optionally, the method for processing page information is characterized in that determining the demarcation value according to the number of elements includes:
[0018] Updating the current display content, wherein the number of elements included in the updated current display content is the number of elements plus one; re-rendering the updated current display content for the reference container;
[0019] According to the result of re-rendering, update the current size of the reference container; determine whether the updated current size is larger than the set display size: if so, use the intermediate value as the dividing value; if not, calculate the intermediate value of the number between the intermediate value and the maximum value according to the preset numbering strategy, use the intermediate value as the intermediate value, and execute step A.
[0020] Optionally, the method for processing page information is characterized by further comprising:
[0021] The demarcation value is stored; in response to a triggering operation of the page, the display elements and hidden elements of the page information included in the page are determined according to the demarcation value, and the display elements are displayed on the page.
[0022] Optionally, the method for processing page information is characterized by further comprising:
[0023] When the container size is smaller than the set display size, the reference container and the corresponding content are removed.
[0024] Optionally, the method for processing page information is characterized in that processing the page information to be processed includes:
[0025] The content contained in the reference container replaces the page information to be processed; and the reference container and the corresponding content are removed.
[0026] Optionally, the method for processing page information is characterized in that:
[0027] In the case where the page information includes text information and the elements of the page information are characters, using the delimiter value to determine the display elements includes: using the delimiter value to determine the number of characters displayed in the text information.
[0028] Optionally, the method for processing page information is characterized in that:
[0029] In the case where the page information includes list information and the elements of the page information are list items, using the delimiter value to determine the display elements includes: using the delimiter value to determine the number of list items displayed in the list information.
[0030] Optionally, the method for processing page information is characterized in that the container size is larger than the set display size, including: the height of the container size is larger than the height of the set display size; and / or the width of the container size is larger than the width of the set display size.
[0031] To achieve the above object, according to a second aspect of an embodiment of the present invention, a device for processing page information is provided, characterized in that it includes: a rendering container module, a calculation and display module, and an information processing module; wherein,
[0032] The rendering container module is used to create a reference container; obtain the page information to be processed, and add the page information to the reference container; and determine the container size of the reference container by rendering the page information contained in the reference container;
[0033] The calculation display module is used to add a folding component to the reference container when the container size is larger than the set display size; and calculate the actual display size of the page information for the reference container based on the folding component and the set display size, so that the sum of the actual display size and the size of the folding component is not larger than the set display size;
[0034] The information processing module is used to process the page information to be processed according to the folding components and the actual display size included in the reference container.
[0035] Optionally, the device for processing page information is characterized in that:
[0036] Calculating the actual display size of the page information for the reference container includes:
[0037] Obtain each element of the page information and number each element in sequence; obtain the maximum value of the numbers; calculate the demarcation value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value; determine the display element using the demarcation value, wherein the element whose number is not greater than the demarcation value is the display element, and the element whose number is greater than the demarcation value is the hidden element; calculate the actual display size of the display element.
[0038] Optionally, the device for processing page information is characterized in that:
[0039] Calculating the demarcation value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value, including:
[0040] According to the preset numbering strategy and the maximum value, the intermediate value of the numbering is calculated; and the following steps are executed in a loop until the demarcation value is obtained:
[0041] A: Get the element with a number less than or equal to the middle value as the current display content;
[0042] B: Rendering the current display content and the folding component for the reference container, and obtaining the current size of the reference container according to the rendering result;
[0043] C: Determine whether the current size is greater than the set display size. If so, calculate the intermediate value of the number according to the preset numbering strategy and the intermediate value, use the intermediate value as the intermediate value, and execute step A; otherwise, execute step D;
[0044] D: Calculate the number of elements whose numbers are less than or equal to the middle value, and determine the demarcation value based on the number of elements.
[0045] Optionally, the device for processing page information is characterized in that determining the demarcation value according to the number of elements comprises:
[0046] Update the current display content, wherein the number of elements included in the updated current display content is the number of elements plus one; re-render the updated current display content for the reference container; based on the result of the re-rendering, update the current size of the reference container; determine whether the updated current size is larger than the set display size: if so, use the intermediate value as the delimiter; if not, calculate the intermediate value of the number between the intermediate value and the maximum value according to the preset numbering strategy, use the intermediate value as the intermediate value, and execute step A.
[0047] Optionally, the device for processing page information is characterized by further comprising:
[0048] The demarcation value is stored; in response to a triggering operation of the page, the display elements and hidden elements of the page information included in the page are determined according to the demarcation value, and the display elements are displayed on the page.
[0049] Optionally, the device for processing page information is characterized by further comprising:
[0050] When the container size is smaller than the set display size, the reference container and the corresponding content are removed.
[0051] Optionally, the device for processing page information is characterized in that processing the page information to be processed includes:
[0052] The content contained in the reference container replaces the page information to be processed; and the reference container and the corresponding content are removed.
[0053] Optionally, the device for processing page information is characterized in that:
[0054] In the case where the page information includes text information and the elements of the page information are characters, using the delimiter value to determine the display elements includes: using the delimiter value to determine the number of characters displayed in the text information.
[0055] Optionally, the device for processing page information is characterized in that:
[0056] In the case where the page information includes list information and the elements of the page information are list items, using the delimiter value to determine the display elements includes: using the delimiter value to determine the number of list items displayed in the list information.
[0057] Optionally, the device for processing page information is characterized in that the container size is larger than the set display size, comprising:
[0058] The height of the container size is greater than the height of the set display size; and / or the width of the container size is greater than the width of the set display size.
[0059] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, an electronic device for processing page information is provided, characterized in that it includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any method as described in the above-mentioned method for processing page information.
[0060] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any method as described in the above-mentioned method for processing page information is implemented.
[0061] An embodiment of the above invention has the following advantages or beneficial effects: it is able to add the page information to be processed in the application to a reference container, obtain the actual display size of the page information by rendering the reference container, calculate the boundary value of the corresponding element of the page information according to the set display size, folding component, and actual display size, and dynamically determine the display elements and hidden elements of the page information according to the boundary value; it overcomes the problem of inconsistent folding effects displayed by page information containing different characters, and overcomes the problem of poor compatibility of different terminal screen sizes, thereby improving the efficiency of page development and the user experience of browsing page information.
[0062] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0064] Figure 1 It is a flowchart of a method for processing page information provided by an embodiment of the present invention;
[0065] Figure 2 It is a schematic diagram of a flow chart of calculating a page element demarcation value provided by an embodiment of the present invention;
[0066] Figure 3 is a schematic diagram of the structure of a device for processing page information provided by an embodiment of the present invention;
[0067] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0068] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0069] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0070] In the process of developing web pages for Internet applications, when a section of text (e.g., text introduction) or a list (e.g., item list) in a web page is long, due to the limited size of the terminal screen, the user needs to slide and turn the page to view the complete web page content, which is inconvenient. In order to allow users to intuitively browse the overall overview of the page and increase the speed of finding content of interest, the commonly used design solution is to fold these long content areas and place an expand / collapse button (i.e., folding component), and the user can switch between expanding and collapsing the content by clicking the button.
[0071] In order to achieve this function, the existing technology adopts a method of presetting a quantity threshold, such as:
[0072] (1) For longer texts, set a word count threshold. Hide text above the word count threshold (i.e., collapse it), and display text below the word count threshold.
[0073] (2) For a long list, set a threshold for the number of list items. List items with a number higher than the threshold are hidden (i.e., folded), and list items with a number lower than the threshold are displayed.
[0074] Controlling expansion and collapse actually controls the size of this quantity threshold. When collapsed, the quantity threshold is small; when expanded, the quantity threshold is large. The disadvantages of the technical solution are as follows:
[0075] 1. The character width in the text is dynamic, resulting in inconsistent visual effects in the same folded state. For example, for the number "1" and the letter "M", the width of "M" is larger; under the same folding quantity threshold (for example, 50), 50 "1"s may occupy 2 lines, while 50 "M"s may occupy 2 and a half lines. Similarly, the width and height of the list items in the list are also dynamic according to their content, so using a set quantity threshold will cause inconsistent visual effects in the folded state.
[0076] Second, the quantity threshold needs to be set in advance, but due to differences in rendering effects, the maximum number of words / list items displayed on the screen of terminal A may be inconsistent with that displayed on the screen of terminal B, resulting in the failure of the folding solution due to compatibility issues.
[0077] In view of this, if Figure 1 As shown, an embodiment of the present invention provides a method for processing page information, which may include the following steps:
[0078] Step S101: create a reference container; obtain page information to be processed, and add the page information to the reference container; and determine the container size of the reference container by rendering the page information contained in the reference container.
[0079] Specifically, a reference container is created to contain the page information to be processed; creating the reference container includes: using JavaScript to create an off-screen document fragment separated from the document flow, and using absolute positioning to translate its position to outside the visible range of the terminal screen, so that the added page information content will not appear on the screen after rendering, thereby improving development flexibility; further, in the off-screen document fragment, an empty block-level node (such as a div block-level node) is added as a reference container, and the page information is added to the reference container. That is, the page information to be processed is obtained, and the page information is added to the reference container.
[0080] Furthermore, the page information to be processed may be a longer text or a longer list; the method used to add the page information to the reference container may be: using JavaScript to read the page information in the page to be processed (for example: the innerHTML string corresponding to the longer text or the longer list), and using the DOM (Document Object Model) interface to add it to the reference container.
[0081] Further, the page information contained in the reference container is rendered to determine the container size of the reference container; the rendering operation is completed by the browser; further, the container size of the reference container is determined, for example, the container size of the reference container can be read using JavaScript, including the values of the width and height of the reference container. That is, the container size of the reference container is determined by rendering and reading.
[0082] Step S102: When the container size is larger than the set display size, add a folding component in the reference container; based on the folding component and the set display size, calculate the actual display size of the page information for the reference container so that the sum of the actual display size and the size of the folding component is no larger than the set display size.
[0083] Specifically, as described in step S101, the container size of the reference container is determined, that is, the display size of the page information to be processed is determined; further, it is determined whether the container size is greater than the set display size; wherein the set display size is the size of the area for displaying the page information set according to the page layout of the page information to be processed, for example: the size of the area with a width of 10 and a height of 50. Wherein, determining the container size includes obtaining the width and height of the container size, and comparing the width and height of the container size with the width or / and height of the set display size to determine whether the container size is greater than the set display size, that is, the container size is greater than the set display size, including: the height of the container size is greater than the height of the set display size; and / or the width of the container size is greater than the width of the set display size.
[0084] Furthermore, according to the judgment result, when the container size is larger than the set display size, a folding component is added to the reference container; it can be understood that when the container size is larger than the set display size, the content of the page information needs to be folded (that is, part of the page information is displayed and the rest is hidden), so it is necessary to add a folding component so that the user can control the folding of the page information when operating the page, wherein the folding component can be an image control or a custom control, and the present invention does not limit the appearance, format, and size of the folding component.
[0085] Further, based on the folding component and the set display size, the actual display size of the page information is calculated for the reference container so that the sum of the actual display size and the size of the folding component is not greater than the set display size.
[0086] Specifically, based on the set display size and the added folding components, the actual display size of the page information is determined, wherein the actual display size is the size corresponding to the display portion of the page information. For example, if the page information is a text containing 1,000 characters, based on the set display size and the added folding components, after calculation, it is determined that the displayed content is 200 characters, then the display size corresponding to 200 characters is the actual display size.
[0087] Furthermore, the actual display size of the page information is calculated for the reference container, including: obtaining each element of the page information and numbering each element in sequence; obtaining the maximum value of the numbering; calculating the demarcation value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value; determining the display element using the demarcation value, wherein elements whose numbers are not greater than the demarcation value are display elements, and elements whose numbers are greater than the demarcation value are hidden elements; calculating the actual display size of the page information for the reference container, that is, calculating the actual display size of the display element. For example: the page information is a text containing 1000 characters, and according to the judgment result, if the container size corresponding to the page information is larger than the set display size, then 1000 characters in the text are obtained (that is, each element of the page information is obtained), and the 1000 characters are numbered, for example: the numbering is from 1 to 1000, and the maximum value of the numbering is 1000 (that is, each element is numbered sequentially; the maximum value of the numbering is obtained); the numbering is from 1 to 1000; wherein, the numbering starts from 1 and is sequentially increased by 1, which is the preset numbering strategy; it can be understood that the preset numbering strategy can be a sequentially discontinuous integer, and the present invention does not limit the preset numbering strategy.
[0088] Further, according to the set display size, the size of the folding component, and the maximum number 1000, the delimiting value of the elements included in the page information is calculated. For example, the delimiting value obtained by calculation is 266; then the characters numbered 1-266 are displayed, and the characters numbered 1-266 are displayed elements; the characters numbered 267-1000 are hidden, that is, the characters numbered 267-1000 are not displayed (folded), and the characters numbered 267-1000 are hidden elements; that is, the display elements are determined by the delimiting value; wherein the elements with numbers not greater than the delimiting value are display elements, and the elements with numbers greater than the delimiting value are hidden elements. That is, in the case where the page information includes text information and the elements of the page information are characters, the display elements are determined by the delimiting value, including: using the delimiting value to determine the number of displayed characters in the text information, for example: 266 is the number of displayed characters.
[0089] Furthermore, the page information can also be a list, for example: a list containing 100 list items, then each list item is numbered, and the demarcation value of the elements included in the page information is calculated based on the set display size, the size of the folding component, and the maximum number. For example: the calculated demarcation value is 26, then the list items numbered 1-26 are display elements; the list items numbered 27-100 are hidden elements, that is, for the case where the page information includes list information and the elements of the page information are list items, the demarcation value is used to determine the display elements, including: using the demarcation value to determine the number of displayed list items in the list information; for example: 26 is the number of displayed list items.
[0090] Furthermore, the specific description of calculating the boundary value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value is consistent with the description of steps S201 to S209 and will not be repeated here.
[0091] When the container size is smaller than the set display size, the reference container and the corresponding content are removed. Specifically, it is determined whether the container size is larger than the set display size. When the container size is smaller than the set display size, it means that the page information to be processed does not need to be folded, so the reference container and the corresponding content are removed to release memory.
[0092] Step S103: Processing the page information to be processed according to the folding components and the actual display size included in the reference container.
[0093] Specifically, the page information to be processed is processed according to the folding components included in the reference container and the calculated actual display size; there are two methods for processing the page information to be processed:
[0094] The first method: after replacing the page information to be processed with the content contained in the reference container, remove the reference container and the corresponding content. Specifically, replace the inner HTML string corresponding to the original page information to be processed with the content of the off-screen document fragment containing the reference container, wherein the reference container contains a folding component and a calculated demarcation value (the demarcation value can be an attribute value of the reference container), and further, remove the off-screen document fragment (containing the reference container) to release memory.
[0095] The second method: sending the calculated demarcation value and folding component information to the application for developing the page to be processed, so that the code in the application automatically generates the folding component through the obtained demarcation value and folding component information, and determines the display elements and hidden elements based on the demarcation value to automatically process the folding display of the page information to be processed.
[0096] The present invention performs folding calculations according to the set display size set by the developer, and automatically performs folding processing on the part exceeding the container size, and can dynamically process the display of characters or list items under the premise of ensuring the visual effect; by automatically calculating the content rendering effect displayed according to the actual screen size, it can ensure compatibility under different rendering conditions; at the same time, by using a reference container, the calculation process can be performed outside the screen, without interfering with the page and without user perception, thereby improving the efficiency of page development and taking page rendering performance into consideration to the greatest extent.
[0097] like Figure 2 As shown, an embodiment of the present invention provides a schematic diagram of a process for calculating a page element boundary value, and the process may include the following steps:
[0098] In a process for calculating the delimiting value of page elements provided in this embodiment, the numbering starts from 1 and increases by 1 in sequence until each element is numbered as a preset numbering strategy, and the following steps are described using binary search as an example of the calculation method.
[0099] Step S201: Acquire each element of the page information, and number each element in sequence; and acquire the maximum value of the numbers.
[0100] Specifically, taking text as an example of page information, for example: obtain 1000 characters contained in the text (i.e., obtain each element of the page information), and number the 1000 characters, for example: number them from 1 to 1000, and obtain the maximum value of the number as 1000 (i.e., number each element sequentially; obtain the maximum value of the number).
[0101] Step S202: Calculate the middle value of the numbering according to the preset numbering strategy and the maximum value.
[0102] Specifically, the numbering starts from 1 and increases by 1 in sequence until each element is numbered, which is the preset numbering strategy. Further, it can be known that the maximum value of the obtained number is 1000; further, the middle value of the number is calculated; taking the binary method as an example, the maximum value is divided by 2 and rounded to 500, which is used as the middle value. That is, according to the preset numbering strategy and the maximum value, the middle value of the number is calculated.
[0103] Step S203: obtaining an element whose number is less than or equal to the middle value as the current display content, rendering the current display content and the folding component for the reference container, and obtaining the current size of the reference container according to the rendering result.
[0104] Specifically, elements whose numbers are less than or equal to the middle value are obtained as the current display content. Still taking the example of step S202 as an example, for example: the middle value is 500, then characters (i.e., elements) numbered from 1 to 500 are obtained as the current display content; further, the current display content and the folding component are rendered for the reference container, and the current size of the reference container is obtained according to the rendering result; for example: the current size obtained as a result of the rendering is 10x100.
[0105] It can be understood that when the page information is a list, the steps used are consistent.
[0106] Step S204: Determine whether the current size is larger than the set display size.
[0107] Specifically, it is determined whether the current size is larger than the set display size. The description of setting the current size is consistent with the description of step S102 and will not be repeated here.
[0108] Determine whether the current size is larger than the set display size, if so, execute step S205, otherwise execute step S206.
[0109] Step S205: Calculate the intermediate value of the numbering according to the preset numbering strategy and the intermediate value, and use the intermediate value as the intermediate value.
[0110] Specifically, for example, if the current size obtained by the rendering result is 10x100, and the display size is set to 10x50, it can be known that the current size is larger than the set display size. Then continue to obtain the intermediate value, and the method of obtaining it can be to use the binary method, according to the preset numbering strategy and the intermediate value, calculate the intermediate value of the number, and use the intermediate value as the intermediate value. For example, if the intermediate value obtained by step S203 is 500, then further calculate the intermediate value between number 1 and number 500, and divide 500 by 2 to get the intermediate value of 250, and then use 250 as the new intermediate value, as the intermediate value of the next cycle.
[0111] Step S206: updating the current display content, wherein the number of elements included in the updated current display content is the number of elements plus one; re-rendering the updated current display content for the reference container; and updating the current size of the reference container according to the re-rendering result.
[0112] Specifically, when it is determined that the current size is smaller than the set display size, the intermediate value is used to obtain the number of display elements of the current display content, and 1 is added (that is, the current display content is updated) to obtain the updated current display content. For example, the intermediate value is 250, corresponding to 250 characters, then the updated current content is 251 characters, and the reference container is re-rendered based on these 251 characters, and the current size of the reference container is updated according to the result of the re-rendering.
[0113] Step S207: Determine whether the updated current size is larger than the set display size.
[0114] Specifically, based on step S206, the current size is obtained, and it is determined whether the updated current size is larger than the set display size; if so, step S209 is executed; otherwise, step S208 is executed.
[0115] Step S208: according to the preset numbering strategy, calculate the intermediate value of the number between the intermediate value and the maximum value, and use the intermediate value as the intermediate value.
[0116] Specifically, when it is determined that the updated current size is smaller than the set display size, the middle value of the number between the middle value and the maximum value is taken. For example, if the middle value is 500 and the maximum value is 1000, the middle value of the number between the middle value and the maximum value is calculated to be 750 using the binary search method, and 750 is taken as the middle value.
[0117] Step S209: taking the middle value as the demarcation value.
[0118] Specifically, the obtained middle value is used as a demarcation value, and the display element is determined by using the demarcation value, wherein elements whose numbers are not greater than the demarcation value are display elements, and elements whose numbers are greater than the demarcation value are hidden elements.
[0119] Steps S201 to S209 are executed repeatedly to determine a demarcation value, and further, the demarcation value is stored; in response to a trigger operation of a page, display elements and hidden elements of the page information included in the page are determined according to the stored demarcation value, and the display elements are displayed on the page. Specifically, the demarcation value is stored so that the application determines the display elements and hidden elements of the page information included in the page according to the acquired demarcation value when processing the page information.
[0120] The description of step S201 to step S209 is:
[0121] Calculate the middle value of the numbering according to the preset numbering strategy and the maximum value;
[0122] The following steps are executed repeatedly until the demarcation value is obtained:
[0123] A: Get the element with a number less than or equal to the middle value as the current display content;
[0124] B: Rendering the current display content and the folding component for the reference container, and obtaining the current size of the reference container according to the rendering result;
[0125] C: Determine whether the current size is greater than the set display size. If so, calculate the intermediate value of the number according to the preset numbering strategy and the intermediate value, use the intermediate value as the intermediate value, and execute step A; otherwise, execute step D;
[0126] D: Calculate the number of elements whose numbers are less than or equal to the middle value, and determine the demarcation value based on the number of elements.
[0127] Wherein, determining the demarcation value according to the number of elements includes:
[0128] Updating the current display content, wherein the number of elements included in the updated current display content is the number of elements plus one; re-rendering the updated current display content for the reference container;
[0129] According to the result of the re-rendering, updating the current size of the reference container;
[0130] Determine whether the updated current size is larger than the set display size: if so, use the intermediate value as the dividing value; if not, calculate the intermediate value of the number between the intermediate value and the maximum value according to the preset numbering strategy, use the intermediate value as the intermediate value, and execute step A.
[0131] It can be seen that by using the loop operation, the demarcation value can be automatically calculated according to the content rendering effect displayed by the actual screen size, so that the display of characters or list items can be dynamically processed by the demarcation value while ensuring the visual effect; therefore, compatibility under different rendering conditions can be guaranteed; at the same time, by using the reference container, the calculation process can be carried out outside the screen, without interfering with the page and without user perception, which improves the efficiency of page development and takes page rendering performance into consideration to the greatest extent.
[0132] like Figure 3 As shown, an embodiment of the present invention provides a device 300 for processing page information, including: a rendering container module 301, a calculation and display module 302 and an information processing module 303; wherein,
[0133] The rendering container module 301 is used to create a reference container; obtain the page information to be processed, and add the page information to the reference container; and determine the container size of the reference container by rendering the page information contained in the reference container;
[0134] The calculation display module 302 is used to add a folding component to the reference container when the container size is larger than the set display size; and calculate the actual display size of the page information for the reference container based on the folding component and the set display size, so that the sum of the actual display size and the size of the folding component is not larger than the set display size;
[0135] The information processing module 303 is used to process the page information to be processed according to the folding components and the actual display size included in the reference container.
[0136] An embodiment of the present invention also provides an electronic device for processing page information, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.
[0137] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method provided in any of the above embodiments is implemented.
[0138] Figure 4 An exemplary system architecture 400 is shown to which the method for processing page information or the apparatus for processing page information according to the embodiment of the present invention can be applied.
[0139] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0140] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various client applications can be installed on terminal devices 401, 402, 403, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, and email clients.
[0141] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0142] Server 405 may be a server that provides various services, such as a background management server that provides support for client applications used by users using terminal devices 401, 402, and 403. The background management server may process the received request for displaying page information and feed back the page information in response to the request to the terminal device.
[0143] It should be noted that the method for processing page information provided in the embodiment of the present invention is generally executed by the terminal devices 401 , 402 , 403 , and accordingly, the apparatus for processing page information is generally disposed in the terminal devices 401 , 402 , 403 .
[0144] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0145] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0146] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0147] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0148] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0149] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0150] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0151] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be provided in a processor, for example, may be described as: a processor including a rendering container module, a calculation display module, and an information processing module. The names of these modules do not, in certain cases, constitute limitations on the modules themselves, for example, the information processing module may also be described as "the reference container includes a folding component, an actual display size, and a module for processing page information".
[0152] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: creating a reference container; obtaining page information to be processed, and adding the page information to the reference container; determining the container size of the reference container by rendering the page information contained in the reference container; when the container size is larger than the set display size, adding a folding component to the reference container; based on the folding component and the set display size, calculating the actual display size of the page information for the reference container, so that the sum of the actual display size and the size of the folding component is not larger than the set display size; processing the page information to be processed according to the folding component and the actual display size included in the reference container.
[0153] The system can add the page information to be processed in the application to the reference container, obtain the actual display size of the page information by rendering the reference container, calculate the boundary value of the corresponding element of the page information according to the set display size, folding component, and actual display size, and dynamically determine the display elements and hidden elements of the page information according to the boundary value; it overcomes the problem of inconsistent folding effects displayed by page information containing different characters, and overcomes the problem of poor compatibility with different terminal screen sizes, thereby improving the efficiency of page development and the user experience of browsing page information.
[0154] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for processing page information, characterized in that: include: Create a reference container; Acquire the page information to be processed, and add the page information to the reference container; Determine the container size of the reference container by rendering the page information contained in the reference container; When the container size is larger than the set display size, adding a folding component to the reference container; Based on the folding component and the set display size, calculating the actual display size of the page information for the reference container so that the sum of the actual display size and the size of the folding component is not greater than the set display size; The step of calculating the actual display size of the page information for the reference container includes: Obtain each element of the page information, and number each element in sequence; obtain the maximum value of the number; Calculating the delimiting value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value; Determine the display element by using the demarcation value, wherein the element whose number is not greater than the demarcation value is the display element, and the element whose number is greater than the demarcation value is the hidden element; Calculating the actual display size of the display element; The page information to be processed is processed according to the folding components and the actual display size included in the reference container.
2. The method according to claim 1, characterized in that Calculating the demarcation value of the elements included in the page information according to the set display size, the size of the folding component, the preset numbering strategy and the maximum value, including: Calculate the middle value of the numbering according to the preset numbering strategy and the maximum value; The following steps are executed repeatedly until the demarcation value is obtained: A: Get the element with a number less than or equal to the middle value as the current display content; B: Rendering the current display content and the folding component for the reference container, and obtaining the current size of the reference container according to the rendering result; C: Determine whether the current size is greater than the set display size. If so, calculate the intermediate value of the number according to the preset numbering strategy and the intermediate value, use the intermediate value as the intermediate value, and execute step A; otherwise, execute step D; D: Calculate the number of elements whose numbers are less than or equal to the middle value, and determine the demarcation value based on the number of elements.
3. The method according to claim 2, characterized in that Determining the demarcation value according to the number of elements includes: Updating the current display content, wherein the number of elements included in the updated current display content is the number of elements plus one; re-rendering the updated current display content for the reference container; According to the result of the re-rendering, updating the current size of the reference container; Determine whether the updated current size is larger than the set display size: if so, use the intermediate value as the dividing value; if not, calculate the intermediate value of the number between the intermediate value and the maximum value according to the preset numbering strategy, use the intermediate value as the intermediate value, and execute step A.
4. The method according to claim 2 or 3, characterized in that: Further including: storing the demarcation value; In response to a triggering operation of a page, display elements and hidden elements of page information included in the page are determined according to the demarcation value, and the display elements are displayed on the page.
5. The method according to claim 1, characterized in that Further including: When the container size is smaller than the set display size, the reference container and the corresponding content are removed.
6. The method according to claim 1, characterized in that Processing the page information to be processed includes: Replacing the page information to be processed with the content contained in the reference container; Remove the reference container and the corresponding content.
7. The method according to claim 1, characterized in that In the case where the page information includes text information and the elements of the page information are characters, Determining a display element using the demarcation value includes: The delimiting value is used to determine the number of characters displayed in the text information.
8. The method according to claim 1, characterized in that In the case where the page information includes list information and the elements of the page information are list items, Determining a display element using the demarcation value includes: The delimiting value is used to determine the number of list items displayed in the list information.
9. The method according to claim 1, characterized in that: The container size is larger than the set display size, including: The height of the container size is greater than the height of the set display size; and / or, The width of the container size is greater than the width of the set display size.
10. A device for processing page information, characterized in that: include: Rendering container module, calculation display module and information processing module; among them, The rendering container module is used to create a reference container; obtain the page information to be processed, and add the page information to the reference container; and determine the container size of the reference container by rendering the page information contained in the reference container; The calculation display module is used to add a folding component to the reference container when the container size is larger than the set display size; based on the folding component and the set display size, calculate the actual display size of the page information for the reference container, so that the sum of the actual display size and the size of the folding component is not larger than the set display size; wherein, the calculation of the actual display size of the page information for the reference container includes: obtaining each element of the page information and numbering each element in sequence; obtaining the maximum value of the numbering; calculating the demarcation value of the elements included in the page information according to the set display size, the size of the folding component, a preset numbering strategy and the maximum value; determining the display element using the demarcation value, wherein the element whose number is not larger than the demarcation value is a display element, and the element whose number is larger than the demarcation value is a hidden element; calculating the actual display size of the display element; The information processing module is used to process the page information to be processed according to the folding components and the actual display size included in the reference container.
11. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.
12. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Acquiring method and device of parameter information
CN104484360A
Full screen displaying method and full screen displaying system for diagram in webpage applied to terminal browser
CN105893602A
