/*jslint indent: 2 */
/*global $: false, document: false, togglbutton: false*/
'use strict';

togglbutton.render('.subheader-status .subheader-content', {}, function (elem) {
  var link, description,
    titleElem = $('.subheader-content h2'),
    projectElem = $('#header h1').clone().children().remove().end().text(); //Exp: http://stackoverflow.com/a/8851526

  description = titleElem.innerText;

  link = togglbutton.createTimerLink({
    className: 'sifterapp',
    description: description,
    projectName: projectElem && projectElem.textContent
  });

  $('.subheader-content h2').appendChild(link);
});

/*jslint indent: 2 */
/*global $: false, document: false, togglbutton: false*/
'use strict';

togglbutton.render('.subheader-status .subheader-content', {}, function (elem) {
  var link, description, project, company,
    titleElem = $('.subheader-content h2'),
    projectElem = $('#header h1'),
    companyElem = $('#header h1 .company');

  description = titleElem.innerText;
  project = projectElem.textContent;
  company = companyElem.textContent;
  
  project = project.substring(0, project.length - company.length - 1);

  link = togglbutton.createTimerLink({
    className: 'sifterapp',
    description: description,
    projectName: projectElem && projectElem.textContent
  });

  $('.subheader-content h2').appendChild(link);
});

remove company name from project name