[~] Refactor

This commit is contained in:
Siarhei Siniak 2024-08-10 21:49:26 +03:00
parent 3b2dd8045e
commit 331e11d728

@ -2,7 +2,13 @@
// @name data extraction linkedin // @name data extraction linkedin
// @namespace Violentmonkey Scripts // @namespace Violentmonkey Scripts
// @match https://www.linkedin.com/* // @match https://www.linkedin.com/*
// @grant none // @grant GM_getValue
// @grant GM_setValue
// @grant GM_getValues
// @grant GM_setValues
// @grant GM_listValues
// @grant GM_deleteValue
// @grant GM_deleteValues
// @version 0.1 // @version 0.1
// @author Siarhei Siniak // @author Siarhei Siniak
// @license Unlicense // @license Unlicense
@ -15,6 +21,10 @@
// ==/UserScript== // ==/UserScript==
class Linkedin { class Linkedin {
constructor() {
this.data = new Map();
}
parse_header() { parse_header() {
return [ return [
$( $(
@ -26,11 +36,31 @@ class Linkedin {
] ]
} }
data_add (text) {
if (self.data.has(text))
{
return;
}
self.data.set(text, {
value: text,
ts: (new Date()).valueOf(),
});
console.log(self.data[text]);
}
document_on_changed () { document_on_changed () {
let self = this; let self = this;
let current_data = self.parse_header(); let current_data = self.parse_header();
console.log(current_data); current_data[0].forEach((i, o) => {
self.data_add(o);
});
current_data[1].forEach((i, o) => {
self.data_add(o);
});
} }
listener_add() { listener_add() {