File tree 2 files changed +22
-5
lines changed 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,25 @@ var MapSwitcherDonation = null;
14
14
15
15
{
16
16
const lastDonationClick = localStorage . stravaMapSwitcherLastDonationClick ;
17
- if ( ! lastDonationClick || ( Date . now ( ) - lastDonationClick ) > 1000 * 86400 * 180 ) {
18
- MapSwitcherDonation = jQuery ( '<a href="https://www.paypal.me/lisknisi/10EUR" target="_blank">♥=€ strava-map-switcher</a>' ) ;
19
- MapSwitcherDonation . click ( function ( ) {
20
- localStorage . stravaMapSwitcherLastDonationClick = Date . now ( ) ;
21
- } ) ;
17
+ const clickedRecently = lastDonationClick && ( Date . now ( ) - lastDonationClick ) < 1000 * 86400 * 180 ;
18
+
19
+ const lastDonationVersion = localStorage . stravaMapSwitcherLastDonationVersion ;
20
+ const thisVersion = localStorage . stravaMapSwitcherVersion ;
21
+ const clickedThisVersion = ! thisVersion || ( lastDonationVersion && thisVersion == lastDonationVersion ) ;
22
+
23
+ if ( ! clickedRecently || ! clickedThisVersion ) {
24
+ MapSwitcherDonation =
25
+ jQuery ( '<a href="https://www.paypal.me/lisknisi/10EUR" target="_blank">' )
26
+ . text ( '♥=€ strava-map-switcher' )
27
+ . css ( { 'font-weight' : 'bold' } )
28
+ . click ( function ( ) {
29
+ localStorage . stravaMapSwitcherLastDonationClick = Date . now ( ) ;
30
+ localStorage . stravaMapSwitcherLastDonationVersion = thisVersion ;
31
+ } ) ;
32
+ } else {
33
+ MapSwitcherDonation =
34
+ jQuery ( '<a href="https://github.com/liskin/strava-map-switcher#readme" target="_blank">' )
35
+ . text ( 'strava-map-switcher' )
36
+ . css ( { 'font-weight' : 'bold' } ) ;
22
37
}
23
38
}
Original file line number Diff line number Diff line change 11
11
*/
12
12
13
13
{
14
+ localStorage . stravaMapSwitcherVersion = chrome . runtime . getManifest ( ) . version ;
15
+
14
16
const s = document . createElement ( "script" ) ;
15
17
s . src = chrome . runtime . getURL ( "load.js" ) ;
16
18
s . type = 'text/javascript' ;
You can’t perform that action at this time.
0 commit comments