<commit_before>/**
 * jquery-analogpad-plugin - jQuery plugin for emulate analog pad controller.
 *
 * https://github.com/hakobera/jquery-analogpad-plugin
 * version: 0.1
 *
 * Copyright 2011, <NAME> (@hakobera)
 * Licensed under the MIT licenses (MIT-LICENSE.txt). 
 */
jQuery.fn.extend({
    analogpad: function(args) {
        var clicked = false;
        var self = $(this);
        var x, y, sx, sy, cx, cy;

        self.addClass('analogpad')
        var base = $('<div>').addClass('analogpad-base').appendTo(self);
        var pad = $('<div>').addClass('analogpad-pad').appendTo(base);

        x =  cx = pad.css('left').replace("px", "") | 0;
        y =  cy = pad.css('top').replace("px", "") | 0;

        var onMoveStart = function() {
            clicked = true;
            var e = (event.touches ? event.touches[0] : event);
            sx = e.pageX | 0;
            sy = e.pageY | 0;
        };

        var onMoveEnd = function() {
            pad.css({ 'left': '', 'top': ''});
            clicked = false;
            x = cx;
            y = cy;
        };

        var onMove = function() {
            if (clicked) {
                event.preventDefault();
                var e = (event.touches ? event.touches[0] : event);
                var px = e.pageX | 0;
                var py =  e.pageY | 0;
                var left = pad.css('left').replace("px", "") | 0;
                var top = pad.css('top').replace("px", "") | 0;
                var dx = px - sx;
                var dy = py - sy;

                x = left + dx;
                y = top + dy;
                sx = px;
                sy = py;
                x = Math.max(0, Math.min(2*cx, x));
                y = Math.max(0, Math.min(2*cy, y));

                pad.css({ 'left': x + 'px', 'top': y + 'px'});
            }
        };

        pad.mousedown(onMoveStart);
        pad.bind('touchstart', onMoveStart);<commit_msg>Set wait for onMove event prevent slow down cause event queue overflow.<commit_after>/**
 * jquery-analogpad-plugin - jQuery plugin for emulate analog pad controller.
 *
 * https://github.com/hakobera/jquery-analogpad-plugin
 * version: 0.1
 *
 * Copyright 2011, <NAME> (@hakobera)
 * Licensed under the MIT licenses (MIT-LICENSE.txt). 
 */
jQuery.fn.extend({
    analogpad: function(args) {
        var clicked = false;
        var self = $(this);
        var x, y, sx, sy, cx, cy;

        self.addClass('analogpad')
        var base = $('<div>').addClass('analogpad-base').appendTo(self);
        var pad = $('<div>').addClass('analogpad-pad').appendTo(base);

        x =  cx = pad.css('left').replace("px", "") | 0;
        y =  cy = pad.css('top').replace("px", "") | 0;

        var onMoveStart = function() {
            clicked = true;
            var e = (event.touches ? event.touches[0] : event);
            sx = e.pageX | 0;
            sy = e.pageY | 0;
        };

        var onMoveEnd = function() {
            pad.css({ 'left': '', 'top': ''});
            clicked = false;
            x = cx;
            y = cy;
        };

        var wait = false;
        var onMove = function() {
            if (clicked && !wait) {
                wait = true;
                
                event.preventDefault();
                var e = (event.touches ? event.touches[0] : event);
                var px = e.pageX | 0;
                var py =  e.pageY | 0;
                var left = pad.css('left').replace("px", "") | 0;
                var top = pad.css('top').replace("px", "") | 0;
                var dx = px - sx;
                var dy = py - sy;

                x = left + dx;
                y = top + dy;
                sx = px;
                sy = py;
                x = Math.max(0, Math.min(2*cx, x));
                y = Math.max(0, Math.min(2*cy, y));

                pad.css({ 'left': x + 'px', 'top': y + 'px'});

                setTimeout(function() { wait = false; }, 100);
            }
        };

        pad.mousedown(onMoveStart);
        pad.bind('touchstart', onMoveStart);
{'fraction_non_alphanumeric': 0.1643971280019807, 'fraction_numerical': 0.010646199554345134, 'mean_word_length': 1.4499696785930867, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '5358312', 'n_tokens_mistral': 1323, 'n_tokens_neox': 1249, 'n_words': 308}