CoreFiles by mySites.guru
textdiff.php63 lines, 1,546 bytes, from Joomla_3.6.5-Stable-Full_Package.zip
Raw History Compare with 3.6.4
md5
bbc5cd7ad65ac5f806e655c94b20da39
sha1
6d98523867d2f0ce941aa23fe710669cf8a559d2
sha256
d1fe933cb651429010bc46bd8aa38e0be8794edd0e65fb9544d6832fa05ffc2c
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_contenthistory
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * HTML utility class for creating text diffs using jQuery, diff_patch_match.js and jquery.pretty-text-diff.js JavaScript libraries.
 *
 * @since  3.2
 */
abstract class JHtmlTextdiff
{
	/**
	 * @var    array  Array containing information for loaded files
	 * @since  3.2
	 */
	protected static $loaded = array();

	/**
	 * Method to load Javascript text diff
	 *
	 * @param   string  $containerId  DOM id of the element where the diff will be rendered
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public static function textdiff($containerId)
	{
		// Only load once
		if (isset(static::$loaded[__METHOD__]))
		{
			return;
		}

		// Depends on jQuery UI
		JHtml::_('bootstrap.framework');
		JHtml::_('script', 'com_contenthistory/diff_match_patch.js', false, true);
		JHtml::_('script', 'com_contenthistory/jquery.pretty-text-diff.min.js', false, true);
		JHtml::_('stylesheet', 'com_contenthistory/jquery.pretty-text-diff.css', false, true, false);

		// Attach diff to document
		JFactory::getDocument()->addScriptDeclaration("
			(function ($){
				$(document).ready(function (){
 					$('#" . $containerId . " tr').prettyTextDiff();
 				});
			})(jQuery);
			"
		);

		// Set static array
		static::$loaded[__METHOD__] = true;

		return;
	}
}

The same content is in 16 releases, Joomla 3.6.0-alpha to 3.6.5. See them all, or every version of this file.