// ==UserScript== // @name SearchPreview for Baidu // @description SearchPreview for Baidu 伪百度搜索预览,提供一站式服务,无页面转跳,适合快速搜索资料。Re-edit by 864907600cc // @include http://www.baidu.com/s* // @exclude // @grant none // @version 1.7 // @icon http://1.gravatar.com/avatar/147834caf9ccb0a66b2505c753747867 // @namespace https://greasyfork.org/users/141 // @downloadURL https://update.greasyfork.icu/scripts/288/SearchPreview%20for%20Baidu.user.js // @updateURL https://update.greasyfork.icu/scripts/288/SearchPreview%20for%20Baidu.meta.js // ==/UserScript== // Re-edit by 864907600cc // 本脚本基于百度 firefox 吧吧友 网络孤独行客 的脚本修改(原贴地址 http://tieba.baidu.com/p/1687601275) // 基于 GPL 协议 修改并发布 // 原脚本中附加的信息均未删除以便参考 // 更新历史 // 2013.6.7 (1.0) // 1. 修改脚本以兼容 chrome // 2. 自动适应浏览器宽度,解决在各浏览器下出现错位的问题 // 2013.6.7 (1.1) // 1. 修复 chrome 下无法滚动页面的问题。由于 chrome 的自身问题,将鼠标移至网页上时尽管已成功触发事件并为框架添加相关属性,但并不会激活,故针对 chrome 浏览器移除自动隐藏滚动栏样式 // 2013.6.7 (1.2) // 1. 修复 firefox 在小屏幕浏览搜索结果时出现错位及无法滚动页面的问题 // 2013.6.7 (1.3) // 1. 取消窗口固定样式以解决在上一版本更新时出现的预览页过窄的问题 // 2013.6.22 (1.4) // 1. 添加展开按钮,点击可使预览页占满整个窗口,增大可视面积 // 2013.6.23 (1.5) // 1. 改进原脚本中修改搜索结果宽度的样式,因为该样式会导致部分搜索结果排版错乱 // 2013.9.16 (1.6) // 1. 修复百度更新后不可用的问题 // 2014.4.6 (1.7) // 1. 修复百度更新后不可用的问题,暂只支持旧版百度搜索,其他功能高考后再说 /********************************** 源脚本附加信息开始 **********************************/ /* // version 0.04 Beta // 2012.6.26 // Copyleft (c) 2013, 网络孤独行客 // Released under the GPL license // http://www.gnu.org/copyleft/gpl.html //--------------------------------F&Q------------------------------------------ // 1.因测试环境原因,暂时只提供宽度为1440 1366 1280 1024 1920 的分辨率 // 2.此UserScript假定用户已使用ABP等扩展对百度广告进行了屏蔽,所以不对广告进行任 // 何处理。若因百度广告导致版面错乱,请自行去除广告。 // -------------------------------/F&Q---------------------------------------- // ==UserScript== // @name SearchPreview for Baidu // @namespace http://www.winbaike.com // @description SearchPreview for Baidu 伪百度搜索预览,提供一站式服务, // 无虽页面转跳。适合快速搜索资料。 // @updateURL https://userscripts.org/scripts/source/137023.meta.js // @downloadURL https://userscripts.org/scripts/source/137023.user.js // @include http://www.baidu.com/* // @exclude // @grant none // ==/UserScript== */ /********************************** 源脚本附加信息结束 **********************************/ //CSS function addGlobalStyle(css) { var head, style; head = document.querySelectorAll('head')[0]; if (!head) { return; } style = document.createElement('style'); style.innerHTML = css; head.appendChild(style); } addGlobalStyle('.hide_Ifr {border-left:1px solid #e1e1e1;padding-left:3px !important;visibility:hidden}'); addGlobalStyle('.show_Ifr {border-left:1px solid #e1e1e1;padding-left:3px !important;visibility:visible;z-index:10}'); addGlobalStyle('.vspiic {background:url("http://hiphotos.baidu.com/sanguomengxiang/pic/item/2e1d1544ad34598230d750060cf431adcaef8402.jpg") no-repeat scroll -20px 0 transparent;display:block;height:15px;width:20px;top: 0;bottom: 0;margin: auto;position: absolute;}'); addGlobalStyle('.vspiic:hover {background:url("http://hiphotos.baidu.com/sanguomengxiang/pic/item/2e1d1544ad34598230d750060cf431adcaef8402.jpg") no-repeat;display:block;height:15px;width:20px;}'); addGlobalStyle('.widely {position:fixed!important;width:calc(100% - 70px);z-index:10000;right:5px;top:0px;height:100%;outline:10000px solid rgba(0,0,0,.5);background:white}'); addGlobalStyle('.widely>iframe {height:100%} .result{padding-right:20px;position:relative} #content_left {width:auto!important} .fuck{width:20px;position: absolute;height: 100%;top: 0;right: 0;} '); document.querySelector("#container").style.width="auto"; //if(document.querySelector(".result-zxl"))leftWidth=636; /*else*/var leftWidth=600; document.querySelector("#content_left").style.width=leftWidth+"px"; if(document.querySelector("#content_right")){ var cr=document.querySelector("#content_right") cr.parentNode.removeChild(cr); } //遍历td,插入链接 //var theTr=document.querySelectorAll("td.f"); var theTr=document.querySelectorAll(".result"); for(var count=0;count'; var display=newTd.childNodes[0]; display.target="onLoad"; display.href=theTr[count].firstChild.firstChild.href; //insert.parentNode.insertBefore(newTd,null); insert.appendChild(newTd) } } //插入iframe. var content_h=document.querySelector("#content_left").offsetHeight+"px"; var theContainer=document.querySelector("#container"); var showPage = document.createElement("table"); showPage.id="preview"; showPage.align="right"; showPage.innerHTML=''+ ''+ '
'+ ''+ '
'; theContainer.insertBefore(showPage,theContainer.firstChild); var thisdiv=document.querySelector("#thisDiv"); if(/Chrome/.test(navigator.userAgent)){ thisdiv.setAttribute('onmouseover','this.firstChild.style.overflow="visible"'); thisdiv.setAttribute('onmouseout','this.firstChild.style.overflow="hidden"'); } else{ thisdiv.setAttribute('onmouseover','this.firstChild.style.overflow="visible";this.firstChild.scrolling="yes"'); thisdiv.setAttribute('onmouseout','this.firstChild.style.overflow="hidden";this.firstChild.scrolling="no"'); } showPage.style.width='calc(100% - '+leftWidth+'px)' document.getElementById('wider').onclick=function(event){ if(document.getElementsByClassName('widely')[0]){ thisdiv.className='show_Ifr'; this.style.backgroundPosition='0 0'; this.style.right="" } else { thisdiv.className='show_Ifr widely'; this.style.backgroundPosition='-50px 0' this.style.right="calc(100% - 60px)" } } //取消固定窗口以兼容 firefox thisdiv.style.position="relative"; /********************************** 源脚本附加信息开始 **********************************/ //------------------------Update log------------------------------------------- /* 2013-03.01 窗口自动固定 2012-06-27 1.增加分辨率检测,自动适应大小。 2.识别鼠标活动,隐藏滚动条。 3.修正页面显示bug。 2012-07-26 1.更改图片2.鼠标滑过3.自动预览。 2013.04.22 百度更新,理论上适应所有分辨率。 */ /********************************** 源脚本附加信息结束 **********************************/