Benutzer-Werkzeuge

Webseiten-Werkzeuge


chrome_chromium

Chrome/Chromium

PDF Anzeige aus Chrome in Chromium unter Linux

cp /opt/google/chrome/libpdf.so /usr/lib/chromium-browser/libpdf.so

Tampermonkey Script für startpage.com

Meine Version des Tampermonkey-Sctips von Userscripts für startpage.com mit folgenden Änderungen:

  • Setup-Cookie wird in Ruhe gelassen
  • Ausblendungen erweitert
  • Verwendet jquery Funktion $() für Ausblendungen
  • PDF-Link-Script integriert
  • Google-Shopping Link ergänzt

// ==UserScript==
// @name           startpage Enhancer
// @author         Carlton Kenney
// @namespace      none
// @description    Enhances startpage (by ixquick) to look like Google and load 100 results
// @copyright      2012 by Carlton Kenney
// @version        0.1b
// @lastupdated    3/26/2012
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js
// @include        *startpage.com*
// ==/UserScript==


//--------------Home Page?--------------//
if(document.URL.indexOf("startpage.com/do/") >= 0) {
	homePage = 0;
}
else {
	homePage = 1;
}


/***********************************************************
=================Style Changes=================
***********************************************************/
if(homePage) {
	GM_addStyle(
'body { background: #FFFFFF; }'
+'html {background: #FFFFFF; }'
+'input#query {font: 16px arial,sans-serif; background: none repeat scroll 0 0 #FFFFFF; box-shadow: none; border-color: #C0C0C0 #D9D9D9 #D9D9D9; border-radius: 1px; border-right: 1px solid #D9D9D9; border-style: solid; border-width: 1px; height: 18px; padding: 5px 6px 6px; white-space: nowrap; width: 560px; }'
+'input#query:hover, input#query_bottom:hover { border-color: #A0A0A0 #B9B9B9 #B9B9B9; border-right: 1px solid #B9B9B9; border-style: solid; border-width: 1px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset; }'
+'input#query:active, input#query_bottom:active { border: 1px solid #4D90FE; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset; outline: medium none; }'
+'input#query:focus, input#query_bottom:focus { border: 1px solid #4D90FE; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset; outline: medium none; }'
+'#head { margin: 0 0 12px; background: #2D2D2D; padding: 6px 25px; border-bottom: 1px solid; border-bottom-color: #FFFFFF; }'
+'#logoRed { position: relative; color: #D5402C; font-size: 60px; font-family: Arial, helvetica; font-weight: 600; text-shadow:2px 2px 3px #999999; text-decoration: none; padding-right: 100px; line-height: 100%; }'
+'#logoBlue { position: relative; color: #608BD6; font-size: 60px; font-family: georgia; font-weight: normal; text-shadow:2px 2px 3px #999999; text-decoration: none; padding-left: 30px; line-height: 100%; margin-top: -22px}'
+'#logo a {text-decoration: none; }'
+'#enhanced {padding: 0 0 0 60px; }'
+'a#main_link { margin-bottom: 60px;}'
+'#content { margin: 125px auto auto auto; }'
+'.homeButton { -moz-user-select: none; background-color: #F5F5F5; background-image: -moz-linear-gradient(center top , #F5F5F5, #F1F1F1); border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 2px 2px 2px 2px; color: #555555; cursor: default !important; display: block; font-weight: bold; height: 29px; line-height: 29px; margin: 16px auto; min-width: 54px; padding: 0 8px; text-align: center; text-decoration: none !important; }'
//+'.homeButton { background-color: #F5F5F5; background-image: #F5F5F5; border-color: rgba(0, 0, 0, 0.1); color: #555555; margin: 16px auto; cursor: default; display: block; font-weight: bold; height: 29px; line-height: 29px; min-width: 54px; padding: 0 8px; text-align: center; text-decoration: none; border-width: 1px; border-radius: 2px;}'
+'.homeButton:hover { background-color: #F8F8F8; background-image: -moz-linear-gradient(center top , #F8F8F8, #F1F1F1); border-color: #C6C6C6; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); color: #333333; }'
+'#iconText {font: bold 11px/27px Arial,sans-serif !important; vertical-align: top; }'
+'form#search_form { padding-left: 0; }'
+'div#links {  margin-top: 25px; }'
+'.addsettings { font: 11px verdana,arial,sans-serif; }'
);
}

else {
	GM_addStyle(
'input#query_top, input#query_bottom {font: 16px arial,sans-serif; background: none repeat scroll 0 0 #FFFFFF; box-shadow: none; border-color: #C0C0C0 #D9D9D9 #D9D9D9; border-radius: 1px; border-right: 1px solid #D9D9D9; border-style: solid; border-width: 1px; height: 18px; }'
+'input#query_top:hover, input#query_bottom:hover { border-color: #A0A0A0 #B9B9B9 #B9B9B9; border-right: 1px solid #B9B9B9; border-style: solid; border-width: 1px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) inset; }'
+'input#query_top:active, input#query_bottom:active { border: 1px solid #4D90FE; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset; outline: medium none; }'
+'input#query_top:focus, input#query_bottom:focus { border: 1px solid #4D90FE; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset; outline: medium none; }'
+'html {background: #F1F1F1; }'
+'#results_content { background: #FFFFFF; margin-top: 30px; border-top: 1px solid; border-top-color: #E5E5E5; }'
+'#head { margin: -18px 0 12px; background: #2D2D2D; padding: 0 25px 2px 22px; border-bottom: 1px solid; border-bottom-color: #FFFFFF; }'
+'#logoRed { position: relative; color: #D5402C; font-size: 40px; font-family: Arial, helvetica; font-weight: 600; text-shadow:2px 2px 3px #999999; text-decoration: none; margin: -10px 0 0 0; padding: 0; }'
+'#logoBlue { position: relative; color: #608BD6; font-size: 40px; font-family: georgia; font-weight: normal; text-shadow:2px 2px 3px #999999; text-decoration: none; margin: -20px 0 0 45px; padding: 0; }'
+'#logo a {text-decoration: none; }'
+'#results_count_p {font-size: 13px; margin: 23px 0 18px 220px; color: #999999; }'
+'#tip {border-top: 1px solid; border-top-color: #D9D9D9; }'
+'#side_bar { margin-top: 30px !important; }'
+'#show_hide span { margin-top: 205px; }'
+'#results, #tod_wrap { border-left: 0px; }'
+'#by_time { border-right: 0px; }'
+'#enhanced {padding: 0 8px 0 40px; }'
+'#results .result h3 {font-weight:300; }'
+'span.linkType { font-weight:bold; font-size:x-small; color:#1122CC; }'
);
}

GM_addStyle(
'#head a { color: #BBBBBB; font-size: 13px; font-family: arial !important; font-weight: bold !important; }'
+'#head a:hover {color: #FFFFFF; }'
+'#head a.active { color: #FFFFFF; }'
+'.newButton {-moz-user-select: none; background-color: #4D90FE; background-image: -moz-linear-gradient(center top , #4D90FE, #4787ED); border: 1px solid #3079ED; border-radius: 2px 2px 2px 2px; color: #FFFFFF; cursor: default; display: inline-block; font-weight: bold; height: 29px; line-height: 29px; min-width: 54px; padding: 0 8px; text-align: center; text-decoration: none; margin-left: 30px; }'
+'.newButton:hover { background-color: #357AE8; background-image: -moz-linear-gradient(center top , #4D90FE, #357AE8); border: 1px solid #2F5BB7; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); }'
+'.searchIcon { background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAANCAQAAAAz1Zf0AAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAAAEgAAABIAEbJaz4AAABZSURBVBjTY2AAgv8N/9//B4H3/xsYUMH/8/+RwXlkqQawjgAwOwBsAkI3mBsA5wWAlCIkgQDFEmQ+fkm8xuJ1kADcK++hdAGqT5EC4X8Bml+xBAol0kA3AwAYF4taFE9dUAAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxMi0wMy0yM1QxNDo0ODo1OCswMTowMDeAqyMAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTItMDMtMjNUMTQ6NDg6NTgrMDE6MDBG3ROfAAAAAElFTkSuQmCC") transparent; display: inline-block; height: 13px; margin: 7px 19px; width: 14px; }'
);


//--------------Change Logo--------------//
if(homePage) {
	var logoLinkDiv = document.getElementById("main_link");
	var logoLink = logoLinkDiv.getElementsByTagName("p")[0];
	logoLink.removeChild(logoLink.getElementsByTagName("img")[0]);
}
else {
	var logoLinkDiv = document.getElementById("logo");
	var logoLink = logoLinkDiv.getElementsByTagName("a")[0];
	logoLink.removeChild(logoLinkDiv.getElementsByTagName("img")[0]);
}

var logoRed = document.createElement('div');
logoRed.setAttribute('id', 'logoRed')
logoRed.innerHTML = "start";

var logoBlue = document.createElement('div');
logoBlue.setAttribute('id', 'logoBlue')
logoBlue.innerHTML = "page";

logoLink.appendChild(logoRed);
logoLink.appendChild(logoBlue);


//--------------Add Google Maps Link--------------//
if(homePage) {
	document.getElementById("category").innerHTML += "\u00A0|\u00A0\u00A0" + '<a id="maps" href="https://maps.google.com" onClick = "javascript:maps()">Maps</a>';
}
else {
	var query = document.getElementById("query_top").value.split(" ").join("+");
	document.getElementById("head_left").innerHTML += "\u00A0|\u00A0\u00A0" + '<a id="maps" href="https://maps.google.com/maps?q=' + query + '" onClick = "javascript:maps()">Maps</a>' + "\u00A0|\u00A0\u00A0" + 
        '<a id="shopping" href="https://www.google.com/search?q=' + query + '&source=lnms&tbm=shop">Shopping</a>';
}


var button = document.createElement('button');
button.name = 'btn';
var j = 0;


if(homePage) {
	button.setAttribute('class', 'homeButton');
	button.innerHTML = '<span id="iconText">Startpage Search</span>';
	button.id = 'submit';
	var homeSubmit = document.getElementById('submit');
	homeSubmit.parentNode.replaceChild(button, homeSubmit);
}
else {
	button.setAttribute('class', 'newButton');
	button.innerHTML = '<span class="searchIcon"></span>';
	var inputs = document.getElementsByTagName('input');
	for(i=0; i<inputs.length; i++ ) {
		if (inputs[i].id == 'submit1') {
			button.id = inputs[i].id;
		
			if(j == 0) {
				inputs[i].parentNode.replaceChild(button, inputs[i]);
			}
			if(j == 1) {
				var button2 = button.cloneNode(true);
				inputs[i].parentNode.replaceChild(button2, inputs[i]);
			}
			j += 1;
		}
	}
}

/***********************************************************
=================Function Declaration=================
***********************************************************/

function getElementsByClass(node,searchClass,tag) {
  var classElements = new Array();
  var els = node.getElementsByTagName(tag);
  var elsLen = els.length;
  var pattern = new RegExp(searchClass);
  for (i = 0, j = 0; i < elsLen; i++) {
    if ( pattern.test(els[i].className) ) {
      classElements[j] = els[i];
      j++;
    }
  }
  return classElements;
}



/***********************************************************
=================Main Program=================
***********************************************************/

var dp = document.getElementsByClassName('date_promo');
dp[0].style.display = "none";

$("#caption, #light, #lang, #links, #sponsored, #news_message, #tip, #ix_promo_box, #date_promo, #enhanced, #detail").hide();


//--------------Label Special Link Types--------------//
var results = document.getElementsByClassName('result');

for(i=0; i<results.length; i++ ) {
	var link = results[i].getElementsByTagName('a')[0]
	var href = link.href;
	if( href.match(/\.(rtf|doc|ppt|pdf)$/i) ) {
		var linkType = document.createElement("span");
    		linkType.className = "linkType";
    		linkType.appendChild( document.createTextNode(href.replace(/^.*\.(...)$/,"[$1] ").toUpperCase() ) );
    		link.parentNode.insertBefore(linkType, link);
	}
}

//-----------PDF Links----------------------------------//
var spans = getElementsByClass(document,'linkx','font');
for (var i=0; i<spans.length; i++) {
  var span = spans[i];
  var url = span.innerHTML;
  var re = /.pdf[ ]*$/i;
  if (re.test(url)) {
      span.parentNode.parentNode.childNodes[1].innerHTML = "[pdf] "+ span.parentNode.parentNode.childNodes[1].innerHTML ;
  }

}

var zipCode = new Array();
zipCode.push('function edit() {');
zipCode.push('var query = getQuery();');
zipCode.push('document.getElementById("search_form").action = "https://startpage.com/do/search?q=" + getQuery();');
zipCode.push('}');
zipCode.push('function getQuery() {');
zipCode.push('if(document.URL.indexOf("startpage.com/do/") >= 0) {');
zipCode.push('var query = document.getElementById("query_top").value.split(" ").join("+");');
zipCode.push('} else {');
zipCode.push('var query = document.getElementById("query").value.split(" ").join("+");');
zipCode.push('}');
zipCode.push('return query;');
zipCode.push('}');
zipCode.push('function maps() {');
zipCode.push('document.getElementById("maps").href = "https://maps.google.com/maps?q=" + getQuery();');
zipCode.push('}');
var zipScript = document.createElement('script');
zipScript.setAttribute('type', 'text/javascript');
zipScript.innerHTML = zipCode.join('');
zipCode.length=0;
document.getElementsByTagName('head')[0].appendChild(zipScript);

document.getElementById('search_form').setAttribute('onsubmit', 'edit()');

chrome_chromium.txt · Zuletzt geändert: 2017/03/17 11:37 (Externe Bearbeitung)