Skip to content

Instantly share code, notes, and snippets.

@brandonhellman
Last active October 5, 2018 23:51
Show Gist options
  • Save brandonhellman/4771000278c91be203aa1cfa94b026dc to your computer and use it in GitHub Desktop.
Save brandonhellman/4771000278c91be203aa1cfa94b026dc to your computer and use it in GitHub Desktop.
Provides crosshairs for A9 HITs.
// ==UserScript==
// @name A9 Crosshairs
// @version 1.0.0
// @author Kadauchi
// @include requester_id:3R8NDUBSF6YFJ09L5IGKXETPSAB4KD
// //@include https://www.mturkcontent.com/dynamic/hit*
// //@include https://s3.amazonaws.com/mturk_bulk/hits/*
// ==/UserScript==
const color = 'red';
document.head.insertAdjacentHTML(
'beforeend',
`<style>
.hair {
left:0;
border-top: 2px dotted ${color};
border-left: 2px dotted ${color};
pointer-events: none;
position: fixed;
top:0;
z-index: 10000;
}
</style>`
);
const xHair = document.createElement('div');
xHair.className = 'hair';
xHair.style.width = '100vw';
document.body.prepend(xHair);
const yHair = document.createElement('div');
yHair.className = 'hair';
yHair.style.height = '100vh';
document.body.prepend(yHair);
document.addEventListener('mousemove', ({ x, y }) => {
xHair.style.top = `${y}px`;
yHair.style.left = `${x}px`;
});
@brandonhellman
Copy link
Author

Example GIF below.
GitHub Logo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment