26 lines
796 B
JavaScript
26 lines
796 B
JavaScript
/**
|
|
* Fetches CSRF Token from page
|
|
*/
|
|
function getCsrfToken() {
|
|
return { 'X-XSRF-TOKEN': document.getElementsByName('__RequestVerificationToken')[0].value }
|
|
}
|
|
|
|
async function getAnnotationParams(leftInInch = 0, topInInch = 0, inchToPointFactor = 72) {
|
|
|
|
const annotParams = await fetch(`${window.location.origin}/api/Config/Annotations`, {
|
|
credentials: 'include',
|
|
method: 'GET'
|
|
})
|
|
.then(res => res.json());
|
|
|
|
for (var key in annotParams) {
|
|
var annot = annotParams[key];
|
|
annot.width *= inchToPointFactor;
|
|
annot.height *= inchToPointFactor;
|
|
annot.left += leftInInch - 0.7;
|
|
annot.left *= inchToPointFactor;
|
|
annot.top += topInInch - 0.5;
|
|
annot.top *= inchToPointFactor;
|
|
}
|
|
return annotParams;
|
|
} |