dialog JavaScript library rewrite