Avoid eval by doing the reverse of "stringified function" + eval
Instead of writing a function in a string and evaling it later, just define the function as usual and call it directly. The string representation necessary for use with executeScript is acquired by calling .toString() on the function.