View Single Post
Old 04-17-2020, 05:39 PM   #24
iG0R
Enthusiast
iG0R began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Apr 2020
Device: PC
Quote:
Originally Posted by kovidgoyal View Post
right click on it open the inspect tool and see why its not working for you
I've already tried it but after clicking "View page source" nothing happens the same as while clicking "Save page". Only working context menu's items are - Back, Forward, Reload, Zoom in, Zoom out, Default zoom.

Also I've tried to modify lookup.js to change CSS but faced with the strange results.
lookup.js:
Spoiler:
Code:
/* vim:fileencoding=utf-8
 * 
 * Copyright (C) 2019 Kovid Goyal <kovid at kovidgoyal.net>
 *
 * Distributed under terms of the GPLv3 license
 */

(function() {
    "use strict";

    function fix_google_markup() {
        var cc = document.getElementById('center_col');
        cc.style.marginLeft = '0';
        cc = document.getElementById('cnt');
        if (cc) cc.style.paddingTop = '0';
        var params = new URLSearchParams(document.location.search.substring(1));
        var q = params.get('q');
        if (q && q.startsWith('define:')) {
            cc.style.position = 'absolute';
            cc.style.top = '0';
            cc.style.left = '0';
            var remove = ['sfcnt', 'top_nav', 'before-appbar', 'appbar', 'searchform', 'easter-egg'];
            remove.forEach(function(id) {
                var elem = document.getElementById(id);
                if (elem) elem.style.display = 'none';
            });
        }
        var promo = document.getElementById('promos');
        if (promo) promo.parentNode.removeChild(promo);
    }

        var css = [
	"* {",
	"background-color: #fef3df !important;",
	"color: black !important;",
//	"border-color: #fef3df !important;",
	"}"
	].join("\n");

/*Block#1*/
	if (typeof GM_addStyle != "undefined") {
		GM_addStyle(css);
	} else if (typeof PRO_addStyle != "undefined") {
		PRO_addStyle(css);
	} else if (typeof addStyle != "undefined") {
		addStyle(css);
	} else {
		var node = document.createElement("style");
		node.type = "text/css";
		node.appendChild(document.createTextNode(css));
		var heads = document.getElementsByTagName("head");
		if (heads.length > 0) {
			heads[0].appendChild(node);
		} else {
			// no head yet, stick it whereever
			document.documentElement.appendChild(node);
		}
	}
/*End#1*/

	if (window.location.hostname === 'www.google.com' || window.location.hostname === 'translate.google.com') {
        window.addEventListener('DOMContentLoaded', function() { setTimeout(fix_google_markup, 5000); } );
/*Block#2*/
//		if (typeof GM_addStyle != "undefined") {
//			GM_addStyle(css);
//		} else if (typeof PRO_addStyle != "undefined") {
//			PRO_addStyle(css);
//		} else if (typeof addStyle != "undefined") {
//			addStyle(css);
//		} else {
//			var node = document.createElement("style");
//			node.type = "text/css";
//			node.appendChild(document.createTextNode(css));
//			var heads = document.getElementsByTagName("head");
//			if (heads.length > 0) {
//				heads[0].appendChild(node);
//			} else {
//				// no head yet, stick it whereever
//				document.documentElement.appendChild(node);
//			}
//		}
/*End#2*/
	}

/*Block#3*/	
//	if (typeof GM_addStyle != "undefined") {
//		GM_addStyle(css);
//	} else if (typeof PRO_addStyle != "undefined") {
//		PRO_addStyle(css);
//	} else if (typeof addStyle != "undefined") {
//		addStyle(css);
//	} else {
//		var node = document.createElement("style");
//		node.type = "text/css";
//		node.appendChild(document.createTextNode(css));
//		var heads = document.getElementsByTagName("head");
//		if (heads.length > 0) {
//			heads[0].appendChild(node);
//		} else {
//			// no head yet, stick it whereever
//			document.documentElement.appendChild(node);
//		}
//	}
/*End#3*/


})();


Blocks #2 and #3 don't work for 'translate.google.com', i.e. Google Translate aren't changing at all - as it was "white" it still remains "white". But for 'www.google.com' all Blocks (#1, #2, #3) work perfect.
iG0R is offline   Reply With Quote