-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
177 lines (151 loc) · 4.94 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html>
<head>
<title>FC24 Mobile Transfer Market Profit Calculator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
/* Mobile-friendly styles */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
body {
min-height: 100vh;
display: flex;
flex-direction: column;
}
h1 {
text-align: center;
padding: 10px;
background-color: #333;
color: white;
margin-top: 0;
}
form {
max-width: 400px;
width: 100%;
margin: 0 auto;
background-color: white;
border-radius: 5px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.2);
position: relative;
padding: 20px;
}
label,
input {
display: block;
margin-bottom: 15px;
}
input[type="number"] {
width: calc(100% - 20px); /* Adjusted width to account for padding */
padding: 10px;
border: 1px solid #ccc;
border-radius: 3px;
}
.button-container {
display: flex;
justify-content: space-between;
align-items: center;
}
button {
flex: 1;
padding: 10px;
background-color: #333;
color: white;
border: none;
border-radius: 3px;
cursor: pointer;
}
/* Add spacing between buttons */
button:first-child {
margin-right: 5px;
}
button:hover {
background-color: #555;
}
#profitResult {
margin-top: 20px;
text-align: center;
font-size: 18px;
color: #333;
}
footer {
color: rgb(86, 88, 105);
text-align: center;
padding: 10px 0;
font-size: 12px;
margin-top: auto; /* Push the footer to the bottom */
}
footer p {
margin: 0;
}
</style>
</head>
<body>
<h1>FC24 Mobile Transfer Market Profit Calculator</h1>
<form id="profitCalculatorForm">
<label for="basePrice">Base Card Price (in gold):</label>
<input type="number" id="basePrice" required />
<label for="currentRank">Current Player Rank:</label>
<input type="number" id="currentRank" required />
<div class="button-container">
<button type="submit">Calculate Profit</button>
<button type="button" id="clearButton" disabled>Clear</button>
</div>
</form>
<div id="profitResult">
<p>Approximate Profitable Price: <span id="profitPrice"></span> gold</p>
</div>
<footer>
<p>
Free Research Preview © 2023 [email protected]. All Rights
Reserved.
</p>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function () {
const form = document.getElementById('profitCalculatorForm');
const clearButton = document.getElementById('clearButton');
const profitPriceDisplay = document.getElementById('profitPrice');
form.addEventListener('submit', function (e) {
e.preventDefault();
// Get values from input fields
const baseCardPurchaseCost = parseFloat(document.getElementById('basePrice').value);
const currentRank = parseInt(document.getElementById('currentRank').value);
const taxRate = 0.10; // 10% tax rate
// Define an array of multipliers for each rank
const rankMultipliers = [1, 2, 4, 9, 19];
// Calculate profitable price based on rank
if (currentRank >= 0 && currentRank < rankMultipliers.length) {
const multiplier = rankMultipliers[currentRank];
const totalCost = (baseCardPurchaseCost * multiplier) + (baseCardPurchaseCost * multiplier * taxRate);
// Format the profitable price as currency
const formattedPrice = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(totalCost);
// Display the formatted profitable price
profitPriceDisplay.textContent = formattedPrice;
} else {
profitPriceDisplay.textContent = "Invalid Rank";
}
});
clearButton.addEventListener('click', function () {
// Clear the form and result
form.reset();
profitPriceDisplay.textContent = '';
});
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('./service-worker.js')
.then(function(registration) {
console.log('Service Worker registered with scope:', registration.scope);
})
.catch(function(error) {
console.error('Service Worker registration failed:', error);
});
}
</script>
</body>
</html>