CoreFiles by mySites.guru
helpsite.js32 lines, 1,067 bytes, from Joomla_3.9.13-Stable-Full_Package.zip
Raw History Compare with 3.9.12
md5
527c57271ca2b9219e514489c2aa0711
sha1
25060557efffa92d58b638471261d8de83a8e48c
sha256
1aefb87dbeddfc833fd3301ff211e537b125f2eb8cf869f38d2feec7f98ba972
/**
 * @package		Joomla.JavaScript
 * @copyright	Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * gets the help site with ajax
 */
jQuery(document).ready(function() {
	jQuery('#helpsite-refresh').click(function()
	{
		// Uses global variable helpsite_base for bast uri
		var select_id   = jQuery(this).attr('rel');
		var showDefault = jQuery(this).attr('showDefault');

		jQuery.getJSON('index.php?option=com_users&task=profile.gethelpsites&format=json', function(data){
			// The response contains the options to use in help site select field
			var items = [];

			// Build options
			jQuery.each(data, function(key, val) {
				if (val.value !== '' || showDefault === 'true') {
					items.push('<option value="' + val.value + '">' + val.text + '</option>');
				}
			});

			// Replace current select options. The trigger is needed for Chosen select box enhancer
			jQuery("#" + select_id).empty().append(items).trigger("liszt:updated");
		});
	});
});

The same content is in 26 releases, Joomla 3.9.2-rc to 3.9.14. See them all, or every version of this file.