-
Notifications
You must be signed in to change notification settings - Fork 0
/
rangeslider.html
221 lines (192 loc) · 9.13 KB
/
rangeslider.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html>
<head>
<title>Creator</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/regular.min.css" integrity="sha512-WidMaWaNmZqjk3gDE6KBFCoDpBz9stTsTZZTeocfq/eDNkLfpakEd7qR0bPejvy/x0iT0dvzIq4IirnBtVer5A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="shortcut icon" href="svg/favicon.svg" type="image/x-icon">
<style>
.forecast-earning .circle {
position: absolute;
width: 20px;
height: 20px;
background: rgba(118, 76, 194, 0.49);
border-radius: 50%;
}
.forecast-earning .our-forecast {
margin-left: 25px;
}
.forecast-description {
font-family: 'Inter';
font-style: normal;
font-weight: 400;
font-size: 16px;
line-height: 140.5%;
color: #565656;
width: 470px;
padding: 0px 20px;
}
.result-with-text .total-earning {
font-family: 'Inter';
font-style: normal;
font-weight: 500;
font-size: 24px;
line-height: 29px;
text-transform: capitalize;
color: #764CC2;
position: relative;
left: 30px;
}
</style>
</head>
<body>
<header style="height: 67px;">
<nav class="navbar navbar-expand-lg navbar-light bg-light" style="height: 67px; border-bottom: 1px solid #000000;">
<div class="container">
<a class="navbar-brand" href="index.html">aBit</a>
<!-- <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button> -->
<div class="expand navbar-expand" id="navbarTogglerDemo02">
<ul class="navbar-nav ml-auto mt-lg-0 ">
<li class="nav-item active">
<a class="nav-link nav-item-creator" href="creatorpage.html" style="text-decoration-color: #b497ea;">Are you a creator? <span class="sr-only">(current)</span></a>
</li>
</ul>
<!-- <button class="btn abit-outline-purple my-2 my-sm-0" data-toggle="modal" data-target="#registerModal">Login / Signup</button> -->
</div>
</div>
</nav>
</header>
<div class="container mt-5 cr-common-section">
<!-- <h3>Range Slider</h3>
<div class="form-group">
<label for="audienceEarnings">Audience Earnings:</label>
<input type="text" class="form-control" id="audienceEarnings" readonly>
</div> -->
<div id="accordion2" class="mt-5 cstm-accordian">
<div class="card mb-5 cstm-card" style="width: 80%;">
<div class="card-header text-left" id="headingOne">
<h5 class="mb-0">
<button class="btn p-0 shadow-none" data-toggle="collapse" data-target="#collapseOne2f" aria-expanded="true" aria-controls="collapseOne">
Forecast your earnings.
</button>
<img src="svg/icons/plus-circle-icon.svg" alt="plusicon" class="float-right plus-icon d-none toggle-icon">
<img src="svg/icons/minus-icon.svg" alt="minuscon" class="float-right minus-icon toggle-icon">
</h5>
</div>
<div id="collapseOne2" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion2" style="height: 400px;">
<p class="forecast-description" >The more it views, the more you earn.
Explore potential earnings for this new video by Dan Mace.
Use the slider to see how much you could earn.</p>
<div class="forecast-earning" style="padding: 0px 20px;">
<span class="circle"></span><span class="our-forecast"><i>Our Forecast</i></span>
</div>
<div class="card-body pt-0" style="position: relative; top: 150px;">
<div class="result-with-text"></div>
<div class="slider-container">
<input type="text" id="slider2" class="slider" />
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="mt-4 section-footer border-top">
<div class="container" style="margin-top: 76px;">
<div class="row">
<div class="col-lg-6 col-md-6 col-xs-4 col-sm-5 col-6">
<!-- <h3 class="heading">aBit</h3> -->
<p class="description">Own <span class="heading">aBit</span> of your favourite videos.</p>
</div>
<div class="col-lg-6 col-md-6 col-sm-7 col-6">
<ul class="list-group border-left float-right">
<a href="index.html"><li class="list-group-item border-0">Home</li></a>
<a href="creatorpage.html"><li class="list-group-item border-0">Are you a creator?</li></a>
<!-- <li class="list-group-item border-0">Support</li> -->
</ul>
</div>
</div>
</div>
</footer>
<script src="js/rSlider.js"></script>
<script src="js/loadExtLibrary.js"></script>
<script src="js/main.js"></script>
<!-- <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> -->
<script>
(function () {
'use strict';
var init = function () {
var slider2 = new rSlider({
target: '#slider2',
values: ['5k', '10k', '15k', '20k', '25k', '30k', '35k', '40k', '45k', '50k', '55k', '60k', '65k', '70k', '75k', '80k', '85k', '90k', '95k', '100k'],
range: false,
set: ['50k'],
tooltip: false,
labels: false,
onChange: function (vals, activePointer) {
console.log(vals);
debugger
let activeSpan = $('.rs-scale').find("span")[activePointer];
$('.rs-scale').find("span").removeClass("activePointer");
$('.rs-scale').find("span .rs-transparent-rectangle").remove();
$(activeSpan).append(`<div class="rs-transparent-rectangle"></div>`);
$(activeSpan).addClass("activePointer");
// $(activeSpan).attr("data-earnings", 4.80);
$('.result-with-text').css({
'position': 'relative',
'left': ($(activeSpan).position().left - 60),
'top': '-100px'
})
calculateAudienceEarnings(activeSpan);
}
});
var slider3 = new rSlider({
target: '#slider3',
values: {min: 0, max: 100},
step: 10,
range: true,
set: [10, 40],
scale: true,
labels: false,
onChange: function (vals) {
console.log(vals);
}
});
var slider = new rSlider({
target: '#slider',
values: [2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015],
range: true,
set: [2010, 2013],
onChange: function (vals) {
console.log(vals);
}
});
};
window.onload = init;
// Update audience earnings on input change
$('#earningsPerView, #slider2, #ownershipPercentage').on('input', calculateAudienceEarnings);
// Calculate audience earnings
function calculateAudienceEarnings(activeElem) {
debugger;
var valueInK = $('#slider2').val();
var views = parseInt(valueInK.split("k")[0]) * 1000;
//var views = parseInt($('#slider2').val());
var percentage = parseFloat(0.24) / 100;
var earningsPerView = parseFloat(0.005);
var audienceEarnings = (views * earningsPerView) * percentage;
$('.result-with-text').html(`<div class="total-earning">$${audienceEarnings.toFixed(2)}</div><span>Annualized Payout est.</span>`);
$(activeElem).attr("data-earnings", "$" + audienceEarnings.toFixed(2));
$('#audienceEarnings').val('$' + audienceEarnings.toFixed(2));
}
// Format number with commas
function formatNumber(number) {
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
})();
</script>
</body>
</html>