<commit_before>(function (window, $, undefined) {
  'use strict';
  var Touchcontroller;
  var is_touch_device = true;// 'ontouchstart' in document.documentElement;
  if (!is_touch_device)
    return;
  function setupGameController(cockpit) {
    $('#outter-videocontainer').append('<canvas id="touchcontroller" class="row-fluid full-height testoverlay"></canvas>');
    GameController.init({
      canvas: 'touchcontroller',
      left: {
        type: 'dpad',
        position: {
          left: '15%',
          bottom: '15%'
        },
        dpad: {
          touchMove: function (details) {
            cockpit.emit('rovpilot.setThrottle', details.normalizedY);
            cockpit.emit('rovpilot.setYaw', details.normalizedX);
            console.log(details.dx);
            console.log(details.dy);
            console.log(details.max);
            console.log(details.normalizedX);
            console.log(details.normalizedY);
          }
        }
      },
      bottom: {
        type: 'dpad',
        position: {
          right: '15%',
          bottom: '15%'
        },
        dpad: {
          touchMove: function (details) {
            cockpit.emit('setLift', details.normalizedY);
          }
        }
      },
      right: {
        type: 'buttons',
        position: {
          right: '25%',
          bottom: '15%'
        },
        buttons: [
          {
            label: 'lights',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-10%',
              y: 0
            },
            touchStart: function () {
              cockpit.emit('rovpilot.toggleLights');
            }
          },
          {
            label: 'up',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-25%',
              y: '-15%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.setLift', 1);
            },
            touchEnd: function () {
              cockpit.emit('rovpilot.setLift', 0);
            }
          },
          {
            label: 'down',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-25%',
              y: '0%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.setLift', -1);
            },
            touchEnd: function () {
              cockpit.emit('rovpilot.setLift', 0);
            }
          },
          {
            label: 'C-UP',
            fontSize: 10,
            radius: '5%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '5%',
              y: '-15%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.adjustCameraTilt', 0.1);
            }
          },
          {
            label: 'C-CEN',
            fontSize: 10,
            radius: '5%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '5%',
              y: '-5%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.setCameraTilt', 0);
            }
          },
          {
            label: 'C-DWN',
            fontSize: 10,
            radius: '5%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '5%',
              y: '4%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.adjustCameraTilt', -0.1);
            }
          },
          {
            label: 'laser',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-10%',
              y: '-15%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.toggleLasers');
            }
          }
        ]
      }
    });
  }

  Touchcontroller = function Touchcontroller(cockpit) {
    console.log('Loading Touchcontroller plugin in the browser.');
    if (!is_touch_device)
      return;
    setupGameController(cockpit);

    // Instance variables
    this.cockpit = cockpit;
    $(document).trigger('resize');
    // Add required UI elements
    // for plugin management:
    this.name = 'touchcontroller';
    // for the settings
    this.viewName = 'Touch controller';
    // for the UI
    this.canBeDisabled = true;
    this.enable = function () {
      $('#touchcontroller.real').show();
    };
    this.disable = function () {
      $('#touchcontroller.real').hide();
    };
  };
  window.Cockpit.plugins.push(Touchcontroller);
}(window, jQuery));<commit_msg>Fixing detection of touchcontroller<commit_after>(function (window, $, undefined) {
  'use strict';
  var Touchcontroller;
  var is_touch_device = 'ontouchstart' in document.documentElement;
  if (!is_touch_device)
    return;
  function setupGameController(cockpit) {
    $('#outter-videocontainer').append('<canvas id="touchcontroller" class="row-fluid full-height testoverlay"></canvas>');
    GameController.init({
      canvas: 'touchcontroller',
      left: {
        type: 'dpad',
        position: {
          left: '15%',
          bottom: '15%'
        },
        dpad: {
          touchMove: function (details) {
            cockpit.emit('rovpilot.setThrottle', details.normalizedY);
            cockpit.emit('rovpilot.setYaw', details.normalizedX);
            console.log(details.dx);
            console.log(details.dy);
            console.log(details.max);
            console.log(details.normalizedX);
            console.log(details.normalizedY);
          }
        }
      },
      bottom: {
        type: 'dpad',
        position: {
          right: '15%',
          bottom: '15%'
        },
        dpad: {
          touchMove: function (details) {
            cockpit.emit('setLift', details.normalizedY);
          }
        }
      },
      right: {
        type: 'buttons',
        position: {
          right: '25%',
          bottom: '15%'
        },
        buttons: [
          {
            label: 'lights',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-10%',
              y: 0
            },
            touchStart: function () {
              cockpit.emit('rovpilot.toggleLights');
            }
          },
          {
            label: 'up',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-25%',
              y: '-15%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.setLift', 1);
            },
            touchEnd: function () {
              cockpit.emit('rovpilot.setLift', 0);
            }
          },
          {
            label: 'down',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-25%',
              y: '0%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.setLift', -1);
            },
            touchEnd: function () {
              cockpit.emit('rovpilot.setLift', 0);
            }
          },
          {
            label: 'C-UP',
            fontSize: 10,
            radius: '5%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '5%',
              y: '-15%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.adjustCameraTilt', 0.1);
            }
          },
          {
            label: 'C-CEN',
            fontSize: 10,
            radius: '5%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '5%',
              y: '-5%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.setCameraTilt', 0);
            }
          },
          {
            label: 'C-DWN',
            fontSize: 10,
            radius: '5%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '5%',
              y: '4%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.adjustCameraTilt', -0.1);
            }
          },
          {
            label: 'laser',
            fontSize: 13,
            radius: '7%',
            stroke: 2,
            backgroundColor: 'blue',
            fontColor: '#fff',
            offset: {
              x: '-10%',
              y: '-15%'
            },
            touchStart: function () {
              cockpit.emit('rovpilot.toggleLasers');
            }
          }
        ]
      }
    });
  }

  Touchcontroller = function Touchcontroller(cockpit) {
    console.log('Loading Touchcontroller plugin in the browser.');
    if (!is_touch_device)
      return;
    setupGameController(cockpit);

    // Instance variables
    this.cockpit = cockpit;
    $(document).trigger('resize');
    // Add required UI elements
    // for plugin management:
    this.name = 'touchcontroller';
    // for the settings
    this.viewName = 'Touch controller';
    // for the UI
    this.canBeDisabled = true;
    this.enable = function () {
      $('#touchcontroller.real').show();
    };
    this.disable = function () {
      $('#touchcontroller.real').hide();
    };
  };
  window.Cockpit.plugins.push(Touchcontroller);
}(window, jQuery));
{'fraction_non_alphanumeric': 0.13714454976303317, 'fraction_numerical': 0.01382306477093207, 'mean_word_length': 1.2130216298885732, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4666777', 'n_tokens_mistral': 2905, 'n_tokens_neox': 2804, 'n_words': 541}