detect urls, revert code to input if click on output segment. TODO: cleanup