0

I was playing around with UserScript examples here and here to try and find a close example of what Im looking for.

Sometimes the page has a table with 100s of entries, and I'd like to return the values of "data-original-title" all to a place where I can copy them, like a console log.

I tried the above scripts but couldn't target the label as expected.

Edit: I guess I should clarify my request a little bit. Here's the full outerHTML

<td class="sorting_1">Lorem Ipsum<br><span class="label label-warning tooltip-class" title="ABC">ABC</span> <span class="label label-theme" data-toggle="tooltip" title="" data-original-title="Source: http://ThisIsTheLinkNeeded.com">S</span> </td>

<td class="sorting_1">Dolar Emet<br><span class="label label-warning tooltip-class" title="ABC">ABC</span> <span class="label label-theme" data-toggle="tooltip" title="" data-original-title="Source: http://ThisIsThe2ndLinkNeeded.com">S</span> </td>

It would be great for the console log to show:

Lorem Ipsum

http://ThisIsTheLinkNeeded.com

Dolar Emet

http://ThisIsThe2ndLinkNeeded.com

My attempt at a UserScript based on suggestion below which only returns values once they've been hovered on.

// ==UserScript==
// @name     Parse Source Links Test
// @description hello
// @version 0.1
// @match    https://example.url/*
// @require  https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @grant    GM_addStyle
// @grant    GM.getValue
// ==/UserScript==
//- The @grant directives are needed to restore the proper sandbox.
/* global $ */

let labels = document.querySelectorAll(".label.label-theme");
for (let label of labels) {
    console.log(label.dataset.originalTitle)
}

0 Answers0