Skip to content

Instantly share code, notes, and snippets.

@Gelob
Created October 23, 2022 18:52
Show Gist options
  • Save Gelob/a2edc1eaa33ee4dd4ccdfe1623c2c7c4 to your computer and use it in GitHub Desktop.
Save Gelob/a2edc1eaa33ee4dd4ccdfe1623c2c7c4 to your computer and use it in GitHub Desktop.
eBay ID viewer for HobbyDB
// ==UserScript==
// @name eBay ID viewer for HobbyDB
// @namespace http://tampermonkey.net/
// @version 0.1
// @description show eBay IDs in listing
// @author Ryan
// @match https://www.ebay.com/sch/*
// @icon https://www.google.com/s2/favicons?domain=ebay.com
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// @grant none
/* globals $ */
// ==/UserScript==
(function() {
//ebay changed shit
//var item = '<div class="container">'
var item = '<div class="s-item__wrapper clearfix">'
//ebay changed to the above 9/28
//var item = '<div class="results">'
//ebay changed shit
$( ".s-item__link" ).each(function(i, obj) {
//$( ".vip" ).each(function(i, obj) {
const regexp = /ebay.com\/itm\/([0-9]{12})\?hash/g;
const url = $(this).attr("href");
const array = [...url.matchAll(regexp)];
var itemnum = array[0]?.[1];
item += array[0]?.[1]
item += "<br />"
$(this).after(`<p>${itemnum}</p>`)
})
$(document.body).append(item);
})
();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment