(function (D, Q, R) {

    /* 'use strict';*/

    var L = R.Logger;
    var cs = D.createElement('canvas');
    var sc = !!(cs.getContext && cs.getContext('2d'));
    R && (R.Supports.ES = Q.extend(R.Supports.ES, {
        canvas: sc
    }));
    if (!sc) {
        L.log('Unsupport canvas...');
        return;
    }
    var scripts = D.getElementsByTagName('script');
    var last = scripts[scripts.length - 1];
    var src = last.src.replace(/\+/, '/');
    var index = src.lastIndexOf('/');
    var base = src.substring(0, index + 1);
    base = './static//script/';
    var min = src.substring(index).indexOf('.min.') !== -1;
    var ext = min ? '.min.js' : '.js';

    function load(name, load) {
        var url = base + name + ext;
        Q.ajax(url, {
            dataType: 'script',
            cache: true, async: false,
            success: load, error: L.error
        });
    }

    if (R.Config.painter) {
        load('fabric-2.4.4', function () {
            load('reader-annot-3.2.0');
        });
    }
})(window.document, window.jQuery, window.SWR);
