Skip to content

Commit

Permalink
Merge pull request #254 from salcido/remove-analytics
Browse files Browse the repository at this point in the history
Remove Analytics
  • Loading branch information
salcido authored Sep 20, 2023
2 parents aff188a + 81784d7 commit 3e86db1
Show file tree
Hide file tree
Showing 33 changed files with 86 additions and 210 deletions.
13 changes: 13 additions & 0 deletions css/dark-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4215,6 +4215,15 @@
}

// Marketplace Buy / Sell buttons
div[class*="content_"] button[class*="_primary"] {
background: var(--button-blue) !important;
div {
color: var(--button-blue-text) !important;
}
&:disabled div {
color: var(--text-muted) !important;
}
}
div[class*="content_"] div[class*="buttons_"] {
// Buy Primary
a[class*="_anchor"][class*="_primary"] {
Expand Down Expand Up @@ -5008,6 +5017,10 @@
}
}
}

div[class*="_wantlistButton"] button {
background: var(--black) !important;
}
}

button[type="submit"][class*="grey_"] {
Expand Down
2 changes: 1 addition & 1 deletion html/learn.html
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ <h2 id="thanks">Thank You</h2>
<li class="donor">JumpOutlet</li>
<li class="donor">Ken B</li>
<li>Kristian N.</li>
<li class="donor">Lewis B.</li>
<li class="donor">Lewis B. <span style="color: #fff;">&#9733;</span></li>
<li class="donor">Lorenzo B.</li>
<li class="donor">Loris D.</li>
<li>Lucas F.</li>
Expand Down
37 changes: 0 additions & 37 deletions js/extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,43 +256,6 @@ chrome.runtime.onConnect.addListener(function(port) {
chrome.contextMenus.removeAll();
updateContextMenus();
}

if (msg.request === 'trackEvent') {

let { uid = false } = await chrome.storage.sync.get(['uid']);

if (!uid) {
uid = Math.random().toString(16).slice(2);
await chrome.storage.sync.set({ uid });
}

async function postData(data = {}) {
let url = 'https://www.google-analytics.com/collect';

await fetch(url, {
method: 'POST',
mode: 'no-cors',
cache: 'no-cache',
credentials: 'same-origin',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
redirect: 'follow',
referrerPolicy: 'no-referrer',
body: data
});
}

let gaParams = new URLSearchParams();
// https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
gaParams.append('v', 1); // protocol version
gaParams.append('tid', 'UA-75073435-1'); // web property ID
gaParams.append('aip', 1); // anonymize IP
gaParams.append('cid', uid);
gaParams.append('t', 'event');
gaParams.append('ec', msg.category);
gaParams.append('ea', msg.action);

await postData(gaParams);
}
});
});

Expand Down
4 changes: 2 additions & 2 deletions js/extension/features/donate-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ rl.ready(() => {
const today = new Date();
const solstices = getSolsticeDates(today.getFullYear());
const isOnOrAfterSummerSolstice = isDateOnOrAfterSolstice(today, solstices.summerSolstice);
const isOnOrAfterWinterSolstice = isDateOnOrAfterSolstice(today, solstices.winterSolstice);
// const isOnOrAfterWinterSolstice = isDateOnOrAfterSolstice(today, solstices.winterSolstice);
const dismissedData = localStorage.getItem('donateModalDismissed');
const dismissed = dismissedData && JSON.parse(dismissedData);

if ((isOnOrAfterSummerSolstice || isOnOrAfterWinterSolstice) && (!dismissed || dismissed.year !== today.getFullYear() || dismissed.solstice !== getUpcomingSolstice(today).getTime())) {
if (isOnOrAfterSummerSolstice && (!dismissed || dismissed.year !== today.getFullYear() || dismissed.solstice !== getUpcomingSolstice(today).getTime())) {
setTimeout(() => {
showModal();
}, 1500);
Expand Down
2 changes: 1 addition & 1 deletion js/extension/features/editing-notepad.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ rl.ready( () => {
const link = document.createElement( 'a' );
link.href = paste.trim();
link.text = paste;
link.target = "_blank";
link.target = '_blank';
link.rel = 'noopener noreferrer';
link.classList.add( notepadLinkClass );

Expand Down
18 changes: 9 additions & 9 deletions js/extension/features/links-in-new-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ rl.ready(() => {
mpSellers = '.shortcut_navigable .seller_info li strong a',
mpThumbs = '.item_picture a',
// Releases
relCompanies = '#release-companies a';
relVersions = '#release-other-versions a';
relRecommends = '#release-recommendations ul[class*="cards_"] a';
relLists = '.de-release #curated-lists a';
relContribs = '#release-contributors a';
relTracklist = '#release-tracklist tr a';
relLastSold = '#release-stats ul li a[href*="/sell/history/"]';
relOtherVers = '.de-release .title a, .de-release .label a';
relCompanies = '#release-companies a',
relVersions = '#release-other-versions a',
relRecommends = '#release-recommendations ul[class*="cards_"] a',
relLists = '.de-release #curated-lists a',
relContribs = '#release-contributors a',
relTracklist = '#release-tracklist tr a',
relLastSold = '#release-stats ul li a[href*="/sell/history/"]',
relOtherVers = '.de-release .title a, .de-release .label a',
// Wantlist
wantThumbs = '[class^="wantlist_"] .image a',
wantTitles = '[class^="wantlist_"] .artist_title a',
Expand Down Expand Up @@ -139,7 +139,7 @@ rl.ready(() => {
window.modifyLinks();
});
}, 200);
})
});
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion js/extension/features/quick-search-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@
document.querySelector('.de-quick-search').addEventListener('click', () => {
window.open('https://www.google.com/search?q=' + encodeURIComponent(query) + additionalText);
});
})
});
});
2 changes: 1 addition & 1 deletion js/extension/features/relative-sold-date-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

lastSold.closest('ul').querySelectorAll('li span').forEach(elem => {
elem.style.width = '75px';
})
});

addMouseListeners(rawDate, relative);
}
Expand Down
6 changes: 3 additions & 3 deletions js/extension/features/release-durations-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@

function collectTrackTimes(source) {

let a = []
let a = [];

source.forEach(time => {

let duration = time.querySelector('td[class*="duration_"]')?.textContent;

if (duration && duration !== '') {

a.push(time.querySelector('td[class*="duration_"]'))
a.push(time.querySelector('td[class*="duration_"]'));
}
})
});

return a;
}
Expand Down
9 changes: 5 additions & 4 deletions js/extension/features/remove-from-wantlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@

rl.ready(() => {

let marketplace = rl.pageIs('myWants');

let regex = /\/seller\/(.+)\/mywants/gi, // Seller has my wants page
marketplace = rl.pageIs('myWants'), // Marketplace Items I Want page
sellerHasWants = regex.test(window.location.href);
// ========================================================
// Functions
// ========================================================
Expand Down Expand Up @@ -114,7 +115,7 @@ rl.ready(() => {
// attached to window object so it can be called by Everlasting Marketplace
window.insertRemoveLinks = function insertRemoveLinks() {

if ( marketplace ) {
if ( marketplace || sellerHasWants ) {

let releases = document.querySelectorAll('.item_release_link');

Expand Down Expand Up @@ -159,7 +160,7 @@ rl.ready(() => {
// DOM Setup
// ========================================================

if ( marketplace ) {
if ( marketplace || sellerHasWants ) {
rl.attachCss('remove-from-wantlist', rules);
window.insertRemoveLinks();

Expand Down
2 changes: 1 addition & 1 deletion js/extension/features/show-actual-dates-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
rl.waitForElement('div[class*="collection_"]').then(() => {

let { featureData } = rl.getItem('userPreferences'),
usDateFormat = featureData.usDateFormat
usDateFormat = featureData.usDateFormat,
copies = document.querySelectorAll('div[class*="collection_"]'),
language = rl.language(),
monthList = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
Expand Down
16 changes: 1 addition & 15 deletions js/extension/user-preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -1228,24 +1228,10 @@ appendFragment([resourceLibrary])

if (oldPrefs.newBlockedSellers.length > 0) {

let uniqueBlockedSellers = [...new Set(oldPrefs.newBlockedSellers)],
sendEvents = true;

if (featureData.blockList.list.includes('development')) {
sendEvents = false;
}
let uniqueBlockedSellers = [...new Set(oldPrefs.newBlockedSellers)];

uniqueBlockedSellers.forEach(seller => {
featureData.blockList.list.push(seller);

if (sendEvents) {
let port = chrome.runtime.connect();
port.postMessage({
request: 'trackEvent',
category: 'block seller',
action: seller
});
}
});
}

Expand Down
2 changes: 1 addition & 1 deletion js/popup/change-log.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
description: 'The Tag Seller Rating feature now lets you hide new sellers in the Marketplace. Expand the feature menu and click the Hide New Sellers checkbox to enable it.'
},
],
thanks: ['Massive thank you to Archibald, Arturo, Britney, Charlie, Chris, Daniel, Douglas, Fabian, Frederic, Henrik, James, Jeffrey, Jesper, Johan, Johannes, Jonathan, Jordan, Lorenzo, Loris, Lukas, Łukasz, Mania, Marc, Marcel, Mark, Mike, Nathan, Nicholas, Niko\'s Records, Noah, Pangiotis, Paul, Paull, Peter, Robert, Ryan, Simon, Socrates, Stewart William, and Willem for the kind donations! I am overwhelmed by your generosity. 🥲'],
thanks: ['Massive thank you to Lewis B. and Britany for the kind donations!'],
},
],
previous: []
Expand Down
22 changes: 10 additions & 12 deletions js/popup/configuration-pages/favorite-sellers.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
document.addEventListener('DOMContentLoaded', async () => {

let { featureData } = await chrome.storage.sync.get(['featureData']),
blockList = featureData.blockList,
initialFavoriteList = featureData.favoriteList,
blocklistError = 'is on your block list. You must remove them from your block list before adding them as a favorite.',
favoriteListError = 'is already on your favorites list.';
blockList = featureData.blockList,
initialFavoriteList = featureData.favoriteList,
blocklistError = 'is on your block list. You must remove them from your block list before adding them as a favorite.',
favoriteListError = 'is already on your favorites list.';

// ========================================================
// Functions (Alphabetical)
Expand Down Expand Up @@ -42,8 +42,6 @@ document.addEventListener('DOMContentLoaded', async () => {
input = input.replace(/\s/g, '').trim();

if ( input ) {
// ga(type, category, action, label)
// if ( window.ga ) { window.ga('send', 'event', 'favorite seller', input); }

chrome.storage.sync.get(['featureData']).then(({ featureData }) => {
featureData.favoriteList.list.push(input);
Expand All @@ -52,7 +50,7 @@ document.addEventListener('DOMContentLoaded', async () => {
document.querySelector('.errors').textContent = '';
return location.reload();
});
})
});
}
}

Expand Down Expand Up @@ -126,12 +124,12 @@ document.addEventListener('DOMContentLoaded', async () => {

featureData.favoriteList.list.splice(i, 1);
chrome.storage.sync.set({ featureData });
initialFavoriteList = featureData.favoriteList
initialFavoriteList = featureData.favoriteList;

return setTimeout(() => updatePageData(), 400);
}
});
})
});
}

/**
Expand Down Expand Up @@ -163,7 +161,7 @@ document.addEventListener('DOMContentLoaded', async () => {
document.querySelector('.backup-output').textContent = JSON.stringify(featureData.favoriteList.list);
// check for empty list
checkForEmptySellersList();
})
});
}

/**
Expand Down Expand Up @@ -236,8 +234,8 @@ document.addEventListener('DOMContentLoaded', async () => {
featureData.favoriteList = restore;
chrome.storage.sync.set({ featureData }).then(() => {
return location.reload();
})
})
});
});

} else {

Expand Down
4 changes: 2 additions & 2 deletions js/popup/popup-logic/features/absolute-date.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function init() {
chrome.storage.sync.get(['featureData']).then(({ featureData }) => {
featureData.usDateFormat = this.checked;
chrome.storage.sync.set({ featureData });
})
});
});

// Setup example US date format
Expand Down Expand Up @@ -65,6 +65,6 @@ export function setAbsoluteDateStatus() {
// Setup US Date Format checkbox preference
chrome.storage.sync.get(['featureData']).then(({ featureData }) => {
document.getElementById('usFormat').checked = JSON.parse(featureData.usDateFormat);
})
});
});
}
2 changes: 1 addition & 1 deletion js/popup/popup-logic/features/baoi-fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ export async function toggleBAOIfields(event) {
chrome.scripting.executeScript({
target: {tabId: tabId},
files: ['js/extension/features/toggle-baoi-fields.js']
}, () => { applySave(null, event) });
}, () => { applySave(null, event); });
}
7 changes: 3 additions & 4 deletions js/popup/popup-logic/features/filter-media-condition.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Filter Media Condition feature
*/

import { applySave, optionsToggle, sendEvent } from '../utils';
import { applySave, optionsToggle } from '../utils';

/**
* These arrays corespond to the `.status` string [conditions] and
Expand Down Expand Up @@ -42,7 +42,6 @@ export function init() {

featureData.mediaCondition = JSON.parse(this.value);
chrome.storage.sync.set({ featureData });
sendEvent('Filter Media Condition', conditions[this.value]);

if (!toggle.checked) {

Expand Down Expand Up @@ -85,7 +84,7 @@ export function setupFilterByCondition(enabled) {
if ( mediaCondition ) {
select.value = mediaCondition;
}
})
});
}

/**
Expand All @@ -111,5 +110,5 @@ export function toggleHideConditions(event) {
}

applySave('refresh', event);
})
});
}
Loading

0 comments on commit 3e86db1

Please sign in to comment.