Spaces:
Running
Running
Upload 5 files
#5
by
Soluses
- opened
- (content.js) +15 -0
- manifest.json +28 -0
- popup.css +22 -0
- popup.html +17 -0
- popup.js +45 -0
(content.js)
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Function to calculate metrics and modify the DOM
|
2 |
+
function calculateMetrics() {
|
3 |
+
// Extract necessary data from the OnlyFans profile page
|
4 |
+
// Perform calculations and create additional metrics
|
5 |
+
// Modify the DOM to display the metrics next to the user's profile
|
6 |
+
|
7 |
+
// Example: Adding a metric to the page
|
8 |
+
const metricsContainer = document.getElementById('metrics');
|
9 |
+
const metricElement = document.createElement('p');
|
10 |
+
metricElement.textContent = 'Follow Ratio: 2.5';
|
11 |
+
metricsContainer.appendChild(metricElement);
|
12 |
+
}
|
13 |
+
|
14 |
+
// Execute the content script when the page finishes loading
|
15 |
+
window.addEventListener('load', calculateMetrics);
|
manifest.json
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"manifest_version": 2,
|
3 |
+
"name": "OnlyFans Metrics",
|
4 |
+
"version": "1.0",
|
5 |
+
"description": "Add metrics and insights to OnlyFans profiles",
|
6 |
+
"icons": {
|
7 |
+
"16": "icon.png",
|
8 |
+
"48": "icon.png",
|
9 |
+
"128": "icon.png"
|
10 |
+
},
|
11 |
+
"permissions": [
|
12 |
+
"https://www.onlyfans.com/*",
|
13 |
+
"storage"
|
14 |
+
],
|
15 |
+
"content_scripts": [
|
16 |
+
{
|
17 |
+
"matches": ["https://www.onlyfans.com/*"],
|
18 |
+
"js": ["content.js"]
|
19 |
+
}
|
20 |
+
],
|
21 |
+
"browser_action": {
|
22 |
+
"default_icon": {
|
23 |
+
"16": "icon.png",
|
24 |
+
"48": "icon.png"
|
25 |
+
},
|
26 |
+
"default_popup": "popup.html"
|
27 |
+
}
|
28 |
+
}
|
popup.css
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Add your custom styles here */
|
2 |
+
|
3 |
+
#metrics {
|
4 |
+
font-family: Arial, sans-serif;
|
5 |
+
padding: 10px;
|
6 |
+
}
|
7 |
+
|
8 |
+
p {
|
9 |
+
margin: 0;
|
10 |
+
}
|
11 |
+
|
12 |
+
.metric {
|
13 |
+
margin-bottom: 10px;
|
14 |
+
}
|
15 |
+
|
16 |
+
.metric-label {
|
17 |
+
font-weight: bold;
|
18 |
+
}
|
19 |
+
|
20 |
+
.metric-value {
|
21 |
+
color: #333;
|
22 |
+
}
|
popup.html
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>OnlyFans Metrics</title>
|
5 |
+
<link rel="stylesheet" type="text/css" href="popup.css">
|
6 |
+
</head>
|
7 |
+
<body>
|
8 |
+
<div id="metrics">
|
9 |
+
<div class="metric">
|
10 |
+
<p class="metric-label">Follow Ratio:</p>
|
11 |
+
<p class="metric-value">2.5</p>
|
12 |
+
</div>
|
13 |
+
<!-- Add more metrics using the same structure -->
|
14 |
+
</div>
|
15 |
+
<script src="popup.js"></script>
|
16 |
+
</body>
|
17 |
+
</html>
|
popup.js
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Add any necessary functionality for the popup
|
2 |
+
|
3 |
+
document.addEventListener('DOMContentLoaded', function () {
|
4 |
+
// Access the DOM elements
|
5 |
+
var metricsContainer = document.getElementById('metrics');
|
6 |
+
var refreshButton = document.getElementById('refreshButton');
|
7 |
+
|
8 |
+
// Function to refresh the metrics
|
9 |
+
function refreshMetrics() {
|
10 |
+
// Clear the metrics container
|
11 |
+
metricsContainer.innerHTML = '';
|
12 |
+
|
13 |
+
// Send a message to the content script to recalculate metrics
|
14 |
+
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
|
15 |
+
chrome.tabs.sendMessage(tabs[0].id, { action: 'recalculateMetrics' }, function (response) {
|
16 |
+
// Handle the response from the content script
|
17 |
+
if (response && response.metrics) {
|
18 |
+
// Display the metrics in the popup
|
19 |
+
response.metrics.forEach(function (metric) {
|
20 |
+
var metricElement = document.createElement('div');
|
21 |
+
metricElement.classList.add('metric');
|
22 |
+
|
23 |
+
var labelElement = document.createElement('p');
|
24 |
+
labelElement.classList.add('metric-label');
|
25 |
+
labelElement.textContent = metric.label;
|
26 |
+
|
27 |
+
var valueElement = document.createElement('p');
|
28 |
+
valueElement.classList.add('metric-value');
|
29 |
+
valueElement.textContent = metric.value;
|
30 |
+
|
31 |
+
metricElement.appendChild(labelElement);
|
32 |
+
metricElement.appendChild(valueElement);
|
33 |
+
metricsContainer.appendChild(metricElement);
|
34 |
+
});
|
35 |
+
}
|
36 |
+
});
|
37 |
+
});
|
38 |
+
}
|
39 |
+
|
40 |
+
// Add an event listener to the refresh button
|
41 |
+
refreshButton.addEventListener('click', refreshMetrics);
|
42 |
+
|
43 |
+
// Initial refresh of the metrics when the popup is opened
|
44 |
+
refreshMetrics();
|
45 |
+
});
|