bitcoinaddress.js
function(address, amount, label, message) {
        var tmpl = ["bitcoin:", address, "?"];

        if(amount) {
            tmpl = tmpl.concat(["amount=", encodeURIComponent(amount), "&"]);
        }

        if(label) {
            tmpl = tmpl.concat(["label=", encodeURIComponent(label), "&"]);
        }

        if(message) {
            tmpl = tmpl.concat(["message=", encodeURIComponent(message), "&"]);
        }
        // Remove prefixing extra
        var lastc = tmpl[tmpl.length-1];
        if(lastc == "&" || lastc == "?") {
            tmpl = tmpl.splice(0, tmpl.length-1);
        }

        return tmpl.join("");
    }
function(address, amount, label, message) {
        var tmpl = ["bitcoin:", address, "?"];

        if(amount) {
            tmpl = tmpl.concat(["amount=", encodeURIComponent(amount), "&"]);
        }

        if(label) {
            tmpl = tmpl.concat(["label=", encodeURIComponent(label), "&"]);
        }

        if(message) {
            tmpl = tmpl.concat(["message=", encodeURIComponent(message), "&"]);
        }
        // Remove prefixing extra
        var lastc = tmpl[tmpl.length-1];
        if(lastc == "&" || lastc == "?") {
            tmpl = tmpl.splice(0, tmpl.length-1);
        }

        return tmpl.join("");
    }
function ( address , amount , label , message ) { var tmpl = [ "bitcoin:" , address , "?" ] ; if ( amount ) { tmpl = tmpl . concat ( [ "amount=" , encodeURIComponent ( amount ) , "&" ] ) ; } if ( label ) { tmpl = tmpl . concat ( [ "label=" , encodeURIComponent ( label ) , "&" ] ) ; } if ( message ) { tmpl = tmpl . concat ( [ "message=" , encodeURIComponent ( message ) , "&" ] ) ; } // Remove prefixing extra var lastc = tmpl [ tmpl . length - 1 ] ; if ( lastc == "&" || lastc == "?" ) { tmpl = tmpl . splice ( 0 , tmpl . length - 1 ) ; } return tmpl . join ( "" ) ; }
Create URL for bitcoin URI scheme payments.

https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki#Examples

http://bitcoin.stackexchange.com/questions/4987/bitcoin-url-scheme

@param  {String} address Receiving address
@param  {String} amount  Amount as big decimal
@param  {String} label   [description]
@param  {[type]} message [description]
@return {[type]}         [description]
Create URL for bitcoin URI scheme payments .