Page processing method, device and equipment and computer readable storage medium
By obtaining the page container and the target element container, and directly extracting and processing page elements, the problem of inefficient traversing the page structure tree under complex page structure is solved, and page processing efficiency is improved.
Patent Information
- Application Number
- CN202411733226.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-28
AI Technical Summary
As the page structure becomes more complex, it is less efficient to traverse the page structure tree to obtain page data, resulting in less page processing efficiency.
By obtaining the first page container and the target element container for displaying the page, the page elements are extracted and processed directly without traversing the entire page structure tree.
Improves the efficiency of page processing and reduces processing time, and is suitable for multilingual translation and content change scenarios with complex page structures.
Smart Images

Figure CN119721065A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer application technology, and in particular, relates to a page processing method, device, equipment and computer-readable storage medium. Background Art
[0002] With the development of computer application technology, more and more applications support processing (such as translation) the text content of a page to update the function of displaying the page. Taking the application supporting the translation function as an example, currently, when receiving a trigger operation from a user for translating a page, the page structure tree of the page is usually traversed to obtain more comprehensive page data, and then the page data is translated.
[0003] However, as the page structure becomes more and more complex, a page may contain multiple types of sub-pages such as mini-program pages, hypertext markup language pages, native pages, etc. Therefore, the page structure tree becomes more and more complex, resulting in low efficiency in traversing the page structure tree, thereby reducing page processing efficiency. Summary of the invention
[0004] Embodiments of the present application provide a page processing method, apparatus, device, computer-readable storage medium, and computer program product, which can improve page processing efficiency.
[0005] In a first aspect, an embodiment of the present application provides a page processing method, including:
[0006] Receiving a first operation of a user on a first page;
[0007] In response to the first operation, a first page container is acquired, where the first page container is used to display the first page, and the first page container includes an element container for displaying page elements;
[0008] Acquire an original page element in the first page container and a target element container for displaying the original page element;
[0009] Processing the original page element to obtain a target page element;
[0010] The target page element is placed in the target element container of the first page container to update and display the first page.
[0011] In a second aspect, an embodiment of the present application provides a page processing device, including:
[0012] A receiving module, used for receiving a first operation of a user on a first page;
[0013] A first acquisition module, configured to acquire a first page container in response to the first operation, wherein the first page container is used to display the first page, and the first page container includes an element container for displaying page elements;
[0014] A second acquisition module, used to acquire an original page element in the first page container and a target element container for displaying the original page element;
[0015] A processing module, used for processing the original page element to obtain a target page element;
[0016] An updating module is used to place the target page element in the target element container of the first page container to update and display the first page.
[0017] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0018] When the processor executes the computer program instructions, the processor implements any possible implementation method of the first aspect described above.
[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implements a method in any possible implementation method of the first aspect described above.
[0020] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a method as any possible implementation method in the first aspect above.
[0021] The embodiment of the present application, upon receiving the first operation of the user on the first page, first obtains the first page container for displaying the first page, and then obtains the original page element from the first page container, so that the original page element to be processed can be obtained without traversing the page structure tree. By obtaining the target element container for displaying the original page element, the position of the original page element in the first page can be located by the target element container. By processing the original page element to obtain the target page element, and placing the target page element in the target element container of the first page container, the processed target page element can be reset back to the first page to achieve the update of the first page. In this way, in the embodiment of the present application, the first page container and the target element container can be used to extract the original page element and reset the target page element without traversing the entire page structure tree, thereby improving the efficiency of page processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0023] Figure 1 It is a structural diagram of a page processing system provided by an embodiment of the present application;
[0024] Figure 2 It is a flow chart of a page processing method provided in an embodiment of the present application;
[0025] Figure 3 It is a flowchart of obtaining an original page element and a target element container provided by an embodiment of the present application;
[0026] Figure 4 is a schematic diagram of a flow chart of determining the type of a second page container provided by an embodiment of the present application;
[0027] Figure 5 It is a flowchart of another page processing method provided by an embodiment of the present application;
[0028] Figure 6 is a structural schematic diagram of a page processing device provided in an embodiment of the present application;
[0029] Figure 7 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0031] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0032] In addition, the acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.
[0033] As described in the background technology section, with the development of computer application technology, more and more applications support processing (such as translation) the text content of a page to update the displayed page. Taking the application supporting the translation function as an example, currently, when receiving a trigger operation from a user for translating a page, the page structure tree of the page is usually traversed to obtain more comprehensive page data, and then the page data is translated.
[0034] However, as the page structure becomes more and more complex, a page may contain multiple types of sub-pages such as mini-program pages, hypertext markup language pages, native pages, etc. Therefore, the page structure tree becomes more and more complex, resulting in low efficiency in traversing the page structure tree, thereby reducing page processing efficiency.
[0035] In addition, currently, it is also possible to pre-set a multilingual translation scheme (i.e., pre-set the translation text) so that when receiving the trigger operation for translating the page from the user, the page is directly translated according to the preset multilingual translation scheme. However, the page structure of the application is usually constantly changing. Therefore, if the page structure is updated every time, that is, hard-coded again to adapt the page to a new multilingual scheme, it will affect the development efficiency of the application and increase the development cost of the application.
[0036] Thus, in order to solve the problems of the prior art, the embodiments of the present application provide a page processing method, device, equipment, computer-readable storage medium and computer program product. Among them, the page processing method can be applied to the scenario of multi-language translation of page elements such as text elements, image elements, video elements, audio elements, etc. in the page. Among them, the page can be a page in an application or a page in a browser, which is not limited here.
[0037] In addition, the page processing method can be executed by a server and / or processor in the page processing system. If the page is a page in an application, the page processing system can be integrated into the application in the form of a software development kit (SDK). It should be noted that the page processing system can be fully integrated into the application in the form of an SDK, or partially integrated into the application in the form of an SDK, and the other part is implemented through a cloud service, which is not limited here.
[0038] The following is an introduction to the page processing system provided in the embodiment of the present application.
[0039] like Figure 1 As shown, the page processing system 100 provided in the embodiment of the present application may include a rule management module 11, a page analysis engine 12, a page element extraction module 13, a page element processing module 14 and a page element resetting module 15.
[0040] In an embodiment of the present application, a first page may have multiple types of sub-pages embedded in it. Among them, the first page may be displayed in a first page container, and the first page container may include multiple different types of second page containers. The second page container may be used to display the above sub-pages. Different types of second page containers may be implemented by different technology stacks, and different types of second page containers may correspond to different feature information. The feature information may include, for example, the class name of the second page container, interface information, and the mapping of the name of the second page container in different operating systems. Based on this, the rule management module 11 may be used to store the correspondence between different types of second page containers and feature information.
[0041] As an example, the correspondence between different types of second page containers and feature information can be directly set in the rule management module 11, or it can be first set in the cloud server, and then the rule management module 11 pulls the above correspondence from the cloud server and stores it locally.
[0042] When the user triggers the first operation for updating the first page on the first page, the page analysis engine 12 can first obtain the first page container for displaying the first page, and the function call stack of the application during operation. Among them, the function call stack may include function information of multiple called functions, and the function information may include at least two of the function name, class name and interface information. Afterwards, the page analysis engine 12 can match each function information with all the feature information in the rule management module 11. If the function information matches a certain feature information, the type of the second page container corresponding to the function information can be determined based on the correspondence between the feature information and the second page container. In this way, through the above method, the page analysis engine 12 is used to determine multiple different types of second page containers included in the first page container.
[0043] The page element extraction module 13 may be used to extract the original page elements in the second page container based on the type of the second page container, and obtain a target element container for displaying the original page elements.
[0044] The page element processing module 14 can be used to process the original page element in response to the first operation to obtain the target page element. The page element processing module 14 can be integrated in the application or located in the cloud server, which is not limited here.
[0045] The page element resetting module 15 may be used to resetting the target page element to the target element container of the first page container, so as to update and display the first page.
[0046] The following is an introduction to the page processing method provided in the embodiment of the present application.
[0047] Figure 2 FIG. 1 is a flow chart of a page processing method provided by an embodiment of the present application. Figure 2 As shown, the page processing method provided in the embodiment of the present application includes the following steps:
[0048] S210, receiving a first operation of a user on a first page;
[0049] S220: In response to the first operation, obtain a first page container, where the first page container is used to display the first page, and the first page container includes an element container for displaying page elements;
[0050] S230, obtaining an original page element in the first page container and a target element container for displaying the original page element;
[0051] S240, processing the original page element to obtain the target page element;
[0052] S250: placing the target page element in the target element container of the first page container to update and display the first page.
[0053] The embodiment of the present application, upon receiving the first operation of the user on the first page, first obtains the first page container for displaying the first page, and then obtains the original page element from the first page container, so that the original page element to be processed can be obtained without traversing the page structure tree. By obtaining the target element container for displaying the original page element, the position of the original page element in the first page can be located by the target element container. By processing the original page element to obtain the target page element, and placing the target page element in the target element container of the first page container, the processed target page element can be reset back to the first page to achieve the update of the first page. In this way, in the embodiment of the present application, the first page container and the target element container can be used to extract the original page element and reset the target page element without traversing the entire page structure tree, thereby improving the efficiency of page processing.
[0054] The specific implementation methods of the above steps are introduced below.
[0055] In some embodiments, in S210, the first page may be a page displayed in an application or a page displayed in a browser, which is not limited here. In addition, the first page may be embedded with a variety of different types of sub-pages, such as a native page, a native mobile (React Native, RN) page, a mini program page, a Hypertext Markup Language 5 (H5) page, a Flutter page, a Weex page, etc.
[0056] The first operation can be used to update and display the first page. The update display of the first page can be a multilingual translation of the page elements in the first page, or a content change of the page elements in the first page. The first operation can be a click operation of the user, a long press operation of the user, a sliding operation of the user, a voice input of the user, or a command input implemented by the user with the help of other devices connected to the electronic device. The other device may include at least one of the devices with typing functions such as a remote control, a mouse, and a keyboard. For example, if the first page displays a target control for updating and displaying the first page, and after the user clicks the target control, the first page can display a "translation" control for multilingual translation and a "correction" control for content change, then the first operation may include the operation of the user clicking the target control and the "translation" control, and may also include the operation of the user clicking the target control and the "correction" control.
[0057] In the case where multiple types of sub-pages are embedded in the first page, the first operation may be used to update and display the multiple types of sub-pages in the first page.
[0058] In some embodiments, in S220, the page element may include a text element, an image element, a video element, an audio element, etc. Correspondingly, the element container may include a text container, an image container, a video container, an audio container, etc. In addition, the first page container may include a plurality of types of second page containers. Among them, the second page container may include an element container for displaying the page element.
[0059] In some embodiments, in S230, the original page element may be a page element displayed in the first page when the first operation is received. The original page element may include at least one of a text element, an image element, a video element, and an audio element. Accordingly, the target element container may include at least one of a text container, an image container, a video container, and an audio container.
[0060] As described above, the first page container may include multiple types of second page containers. Therefore, obtaining the original page element in the first page container and the target element container for displaying the original page element may specifically include: respectively obtaining the original page elements in multiple second page containers and the target element container for displaying the original page element.
[0061] Based on this, in order to ensure the accuracy of the acquired original page element and the target element container, in some embodiments, the above S230 may specifically include:
[0062] The original page elements in the plurality of second page containers and the target element container for displaying the original page elements are respectively obtained by an acquisition method corresponding to the type of the second page container.
[0063] Since different types of second page containers are implemented based on different technology stacks, the methods for obtaining the original page element and the target element container may be different for different types of second page containers.
[0064] The embodiment of the present application obtains original page elements in multiple second page containers and target element containers for displaying the original page elements respectively through an acquisition method corresponding to the type of the second page container, thereby ensuring the accuracy of the acquired original page elements and target element containers.
[0065] Based on this, in order to ensure the accuracy of the acquired original page elements and target element containers, in some embodiments, such as Figure 3As shown, the above-mentioned acquisition method corresponding to the type of the second page container is used to respectively acquire the original page elements in the plurality of second page containers and the target element container for displaying the original page elements, which may specifically include the following steps:
[0066] S310: based on the type of the second page container, add a target code to the code of the second page container, where the target code is used to intercept the original page element and the target element container;
[0067] S320: For each second page container, intercept the pointers of the original page element and the target element container through the target code;
[0068] S330, obtaining the target element container according to the pointer of the target element container;
[0069] S340: Extract the original page element from the target element container.
[0070] Here, the target code can be an insertion code, and the target code can be used to intercept the original page element and the target element container. Based on the type of the second page container, adding the target code to the code of the second page container can specifically be based on the type of the second page container, inserting the page element setting method corresponding to the second page container. Among them, the page element setting method can be used to implement the setting of a certain page element in a certain element container. In this way, by inserting the page element setting method corresponding to the second page container based on the type of the second page container, it can be achieved that when the original page element is set in the target element container, the pointer of the target element container and the original page element in the target element container can be intercepted through the target code.
[0071] For each second page container, after the pointers of the original page element and the target element container are intercepted by the target code, the target element container can be acquired according to the pointer, and the original page element can be extracted from the target element container.
[0072] In this way, by adding the target code to the code of the second page container based on the type of the second page container, and acquiring the original page element and the target element container based on the target code, the accuracy of the acquired original page element and the target element container can be ensured.
[0073] In addition, different types of second page containers can be implemented by different technology stacks. Therefore, different types of second page containers can correspond to different feature information. The feature information may include, for example, the class name of the second page container, the interface (Application Programming Interface, API) information, the mapping of the name of the second page container in different operating systems, etc. For example, the name of the second page container in the first operating system may be A container, the name in the second operating system may be B container, and the name in the third operating system may be C container.
[0074] In addition, in order to ensure the accuracy of the type of the second page container, in some embodiments, Figure 4 As shown, before respectively acquiring the original page elements in the plurality of second page containers and the target element containers for displaying the original page elements in the above-mentioned acquisition method corresponding to the type of the second page container, a specific step of determining the type of the second page container may also be included:
[0075] S410, obtaining a function call stack of the application during operation, wherein the function call stack includes function information of multiple called functions, the function information includes function information of the second page container, and the function information includes at least two items of a function name, a class name, and interface information;
[0076] S420, matching each function information with characteristic information corresponding to each of the multiple types of second page containers to obtain a matching result;
[0077] S430: Determine the type of the second page container corresponding to the function information according to the matching result.
[0078] Here, after the application is started, the function call stack can be captured periodically during the running of the application through Runtime.
[0079] As an example, after obtaining the function call stack, for each function information in the function call stack, the function information can be matched with the characteristic information corresponding to each of the multiple types of second page containers. Specifically, the function name in the function information can be matched with the name of the second page container in the characteristic information; the class name in the function information can be matched with the class name in the characteristic information; the interface information in the function information can be matched with the interface information in the characteristic information. If all three are matched successfully, it can be determined that the matching result is a successful match. More specifically, under the determination of the operating system, if the function name in the function information is consistent with the name of the second page container, it can be determined that the function name matches successfully; if the class name in the function information is consistent with the class name in the characteristic information, it can be determined that the class name matches successfully; if the interface information in the function information is included in the interface information in the characteristic information, it can be determined that the interface information matches successfully.
[0080] For each function information, if the function information successfully matches a certain feature information, it can be determined that the function information corresponds to a second page container, and the type of the second page container corresponding to the function information can be determined based on the correspondence between the feature information and the type of the second page container.
[0081] In the embodiment of the present application, by determining the type of the second page container based on function information such as function name, class name and interface information in the function call stack, the accuracy of determining the type of the second page container can be improved compared to determining the container type only by the class name. In addition, by obtaining the function call stack of the application during operation, and then determining the type of the second page container based on the function information in the function call stack, that is, by dynamically determining the container type, compared to the traditional static determination of the container type based on reflection, it is possible to timely discover whether the page structure has changed, and obtain the nested container type (i.e., the type of the second page container) corresponding to the latest page structure in real time, thereby ensuring the accuracy of the type of the second page container.
[0082] In some embodiments, in S240, the processing method of the original page element is associated with the first operation. If the first operation is used to translate the page elements of the first page into multiple languages, the processing method of the original page element may be to convert the language of the original page element to obtain the target page element. The language conversion may be, for example, converting Chinese into English. If the first operation is used to change the content of the page elements in the first page, the processing method of the original page element may be to change the content of the original page element to obtain the target page element. The content change may be used to "correct errors" on the first page. The content change may be, for example, changing "A" to "B".
[0083] In some embodiments, in S250 , after the target page element is determined, the target page element may be placed in a target element container of the first page container to update and display the first page.
[0084] It should be noted that the size of the target page element and the original page element may be different. For example, if the original page element is a Chinese text element, and the first operation is used to translate the Chinese text element into an English text element, then due to the difference in writing methods between Chinese and English, the length of the English text element may be much longer than the Chinese text element. Therefore, if the English text element is reset back to the target element container according to the previous font, size, and style of the Chinese text element, the English text element may not be fully displayed, affecting the user's reading experience.
[0085] Based on this, in order to ensure the user's reading experience of the updated first page, in some embodiments, before the above S250, the following may also be included:
[0086] Get the container attribute information of the target element container and the element attribute information of the target page element.
[0087] Based on this, the above S250 may specifically include:
[0088] Based on the element attribute information and the container attribute information, the target page element is placed in a target element container of the first page container.
[0089] Here, the container attribute information may include at least the position information of the target element container in the first page container, and the size information and shape information of the target element container. The position information may be used to locate the target element container. In addition, the element attributes corresponding to different types of page elements may be different. For example, if the page element is a text element, the element attribute information may include information such as the font, size, style, etc. of the page element. If the page element is an image element, the element attribute information may include information such as the image format and shape of the page element.
[0090] As an example, if the target page element is a text element, after obtaining the container attribute information of the target element container and the element attribute information of the target page element, the target element container can be located according to the position information of the target element container in the first page container, and then the text style of the target page element in the target element container can be adjusted according to the size, shape and other information of the target element container and the font, size, style and other information of the target page element, so that the target page element can adapt to the target element container, ensuring the user's reading experience of the updated first page.
[0091] Based on this, in order to improve the updating and displaying efficiency of the first page, in some embodiments, placing the target page element in the target element container of the first page container based on the element attribute information and the container attribute information may specifically include:
[0092] Determine the display mode of the target page element in the target element container based on the element attribute information and the container attribute information;
[0093] According to the display method, the target page element is placed in the target element container of the first page container.
[0094] Here, if the target page element is a text element, the display method may be, for example, how many lines are displayed in the target element container, how many characters are in each line, etc.
[0095] The embodiment of the present application first determines the display method of the target page element in the target element container based on the element attribute information and the container attribute information, and then directly places the target page element in the target element container of the first page container according to the display method. Compared with continuously adjusting the display method of the target page element in the target element container according to the element attribute information and the container attribute information, so that the target page element can adapt to the target element container, the update display efficiency of the first page can be improved.
[0096] In addition, as described above, the container attribute information may include the position information of the target element container in the first page container, wherein the position information may be used to locate the target element container. However, in some embodiments, there may be multiple original page elements and their corresponding target element containers. Therefore, in order to accurately locate the target element container when the number of target page elements is large, in some embodiments, before the above S240, the method may further include:
[0097] Generate identification information of the target element container based on the container attribute information of the target element container;
[0098] Using the identification information as an index, a first association relationship is established between the identification information, the original page element, and the target element container.
[0099] Based on this, the above S240 may specifically include:
[0100] Process the original page elements to obtain the target page elements;
[0101] According to the first association relationship and the association relationship between the original page element and the target page element, a second association relationship is determined, and the second association relationship is used to determine a target element container for displaying the target page element.
[0102] Here, the identification information of the target element container can be used to uniquely identify the target element container. After the first association relationship is established, the identification information can also be used to identify the first association relationship. If there are multiple target element containers, multiple first association relationships can be established. Multiple first association relationships can represent information as an index.
[0103] As an example, after obtaining the target element container, the container attribute information of the target element container can be obtained, and then the identification information of the target element container is generated according to the container attribute information, and the first association relationship between the identification information, the original page element and the target element container is established with the identification information as an index. After the first association relationship is established, the first association relationship can be cached.
[0104] Based on this, after the original page element is processed to obtain the target page element, the target page element can be added to the first association relationship where the original page element is located according to the association relationship between the original page element and the target page element to obtain the second association relationship. That is, the second association relationship can include the association relationship between the target page element and the target element container.
[0105] Based on this, in some embodiments, the above S250 may specifically include:
[0106] Determine a target element container for displaying the target page element based on the second association relationship;
[0107] Place the target page element in the target element container of the first page container.
[0108] In this way, by determining the target element container for displaying the target page elements in the second association relationship, it can be ensured that the target element container can be accurately located even when the number of target page elements is large.
[0109] Based on this, in order to further improve the efficiency of page processing, in some embodiments, the original page element is processed to obtain the target page element, and the second association relationship is determined according to the first association relationship and the association relationship between the original page element and the target page element, which may specifically include:
[0110] Generate a page processing request based on the first association relationship and the original page element;
[0111] Sending a page processing request to a page processing server, so that the page processing server responds to the page processing request, processes the original page element, and obtains the target page element; determining a second association relationship according to the first association relationship and the association relationship between the original page element and the target page element;
[0112] Receive the target page element and the second association relationship fed back by the page processing server.
[0113] Here, the page processing request can be used to request the page processing server to process the original page element to obtain the target page element, and determine the second association relationship based on the first association relationship and the association relationship between the original page element and the target page element. The page processing request can include the first association relationship and the original page element.
[0114] The embodiment of the present application generates the original page elements and the second association relationship with the help of the page processing server, which can reduce the computing pressure of the local processor and further improve the page processing efficiency.
[0115] In order to better describe the entire solution, some specific examples are given based on the above embodiments. Figure 5 As shown, taking the first page as a page in an application, and the first page container including multiple types of second page containers as an example, the page processing method provided in the embodiment of the present application may specifically include the following steps:
[0116] S51, after the application is started, periodically capture the function call stack during the running of the application;
[0117] S52, for each function information in the function call stack, matching the function information with characteristic information corresponding to each of the multiple types of second page containers to obtain a matching result, and determining the type of the second page container corresponding to the function information according to the matching result;
[0118] S53: based on the type of the second page container, add target code to the code of the second page container to intercept the original page element and the target element container;
[0119] S54: For each second page container, intercept the pointers of the original page element and the target element container through the target code;
[0120] S55, obtaining a target element container according to the pointer, obtaining container attribute information of the target element container, and extracting the original page element from the target element container;
[0121] S56: Generate identification information of the target element container based on the container attribute information of the target element container, and establish a first association relationship between the identification information, the original page element, and the target element container using the identification information as an index;
[0122] S57: upon receiving a first operation of the user on the first page, generating a page processing request based on the first association relationship and the original page element;
[0123] S58, sending a page processing request to a page processing server, so that the page processing server processes the original page element in response to the page processing request to obtain a target page element; determining a second association relationship according to the first association relationship and the association relationship between the original page element and the target page element;
[0124] S59, receiving the target page element and the second association relationship fed back by the page processing server;
[0125] S510, determining a target element container for displaying a target page element according to the second association relationship;
[0126] S511, obtaining element attribute information of the target page element;
[0127] S512: Determine the display mode of the target page element based on the container attribute information and the element attribute information;
[0128] S513: placing the target page element in the target element container of the first page container according to the display mode, so as to update and display the first page.
[0129] The embodiment of the present application captures the function call stack at regular intervals during the running of the application after the application is started, and then determines the type of the second page container based on the function information in the function call stack, that is, by dynamically determining the container type, compared with the traditional static determination of the container type based on reflection, it is possible to timely discover whether the page structure has changed, and obtain the nested container type (i.e., the type of the second page container) corresponding to the latest page structure in real time, thereby ensuring the accuracy of the type of the second page container. By obtaining the original page element and the target element container based on the type of the second page container, instead of traversing the entire page structure tree, the efficiency of obtaining the original page element can be improved. By processing the original page element to obtain the target page element, and placing the target page element in the target element container of the first page container, it is possible to reset the processed target page element back to the first page, thereby updating the first page. In this way, in the embodiment of the present application, the second page container and the target element container can be used to extract the original page element and reset the target page element without traversing the entire page structure tree, thereby improving the page processing efficiency.
[0130] Based on the page processing method provided in the above embodiment, the present application also provides a specific implementation of the page processing device. Please refer to the following embodiment.
[0131] like Figure 6 As shown, the page processing device 600 provided in the embodiment of the present application may include the following modules:
[0132] A receiving module 610 is used to receive a first operation of a user on a first page;
[0133] A first acquisition module 620 is used to acquire a first page container in response to a first operation, where the first page container is used to display a first page, and the first page container includes an element container for displaying page elements;
[0134] A second acquisition module 630 is used to acquire the original page element in the first page container and a target element container for displaying the original page element;
[0135] The processing module 640 is used to process the original page element to obtain the target page element;
[0136] The updating module 650 is used to place the target page element in the target element container of the first page container to update and display the first page.
[0137] The page processing device 600 is described in detail below, as follows:
[0138] In some of these embodiments, the first page container includes multiple types of second page containers.
[0139] Based on this, the second acquisition module 630 may specifically include:
[0140] The first acquisition submodule is used to respectively acquire original page elements in a plurality of second page containers and a target element container for displaying the original page elements by using an acquisition method corresponding to the type of the second page container.
[0141] In some embodiments, the first page is a page in an application, and different types of second page containers correspond to different characteristic information. Based on this, the second acquisition module 630 may further specifically include:
[0142] A second acquisition submodule is used to acquire a function call stack of the application during operation before respectively acquiring original page elements in a plurality of second page containers and a target element container for displaying the original page elements by using an acquisition method corresponding to the type of the second page container, wherein the function call stack includes function information of a plurality of called functions, the function information includes function information of the second page container, and the function information includes at least two items of a function name, a class name, and an interface information;
[0143] A matching submodule, used for matching each function information with characteristic information corresponding to each of the multiple types of second page containers to obtain a matching result;
[0144] The determination submodule is used to determine the type of the second page container corresponding to the function information according to the matching result.
[0145] In some embodiments, the first acquisition submodule may specifically include:
[0146] The plugging unit is used to add target code to the code of the second page container based on the type of the second page container, and the target code is used to intercept the original page element and the target element container;
[0147] An interception unit, for intercepting pointers of the original page element and the target element container through the target code for each second page container;
[0148] An acquisition unit, used for acquiring a target element container according to a pointer of the target element container;
[0149] The extraction unit is used to extract the original page element from the target element container.
[0150] In some embodiments, the page processing device 600 may further include:
[0151] The third acquisition module is used to acquire the container attribute information of the target element container and the element attribute information of the target page element before placing the target page element in the target element container of the first page container.
[0152] Based on this, the update module 650 may specifically include:
[0153] The first updating submodule is used to place the target page element in the target element container of the first page container based on the element attribute information and the container attribute information.
[0154] In some embodiments, the first updating submodule may specifically include:
[0155] A determination unit, used to determine the display mode of the target page element in the target element container based on the element attribute information and the container attribute information;
[0156] The updating unit is used to place the target page element in the target element container of the first page container according to the display mode.
[0157] In some embodiments, the page processing device 600 may further include:
[0158] A generating module, used for generating identification information of a target element container based on container attribute information of the target element container before processing the original page element to obtain the target page element;
[0159] The association module is used to establish a first association relationship between the identification information, the original page element and the target element container by taking the identification information as an index.
[0160] Based on this, the processing module 640 can be specifically used for:
[0161] Process the original page elements to obtain the target page elements;
[0162] According to the first association relationship and the association relationship between the original page element and the target page element, a second association relationship is determined, and the second association relationship is used to determine a target element container for displaying the target page element.
[0163] In some embodiments, the processing module 640 may be specifically configured to:
[0164] Generate a page processing request based on the first association relationship and the original page element;
[0165] Sending a page processing request to a page processing server, so that the page processing server responds to the page processing request, processes the original page element, and obtains the target page element; determining a second association relationship according to the first association relationship and the association relationship between the original page element and the target page element;
[0166] Receive the target page element and the second association relationship fed back by the page processing server.
[0167] In some embodiments, the update module 650 may specifically include:
[0168] A determination submodule, configured to determine a target element container for displaying a target page element based on the second association relationship;
[0169] The second updating submodule is used to place the target page element in the target element container of the first page container.
[0170] In some of the embodiments, the original page element includes at least one of a text element, an image element, a video element, and an audio element.
[0171] In some embodiments, the processing module 640 may specifically include any one of the following:
[0172] The first processing submodule is used to convert the language of the original page element to obtain the target page element;
[0173] The second processing submodule is used to change the content of the original page element to obtain the target page element.
[0174] In some of the embodiments, the container attribute information includes at least position information of the target element container in the first page container, and size information and shape information of the target element container.
[0175] The embodiment of the present application, upon receiving the first operation of the user on the first page, first obtains the first page container for displaying the first page, and then obtains the original page element from the first page container, so that the original page element to be processed can be obtained without traversing the page structure tree. By obtaining the target element container for displaying the original page element, the position of the original page element in the first page can be located by the target element container. By processing the original page element to obtain the target page element, and placing the target page element in the target element container of the first page container, the processed target page element can be reset back to the first page to achieve the update of the first page. In this way, in the embodiment of the present application, the first page container and the target element container can be used to extract the original page element and reset the target page element without traversing the entire page structure tree, thereby improving the efficiency of page processing.
[0176] Based on the page processing method provided in the above embodiment, the embodiment of the present application also provides a specific implementation of the electronic device. Figure 7 A schematic diagram of an electronic device 700 provided in an embodiment of the present application is shown.
[0177] The electronic device 700 may include a processor 710 and a memory 720 storing computer program instructions.
[0178] Specifically, the processor 710 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0179] The memory 720 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 720 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 720 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 720 may be inside or outside the electronic device 700. In a particular embodiment, the memory 720 is a non-volatile solid-state memory.
[0180] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of the present application.
[0181] The processor 710 implements any one of the page processing methods in the above embodiments by reading and executing computer program instructions stored in the memory 720 .
[0182] In one example, the electronic device 700 may further include a communication interface 730 and a bus 740. Figure 7 As shown, the processor 710, the memory 720, and the communication interface 730 are connected via a bus 740 and communicate with each other.
[0183] The communication interface 730 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0184] Bus 740 includes hardware, software or both, and the parts of electronic equipment are coupled to each other.For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 740 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0185] Exemplarily, the electronic device 700 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
[0186] The electronic device can execute the page processing method in the embodiment of the present application, thereby realizing the combination Figures 2 to 6 The page processing method and device described.
[0187] In addition, in combination with the page processing method in the above embodiment, the embodiment of the present application can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the page processing methods in the above embodiment is implemented.
[0188] In combination with the page processing method in the above embodiment, the embodiment of the present application can provide a computer program product for implementation. When the instructions in the computer program product are executed by a processor of an electronic device, any one of the page processing methods in the above embodiment is implemented.
[0189] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0190] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0191] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0192] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0193] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A page processing method, characterized in that: include: Receiving a first operation of a user on a first page; In response to the first operation, a first page container is acquired, where the first page container is used to display the first page, and the first page container includes an element container for displaying page elements; Acquire an original page element in the first page container and a target element container for displaying the original page element; Processing the original page element to obtain a target page element; The target page element is placed in the target element container of the first page container to update and display the first page.
2. The method according to claim 1, characterized in that The first page container includes multiple types of second page containers, and the obtaining of the original page element in the first page container and the target element container for displaying the original page element includes: The original page elements in a plurality of the second page containers and the target element container for displaying the original page elements are respectively obtained by an acquisition method corresponding to the type of the second page container.
3. The method according to claim 2, characterized in that The first page is a page in an application, and different types of second page containers correspond to different characteristic information; before respectively acquiring original page elements and target element containers for displaying the original page elements in a plurality of second page containers in an acquisition method corresponding to the type of the second page container, the method further includes: Acquire a function call stack of the application during operation, wherein the function call stack includes function information of a plurality of called functions, the function information includes function information of the second page container, and the function information includes at least two items of a function name, a class name, and interface information; Matching each of the function information with the characteristic information corresponding to each of the multiple types of second page containers to obtain a matching result; According to the matching result, the type of the second page container corresponding to the function information is determined.
4. The method according to claim 2, characterized in that: The obtaining of the original page elements in the plurality of second page containers and the target element container for displaying the original page elements respectively in a manner corresponding to the type of the second page container includes: Based on the type of the second page container, adding a target code to the code of the second page container, wherein the target code is used to intercept the original page element and the target element container; For each of the second page containers, the pointers of the original page element and the target element container are intercepted by the target code; Acquire the target element container according to the pointer of the target element container; The original page element is extracted from the target element container.
5. The method according to claim 1, characterized in that Before placing the target page element in the target element container of the first page container, the method further includes: Acquire container attribute information of the target element container and element attribute information of the target page element; Placing the target page element in the target element container of the first page container includes: Based on the element attribute information and the container attribute information, the target page element is placed in the target element container of the first page container.
6. The method according to claim 5, characterized in that Placing the target page element in the target element container of the first page container based on the element attribute information and the container attribute information includes: Based on the element attribute information and the container attribute information, determining a display mode of the target page element in the target element container; According to the display method, the target page element is placed in the target element container of the first page container.
7. The method according to claim 1, characterized in that Before the original page element is processed to obtain the target page element, the method further includes: Based on the container attribute information of the target element container, generating identification information of the target element container; Using the identification information as an index, establishing a first association relationship between the identification information, the original page element, and the target element container; The processing of the original page element to obtain the target page element includes: The processing of the original page element to obtain the target page element; A second association relationship is determined based on the first association relationship and the association relationship between the original page element and the target page element, and the second association relationship is used to determine the target element container for displaying the target page element.
8. The method according to claim 7, characterized in that The processing of the original page element to obtain the target page element, and determining the second association relationship according to the first association relationship and the association relationship between the original page element and the target page element, includes: Generate a page processing request based on the first association relationship and the original page element; Sending the page processing request to a page processing server, so that the page processing server processes the original page element in response to the page processing request to obtain a target page element; determining a second association relationship according to the first association relationship and the association relationship between the original page element and the target page element; Receive the target page element and the second association relationship fed back by the page processing server.
9. The method according to claim 7 or 8, characterized in that: Placing the target page element in the target element container of the first page container includes: Determine the target element container for displaying the target page element based on the second association relationship; The target page element is placed in the target element container of the first page container.
10. The method according to any one of claims 1 to 8, characterized in that: The original page element includes at least one of a text element, an image element, a video element, and an audio element; the processing of the original page element to obtain the target page element includes any one of the following: Performing language conversion on the original page element to obtain a target page element; The content of the original page element is changed to obtain a target page element.
11. The method according to any one of claims 5 to 8, characterized in that: The container attribute information includes at least position information of the target element container in the first page container, and size information and shape information of the target element container.
12. A page processing device, characterized in that: Applied to electronic equipment, the device comprises: A receiving module, used for receiving a first operation of a user on a first page; A first acquisition module, configured to acquire a first page container in response to the first operation, wherein the first page container is used to display the first page, and the first page container includes an element container for displaying page elements; A second acquisition module, used to acquire an original page element in the first page container and a target element container for displaying the original page element; A processing module, used for processing the original page element to obtain a target page element; An updating module is used to place the target page element in the target element container of the first page container to update and display the first page.
13. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the page processing method according to any one of claims 1 to 11 is implemented.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the page processing method according to any one of claims 1 to 11 is implemented.
15. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the page processing method as described in any one of claims 1-11.