clean_distri-company-lu

Remove duplicate results in search and redirect to www

当前为 2024-05-28 提交的版本,查看 最新版本

// ==UserScript==
// @name        clean_distri-company-lu
// @namespace   Violentmonkey Scripts
// @match       *://*distri-company.lu/*
// @grant       none
// @version     1.0
// @author      kedema
// @description Remove duplicate results in search and redirect to www
// @license     GNU GPLv3
// ==/UserScript==

// Get the actual url in js
const proto = location.protocol;
const host  = location.hostname;
const page  = location.pathname;
const args  = location.search; 
const url   = proto + '//' + host;
const fullUrl   = proto + '//www.' + host + page + args;

if (!host.startsWith("www.")) {
    console.log("Redirecting to www");
    window.location = fullUrl;
}

// Cleaning results
$("a.uk-card.uk-card-default.uk-card-small.uk-card-hover.uk-card-body.uk-margin-remove-first-child.uk-link-toggle.uk-display-block").not('[href^="'+url+'"]').closest(".el-item").parent().toggle(false);