diff --git a/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs b/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs
index 1e67174..bed5470 100644
--- a/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs
+++ b/客户端/齐越慧眼/齐越慧眼/UserControls/BrowerControl.xaml.cs
@@ -26,6 +26,11 @@ namespace 齐越慧眼.UserControls
///
public bool IsJustLoginJd { get; set; }
+ ///
+ /// 处理拼多多
+ ///
+ public bool IsPddPage { get; set; }
+
public BrowerControl(string url, HandyControl.Controls.TabItem tabItem)
{
InitializeComponent();
@@ -36,6 +41,11 @@ namespace 齐越慧眼.UserControls
IsJustLoginJd = true;
}
+ if (url.Contains("yangkeduo.com"))
+ {
+ IsPddPage = true;
+ }
+
Tab = tabItem;
web = new ExtChromiumBrowser(url)
{
@@ -76,6 +86,7 @@ namespace 齐越慧眼.UserControls
web.AddressChanged += Web_AddressChanged;
+
this.KeyUp += BrowerControl_KeyUp;
}
@@ -225,7 +236,7 @@ namespace 齐越慧眼.UserControls
{
lastUrl = e.Browser.MainFrame.Url;
//开始单页查询
- if (lastUrl.StartsWith("https://s.taobao.com/search")|| lastUrl.StartsWith("https://search.jd.com/")||lastUrl.StartsWith("https://s.1688.com/selloffer/offer_search.htm"))
+ if (lastUrl.StartsWith("https://s.taobao.com/search")|| lastUrl.StartsWith("https://search.jd.com/")||lastUrl.StartsWith("https://s.1688.com/selloffer/offer_search.htm")|| lastUrl.StartsWith("https://mobile.yangkeduo.com/search_result.html?search_key"))
{
if (lastUrl.StartsWith("https://s.taobao.com/search")) {
@@ -241,9 +252,8 @@ namespace 齐越慧眼.UserControls
nowPatlom = 2;
}
- if (lastUrl.StartsWith("https://mobile.yangkeduo.com/"))
+ if (lastUrl.StartsWith("https://mobile.yangkeduo.com/search_result.html?search_key"))
{
-
nowPatlom = 3;
}
StartPage();
@@ -320,6 +330,11 @@ namespace 齐越慧眼.UserControls
// web.ShowDevTools();
}
+ if (nowPatlom == 3)
+ {
+ var isok= ChangePddStyle();
+ }
+
//lastUrl = string.Empty;
break;
}
@@ -704,6 +719,182 @@ namespace 齐越慧眼.UserControls
#endregion
+ private bool ChangePddStyle()
+ {
+ return DoJavaScript(@"//整体
+document.getElementById(""main"").children[0].children[1].style.width=""1380px""
+
+//浮动筛选框
+document.querySelector(""#main > div > div:nth-child(2) > div > div > div:nth-child(1) > div > div:nth-child(2)"").style.top=""55px""
+
+
+//在app打开
+if(document.getElementsByClassName(""pdd-go-to-app"")[0])
+document.getElementsByClassName(""pdd-go-to-app"")[0].outerHTML=''
+if(document.getElementsByClassName(""PTWSQMBM _1vDZKiQt"")[0])
+//回顶部
+document.getElementsByClassName(""PTWSQMBM _1vDZKiQt"")[0].outerHTML=''
+
+//列表
+for (var i = 0; i < document.getElementsByClassName(""_3glhOBhU"").length; i++) {
+ if (document.getElementsByClassName(""_3glhOBhU"")[i] != undefined) {
+ document.getElementsByClassName(""_3glhOBhU"")[i].style = ""width: 200px; margin-right: 0.03rem; margin-bottom: 0.03rem;float:left;"";
+
+ if (document.getElementsByClassName(""_3glhOBhU"")[i].children[0].children[0] != undefined) {
+
+ var maindiv = document.getElementsByClassName(""_3glhOBhU"")[i].children[0].children[0];
+
+ if(maindiv.outerHTML.indexOf(""试试搜这些"")>=0)
+ {
+ document.getElementsByClassName(""_3glhOBhU"")[i].style = ""display:none"";
+ continue;
+ }
+
+ maindiv.style = ""width:200px;height:300px"";
+
+ if (maindiv.children[0].children[0] != undefined) {
+ maindiv.children[0].children[0].style = ""width:200px;height:200px"";
+
+ maindiv.children[0].children[0].children[0].style = ""width:200px;height:200px"";
+ }
+
+
+
+ var itemInfoDiv = maindiv.children[1]
+ if (itemInfoDiv != undefined) {
+ itemInfoDiv.style = ""padding: 0px;""
+
+ //标题
+ if (itemInfoDiv.children[0] != undefined) {
+ itemInfoDiv.children[0].style = ""font-size: 10px; line-height: 15px;"";
+
+ var imgs = itemInfoDiv.children[0].getElementsByTagName(""img"");
+ if (imgs != undefined && imgs.length > 0) {
+ for (var imgi = 0; imgi < imgs.length; imgi++) {
+ imgs[imgi].style = ""height:10px;top:0.01rem""
+ }
+ }
+
+
+
+ var spans = itemInfoDiv.children[0].getElementsByTagName(""span"");
+ for (var spi = 0; spi < spans.length; spi++) {
+ spans[spi].style = ""display:none""
+ }
+ }
+
+ // 标签
+ if (itemInfoDiv.children[1] != undefined) {
+ itemInfoDiv.children[1].style = ""padding:0px;margin:0px;height:10px"";
+ var iconList = itemInfoDiv.children[1].children;
+ for (var si = 0; si < iconList.length; si++) {
+ var iconDiv = iconList[si]
+ for (var t = 0; t < iconDiv.children.length; t++) {
+ iconDiv.children[t].style.fontSize = ""10px"";
+ iconDiv.children[t].style.lineHeight = ""15px"";
+ iconDiv.children[t].style.marginRight = ""5px"";
+ iconDiv.children[t].style.marginBottom = ""5px"";
+ }
+ imgs = iconDiv.getElementsByTagName(""img"")
+ if (imgs != undefined && imgs.length > 0) {
+ for (var imgi = 0; imgi < imgs.length; imgi++) {
+ imgs[imgi].style = ""width:10px;height:10px;position:relative;top:1px;margin-right:5px""
+ }
+ }
+ }
+ }
+
+ //价格
+ if (itemInfoDiv.children[2] != undefined) {
+ itemInfoDiv.children[2].style = ""padding:0px;margin:0px;height:1px"";
+ var priceDiv = itemInfoDiv.children[2].children[0];
+
+ if (priceDiv.children[1] != undefined) {
+ // priceDiv.children[1].style = ""margin-left: 0.04rem; font-size: 0.13rem;""
+ // if (priceDiv.children[1].children[0] != undefined) {
+ // priceDiv.children[1].children[0].style = "" transform-origin: left bottom; transform: scale(1); overflow: hidden;""
+ // }
+ }
+ var spans = priceDiv.getElementsByTagName(""span"")
+ for (var spanI = 0; spanI < spans.length; spanI++) {
+
+ spans[spanI].style.transform = ""unset"";
+ spans[spanI].style.fontSize = ""10px"";
+ spans[spanI].style.lineHeight = ""15px"";
+
+ }
+
+ }
+ }
+ }
+
+ }
+}
+
+
+
+
+//修改头部
+var headDiv=document.getElementsByClassName(""_1DncS32V"")[0];
+
+var svgList= headDiv.getElementsByTagName(""svg"")
+for(var i=0;i1)
+ {
+ filterSpans[i].style.height=""0px""
+ }
+}
+
+var filteris= document.querySelector(""#main > div > div:nth-child(2) > div > div > div:nth-child(1) > div > div:nth-child(2)"").getElementsByTagName(""i"")
+for(var i=0;i
///
///
- public (bool isOk, object result) DoJavaScript(string js)
+ public (bool isOk, object result) DoJavaScript(string js,bool needReplaceLine=true)
{
- js = js.Replace("\n", "").Replace("\r\n", "").Replace(System.Environment.NewLine, "").Replace("\r", "");
+ if (needReplaceLine)
+ {
+ js = js.Replace("\n", "").Replace("\r\n", "").Replace(System.Environment.NewLine, "").Replace("\r", "");
+ }
Task task = null;
Application.Current.Dispatcher.Invoke(() =>
diff --git a/客户端/齐越慧眼/齐越慧眼/cefhelper/CefRequestHandler.cs b/客户端/齐越慧眼/齐越慧眼/cefhelper/CefRequestHandler.cs
index b447a1f..219c2e0 100644
--- a/客户端/齐越慧眼/齐越慧眼/cefhelper/CefRequestHandler.cs
+++ b/客户端/齐越慧眼/齐越慧眼/cefhelper/CefRequestHandler.cs
@@ -4,8 +4,10 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
+using System.Text.RegularExpressions;
using System.Windows;
using 齐越慧眼.UserControls;
@@ -102,12 +104,12 @@ namespace 齐越慧眼.cefhelper
protected override IResponseFilter GetResourceResponseFilter(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, IRequest request, IResponse response)
{
- if (request.Url.Contains("static.pddpic.com/assets/css/widgets_ba9e42522602b85cbbbc.css"))
+ if (request.Url.Contains("https://static.pddpic.com/assets/css/SearchResultTab") ||request.Url.StartsWith("https://static.pddpic.com/assets/css/SearchBar2")||request.Url.StartsWith("https://static.pddpic.com/assets/css/widgets"))
{
if(!request.Url.StartsWith("data:text/html"))
{
- var fil = new MyResponseFilter(true, Brower, request.Url);
- return fil;
+ var fil = new MyResponseFilter(true, Brower, request.Url);
+ return fil;
}
}
@@ -161,9 +163,55 @@ namespace 齐越慧眼.cefhelper
dataIn.CopyTo(memoryStream);
byte[] response = null;
- string json = DataStr;
+ string json = DataStr.Replace(" .",".");
+ if (Url.Contains("https://static.pddpic.com/assets/css/SearchBar2")||Url.Contains("https://static.pddpic.com/assets/css/SearchResultTab"))
+ {
+ var matchs = Regex.Matches(json, ":(.*?)rem");
+
+ if (matchs.Count > 0)
+ {
+ matchs.ToList().ForEach(c =>
+ {
+ string px = c.Groups[1].Value;
+ if (px.StartsWith("."))
+ {
+ px = "0" + px;
+ }
+
+ decimal pxVal = 0;
+ if (decimal.TryParse(px, out pxVal))
+ {
+ json = json.Replace(c.Value, ":" + (pxVal * 100) + "px ");
+ }
+ });
+ }
+ matchs = Regex.Matches(json, " (.*?)rem");
+
+ if (matchs.Count > 0)
+ {
+ matchs.ToList().ForEach(c =>
+ {
+ string px = c.Groups[1].Value;
+ if (px.StartsWith("."))
+ {
+ px = "0" + px;
+ }
+
+ decimal pxVal = 0;
+ if (decimal.TryParse(px, out pxVal))
+ {
+ json = json.Replace(c.Value, " " + (pxVal * 100) + "px ");
+ }
+ });
+ }
+
+ if (Url.Contains("https://static.pddpic.com/assets/css/SearchResultTab"))
+ {
+ json = json.Replace(".gNxXM8Fs{top:.5rem;}", ".gNxXM8Fs{top:55px;}");
+ }
+ }
json = json.Replace("768px", "100%");
response = Encoding.GetEncoding("gb2312").GetBytes(json);
diff --git a/客户端/齐越慧眼/齐越慧眼/replacepddcss.js b/客户端/齐越慧眼/齐越慧眼/replacepddcss.js
index 5c8b48e..134d0d5 100644
--- a/客户端/齐越慧眼/齐越慧眼/replacepddcss.js
+++ b/客户端/齐越慧眼/齐越慧眼/replacepddcss.js
@@ -1,3 +1,18 @@
+//整体
+document.getElementById("main").children[0].children[1].style.width="1380px"
+
+//浮动筛选框
+document.querySelector("#main > div > div:nth-child(2) > div > div > div:nth-child(1) > div > div:nth-child(2)").style.top="55px"
+
+
+//在app打开
+if(document.getElementsByClassName("pdd-go-to-app")[0])
+document.getElementsByClassName("pdd-go-to-app")[0].outerHTML=''
+if(document.getElementsByClassName("PTWSQMBM _1vDZKiQt")[0])
+//回顶部
+document.getElementsByClassName("PTWSQMBM _1vDZKiQt")[0].outerHTML=''
+
+//列表
for (var i = 0; i < document.getElementsByClassName("_3glhOBhU").length; i++) {
if (document.getElementsByClassName("_3glhOBhU")[i] != undefined) {
document.getElementsByClassName("_3glhOBhU")[i].style = "width: 200px; margin-right: 0.03rem; margin-bottom: 0.03rem;float:left;";
@@ -92,3 +107,65 @@ for (var i = 0; i < document.getElementsByClassName("_3glhOBhU").length; i++) {
}
}
+
+
+
+
+//修改头部
+var headDiv=document.getElementsByClassName("_1DncS32V")[0];
+
+var svgList= headDiv.getElementsByTagName("svg")
+for(var i=0;i1)
+ {
+ filterSpans[i].style.height="0px"
+ }
+}
+
+var filteris= document.querySelector("#main > div > div:nth-child(2) > div > div > div:nth-child(1) > div > div:nth-child(2)").getElementsByTagName("i")
+for(var i=0;i