Skip to content

Commit 643157c

Browse files
committed
Merge branch 'develop' of https://github.com/EverexIO/Ethplorer into develop
2 parents 94177cc + 199bad0 commit 643157c

File tree

6 files changed

+153
-30
lines changed

6 files changed

+153
-30
lines changed

api/controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ public function getAddressPriceHistoryGrouped(){
510510
$this->sendError(104, 'Invalid address format');
511511
}
512512
}
513-
$withEth = (isset($_GET["withEth"]) && $_GET["withEth"]) ? TRUE : FALSE;
513+
$withEth = (isset($_GET["withEth"]) && (bool)$_GET["withEth"]) ? TRUE : FALSE;
514514
$result = array('history' => $this->db->getAddressPriceHistoryGrouped($address, FALSE, $withEth));
515515
if(isset($result['history']['cache'])) $this->cacheState = $result['history']['cache'];
516516
else $this->cacheState = '';

api/widget.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ ethplorerWidget = {
161161
apiKey: 'ethplorer.widget',
162162
domain: document.location.href,
163163
period: 730,
164-
withEth: preloadMethod.options.withEth ? preloadMethod.options.withEth : false,
164+
withEth: preloadMethod.options.withEth ? preloadMethod.options.withEth : '',
165165
};
166166

167167
$.getJSON(api, params, function(_address){

css/cookie-notify.css

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#cookie-notification {
2+
font-family: 'Open Sans', sans-serif;
3+
font-size: 13px;
4+
position: fixed;
5+
z-index: 1000;
6+
width: 100%;
7+
bottom: 0;
8+
padding: 10px 0;
9+
background: #eaeaea;
10+
}
11+
12+
#cookie-notification span span {
13+
white-space: nowrap;
14+
}
15+
16+
#cookie-notification span:first-child {
17+
padding-bottom: 7px;
18+
display: inline-block;
19+
margin-right: 10px;
20+
}
21+
22+
@media (min-width: 992px) {
23+
#cookie-notification .cn-container {
24+
width: 970px;
25+
}
26+
}
27+
28+
@media (min-width: 768px) {
29+
#cookie-notification .cn-container {
30+
width: 750px;
31+
}
32+
}
33+
34+
@media (min-width: 992px) {
35+
#cookie-notification .cn-container {
36+
width: 970px;
37+
}
38+
}
39+
40+
@media (min-width: 1200px) {
41+
#cookie-notification .cn-container {
42+
width: 1170px;
43+
}
44+
}
45+
46+
#cookie-notification .cn-container {
47+
padding-right: 15px;
48+
padding-left: 15px;
49+
margin-right: auto;
50+
margin-left: auto;
51+
}
52+
#cookie-notification .text-center {
53+
text-align: center;
54+
}
55+
56+
#cookie-notification .cn-btn-group-lg > .cn-btn, #cookie-notification .cn-btn-lg {
57+
padding: 10px 16px;
58+
font-size: 18px;
59+
line-height: 1.3333333;
60+
border-radius: 6px;
61+
}
62+
63+
#cookie-notification .cn-btn-primary {
64+
color: #fff;
65+
background-color: #337ab7;
66+
border-color: #2e6da4;
67+
}
68+
69+
#cookie-notification .cn-btn-primary:hover {
70+
color: #fff;
71+
background-color: #2c679b;
72+
border-color: #2e6da4;
73+
}
74+
75+
#cookie-notification .cn-btn-block {
76+
display: block;
77+
}
78+
79+
#cookie-notification .cn-btn {
80+
display: inline-block;
81+
text-decoration: none;
82+
padding: 6px 12px;
83+
margin-bottom: 0;
84+
font-size: 14px;
85+
font-weight: 400;
86+
line-height: 1.42857143;
87+
text-align: center;
88+
white-space: nowrap;
89+
vertical-align: middle;
90+
-ms-touch-action: manipulation;
91+
touch-action: manipulation;
92+
cursor: pointer;
93+
-webkit-user-select: none;
94+
-moz-user-select: none;
95+
-ms-user-select: none;
96+
user-select: none;
97+
background-image: none;
98+
border: 1px solid transparent;
99+
border-radius: 4px;
100+
}
101+
102+
#cookie-notification .visible-xs-inline-block {
103+
display: none !important;
104+
}
105+
106+
@media (max-width: 767px) {
107+
#cookie-notification .hidden-xs {
108+
display: none !important;
109+
}
110+
111+
#cookie-notification .visible-xs-inline-block {
112+
display: inline-block !important;
113+
}
114+
115+
#cookie-notification .cn-btn-block {
116+
display: block !important;
117+
}
118+
}
119+
120+
#cookie-notification a:not(.cn-btn) {
121+
color: #47C2FF !important;
122+
display: inline-block;
123+
}

index.php

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@
6868
}
6969

7070
$withEth = false;
71-
if(isset($_GET['withEth']) && $_GET['withEth']){
72-
$withEth = $_GET['withEth'];
71+
if((isset($_GET['withEth']) && (bool)$_GET['withEth']) || (isset($_GET['witheth']) && (bool)$_GET['witheth'])){
72+
$withEth = true;
7373
}
7474

7575
$hasNotes = isset($aConfig['adv']) && count($aConfig['adv']);
@@ -818,30 +818,6 @@
818818
fbq('track', 'PageView');
819819
}
820820
<?php if(isset($aConfig['scriptAddon'])) echo $aConfig['scriptAddon']; ?></script>
821-
<div id="cookie-notification" class="hidden">
822-
<div class="container text-center">
823-
<div class="row">
824-
<div class="col-xs-12">
825-
<span>This website uses cookies to ensure you get the best experience on our website.</span>
826-
<a class="agree-using-cookies btn btn-lg btn-primary hidden-xs" href="">Got it</a>
827-
<a class="agree-using-cookies btn btn-lg btn-block btn-primary visible-xs-inline-block" href="">Got it</a>
828-
</div>
829-
</div>
830-
</div>
831-
</div>
832-
<script>
833-
var matches = document.cookie.match(new RegExp("(?:^|; )agree_to_use=([^;]*)"));
834-
var agreeToUseCookie = matches ? decodeURIComponent(matches[1]) : undefined;
835-
if (!agreeToUseCookie) {
836-
$('#cookie-notification').removeClass('hidden');
837-
$('.agree-using-cookies').on('click', function() {
838-
var date = new Date();
839-
date.setFullYear(date.getFullYear() + 2); // + 2 years
840-
document.cookie = 'agree_to_use=' + Date.now() + '; path=/; expires=' + date.toUTCString();
841-
$('#cookie-notification').addClass('hide');
842-
return false;
843-
});
844-
}
845-
</script>
821+
<script src="/js/cookie-notify.js" async></script>
846822
</body>
847823
</html>

js/cookie-notify.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
$('head').append('<link rel="stylesheet" type="text/css" href="/css/cookie-notify.css">');
2+
$(document).ready(function() {
3+
var template = $('<div id="cookie-notification">' +
4+
'<div class="cn-container text-center">' +
5+
'<span>We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies. <span>Find out more in <a href="https://ethplorer.io/privacy" target="_blank">Privacy Policy</a>.</span></span>' +
6+
'<a class="agree-using-cookies cn-btn cn-btn-lg cn-btn-primary hidden-xs" href="">Got it</a>' +
7+
'<a class="agree-using-cookies cn-btn cn-btn-lg cn-btn-block cn-btn-primary visible-xs-inline-block" href="">Got it</a>' +
8+
'</div>'+
9+
'</div>');
10+
11+
// checking cookie
12+
var matches = document.cookie.match(new RegExp("(?:^|; )agree_to_use=([^;]*)"));
13+
var agreeToUseCookie = matches && decodeURIComponent(matches[1]);
14+
if (!agreeToUseCookie) {
15+
$('body').append(template);
16+
template.hide().fadeIn(300);
17+
$('.agree-using-cookies').on('click', function() {
18+
var date = new Date();
19+
date.setFullYear(date.getFullYear() + 2); // + 2 years
20+
document.cookie = 'agree_to_use=' + Date.now() + '; path=/; expires=' + date.toUTCString();
21+
$('#cookie-notification').fadeOut(500);
22+
return false;
23+
});
24+
}
25+
});

service/lib/ethplorer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,6 @@ public function getTokenPriceHistoryGrouped($address, $period = 365, $type = 'da
27712771
}
27722772

27732773
public function getAddressPriceHistoryGrouped($address, $updateCache = FALSE, $withEth = FALSE){
2774-
$withEth = FALSE;
27752774
evxProfiler::checkpoint('getAddressPriceHistoryGrouped', 'START', 'address=' . $address . ', withEth=' . ($withEth ? 'TRUE' : 'FALSE'));
27762775

27772776
$cache = 'address_operations_history-' . $address . ($withEth ? '-eth' : '');

0 commit comments

Comments
 (0)