To export the $1 gadget, click on "Download" button, save the downloaded file, go to Special:Import on destination wiki and upload it. Then add the following to MediaWiki:Gadgets-definition page:
$2
You must have appropriate permissions on destination wiki (including the right to edit system messages) and import from file uploads must be enabled.