mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-23 22:55:39 +00:00
159 lines
7.8 KiB
XML
159 lines
7.8 KiB
XML
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64">
|
||
|
<script xmlns="http://www.w3.org/1999/xhtml">(function () {
|
||
|
function hookGeo() {
|
||
|
//<![CDATA[
|
||
|
const WAIT_TIME = 100;
|
||
|
const hookedObj = {
|
||
|
getCurrentPosition: navigator.geolocation.getCurrentPosition.bind(navigator.geolocation),
|
||
|
watchPosition: navigator.geolocation.watchPosition.bind(navigator.geolocation),
|
||
|
fakeGeo: true,
|
||
|
genLat: 38.883333,
|
||
|
genLon: -77.000
|
||
|
};
|
||
|
|
||
|
function waitGetCurrentPosition() {
|
||
|
if ((typeof hookedObj.fakeGeo !== 'undefined')) {
|
||
|
if (hookedObj.fakeGeo === true) {
|
||
|
hookedObj.tmp_successCallback({
|
||
|
coords: {
|
||
|
latitude: hookedObj.genLat,
|
||
|
longitude: hookedObj.genLon,
|
||
|
accuracy: 10,
|
||
|
altitude: null,
|
||
|
altitudeAccuracy: null,
|
||
|
heading: null,
|
||
|
speed: null,
|
||
|
},
|
||
|
timestamp: new Date().getTime(),
|
||
|
});
|
||
|
} else {
|
||
|
hookedObj.getCurrentPosition(hookedObj.tmp_successCallback, hookedObj.tmp_errorCallback, hookedObj.tmp_options);
|
||
|
}
|
||
|
} else {
|
||
|
setTimeout(waitGetCurrentPosition, WAIT_TIME);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function waitWatchPosition() {
|
||
|
if ((typeof hookedObj.fakeGeo !== 'undefined')) {
|
||
|
if (hookedObj.fakeGeo === true) {
|
||
|
navigator.getCurrentPosition(hookedObj.tmp2_successCallback, hookedObj.tmp2_errorCallback, hookedObj.tmp2_options);
|
||
|
return Math.floor(Math.random() * 10000); // random id
|
||
|
} else {
|
||
|
hookedObj.watchPosition(hookedObj.tmp2_successCallback, hookedObj.tmp2_errorCallback, hookedObj.tmp2_options);
|
||
|
}
|
||
|
} else {
|
||
|
setTimeout(waitWatchPosition, WAIT_TIME);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Object.getPrototypeOf(navigator.geolocation).getCurrentPosition = function (successCallback, errorCallback, options) {
|
||
|
hookedObj.tmp_successCallback = successCallback;
|
||
|
hookedObj.tmp_errorCallback = errorCallback;
|
||
|
hookedObj.tmp_options = options;
|
||
|
waitGetCurrentPosition();
|
||
|
};
|
||
|
Object.getPrototypeOf(navigator.geolocation).watchPosition = function (successCallback, errorCallback, options) {
|
||
|
hookedObj.tmp2_successCallback = successCallback;
|
||
|
hookedObj.tmp2_errorCallback = errorCallback;
|
||
|
hookedObj.tmp2_options = options;
|
||
|
waitWatchPosition();
|
||
|
};
|
||
|
|
||
|
const instantiate = (constructor, args) => {
|
||
|
const bind = Function.bind;
|
||
|
const unbind = bind.bind(bind);
|
||
|
return new (unbind(constructor, null).apply(null, args));
|
||
|
}
|
||
|
|
||
|
Blob = function (_Blob) {
|
||
|
function secureBlob(...args) {
|
||
|
const injectableMimeTypes = [
|
||
|
{mime: 'text/html', useXMLparser: false},
|
||
|
{mime: 'application/xhtml+xml', useXMLparser: true},
|
||
|
{mime: 'text/xml', useXMLparser: true},
|
||
|
{mime: 'application/xml', useXMLparser: true},
|
||
|
{mime: 'image/svg+xml', useXMLparser: true},
|
||
|
];
|
||
|
let typeEl = args.find(arg => (typeof arg === 'object') && (typeof arg.type === 'string') && (arg.type));
|
||
|
|
||
|
if (typeof typeEl !== 'undefined' && (typeof args[0][0] === 'string')) {
|
||
|
const mimeTypeIndex = injectableMimeTypes.findIndex(mimeType => mimeType.mime.toLowerCase() === typeEl.type.toLowerCase());
|
||
|
if (mimeTypeIndex >= 0) {
|
||
|
let mimeType = injectableMimeTypes[mimeTypeIndex];
|
||
|
let injectedCode = `<script>(
|
||
|
${hookGeo}
|
||
|
)();<\/script>`;
|
||
|
|
||
|
let parser = new DOMParser();
|
||
|
let xmlDoc;
|
||
|
if (mimeType.useXMLparser === true) {
|
||
|
xmlDoc = parser.parseFromString(args[0].join(''), mimeType.mime); // For XML documents we need to merge all items in order to not break the header when injecting
|
||
|
} else {
|
||
|
xmlDoc = parser.parseFromString(args[0][0], mimeType.mime);
|
||
|
}
|
||
|
|
||
|
if (xmlDoc.getElementsByTagName("parsererror").length === 0) { // if no errors were found while parsing...
|
||
|
xmlDoc.documentElement.insertAdjacentHTML('afterbegin', injectedCode);
|
||
|
|
||
|
if (mimeType.useXMLparser === true) {
|
||
|
args[0] = [new XMLSerializer().serializeToString(xmlDoc)];
|
||
|
} else {
|
||
|
args[0][0] = xmlDoc.documentElement.outerHTML;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return instantiate(_Blob, args); // arguments?
|
||
|
}
|
||
|
|
||
|
// Copy props and methods
|
||
|
let propNames = Object.getOwnPropertyNames(_Blob);
|
||
|
for (let i = 0; i < propNames.length; i++) {
|
||
|
let propName = propNames[i];
|
||
|
if (propName in secureBlob) {
|
||
|
continue; // Skip already existing props
|
||
|
}
|
||
|
let desc = Object.getOwnPropertyDescriptor(_Blob, propName);
|
||
|
Object.defineProperty(secureBlob, propName, desc);
|
||
|
}
|
||
|
|
||
|
secureBlob.prototype = _Blob.prototype;
|
||
|
return secureBlob;
|
||
|
}(Blob);
|
||
|
|
||
|
window.addEventListener('message', function (event) {
|
||
|
if (event.source !== window) {
|
||
|
return;
|
||
|
}
|
||
|
const message = event.data;
|
||
|
switch (message.method) {
|
||
|
case 'updateLocation':
|
||
|
if ((typeof message.info === 'object') && (typeof message.info.coords === 'object')) {
|
||
|
hookedObj.genLat = message.info.coords.lat;
|
||
|
hookedObj.genLon = message.info.coords.lon;
|
||
|
hookedObj.fakeGeo = message.info.fakeIt;
|
||
|
}
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}, false);
|
||
|
//]]>
|
||
|
}
|
||
|
|
||
|
hookGeo();
|
||
|
})()</script>
|
||
|
<path xmlns="http://www.w3.org/2000/svg"
|
||
|
d="m52 62v-43.1c0-8.4-4-15-14-15-7.3 0-12 5.6-12 13.1h-2c0-9.4 5.7-15 14-15 10.7 0 16 6.6 16 16.9v43.1h-2"
|
||
|
fill="#d0d0d0"/>
|
||
|
<path xmlns="http://www.w3.org/2000/svg"
|
||
|
d="m40 33.1c0 16-6.7 28.9-15 28.9-8.3 0-15-12.9-15-28.9 0-9.8 6.7-22.7 15-22.7 8.3 0 15 12.9 15 22.7"
|
||
|
fill="#3e4347"/>
|
||
|
<g xmlns="http://www.w3.org/2000/svg" fill="#94989b">
|
||
|
<path d="m15.2 25.5c-.7 2.5-1.2 5.1-1.2 7.6 0 4.9.6 9.3 1.6 13.1.3-.5.6-1 1-1.6 5.8-10.5 2.5-16.1-1.4-19.1"/>
|
||
|
<path d="m34.8 25.5c-3.9 2.9-7.2 8.6-1.4 19 .3.6.7 1.1 1 1.6 1-3.8 1.6-8.3 1.6-13.1 0-2.4-.4-5-1.2-7.5"/>
|
||
|
</g>
|
||
|
<ellipse xmlns="http://www.w3.org/2000/svg" cx="25" cy="21.7" rx="6" ry="5.6" fill="#ed4c5c"/>
|
||
|
</a0:svg>
|