Greasy Fork is available in English.
Provides a button to lookup information easily from the upload page on Platesmania.
当前为
// ==UserScript==
// @name Platesmania Lookup Toolbox
// @version 1.0
// @description Provides a button to lookup information easily from the upload page on Platesmania.
// @match https://platesmania.com/*/add*
// @grant none
// @license MIT
// @namespace http://greasyfork.icu/users/976031
// ==/UserScript==
(function() {
'use strict';
// Choose your preferred lookup sites here!
// Put two slashes (//) in front of the lookup site(s) you DON'T want to use and remove them from the one you want to use.
// Make sure ONLY ONE is active per country, otherwise the script will not work!
// Save this script and reload the PM upload page for changes to apply.
// Netherlands
const NLlookupSite = 'https://finnik.nl/kenteken/';
// const NLlookupSite = 'https://www.rdwdata.nl/kenteken/';
// const NLlookupSite = 'https://www.autoweek.nl/kentekencheck/';
// Sweden
const SElookupSite = 'https://www.car.info/?s=';
// const SElookupSite = 'https://biluppgifter.se/fordon/';
// const SElookupSite = 'https://fordon-fu-regnr.transportstyrelsen.se/?ts-regnr-sok=';
// Ukraine
const UAlookupSite = 'https://ua.carplates.app/en/number/';
// const UAlookupSite = 'https://baza-gai.com.ua/nomer/';
// const UAlookupSite = 'https://auto-inform.com.ua/search/';
// Actual script starts here, don't change anything from here unless you know what you're doing.
function isLookupSiteAvailable() {
return window.location.href.includes('platesmania.com/nl/add') ||
window.location.href.includes('platesmania.com/ua/add') ||
window.location.href.includes('platesmania.com/no/add') ||
window.location.href.includes('platesmania.com/dk/add') ||
window.location.href.includes('platesmania.com/fr/add') ||
window.location.href.includes('platesmania.com/se/add');
}
function areFieldsFilled() {
if (window.location.href.includes('platesmania.com/nl/add')) {
return document.getElementById('nomer').value !== '';
} else if (window.location.href.includes('platesmania.com/ua/add')) {
const region = document.getElementById('region1').value;
const digits = document.getElementById('digit1').value;
return region !== '' && digits !== '';
} else if (window.location.href.includes('platesmania.com/no/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
return letField !== '' && digitField !== '';
} else if (window.location.href.includes('platesmania.com/dk/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
return letField !== '' && digitField !== '';
} else if (window.location.href.includes('platesmania.com/fr/add')) {
const b1 = document.getElementById('b1').value;
const digit2 = document.getElementById('digit2').value;
const b2 = document.getElementById('b2').value;
return b1 !== '' && digit2 !== '' && b2 !== '';
} else if (window.location.href.includes('platesmania.com/se/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
return letField !== '' && digitField !== '';
} else if (window.location.href.includes('platesmania.com/de/add')) {
const digitField = document.getElementById('digit').value;
return digitField !== '';
} else if (window.location.href.includes('platesmania.com/ch/add')) {
const digitField = document.getElementById('digit').value;
return digitField !== '';
} else if (window.location.href.includes('platesmania.com/pl/add')) {
const digitField = document.getElementById('nomerpl').value;
return digitField !== '';
}
return false;
}
function createOrUpdateLookupButton() {
if (!isLookupSiteAvailable()) {
const lookupButton = document.getElementById('lookupButton');
if (lookupButton) {
lookupButton.parentNode.removeChild(lookupButton);
}
return;
}
const fieldsFilled = areFieldsFilled();
let lookupButton = document.getElementById('lookupButton');
if (!lookupButton) {
lookupButton = document.createElement('button');
lookupButton.id = 'lookupButton';
lookupButton.innerText = 'Lookup';
lookupButton.style.marginBottom = '10px';
lookupButton.style.width = '100%';
lookupButton.style.backgroundColor = '#3498db';
lookupButton.style.color = '#ffffff';
lookupButton.style.border = 'none';
lookupButton.style.cursor = 'pointer';
document.getElementById('zoomimgid').parentNode.insertBefore(lookupButton, document.getElementById('zoomimgid'));
}
if (fieldsFilled) {
lookupButton.disabled = false;
lookupButton.onclick = function() {
let plateNumber = '';
if (window.location.href.includes('platesmania.com/nl/add')) {
plateNumber = document.getElementById('nomer').value;
window.open(NLlookupSite + plateNumber);
} else if (window.location.href.includes('platesmania.com/ua/add')) {
const region = document.getElementById('region1').value;
const digits = document.getElementById('digit1').value;
const b1 = document.getElementById('b1').value;
const b2 = document.getElementById('b2').value;
plateNumber = `${region}${digits}${b1}${b2}`;
window.open(UAlookupSite + plateNumber);
} else if (window.location.href.includes('platesmania.com/no/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
plateNumber = letField + digitField;
window.open('https://www.vegvesen.no/en/vehicles/buy-and-sell/vehicle-information/sjekk-kjoretoyopplysninger/?registreringsnummer=' + plateNumber);
} else if (window.location.href.includes('platesmania.com/dk/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
plateNumber = letField + digitField;
window.open('https://app.digitalservicebog.dk/search?country=dk&Registration=' + plateNumber);
} else if (window.location.href.includes('platesmania.com/fr/add')) {
const b1 = document.getElementById('b1').value;
const digit2 = document.getElementById('digit2').value;
const b2 = document.getElementById('b2').value;
plateNumber = `${b1}${digit2}${b2}`;
window.open('https://immatriculation-auto.info/vehicle/' + plateNumber);
} else if (window.location.href.includes('platesmania.com/se/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
plateNumber = letField + digitField;
window.open(SElookupSite + plateNumber);
} else if (window.location.href.includes('platesmania.com/pl/add')) {
window.open('https://ufg.pl/');
}
};
} else {
lookupButton.disabled = true;
lookupButton.onclick = null;
}
}
function createOrUpdateGoogleImagesButton() {
const fieldsFilled = areFieldsFilled();
let googleImagesButton = document.getElementById('googleImagesButton');
if (!googleImagesButton) {
googleImagesButton = document.createElement('button');
googleImagesButton.id = 'googleImagesButton';
googleImagesButton.innerText = 'Search combination on Google Images';
googleImagesButton.style.marginBottom = '10px';
googleImagesButton.style.width = '100%';
googleImagesButton.style.backgroundColor = '#3498db';
googleImagesButton.style.color = '#ffffff';
googleImagesButton.style.border = 'none';
googleImagesButton.style.cursor = 'pointer';
document.getElementById('zoomimgid').parentNode.insertBefore(googleImagesButton, document.getElementById('zoomimgid'));
}
if (fieldsFilled) {
googleImagesButton.disabled = false;
googleImagesButton.onclick = function() {
let plateNumber = '';
if (window.location.href.includes('platesmania.com/nl/add')) {
plateNumber = document.getElementById('nomer').value;
} else if (window.location.href.includes('platesmania.com/ua/add')) {
const region = document.getElementById('region1').value;
const digits = document.getElementById('digit1').value;
const b1 = document.getElementById('b1').value;
const b2 = document.getElementById('b2').value;
plateNumber = `${region} ${digits} ${b1}${b2}`;
} else if (window.location.href.includes('platesmania.com/no/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
plateNumber = letField + ' ' + digitField;
} else if (window.location.href.includes('platesmania.com/dk/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
plateNumber = letField + ' ' + digitField;
} else if (window.location.href.includes('platesmania.com/fr/add')) {
const b1 = document.getElementById('b1').value;
const digit2 = document.getElementById('digit2').value;
const b2 = document.getElementById('b2').value;
plateNumber = `${b1} ${digit2} ${b2}`;
} else if (window.location.href.includes('platesmania.com/se/add')) {
const letField = document.getElementById('let').value;
const digitField = document.getElementById('digit').value;
plateNumber = letField + ' ' + digitField;
} else if (window.location.href.includes('platesmania.com/de/add')) {
const regionField = document.getElementById('region').value;
const letField = document.getElementById('b1').value;
const letField2 = document.getElementById('b2').value;
const digitField = document.getElementById('digit').value;
plateNumber = regionField + ' ' + letField + ' ' + digitField + letField2;
} else if (window.location.href.includes('platesmania.com/ch/add')) {
const regionField = document.getElementById('region').value;
const digitField = document.getElementById('digit').value;
plateNumber = regionField + ' ' + digitField;
} else if (window.location.href.includes('platesmania.com/pl/add')) {
const regionField = document.getElementById('region');
const selectedRegionText = regionField.options[regionField.selectedIndex].text;
const digitField = document.getElementById('nomerpl').value;
plateNumber = selectedRegionText + ' ' + digitField;
}
window.open('https://www.google.com/search?tbm=isch&q="' + plateNumber + '"');
};
} else {
googleImagesButton.disabled = true;
googleImagesButton.onclick = null;
}
}
createOrUpdateLookupButton();
createOrUpdateGoogleImagesButton();
setInterval(() => {
createOrUpdateLookupButton();
createOrUpdateGoogleImagesButton();
}, 1000);
})();