/**
 * Created with JetBrains WebStorm.
 * User: pengshen
 * Date: 14-11-17
 * Time: 下午3:16
 * To change this template use File | Settings | File Templates.
 */
define(function (require, exports) {
    var IOUtil;
    if (RunningPlatform === "NodeWebkit") {
        IOUtil = require("../../../../share/assert/js/ioutil_desktop.js").IOUtil;
    }
    else if (RunningPlatform === "Android") {
        IOUtil = require("../../../../share/assert/js/ioutil_android.js").IOUtil;
    }
    else if (RunningPlatform === "CEF") {
        IOUtil = require("../../../../share/assert/js/ioutil_cef.js").IOUtil;
    }
    else{
        IOUtil = require("../../../../share/assert/js/ioutil_web.js").IOUtil;
    }

    //获取扩展名
    function getExtName(url) {
        var _name = null;
        _name = url.split(".");
        _name = _name[_name.length - 1];
        return _name.toLowerCase();
    };

    fabric.Gif.prototype.getRenderDOM = function (relatedResPath) {
        var def = $.Deferred();
        var jsonPath =  relatedResPath+'/meta.json';
        IOUtil.readFile(jsonPath).done(function(data,err){
            if(data){
                data = data.replace(/\n/g, '\\n');
                var _json = JSON.parse(data);
                var _dom = $('<div><img src="'+relatedResPath+'/'+_json.imgSrc+'"></img></div>');   //android4.2下不加div图片不会动
            }
            def.resolve(_dom);
        });
        return def.promise();
    };
});