Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. javascript:(function(){var v="2.1.1";if(window.jQuery===undefined||window.jQuery.fn.jquery<v){var done=false;var script=document.createElement("script");script.src="https://ajax.googleapis.com/ajax/libs/jquery/"+v+"/jquery.min.js";script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;initMyBookmarklet();}};document.getElementsByTagName("head")[0].appendChild(script);}else{initMyBookmarklet();}function initMyBookmarklet(){var entries={q:"",topAds:[],rightAds:[],organic:[]};var prefs={a:{ad:'h3 a',organic:'h3.r a'},cite:{ad:'cite',organic:'div.s cite'},type:{ad:'paid',organic:'organic'}};var id=0;function getSeQuery(){var matches=window.location.href.match(/[\?#&]{1}q=([\w-\+%]+)(&)?/);if(matches==null)return "";return matches[1];}function getSeStart(){var matches=window.location.href.match(/[\?#&]{1}start=(\d+)(&)?/);if(matches==null)return 0;return matches[1];}function getSeResults(start){var $center_col=$('#center_col');var $right_col=$('#rhs_block');var $tads=$center_col.find('#tads ol li');var $rads=$right_col.find('ol li');var $org=$center_col.find('#res #search ol li:not([class*=action-menu-item])');makeEntries($tads,entries.topAds,"ad");makeEntries($rads,entries.rightAds,"ad");id=start;makeEntries($org,entries.organic,"organic");return entries;}function makeEntries($col,eSub,t){var j=0;for(var i=0;i<$col.length;i++){var entry={};var a=$($col.get(i)).find(prefs.a[t]);var cite=$($col.get(i)).find(prefs.cite[t]);if(cite.length>0){entry.id=++id;entry.a=a.get(0).href;entry.t=prefs.type[t];if(t=='ad'){entry.cite=cite.get(0).innerHTML.match(/www\.(\w)*/)[0].replace("www.","");}else{entry.cite=cite.get(0).innerHTML.replace(/<(\/?).+?>/g,"").split(" ")[0].split("/")[0].replace("www.","");}eSub[j++]=entry;}}}function stringify(e){var cols=[e.topAds,e.rightAds,e.organic];var res=e.q;for(var i=0;i<cols.length;i++){for(var j=0;j<cols[i].length;j++){var ta=cols[i][j];res+="; "+ta.id+"; "+ta.t+"; "+ta.a+"; "+ta.cite+"\n";}}return res;}if($("#resframe").length==0){var q=getSeQuery();var start=getSeStart();if((q!="")&&(q!=null)){entries.q=unescape(q);var newHtml="<div id='resframe'><div id='resframe_overlay'><div id='resframe_result'>Loading...</div></div><style type='text/css'>#resframe_overlay {display: none; position: fixed; width: 100%; height: 100%; top: 0; left: 0; background-color: rgba(255,255,255,.8); z-index: 900; }#resframe_result {position: fixed; top: 10%; left: 10%; width: 80%; height: 80%; z-index: 999;}#resframe_result textarea{width:100%;height:100%;}</style></div>";$("body").append(newHtml);$("#resframe_overlay").fadeIn(250);var entries=getSeResults(start);$('#resframe_result').html("<textarea>"+stringify(entries)+"</textarea>");}}else{$('#resframe').fadeOut(250).remove();}}})();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement