rewrite links by js