<commit_before>/*jslint indent: 2 */
/*global window: false, document: false, chrome: false, $: false, createTag: false, createLink: false*/
(function () {
  "use strict";
  function createTimerLink(task, moreClass, tag) {
    var link;
    if (!tag) {
      link = createLink('jira ' + moreClass);
    } else {
      link = createTag(tag, 'jira ' + moreClass);
      link.appendChild(document.createTextNode('Start timer'));
    }
    link.addEventListener("click", function (e) {
      e.preventDefault();
      chrome.extension.sendMessage({
        type: 'timeEntry',
        description: task
      });
      $('span', link).innerHTML = "Started...";
    });
    return link;
  }

  function observeBoard() {
    var target = document.querySelector('#ghx-detail-view');
    var observer = new WebKitMutationObserver(function(mutations) {
      mutations.forEach(function(mutation) {
        if ($('.toggl-button')) {
          return;
        }

        var titleElem = $('dd.ghx-fieldname-summary'), numElem, title,wrapSpan, button;
        if (titleElem === null) {
          return;
        }

        numElem = $('.ghx-fieldname-issuekey a');
        title = titleElem.textContent;
        if (numElem !== null) {
          title = numElem.textContent + " " + title;
        }

        button = createTimerLink(title, 'aui-button ghx-actions aui-button-compact', 'button');
        wrapSpan = createTag('span', 'toggl-button', button.textContent);
        button.innerHTML = wrapSpan.outerHTML;
        $(".ghx-controls").insertBefore(button, $(".ghx-controls").childNodes[0]);
      });
    });
    var config = {childList: true, subtree: true};
    observer.observe(target, config);
  }

  function addLinkToDiscussion() {
    var titleElem = $('#summary-val'), numElem, title, wrapUl, wrapLi, wrapSpan, a;
    if (titleElem === null) {
      return;
    }

    numElem = $('.issue-link');
    title = titleElem.textContent;
    if (numElem !== null) {
      title = numElem.getAttribute('data-issue-key') + " " + title;
    }

    wrapUl = createTag('ul', 'toggl toolbar-group');
    wrapLi = createTag('li', 'toolbar-item');
    wrapUl.appendChild(wrapLi);<commit_msg>Jira: reset isStarted flag on issue reload<commit_after>/*jslint indent: 2 */
/*global window: false, document: false, chrome: false, $: false, createTag: false, createLink: false*/
(function () {
  "use strict";
  function createTimerLink(task, moreClass, tag) {
    var link;
    if (!tag) {
      link = createLink('jira ' + moreClass);
    } else {
      link = createTag(tag, 'jira ' + moreClass);
      link.appendChild(document.createTextNode('Start timer'));
    }
    link.addEventListener("click", function (e) {
      e.preventDefault();
      chrome.extension.sendMessage({
        type: 'timeEntry',
        description: task
      });
      $('span', link).innerHTML = "Started...";
    });
    return link;
  }

  function observeBoard() {
    var target = document.querySelector('#ghx-detail-view');
    var observer = new WebKitMutationObserver(function(mutations) {
      mutations.forEach(function(mutation) {
        if ($('.toggl-button')) {
          return;
        }

        var titleElem = $('dd.ghx-fieldname-summary'), numElem, title,wrapSpan, button;
        if (titleElem === null) {
          return;
        }

        numElem = $('.ghx-fieldname-issuekey a');
        title = titleElem.textContent;
        if (numElem !== null) {
          title = numElem.textContent + " " + title;
        }

        button = createTimerLink(title, 'aui-button ghx-actions aui-button-compact', 'button');
        wrapSpan = createTag('span', 'toggl-button', button.textContent);
        button.innerHTML = wrapSpan.outerHTML;
        $(".ghx-controls").insertBefore(button, $(".ghx-controls").childNodes[0]);
        isStarted = false;
      });
    });
    var config = {childList: true, subtree: true};
    observer.observe(target, config);
  }

  function addLinkToDiscussion() {
    var titleElem = $('#summary-val'), numElem, title, wrapUl, wrapLi, wrapSpan, a;
    if (titleElem === null) {
      return;
    }

    numElem = $('.issue-link');
    title = titleElem.textContent;
    if (numElem !== null) {
      title = numElem.getAttribute('data-issue-key') + " " + title;
    }

    wrapUl = createTag('ul', 'toggl toolbar-group');
    wrapLi = createTag('li', 'toolbar-item');
    wrapUl.appendChild(wrapLi);
{'fraction_non_alphanumeric': 0.15821638750565867, 'fraction_numerical': 0.0009053870529651426, 'mean_word_length': 2.75765306122449, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '82555', 'n_tokens_mistral': 1366, 'n_tokens_neox': 1330, 'n_words': 285}