examples/browser/resources/browser-demo.js
function(org) {
        var url = decodeURIComponent(org.toString());
        urlOutput.empty().attr('href', url);

        url = url.replace(/.*?\/users\//g, '/users/');
        url = url.replace(/Token=(.{10}).*/g, 'Token=$1...');

        var parts = url.split('?'), param;
        var params = parts[1].replace(/t\[\]=maxSize.*?&/g, '').split('&');

        // Base url
        $('<div />').text(parts[0]).appendTo(urlOutput);
        for (var i = 0, prefix; i < params.length; i++) {
            prefix = i > 0 ? '&' : '?';

            parts = params[i].split(/t\[\]=/);
            param = prefix + parts[0];
            if (parts.length > 1) {
                var args = [], trans = parts[1].split(':');
                param = prefix + 't[]=<span class="transformation">' + trans[0] + '</span>';

                if (trans.length > 1) {
                    var items = trans[1].split(',');

                    for (var t = 0; t < items.length; t++) {
                        var c = items[t].split('='), x = '';
                        x += '<span class="param">' + c[0] + '</span>=';
                        x += '<span class="value">' + c[1] + '</span>';
                        args.push(x);
                    }

                    param += ':' + args.join(',');
                }
            }

            param = param.replace(/(.*?=)/, '<strong>$1</strong>');
            $('<div />').html(param).appendTo(urlOutput);
        }
    }
function(org) {
        var url = decodeURIComponent(org.toString());
        urlOutput.empty().attr('href', url);

        url = url.replace(/.*?\/users\//g, '/users/');
        url = url.replace(/Token=(.{10}).*/g, 'Token=$1...');

        var parts = url.split('?'), param;
        var params = parts[1].replace(/t\[\]=maxSize.*?&/g, '').split('&');

        // Base url
        $('<div />').text(parts[0]).appendTo(urlOutput);
        for (var i = 0, prefix; i < params.length; i++) {
            prefix = i > 0 ? '&' : '?';

            parts = params[i].split(/t\[\]=/);
            param = prefix + parts[0];
            if (parts.length > 1) {
                var args = [], trans = parts[1].split(':');
                param = prefix + 't[]=<span class="transformation">' + trans[0] + '</span>';

                if (trans.length > 1) {
                    var items = trans[1].split(',');

                    for (var t = 0; t < items.length; t++) {
                        var c = items[t].split('='), x = '';
                        x += '<span class="param">' + c[0] + '</span>=';
                        x += '<span class="value">' + c[1] + '</span>';
                        args.push(x);
                    }

                    param += ':' + args.join(',');
                }
            }

            param = param.replace(/(.*?=)/, '<strong>$1</strong>');
            $('<div />').html(param).appendTo(urlOutput);
        }
    }
function ( org ) { var url = decodeURIComponent ( org . toString ( ) ) ; urlOutput . empty ( ) . attr ( 'href' , url ) ; url = url . replace ( / .*?\/users\/ / g , '/users/' ) ; url = url . replace ( / Token=(.{10}).* / g , 'Token=$1...' ) ; var parts = url . split ( '?' ) , param ; var params = parts [ 1 ] . replace ( / t\[\]=maxSize.*?& / g , '' ) . split ( '&' ) ; // Base url $ ( '<div />' ) . text ( parts [ 0 ] ) . appendTo ( urlOutput ) ; for ( var i = 0 , prefix ; i < params . length ; i ++ ) { prefix = i > 0 ? '&' : '?' ; parts = params [ i ] . split ( / t\[\]= / ) ; param = prefix + parts [ 0 ] ; if ( parts . length > 1 ) { var args = [ ] , trans = parts [ 1 ] . split ( ':' ) ; param = prefix + 't[]=<span class="transformation">' + trans [ 0 ] + '</span>' ; if ( trans . length > 1 ) { var items = trans [ 1 ] . split ( ',' ) ; for ( var t = 0 ; t < items . length ; t ++ ) { var c = items [ t ] . split ( '=' ) , x = '' ; x += '<span class="param">' + c [ 0 ] + '</span>=' ; x += '<span class="value">' + c [ 1 ] + '</span>' ; args . push ( x ) ; } param += ':' + args . join ( ',' ) ; } } param = param . replace ( / (.*?=) / , '<strong>$1</strong>' ) ; $ ( '<div />' ) . html ( param ) . appendTo ( urlOutput ) ; } }
Demonstrating the URL helper
Demonstrating the URL helper