IP Library Granted Patent US 10,409,899
Granted Patent B2
US 10,409,899 · App. 14/998,315 · Granted Sep 10, 2019

Method, device and mobile terminal for processing webpage in night mode

Inventors: Qianzhou Wang (Guangdong, CN); Jin Liang (Guangdong, CN); Xianfeng Li (Guangdong, CN); Xiaokai Ke (Guangdong, CN)
Assignee: GUANGZHOU UCWEB COMPUTER TECHNOLOGY CO., LTD.
G06F17/2288G06F17/218G06F17/227G06F17/2247
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,409,899
App. No.
14/998,315
Granted
Sep 10, 2019
Kind
B2
Abstract

Methods, devices, and mobile terminals for webpage processing in a night mode are provided. A method may comprise the browser injecting the CSS style of night mode and the corresponding JavaScript into the main file of said webpage via the interface of network request processing as provided by the terminal operating system when the browser is loading a webpage, and the browser parsing said main file, executing said JavaScript and applying said CSS style in a night mode to the webpage elements of said webpage for display. This can effect night mode and improve a user's browsing experience while maintaining the original webpage layout.

Claims (45)

1. A computer-implemented method for webpage processing in a night mode, wherein the method comprises:

injecting, by a browser using an interface of network request processing of a terminal operating system, a plurality of CSS styles of the night mode and a corresponding script code into a main file of a webpage when the browser is loading the webpage, wherein a priority of the plurality of CSS styles of the night mode is higher than a priority of an original CSS style of the main file, wherein said plurality of CSS styles of the night mode comprise a first type of CSS style of the night mode, a second type of CSS style of the night mode, and a third type of CSS style of the night mode; and

parsing, by the browser, said main file, executing said corresponding script code and applying said plurality of CSS styles of the night mode to webpage elements of said webpage for display, comprising:

generating, by the browser, a webpage Dom Tree based on the parsed main file;

modifying said webpage Dom Tree by adding said plurality of CSS styles of the night mode to said webpage Dom Tree, comprising:

setting CSS style of a first set node of the webpage Dom Tree as background color, frame color or text color designated by said first type of CSS style of the night mode, said first set node having predefined CSS style of the night mode;

setting CSS style of non-inspecting nodes of the webpage Dom Tree as background color or frame color designated by said second type of CSS style of the night mode;

applying said third type of CSS style at a special node of the webpage Dom Tree, said special node having a white background color or a white frame color style, comprising:

adding a first class to said special node when traversing each displayable node of said webpage Dom Tree,

acquiring an original style of said special node, and

based on a property of said original style satisfying a preset condition:

 adding a second class to said special node, and

 setting CSS style of said special node as background color and frame color designated by said third type of CSS style of the night mode.

2. The computer-implemented method for webpage processing in night mode of claim 1 , wherein, before the step of injecting, by the browser, the plurality of CSS styles of the night mode and the corresponding script code into the main file of said webpage via the interface of network request processing as provided by the terminal operating system when the browser is loading the webpage, said method further comprises:

registering a self-defined subclass of NSURLProtocol with iOS system via NSURLProtocol;

wherein injecting, by the browser, the plurality of CSS styles of the night mode and the corresponding script code into the main file of said webpage via the interface of network request processing as provided by the terminal operating system when the browser is loading the webpage further comprises:

injecting, by the browser, the plurality of CSS styles of the night mode and the corresponding script code into the main file of said webpage via said subclass of NSURLProtocol.

3. The computer-implemented method for webpage processing in night mode of claim 1 , wherein said preset condition is a property value of said original style being higher than a preset threshold value or satisfying a preset regular expression.

4. The computer-implemented method for webpage processing in night mode of claim 1 , wherein the step of setting the CSS style of said special node as the background color and frame color designated by said third type of CSS style of the night mode comprises:

based on said third type of CSS style of the night mode, selecting special node with said second class, setting the CSS style of said special node as the background color and frame color designated by said third type of CSS style; and

subsequent to setting the CSS style of said special node, adding a third class to said special node.

5. The computer-implemented method for webpage processing in night mode of claim 4 , wherein the step of parsing and executing, by the browser, said corresponding script code and adding said plurality of CSS styles in the night mode to said webpage Dom Tree comprises:

based on said plurality of CSS styles of the night mode comprising a fourth type of CSS style of the night mode applied to a second set node of said webpage Dom Tree, traversing each displayable node of said webpage Dom Tree to acquire said second set node and setting CSS style of said second set node as background color, frame color and text color designated by said fourth type of CSS style of the night mode, wherein said second set node is with said third class and without said second class.

6. The computer-implemented method for webpage processing in night mode of claim 1 , wherein, after the step of parsing, by the browser, said main file, executing said corresponding script code and applying said plurality of CSS styles of the night mode to the webpage elements of said webpage for display, said method further comprises:

monitoring whether said webpage is inserted with a new webpage element; and

based on said webpage being inserted with the new webpage element, parsing, by the browser, said main file, executing said corresponding script code and applying said plurality of CSS styles of the night mode to the new webpage element of said webpage for display.

7. An apparatus for webpage processing in a night mode, comprising at least one processor and at least one non-transitory memory including computer program code, the at least one non-transitory memory and the computer program code configured to, with the at least one processor, cause the apparatus to at least:

inject a plurality of CSS styles of the night mode and a corresponding script code into a main file of a webpage via an interface of network request processing of an operating system, wherein a priority of the plurality of CSS styles of the night mode is higher than a priority of an original CSS style of the main file, wherein said plurality of CSS styles of the night mode comprise a first type of CSS style of the night mode, a second type of CSS style of the night mode, and a third type of CSS style of the night mode; and

parse said main file, executing said corresponding script code and applying said plurality of CSS styles of the night mode to webpage elements of said webpage for display, comprising:

generating a webpage Dom Tree based on the parsed main file;

modifying said webpage Dom Tree by adding said plurality of CSS styles of the night mode to said webpage Dom Tree, comprising:

setting CSS style of a first set node of the webpage Dom Tree as background color, frame color or text color designated by said first type of CSS style of the night mode, said first set node having predefined CSS style of the night mode;

setting CSS style of non-inspecting nodes of the webpage Dom Tree as background color or frame color designated by said second type of CSS style of the night mode;

applying said third type of CSS style at a special node of the webpage Dom Tree, said special node having a white background color or a white frame color style, comprising:

adding a first class to said special node when traversing each displayable node of said webpage Dom Tree,

acquiring an original style of said special node, and

based on a property of said original style satisfying a preset condition:

 adding a second class to said special node, and

 setting CSS style of said special node as background color and frame color designated by said third type of CSS style of the night mode.

8. The apparatus for webpage processing in a night mode of claim 7 , wherein the at least one non-transitory memory including the computer program code is further configured to, with the at least one processor, cause the apparatus to:

register a self-defined subclass of NSURLProtocol with iOS system via NSURLProtocol; and

inject the plurality of CSS styles of the night mode and the corresponding script code into the main file of said webpage via said subclass of NSURLProtocol.

9. The apparatus for webpage processing in night mode of claim 7 , wherein, based on said plurality of CSS styles in the night mode comprising a fourth type of CSS style in the night mode applied to a second set node of said webpage Dom Tree, the at least one non-transitory memory including the computer program code is further configured to, with the at least one processor, cause the apparatus to:

traverse each displayable node of said webpage Dom Tree to acquire said second set node; and

set CSS style of said second set node as background color, frame color and text color designated by said fourth type of CSS style of the night mode, wherein said second set node is with third class and without said second class.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 28, 2020
From: GUANGZHOU UCWEB COMPUTER TECHNOLOGY CO., LTD
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 052771/0562 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 1, 2016
From: WANG, QIANZHOU; LIANG, JIN; LI, XIANFENG; KE, XIAOKAI
To: GUANGZHOU UCWEB COMPUTER TECHNOLOGY CO., LTD.
Reel/Frame 037634/0896 →
Priority Claims (1)
CN 2014 1 0830793 · Dec 25, 2014 · national
Continuity (1)
Related Publication 20160188552A1 · Jun 30, 2016