2 ms·
You beat by a few minutes. I wrote a Chromium extension for it: cs.js: (function(){var b;var a=function(){if(b!==undefined){var e=document.querySelector("
by wreegab 13y ago
You beat by a few minutes. I wrote a Chromium extension for it:
cs.js:
(function(){var b;var a=function(){if(b!==undefined){var e=document.querySelector("input#answer");
e.value=b;e.dispatchEvent(new Event("keyup"))}};var c=function(e){var h=e.length;
var f;while(h--){f=e[h];if(!f.addedNodes||!f.addedNodes.length)
{continue}if(f.addedNodes[0].nodeType!==3){continue
}var j=f.addedNodes[0].textContent.match(/^\s*(\d+)\s*(\S)\s*(\d+)/);if(!j){continue
}var k=parseInt(j[1],10);var l=j[2];var g=parseInt(j[3],10);switch(l){case"+":b=k+g;
break;case"-":b=k-g;break;case"x":b=k*g;break;case"÷":b=k/g;break}setTimeout(a,500);
return}};var d=function(){var e=new
MutationObserver(c);e.observe(document.querySelector("div#question"),
{attributes:false,childList:true,characterData:false,subtree:false})
};window.addEventListener("load",d)})();
manifest.json
{
"manifest_version": 2,
"name": "Speedsums Helper",
"version": "0.1",
"description": "Help be good at SpeedSums",
"author": "wreegab",
"content_scripts": [{
"matches": ["http://www.speedsums.com/*"],
"js": ["cs.js"],
"run_at": "document_start"
}]
}
Caveats:
Need to answer the first question.
Need a time out to prevent exhausting the list of questions (it stops at 119)
It's Hacker News after all...