From fb3d497aa326dd4e07e8eea9959fe07769b67ab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Am=C4=93lija=20I?= Date: Mon, 31 Mar 2025 21:03:01 +0300 Subject: [PATCH] Adding URL for each event, and removing duplicate URL info from "copy" event --- src/borderify.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/borderify.js b/src/borderify.js index e3e07ef..b1a0749 100644 --- a/src/borderify.js +++ b/src/borderify.js @@ -59,11 +59,12 @@ browser.storage.sync.get("clientId").then((result) => { function createEventJSON(eventType, data) { const timeStamp = new Date().toISOString(); + const pageUrl = window.location.href; return { "@version": 1, "type": `browserext.${eventType}`, "TimeStamp": timeStamp, - "data": {...data, clientId }, + "data": {...data, clientId, pageUrl}, "@timestamp": timeStamp }; } @@ -187,12 +188,11 @@ function navigateWithPromise(href) { document.addEventListener("copy", (event) => { const selectedText = window.getSelection().toString(); - const pageUrl = window.location.href; let outputText = selectedText.length > 50 ? selectedText.substring(0, 49) + '…' : selectedText; if (selectedText.length > 0) { - const eventData = createEventJSON('copy', { selectedText: outputText, pageUrl, description: "Скопирован текст" }); + const eventData = createEventJSON('copy', { selectedText: outputText, description: "Скопирован текст" }); console.log("Событие copy:", JSON.stringify(eventData)); sendDataToServer(eventData); }