From: <dos...@us...> - 2012-04-17 21:09:34
|
Revision: 4482 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4482&view=rev Author: doskabouter Date: 2012-04-17 21:09:28 +0000 (Tue, 17 Apr 2012) Log Message: ----------- placed link-ids on the left of the url, to improve readability Modified Paths: -------------- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs Modified: trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs =================================================================== --- trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-04-15 14:13:24 UTC (rev 4481) +++ trunk/plugins/BrowseTheWeb/Source/BrowseTheWeb/GUIPlugin.cs 2012-04-17 21:09:28 UTC (rev 4482) @@ -55,7 +55,7 @@ #endregion #region Constants - private const string _spanstyle = "font-family: arial,sans-serif; font-size: 12px ! important; line-height: 130% ! important; border-width: 1px ! important; border-style: solid ! important; -moz-border-radius: 2px 2px 2px 2px ! important; padding: 0px 2px ! important; margin-left: 2px; max-width: 20px; max-height: 10px ! important; overflow: visible ! important; float: none ! important; display: inline;"; + private const string _spanstyle = "font-family: arial,sans-serif; font-size: 12px ! important; line-height: 130% ! important; border-width: 1px ! important; border-style: solid ! important; -moz-border-radius: 2px 2px 2px 2px ! important; padding: 0px 2px ! important; margin-right: 2px; max-width: 20px; max-height: 10px ! important; overflow: visible ! important; float: none ! important; display: inline;"; #endregion #region declare vars @@ -417,7 +417,7 @@ else GUIPropertyManager.SetProperty("#btWeb.status", DateTime.Now.ToLongTimeString() + " : " + action.wID.ToString() + " / " + action.m_key.KeyChar.ToString()); - } + } #endregion #region selectable buttons @@ -508,7 +508,6 @@ if (mouse.Visible) { mouse.Visible = false; - } else { @@ -888,13 +887,29 @@ newChild.InnerHtml = geckoId.ToString(); if (!String.IsNullOrEmpty(className)) newChild.SetAttribute("class", className); - if (after.NextSibling != null) - after.ParentNode.InsertBefore(newChild, after.NextSibling); + if (after.FirstChild == null) + after.AppendChild(newChild); else - after.ParentNode.AppendChild(newChild); + after.InsertBefore(newChild, after.FirstChild); return newChild; } + private void SetLinkAttributes(GeckoElement link, int linkNumber, out string id, out string name) + { + string gb = link.GetAttribute("gb"); + id = link.GetAttribute("id"); + name = link.GetAttribute("name"); + if (string.IsNullOrEmpty(gb)) + { + link.SetAttribute("gb", "gecko_link" + linkNumber); + } + if (string.IsNullOrEmpty(id)) + { + link.SetAttribute("id", "gb" + linkNumber); + id = "gb" + linkNumber; + } + } + private void webBrowser_DocumentCompleted(object sender, EventArgs e) { MyLog.debug("page completed : " + webBrowser.Url.ToString()); @@ -936,22 +951,15 @@ }; if (!element.InnerHtml.Contains("gecko_id")) { + GeckoElement ls = element; + while (ls.LastChild != null && ls.LastChild is GeckoElement && !String.IsNullOrEmpty(ls.LastChild.TextContent)) + ls = (GeckoElement)ls.LastChild; insertSpan(i, String.Empty, "LINK", lastSpan.ClassName, - element.LastChild == null ? element : element.LastChild); + ls); } - string gb = element.GetAttribute("gb"); - string id = element.GetAttribute("id"); - string name = element.GetAttribute("name"); - if (string.IsNullOrEmpty(gb)) - { - element.SetAttribute("gb", "gecko_link" + i); - } - if (string.IsNullOrEmpty(id)) - { - element.SetAttribute("id", "gb" + i); - id = "gb" + i; - } + string id, name; + SetLinkAttributes(element, i, out id, out name); _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, link, HtmlInputType.Link)); i++; } @@ -972,23 +980,12 @@ { if (linkType != "hidden") { + string id, name; + SetLinkAttributes(link, i, out id, out name); - string gb = link.GetAttribute("gb"); - string id = link.GetAttribute("id"); - string name = link.GetAttribute("name"); - if (string.IsNullOrEmpty(gb)) - { - link.SetAttribute("gb", "gecko_link" + i); - } - if (string.IsNullOrEmpty(id)) - { - link.SetAttribute("id", "gb" + i); - id = "gb" + i; - } - if (!element.InnerHtml.Contains("gecko_id=\"" + i + "\"")) { - insertSpan(i, action, "INPUT", null, link); + insertSpan(i, action, "INPUT", null, link.Parent); } if (linkType == "submit" || linkType == "reset" || @@ -1010,22 +1007,12 @@ } else { - string gb = link.GetAttribute("gb"); - string id = link.GetAttribute("id"); - string name = link.GetAttribute("name"); - if (string.IsNullOrEmpty(gb)) - { - link.SetAttribute("gb", "gecko_link" + i); - } - if (string.IsNullOrEmpty(id)) - { - link.SetAttribute("id", "gb" + i); - id = "gb" + i; - } + string id, name; + SetLinkAttributes(link, i, out id, out name); if (!element.InnerHtml.Contains("gecko_id=\"" + i + "\"")) { - insertSpan(i, action, "INPUT", null, link); + insertSpan(i, action, "INPUT", null, link.Parent); } _htmlLinkNumbers.Add(i, new HtmlLinkNumber(i, id, name, action, HtmlInputType.Input)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |