Update gradients.js

Bug: hook did not work on multiple gradients. 
Why: "".replace(str, ) only replaces first occurence
Fix: Use regex as an argument to "".replace

This fixed multiple gradients for me.