Page processing method and device, storage medium and electronic equipment
By receiving page enhancement requests and user interaction operations, and dynamically adjusting page element styles using configuration files, the problem of low enhancement flexibility in webpage age-friendly transformation is solved, achieving a flexible page age-friendly effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TRAVELSKY TECHNOLOGY LIMITED
- Filing Date
- 2026-03-10
- Publication Date
- 2026-06-19
Smart Images

Figure CN122240952A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and more specifically, to a page processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the increasing aging population and rising internet penetration, adapting web pages to be age-friendly to ensure that older adults can access and use information conveniently and without barriers has become a key task for improving social inclusion and the penetration rate of digital services. Currently, most age-friendly web page adaptation solutions rely on directly modifying the original web page's source code to adjust the page to a fixed enhancement, resulting in low flexibility in page enhancement.
[0003] There is currently no effective solution to the aforementioned problems in the relevant technologies. Summary of the Invention
[0004] The main objective of this application is to provide a page processing method, apparatus, storage medium, and electronic device to solve the problem of low flexibility in page enhancement when adding fixed auxiliary enhancement effects to pages to improve page aging resistance.
[0005] To achieve the above objectives, according to one aspect of this application, a page processing method is provided. The method includes: upon receiving a page enhancement request for a target page, determining a page enhancement method from the page enhancement request, wherein the page enhancement method is at least used to adjust the style of page elements; responding to a user's interaction with the target page, determining the page element indicated by the interaction, and obtaining the target page element; updating the style of the target page element on the target page based on the page enhancement method and target information in the page source code using an element instance of the target page element, thereby obtaining an updated target page, wherein the target information describes the element enhancement rules of the target page element, and the target information is imported into the document object model tree corresponding to the page source code based on a preset configuration file during page loading.
[0006] Optionally, the page processing method further includes: before updating the style of the target page element in the target page based on the page enhancement method and the target information in the page source code through the element instance of the target page element, obtaining a configuration file, wherein the configuration file is used to declare the element enhancement rules corresponding to different elements; compiling the content in the configuration file into a cascading style sheet to obtain the target style sheet; and injecting the target style sheet into the document object model tree corresponding to the page source code in the form of tags.
[0007] Optionally, the page processing method further includes: traversing the element nodes in the document object model tree corresponding to the page source code; for each element node, calculating the node identifier of the element node based on the node information of the element node, wherein the document object model tree is a tree data structure obtained after parsing the page source code, and the element nodes correspond one-to-one with the page elements in the target page; identifying the element nodes whose node identifiers are recorded in the configuration file as target element nodes, and constructing a virtual document object model tree based on the target element nodes, wherein the virtual document object model tree includes references to the target element nodes and the element enhancement rules corresponding to the target element nodes in the configuration file; adding markers to the target element nodes in the document object model tree according to the virtual document object model tree to obtain an updated document object model tree, wherein the added markers are used to characterize the element enhancement types possessed by the target element nodes; and updating the style of the target page elements in the target page based on the updated document object model tree, the page enhancement method, and the target information through element instances.
[0008] Optionally, the page processing method further includes: determining the element enhancement type of the target page element based on the updated document object model tree; determining the target enhancement method to be applied from the page enhancement methods based on the element enhancement type of the target page element; and updating the style of the target page element based on the target enhancement method and the target information.
[0009] Optionally, the page processing method also includes: extracting at least one of the following feature fields from the node information of the element node: node tag name, role name, semantic tag, text content, node native identifier, class name, and parent node node identifier; concatenating the extracted feature field and the field value of the feature field into a string; and performing summary generation processing on the string to obtain the node identifier.
[0010] Optionally, the page processing method also includes: detecting whether there are updates to element nodes in the document object model tree; if there are updates to element nodes in the document object model tree, recalculating the node identifier of the element node based on the node information of the element node.
[0011] Optionally, the page processing method further includes: displaying multiple selection plugins on the target page before determining the page enhancement method from the page enhancement request, wherein different selection plugins are used to select different page enhancement methods; and determining the page enhancement request in response to a click operation on a selection plugin.
[0012] To achieve the above objectives, according to another aspect of this application, a page processing apparatus is provided. The apparatus includes: a first determining module, configured to, upon receiving a page enhancement request for a target page, determine a page enhancement method from the page enhancement request, wherein the page enhancement method is at least used to adjust the style of page elements; a second determining module, configured to, in response to a user's interaction with the target page, determine the page element indicated by the interaction operation, and obtain the target page element; and a first processing module, configured to, based on the page enhancement method and target information in the page source code, update the style of the target page element on the target page using an element instance of the target page element, thereby obtaining an updated target page, wherein the target information describes the element enhancement rules of the target page element, and the target information is imported into the document object model tree corresponding to the page source code based on a preset configuration file during page loading.
[0013] Optionally, the page processing device further includes: an acquisition module for acquiring a configuration file, wherein the configuration file is used to declare element enhancement rules corresponding to different elements; a compilation module for compiling the content in the configuration file into a cascading style sheet to obtain a target style sheet; and a second processing module for injecting the target style sheet into the document object model tree corresponding to the page source code in the form of tags.
[0014] Optionally, the first processing module further includes: a calculation submodule, used to traverse the element nodes in the document object model tree corresponding to the page source code, and for each element node, calculate the node identifier of the element node based on the node information of the element node, wherein the document object model tree is a tree data structure obtained after parsing the page source code, and the element nodes correspond one-to-one with the page elements in the target page; a construction submodule, used to determine the element nodes whose node identifiers are recorded in the configuration file as target element nodes, and construct a virtual document object model tree based on the target element nodes, wherein the virtual document object model tree includes references to the target element nodes and the element enhancement rules corresponding to the target element nodes in the configuration file; an adding submodule, used to add markers to the target element nodes in the document object model tree according to the virtual document object model tree, to obtain an updated document object model tree, wherein the added markers are used to characterize the element enhancement types possessed by the target element nodes; and an updating submodule, used to update the style of the target page elements in the target page based on the updated document object model tree, the page enhancement method, and the target information through element instances.
[0015] Optionally, the update submodule further includes: a first determining unit, used to determine the element enhancement type of the target page element based on the updated document object model tree; a second determining unit, used to determine the target enhancement method to be implemented from the page enhancement methods based on the element enhancement type of the target page element; and an update unit, used to update the style of the target page element based on the target enhancement method and target information.
[0016] Optionally, the calculation submodule further includes: an extraction unit, used to extract at least one of the following feature fields from the node information of the element node: node tag name, role name, semantic tag, text content, node native identifier, class name, and parent node node identifier; a concatenation unit, used to concatenate the extracted feature fields and their values into a string; and a processing unit, used to perform summary generation processing on the string to obtain the node identifier.
[0017] Optionally, the page processing device further includes: a detection module for detecting whether there are updates to element nodes in the document object model tree; and a calculation module for recalculating the node identifier of the element node based on the node information of the element node when there are updates to the element nodes in the document object model tree.
[0018] Optionally, the page processing device further includes: a display module for displaying multiple selection plugins on the target page, wherein different selection plugins are used to select different page enhancement methods; and a third determination module for determining a page enhancement request in response to a click operation on a selection plugin.
[0019] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium including a stored executable program, wherein, when the executable program is running, it controls the device where the computer-readable storage medium is located to perform the above-described page processing method.
[0020] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, the electronic device including a memory storing an executable program; and a processor for running the program, wherein the program executes the page processing method described above when it runs.
[0021] To achieve the above objectives, according to another aspect of this application, a computer program product is provided, including computer instructions that, when executed by a processor, implement the steps of the page processing method described above.
[0022] In this embodiment, by determining the page enhancement method and target page elements based on user-initiated requests and interactive operations, the user's real-time enhancement needs are accurately identified. By updating the style of the target page elements on the target page based on the page enhancement method and target information in the page source code, the style of elements on the target page is automatically enhanced according to user needs, effectively improving the flexibility of page enhancement. Furthermore, by using configuration files to import the element enhancement rules of the target page elements into the document object model tree corresponding to the page source code, manual modification of the page source code is avoided. This reduces manual costs and allows for flexible adjustment of enhancement rules, further improving the flexibility of page enhancement.
[0023] Therefore, the method provided in this application achieves the goal of automatically and adaptively enhancing the styles of elements on the target page according to user needs, thereby improving the flexibility of page enhancement and solving the technical problem of low page enhancement flexibility in related technologies that add fixed enhancement effects to the page to improve page adaptability. Attached Figure Description
[0024] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0025] Figure 1 This is a hardware structure block diagram of a computer terminal provided according to an embodiment of this application;
[0026] Figure 2 This is a flowchart of a page processing method provided according to an embodiment of this application;
[0027] Figure 3 This is a schematic diagram of the target page provided according to an embodiment of this application;
[0028] Figure 4 This is a schematic diagram of a page processing method provided according to an embodiment of this application;
[0029] Figure 5 This is a schematic diagram of a page processing apparatus provided according to an embodiment of this application;
[0030] Figure 6 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0031] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application.
[0032] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0033] It should be noted that the information collected in this application (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data all comply with relevant laws, regulations, and standards, necessary confidentiality measures have been taken, and they do not violate public order and good morals. Corresponding access points are provided for users to choose to authorize or refuse. For example, interfaces are set up between this system and relevant users or organizations, providing users with corresponding access points to choose to agree to or refuse automated decision-making results; if the user chooses to refuse, the process proceeds to the expert decision-making stage.
[0034] Example 1
[0035] According to an embodiment of this application, an embodiment of a page processing method is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0036] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a page processing method is shown. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more processors 102 (shown as 102a, 102b, ..., 102n in the figure) 102 (processor 102 may include, but is not limited to, a microprocessor (MCU) or a field-programmable gate array (FPGA), etc.), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output (I / O) interface, a Universal Serial Bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0037] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0038] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the page processing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the page processing method described above. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0039] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0040] The display can be, for example, a touchscreen liquid crystal display (LCD), which allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0041] Under the aforementioned operating environment, this application provides the following: Figure 2 The page processing method shown. Figure 2 This is a flowchart of a page processing method according to Embodiment 1 of this application.
[0042] Step S201: Upon receiving a page enhancement request for the target page, determine the page enhancement method from the page enhancement request, wherein the page enhancement method is at least used to adjust the style of page elements.
[0043] Optionally, electronic devices, application systems, servers, or other similar devices can be used as the execution subject of this application. In this embodiment, the target processing system is used as the execution subject to execute the page processing method described above.
[0044] In an optional embodiment, the page enhancement request is initiated by the user through the human-computer interaction interface, or the page enhancement request is a request triggered automatically by the system when it detects that the user may need accessibility features.
[0045] For example, in civil aviation internet applications, it could be a user clicking the "Age-Friendly Mode" button, or a request generated by the system automatically recognizing user needs through the user's device's auxiliary technology settings (such as the startup status of a screen reader).
[0046] For example, the system can dynamically render an age-friendly toolbar at the top of the target page, providing features such as reset, sound on / off, speech speed adjustment (normal, faster, slower), mouse zoom, crosshair cursor for positioning, color scheme switching (supporting four high-contrast modes: white background with black text, blue background with yellow text, yellow background with black text, and black background with yellow text), overall page zoom in / out, reading mode (supporting "point-and-read" (mouse pointing triggers voice playback) and "continuous reading" (automatic sequential reading)), large display screen, desktop shortcut generation, and operation help guidance. The toolbar is hidden by default and can be triggered to appear via the "Website Accessibility" button. After triggering the age-friendly toolbar, users can select their desired enhancements from it, and then generate a page enhancement request after clicking confirm.
[0047] In an optional embodiment, page enhancements refer to accessibility features determined based on user needs or webpage characteristics, such as font size adjustment, high-contrast mode, and simplified navigation. These features aim to improve page accessibility and age-friendliness. Page enhancements are used at least to adjust the style of page elements and can also be used to add accessibility features to page elements, such as voice guidance and additional prompts. Page enhancements are used to improve the age-friendliness of the page.
[0048] In an optional embodiment, when the system detects a "page enhancement request" (e.g., when a user clicks a button on the adaptive toolbar), it determines the page enhancement method specified by the user from the page enhancement request. For example, the user may have selected a large font mode, in which case the page enhancement method would be to adjust the font size of text elements.
[0049] Step S202: In response to the user's interactive operation on the target page, determine the page element indicated by the interactive operation and obtain the target page element.
[0050] Optionally, user interaction refers to actions performed by the user on the target page, such as clicking, mouse hovering, and keyboard navigation. The target page element refers to the page element that the user's action points to or affects. For example, if a user clicks on a flight information table, then the flight information table is the target page element.
[0051] For example, the system can listen for user actions to capture those actions and determine the target page element the user is focusing on or interacting with. For instance, if a user focuses on the flight search button using keyboard navigation, that button can be identified as the target page element.
[0052] Step S203: The style of the target page element in the target page is updated by the element instance of the target page element according to the page enhancement method and the target information in the page source code, so as to obtain the updated target page. The target information is used to describe the element enhancement rules of the target page element. The target information is imported into the document object model tree corresponding to the page source code based on the preset configuration file during the page loading process.
[0053] Optionally, the target information can be stored in a configuration file. During page loading, the system can compile the configuration file into a standardized set of CSS (Cascading Style Sheets) rules. This CSS... <style>标签形式动态注入至目标页面的文档对象模型(Document ObjectModel Tree,DOM)树的<head>区域,并被赋予较高的层叠优先级,以确保后续样式覆盖能力。该CSS不立即生效,而是作为"样式定义池”,供后续按需激活与绑定,以避免对无需增强的页面元素造成视觉干扰。文档对象模型树为对页面源代码解析后得到的树形数据结构,文档对象模型树中的元素节点与目标页面中的页面元素一一对应。
[0054] 在一可选的实施例中,在确定页面增强方式和目标页面元素之后,系统中的界面模块可以通过界面消息处理机制postMessage向页面中的各个页面元素的元素实例发送结构化事件消息,事件消息包含目标页面元素和节点标识和页面增强方式。每个页面元素的元素实例作为独立消息接收者,监听并解析该消息,在监听到自身为事件消息所指定的目标页面元素的情况下,其可以根据消息中的页面增强方式确定自身待生效的目标增强方式,然后基于目标增强方式和目标信息,对自身进行样式更新。
[0055] 在本申请实施例中,通过基于用户发起的请求以及交互操作,确定页面增强方式和目标页面元素,实现了对用户的实时增强需求的准确确定,通过基于页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新,实现了依据用户需求自动对目标页面中元素的样式进行辅助增强,从而可以有效提高页面辅助增强的灵活性。此外,通过利用配置文件将目标页面元素的元素增强规则导入页面源代码对应的文档对象模型树,避免了人工对页面源代码的修改,从而一方面降低了人工成本,另一方面使得增强规则能够灵活调整,进一步地提高页面辅助增强的灵活性。
[0056] 由此可见,本申请所提供的方法达到了依据用户需求自动对目标页面中元素的样式进行适应性辅助增强的目的,实现了提高页面辅助增强的灵活性的技术效果,解决了相关技术中为页面添加固定的辅助增强效果,以提高页面适老化效果,从而存在页面增强灵活性低的技术问题。
[0057] 可选的,在本申请实施例提供的页面处理方法中,在通过目标页面元素的元素实例根据页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新之前,方法还包括:获取配置文件,其中,配置文件中用于声明不同元素对应的元素增强规则;将配置文件中的内容编译为层叠样式表形式,得到目标样式表;将目标样式表以标签形式注入页面源代码对应的文档对象模型树中。
[0058] 可选的,配置文件可以理解为是一种保存网页元素增强规则的文件,它包含了适用于不同元素的样式调整和功能增强指令,如字体大小、色彩对比度、焦点样式等。在一可选的实施例中,配置文件中包含了适用于不同元素类型的样式调整和功能增强指令。元素类型可以分为按钮、文本、图像等。
[0059] 在获取到配置文件后,系统可以使用自定义的解析器将配置文件中的规则编译为CSS规则集,即目标样式表。这一过程涉及将配置文件中的规则转换为浏览器可理解的CSS语法。例如,配置文件中可能包含"所有航班查询表的字体大小应调整为20pt,行高为1.5倍字体大小”的规则,编译器会将其转换为相应的CSS规则。
[0060] 在编译完成"目标样式表”后,接下来的步骤是将其以<style>标签的形式注入到目标页面的DOM树中。这一注入过程可以设置样式表的优先级高于其他可能存在的CSS规则,以防止增强规则被覆盖。
[0061] 例如,在页面加载初期,系统将配置文件中声明的元素增强规则编译为一组标准化的CSS规则集,也即目标样式表。这些规则涵盖字体大小(如18–24pt)、高对比度配色方案、焦点高亮框、无障碍状态样式等。该目标样式表以<style>标签形式动态注入目标页面的DoM树的<head>区域,并赋予较高的层叠优先级,以确保后续样式覆盖能力。此目标样式表不立即生效,而是作为样式定义池,供后续按需激活与绑定,避免对未匹配节点造成视觉干扰。
[0062] 在一可选的实施例中,配置文件中的元素增强规则可以包括表1中所示出的至少部分字段:
[0063] 表1
[0064]
[0065]
[0066] 需要说明的是,通过上述方式,实现了在无需修改原有网页源代码的情况下,为页面提供了动态、智能的适老化和无障碍增强功能。首先,通过获取配置文件,系统能够加载并解析特定于网站的增强规则,满足了适老化和无障碍改造的基本需求。其次,将配置文件编译为CSS规则集,实现了规则从原始格式到浏览器可理解格式的转换,确保了样式调整的正确性和兼容性。最后,通过将CSS规则以<style>标签形式注入到页面的DOM树中,系统能够在用户触发请求时即时应用增强效果,提升了网页的响应性和用户体验。
[0067] 可选的,在本申请实施例提供的页面处理方法中,通过目标页面元素的元素实例根据页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新,包括:遍历页面源代码对应的文档对象模型树中的元素节点,对于每个元素节点,根据元素节点的节点信息计算得到元素节点的节点标识,其中,文档对象模型树为对页面源代码解析后得到的树形数据结构,元素节点与目标页面中的页面元素一一对应;将节点标识被记录在配置文件中的元素节点确定为目标元素节点,并基于目标元素节点构建虚拟文档对象模型树,其中,虚拟文档对象模型树包括目标元素节点的引用以及目标元素节点在配置文件中对应的元素增强规则;依据虚拟文档对象模型树对文档对象模型树中的目标元素节点添加标记,得到更新后的文档对象模型树,其中,添加的标记用于表征目标元素节点所具备的元素增强类型;通过元素实例根据更新后的文档对象模型树、页面增强方式以及目标信息,对目标页面元素在目标页面中的样式进行更新。
[0068] 可选的,系统首先需要遍历整个页面源代码对应的文档对象模型树(即DOM树),该DOM树是浏览器在解析HTML(Hyper Text Markup Language,超文本标记语言)文档后生成的,用于表示页面结构的树形数据结构,DOM树中包括多个DOM节点(也即元素节点),DOM节点与目标页面中的页面元素一一对应。在遍历过程中,对于每个遇到的元素节点,插件会根据节点的属性信息(如标签名、类名、ID(Identity Document,身份标识号)等)计算出一个唯一的节点标识。这一过程确保了即使是动态生成的页面元素,也能够被唯一而准确地识别,为后续的页面增强操作提供了基础,并提高了灵活性。
[0069] 在遍历DOM树的过程中,对于那些在配置文件中被标记的元素节点,即其节点标识存在于配置文件中的元素,系统会将其确定为目标元素节点。接下来,插件会基于这些目标元素节点在配置文件中构建一个虚拟DOM树(也即虚拟文档对象模型树),该树不仅包含了目标元素节点的引用(即原生DOM节点的引用),还包含了该节点在配置文件中对应的元素增强规则。
[0070] 在虚拟DOM树构建完成后,系统可以会对DOM树中的目标元素节点添加标记,其可以是自定义的属性或类名,用以标识该节点已经具备的元素增强类型,从而得到更新后的文档对象模型树。这一标记过程可以简化后续的页面增强操作,使得节点自身能够快速识别并应用增强规则。
[0071] 在得到更新后的文档对象模型树之后,由元素实例根据更新后的文档对象模型树、页面增强方式以及目标信息,对目标页面元素在目标页面中的样式进行更新。
[0072] 例如,以一个具体的示例对上述确定更新后的文档对象模型树的过程进行示例性说明。例如,系统监听DOM树中的Body元素及其子树,以实现对整个目标页面的可视区域里面的所有元素的元素节点的监听。系统通过一个独立的实例持续监听前述的<body>元素及其子树的结构变化,包括元素节点的添加、删除与属性更新,确保动态渲染内容(如SPA(Single Page Application,单页面应用程序)路由切换、异步加载模块)也能被纳入适配范围。系统遍历DOM树的每一个节点,计算其节点标识,并与配置文件中预定义的节点标识(即nodeId)进行模式匹配。
[0073] 在匹配成功后,插件在内存中构建一个增强型虚拟DOM节点(也可以称为虚拟元素节点),该虚拟元素节点不仅包含原始DOM的引用(即真实DOM实例),还携带其对应的DSL配置片段(也即元素增强规则,如,包括样式规则、事件策略、无障碍属性等),从而由构建的所有虚拟DOM节点形成一棵带配置上下文的虚拟DOM树(也即虚拟文档对象模型树)。该树结构支持快速查找、更新与状态同步。
[0074] 在得到虚拟DOM树之后,依据虚拟文档对象模型树对文档对象模型树中的目标元素节点添加标记,得到更新后的文档对象模型树。通俗而言,前述的标记可以理解为是"能力开关名”集合,其并不直接指向或存储完整的元素增强规则,规则始终放在目标样式表当中,标记的作用是为了告诉元素实例"我可以支持哪些开关”,以使得元素实例可以通过开关名去样式表中查对应的规则。
[0075] 在一可选的实施例中,上述的元素增强类型包括但不限于重置、声音开关、语速调节、字体调整、鼠标放大、十字光标辅助定位、配色方案切换、页面整体放大与缩小、阅读模式、大显示屏显示、桌面快捷方式生成、操作帮助指引、事件反馈等。
[0076] 需要说明的是,通过计算节点标识并构建虚拟DOM树,系统能够准确识别和定位页面中需要增强的元素,使得增强规则能够被正确应用。通过在DOM树中添加相应标记,可以简化了后续的元素增强操作,提高页面处理效率。
[0077] 可选的,在本申请实施例提供的页面处理方法中,通过元素实例根据更新后的文档对象模型树、页面增强方式以及目标信息,对目标页面元素在目标页面中的样式进行更新,包括:依据更新后的文档对象模型树中确定目标页面元素所具备的元素增强类型;根据目标页面元素所具备的元素增强类型从页面增强方式中确定待生效的目标增强方式;依据目标增强方式和目标信息,对目标页面元素进行样式更新。
[0078] 可选的,目标页面元素的元素实例在确定目标页面元素需要增强的情况下,依据更新后的文档对象模型树中目标页面元素的元素节点中的标记来确定其具备的元素增强类型,也即确定该元素支持哪些类型的增强(如字体大小调整、高对比度显示、焦点样式修改等)。
[0079] 在确定目标页面元素具备的元素增强类型之后,基于该元素增强类型从页面增强方式中筛选出待生效的目标增强方式。例如,如果目标页面元素是一个按钮,该元素所具备的元素增量类型为字体调整,页面增强方式指出需要增加其焦点样式和字体大小,那么确定调整字体大小为待生效的目标增强方式。也即通过取交集的方式,从页面增强方式中确定待生效的目标增强方式。
[0080] 在确定待生效的目标增强方式之后,依据目标增强方式和目标信息,对目标页面元素进行样式更新。
[0081] 例如,如果待生效的目标增强方式是用于样式增强,则可以根据目标增强方式,从目标样式表中激活该目标增强方式对应的CSS类名或动态生成行内样式(style属性),以实现样式注入操作,如,字体放大、对比度增强、边框高亮等视觉优化。
[0082] 例如,如果待生效的目标增强方式是用于功能增强,则可以根据目标增强方式,执行以下相应操作,以对目标页面元素进行功能更新:
[0083] (1)、无障碍属性注入:动态添加ARIA(Accessible Rich InternetApplications,可访问的富互联网应用程序)属性(如role="button"、aria-label="返回首页")、设置相应属性以支持键盘导航,并插入语音导航锚点。目标处理系统可以在DOM节点中添加前述功能对应的属性,以实现对目标页面元素在目标页面中的功能更新。
[0084] (2)、事件反馈增强:在原始事件监听基础上,叠加适老化交互逻辑。例如,为按钮绑定"提示确认”机制(为可聚焦元素添加"悬浮提示”功能)。目标处理系统可以在DOM节点中添加前述功能对应的属性,以实现对目标页面元素在目标页面中的功能更新。
[0085] 在一可选的实施例中,上述样式注入操作、无障碍属性注入操作以及事件反馈增强操作可以均通过代理或装饰模式实现,保留原始事件回调,以使得业务功能不受影响。
[0086] 需要说明的是,通过上述方式,实现了基于目标页面元素支持的元素增强类型和用户需求的页面增强方式确定元素最终待生效的目标增强方式,从而可以提高页面增强处理的准确性。
[0087] 可选的,在本申请实施例提供的页面处理方法中,根据元素节点的节点信息计算得到元素节点的节点标识,包括:从元素节点的节点信息中提取出以下至少之一特征字段:节点标签名、角色名、语义标签、文本内容、节点原生标识、类名、父节点的节点标识;将提取出的特征字段以及该特征字段的字段值拼接为字符串;对字符串进行摘要生成处理,得到节点标识。
[0088] 为了系统在文件配置阶段与页面运行时阶段能够准确、稳定地识别出同一DOM节点,即使页面结构动态变化,也能实现配置与行为的可靠映射,目标处理系统可以基于节点的多维语义特征向量,通过哈希算法生成固定长度的唯一标识符,也即节点标识,以实现对DOM树中元素节点与配置文件中的规则的有效匹配。例如,目标处理系统可以从DOM节点的节点信息中提取以下特征字段中的至少之一:
[0089] 表2
[0090]
[0091] 在一可选的实施例中,从元素节点的节点信息中提取出以下至少特征字段:节点标签名、角色名、语义标签、文本内容、节点原生标识、类名、父节点的节点标识。
[0092] 在提取出特征字段之后,将提取出的特征字段以及该特征字段的字段值拼接为字符串。例如,将提取的特征按固定顺序拼接为标准化字符串,字段间以"|"分隔,并统一转为小写:"tag:button|role:button|aria:search flight|text:Search|id:flightSearchBtn|class:btn-primary,search-btn|ancestor:div-navigation|div-header"。在得到字符串之后,对字符串进行摘要生成处理,得到节点标识。
[0093] 需要说明的是,通过从元素节点的节点信息中提取特征字段、拼接这些特征为字符串以及对字符串进行摘要生成处理,最终生成一个稳定的节点标识,这一过使得即使在动态网页环境中,也能准确无误地识别并定位到需要进行适老化和信息无障碍配置的元素。从而可以提高页面处理的可靠性。
[0094] 可选的,在本申请实施例提供的页面处理方法中,在得到更新后的目标页面之后,方法还包括:检测文档对象模型树中的元素节点是否存在更新;在文档对象模型树中的元素节点存在更新的情况下,重新根据元素节点的节点信息计算得到该元素节点的节点标识。
[0095] 可选的,在得到更新后的目标页面,也即得到适老化增强后的目标页面之后,系统可以继续监测DOM树中元素节点的状态,判断是否有新的元素节点被添加、旧的元素节点被移除或是已有元素节点的属性被修改。
[0096] 一旦DOM树中的元素节点被检测到更新(无论是新增、删除还是属性更改),系统可以对DOM树重新执行节点标识的计算过程。这一过程涉及到再次提取元素的特征字段、拼接字符串以及生成新的摘要标识符,从而以便于后续与配置文件中的规则进行匹配。
[0097] 在一可选的实施例中,在文档对象模型树中的元素节点不存在更新的情况下,无需重新计算元素节点的节点标识。
[0098] 需要说明的是,通过上述方式,本实施例提供的方法能够有效适应页面的实时变化,从而提高了页面处理的可靠性。
[0099] 可选的,在本申请实施例提供的页面处理方法中,在从页面增强请求中确定页面增强方式之前,方法还包括:在目标页面中展示多个选择插件,其中,不同选择插件用于选择不同的页面增强方式;响应于针对选择插件的点选操作,确定页面增强请求。
[0100] 在一可选的实施例中,在用户访问目标网页(如,民航互联网应用的网页)时,首先会在页面的某个显著位置(如页眉、页脚或侧边栏)展示一个工具栏或菜单,这个工具栏包含了多个选择插件,每个插件代表一种不同的页面增强方式,例如字体放大、高对比度模式、语音反馈等。这些选择插件通常以图标、按钮或下拉菜单的形式出现,提供直观的用户界面,便于用户快速选择他们所需的信息无障碍辅助功能。
[0101] 例如,图3是根据本申请实施例提供的目标页面的示意图,如图3所示,在目标页面顶部动态渲染适老化功能工具栏,适老化功能工具栏中包括多个选择插件,以提供页面导航、重置、声音开关、语速调节(正常、加快、减缓)、鼠标放大、十字光标辅助定位、配色方案切换(支持白底黑字、蓝底黄字、黄底黑字、黑底黄字四种高对比度模式)、页面整体放大与缩小、阅读模式(支持"指读”(鼠标指向即语音播报),以及"连续读”(自动顺序朗读))、大显示屏显示、全局放大镜、桌面快捷方式生成及操作帮助指引等丰富功能。该工具栏默认隐藏,用户可以通过"网站无障碍”按钮触发显示,其状态与用户偏好可以通过信息文件(Cookie)持久化,以实现跨会话记忆。
[0102] 在一可选的实施例中,当用户通过鼠标或触摸设备(对于移动设备)点击这些选择插件,选出期望的页面增强方式之后,页面确定页面增强请求。例如,用户在点击字体放大按钮,选择高对比度模式,启用语音反馈之后点击确定按钮,系统确定页面增强请求中的增强方式包括字体放大、提高对比对以及语音反馈。
[0103] 需要说明的是,通过上述方式,实现了对页面增强请求的准确确定,从而可以更进一步地提高页面处理可靠性。
[0104] 在一可选的实施例中,图4是根据本申请实施例提供的页面处理方法的示意图,如图4所示,可以由该工作人员登录目标处理系统,在目标处理系统中通过可视化编辑的方式编写配置代码,并由目标处理系统基于工作人员编写的代码生成配置文件,如,对前述的代码进行格式转换,得到配置文件。前述功能可以由目标处理系统中的配置中枢执行。
[0105] 如图4所示,在得到配置文件后,在目标处理系统中加载配置文件。当接收到用户针对目标页面的页面增强请求之后,确定用户指定的增强方式,以及用户交互的目标页面操作元素。之后,遍历DOM中的元素节点,基于节点标识将其与配置文件进行匹配,以对DOM树进行更新,得到更新后的DOM树,并进行DOM实例化。前述功能可以由目标处理系统中的辅助功能解析引擎执行。然后,通过界面消息处理机制postMessage向页面中的各个页面元素的元素实例发送结构化事件消息,事件消息包含目标页面元素和节点标识和页面增强方式。每个页面元素的元素实例作为独立消息接收者,监听并解析该消息,在监听到自身为事件消息所指定的目标页面元素的情况下,其可以根据消息中的页面增强方式以及更新后的DOM树中记录的元素增强类型确定自身待生效的目标增强方式,然后基于目标增强方式和目标信息,对自身进行样式更新。
[0106] 如图4所示,目标处理系统通过辅助工具栏为用户提供增强效果的选择,其可以支持用户从语音控制、视觉增强、交互效果等方面进行选择。
[0107] 由此可见,本申请所提供的方法达到了依据用户需求自动对目标页面中元素的样式进行适应性辅助增强的目的,实现了提高页面辅助增强的灵活性的技术效果,解决了相关技术中为页面添加固定的辅助增强效果,以提高页面适老化效果,从而存在页面增强灵活性低的技术问题。
[0108] 需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
[0109] 实施例2
[0110] 本申请实施例还提供了一种页面处理装置,需要说明的是,本申请实施例的页面处理装置可以用于执行本申请实施例所提供的用于页面处理方法。以下对本申请实施例提供的页面处理装置进行介绍。
[0111] 根据本申请实施例,还提供了一种用于实施上述页面处理方法的装置,如图5所示,该装置包括:
[0112] 第一确定模块501,用于在接收到针对目标页面的页面增强请求的情况下,从页面增强请求中确定页面增强方式,其中,页面增强方式至少用于对页面元素的样式进行调整;
[0113] 第二确定模块502,用于响应于用户对目标页面的交互操作,确定交互操作指示的页面元素,得到目标页面元素;
[0114] 第一处理模块503,用于通过目标页面元素的元素实例根据页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新,得到更新后的目标页面,其中,目标信息用于描述目标页面元素的元素增强规则,目标信息在页面加载过程中基于预设的配置文件被导入页面源代码对应的文档对象模型树中。
[0115] 在本申请实施例中,通过基于用户发起的请求以及交互操作,确定页面增强方式和目标页面元素,实现了对用户的实时增强需求的准确确定,通过基于页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新,实现了依据用户需求自动对目标页面中元素的样式进行辅助增强,从而可以有效提高页面辅助增强的灵活性。此外,通过利用配置文件将目标页面元素的元素增强规则导入页面源代码对应的文档对象模型树,避免了人工对页面源代码的修改,从而一方面降低了人工成本,另一方面使得增强规则能够灵活调整,进一步地提高页面辅助增强的灵活性。
[0116] 由此可见,本申请所提供的方法达到了依据用户需求自动对目标页面中元素的样式进行适应性辅助增强的目的,实现了提高页面辅助增强的灵活性的技术效果,解决了相关技术中为页面添加固定的辅助增强效果,以提高页面适老化效果,从而存在页面增强灵活性低的技术问题。
[0117] 可选的,在本申请实施例提供的页面处理装置中,页面处理装置还包括:获取模块,用于获取配置文件,其中,配置文件中用于声明不同元素对应的元素增强规则;编译模块,用于将配置文件中的内容编译为层叠样式表形式,得到目标样式表;第二处理模块,用于将目标样式表以标签形式注入页面源代码对应的文档对象模型树中。
[0118] 可选的,在本申请实施例提供的页面处理装置中,第一处理模块还包括:计算子模块,用于遍历页面源代码对应的文档对象模型树中的元素节点,对于每个元素节点,根据元素节点的节点信息计算得到元素节点的节点标识,其中,文档对象模型树为对页面源代码解析后得到的树形数据结构,元素节点与目标页面中的页面元素一一对应;构建子模块,用于将节点标识被记录在配置文件中的元素节点确定为目标元素节点,并基于目标元素节点构建虚拟文档对象模型树,其中,虚拟文档对象模型树包括目标元素节点的引用以及目标元素节点在配置文件中对应的元素增强规则;添加子模块,用于依据虚拟文档对象模型树对文档对象模型树中的目标元素节点添加标记,得到更新后的文档对象模型树,其中,添加的标记用于表征目标元素节点所具备的元素增强类型;更新子模块,用于通过元素实例根据更新后的文档对象模型树、页面增强方式以及目标信息,对目标页面元素在目标页面中的样式进行更新。
[0119] 可选的,在本申请实施例提供的页面处理装置中,更新子模块还包括:第一确定单元,用于依据更新后的文档对象模型树中确定目标页面元素所具备的元素增强类型;第二确定单元,用于根据目标页面元素所具备的元素增强类型从页面增强方式中确定待生效的目标增强方式;更新单元,用于依据目标增强方式和目标信息,对目标页面元素进行样式更新。
[0120] 可选的,在本申请实施例提供的页面处理装置中,计算子模块还包括:提取单元,用于从元素节点的节点信息中提取出以下至少之一特征字段:节点标签名、角色名、语义标签、文本内容、节点原生标识、类名、父节点的节点标识;拼接单元,用于将提取出的特征字段以及该特征字段的字段值拼接为字符串;处理单元,用于对字符串进行摘要生成处理,得到节点标识。
[0121] 可选的,在本申请实施例提供的页面处理装置中,页面处理装置还包括:检测模块,用于检测文档对象模型树中的元素节点是否存在更新;计算模块,用于在文档对象模型树中的元素节点存在更新的情况下,重新根据元素节点的节点信息计算得到该元素节点的节点标识。
[0122] 可选的,在本申请实施例提供的页面处理装置中,页面处理装置还包括:展示模块,用于在目标页面中展示多个选择插件,其中,不同选择插件用于选择不同的页面增强方式;第三确定模块,用于响应于针对选择插件的点选操作,确定页面增强请求。
[0123] 此处需要说明的是,上述第一确定模块501、第二确定模块502、第一处理模块503对应于实施例1中的步骤S201至步骤S203,三个模块与对应的步骤所实现的实例和应用场景相同,但不限于上述实施例一所公开的内容。需要说明的是,上述模块或单元可以是存储在存储器(例如,存储器104)中并由一个或多个处理器(例如,处理器102a,102b,……,102n)处理的硬件组件或软件组件,上述模块也可以作为装置的一部分可以运行在实施例一提供的计算机终端10中。
[0124] 实施例3
[0125] 本申请的实施例可以提供一种电子设备,图6是根据本申请实施例的一种电子设备的结构框图。如图6所示,该电子设备可以包括:一个或多个(图6中仅示出一个)处理器1002、存储器1004、存储控制器、以及外设接口,其中,外设接口与射频模块、音频模块和显示器连接。
[0126] 其中,存储器可用于存储软件程序以及模块,如本申请实施例中的方法和装置对应的程序指令 / 模块,处理器通过运行存储在存储器内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器可进一步包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
[0127] 处理器可以通过传输装置调用存储器存储的信息及应用程序,以执行以下步骤:在接收到针对目标页面的页面增强请求的情况下,从页面增强请求中确定页面增强方式,其中,页面增强方式至少用于对页面元素的样式进行调整;响应于用户对目标页面的交互操作,确定交互操作指示的页面元素,得到目标页面元素;通过目标页面元素的元素实例根据页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新,得到更新后的目标页面,其中,目标信息用于描述目标页面元素的元素增强规则,目标信息在页面加载过程中基于预设的配置文件被导入页面源代码对应的文档对象模型树中。
[0128] 处理器还可以通过传输装置调用存储器存储的信息及应用程序,以执行以下步骤:在通过目标页面元素的元素实例根据页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新之前,获取配置文件,其中,配置文件中用于声明不同元素对应的元素增强规则;将配置文件中的内容编译为层叠样式表形式,得到目标样式表;将目标样式表以标签形式注入页面源代码对应的文档对象模型树中。
[0129] 处理器还可以通过传输装置调用存储器存储的信息及应用程序,以执行以下步骤:遍历页面源代码对应的文档对象模型树中的元素节点,对于每个元素节点,根据元素节点的节点信息计算得到元素节点的节点标识,其中,文档对象模型树为对页面源代码解析后得到的树形数据结构,元素节点与目标页面中的页面元素一一对应;将节点标识被记录在配置文件中的元素节点确定为目标元素节点,并基于目标元素节点构建虚拟文档对象模型树,其中,虚拟文档对象模型树包括目标元素节点的引用以及目标元素节点在配置文件中对应的元素增强规则;依据虚拟文档对象模型树对文档对象模型树中的目标元素节点添加标记,得到更新后的文档对象模型树,其中,添加的标记用于表征目标元素节点所具备的元素增强类型;通过元素实例根据更新后的文档对象模型树、页面增强方式以及目标信息,对目标页面元素在目标页面中的样式进行更新。
[0130] 处理器还可以通过传输装置调用存储器存储的信息及应用程序,以执行以下步骤:依据更新后的文档对象模型树中确定目标页面元素所具备的元素增强类型;根据目标页面元素所具备的元素增强类型从页面增强方式中确定待生效的目标增强方式;依据目标增强方式和目标信息,对目标页面元素进行样式更新。
[0131] 处理器还可以通过传输装置调用存储器存储的信息及应用程序,以执行以下步骤:从元素节点的节点信息中提取出以下至少之一特征字段:节点标签名、角色名、语义标签、文本内容、节点原生标识、类名、父节点的节点标识;将提取出的特征字段以及该特征字段的字段值拼接为字符串;对字符串进行摘要生成处理,得到节点标识。
[0132] 处理器还可以通过传输装置调用存储器存储的信息及应用程序,以执行以下步骤:检测文档对象模型树中的元素节点是否存在更新;在文档对象模型树中的元素节点存在更新的情况下,重新根据元素节点的节点信息计算得到该元素节点的节点标识。
[0133] 处理器还可以通过传输装置调用存储器存储的信息及应用程序,以执行以下步骤:在从页面增强请求中确定页面增强方式之前,在目标页面中展示多个选择插件,其中,不同选择插件用于选择不同的页面增强方式;响应于针对选择插件的点选操作,确定页面增强请求。
[0134] 在本申请实施例中,通过基于用户发起的请求以及交互操作,确定页面增强方式和目标页面元素,实现了对用户的实时增强需求的准确确定,通过基于页面增强方式以及页面源代码中的目标信息,对目标页面元素在目标页面中的样式进行更新,实现了依据用户需求自动对目标页面中元素的样式进行辅助增强,从而可以有效提高页面辅助增强的灵活性。此外,通过利用配置文件将目标页面元素的元素增强规则导入页面源代码对应的文档对象模型树,避免了人工对页面源代码的修改,从而一方面降低了人工成本,另一方面使得增强规则能够灵活调整,进一步地提高页面辅助增强的灵活性。
[0135] 由此可见,本申请所提供的方法达到了依据用户需求自动对目标页面中元素的样式进行适应性辅助增强的目的,实现了提高页面辅助增强的灵活性的技术效果,解决了相关技术中为页面添加固定的辅助增强效果,以提高页面适老化效果,从而存在页面增强灵活性低的技术问题。
[0136] 本领域普通技术人员可以理解,图6所示的结构仅为示意,电子设备也可以是智能手机、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等终端设备。图6其并不对上述电子装置的结构造成限定。例如,电子设备还可包括比图6中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图6所示不同的配置。
[0137] 本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(RandomAccess Memory,RAM)、磁盘或光盘等。
[0138] 实施例4
[0139] 本申请的实施例还提供了一种存储介质。可选的,在本实施例中,上述存储介质可以用于保存上述实施例一所提供的页面处理方法所执行的程序代码。
[0140] 可选的,在本实施例中,上述存储介质可以位于计算机网络中计算机终端群中的任意一个计算机终端中,或者位于移动终端群中的任意一个移动终端中。
[0141] 本申请还提供了一种计算机程序产品,当在数据处理设备上执行时,适于执行页面处理方法步骤的程序。
[0142] 上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
[0143] 在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
[0144] 在本申请所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。
[0145] 作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
[0146] 另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
[0147] 所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。
[0148] 以上所述仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。< / style>
Claims
1. A page processing method, characterized in that, include: Upon receiving a page enhancement request for a target page, a page enhancement method is determined from the page enhancement request, wherein the page enhancement method is at least used to adjust the style of page elements; In response to a user's interaction with the target page, the page element indicated by the interaction is determined, and the target page element is obtained. The style of the target page element in the target page is updated by the element instance of the target page element according to the page enhancement method and the target information in the page source code, so as to obtain the updated target page. The target information is used to describe the element enhancement rules of the target page element. The target information is imported into the document object model tree corresponding to the page source code based on a preset configuration file during the page loading process.
2. The method according to claim 1, characterized in that, Before updating the style of the target page element in the target page based on the page enhancement method and the target information in the page source code using an element instance of the target page element, the method further includes: Obtain the configuration file, wherein the configuration file is used to declare the element enhancement rules corresponding to different elements; The contents of the configuration file are compiled into a cascading style sheet to obtain the target style sheet; The target stylesheet is injected as a tag into the document object model tree corresponding to the page source code.
3. The method according to claim 2, characterized in that, The style of the target page element in the target page is updated based on the page enhancement method and the target information in the page source code, using an element instance of the target page element. This includes: Traverse the element nodes in the document object model tree corresponding to the page source code. For each element node, calculate the node identifier of the element node based on the node information of the element node. The document object model tree is a tree data structure obtained after parsing the page source code. The element nodes correspond one-to-one with the page elements in the target page. The element node whose node identifier is recorded in the configuration file is identified as the target element node, and a virtual document object model tree is constructed based on the target element node. The virtual document object model tree includes a reference to the target element node and the element enhancement rule corresponding to the target element node in the configuration file. Based on the virtual document object model tree, a mark is added to the target element node in the document object model tree to obtain an updated document object model tree, wherein the added mark is used to characterize the element enhancement type of the target element node; The style of the target page element in the target page is updated based on the element instance, the updated document object model tree, the page enhancement method, and the target information.
4. The method according to claim 3, characterized in that, The style of the target page element in the target page is updated based on the element instance, the updated document object model tree, the page enhancement method, and the target information, including: The element enhancement type of the target page element is determined based on the updated document object model tree; Based on the element enhancement type possessed by the target page element, determine the target enhancement method to be applied from the page enhancement methods; Based on the target enhancement method and the target information, the style of the target page elements is updated.
5. The method according to claim 3, characterized in that, The node identifier of the element node is calculated based on the node information of the element node, including: Extract at least one of the following feature fields from the node information of the element node: node tag name, role name, semantic tag, text content, node native identifier, class name, and parent node node identifier; The extracted feature fields and their values are concatenated into a string; The string is processed to generate a digest, and the node identifier is obtained.
6. The method according to claim 3, characterized in that, After obtaining the updated target page, the method further includes: Detect whether there are any updates in the element nodes of the document object model tree; If an element node in the document object model tree is updated, the node identifier of the element node is recalculated based on the node information of the element node.
7. The method according to claim 1, characterized in that, Before determining the page enhancement method from the page enhancement request, the method further includes: The target page displays multiple selection plugins, each used to select a different page enhancement method. In response to the click operation for the selected plugin, the page enhancement request is determined.
8. A page processing apparatus, characterized in that, include: The first determining module is used to determine a page enhancement method from the page enhancement request when a page enhancement request for a target page is received, wherein the page enhancement method is at least used to adjust the style of page elements; The second determining module is used to respond to the user's interactive operation on the target page, determine the page element indicated by the interactive operation, and obtain the target page element; The first processing module is used to update the style of the target page element in the target page according to the page enhancement method and the target information in the page source code by using the element instance of the target page element, so as to obtain the updated target page. The target information is used to describe the element enhancement rules of the target page element. The target information is imported into the document object model tree corresponding to the page source code based on a preset configuration file during the page loading process.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored executable program, wherein, when the executable program is executed, it controls the device on which the computer-readable storage medium is located to perform the page processing method according to any one of claims 1 to 7.
10. An electronic device, characterized in that, include: Memory, which stores executable programs; A processor for running the program, wherein the program, when running, performs the page processing method according to any one of claims 1 to 7.