<commit_before>/**
 *
 * jQuery.AjaxQueuer
 *
 * @FileName: jquery.ajaxqueuer.js
 * @Auther: Pandao 
 * @version: 0.1.0 
 * @License: MIT
 * Copyright@2014 all right reserved.
 */

;(function(ajaxQueuer) {

	// CommonJS/Node.js
	if(typeof require === 'function' && typeof exports === "object" && typeof module === "object") {
		ajaxQueuer(require, exports, module);
	}	
	// AMD/CMD/Sea.js
	else if(typeof define === "function") {

		if(define.amd) { // for Require.js

			define(["jquery"], ajaxQueuer);

		} else { // for Sea.js
			define(ajaxQueuer);
		}
	} 
	else 
	{ 
		ajaxQueuer(function(){}, window['ajaxQueuer']={}, {}); 
	}

}(function(require, exports, module) {  

	(function ($) {
		
		var ajaxQueuer = function() { 

			if(arguments.length == 1 && typeof (arguments[0].length) == "undefined") {

				return new ajaxQueuer.queue([], arguments[0]);

			} else {

				return new ajaxQueuer.queue(arguments[0], arguments[1]);
				
			}
		};

		ajaxQueuer.queue = function(queue, options) {

			queue   = queue   || [];
			options = options || {};
			var _this = this;

			if (typeof (queue) == "object") {
				this.queue = queue; 
				this.count = queue.length;
				this.nowIndex = 0;
			}

			var defaults = {
				type    : "GET",
				async   : false,           // default false
				timeout : 3000,            // global setting
				namePrefix : 'ajaxQueuer'
			}; 

			this.settings = $.extend(defaults, options);

			this.qid      = this.settings.namePrefix + (new Date).getTime(); 

			this.add = function(queue) { 
				queue = queue || {};

				if(typeof (queue.length) != "undefined" && queue.length > 1)
				{ 
					for (var i = 0, len = queue.length; i < len; i++) 
					{
						_this.count += 1; 
						_this.queue.push(queue[i]); 
					}
				} 
				else 
				{
					_this.count += 1; 
					_this.queue.push(queue); 					
				}

				return _this;
			};

			this.async = function() {

				_this.settings.async = true;

				ajaxQueuer.prioritySort(_this);

				var queue = _this.queue[_this.nowIndex]; 

				ajaxQueuer.request(_this, queue); 

				return _this;
			};

			this.synch = function() {

				_this.settings.async = false;

				var queue = _this.queue[_this.nowIndex];

				ajaxQueuer.request(_this, queue); 

				return _this;
			};

			this.run = function() {
				var queue = _this.queue[_this.nowIndex];

				ajaxQueuer.request(_this, queue); 

				return _this;
			};  

			this.last = function() {  

				_this.nowIndex = _this.queue.length-1;

				ajaxQueuer.request(_this, _this.queue[_this.nowIndex], true);  

				return _this;
			};

			this.getQueues = function() {
				return _this.queue;
			};

			this.stop = function() {
				_this.nowIndex = _this.queue.length;

				return _this;
			};

			return this;
		}; 
<commit_msg>add flush queue method<commit_after>/**
 *
 * jQuery.AjaxQueuer
 *
 * @FileName: jquery.ajaxqueuer.js
 * @Auther: Pandao 
 * @version: 0.1.0 
 * @License: MIT
 * Copyright@2014 all right reserved.
 */

;(function(ajaxQueuer) {

	// CommonJS/Node.js
	if(typeof require === 'function' && typeof exports === "object" && typeof module === "object") {
		ajaxQueuer(require, exports, module);
	}	
	// AMD/CMD/Sea.js
	else if(typeof define === "function") {

		if(define.amd) { // for Require.js

			define(["jquery"], ajaxQueuer);

		} else { // for Sea.js
			define(ajaxQueuer);
		}
	} 
	else 
	{ 
		ajaxQueuer(function(){}, window['ajaxQueuer']={}, {}); 
	}

}(function(require, exports, module) {  

	(function ($) {
		
		var ajaxQueuer = function() { 

			if(arguments.length == 1 && typeof (arguments[0].length) == "undefined") {

				return new ajaxQueuer.queue([], arguments[0]);

			} else {

				return new ajaxQueuer.queue(arguments[0], arguments[1]);
				
			}
		};

		ajaxQueuer.queue = function(queue, options) {

			queue   = queue   || [];
			options = options || {};
			var _this = this;

			if (typeof (queue) == "object") {
				this.queue = queue; 
				this.count = queue.length;
				this.nowIndex = 0;
			}

			var defaults = {
				type    : "GET",
				async   : false,           // default false
				timeout : 3000,            // global setting
				namePrefix : 'ajaxQueuer'
			}; 

			this.settings = $.extend(defaults, options);

			this.qid      = this.settings.namePrefix + (new Date).getTime(); 

			this.add = function(queue) { 
				queue = queue || {};

				if(typeof (queue.length) != "undefined" && queue.length > 1)
				{ 
					for (var i = 0, len = queue.length; i < len; i++) 
					{
						_this.count += 1; 
						_this.queue.push(queue[i]); 
					}
				} 
				else 
				{
					_this.count += 1; 
					_this.queue.push(queue); 					
				}

				return _this;
			};

			this.async = function() {

				_this.settings.async = true;

				ajaxQueuer.prioritySort(_this);

				var queue = _this.queue[_this.nowIndex]; 

				ajaxQueuer.request(_this, queue); 

				return _this;
			};

			this.synch = function() {

				_this.settings.async = false;

				var queue = _this.queue[_this.nowIndex];

				ajaxQueuer.request(_this, queue); 

				return _this;
			};

			this.run = function() {
				var queue = _this.queue[_this.nowIndex];

				ajaxQueuer.request(_this, queue); 

				return _this;
			};  

			this.last = function() {  

				_this.nowIndex = _this.queue.length-1;

				ajaxQueuer.request(_this, _this.queue[_this.nowIndex], true);  

				return _this;
			};

			this.getQueues = function() {
				return _this.queue;
			};

			this.stop = function() {
				_this.nowIndex = _this.queue.length;

				return _this;
			};

			this.flush = function() {
				_this.queue = [];

				return _this;
			};

			return this;
		}; 

{'fraction_non_alphanumeric': 0.15989304812834224, 'fraction_numerical': 0.00784313725490196, 'mean_word_length': 2.388285024154589, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1746952', 'n_tokens_mistral': 2472, 'n_tokens_neox': 1900, 'n_words': 382}