<commit_before>/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */

var SOGoDragHandlesInterface = {
 leftMargin: 180,
 topMargin: 140,
 dhType: null,
 dhLimit: -1,
 origX: -1,
 origLeft: -1,
 origRight: -1,
 origY: -1, 
 origUpper: -1,
 origLower: -1,
 delta: -1,
 leftBlock: null,
 rightBlock: null,
 upperBlock: null,
 lowerBlock: null,
 startHandleDraggingBound: null,
 stopHandleDraggingBound: null,
 moveBound: null,
 delayedSave: null,
 bind: function () {
    this.startHandleDraggingBound = this.startHandleDragging.bindAsEventListener(this);
    this.observe("mousedown", this.startHandleDraggingBound, false);
  },
 adjust: function () {
    if (!this.dhType)
      this._determineType();
		if (this.dhType == 'horizontal') {
			this.dhLimit = window.width() - 20;
			if (parseInt(this.getStyle("left")) > this.dhLimit) {
				this.setStyle({ left: this.dhLimit + "px" });
				this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' });
				this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' });
				if (this.delayedSave) window.clearTimeout(this.delayedSave);
				this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback);
			}
		}
		else if (this.dhType == 'vertical') {
			this.dhLimit = window.height() - 20 - this.upperBlock.cumulativeOffset()[1] + this.upperBlock.offsetTop;
			if (parseInt(this.getStyle("top")) > this.dhLimit) {
				this.setStyle({ top: this.dhLimit + 'px' });
				this.lowerBlock.setStyle({ top: this.dhLimit + 'px' });
				this.upperBlock.setStyle({ height: (this.dhLimit - this.upperBlock.offsetTop) + 'px' });
				if (this.delayedSave) window.clearTimeout(this.delayedSave);
				this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback);
			}
		}
	},
 _determineType: function () {
    if (this.leftBlock && this.rightBlock)
      this.dhType = 'horizontal';
    else if (this.upperBlock && this.lowerBlock)
      this.dhType = 'vertical';
  },
 startHandleDragging: function (event) {
    if (!this.dhType)
      this._determineType();
    var targ = getTarget(event);
    if (targ.nodeType == 1) {
      if (this.dhType == 'horizontal') {
				this.dhLimit = window.width() - 20;
        this.origX = this.offsetLeft;
        this.origLeft = this.leftBlock.offsetWidth;
				this.delta = 0;
        this.origRight = this.rightBlock.offsetLeft - 5;
        document.body.setStyle({ cursor: "e-resize" });
      } else if (this.dhType == 'vertical') {
				this.dhLimit = window.height() - 20;
        this.origY = this.offsetTop;
        this.origUpper = this.upperBlock.offsetHeight;
				var pointY = Event.pointerY(event);
				if (pointY <= this.topMargin) this.delta = this.topMargin;
        else this.delta = pointY - this.offsetTop - 5;
        this.origLower = this.lowerBlock.offsetTop - 5;
        document.body.setStyle({ cursor: "n-resize" });
      }
      this.stopHandleDraggingBound = this.stopHandleDragging.bindAsEventListener(this);
      document.body.observe("mouseup", this.stopHandleDraggingBound, true);
      this.moveBound = this.move.bindAsEventListener(this);
      document.body.observe("mousemove", this.moveBound, true);
      this.move(event);
      event.cancelBubble = true;
    }

    return false;
  },
 stopHandleDragging: function (event) {
    if (!this.dhType)
      this._determineType();
    if (this.dhType == 'horizontal') {
      var pointerX = Event.pointerX(event);
      if (pointerX <= this.leftMargin) {<commit_msg>Fix for bug #3292<commit_after>/* -*- Mode: java; tab-width: 2; c-tab-always-indent: t; indent-tabs-mode: t; c-basic-offset: 2 -*- */

var SOGoDragHandlesInterface = {
 leftMargin: 180,
 topMargin: 140,
 dhType: null,
 dhLimit: -1,
 origX: -1,
 origLeft: -1,
 origRight: -1,
 origY: -1, 
 origUpper: -1,
 origLower: -1,
 delta: -1,
 leftBlock: null,
 rightBlock: null,
 upperBlock: null,
 lowerBlock: null,
 startHandleDraggingBound: null,
 stopHandleDraggingBound: null,
 moveBound: null,
 delayedSave: null,
 bind: function () {
    this.startHandleDraggingBound = this.startHandleDragging.bindAsEventListener(this);
    this.observe("mousedown", this.startHandleDraggingBound, false);
  },
 adjust: function () {
    if (!this.dhType)
      this._determineType();
		if (this.dhType == 'horizontal') {
			this.dhLimit = window.width() - 20;
			if (parseInt(this.getStyle("left")) > this.dhLimit) {
				this.setStyle({ left: this.dhLimit + "px" });
				this.rightBlock.setStyle({ left: (this.dhLimit) + 'px' });
				this.leftBlock.setStyle({ width: (this.dhLimit) + 'px' });
				if (this.delayedSave) window.clearTimeout(this.delayedSave);
				this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback);
			}
		}
		else if (this.dhType == 'vertical') {
			this.dhLimit = window.height() - 20 - this.upperBlock.cumulativeOffset()[1] + this.upperBlock.offsetTop;
			if (parseInt(this.getStyle("top")) > this.dhLimit) {
				this.setStyle({ top: this.dhLimit + 'px' });
				this.lowerBlock.setStyle({ top: this.dhLimit + 'px' });
				this.upperBlock.setStyle({ height: (this.dhLimit - this.upperBlock.offsetTop) + 'px' });
				if (this.delayedSave) window.clearTimeout(this.delayedSave);
				this.delayedSave = this.saveDragHandleState.delay(3, this.dhType, this.dhLimit, this.saveDragHandleStateCallback);
			}
		}
	},
 _determineType: function () {
    if (this.leftBlock && this.rightBlock)
      this.dhType = 'horizontal';
    else if (this.upperBlock && this.lowerBlock)
      this.dhType = 'vertical';
  },
 startHandleDragging: function (event) {
    if (!this.dhType)
      this._determineType();
    var targ = getTarget(event);
    if (targ.nodeType == 1) {
      if (this.dhType == 'horizontal') {
				this.dhLimit = window.width() - 20;
        this.origX = this.offsetLeft;
        this.origLeft = this.leftBlock.offsetWidth;
				this.delta = 0;
        this.origRight = this.rightBlock.offsetLeft - 5;
        document.body.setStyle({ cursor: "e-resize" });
      } else if (this.dhType == 'vertical') {
				this.dhLimit = window.height() - 20;
        this.origY = this.offsetTop;
        this.origUpper = this.upperBlock.offsetHeight;
				var pointY = Event.pointerY(event);
				if (pointY < this.topMargin) this.delta = this.topMargin;
        else this.delta = pointY - this.offsetTop - 5;
        this.origLower = this.lowerBlock.offsetTop - 5;
        document.body.setStyle({ cursor: "n-resize" });
      }
      this.stopHandleDraggingBound = this.stopHandleDragging.bindAsEventListener(this);
      document.body.observe("mouseup", this.stopHandleDraggingBound, true);
      this.moveBound = this.move.bindAsEventListener(this);
      document.body.observe("mousemove", this.moveBound, true);
      this.move(event);
      event.cancelBubble = true;
    }

    return false;
  },
 stopHandleDragging: function (event) {
    if (!this.dhType)
      this._determineType();
    if (this.dhType == 'horizontal') {
      var pointerX = Event.pointerX(event);
      if (pointerX <= this.leftMargin) {
{'fraction_non_alphanumeric': 0.15020316659660923, 'fraction_numerical': 0.009527812806501331, 'mean_word_length': 3.400739827373613, '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': '4139130', 'n_tokens_mistral': 2526, 'n_tokens_neox': 2361, 'n_words': 459}