Week 12 ~ eroding capitalism with a mouse

this post is in progress

In order to make the software side of the anti-capitalist mouse work I needed to build a few environments.

First I needed to build a chrome browser extension. Chrome extensions only require a few files and allow you to drop javascript (or any kind of code) onto any webpage. Below I have pasted the code which looks for HTML elements that have a class name of ad.

If the mouse moves over any of the ad elements a function called sendPost will be triggered. From here an ajax post request is sent to a local node server which I am simultaneously running on my machine.

var ads = document.getElementsByClassName('ad');
var cads = document.getElementsByClassName('c-ad');

for (var i = 0; i < ads.length; i++) {

for (var i = 0; i < cads.length; i++) {

function changeElement(el) {
  el.addEventListener("mouseover", mouseOver);

function mouseOver() {

function sendPost(dat) {
    url: "http://localhost:8080/posts",
    type: "POST",
    data: JSON.stringify({
      "data": "We can bring to birth a new world from the ashes of the old ",
    error: function(e) {
    dataType: "json",
    cache: false, 
    contentType: "application/json; charset=utf-8"

The node server is listening for data coming in and printing it to the console."/posts", function(request, response) {

The final step will be making a Serial.send function inside the function above so that the Arduino will know when to turn on the vibrating motor inside the physical mouse.