Skip to content

Commit 4dcc6be

Browse files
authored
Merge pull request #6 from AlexInABox/dev
fix most duplicate cursors and conflicting css
2 parents 385795e + 13650c8 commit 4dcc6be

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

.github/workflows/chrome_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
zip:
8+
build:
99
runs-on: ubuntu-latest
1010
steps:
1111
- name: Checkout

.github/workflows/firefox_publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
ignoreFiles: '[ "package.json","package-lock.json","yarn.lock" ]'
2525

2626
- name: "Upload Artifact"
27-
uses: actions/upload-artifact@v3
27+
uses: actions/upload-artifact@v4
2828
with:
2929
name: target.xpi
3030
path: ${{ steps.web-ext-build.outputs.target }}

contentScript.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ function isLocalNetworkURL(url) {
1818

1919
(async () => {
2020
let URL = window.location.toString();
21-
console.log("cursors: contentScript.js: URL: " + URL);
21+
//console.log("cursors: contentScript.js: URL: " + URL);
2222

2323
if (isLocalNetworkURL(URL)) {
24-
console.log("cursors: contentScript.js: URL is on the local-network. Exiting...");
24+
//console.log("cursors: contentScript.js: URL is on the local-network. Exiting...");
2525
return;
2626
}
2727

@@ -33,9 +33,9 @@ function isLocalNetworkURL(url) {
3333
blacklist = await browser.storage.local.get(["cursors.blacklist"]);
3434
}
3535

36-
console.log("cursors: contentScript.js: blacklist: " + blacklist["cursors.blacklist"]);
36+
//console.log("cursors: contentScript.js: blacklist: " + blacklist["cursors.blacklist"]);
3737
if (blacklist["cursors.blacklist"].includes(URL)) {
38-
console.log("contentScript.js: " + URL + " is blacklisted.");
38+
//console.log("contentScript.js: " + URL + " is blacklisted.");
3939
return;
4040
}
4141

@@ -70,6 +70,11 @@ function isLocalNetworkURL(url) {
7070
mousePosition.y = event.pageY;
7171
});
7272

73+
window.addEventListener('beforeunload', (event) => {
74+
//terminate the websocket before leaving the page
75+
terminatePreviousWebSocket();
76+
});
77+
7378
var previousDistanceToBoundaryX = document.documentElement.scrollLeft;
7479
var previousDistanceToBoundaryY = document.documentElement.scrollTop;
7580
window.addEventListener('scroll', (event) => {
@@ -164,14 +169,14 @@ function isLocalNetworkURL(url) {
164169
}
165170

166171
const addClient = (id, skinId) => {
167-
console.log("contentScript.js: addClient: adding client with id: " + id + " and skinId: " + skinId);
172+
//console.log("contentScript.js: addClient: adding client with id: " + id + " and skinId: " + skinId);
168173

169174
cursorUserCounter++;
170175

171176
//create a new cursor element
172177
var cursor = document.createElement("img");
173178
cursor.id = id;
174-
cursor.className = "cursor";
179+
cursor.className = "CursorConnectUniqueCSSClass";
175180

176181
try {
177182
cursor.src = browser.runtime.getURL("customization/cursors/" + skinId + ".png");
@@ -236,17 +241,16 @@ function isLocalNetworkURL(url) {
236241
cursor.style.animation = '';
237242
};
238243

239-
240244
const injectCSS = () => {
241-
var alreadyInjected = document.getElementById("multiCursorStyle");
245+
var alreadyInjected = document.getElementById("CursorConnectUniqueCSSStyle");
242246

243247
if (!alreadyInjected) {
244248
//create a new style element
245249
var style = document.createElement("style");
246-
style.id = "multiCursorStyle";
250+
style.id = "CursorConnectUniqueCSSStyle";
247251
//set the style element content
248252
style.innerHTML = `
249-
.cursor {
253+
.CursorConnectUniqueCSSClass {
250254
position: absolute;
251255
transform: translate(-33%, -23%);
252256
left: -2000px;
@@ -271,12 +275,11 @@ function isLocalNetworkURL(url) {
271275

272276
document.head.appendChild(style);
273277

274-
console.log("cursorConnect: injected css into: " + URL);
278+
//console.log("cursorConnect: injected css into: " + URL);
275279
}
276280
}
277281

278-
terminatePreviousWebSocket();
279-
console.log("cursors: contentScript.js: readyState: " + document.readyState);
282+
//console.log("cursors: contentScript.js: readyState: " + document.readyState);
280283
if (document.readyState == "complete") {
281284
injectCSS();
282285
connectToWebSocket();
@@ -290,7 +293,7 @@ function isLocalNetworkURL(url) {
290293
setInterval(function () {
291294
if (window.location.toString() != URL) {
292295
URL = window.location.toString();
293-
console.log("cursors: contentScript.js: URL changed to: " + URL);
296+
//console.log("cursorConnect: contentScript.js: URL changed to: " + URL);
294297
terminatePreviousWebSocket();
295298
injectCSS();
296299
connectToWebSocket();

platform/chromium/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CursorConnect",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "Real-time cursor interaction for a more connected browsing experience.",
55
"permissions": [
66
"storage",

platform/firefox/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CursorConnect",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "Real-time cursor interaction for a more connected browsing experience.",
55
"browser_specific_settings": {
66
"gecko": {

0 commit comments

Comments
 (0)