function imageUrl(path) {
    var dataUrl;
    try {
        dataUrl = require('text!cockpit/ui/' + path);
    } catch (e) { }
    if (dataUrl) {
        return dataUrl;
    }

    var filename = module.id.split('/').pop() + '.js';
    var imagePath;

    if (module.uri.substr(-filename.length) !== filename) {
        console.error('Can\'t work out path from module.uri/module.id');
        return path;
    }

    if (module.uri) {
        var end = module.uri.length - filename.length - 1;
        return module.uri.substr(0, end) + "/" + path;
    }

    return filename + path;
}
function imageUrl(path) {
    var dataUrl;
    try {
        dataUrl = require('text!cockpit/ui/' + path);
    } catch (e) { }
    if (dataUrl) {
        return dataUrl;
    }

    var filename = module.id.split('/').pop() + '.js';
    var imagePath;

    if (module.uri.substr(-filename.length) !== filename) {
        console.error('Can\'t work out path from module.uri/module.id');
        return path;
    }

    if (module.uri) {
        var end = module.uri.length - filename.length - 1;
        return module.uri.substr(0, end) + "/" + path;
    }

    return filename + path;
}
function imageUrl ( path ) { var dataUrl ; try { dataUrl = require ( 'text!cockpit/ui/' + path ) ; } catch ( e ) { } if ( dataUrl ) { return dataUrl ; } var filename = module . id . split ( '/' ) . pop ( ) + '.js' ; var imagePath ; if ( module . uri . substr ( - filename . length ) !== filename ) { console . error ( 'Can\'t work out path from module.uri/module.id' ) ; return path ; } if ( module . uri ) { var end = module . uri . length - filename . length - 1 ; return module . uri . substr ( 0 , end ) + "/" + path ; } return filename + path ; }
Work out the path for images.
TODO: This should probably live in some utility area somewhere
Work out the path for images . TODO : This should probably live in some utility area somewhere