<commit_before>/*

Jira widget is a small display of several JIRA issues found by a given query
in a specified place on the website. Data is downloaded using AJAX from JIRA REST
services and cached in SessionStorage of the webrowser, so that it's not downloaded
on each refresh.

Widget code requires jQuery to be available.

An example of how to use the widget.

<!--
  You have to define somewhere on the page where you want the content to be rendered.
  It's important to define 'id' attribute becuase it's later used as an initialization
  parameter
-->
<div id="jiraDiv"> </div>

<!--
  It's also required to initialize the widget by executing following JavaScript function.
-->
<script type="text/javascript">
	renderJiraWidget( {
		jqlQuery : 'project = ORG AND (status = Open OR status = Reopened)',
		maxResults : 3,
		startAt : 0,
		divId : 'jiraDiv',
		title : 'Open JBoss Community Issues'
	} );
</script>

*/

function renderJiraWidget(params) {
	$(document).ready( processJiraWidget( params ));
}

// Function checks sessionStorage if there is cached content, validates its age
// and optionally downloads a new from REST service and caches it.
function processJiraWidget(params) {

	// Renders content html into div with the given id
	function renderHtml(data) {

		// Searching for the div where content should be injected.
		var div = document.getElementById(params.divId);
		if (div == null) {
			console.log('Could not find div with '+params.divId+' id to render jira widget.');
			return;
		}

		var dataArray = data.issues;

		var rawTableBodyHtml = '';
		var rowType = 'oddRow';

		// Iteration through results displaying each issue found by the query.
		for (var i=0; i<dataArray.length ; i++) {
<commit_msg>Updated use example for JiraWidget.<commit_after>/*

Jira widget is a small display of several JIRA issues found by a given query
in a specified place on the website. Data is downloaded using AJAX from JIRA REST
services and cached in SessionStorage of the webrowser, so that it's not downloaded
on each refresh.

Widget code requires jQuery to be available.

An example of how to use the widget.

<!--
  You have to define somewhere on the page where you want the content to be rendered.
  It's important to define 'id' attribute becuase it's later used as an initialization
  parameter
-->
<div id="jiraDiv"> </div>

<!--
  It's also required to initialize the widget by executing following JavaScript function.
-->
<script type="text/javascript">
	$(document).ready(function () {
      processJiraWidget(  {
        jqlQuery : 'project = ORG AND (status = Open OR status = Reopened)',
        maxResults : 5,
        startAt : 0,
        divId : 'jiraDiv',
        title : 'Jira Issues'
      })
    });
</script>

*/

function renderJiraWidget(params) {
	$(document).ready( processJiraWidget( params ));
}

// Function checks sessionStorage if there is cached content, validates its age
// and optionally downloads a new from REST service and caches it.
function processJiraWidget(params) {

	// Renders content html into div with the given id
	function renderHtml(data) {

		// Searching for the div where content should be injected.
		var div = document.getElementById(params.divId);
		if (div == null) {
			console.log('Could not find div with '+params.divId+' id to render jira widget.');
			return;
		}

		var dataArray = data.issues;

		var rawTableBodyHtml = '';
		var rowType = 'oddRow';

		// Iteration through results displaying each issue found by the query.
		for (var i=0; i<dataArray.length ; i++) {

{'fraction_non_alphanumeric': 0.0904480135249366, 'fraction_numerical': 0.0016906170752324597, 'mean_word_length': 3.6223958333333335, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5090103', 'n_tokens_mistral': 1064, 'n_tokens_neox': 988, 'n_words': 445}