make the plugin AMD friendly

based on idea from http://simonsmith.io/writing-amd-compatible-plugins-for-jquery/

incomplete