Update web-tools.js

another web-tools patch (more pretty code, fixed some bugs)