[译]让我们自定义Google以显示以前的搜索
By robot-v1.0
本文链接 https://www.kyfws.com/applications/letscustomizegoogle-zh/
版权声明 本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
- 16 分钟阅读 - 7678 个词 阅读量 0[译]让我们自定义Google以显示以前的搜索
原文地址:https://www.codeproject.com/Articles/316073/LetscustomizeGoogle
原文作者:HiteshSharma
译文由本站 robot-v1.0 翻译
前言
The application adds a custom button and a few anchor elements on Google page which link to a previously searched text on google.
该应用程序在Google页面上添加了一个自定义按钮和一些锚元素,这些元素链接到先前在google上搜索的文本.
介绍(Introduction)
通常,当我使用Google进行搜索时,很有可能几天后我会再次使用Google搜索同一件事,以回忆起我上一次学到的东西.因此,如果我想使用与上次使用相同的关键字再次单击搜索按钮以获取所需的结果,请运行Internet Explorer并查看历史记录.效果很好,但是有一天我只是想知道,为什么Google不在其页面上显示最近搜索的文本,如果这样做的话,它将为Google员工提供很多便利.当然,由于我无法用这个想法来接近Google,所以我决定为我的机器自定义google,以便它可以向我展示我最近几次的搜索.(Usually when I Google something there are a good amount of chances that I’ll be googling the same thing again after a few days to recollect whatever I learned last time. So I run Internet Explorer and look into the history if I feel like hitting the search button again with the same keywords as I used last time to get the results I am looking for. This works great but one day I just wondered that why doesn’t google shows recently searched text on its page, if it does so it will provide Googlers much ease. Certainly since I can’t approach Google with the idea so I decided to customize google for my machine so that it may show me whatever I looked for last few times.)
怎么做(How is it done)
可以通过在每次将Google的HTML加载到任何浏览器窗口中时对其进行修改(通过向其中添加一些HTML元素)来对其进行修改.带有文字的按钮(This could be done by modifying the Google’s HTML each time its loaded in any browser window by adding a few HTML elements to it. A button with text) "I'm Feeling Really Good"
以及标准的Google页面按钮((along side standard Google page buttons () "Google Search"
和(and) "I'm Feeling Lucky"
)添加到Google页面的HTML中.按下此按钮后,过去搜索过的所有文本都将显示为HTML() is added to the Google page’s HTML. On hit of this button all the text which has been searched in the past is rendered as HTML in a) Span
Google页面的元素(上图中的红色文本).执行新搜索时,将从地址栏中的Google URL检索搜索查询,并将其存储为历史记录(IE历史记录跟踪在此没有作用).(Element of Google page (the red text in image above). When a new search is performed, the search query is retrieved from the Google URL which is their in the address bar and is stored as a history record ( IE history track has no role here).)
使用的组件(Components Used)
该应用程序使用以下组件:(This application uses the following components:)
- SHDocVw.dll(SHDocVw.dll)-该组件直接由Internet Explorer托管,并提供与导航,就地链接,收藏夹和历史记录管理相关的功能. SHDocVw还向其主机公开接口,从而使其可以作为ActiveX控件单独托管. SHDocVw.dll组件也称为WebBrowser控件.它还承载MSHTML.dll组件.(- This component is hosted directly by Internet Explorer and provides the functionality associated with navigation, in-place linking, favorites and history management. SHDocVw also exposes interfaces to its host which allows it to be hosted seperately as an ActiveX control. SHDocVw.dll component is also referred as WebBrowser Control. It also hosts the MSHTML.dll component.)
- MSHTML.dll(MSHTML.dll)-的(- The)**MSHTML.dll(MSHTML.dll)**组件负责在浏览器(Internet Explorer 4.0或更高版本)中进行HTML解析和呈现,并通过DOM提供对加载的HTML文档的访问.它还托管脚本引擎,ActiveX控件,插件和HTML文档可能引用的所有其他对象.(component is responsible for HTML parsing and rendering in browser (Internet Explorer 4.0 or later) and provides access to the loaded HTML document through DOM. It also hosts Scripting Engines, ActiveX controls, plug-ins and all other objects which could be referenced by the HTML document.) 有关这些组件以及如何选择其中一个组件的详细阅读(For detailed reading on these components and on how to choose one of the components) 读这个(read this) .(.)
了解Google HTML结构(Understanding the Google HTML Structure)
首先应理解要编辑和更改网站的HTML.了解包括了解要在其中添加自定义元素的页面上的HTML元素.(To edit and make changes to a Website’s HTML first it should be undertood. Understanding involves knowing the HTML Elements on the page where the custom elements will be added.)
任何页面的源代码都可以在网络浏览器中看到.许多浏览器(例如Internet Explorer 9.0)提供了更好的导航到网页上可见元素的HTML的方法.在这里,我将解释使用Internet Explorer 9.0开发人员工具的Google HTML结构.(Source code of any page could be seen in the web browser. Many browsers (like Internet Explorer 9.0 ) offer better ways to navigate to HTML of visible elements on web page. Here I’ll explain the Google HTML structure using Internet Explorer 9.0 Developer Tools.)
首先让我们看一下按钮的父元素(First lets look at the parent Element of buttons) "Google Search"
和(and) "I'm Feeling Lucky"
.这些按钮分别具有名称" btnK"和" btnI".自定义按钮将作为``最后一个孩子'‘添加到这些按钮元素的父元素中.为了使自定义按钮看起来像Google的按钮,只需要确保按钮的type属性被提交即可,因为Google的CSS适用于所有type属性为(. The buttons have names “btnK” and “btnI” respectively. The custom button will be added as the Last Child to the parent of these button elements. To make the custom button look like Google’s buttons only this needs to be ensured that the type property of the button is submit as the Google’s CSS applies to all input elements which have their type property as) "submit"
.(.)
先前的搜索文本将显示为锚元素,该锚元素以与上次相同的查询链接到google.这些锚点元素需要显示在Google页面的某些元素中.为了显示锚点元素,将使用google页面底部,实际上是一个白色的大空白空间.(The previous search texts will be shown as anchor element being linked to google with the same query as was the last time. These anchor elements need to displayed in some element in Google page. To display the anchor elements bottom part of the google page, which is actually a big empty space with white color, will be used.)
的(The) Div
元素有(element has) "footer"
作为其ID属性.在页面内显示锚元素(as its ID property. To display anchor elements inside this page a) span
元素将作为子元素添加到此元素,然后将锚元素添加到此元素(element will be added as a child to this element and then the anchor elements will be added to this) span
元件.无需添加任何样式(element. No styles need to be added to) anchor
元素全部由Google的CSS处理,该CSS将样式应用于所有(elements as its all handled by Google’s CSS which applies styles to all) anchor
属于的元素(elements which are child of) footer div
.(.)
一切如何运作(How it all works)
要开始理解代码并首先了解所有代码的工作原理,那么值得一看下面显示的应用程序流程.请特别关注Window的DocumentComplete事件和自定义按钮的OnClick事件.(To start understanding the code and to have a vision of how it all works first it will be worth to have a look at the application flow which is shown below. Have a special look at DocumentComplete event of Window and OnClick event of custom button.)
注册所有窗口(Register all windows)
当应用程序在Main方法中启动时,将创建SHDocVw.ShellWindows类的新实例. ShellWindows是属于外壳程序的所有打开的窗口的集合.它还包括Internet Explorer和Windows Explorer窗口. ShellWindows类公开了两个事件:WindowRegistered事件(每当创建一个窗口的新实例时将触发该事件)和WindowRevoked事件(每当一个窗口实例被终止时将触发该事件).为此,我们需要为WindowRegistered事件添加EventHandler,以便可以捕获Internet Explorer的所有新实例.(When the application starts in the Main method a new instance of SHDocVw.ShellWindows class is created. ShellWindows is a collection of all open windows which belong to the shell. It includes Internet Explorer and Windows Explorer windows as well. ShellWindows class exposes two events, WindowRegistered Event which is fired whenever a new instance of a window is created and WindowRevoked Event which is fired whenever instance of a window is killed. For our purpose we need to add EventHandler for WindowRegistered Event so that all new instances of Internet Explorer could be captured.)
//This will be used to detect a new window.
ExplorerWindow = new SHDocVw.ShellWindows();
ExplorerWindow.WindowRegistered +=
new DShellWindowsEvents_WindowRegisteredEventHandler(ExplorerWindow_WindowRegistered);
如果创建了Internet Explorer的新实例,则将触发WindowsRegistered事件.在此事件的EventHandler中,枚举ShellWindows集合中的所有窗口.集合的所有窗口都类型转换为SHDocVw.dll的InternetExplorer类.自定义属性(If a new instance of Internet Explorer is created the WindowsRegistered Event is fired. In the EventHandler for this event all the windows in the ShellWindows collection are enumerated. All windows of the collection are type cast to InternetExplorer Class of SHDocVw.dll. A custom property) "IsRegistered"
为尚未设置属性的窗口设置,并为该窗口的DocumentComplete事件添加一个新的EventHandler.使用财产(is set for the window for which the property isn’t set already and a new EventHandler will be added for the DocumentComplete event of the window. The use of property) "IsRegistered"
是为了确保仅将EventHandler添加到窗口的DocumentComplete事件中.(is to ensure that only once the EventHandler is added to the DocumentComplete event of the window.)
SHDocVw.ShellWindows AllWindows = new ShellWindows();
//Check if a window is already registered if not then register it
//and wait for the document complete event to get fired
foreach (object Window in AllWindows)
{
SHDocVw.InternetExplorer IE = (InternetExplorer)Window;
if (IE.GetProperty("IsRegistered") == null)
{
IE.PutProperty("IsRegistered", true);
IE.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(IE_DocumentComplete);
}
}
当窗口的readystate属性更改为时,将触发DocumentComplete事件(The DocumentComplete Event is fired when the readystate property of the window is changed to) READYSTATE_COMPLETE
.当浏览器完成网页下载后,就会发生这种情况.加载网页后,下一步就是确保打开的页面仅是Google.最好的方法是查看(. This happens when the browser is done with downloading the web page. Once the Web page is loaded the next step is to ensure that the opened page is Google only. The best way to accomplish this is by looking at the) LocationURL
InternetExplorer类的属性.(property of the InternetExplorer Class.) LocationURL
属性保存当前显示页面的位置.没有什么比正则表达式更好的搜索字符串了.(property holds the location of the page that is currently displayed. There isn’t anything better than Regular Expressions to search the strings.)
知道加载的页面是Google后,接下来是"创建元素"并将其添加到页面中.该页面也可以是google的搜索页面,而不是主页.如果是这样,则搜索查询应保存在XML中.下面是DocumentComplete EventHandler的代码片段.(Once it is known that the loaded page is Google, next is to Create Elements and adding them to the page. Also the page could be the search page of google and not the home page. If this is so then the search query should be saved in the XML. Below is the code snippet from the DocumentComplete EventHandler.)
//if the loaded document is Google then create required HTML Elements
//on page, save queries in XML and load results from XML to Google page
if (Doc != null && System.Text.RegularExpressions.Regex.Match(
IE.LocationURL, @"www\.google\..*").Success)
{
CreateElements(Doc);
SaveResults(URL.ToString());
}
创建元素(Create Elements)
使用MSHTML.HTMLDocument类的实例访问网页中加载的Document.在里面(The Document loaded in the web page is accessed using an instance of MSHTML.HTMLDocument class. In the) MSHTML.HTMLDocument
class会存储对"浏览器"窗口中加载的文档的引用.网页脚本可用的所有JavaScript方法也可以通过MSHTML获得. MSHTML还提供对网页DOM的访问.(class a reference to the document loaded in the Browser window is stored. All JavaScript methods which are available to the web page scripts are also available through MSHTML. MSHTML provides access to web page DOM as well.)
要创建一个新的输入元素,(To create a new input Element, the) createElement
的方法(method of the) MSHTML.HTMLDocument
使用类.对该新输入元素的引用保存在(class is used. The reference to this new input element is held in) MSHTML.HTMLInputElement
类.新按钮的type属性设置为(class. The type property of new button is set to) "Submit"
这样它就可以通过Google CSS进行转换,该CSS在所有类型属性为(so that it is transformed by Google CSS which works on all elements which have their type property as) "Submit"
.子跨度元素也添加到了我们的自定义按钮中(. A child span element is also added to our custom button whose) innerText
属性设置为(property is set to) "I'm Feeling Really Good"
(要在按钮上显示的文字).(( the text to be displayed on our button).)
添加自定义按钮((To add Custom Button () "I'm Feeling Really Good"
)到页面上,首先需要找到对现有Google按钮的引用(() to the page it is first required to find a reference to an existing Google button () "I'm Feeling Lucky"
),然后将按钮添加到其父项.从上方(在了解Google HTML结构部分中)可以看出,() and then to add our button to its parent. Its seen above (In Understanding the Google HTML Structure section) that the HTML Name property of) input
对应于的元素(Element corresponding to) "I'm Feeling Lucky"
按钮是(button is) "btnI"
.获取所有带有名称的HTML元素(. To get all the HTML elements with name) "btnI"
,使用MSHTML.HTMLDocument类的getElementsByName方法.此方法返回一个对象(, getElementsByName method of MSHTML.HTMLDocument class is used. This method returns an object of) MSHTML.IHTMLElementCollection
接口.从这个集合到按钮的引用(interface. From this collection a refenrence to button) "I'm Feeling Lucky"
可以提取到(could be extracted in) MSHTML.HTMLInputElement
类.(class.)
将按钮添加到页面后(After adding the button to the page a) Span
需要将元素添加到页面的HTML中,以HTML的形式显示以前的搜索查询(Element needs to be added to the page’s HTML which will display previous search queries in the form of) anchor
元素.(elements.) Span
元素需要添加到(element needs to be added to) Div
具有其ID的元素(element which has its ID) "footer"
.的(. The) MSHTML.HTMLDivElement
和(and) MSHTML.HTMLSpanElement
类用于保存对HTML的引用(classes are used to hold reference to HTML) Div
和(and) Span
元素.显示属性(Elements. The display property of) Span
元素设置为(element is set as) none
及其ID属性为(and its ID property as) SpanSearchResults
.单击自定义按钮时,将显示跨度.(. The span will be displayed when the custom button will be clicked.)
//if a button doesn't exists already then create one and add
//an event handler to its onclick event
if (Doc.getElementById(ButtonId) == null)
{
mshtml.IHTMLElementCollection LuckyButtonCollection =
(mshtml.IHTMLElementCollection)Doc.getElementsByName("btnI");
if (LuckyButtonCollection.length <= 0) return;
mshtml.HTMLButtonElement LuckyButton =
(mshtml.HTMLButtonElement)LuckyButtonCollection.item(name: Type.Missing, index: 0);
mshtml.HTMLButtonElement CustomButton =
(mshtml.HTMLButtonElement)Doc.createElement("button");
CustomButton.id = ButtonId;
CustomButton.className = "gbqfba";
//build a span element which will hold the button name
mshtml.HTMLSpanElement CustomButtonText = (mshtml.HTMLSpanElement)Doc.createElement("span");
CustomButtonText.className = "gbqfsb";
CustomButtonText.innerText = "I'm Feeling Really Good";
CustomButton.appendChild((mshtml.IHTMLDOMNode)CustomButtonText);
LuckyButton.parentNode.appendChild((mshtml.IHTMLDOMNode)CustomButton);
mshtml.HTMLButtonElementClass CustomButtonClass = (mshtml.HTMLButtonElementClass)CustomButton;
CustomButtonClass.HTMLButtonElementEvents2_Event_onclick +=
new HTMLButtonElementEvents2_onclickEventHandler(
CustomButtonClass_HTMLInputTextElementEvents2_Event_onclick);
}
//create the Span element if one doesn't exists
mshtml.HTMLSpanElement Ele = (mshtml.HTMLSpanElement)Doc.getElementById(SpanSearchResults);
if (Ele == null)
{
mshtml.HTMLDivElement ParentDiv = (mshtml.HTMLDivElement)Doc.getElementById("footer");
mshtml.HTMLSpanElement TargetSpan = (mshtml.HTMLSpanElement)Doc.createElement("span");
TargetSpan.id = SpanSearchResults;
if (ParentDiv == null) return;
ParentDiv.insertBefore((mshtml.IHTMLDOMNode)TargetSpan, ParentDiv.firstChild);
TargetSpan.style.display = "none";
}
mshtml.HTMLDivElement LogoDiv = (mshtml.HTMLDivElement)Doc.getElementById("hplogo");
mshtml.HTMLDivElement LogoChildDiv = (mshtml.HTMLDivElement)LogoDiv.firstChild;
LogoChildDiv.innerText = LogoChildDiv.innerText + ". Customized By Hitesh";
单击按钮事件处理程序(Button click Event Handler)
现在,由于元素已添加到Google网页,下一步是向按钮单击添加一些操作.什么时候(Now since the elements have been added to the Google web page, the next is to add some action to the button click. When) "I'm Feeling Really Good"
单击按钮将使(button is clicked it will make the) Span
元素('(element (') SpanSearchResults
‘)可见并将添加(') visible and will add) anchor
元素以向其中显示以前的搜索查询.(elements to display previous search queries into it.)
//onclick of our custom button clear the span which holds any previous searchs and
//reload the searchs in Google page from the saved XML.
static bool CustomButtonClass_HTMLInputTextElementEvents2_Event_onclick(IHTMLEventObj pEvtObj)
{
MSHTML.HTMLDocument doc = (MSHTML.HTMLDocument)pEvtObj.srcElement.document;
MSHTML.HTMLSpanElement SearchResults = (MSHTML.HTMLSpanElement)doc.getElementById("SpanSearchResults");
SearchResults.style.display = "";
if (!LoadResultsInGoogle(doc))
NoResultsMessage(doc);
return true;
}
加上(To add) anchor
首先从XML文件中读取查询的页面元素,然后(elements to the page the queries are first read from the XML file and then an) anchor
为每个搜索查询创建一个元素.每个锚元素将显示搜索查询,并且在单击时将打开一个新窗口,其中包含来自Google的相同查询的搜索结果.锚元素的工具提示将设置为搜索查询并将其保存在应用程序XML中的日期和时间.(element is created for each search query. Each anchor element will display the search query and on click will open a new window with search results for same query from google. The tooltip of anchor element will be set to the date and time of when the query was searched and was saved in the application XML.)
将存储搜索查询的XML的结构如下.(The structure of the XML which will store search queries is as below.)
<searches>
<search text="" URL="" datetime=""/>
<searches>
每个搜索元素对应一个搜索查询,其text属性保存搜索到的文本,URL属性保存将再次向Google发送相同查询的URL,通常类似于"(Each search element corresponds to one search query and its text property holds the searched text, URL property holds the URL which will send the same query to google again, usually like “) http://www.google.com/search?q=query(http://www.google.com/search?q=query) “和datetime属性将存储搜索查询的日期和时间戳.(” and the datetime attribute will store date and time stamp of when the query was searched.)
在Google中加载以前的搜索查询(Load Previous Search Queries in Google)
要在网页中显示以前的搜索查询,首先需要阅读所有”(To show the previous search queries in web page, first it is required to read all the “) search
XML节点.使用XPath查询可以从XML文件读取所有搜索节点.(” nodes from XML file. Using an XPath query all the “search nodes could be read from the XML file.)
XmlNodeList Nodes = XMLDoc.SelectNodes("//search");
对于找到的每个节点,将创建一个锚元素并将其添加到我们的"自定义跨度"元素中.锚元素的href属性将是XML”(For each node found, an anchor element will be created and will be added to our Custom Span Element. The href attribute of anchor element will be the URL attribute of XML “) search
“节点,锚元素的innerText将设置为node的text属性,title属性将设置为string”(” node, the innerText of anchor element will be set to text property of node and title property will be set to string “) Searched On
" +节点的datetime属性.target属性将设置为(” + datetime attribute of node. The target property will be set to) _blank
以确保所有查询都在新窗口中打开.然后,将这些锚元素中的每一个添加到我们的自定义范围中,该自定义范围的ID属性设置为"(to ensure that all queries open in a new window. Each of these anchor elements will then be added to our custom span which has its ID property set as ‘) SpanSearchResults
‘.(’.)
for (int i = 0; i < Nodes.Count; i++)
{
XmlNode CurrNode = Nodes[i];
if (CurrNode.Attributes["text"].Value == "")
continue;
string URL = CurrNode.Attributes["URL"].Value;
MSHTML.HTMLAnchorElement anch = (MSHTML.HTMLAnchorElement)Doc.createElement("a");
if (TargetSpan.firstChild != null)
TargetSpan.insertBefore((MSHTML.IHTMLDOMNode)anch, TargetSpan.firstChild);
else
TargetSpan.appendChild((MSHTML.IHTMLDOMNode)anch);
anch.setAttribute("href", URL);
anch.setAttribute("name", "searchanchors");
anch.target = "_blank";
anch.innerText = CurrNode.Attributes["text"].Value;
anch.style.color = "#aa0000";
anch.title = "Searched On " + CurrNode.Attributes["datetime"].Value;
}
以XML保存新查询(Saving New Queries in XML)
现在,由于您已经打开Google并进行了搜索,因此您的搜索查询应作为历史记录保存在XML文件中,以便下次打开Google时可以显示该查询.在Google的URL中,搜索查询出现在参数"(Now since you have opened Google and searched something, hence your search query should be saved in XML file as a history record so that it could be displayed next time when Google is opened again. In Google’s URL the search query is present in parameter “) q
“,其格式为&q(” which has a format as &q) uot;q=queried+text
“.因此,仅需要从URL中分离该部分,该部分位于(”. So from the URL only that part is required to be seperated which is after the) =
在”(sign which comes after “) q
“之前(” and before an) &
(表示新参数的开始).可以使用正则表达式来实现,如下面的代码所示.(( which signifies the start of a new parameter). This could be accomplished using Regular Expressions as shown in code below.)
System.Text.RegularExpressions.Regex reg =
new System.Text.RegularExpressions.Regex(@"q=(?<query>[^&]+)");
System.Text.RegularExpressions.Match mt = reg.Match(URL);
string query = "";
string text = "";
if (mt.Success)
{
query = mt.Result("${query}");
}
通常,每当在google中搜索某些文本时,所有空格都被替换为”(Usually Whenever some text is searched in google then all the spaces are replaced by a ‘) +
当查询出现在URL中时,请使用’符号.所以所有的(’ sign when the query is present in URL. So all the ‘) +
‘应替换为(’ should be replaced by a) <space>
字符和所有经过URL编码的字符应替换为其ASCII表示形式.(character and all the URL encoded characters should be replaced by their ASCII representation.)
text = query.Replace("+", " ");
//find the HTML Encoded characters in Query text and replace them with their
//Character
System.Text.RegularExpressions.Regex HexReg =
new System.Text.RegularExpressions.Regex(@"(?<val>%(?<hex>[A-Z0-9]{2}))");
System.Text.RegularExpressions.Match HexMatch = HexReg.Match(text);
while (HexMatch.Success)
{
text = text.Replace(HexMatch.Result("${val}"),
char.ConvertFromUtf32(int.Parse(HexMatch.Result("${hex}"),
System.Globalization.NumberStyles.HexNumber)));
HexMatch = HexMatch.NextMatch();
}
现在,已从URL中检索出搜索到的文本,因此应检查该文本是否尚未保存在XML文件中,如果没有,则使用新的"(Now the searched text has been retrieved from the URL and hence it should be checked that this text is already not saved in the XML file and if not then a new “) Search
“节点应创建并保存在XML的根节点下.(” node should be created and saved under root node of the XML.)
XmlDocument xmlDoc = LoadXML();
XmlNodeList ExistingNodes =
xmlDoc.SelectNodes("//search[@text='" + text + "']");
//prepare the query and save it in XML
if (ExistingNodes.Count > 0) return false;
XmlElement searchEle = xmlDoc.CreateElement("search");
searchEle.SetAttribute("text", text);
searchEle.SetAttribute("URL", "http://www.google.com/search?q=" + query);
searchEle.SetAttribute("datetime", DateTime.Now.ToString());
XmlNode root = xmlDoc.DocumentElement;
if (root != null)
root.AppendChild(searchEle);
else
xmlDoc.AppendChild(searchEle);
SaveXML(xmlDoc);
每当现在下一次打开Google时,此新保存的查询将显示在Google页面上,并可通过单击代表它的锚点元素再次导航到该查询.(whenever now Google will be opened next time this new saved query will be displayed on the Google page and could be navigated to again by clicking on the anchor element representing it.)
如何使用(How to Use)
要使用该应用程序,请在Windows启动文件夹中放置一个指向可执行文件的快捷方式.每次Windows启动时,可执行文件都将在没有UI的情况下运行,并且将更改每个Google实例.(To use the application, put a shortcut to executable in windows startup folder. Each time windows will start the executable will run without UI and will change each and every Google instance.)
在运行Build(如果运行应用程序)期间,可以通过打开新的IE窗口,然后在其中打开Google进行测试.(During Build if application is run then it could be tested by opening a new IE window and then opening Google in it.)
兴趣点(Points of Interest)
可以使用相同的方法来定制运行中的许多其他网站.只需对目标网站的HTML有一点了解,并知道如何使用SHDocVw.dll和MSHTML.dll.(The same methodology could be applied to customize many other websites on the run. Only requirement being a little understanding of target website’s HTML and knowing how to use SHDocVw.dll and MSHTML.dll.)
历史(History)
- 16-02-2012-更新的附加代码已根据更改的Google标记进行了修改.(16-02-2012 - Updated attached code which was modified as per changed Google markup.)
- 2012年6月5日-根据更新的Google标记,更新了代码和图片.(06-05-2012 - Updated code and images as per the updated Google’s markup.)
- 2012年8月5日-图片未在新版本中显示.问题解决了(08-05-2012 - Images were not getting displayed in new version. Issue resolved)
许可
本文以及所有相关的源代码和文件均已获得The Code Project Open License (CPOL)的许可。
Javascript XML C# Windows .NET .NET3.5 COM Visual-Studio automation web 新闻 翻译