<commit_before>'use strict';

(function ($, window, document) {
  function radialMenu(checkCallback) {
    var mouseX = 0;
    var mouseY = 0;
    var radialMidX = 0;
    var radialMidY = 0;
    //var currentRadialSelected = null;
    var canMove = true;

    /*$('#click').click(function () {
      canMove = !canMove;
    });*/

    $(document).on('mouseup', function (e) {
      mouseX = e.pageX;
      mouseY = e.pageY;
      if (!canMove) {
        var isRightMB;
        e = e || window.event;
        if ('which' in e) {
          isRightMB = e.which === 3;
        } else if ('button' in e) {
          isRightMB = e.button === 2;
        }

        if (isRightMB) {
          var deltax = mouseX - radialMidX;
          var deltay = -mouseY + radialMidY;
          var d = Math.sqrt(Math.pow(deltax, 2) + Math.pow(deltay, 2));
          //$('.sector').css('border-bottom-color', 'royalblue');
          $('.sector').removeClass('selected');
          $('.sectorlabel').removeClass('selected');
          if (d > 13) { // is 5 pixels a good amount to signify a drag evt
            $('.vertex').removeClass('selvertex');
            var r;
            if (deltay >= 0) {
              if (deltax >= 0) { // Q1
                r = (3 * Math.PI / 2) - Math.atan(deltay / deltax);
              } else { // Q2
                r = (Math.PI / 2) + Math.atan(deltay / (-deltax));
              }
            } else {
              if (deltax >= 0) { // Q4
                r = (3 * Math.PI / 2) + Math.atan((-deltay) / (deltax));
              } else { // Q3
                r = (Math.PI / 2) - Math.atan((-deltay) / (-deltax));
              }
            }
            var sang = (2 * Math.PI) / n;
            var matchwhichsector = Math.floor((r + (sang / 2)) / sang);
            if (matchwhichsector === n) { // because im dumb
              matchwhichsector = 0;
            }
            //$('#sector' + matchwhichsector).addClass('selected');
            //$('#sectorlabel' + matchwhichsector).addClass('selected');
            //$('#sector' + matchwhichsector).css('border-bottom-color', 'darkblue');
            //window.location = $('#sectorlabel' + matchwhichsector).find('a').get(0).href;
            if (!$('#sectorlabel' + matchwhichsector).find('a').hasClass('disabled')) {
              $('#sectorlabel' + matchwhichsector).find('a').get(0).click();
            }
          } else {
            $('.vertex').addClass('selvertex');
          }
        }
        canMove = true;
        $('.radialmenu').removeClass('paused');
      }
    });

    $(document).on('contextmenu', function (e) {
      if (!e.altKey) { // ALT Right Click => Standard Context Menu
        e.preventDefault();
        e.stopPropagation();
        return false;
      }
    });

    $(document).on('mousedown', function (e) {
      var isRightMB;
      e = e || window.event;
      if ('which' in e) {
        isRightMB = e.which === 3;
      } else if ('button' in e) {
        isRightMB = e.button === 2;
      }

      if (isRightMB) {
        if (canMove) {
          canMove = false;
          $('.sector').removeClass('selected');
          $('.sectorlabel').removeClass('selected');
          $('.sector').removeClass('disabled');
          $('.sectorlabel').removeClass('disabled');
          $('.vertex').addClass('selvertex');

          if (checkCallback) {
            checkCallback();
          }

          setTimeout(function () {
            //limit menu
            $.each($('.sectorlabel'), function (index, child) {
              if ($(child).find('a').hasClass('disabled')) {
                $('#sector' + index).addClass('disabled');
                $('#sectorlabel' + index).addClass('disabled');
              }
            });

            //show menu
            $('.radialmenu').addClass('paused');
          }, 0);
        } else {
          canMove = true;
          setTimeout(function () {
            $('.radialmenu').removeClass('paused');
          }, 0);
        }
        return false;
      }
    });

    function awesome(e) {
      mouseX = e.pageX;
      mouseY = e.pageY;
      if (canMove) {
        $('div.radialmenu').css('top', e.pageY).css('left', e.pageX - w - 2);
        radialMidX = e.pageX;
        radialMidY = e.pageY;
      }

      if (!canMove) {
        var isRightMB;
        e = e || window.event;
        if ('which' in e) {
          isRightMB = e.which === 3;
        } else if ('button' in e) {
          isRightMB = e.button === 2;
        }

        if (isRightMB) {
          var deltax = mouseX - radialMidX;
          var deltay = -mouseY + radialMidY;
          var d = Math.sqrt(Math.pow(deltax, 2) + Math.pow(deltay, 2));
          //$('.sector').css('border-bottom-color', 'royalblue');
          $('.sector').removeClass('selected');
          $('.sectorlabel').removeClass('selected');
          if (d > 13) { // is 5 pixels a good amount to signify a drag evt
            $('.vertex').removeClass('selvertex');
            var r;
            if (deltay >= 0) {
              if (deltax >= 0) { // Q1
                r = (3 * Math.PI / 2) - Math.atan(deltay / deltax);
              } else { // Q2
                r = (Math.PI / 2) + Math.atan(deltay / (-deltax));
              }
            } else {
              if (deltax >= 0) { // Q4
                r = (3 * Math.PI / 2) + Math.atan((-deltay) / (deltax));
              } else { // Q3
                r = (Math.PI / 2) - Math.atan((-deltay) / (-deltax));
              }
            }
            var sang = (2 * Math.PI) / n;
            var matchwhichsector = Math.floor((r + (sang / 2)) / sang);
            if (matchwhichsector === n) { // because im dumb
              matchwhichsector = 0;
            }
            //$('#sector' + matchwhichsector).css('border-bottom-color', 'darkblue');
            if ($('#sectorlabel' + matchwhichsector).find('a').hasClass('disabled')) {
              $('#sector' + matchwhichsector).addClass('disabled');
              $('#sectorlabel' + matchwhichsector).addClass('disabled');
            } else {
              $('#sector' + matchwhichsector).addClass('selected');
              $('#sectorlabel' + matchwhichsector).addClass('selected');
            }
          } else {
            $('.vertex').addClass('selvertex');
          }
        }
      }
    }

    $(document).bind('mousemove', awesome);

    String.prototype.repeat = function (num) {
      return new Array(num + 1).join(this);
    };

    $('.radial').parent().append('<div class="radialmenu">' + '<div class="sectors"></div>' + '<div class="sectorlabels"></div>' + '<div class="vertex">x</div>' + '<div class="trajectory"></div>' + '</div>');
    var n = $('.radial ul').children().length;
    var radian = 2 * Math.PI;
    //var ia = radian / n;
    var oas = (Math.PI - (radian / n)) / 2;
    var c = 100; // constant hypothenuse length
    var h = c * Math.sin(oas);
    var w = Math.sqrt(Math.pow(c, 2) - Math.pow(h, 2));
    $.each($('.radial ul').children(), function (index, child) {
      $('.sectors').append('<div class="sector" id="sector' + index + '"></div>');
      //$('.sectorlabels').append('<div class="sectorlabel" id="sectorlabel' + index + '"><div>' +child.innerHTML+ '</div></div>');
      $('.sectorlabels').append('<div class="sectorlabel" id="sectorlabel' + index + '"><div></div></div>');
      $(child).children().detach().appendTo('#sectorlabel' + index + ' div');
    });
    $('.radial').remove();

    $('.sectorlabel').css('width', 2 * w + 'px');
    $('.sectorlabel').css('padding-top', (h - 30) + 'px');
    $('.sector').css('border-width', '0 ' + w + 'px ' + h + 'px ' + w + 'px');
    $('.vertex').css('left', w - 5 + 'px');

    $.each($('.sectors').children(), function (index, child) {
      var rot = index * (360 / n);
      $(child).css('-webkit-transform-origin', '50% 0%');
      $(child).css('-ms-transform-origin', '50% 0%');
      $(child).css('transform-origin', '50% 0%');
      $(child).css('-webkit-transform', 'rotate(' + rot + 'deg)');
      $(child).css('-ms-transform', 'rotate(' + rot + 'deg)');
      $(child).css('transform', 'rotate(' + rot + 'deg)');
      /*if (n % 2 === 0) {
        if (index % 2 === 0) {
          //$(child).css('border-bottom-color','royalblue');
        }
      } else {

      }*/
    });

    $.each($('.sectorlabels').children(), function (index, child) {
      var rot = index * (360 / n);
      $(child).css('-webkit-transform-origin', '50% 0%');
      $(child).css('-ms-transform-origin', '50% 0%');
      $(child).css('transform-origin', '50% 0%');
      $(child).css('-webkit-transform', 'rotate(' + rot + 'deg)');
      $(child).css('-ms-transform', 'rotate(' + rot + 'deg)');
      $(child).css('transform', 'rotate(' + rot + 'deg)');
      if (90 < rot && rot < 270) {
        //$(child).childNodes()[0].css("-webkit-transform-origin", "50% 0%" );
        //$(child).css('top',h+'px)');
        $($(child).children()[0]).css('-webkit-transform', 'rotate(180deg)');
        $($(child).children()[0]).css('-ms-transform', 'rotate(180deg)');
        $($(child).children()[0]).css('transform', 'rotate(180deg)');
        //$(child).css('margin-top',-h-20+'px');
      }
    });
  }
  window.radialMenu = radialMenu;
})(jQuery, window, window.document);
<commit_msg>allow normal context menu on alt click<commit_after>'use strict';

(function ($, window, document) {
  function radialMenu(checkCallback) {
    var mouseX = 0;
    var mouseY = 0;
    var radialMidX = 0;
    var radialMidY = 0;
    //var currentRadialSelected = null;
    var canMove = true;

    /*$('#click').click(function () {
      canMove = !canMove;
    });*/

    $(document).off('mouseup.radialMenu').on('mouseup.radialMenu', function (e) {
      mouseX = e.pageX;
      mouseY = e.pageY;
      if (!canMove) {
        var isRightMB;
        e = e || window.event;
        if ('which' in e) {
          isRightMB = e.which === 3;
        } else if ('button' in e) {
          isRightMB = e.button === 2;
        }

        if (isRightMB) {
          var deltax = mouseX - radialMidX;
          var deltay = -mouseY + radialMidY;
          var d = Math.sqrt(Math.pow(deltax, 2) + Math.pow(deltay, 2));
          //$('.sector').css('border-bottom-color', 'royalblue');
          $('.sector').removeClass('selected');
          $('.sectorlabel').removeClass('selected');
          if (d > 13) { // is 5 pixels a good amount to signify a drag evt
            $('.vertex').removeClass('selvertex');
            var r;
            if (deltay >= 0) {
              if (deltax >= 0) { // Q1
                r = (3 * Math.PI / 2) - Math.atan(deltay / deltax);
              } else { // Q2
                r = (Math.PI / 2) + Math.atan(deltay / (-deltax));
              }
            } else {
              if (deltax >= 0) { // Q4
                r = (3 * Math.PI / 2) + Math.atan((-deltay) / (deltax));
              } else { // Q3
                r = (Math.PI / 2) - Math.atan((-deltay) / (-deltax));
              }
            }
            var sang = (2 * Math.PI) / n;
            var matchwhichsector = Math.floor((r + (sang / 2)) / sang);
            if (matchwhichsector === n) { // because im dumb
              matchwhichsector = 0;
            }
            //$('#sector' + matchwhichsector).addClass('selected');
            //$('#sectorlabel' + matchwhichsector).addClass('selected');
            //$('#sector' + matchwhichsector).css('border-bottom-color', 'darkblue');
            //window.location = $('#sectorlabel' + matchwhichsector).find('a').get(0).href;
            if (!$('#sectorlabel' + matchwhichsector).find('a').hasClass('disabled')) {
              $('#sectorlabel' + matchwhichsector).find('a').get(0).click();
            }
          } else {
            $('.vertex').addClass('selvertex');
          }
        }
        canMove = true;
        $('.radialmenu').removeClass('paused');
      }
    });

    $(document).off('contextmenu.radialMenu').on('contextmenu.radialMenu', function (e) {
      if (!e.altKey) { // ALT Right Click => Standard Context Menu
        e.preventDefault();
        e.stopPropagation();
        return false;
      }
    });

    $(document).off('mousedown.radialMenu').on('mousedown.radialMenu', function (e) {
      var isRightMB;
      e = e || window.event;
      if ('which' in e) {
        isRightMB = e.which === 3;
      } else if ('button' in e) {
        isRightMB = e.button === 2;
      }

      if (isRightMB && !e.altKey) {
        if (canMove) {
          canMove = false;
          $('.sector').removeClass('selected');
          $('.sectorlabel').removeClass('selected');
          $('.sector').removeClass('disabled');
          $('.sectorlabel').removeClass('disabled');
          $('.vertex').addClass('selvertex');

          if (checkCallback) {
            checkCallback();
          }

          setTimeout(function () {
            //limit menu
            $.each($('.sectorlabel'), function (index, child) {
              if ($(child).find('a').hasClass('disabled')) {
                $('#sector' + index).addClass('disabled');
                $('#sectorlabel' + index).addClass('disabled');
              }
            });

            //show menu
            $('.radialmenu').addClass('paused');
          }, 0);
        } else {
          canMove = true;
          setTimeout(function () {
            $('.radialmenu').removeClass('paused');
          }, 0);
        }
        return false;
      }
    });

    function menuMove(e) {
      mouseX = e.pageX;
      mouseY = e.pageY;
      if (canMove) {
        $('div.radialmenu').css('top', e.pageY).css('left', e.pageX - w - 2);
        radialMidX = e.pageX;
        radialMidY = e.pageY;
      }

      if (!canMove) {
        var isRightMB;
        e = e || window.event;
        if ('which' in e) {
          isRightMB = e.which === 3;
        } else if ('button' in e) {
          isRightMB = e.button === 2;
        }

        if (isRightMB) {
          var deltax = mouseX - radialMidX;
          var deltay = -mouseY + radialMidY;
          var d = Math.sqrt(Math.pow(deltax, 2) + Math.pow(deltay, 2));
          //$('.sector').css('border-bottom-color', 'royalblue');
          $('.sector').removeClass('selected');
          $('.sectorlabel').removeClass('selected');
          if (d > 13) { // is 5 pixels a good amount to signify a drag evt
            $('.vertex').removeClass('selvertex');
            var r;
            if (deltay >= 0) {
              if (deltax >= 0) { // Q1
                r = (3 * Math.PI / 2) - Math.atan(deltay / deltax);
              } else { // Q2
                r = (Math.PI / 2) + Math.atan(deltay / (-deltax));
              }
            } else {
              if (deltax >= 0) { // Q4
                r = (3 * Math.PI / 2) + Math.atan((-deltay) / (deltax));
              } else { // Q3
                r = (Math.PI / 2) - Math.atan((-deltay) / (-deltax));
              }
            }
            var sang = (2 * Math.PI) / n;
            var matchwhichsector = Math.floor((r + (sang / 2)) / sang);
            if (matchwhichsector === n) { // because im dumb
              matchwhichsector = 0;
            }
            //$('#sector' + matchwhichsector).css('border-bottom-color', 'darkblue');
            if ($('#sectorlabel' + matchwhichsector).find('a').hasClass('disabled')) {
              $('#sector' + matchwhichsector).addClass('disabled');
              $('#sectorlabel' + matchwhichsector).addClass('disabled');
            } else {
              $('#sector' + matchwhichsector).addClass('selected');
              $('#sectorlabel' + matchwhichsector).addClass('selected');
            }
          } else {
            $('.vertex').addClass('selvertex');
          }
        }
      }
    }

    $(document).off('mousemove.radialMenu').on('mousemove.radialMenu', menuMove);

    String.prototype.repeat = function (num) {
      return new Array(num + 1).join(this);
    };

    $('.radial').parent().append('<div class="radialmenu">' + '<div class="sectors"></div>' + '<div class="sectorlabels"></div>' + '<div class="vertex">x</div>' + '<div class="trajectory"></div>' + '</div>');
    var n = $('.radial ul').children().length;
    var radian = 2 * Math.PI;
    //var ia = radian / n;
    var oas = (Math.PI - (radian / n)) / 2;
    var c = 100; // constant hypothenuse length
    var h = c * Math.sin(oas);
    var w = Math.sqrt(Math.pow(c, 2) - Math.pow(h, 2));
    $.each($('.radial ul').children(), function (index, child) {
      $('.sectors').append('<div class="sector" id="sector' + index + '"></div>');
      //$('.sectorlabels').append('<div class="sectorlabel" id="sectorlabel' + index + '"><div>' +child.innerHTML+ '</div></div>');
      $('.sectorlabels').append('<div class="sectorlabel" id="sectorlabel' + index + '"><div></div></div>');
      $(child).children().detach().appendTo('#sectorlabel' + index + ' div');
    });
    $('.radial').remove();

    $('.sectorlabel').css('width', 2 * w + 'px');
    $('.sectorlabel').css('padding-top', (h - 30) + 'px');
    $('.sector').css('border-width', '0 ' + w + 'px ' + h + 'px ' + w + 'px');
    $('.vertex').css('left', w - 5 + 'px');

    $.each($('.sectors').children(), function (index, child) {
      var rot = index * (360 / n);
      $(child).css('-webkit-transform-origin', '50% 0%');
      $(child).css('-ms-transform-origin', '50% 0%');
      $(child).css('transform-origin', '50% 0%');
      $(child).css('-webkit-transform', 'rotate(' + rot + 'deg)');
      $(child).css('-ms-transform', 'rotate(' + rot + 'deg)');
      $(child).css('transform', 'rotate(' + rot + 'deg)');
      /*if (n % 2 === 0) {
        if (index % 2 === 0) {
          //$(child).css('border-bottom-color','royalblue');
        }
      } else {

      }*/
    });

    $.each($('.sectorlabels').children(), function (index, child) {
      var rot = index * (360 / n);
      $(child).css('-webkit-transform-origin', '50% 0%');
      $(child).css('-ms-transform-origin', '50% 0%');
      $(child).css('transform-origin', '50% 0%');
      $(child).css('-webkit-transform', 'rotate(' + rot + 'deg)');
      $(child).css('-ms-transform', 'rotate(' + rot + 'deg)');
      $(child).css('transform', 'rotate(' + rot + 'deg)');
      if (90 < rot && rot < 270) {
        //$(child).childNodes()[0].css("-webkit-transform-origin", "50% 0%" );
        //$(child).css('top',h+'px)');
        $($(child).children()[0]).css('-webkit-transform', 'rotate(180deg)');
        $($(child).children()[0]).css('-ms-transform', 'rotate(180deg)');
        $($(child).children()[0]).css('transform', 'rotate(180deg)');
        //$(child).css('margin-top',-h-20+'px');
      }
    });
  }
  window.radialMenu = radialMenu;
})(jQuery, window, window.document);

{'fraction_non_alphanumeric': 0.20911413969335604, 'fraction_numerical': 0.012883304940374787, 'mean_word_length': 1.8758420085731782, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3723282', 'n_tokens_mistral': 6141, 'n_tokens_neox': 5795, 'n_words': 1185}