User:Proteins/quickdiffs.js

This is an old revision of this page, as edited by Proteins (talk | contribs) at 12:11, 3 November 2008 (add new variables). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//<pre>
//Summarizes the differences between two page versions in pop-up windows
// Perhaps calculate fractional change in document 

function quickDiffs() {
	var alert_string = "";

	var body_content;
	var diff_table;
	var diff_table_row;

	var diff_old_version_info; //className = "diff-otitle"
	var diff_new_version_info; //className = "diff-ntitle"

	var mw_diff_otitle1 = "";
	var mw_diff_otitle2 = "";
	var mw_diff_otitle3 = "";
	var mw_diff_otitle4 = "";

	var mw_diff_ntitle1 = "";
	var mw_diff_ntitle2 = "";
	var mw_diff_ntitle3 = "";
	var mw_diff_ntitle4 = "";

	var num_line_numbers = 0;
	var temp_diff_old_line_numbers = 0;
	var temp_diff_new_line_numbers = 0;
	var diff_old_line_numbers = new Array();
	var diff_new_line_numbers = new Array();

	var num_additions = 0;
	var num_deletions = 0;
	var num_replacements = 0;

	var num_changed_lines = 0;
	var diff_added_lines = new Array();
	var diff_deleted_lines = new Array();
	var num_changes_in_line = new Array();

	var diff_changes = new Array();
	var diff_change_line_numbers = new Array();

// Check that there are any diffs on this page

// Acknowledgment string
	alert_string = "This script added explanations for " + num_expanded_acronyms + " acronyms.\n\n";
	if (num_anomalous_acronyms) { 
		alert_string += "The following " + num_anomalous_acronyms + " acronyms were not identified:\n";
		alert_string += anomalous_acronyms;
	}
	window.alert(alert_string);
} // closes function quickDiffs()
 
addOnloadHook(function () {
addPortletLink('p-cactions', 'javascript:quickDiffs()', 'diff', 'ca-diff', 'Summarizes the differences between two page versions', 'b', '');
});
 
//</pre>