// ==UserScript== // @name Google Search 结果导出 // @namespace http://www.ixiqin.com/ // @version 0.4 // @description OutPut Data from Google Search Result // @author Bestony // @match https://www.google.com/search* // @require http://code.jquery.com/jquery-3.2.1.min.js // @license . GPLv2 // @grant none // @downloadURL https://update.greasyfork.icu/scripts/32951/Google%20Search%20%E7%BB%93%E6%9E%9C%E5%AF%BC%E5%87%BA.user.js // @updateURL https://update.greasyfork.icu/scripts/32951/Google%20Search%20%E7%BB%93%E6%9E%9C%E5%AF%BC%E5%87%BA.meta.js // ==/UserScript== /** * Action */ importCss(); scriptWithJquery(); /** * Get Result */ var searchResult = $("h3.r"); var contentArray = []; searchResult.each(function () { contentArray.push({ "title": this.firstElementChild.text.toString().replace(new RegExp(',',"g"),"·"), "herf": this.firstElementChild.href.toString(), }); }); /** * Import CSS For Button */ function importCss() { var jqueryScriptBlock = document.createElement('style'); jqueryScriptBlock.type = 'text/css'; jqueryScriptBlock.innerHTML = "#gototop{position:fixed;bottom:60%;left:10px;border:1px solid gray;padding:3px;width:90px;font-size:12px;cursor:pointer;border-radius: 3px;text-shadow: 1px 1px 3px #676767;}"; document.getElementsByTagName('head')[0].appendChild(jqueryScriptBlock); } /** * 页面元素添加 */ function scriptWithJquery() { $(document.body).append("