You save it as deluge-wrapper.sh. Use chmod to enable the execution bit (chmod a+x deluge-wrapper.sh). And then point your browser at it.
Be sure to doublecheck that running deluge in this way does open the torrent. You can test it in the command line. It might be --torrent or I might be misreading or misremembering the code from last night. Additionally, it might be deluge-gtk or something.