{"size": 1687, "ext": "js", "max_stars_repo_path": "src/Chamilo/Libraries/Resources/Javascript/Upload.js", "max_stars_repo_name": "forelo/cosnics", "max_stars_repo_stars_event_min_datetime": "2017-06-11T14:19:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-15T11:01:13.000Z", "max_issues_repo_path": "src/Chamilo/Libraries/Resources/Javascript/Upload.js", "max_issues_repo_name": "forelo/cosnics", "max_issues_repo_issues_event_min_datetime": "2017-03-13T06:58:12.000Z", "max_issues_repo_issues_event_max_datetime": "2020-02-14T08:58:11.000Z", "max_forks_repo_path": "src/Chamilo/Libraries/Resources/Javascript/Upload.js", "max_forks_repo_name": "forelo/cosnics", "max_forks_repo_forks_event_min_datetime": "2017-02-22T16:19:59.000Z", "max_forks_repo_forks_event_max_datetime": "2017-08-17T08:50:39.000Z"}
{"max_stars_count": 3, "max_issues_count": 19, "max_forks_count": 3, "avg_line_length": 33.0784313725, "max_line_length": 142, "alphanum_fraction": 0.7071724956}
/**
 * JavaScript library to deal with file uploads
 * @author	Yannick Warnier <yannick.warnier@chamilo.org>
 */
/**
 * Upload class. Used to pack functions into one practical object.
 * Call like this: var myUpload = new upload(5);
 */

function upload(latency){ 
	/**
	 * Starts the timer
	 * Call like this: 
	 * @param	string	Name of the DOM element we need to update
	 * @param	string	Loading image to display
	 * @return	true
	 */
	function start(domid,img,text,formid){
		__progress_bar_domid = domid;
		__progress_bar_img   = img;
		__progress_bar_text  = text;
		__progress_bar_interval = setTimeout(__display_progress_bar,latency);
		//__display_progress_bar()
		__upload_form_domid  = formid;
	}
	/**
	 * Displays the progress bar in the given DOM element
	 */
	function __display_progress_bar(){
		var my_html ='<span style="font-style:italic;">'+ __progress_bar_text+'</span><br/><img src="'+__progress_bar_img+'" alt="Progress bar"/>';
		document.getElementById(__progress_bar_domid).innerHTML = my_html;
		if(__upload_form_domid != ''){
			document.getElementById(__upload_form_domid).style.display = 'none';
		}
	}

	function stop()
	{
		//clearTimeout(__progress_bar_interval);
		document.getElementById(__progress_bar_domid).innerHTML = null;
		document.getElementById(__progress_bar_domid).style.display = 'none';
	}

	this.start = start;
	this.stop = stop;
	var __progress_bar_domid = '';
	var __progress_bar_img = getPath('WEB_PATH') + '/configuration/resources/images/' + getTheme() + '/action_progress_bar.gif';
	var __progress_bar_text = getTranslation('Uploading', 'libraries');
	var __upload_form_domid = '';
}
