<commit_before>angular.module('connecting', [
  'utils'
])

.controller('connectingController', [
  '$scope',
  '$http',
  '$stateParams',
  '$rootScope',
  'fileTransfer',
  'webRTC',
  'packetHandlers',
  'fileUpload',
  function($scope, $http, $stateParams, $rootScope, fileTransfer, webRTC, packetHandlers, fileUpload) {
    console.log('connecting controller loaded');
    /**
     * if arriving from redirect,
     * sender has access to their own peer object,
     * becasue it's on the fileTransfer
     *
     * if arriving from a link,
     * follow the code below:
     */
     var hadGlowing = false;
     var hadWaiting = false;
     var hadConnected = false;

    $('#lightningBoltButton').mouseenter(function() {
      if ($('#lightningBoltButton').hasClass('glowing')) {
        $('#lightningBoltButton').removeClass('glowing');
        hadGlowing = true;
      }
      if ($('#lightningBoltButton').hasClass('waitingForConnection')) {
        $('#lightningBoltButton').removeClass('waitingForConnection');
        hadWaiting = true;
      }
      if ($('#lightningBoltButton').hasClass('connectedToPeer')) {
        $('#lightningBoltButton').removeClass('connectedToPeer');
        hadConnected = true;
      }
    });

    $('#lightningBoltButton').mouseleave(function() {
      if (hadGlowing) {
        $('#lightningBoltButton').addClass('glowing');
      }
      if (hadWaiting) {
        $('#lightningBoltButton').addClass('waitingForConnection');
      }
      if (hadConnected) {
        $('#lightningBoltButton').addClass('connectedToPeer');
      }
    });

    $('#lightningBoltButton').on('click', function() {
      copyToClipboard(document.getElementById("currentUrl"));
      $('#lightningBoltButton').removeClass('glowing');
      if (hadGlowing) {
        $('#lightningBoltButton').addClass('waitingForConnection');
        hadGlowing = false;
      }
    });

    $('.currentUrlShow').removeClass('currentUrlHidden');

    setTimeout(function() {
      currentUrl.innerHTML = window.location.href;

    }, 0);

    var copyToClipboard = function(elem) {
      // create hidden text element, if it doesn't already exist
      var targetId = "_hiddenCopyText_";
      var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA";
      var origSelectionStart, origSelectionEnd;
      if (isInput) {
        // can just use the original source element for the selection and copy<commit_msg>[style] Update hovering lightning bolt in connectingController.js<commit_after>angular.module('connecting', [
  'utils'
])

.controller('connectingController', [
  '$scope',
  '$http',
  '$stateParams',
  '$rootScope',
  'fileTransfer',
  'webRTC',
  'packetHandlers',
  'fileUpload',
  function($scope, $http, $stateParams, $rootScope, fileTransfer, webRTC, packetHandlers, fileUpload) {
    console.log('connecting controller loaded');
    /**
     * if arriving from redirect,
     * sender has access to their own peer object,
     * becasue it's on the fileTransfer
     *
     * if arriving from a link,
     * follow the code below:
     */
    var savedClasses = 'btn btn-circle';

    $('#lightningBoltButton').mouseenter(function() {
      savedClasses = $('#lightningBoltButton').attr('class');
      $('#lightningBoltButton').attr('class', 'btn btn-circle');
    });

    $('#lightningBoltButton').mouseleave(function() {
      $('#lightningBoltButton').attr('class', savedClasses)
      savedClasses = 'btn btn-circle';
    });

    $('#lightningBoltButton').on('click', function() {
      copyToClipboard(document.getElementById("currentUrl"));
      $('#lightningBoltButton').removeClass('glowing');
      if (!savedClasses.includes('connectedToPeer')) {
        if (window.location.href.includes('/room/')) {
          savedClasses = 'btn btn-circle waitingForConnection';
        }
      }
    });

    $('.currentUrlShow').removeClass('currentUrlHidden');

    setTimeout(function() {
      currentUrl.innerHTML = window.location.href;

    }, 0);

    var copyToClipboard = function(elem) {
      // create hidden text element, if it doesn't already exist
      var targetId = "_hiddenCopyText_";
      var isInput = elem.tagName === "INPUT" || elem.tagName === "TEXTAREA";
      var origSelectionStart, origSelectionEnd;
      if (isInput) {
        // can just use the original source element for the selection and copy
{'fraction_non_alphanumeric': 0.15034324942791763, 'fraction_numerical': 0.0004576659038901602, 'mean_word_length': 3.357926221335992, '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': '3223795', 'n_tokens_mistral': 1240, 'n_tokens_neox': 1249, 'n_words': 259}