Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tampermonkey - Match default start page

I try to remove the 8 tiles with the last seen pages on the start page of Chrome. You know, the page which appears if you start Chrome.

But since there is no URL at all, I don't know what I have to enter at @match. I've tried // @match * but the script is not executed.

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        *
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    setInterval(function(){
        var box = document.getElementById("mv-tiles");
        box.remove();
    },10
    );
})();
like image 812
Black Avatar asked Feb 19 '26 18:02

Black


1 Answers

Use @include instead of @match.

Also, it's possible to get the URL by going to the console and running window.location.href

I tried this and it worked:

// @include      http*://*chrome/newtab*

Maybe don't use an interval there, since it'll keep throwing errors once the element is not there anymore.

I'd use something like this:

injectStyles('#mv-single {display: none;}');

function injectStyles (styles) {
    var style       = document.createElement('style');
    style.type      = 'text/css';
    style.innerHTML = styles;
    document.head.appendChild(style);
}
like image 92
dangor Avatar answered Feb 21 '26 06:02

dangor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!