<commit_before>jQuery.fn.extend({

	/**
	 * Load HTML from a remote file and inject it into the DOM, only if it's
	 * been modified by the server.
	 *
	 * @example $("#feeds").loadIfModified("feeds.html")
	 * @before <div id="feeds"></div>
	 * @result <div id="feeds"><b>45</b> feeds found.</div>
	 *
	 * @name loadIfModified
	 * @type jQuery
	 * @param String url The URL of the HTML file to load.
	 * @param Hash params A set of key/value pairs that will be sent to the server.
	 * @param Function callback A function to be executed whenever the data is loaded.
	 * @cat AJAX
	 */
	loadIfModified: function( url, params, callback ) {
		this.load( url, params, callback, 1 );
	},

	/**
	 * Load HTML from a remote file and inject it into the DOM.
	 *
	 * @example $("#feeds").load("feeds.html")
	 * @before <div id="feeds"></div>
	 * @result <div id="feeds"><b>45</b> feeds found.</div>
	 *
 	 * @example $("#feeds").load("feeds.html",
 	 *   {test: true},
 	 *   function() { alert("load is done"); }
 	 * );
	 * @desc Same as above, but with an additional parameter
	 * and a callback that is executed when the data was loaded.
	 *
	 * @test stop();
	 * $('#first').load("data/name.php", function() {
	 * 	ok( $('#first').text() == 'ERROR', 'Check if content was injected into the DOM' );
	 * 	start();
	 * });
	 *
	 * @test stop(); // check if load can be called with only url
	 * $('#first').load("data/name.php");
	 * $.get("data/name.php", function() {
	 *   ok( $('#first').text() == 'ERROR', 'Check if load works without callback');
	 *   start();
	 * });
	 *
	 * @test stop();
	 * window.foobar = undefined;
	 * window.foo = undefined;
	 * var verifyEvaluation = function() {
	 *   ok( foobar == "bar", 'Check if script src was evaluated after load' );
	 *   ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM');
	 *   ok( $('#ap').html() == 'bar', 'Check if script evaluation has modified DOM');
	 *   start();
	 * };
	 * $('#first').load('data/test.html', function() {
	 *   ok( $('#first').html().match(/^html text/), 'Check content after loading html' );
	 *   ok( foo == "foo", 'Check if script was evaluated after load' );
	 *   setTimeout(verifyEvaluation, 600);
	 * });
	 *
	 * @name load
	 * @type jQuery
	 * @param String url The URL of the HTML file to load.
	 * @param Object params A set of key/value pairs that will be sent to the server.
	 * @param Function callback A function to be executed whenever the data is loaded.
	 * @cat AJAX
	 */
	load: function( url, params, callback, ifModified ) {
		if ( url.constructor == Function )
			return this.bind("load", url);

		callback = callback || function(){};

		// Default to a GET request
		var type = "GET";

		// If the second parameter was provided
		if ( params ) {
			// If it's a function
			if ( params.constructor == Function ) {
				// We assume that it's the callback
				callback = params;
				params = null;

			// Otherwise, build a param string
			} else {
				params = jQuery.param( params );
				type = "POST";
			}
		}

		var self = this;

		// Request the remote document
		jQuery.ajax({
			url: url,
			type: type,
			data: params,
			ifModified: ifModified,
			complete: function(res, status){
				if ( status == "success" || !ifModified && status == "notmodified" ) {
					// Inject the HTML into all the matched elements
					self.html(res.responseText)
					  // Execute all the scripts inside of the newly-injected HTML
					  .evalScripts()
					  // Execute callback
					  .each( callback, [res.responseText, status] );
				} else
					callback.apply( self, [res.responseText, status] );
			}
		});
		return this;
	},

	/**
	 * Serializes a set of input elements into a string of data.
	 * This will serialize all given elements. If you need<commit_msg>Fixed docs for load; Added the response as third paramter for load callback (partly fixing bug #337)<commit_after>jQuery.fn.extend({

	/**
	 * Load HTML from a remote file and inject it into the DOM, only if it's
	 * been modified by the server.
	 *
	 * @example $("#feeds").loadIfModified("feeds.html")
	 * @before <div id="feeds"></div>
	 * @result <div id="feeds"><b>45</b> feeds found.</div>
	 *
	 * @name loadIfModified
	 * @type jQuery
	 * @param String url The URL of the HTML file to load.
	 * @param Hash params A set of key/value pairs that will be sent to the server.
	 * @param Function callback A function to be executed whenever the data is loaded.
	 * @cat AJAX
	 */
	loadIfModified: function( url, params, callback ) {
		this.load( url, params, callback, 1 );
	},

	/**
	 * Load HTML from a remote file and inject it into the DOM.
	 *
	 * @example $("#feeds").load("feeds.html")
	 * @before <div id="feeds"></div>
	 * @result <div id="feeds"><b>45</b> feeds found.</div>
	 *
 	 * @example $("#feeds").load("feeds.html",
 	 *   {test: true},
 	 *   function() { alert("load is done"); }
 	 * );
	 * @desc Same as above, but with an additional parameter
	 * and a callback that is executed when the data was loaded.
	 *
	 * @test stop();
	 * $('#first').load("data/name.php", function() {
	 * 	ok( $('#first').text() == 'ERROR', 'Check if content was injected into the DOM' );
	 * 	start();
	 * });
	 *
	 * @test stop(); // check if load can be called with only url
	 * $('#first').load("data/name.php");
	 * $.get("data/name.php", function() {
	 *   ok( $('#first').text() == 'ERROR', 'Check if load works without callback');
	 *   start();
	 * });
	 *
	 * @test stop();
	 * window.foobar = undefined;
	 * window.foo = undefined;
	 * var verifyEvaluation = function() {
	 *   ok( foobar == "bar", 'Check if script src was evaluated after load' );
	 *   ok( $('#foo').html() == 'foo', 'Check if script evaluation has modified DOM');
	 *   ok( $('#ap').html() == 'bar', 'Check if script evaluation has modified DOM');
	 *   start();
	 * };
	 * $('#first').load('data/test.html', function() {
	 *   ok( $('#first').html().match(/^html text/), 'Check content after loading html' );
	 *   ok( foo == "foo", 'Check if script was evaluated after load' );
	 *   setTimeout(verifyEvaluation, 600);
	 * });
	 *
	 * @name load
	 * @type jQuery
	 * @param String url The URL of the HTML file to load.
	 * @param Object params A set of key/value pairs that will be sent as data to the server.
	 * @param Function callback A function to be executed whenever the data is loaded (parameters: responseText, status and reponse itself).
	 * @cat AJAX
	 */
	load: function( url, params, callback, ifModified ) {
		if ( url.constructor == Function )
			return this.bind("load", url);

		callback = callback || function(){};

		// Default to a GET request
		var type = "GET";

		// If the second parameter was provided
		if ( params ) {
			// If it's a function
			if ( params.constructor == Function ) {
				// We assume that it's the callback
				callback = params;
				params = null;

			// Otherwise, build a param string
			} else {
				params = jQuery.param( params );
				type = "POST";
			}
		}

		var self = this;

		// Request the remote document
		jQuery.ajax({
			url: url,
			type: type,
			data: params,
			ifModified: ifModified,
			complete: function(res, status){
				if ( status == "success" || !ifModified && status == "notmodified" ) {
					// Inject the HTML into all the matched elements
					self.html(res.responseText)
					  // Execute all the scripts inside of the newly-injected HTML
					  .evalScripts()
					  // Execute callback
					  .each( callback, [res.responseText, status, res] );
				} else
					callback.apply( self, [res.responseText, status, res] );
			}
		});
		return this;
	},

	/**
	 * Serializes a set of input elements into a string of data.
	 * This will serialize all given elements. If you need
{'fraction_non_alphanumeric': 0.15576001036672282, 'fraction_numerical': 0.002462096669690294, 'mean_word_length': 2.976300875837197, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '4505176', 'n_tokens_mistral': 2618, 'n_tokens_neox': 2252, 'n_words': 865}