Sunday, December 18, 2016

motion calls



function createmotionfunctions(namespace) {
var script = document.createElement("script")
window.document.body.appendChild(script)
var motionarray = "left,right,up,down,plus,minus".split(",")
var cb = ""
for (var i = 0; i < motionarray.length; i = i + 1) {
var v = 'function(' + namespace + motionarray[i] + '() {'
v = v + 'if (document.getElementById("' + namespace + 'motion").innerHTML'
v = v + ' === "1") {'
v = v + namespace + '("motion","' + motionarray[i]  + '");'
v = v + 'setTimeout(' + namespace + motionarray[i] + ',100)]}'
cb = cb + v}
script.appendChild(document.createTextNode(cb))}




No comments:

Post a Comment