
//名前空間用のオブジェクトを用意する
var CONTENTVIEW_CONTENTTYPENONE = {};

CONTENTVIEW_CONTENTTYPENONE.getJsonContentInfoTyeNone = function(doneFunc) {
	
	//CONTENTVIEW_CALLAPI.getSearchDataFromJson();
	//CONTENTVIEW_CALLAPI.getJsonDataPageTitle();
	//CONTENTVIEW_CALLAPI.getDataJsonFile();
	var ajax2 = CONTENTVIEW_CALLAPI.getSearchDataFromJsonWhen();
	var ajax3 = CONTENTVIEW_CALLAPI.getJsonDataPageTitleWhen();
	var ajax6 = CONTENTVIEW_CALLAPI.getDataJsonFileWhen();

	$.when(
			ajax2,ajax3,ajax6
	).done(function(data2, data3, data6) {
		//console.log("done:data2:" + data2);
		//console.log("done:data3:" + data3);
		//console.log("done:data6:" + data6);
		if(data2){
			CONTENTVIEW_CALLAPI.getSearchDataFromJsonDone(data2[0]);
		}
		if(data3){
			CONTENTVIEW_CALLAPI.getJsonDataPageTitleDone(data3[0]);
		}
		if(data6){
			CONTENTVIEW_CALLAPI.getDataJsonFileDone(data6[0]);
		}
		if(doneFunc){
			doneFunc();
		}
	});
	
};

//Return a string base 64 image has drawn with specify data
CONTENTVIEW_CONTENTTYPENONE.returnImageString = function(data){
    if(data){
        var height = data.height;
        var width = data.width;
        var color = data.color;
        var alpha = data.alpha;
    }
   
    var imageUrl = '';
    var typeNoneCanvas = document.createElement('canvas');
    var typeNoneContext = typeNoneCanvas.getContext('2d');
    typeNoneCanvas.height = height;
    typeNoneCanvas.width = width;
    
    typeNoneContext.clearRect(0, 0, width, height);   
    
    typeNoneContext.fillStyle= "#"+color;
    typeNoneContext.globalAlpha = alpha;
    typeNoneContext.fillRect(0,0,width,height);
    
    imageUrl = typeNoneCanvas.toDataURL();
    
    return imageUrl;    
};

CONTENTVIEW_CONTENTTYPENONE.ready = function(){
};

