Last active
April 6, 2018 05:37
-
-
Save ticky/e3265e2bc35c3fcd7373e00e2b363eb7 to your computer and use it in GitHub Desktop.
JavaScript injected at curcond.drac.at
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* metric 4 lyf mother heckers */ | |
!function (original_parser) { | |
jQuery.ajaxSettings.converters['text json'] = function (json) { | |
return original_parser( | |
json.replace( | |
/([0-9]+)((?:\\u0026|&|)deg;|\s)([CF]|mph)/g, | |
function (match, value, separator, unit) { | |
value = parseInt(value); | |
switch (unit) { | |
case 'F': | |
value = (value - 32) * (5 / 9); | |
unit = 'C'; | |
break; | |
case 'C': | |
value = (value * (9 / 5)) + 32; | |
unit = 'F'; | |
break; | |
case 'mph': | |
value = value * 1.609344; | |
unit = 'km/h'; | |
break; | |
} | |
return Math.round(value) + separator + unit; | |
} | |
) | |
); | |
}; | |
}(jQuery.ajaxSettings.converters['text json']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* this app doesn't need especially specific coords, so keep the geolocation data inaccurate */ | |
!function (getCurrentPosition) { | |
navigator.geolocation.getCurrentPosition = function (success, error, options) { | |
return getCurrentPosition.call( | |
navigator.geolocation, | |
function(location) { | |
success({ | |
coords: Object.assign( | |
{}, | |
location.coords, | |
{ | |
accuracy: location.coords.accuracy * 100, | |
latitude: Math.round(location.coords.latitude * 20) / 20, | |
longitude: Math.round(location.coords.longitude * 20) / 20 | |
} | |
), | |
timestamp: location.timestamp | |
}); | |
}, | |
error, | |
Object.assign( | |
{}, | |
options, | |
{enableHighAccuracy: false} | |
) | |
); | |
}; | |
}(navigator.geolocation.getCurrentPosition) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment