share.js code improvement