<commit_before>function initiateViima(viimaId, imgUrl, borderColor, tabOpacity){

  //Initializing variables
  if(!viimaId){
    viimaId = 'viima'
  }

  if(!imgUrl){
    imgUrl = ' https://app.viima.com/static/img/feedback.png'
  }

  //Appending tab to body
  $('body').append('<div id="feedback-tab"><img src="'+ imgUrl +'" alt="Feedback"/><div id="feedback-inner"><iframe src="https://app.viima.com/' + viimaId + '"></iframe></div></div>');

  //Setting CSS
	$('#feedback-tab').css({
          'position': 'fixed',
           'top': '30%',
           'left': '0',
           'cursor': 'pointer',
           '-webkit-transition-duration': '0.3s',
           '-moz-transition-duration': '0.3s',
           '-o-transition-duration': '0.3s',
           'transition-duration': '0.3s',
  });


  $('#feedback-inner').css({
          'position': 'fixed',
          'top': '30%',
          'left': '-1000px',
          '-webkit-transition-duration': '0.3s',
          '-moz-transition-duration': '0.3s',
          '-o-transition-duration': '0.3s',
          'transition-duration': '0.3s',
          'height': '400px',
          'width': '700px',
          'overflow': 'hidden',
  });

  $('#feedback-inner iframe').css({
          'height': '100%',
          'width': '100%',
  });

  //Settings
  if(borderColor){
    $('#feedback-inner iframe').css('border', '2px solid ' + borderColor);
  };

  if(tabOpacity){
    $('#feedback-tab img').css('opacity', tabOpacity);
  }

  $('#feedback-tab').click(toggleViima);
}

function toggleViima(){
  //If the feedback tab is hidden, show it, otherwise hide it
  if($('#feedback-inner').css('left').indexOf('-') != -1){
    $('#feedback-tab').css('left', '700px');
    $('#feedback-tab #feedback-inner').css('left', '0px');
  } else {
    $('#feedback-tab').css('left', '0px');
    $('#feedback-tab #feedback-inner').css('left', '-700px');
  }
}

//Hide the feedback widget on clicks outside the container
$(document).mouseup(function (e)
{
    var container = $('#feedback-tab');

    if (!container.is(e.target) // if the target of the click isn't the container...
        && container.has(e.target).length === 0) // ... nor a descendant of the container
    {
        $('#feedback-tab').css('left', '0px');
        $('#feedback-tab #feedback-inner').css('left', '-700px');
    }
});<commit_msg>Made the widget responsive and added many more options: now you can specify the relative height and width of the application as well as position from bottom of the page and add a custom css class<commit_after>function initiateViima(viimaId, tabImgUrl, heightFactor, widthFactor, tabOffsetFromBottom, customClassForTab, borderColor, tabOpacity){

  //Initializing variables
  if(!viimaId){
    viimaId = 'viima'
  }

  if(!tabImgUrl){
    tabImgUrl = 'https://app.viima.com/static/img/feedback.png'
  }

  if(!heightFactor){
    heightFactor = 0.8;
  }

  if(!widthFactor){
    widthFactor = 0.8;
  }

  if(!tabOffsetFromBottom){
    //Calculated based on the actual visible screen size, just applying a percentage for bottom doesn't do the trick
    tabOffsetFromBottom = 0.3;
  }

  //Calculate width and height for container based on visible screen size
  var height = heightFactor * window.innerHeight;
  var width = widthFactor * window.innerWidth;
  var containerOffset = (1-heightFactor)/2 * window.innerHeight;
  var tabOffset = tabOffsetFromBottom * window.innerHeight;

  //Appending tab to body
  $('body').append('<div id="feedback-tab"><img src="'+ tabImgUrl +'" alt="Feedback"/><div id="feedback-inner"><iframe src="https://app.viima.com/' + viimaId + '"></iframe></div></div>');

  //Setting CSS
	$('#feedback-tab').css({
          'position': 'fixed',
           'bottom':  tabOffset + 'px',
           'left': '0',
           'cursor': 'pointer',
           '-webkit-transition-duration': '0.3s',
           '-moz-transition-duration': '0.3s',
           '-o-transition-duration': '0.3s',
           'transition-duration': '0.3s',
           'z-index': '10000'
  });


  $('#feedback-inner').css({
          'position': 'fixed',
          'bottom': containerOffset + 'px',
          'left': '-' + width + 'px',
          '-webkit-transition-duration': '0.3s',
          '-moz-transition-duration': '0.3s',
          '-o-transition-duration': '0.3s',
          'transition-duration': '0.3s',
          'height': height + 'px',
          'width': width + 'px',
          'overflow': 'hidden',
          'z-index': '10000'
  });

  $('#feedback-inner iframe').css({
          'height': '100%',
          'width': '100%',
          'z-index': '10001'
  });

  //Extra style settings
  if(borderColor){
    $('#feedback-inner iframe').css('border', '3px solid ' + borderColor);
  };

  if(tabOpacity){
    $('#feedback-tab img').css('opacity', tabOpacity);
  }

  if(customClassForTab){
    $('#feedback-tab').addClass(customClassForTab);
  }

  $('#feedback-tab').click(toggleViima);

  function toggleViima(){
    //If the feedback tab is hidden, show it, otherwise hide it
    if($('#feedback-inner').css('left').indexOf('-') != -1){
      $('#feedback-tab').css('left', width + 'px');
      $('#feedback-tab #feedback-inner').css('left', '0px');
      $('#feedback-tab #feedback-inner').css('bottom', containerOffset + 'px');
    } else {
      $('#feedback-tab').css('left', '0px');
      $('#feedback-tab #feedback-inner').css('left', '-' + width + 'px');
    }
  }

  //Hide the feedback widget on clicks outside the container
  $(document).mouseup(function (e)
  {
      var container = $('#feedback-tab');

      if (!container.is(e.target) // if the target of the click isn't the container...
          && container.has(e.target).length === 0) // ... nor a descendant of the container
      {
          $('#feedback-tab').css('left', '0px');
          $('#feedback-tab #feedback-inner').css('left', '-' + width + 'px');
      }
  });
}
{'fraction_non_alphanumeric': 0.20298710115410726, 'fraction_numerical': 0.017651052274270197, 'mean_word_length': 2.789710610932476, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 4, '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': '2233149', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1838, 'n_words': 411}