WO2015165216A1 - 一种浏览模式切换处理方法及装置 - Google Patents

一种浏览模式切换处理方法及装置 Download PDF

Info

Publication number
WO2015165216A1
WO2015165216A1 PCT/CN2014/088199 CN2014088199W WO2015165216A1 WO 2015165216 A1 WO2015165216 A1 WO 2015165216A1 CN 2014088199 W CN2014088199 W CN 2014088199W WO 2015165216 A1 WO2015165216 A1 WO 2015165216A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
background
picture
code
display result
Prior art date
Application number
PCT/CN2014/088199
Other languages
English (en)
French (fr)
Inventor
陶醉
Original Assignee
广州市动景计算机科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州市动景计算机科技有限公司 filed Critical 广州市动景计算机科技有限公司
Publication of WO2015165216A1 publication Critical patent/WO2015165216A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of mobile communication technologies, and in particular, to a browsing mode switching processing method and apparatus.
  • the browsing mode of the existing mobile browser browsing webpage generally includes a day mode and a night mode.
  • the night mode is suitable for the user to use the browser to browse the web on the mobile terminal in a relatively weak scene such as at night.
  • the implementation of the night mode function generally includes two ways.
  • the first existing method is to uniformly reduce the brightness of the entire browser interface (including webpage content) when switching from the daytime mode to the nighttime mode, such as a QQ mobile phone browser, a Baidu mobile phone browser, and the like.
  • the second existing method is a browser with a third-party kernel. When switching from day mode to night mode, a third-party kernel is called to perform night mode processing during page rendering, such as a UC mobile browser.
  • both implementations have obvious drawbacks.
  • the display effect is better than the first method, it is only applicable to a browser with a third-party kernel, and is not applicable to a browser with a kernel kernel, so the application is limited. And this method needs to occupy rendering resources.
  • the present invention provides a browsing mode switching processing method and apparatus, which is more versatile than the existing ones, does not need to occupy rendering resources, and has a better nighttime mode display effect.
  • a browsing mode switching processing method including: receiving a browsing mode switching command; injecting a first code and a second code for adjusting a style in the acquired page; and executing the first code Converting the text content and the background of the page into the value set by the first code to obtain a first display result of the page; executing the second code, displaying the text content of the page of the first display result and The background is adjusted to get the second display result of the page.
  • the executing the first code, converting the text content and the background of the page into the value set by the first code, and obtaining the first display result of the page comprises: executing a cascading style sheet, and the page is The text content and the background are converted into values set by the cascading style sheet, and the first display result of the text content of the page and the background darkening is obtained.
  • the executing the second code, and adjusting the text content and the background of the page displaying the first display result, and obtaining the second display result of the page includes: executing JS, and displaying the first display result
  • the text content of the page is increased in brightness, and the background of the page is adjusted to a gray background to obtain the second display result of the page.
  • the background of the page is adjusted to a gray background, including: determining whether there is a picture in the page; if not, adjusting the background of the page to a gray background; if yes, further determining whether the picture is the background of the page, and if so, The picture is adjusted to a gray background.
  • the image is determined to be the background of the page, according to the ratio of the length to the width of the picture being greater than the first threshold and the number of elements included in the picture being greater than the second threshold.
  • the method further includes: recording the text content of the page and the value before and after the background is adjusted; and recovering according to the recorded value when receiving the command to interrupt the switching or returning to the original mode.
  • a browsing mode switching processing apparatus includes: a receiving unit, configured to receive a browsing mode switching command; and an injecting unit, configured to inject a first code for adjusting a style in the acquired page and
  • the second execution unit is configured to execute the first code, convert the text content and the background of the page into the value set by the first code, to obtain a first display result of the page; and the second execution unit And executing the second code to adjust the text content and the background of the page displaying the first display result to obtain a second display result of the page.
  • the first execution unit is specifically configured to execute a cascading style sheet, and convert the text content and the background of the page into values set by the cascading style sheet, to obtain a text content of the page and a background darkened first. Show results.
  • the second execution unit is specifically configured to execute JS, adjust a text content of the page displaying the first display result, and adjust a background of the page displaying the first style to a gray background to obtain a page.
  • the second display result is specifically configured to execute JS, adjust a text content of the page displaying the first display result, and adjust a background of the page displaying the first style to a gray background to obtain a page.
  • the second display result is specifically configured to execute JS, adjust a text content of the page displaying the first display result, and adjust a background of the page displaying the first style to a gray background to obtain a page.
  • the device further includes: a determining unit, configured to: after the second execution unit increases the brightness of the text content of the page displaying the first display result, determine whether a picture exists in the page and determine whether the picture is a background of the page; when the determining unit determines that the page does not have a picture, the background of the page is adjusted to a gray background, and the determining unit determines that the page has a picture and the picture serves as a background of the page When the picture is adjusted to a gray background.
  • a determining unit configured to: after the second execution unit increases the brightness of the text content of the page displaying the first display result, determine whether a picture exists in the page and determine whether the picture is a background of the page; when the determining unit determines that the page does not have a picture, the background of the page is adjusted to a gray background, and the determining unit determines that the page has a picture and the picture serves as a background of the page When the picture is adjusted to a gray background.
  • the device further includes: a recording unit, configured to record a text content of the page and a value before and after the background is adjusted; and a recovery unit, configured to: according to the record, when receiving an interrupt interrupt or returning a command of the original mode The value recorded by the unit is restored.
  • a recording unit configured to record a text content of the page and a value before and after the background is adjusted
  • a recovery unit configured to: according to the record, when receiving an interrupt interrupt or returning a command of the original mode The value recorded by the unit is restored.
  • a terminal including: a processor; a memory for storing processor-executable instructions;
  • the memory is configured to store a computer execution instruction
  • the processor configured to execute the computer-executed instruction stored in the memory, receive a browse mode switching command, inject a first code and a second code for adjusting a style in the acquired page, and execute the first code Converting the text content and background of the page to the value set by the first code to obtain a first display result of the page; executing the second code, The text content and the background of the page displaying the first display result are adjusted to obtain a second display result of the page.
  • the processor is specifically configured to execute a cascading style sheet, convert the text content and the background of the page into values set by the cascading style sheet, and obtain a first display in which the text content of the page and the background become dark.
  • the JS is executed to increase the brightness of the text content of the page displaying the first display result, and adjust the background of the page to a gray background to obtain a second display result of the page.
  • the processor is specifically configured to determine whether a picture exists in the page; if not, adjust the background of the page to a gray background; if yes, further determine whether the picture is the background of the page, and if so, adjust the picture to a gray background .
  • the processor is specifically configured to determine whether a node image attribute of the page includes a background image attribute, and if yes, determine that the picture exists.
  • the processor is configured to determine, according to the ratio of the length and the width of the picture, that the ratio of the length to the width is greater than the first threshold, and the number of elements included in the picture is greater than the second threshold, determining the picture as the background of the page.
  • the processor is further configured to record the text content of the page and the value before and after the background is adjusted; when receiving the command to interrupt the switching or returning to the original mode, the recovery is performed according to the recorded value.
  • a non-transitory computer readable storage medium comprising computer executed instructions for execution of said computer execution instructions by a computer, said computer executing said browsing mode switching processing method .
  • a first code for example, CSS
  • a second code for example, JS
  • the first code and the second code injected are the code supported by any browser, you only need to modify the CSS+HTML of the page through these codes, you can easily switch from day mode to night mode, so whether it is the system With the kernel or with a third party
  • the core no matter which platform system, can be used, is more versatile, does not occupy rendering resources, and can accurately change the attributes of each element in the web page, and the night mode display effect is better.
  • FIG. 1 is a first schematic flowchart of a browsing mode switching processing method according to an embodiment of the present invention
  • FIG. 2 is a second schematic flowchart of a browsing mode switching processing method according to an embodiment of the present invention.
  • FIG. 3 is a third schematic flowchart diagram of a browsing mode switching processing method according to an embodiment of the present invention.
  • FIG. 4 is a fourth schematic flowchart of a browsing mode switching processing method according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram showing the comparison of effects before and after the browsing mode switching in the embodiment of the present invention.
  • FIG. 6 is a schematic diagram showing the effect of executing CSS when switching according to an embodiment of the present invention.
  • FIG. 7 is a schematic diagram showing the effect of executing JS when switching according to an embodiment of the present invention.
  • FIG. 8 is a first schematic diagram showing the structure of a device according to an embodiment of the present invention.
  • Figure 9 is a second schematic view showing the structure of the apparatus of the embodiment of the present invention.
  • FIG. 10 is a schematic diagram showing the structure of a terminal according to an embodiment of the present invention.
  • the invention provides a browsing mode switching processing method, which is more versatile than the existing solution, does not need to occupy rendering resources, and has a good nighttime mode display effect.
  • FIG. 1 is a first schematic flowchart of a browsing mode switching processing method according to an embodiment of the present invention, including steps:
  • the first code is executed, and the text content and the background of the page are converted into values set by the first code to obtain a first display result of the page.
  • the second code is executed, and the text content and the background of the page displaying the first display result are adjusted to obtain a second display result of the page.
  • FIG. 2 is a second schematic flowchart of a browsing mode switching processing method according to an embodiment of the present invention, including the steps:
  • the browsing mode switching command is received.
  • the first code for setting a style for example, CSS
  • the second code for adjusting a style for example, JS
  • the first code is executed first, and the text content of the page is Converting a background to a value set by the first code to obtain a first display result of the page; and executing the second code, and adjusting a text content and a background of the page displaying the first display result to obtain a page number Two shows the result.
  • the first code and the second code injected are any code supported by the browser, you only need to modify the CSS+HTML (HyperText Markup Language) of the page to complete the day mode.
  • CSS+HTML HyperText Markup Language
  • Night mode switching so whether the system comes with a kernel or a third-party kernel, no matter which platform system, it can be used, more versatile, does not take up rendering resources, and can be used for the attributes of each element in the web page. With precise changes, the night mode display is also better.
  • FIG. 3 is a third schematic flowchart diagram of a browsing mode switching processing method according to an embodiment of the present invention.
  • the invention injects CSS and JS into the page when the browsing mode needs to switch from the day mode to the night mode; respectively implements the coarse and fine adjustment of the night mode by executing CSS and JS respectively, firstly converting the entire page into a preset by executing CSS
  • the preliminary style of the night mode the coarse adjustment is realized, and then the font of each node of the page is increased in brightness (ie, highlighted) by performing JS, and the background of the page is adjusted to gray, thereby achieving fine adjustment and obtaining the final nighttime. Mode page.
  • Figure 3 includes the steps:
  • the role of CSS is generally to define the style of the content (font size, color, etc.), can be loaded in the background, does not affect the parsing of HTML.
  • the present invention is to use CSS to convert the entire page into a preliminary pattern of a preset night mode.
  • JS is a scripting language that runs in a browser and is powerful enough to dynamically change the content of a web page, such as inserting HTML.
  • the invention is to use JS to fine-tune the webpage that has been converted into the preliminary pattern of the night mode.
  • the injected CSS is to set the text content of the page and the background to be darkened.
  • the injected JS is to set the text content to be brighter and the background to be gray.
  • JS generally takes longer than CSS processing, so the present invention is in the next step. Execute CSS first during processing.
  • the invention can formulate different CSS styles corresponding to the page mode according to different page node attributes, and convert the current page node into a preset night mode mode when the CSS is executed. That is, the CSS is executed, and the text content and background of the page are converted into the values set by the CSS, and the first display result of the text content of the page and the background darkening is obtained. Since loading CSS takes a short time and has a large processing range, injecting CSS can quickly show the primary night mode effect.
  • the style of the preset night mode can be:
  • Transparency Set to a opaque, 60% transparency mask.
  • the JS is executed, each node is traversed, the text content of the page is brightnessed (lighted), and the background of the page is adjusted to a gray background to obtain a second display result of the page (ie, the last night mode result) ).
  • the logic of night mode is to "dark" the text content color, that is, the current RGB value is adjusted according to certain rules by RGB (R (red) red, G (green) green, B (blue) blue color algorithm,
  • RGB red
  • G green
  • B blue
  • the alpha for transparency
  • the solution of the present invention adopts a more special way, adopting the opposite idea, and then performing CSS to make the overall brightness lower, and then all the characters are brightened on the original basis, which makes the night mode effect better.
  • an attribute can be inserted to record the original brightness of the text, so that the night mode can be cancelled (ie, the previous mode is restored).
  • FIG. 4 is a fourth schematic flowchart of a browsing mode switching processing method according to an embodiment of the present invention.
  • the difference between the flow of Figure 4 and Figure 3 is that different processing is added if there is a picture. process. Specifically, according to whether the page contains images for different processing, if the page is judged to have no picture, the background of the page is directly adjusted to gray. If there is a picture, the length and width of the picture and the number of elements on the picture are obtained, according to the picture. The aspect ratio and the number of elements on the picture determine the role of the picture. If the picture is used as a background picture, the picture is grayed out, and when the picture is not a background picture, it is considered to be provided to the user for viewing. The picture is not processed.
  • Figure 4 includes the steps:
  • This step is the same as step 301.
  • This step is the same as step 302.
  • This step is the same as the processing in step 303 of the process of brightening the font.
  • step 406 determine whether the page contains a picture, when there is no picture, proceeds to step 405, when there is a picture, proceeds to step 406;
  • the backgroundImage in the property of the page node (ComputedStyle) is obtained, and the page node contains the image according to the backgroundImage property.
  • the page background is converted into a preset gray background, and proceeds to step 410;
  • This step directly converts the page background to a gray background when there is no image on the page.
  • the original page background color can be recorded, and the mark color has been changed to perform the operation of canceling the night mode.
  • step 406 obtaining the length and width of the picture and the number of elements on the picture, proceeds to step 407;
  • the length and width of the image and the number of elements on the image can be obtained according to the page code.
  • Elements on the image include characters such as small boxes on the picture.
  • step 407 the number of elements in the picture to determine whether the picture is a background picture, when the picture is not a background picture, proceeds to step 408, when the picture is a background picture, proceeds to step 409;
  • the aspect ratio of the picture satisfies certain conditions, for example, greater than or equal to a threshold (such as 1/0.8), and the number of elements on the picture (such as characters, small boxes on the picture) satisfies certain conditions, for example, greater than or equal to the threshold (for example, 10), it can be judged that the role of the picture is as a background picture, otherwise it is not a background picture, but a picture that the user needs to watch.
  • a threshold such as 1/0.8
  • the number of elements on the picture such as characters, small boxes on the picture
  • the picture is set to a preset gray background, and proceeds to step 410;
  • the image is used as the background image, that is, as the background of the page, there are two ways to deal with it. One is to adjust the color value to make it a gray background, and the other is to directly increase the mask to make it a gray background. .
  • the original page background color can be recorded, and the mark color has been changed to perform the operation of canceling the night mode.
  • this step obtains the final nighttime mode effect and is displayed.
  • the text content of the page and the value before and after the background is adjusted may be recorded, so that when the interrupt switching or the command returning to the original mode is received, the recovery is performed according to the recorded value. That is, the daytime mode is restored according to the previously made mark, so that it can quickly change the attribute value of the node that needs to be changed.
  • FIG. 5 is a schematic diagram of the effect comparison before and after the browsing mode switching in the embodiment of the present invention.
  • the left side is an effect diagram of the day mode, and the right side is an effect diagram of switching to the night mode;
  • FIG. 6 shows the switching mode of the embodiment of the present invention.
  • Schematic diagram of the effect after executing CSS, the text content of the webpage and the background of the webpage become dark;
  • FIG. 7 shows the present invention The effect of executing the JS after the embodiment is switched, the text content of the webpage is already illuminated.
  • the first code for example, CSS
  • the second code for example, JS
  • the first code and the second code injected are the code supported by any browser, you only need to modify the CSS+HTML of the page through these codes, you can easily switch from day mode to night mode, so whether it is the system
  • the kernel or third-party kernel no matter which platform system, it can be used, more versatile, does not take up rendering resources, and can accurately change the attributes of each element in the web page, and the night mode display effect is also better.
  • FIG. 8 is a first schematic diagram showing the structure of a device according to an embodiment of the present invention.
  • a browsing mode switching processing device 80 includes a receiving unit 801, an injecting unit 802, a first executing unit 803, and a second executing unit 804.
  • the receiving unit 801 is configured to receive a browsing mode switching command.
  • the injecting unit 802 is configured to inject, in the acquired page, a first code for setting a style and a second code for adjusting a style;
  • the first execution unit 803 is configured to execute the first code, convert the text content and the background of the page into the value set by the first code, to obtain a first display result of the page;
  • the second executing unit 804 executes the second code, and adjusts the text content and the background of the page displaying the first display result to obtain a second display result of the page.
  • the injecting unit 802 is specifically configured to inject a cascading style sheet CSS and a JS in the obtained page, wherein the text content and the background of the CSS setting page become dark, the JS setting text content becomes bright, and the background becomes gray;
  • the first execution unit 803 is specifically configured to execute the CSS, convert the text content and the background of the page into the value of the CSS setting, and obtain the text content of the page and the background darkening.
  • One display result is specifically configured to execute the CSS, convert the text content and the background of the page into the value of the CSS setting, and obtain the text content of the page and the background darkening.
  • the second execution unit 804 is specifically configured to execute the JS, adjust the brightness of the text content of the page displaying the first display result, and adjust the background of the page displaying the first style to a gray background to obtain the page.
  • the second display results are specifically configured to execute the JS, adjust the brightness of the text content of the page displaying the first display result, and adjust the background of the page displaying the first style to a gray background to obtain the page.
  • the second display results are specifically configured to execute the JS, adjust the brightness of the text content of the page displaying the first display result, and adjust the background of the page displaying the first style to a gray background to obtain the page.
  • Fig. 9 is a second schematic view showing the structure of the apparatus of the embodiment of the present invention.
  • a browsing mode switching processing device 90 includes a receiving unit 801, an injecting unit 802, a first executing unit 803, a second executing unit 804, a determining unit 905, a recording unit 906, and a restoring unit 907.
  • the receiving unit 801, the injecting unit 802, the first executing unit 803, and the second executing unit 804 are the same as those described in FIG.
  • the determining unit 905 is configured to determine, after the second execution unit 804 increases the brightness of the text content of the page displaying the first display result, whether the picture exists in the page and whether the picture is used as the background of the page;
  • the second execution unit 804 adjusts the background of the page to a gray background, and when the determining unit 905 determines that the page has a picture and the picture is the background of the page. , to adjust the picture to a gray background.
  • a recording unit 906 configured to record a text content of the page and a value before and after the background is adjusted
  • the recovery unit 907 is configured to perform recovery according to the value recorded by the recording unit 906 when receiving the command to interrupt the switching or returning to the original mode.
  • FIG. 10 is a schematic diagram showing the structure of a terminal according to an embodiment of the present invention.
  • the terminal device 100 includes a browsing mode switching processing device 200, which may be the device 80 in FIG. 8 or the device 90 in FIG. 9, and its function and structure are shown in FIG. 8 or FIG.
  • the terminal device 100 may be any terminal device with web browsing capability, including a desktop computer, a notebook computer, a smart mobile terminal, an IPad product produced by Apple or other companies, a personal data assistant, and the like.
  • the browsing mode switching processing apparatus may be implemented by using hardware, may be implemented by software, or may be implemented by combining software and hardware.
  • the browsing mode switching processing device can be implemented using one or more processors.
  • the storage unit is further configured to save the browsing mode switching processing means for executing Functional application.
  • the one or more processors are configured to, upon receiving the instruction, invoke a corresponding application stored in the storage unit to perform the function.
  • the method according to the invention can also be implemented as a computer program executed by a processor (such as a CPU) in a mobile terminal and stored in a memory of the mobile terminal.
  • a processor such as a CPU
  • the above-described functions defined in the method of the present invention are performed when the computer program is executed by the processor.
  • the method according to the invention may also be embodied as a computer program product comprising a computer readable medium on which is stored a computer program for performing the functions described above in the method of the invention. .
  • the method steps and system units described above may also be implemented with a controller and a computer readable storage device for storing a computer program that causes the controller to implement the steps or unit functions described above.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

本发明公开一种浏览模式切换处理方法。该方法包括:接收浏览模式切换命令;在获取的页面中注入用于设置样式的第一代码和用于调整样式的第二代码;执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;执行所述第二代码,将所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。本发明相应提供一种浏览模式切换处理装置。本发明的方案客与现有方案相比通用性更强,无需占用渲染资源,且夜间模式显示效果较好。

Description

一种浏览模式切换处理方法及装置
本发明要求于2014年4月29日提交中国专利局、申请号为201410179042.6、发明名称为“一种浏览模式切换处理方法及装置”的中国专利申请的优先权,其内容通过引用结合在本发明中。
技术领域
本发明涉及移动通信技术领域,更为具体地,涉及一种浏览模式切换处理方法及装置。
背景技术
现有的移动浏览器浏览网页的浏览模式一般包括日间模式和夜间模式。夜间模式适合用户在晚上等光线比较弱的场景下更好地在移动终端上使用浏览器来进行网页浏览。夜间模式功能的实现一般包括两种方式。第一种现有方式是从日间模式切换为夜间模式时,将整个浏览器界面(包括网页内容)统一降低明度,例如QQ手机浏览器、百度手机浏览器等。第二种现有方式是具有第三方内核的浏览器,从日间模式切换为夜间模式时,调用第三方内核,在页面渲染时进行夜间模式处理,例如UC手机浏览器。
但是这两种实现方式都存在比较明显的缺陷。在第一种现有实现方式中,在切换成夜间模式后,由于是对浏览器界面和网页内容统一降低明度,使得移动终端的屏幕亮度降低,从而大大降低了网页内容的可读性,十分不利于用户在光线比较弱的环境下进行网页浏览。在第二种现有实现方式中,虽然显示效果比第一种方式更好,但只适用于有第三方内核的浏览器,如果是系统自带内核的浏览器则不适用,因此应用受限,并且该方式需要占用渲染资源。
因此,希望提供一种通用性更强,且显示效果较好的浏览模式切换处理方法。
发明内容
鉴于上述,本发明提出了一种浏览模式切换处理方法及装置,与现有方案相比通用性更强,无需占用渲染资源,且夜间模式显示效果较好。
本发明的技术方案如下:
根据本发明的一个方面,提供了一种浏览模式切换处理方法,包括:接收浏览模式切换命令;在获取的页面中注入用于调整样式的第一代码和第二代码;执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
其中,所述执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果包括:执行级联样式表,将所述页面的文字内容和背景转换为所述级联样式表设置的值,得到页面的文字内容和背景变暗的第一显示结果。
其中,所述执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果包括:执行JS,将显示所述第一显示结果的页面的文字内容调高亮度,将页面的背景调为灰色背景,得到页面的第二显示结果。
其中,所述将页面的背景调为灰色背景,包括:判断页面中是否存在图片;若否,将页面的背景调为灰色背景;若是,进一步判断所述图片是否作为页面的背景,若是,将所述图片调为灰色背景。
其中,判断页面的节点属性中是否含有背景图片属性,若是,则判断为存在图片。
其中,根据所述图片的长与宽的比值大于第一阈值且所述图片中含有的元素个数大于第二阈值,判断出所述图片作为页面的背景。
其中,该方法还包括:记录所述页面的文字内容和背景被调整前后的值;在接收到中断切换或返回原有模式的命令时,根据所记录的值进行恢复。
根据本发明的另一个方面,提供一种浏览模式切换处理装置,包括:接收单元,用于接收浏览模式切换命令;注入单元,用于在获取的页面中注入用于调整样式的第一代码和第二代码;第一执行单元,用于执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;第二执行单元,执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
其中,所述第一执行单元具体用于执行级联样式表,将所述页面的文字内容和背景转换为所述级联样式表设置的值,得到页面的文字内容和背景变暗的第一显示结果。
其中,所述第二执行单元具体用于执行JS,将显示所述第一显示结果的页面的文字内容调高亮度,将显示所述第一样式的页面的背景调为灰色背景,得到页面的第二显示结果。
其中,该装置还包括:判断单元,用于在所述第二执行单元将显示所述第一显示结果的页面的文字内容调高亮度后,判断页面中是否存在图片及判断所述图片是否作为页面的背景;所述第二执行单元在所述判断单元判断出页面不存在图片时,将页面的背景调为灰色背景,在所述判断单元判断出页面存在图片且所述图片作为页面的背景时,将所述图片调为灰色背景。
其中,该装置还包括:记录单元,用于记录所述页面的文字内容和背景被调整前后的值;恢复单元,用于在接收到中断切换或返回原有模式的命令时,根据所述记录单元记录的值,进行恢复。
根据本发明的又一个方面,提供一种终端,包括:处理器;用于存储处理器可执行指令的存储器;其中,
所述存储器,用于存储计算机执行指令;
所述处理器,用于执行所述存储器存储的所述计算机执行指令,接收浏览模式切换命令;在获取的页面中注入用于调整样式的第一代码和第二代码;执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;执行所述第二代码, 将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
其中,所述处理器,具体用于执行级联样式表,将所述页面的文字内容和背景转换为所述级联样式表设置的值,得到页面的文字内容和背景变暗的第一显示结果;执行JS,将显示所述第一显示结果的页面的文字内容调高亮度,将页面的背景调为灰色背景,得到页面的第二显示结果。
所述处理器,具体用于判断页面中是否存在图片;若否,将页面的背景调为灰色背景;若是,进一步判断所述图片是否作为页面的背景,若是,将所述图片调为灰色背景。
所述处理器,具体用于判断页面的节点属性中是否含有背景图片属性,若是,则判断为存在图片。
所述处理器,具体用于根据所述图片的长与宽的比值大于第一阈值且所述图片中含有的元素个数大于第二阈值,判断出所述图片作为页面的背景。
此外,所述处理器,还用于记录所述页面的文字内容和背景被调整前后的值;在接收到中断切换或返回原有模式的命令时,根据所记录的值进行恢复。
根据本发明的再一个方面,提供一种非临时性计算机可读存储介质,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行前述的浏览模式切换处理方法。
利用上述方法,在接收浏览模式切换命令后,在获取的页面中注入用于设置样式的第一代码(例如CSS)和用于调整样式的第二代码(例如JS),先执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;再执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。因为注入的第一代码和第二代码是任何浏览器都支持的代码,只需要通过这些代码修改页面的CSS+HTML,就能简单完成从日间模式到夜间模式的切换,因此无论是系统自带内核还是含第三方内 核,无论是哪个平台系统,都可以使用,通用性更强,也不占用渲染资源,而且能对于网页中的各个元素的属性进行精确的改变,夜间模式的显示效果也更好。
为了实现上述以及相关目的,本发明的一个或多个方面包括后面将详细说明并在权利要求中特别指出的特征。下面的说明以及附图详细说明了本发明的某些示例性方面。然而,这些方面指示的仅仅是可使用本发明的原理的各种方式中的一些方式。此外,本发明旨在包括所有这些方面以及它们的等同物。
附图说明
根据下述参照附图进行的详细描述,本发明的上述和其他目的、特征和优点将变得更加显而易见。在附图中:
图1示出了本发明实施例浏览模式切换处理方法的第一流程示意图;
图2示出了本发明实施例浏览模式切换处理方法的第二流程示意图;
图3示出了本发明实施例浏览模式切换处理方法的第三流程示意图;
图4示出了本发明实施例浏览模式切换处理方法的第四流程示意图;
图5示出了本发明实施例浏览模式切换前后的效果对比示意图;
图6示出了本发明实施例切换时执行CSS后的效果示意图;
图7示出了本发明实施例切换时执行JS后的效果示意图;
图8示出了本发明实施例的装置结构的第一示意图;
图9示出了本发明实施例的装置结构的第二示意图;
图10示出了本发明实施例的终端结构的示意图。
在所有附图中相同的标号指示相似或相应的特征或功能。
具体实施方式
下面描述本公开的各个方面。应该明白的是,本文的教导可以以多种多样形式具体体现,并且在本文中公开的任何具体结构、功能或两者仅仅是代表性的。基于本文的教导,本领域技术人员应该明白的是,本文所公开的一个方面可以独立于任何其它方面实现,并且这些方面中的 两个或多个方面可以按照各种方式组合。例如,可以使用本文所阐述的任何数目的方面,实现装置或实践方法。另外,可以使用其它结构、功能、或除了本文所阐述的一个或多个方面之外或不是本文所阐述的一个或多个方面的结构和功能,实现这种装置或实践这种方法。此外,本文所描述的任何方面可以包括权利要求的至少一个元素。
下面将参照附图描述本发明的各个实施例。
本发明提出了一种浏览模式切换处理方法,与现有方案相比通用性更强,无需占用渲染资源,且夜间模式显示效果较好。
图1示出了本发明实施例浏览模式切换处理方法的第一流程示意图,包括步骤:
101、接收浏览模式切换命令;
102、在获取的页面中注入用于设置样式的第一代码和用于调整样式的第二代码;
103、执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;
104、执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
图2示出了本发明实施例浏览模式切换处理方法的第二流程示意图,包括步骤:
201、接收浏览模式切换命令;
202、在获取的页面中注入CSS(Cascading Style Sheets,级联样式表)和JS,其中所述CSS设置页面的文字内容和背景变暗,所述JS设置文字内容变亮,背景变灰色;
203、执行所述CSS,将所述页面的文字内容和背景转换为所述CSS设置的值,得到页面的文字内容和背景变暗的第一显示结果;
204、执行所述JS(JavaScript),将显示所述第一显示结果的页面的文字内容调高亮度,将页面的背景调为灰色背景,得到页面的第二显示结果。
可以发现,利用图1或图2所示的方法,在接收浏览模式切换命令 后,在获取的页面中注入用于设置样式的第一代码(例如CSS)和用于调整样式的第二代码(例如JS),先执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;再执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。因为注入的第一代码和第二代码是任何浏览器都支持的代码,只需要通过这些代码修改页面的CSS+HTML(HyperText Markup Language,超文本标记语言),就能简单完成从日间模式到夜间模式的切换,因此无论是系统自带内核还是含第三方内核,无论是哪个平台系统,都可以使用,通用性更强,也不占用渲染资源,而且能对于网页中的各个元素的属性进行精确的改变,夜间模式的显示效果也更好。
图3示出了本发明实施例浏览模式切换处理方法的第三流程示意图。
本发明在浏览模式需要从日间模式切换到夜间模式时,在页面中注入CSS和JS;分别通过执行CSS和JS实现夜间模式的粗调和细调,首先通过执行CSS将整个页面转换成预设的夜间模式的初步样式,实现了粗调,再通过执行JS将页面的每个节点的字体提高亮度(即高亮化),将页面的背景调为灰色,从而实现细调,得到最终的夜间模式页面。
图3包括步骤:
301、接收到浏览器模式从日间模式(正常模式)切换到夜间模式的命令后,在获取的页面中注入CSS和JS;
CSS的作用一般是定义内容的样式(字体大小、颜色等),可以后台加载,不影响HTML的解析。本发明是要利用CSS将整个页面转换成预设的夜间模式的初步样式。
JS是一种在浏览器运行的脚本语言,功能很强大,可以动态改变网页内容,如插入HTML等。本发明是要利用JS对已转换为夜间模式初步样式的网页再进行细调。
因此,注入的CSS是设置页面的文字内容和背景变暗,注入的JS是设置文字内容变亮,背景变灰色。
其中,JS一般比CSS处理过程占用的时间长,因此本发明在下一步 处理过程中先执行CSS。
302、执行CSS,将整个页面转换成预设的夜间模式样式;
本发明可以针对页面节点属性的不同而制定不同的CSS样式来对应页面模式,在执行CSS时,将当前的页面节点转换成预设的夜间模式样式。即执行CSS,将页面的文字内容和背景转换为CSS设置的值,得到页面的文字内容和背景变暗的第一显示结果。由于加载CSS占用时间较短,处理范围大,注入CSS即可迅速展现初级的夜间模式效果。
例如,预设的夜间模式的样式可以是:
背景色:颜色值为RGB(31,73,125)#171717
透明度:设置为不透明,60%透明度的遮罩。
303、执行JS,将页面中的每个节点中的字体亮化,将页面背景转换成预设的灰色背景,得到最后的夜间模式。
该步骤中,执行所述JS,遍历每个节点,将页面的文字内容调高亮度(亮化),将页面的背景调为灰色背景,得到页面的第二显示结果(即最后的夜间模式结果)。
一般实现夜间模式的逻辑是把文字内容颜色“调暗”,即通过RGB(R(red)红、G(green)绿、B(blue)蓝)颜色算法将当前RGB值按照一定规则调整,同时考虑图片的“调暗”,通过调整图片的Alpha(用于设置透明度)值,也就是调整图片的透明度来达到“调暗”的效果。本发明方案采用了一种较为特别的方式,采取相反的思路,在执行CSS使整体亮度变低的情况下,再将全部文字都在其原来基础上调亮,这样的方式使得夜间模式效果更好。
对于将页面的背景调为灰色背景,此时可以有两种处理方式,一种是通过调整颜色值使得变成灰色背景,一种是直接增加遮罩使得变成灰色背景。
还需说明的是,将文字内容亮化后,可以插入一个属性用来记录文字原来的亮度,便于后面执行撤销夜间模式(即恢复之前模式)。
图4示出了本发明实施例浏览模式切换处理方法的第四流程示意图。
图4与图3流程的区别是,增加了是否含有图片情况下的不同处理 过程。具体是根据页面中是否含有图片进行不同处理,如果判断页面无图片,则直接将页面的背景调为灰色,如果有图片,则获取图片的长、宽以及该图片上的元素个数,根据图片的长宽比、该图片上的元素个数判断该图片的作用,如果该图片的作用是作为背景图片,将该图片调为灰色,当该图片不是背景图片时认为是需提供给用户观看的图片,则不处理。
图4包括步骤:
401、接收到浏览器模式从日间模式(正常模式)切换到夜间模式的命令时,在获取的页面中注入CSS和JS;
该步骤与步骤301相同。
402、执行CSS,将整个页面转换成预设的夜间模式样式;
该步骤与步骤302相同。
403、执行JS,将页面中的每个节点中的字体亮化。
该步骤将字体亮化的处理与步骤303中的处理相同。
404、判断页面中是否含有图片,当没有图片时,进入步骤405,当有图片时进入步骤406;
该步骤中,获得页面节点的属性(ComputedStyle)中的backgroundImage,根据含有backgroundImage属性判断出页面节点中含有图片。
405、没有图片时,将页面背景转换成预设的灰色背景,转入步骤410;
在页面没有图片时,该步骤直接将页面背景转换成灰色背景。
需说明的是,此时可以有两种处理方式,一种是通过调整颜色值使得变成灰色背景,一种是直接增加遮罩使得变成灰色背景。
此时,可以记录原来的页面背景颜色,并标记颜色已改变,以便执行撤销夜间模式的操作。或者,对用于覆盖的遮罩图打上标记,以便执行撤销夜间模式的操作。
406、获取图片的长、宽以及图片上的元素个数,进入步骤407;
从获取的页面中,根据页面代码可以获得图片的长、宽以及图片上的元素个数。图片上的元素包括如字符、图片上的小框等。
407、根据长宽比、图片中元素个数判断该图片是否为背景图片,当图片不是背景图片时,进入步骤408,当该图片为背景图片时,进入步骤409;
当图片的长宽比满足一定条件,例如大于或等于阈值(如1/0.8),且图片上的元素(如字符、图片上的小框)个数满足一定条件时,例如大于或等于阈值(如10),可以判断出该图片的作用是作为背景图片,否则不是背景图片,而是用户需要观看的图片。
408、不是背景图片时,不对该图片进行处理,转入步骤410;
409、将该图片设置成预设的灰色背景,转入步骤410;
因为该图片作为背景图片,也即作用是作为页面的背景,此时可以有两种处理方式,一种是通过调整颜色值使得变成灰色背景,一种是直接增加遮罩使得变成灰色背景。
此时,可以记录原来的页面背景颜色,并标记颜色已改变,以便执行撤销夜间模式的操作。或者,对用于覆盖的遮罩图打上标记,以便执行撤销夜间模式的操作。
410、显示最终的夜间模式页面。
经过上述的处理,该步骤得到最终的夜间模式效果并显示。
需说明的是,上述切换过程中,可以记录所述页面的文字内容和背景被调整前后的值,使得在接收到中断切换或返回原有模式的命令时,根据所记录的值进行恢复。也即,根据之前做的标记再还原回日间模式,使其能快速改变需要改变的节点的属性值。
若在夜间模式切换过程中,需要中途中断,可通过以下方式实现:在Java层设一个标记值m,每次日间模式和夜间模式切换都会增加该值。执行JS时传入当时的m值,收到中断命令时,回调Java来比较m值;如果发现m值已经改变,则把这次JS操作撤销掉。
本发明方案的效果示意图参见图5-7。其中,图5示出了本发明实施例浏览模式切换前后的效果对比示意图,左边是日间模式的效果图,右边是切换为夜间模式的效果图;图6示出了本发明实施例切换时执行CSS后的效果示意图,网页的文字内容和页面背景变暗;图7示出了本发明 实施例切换时执行JS后的效果示意图,网页的文字内容已经亮化。
综上所述,利用本发明方法,在接收浏览模式切换命令后,在获取的页面中注入用于设置样式的第一代码(例如CSS)和用于调整样式的第二代码(例如JS),先执行所述第一代码进行粗调,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;再执行所述第二代码进行细调,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。因为注入的第一代码和第二代码是任何浏览器都支持的代码,只需要通过这些代码修改页面的CSS+HTML,就能简单完成从日间模式到夜间模式的切换,因此无论是系统自带内核还是含第三方内核,无论是哪个平台系统,都可以使用,通用性更强,也不占用渲染资源,而且能对于网页中的各个元素的属性进行精确的改变,夜间模式的显示效果也更好。
上述详细介绍了本发明的方法,以下介绍本发明的装置。
图8示出了本发明实施例的装置结构的第一示意图;
如图8所示,一种浏览模式切换处理装置80,包括:接收单元801、注入单元802、第一执行单元803、第二执行单元804。
接收单元801,用于接收浏览模式切换命令;
注入单元802,用于在获取的页面中注入用于设置样式的第一代码和用于调整样式的第二代码;
第一执行单元803,用于执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;
第二执行单元804,执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
其中:
所述注入单元802具体用于在获取的页面中注入级联样式表CSS和JS,其中所述CSS设置页面的文字内容和背景变暗,所述JS设置文字内容变亮,背景变灰色;
第一执行单元803具体用于执行所述CSS,将所述页面的文字内容和背景转换为所述CSS设置的值,得到页面的文字内容和背景变暗的第 一显示结果
第二执行单元804具体用于执行所述JS,将显示所述第一显示结果的页面的文字内容调高亮度,将显示所述第一样式的页面的背景调为灰色背景,得到页面的第二显示结果。
图9示出了本发明实施例的装置结构的第二示意图。
如图9所示,一种浏览模式切换处理装置90,包括:接收单元801、注入单元802、第一执行单元803、第二执行单元804、判断单元905、记录单元906、恢复单元907。其中接收单元801、注入单元802、第一执行单元803、第二执行单元804与图8中的功能的描述相同。
判断单元905,用于在所述第二执行单元804将显示所述第一显示结果的页面的文字内容调高亮度后,判断页面中是否存在图片及判断所述图片是否作为页面的背景;
所述第二执行单元804在所述判断单元905判断出页面不存在图片时,将页面的背景调为灰色背景,在所述判断单元905判断出页面存在图片且所述图片作为页面的背景时,将所述图片调为灰色背景。
记录单元906,用于记录所述页面的文字内容和背景被调整前后的值;
恢复单元907,用于在接收到中断切换或返回原有模式的命令时,根据所述记录单元906记录的值,进行恢复。
图10示出了本发明实施例的终端结构的示意图。该终端设备100包括一种浏览模式切换处理装置200,该浏览模式切换处理装置200可以为图8中的装置80或图9中的装置90,其功能和结构参见图8或图9所示。
所述终端设备100可以是任何具有网页浏览能力的终端设备,包括台式计算机、笔记本电脑、智能移动终端、苹果公司或其它公司生产的IPad产品、个人数据助理等。
这里要说明的是,本发明所述的浏览模式切换处理装置,可以利用硬件实现,也可以利用软件实现,或者可以利用软件和硬件相结合实现。比如,浏览模式切换处理装置可以利用一个或多个处理器来实现。在这种情况下,存储单元还被配置为保存用于执行浏览模式切换处理装置的 功能的应用程序。一个或多个处理器被配置为在接收指令后,调用存储单元中保存的相应应用程序来执行功能。
此外,根据本发明的方法还可以被实现为由移动终端中的处理器(比如CPU)执行的计算机程序,并且存储在移动终端的存储器中。在该计算机程序被处理器执行时,执行本发明的方法中限定的上述功能。
此外,根据本发明的方法还可以实现为一种计算机程序产品,该计算机程序产品包括计算机可读介质,在该计算机可读介质上存储有用于执行本发明的方法中限定的上述功能的计算机程序。
此外,上述方法步骤以及系统单元也可以利用控制器以及用于存储使得控制器实现上述步骤或单元功能的计算机程序的计算机可读存储设备实现。
本领域技术人员还将明白的是,结合这里的公开所描述的各种示例性逻辑块、模块、电路和算法步骤可以被实现为电子硬件、计算机软件或两者的组合。为了清楚地说明硬件和软件的这种可互换性,已经就各种示意性组件、方块、模块、电路和步骤的功能对其进行了一般性的描述。这种功能是被实现为软件还是被实现为硬件取决于具体应用以及施加给整个系统的设计约束。本领域技术人员可以针对每种具体应用以各种方式来实现所述的功能,但是这种实现决定不应被解释为导致脱离本发明的范围。
尽管前面公开的内容示出了本发明的示例性实施例,但是应当注意,在不背离权利要求限定的本发明的范围的前提下,可以进行多种改变和修改。根据这里描述的发明实施例的方法权利要求的功能、步骤和/或动作不需以任何特定顺序执行。此外,尽管本发明的元素可以以个体形式描述或要求,但是也可以设想多个,除非明确限制为单数。
虽然如上参照图描述了根据本发明的各个实施例进行了描述,但是本领域技术人员应当理解,对上述本发明所提出的各个实施例,还可以在不脱离本发明内容的基础上做出各种改进。因此,本发明的保护范围应当由所附的权利要求书的内容确定。

Claims (19)

  1. 一种浏览模式切换处理方法,其特征在于,包括:
    接收浏览模式切换命令;
    在获取的页面中注入用于调整样式的第一代码和第二代码;
    执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;
    执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
  2. 根据权利要求1所述的浏览模式切换处理方法,其特征在于,所述执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果包括:
    执行级联样式表,将所述页面的文字内容和背景转换为所述级联样式表设置的值,得到页面的文字内容和背景变暗的第一显示结果。
  3. 根据权利要求2所述的浏览模式切换处理方法,其特征在于,所述执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果包括:
    执行JS,将显示所述第一显示结果的页面的文字内容调高亮度,将页面的背景调为灰色背景,得到页面的第二显示结果。
  4. 根据权利要求3所述的浏览模式切换处理方法,其特征在于,所述将页面的背景调为灰色背景,包括:
    判断页面中是否存在图片;
    若否,将页面的背景调为灰色背景;
    若是,进一步判断所述图片是否作为页面的背景,若是,将所述图片调为灰色背景。
  5. 根据权利要求4所述的浏览模式切换处理方法,其特征在于,所述判断页面中是否存在图片包括:
    判断页面的节点属性中是否含有背景图片属性,若是,则判断为存在图片。
  6. 据权利要求4或5所述的浏览模式切换处理方法,其特征在于,根据所述图片的长与宽的比值大于第一阈值且所述图片中含有的元素个数大于第二阈值,判断出所述图片作为页面的背景。
  7. 根据权利要求1至5任一项所述的浏览模式切换处理方法, 其特征在于,还包括:
    记录所述页面的文字内容和背景被调整前后的值;
    在接收到中断切换或返回原有模式的命令时,根据所记录的值进行恢复。
  8. 一种浏览模式切换处理装置,其特征在于,包括:
    接收单元,用于接收浏览模式切换命令;
    注入单元,用于在获取的页面中注入用于调整样式的第一代码和第二代码;
    第一执行单元,用于执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;
    第二执行单元,执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
  9. 根据权利要求8所述的浏览模式切换处理装置,其特征在于,所述第一执行单元,具体用于执行级联样式表,将所述页面的文字内容和背景转换为所述级联样式表设置的值,得到页面的文字内容和背景变暗的第一显示结果。
  10. 根据权利要求9所述的浏览模式切换处理装置,其特征在于,所述第二执行单元,具体用于执行JS,将显示所述第一显示结果的页面的文字内容调高亮度,将显示所述第一样式的页面的背景调为灰色背景,得到页面的第二显示结果。
  11. 根据权利要求10所述的浏览模式切换处理装置,其特征在于,还包括:
    判断单元,用于在所述第二执行单元将显示所述第一显示结果的页面的文字内容调高亮度后,判断页面中是否存在图片及判断所述图片是否作为页面的背景;
    所述第二执行单元在所述判断单元判断出页面不存在图片时,将页面的背景调为灰色背景,在所述判断单元判断出页面存在图片且所述图片作为页面的背景时,将所述图片调为灰色背景。
  12. 根据权利要求8至11任一项所述的浏览模式切换处理装置,其特征在于,还包括:
    记录单元,用于记录所述页面的文字内容和背景被调整前后的值;
    恢复单元,用于在接收到中断切换或返回原有模式的命令时,根据所述记录单元记录的值,进行恢复。
  13. 一种终端,其特征在于,包括:处理器;用于存储处理器可执行指令的存储器;其中,
    所述存储器,用于存储计算机执行指令;
    所述处理器,用于执行所述存储器存储的所述计算机执行指令,接收浏览模式切换命令;在获取的页面中注入用于调整样式的第一代码和第二代码;执行所述第一代码,将所述页面的文字内容和背景转换为所述第一代码设置的值,得到页面的第一显示结果;执行所述第二代码,将显示所述第一显示结果的页面的文字内容和背景进行调整,得到页面的第二显示结果。
  14. 根据权利要求13所述的终端,其特征在于,所述处理器,具体用于执行级联样式表,将所述页面的文字内容和背景转换为所述级联样式表设置的值,得到页面的文字内容和背景变暗的第一显示结果;执行JS,将显示所述第一显示结果的页面的文字内容调高亮度,将页面的背景调为灰色背景,得到页面的第二显示结果。
  15. 根据权利要求14所述的终端,其特征在于,所述处理器,具体用于判断页面中是否存在图片;若否,将页面的背景调为灰色背景;若是,进一步判断所述图片是否作为页面的背景,若是,将所述图片调为灰色背景。
  16. 根据权利要求15所述的终端,其特征在于,所述处理器,具体用于判断页面的节点属性中是否含有背景图片属性,若是,则判断为存在图片。
  17. 根据权利要求15或16所述的终端,其特征在于,所述处理器,具体用于根据所述图片的长与宽的比值大于第一阈值且所述图片中含有的元素个数大于第二阈值,判断出所述图片作为页面的背景。
  18. 根据权利要求13至16任一项所述的终端,其特征在于,所述处理器,还用于记录所述页面的文字内容和背景被调整前后的值;在接收到中断切换或返回原有模式的命令时,根据所记录的值进行恢复。
  19. 一种非临时性计算机可读存储介质,其特征在于,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述 计算机执行如权利要求1-7中任一项所述的浏览模式切换处理方法。
PCT/CN2014/088199 2014-04-29 2014-10-09 一种浏览模式切换处理方法及装置 WO2015165216A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410179042.6 2014-04-29
CN201410179042.6A CN105094759B (zh) 2014-04-29 2014-04-29 一种浏览模式切换处理方法及装置

Publications (1)

Publication Number Publication Date
WO2015165216A1 true WO2015165216A1 (zh) 2015-11-05

Family

ID=54358099

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/088199 WO2015165216A1 (zh) 2014-04-29 2014-10-09 一种浏览模式切换处理方法及装置

Country Status (2)

Country Link
CN (1) CN105094759B (zh)
WO (1) WO2015165216A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930462A (zh) * 2020-08-13 2020-11-13 中国工商银行股份有限公司 Pc端全量页面灰度化方法和装置
CN112559104A (zh) * 2020-12-22 2021-03-26 北京字节跳动网络技术有限公司 一种页面样式切换方法、装置、计算机设备及存储介质

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511717B (zh) * 2015-11-30 2019-07-02 北京京东尚科信息技术有限公司 页面显示方法和页面显示装置
CN105446786A (zh) * 2015-12-30 2016-03-30 广东欧珀移动通信有限公司 交互界面模式切换方法及装置
CN105701165B (zh) * 2015-12-30 2019-08-13 Oppo广东移动通信有限公司 浏览器模式切换方法及切换装置
CN111198731A (zh) * 2018-11-16 2020-05-26 北京奇虎科技有限公司 一种界面实现方法、装置、电子设备和存储介质
CN109614192A (zh) * 2018-12-07 2019-04-12 北京金山云网络技术有限公司 页面亮度显示方法及装置
CN110609722B (zh) 2019-08-09 2021-07-20 华为技术有限公司 一种暗模式显示界面处理方法、电子设备与存储介质
CN115484345A (zh) * 2021-05-31 2022-12-16 华为技术有限公司 显示模式切换方法、装置、电子设备和介质
CN113569169A (zh) * 2021-07-29 2021-10-29 北京奇艺世纪科技有限公司 一种页面显示方法和装置
CN114138394A (zh) * 2021-12-06 2022-03-04 北京得间科技有限公司 夜间显示模式的处理方法、电子设备及计算机存储介质

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103258038A (zh) * 2013-05-17 2013-08-21 广州市动景计算机科技有限公司 一种浏览器和网页之间的显示模式同步方法及其装置
CN103310763A (zh) * 2013-05-30 2013-09-18 北京小米科技有限责任公司 一种移动设备显示状态切换的方法、装置及一种设备

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5526652B2 (ja) * 2009-08-18 2014-06-18 ソニー株式会社 表示装置及び表示方法
CN103488646B (zh) * 2012-06-13 2017-11-14 腾讯科技(深圳)有限公司 一种移动终端浏览器弱光源下浏览网页的方法及装置

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103258038A (zh) * 2013-05-17 2013-08-21 广州市动景计算机科技有限公司 一种浏览器和网页之间的显示模式同步方法及其装置
CN103310763A (zh) * 2013-05-30 2013-09-18 北京小米科技有限责任公司 一种移动设备显示状态切换的方法、装置及一种设备

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930462A (zh) * 2020-08-13 2020-11-13 中国工商银行股份有限公司 Pc端全量页面灰度化方法和装置
CN112559104A (zh) * 2020-12-22 2021-03-26 北京字节跳动网络技术有限公司 一种页面样式切换方法、装置、计算机设备及存储介质

Also Published As

Publication number Publication date
CN105094759B (zh) 2019-01-22
CN105094759A (zh) 2015-11-25

Similar Documents

Publication Publication Date Title
WO2015165216A1 (zh) 一种浏览模式切换处理方法及装置
WO2021238469A1 (zh) 第三方应用程序的页面展示方法、装置、电子设备
US10409899B2 (en) Method, device and mobile terminal for processing webpage in night mode
US10068179B2 (en) Positioning text in digital designs based on an underlying image
US20170371844A1 (en) Method, device and terminal for implementing regional screen capture
CN107179889B (zh) 界面色彩调节方法、网页色彩调节方法及装置
WO2018072270A1 (zh) 一种图像显示增强方法及装置
US9984657B2 (en) Page display method and terminal
US8959432B2 (en) Utilizing document structure for animated pagination
WO2022001492A1 (zh) 界面处理方法、装置、电子设备和计算机可读存储介质
JP2011154689A (ja) 省電力とコンテキスト表示の表示情報変換システムおよびその装置
AU2013211505A1 (en) Immersive mode for a web browser
US20220254319A1 (en) Screen brightness adjustment method and mobile terminal
WO2016034031A1 (zh) 调整网页内容颜色的方法及装置
US20150370439A1 (en) Gpu-optimized scrolling systems and methods
US9939982B2 (en) Control of application based on user operation on information processing apparatus
CN107463307A (zh) 文档显示方法和装置
WO2019109889A1 (zh) 网页显示方法、浏览器、终端和计算机可读存储介质
CN113282212A (zh) 界面显示方法、界面显示装置和电子设备
US20160093079A1 (en) Enhanced document readability on devices
CN111897532A (zh) 页面元素监听方法、电子设备和介质
JP6199917B2 (ja) 携帯機器における可読性の改善
CN108021366B (zh) 界面动画实现方法、装置、电子设备、存储介质
CN103744942A (zh) 网页浏览方法及装置、网页浏览终端设备
WO2017215516A1 (zh) 确定解码任务的方法和装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14890495

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 16/03/17)

122 Ep: pct application non-entry in european phase

Ref document number: 14890495

Country of ref document: EP

Kind code of ref document: A1