<commit_before>import errorDialog from '../app/errorDialog';
import {getElementById} from '../common/getElement';
import getValue from '../system/getValue';
import hideQTip from '../common/hideQTip';
import jConfirm from '../common/jConfirm';
import on from '../common/on';
import partial from '../common/partial';
import removeskill from '../app/profile/removeskill';
import {sendEvent} from '../support/fshGa';

var disableDeactivatePrompts = getValue('disableDeactivatePrompts');

function debuffSuccess(aLink, json) {
  if (json.s) {aLink.parentNode.innerHTML = '';}
}

function doDebuff(aLink) { // jQuery.min
  sendEvent('profile', 'doDebuff');
  var buffId = aLink.href.match(/(\d+)$/)[1];
  removeskill(buffId).done(errorDialog).done(partial(debuffSuccess, aLink));
}

function doPrompt(aLink) {
  var onclick = aLink.getAttribute('onclick');
  var warn = onclick
    .match(/Are you sure you wish to remove the .* skill\?/)[0];
  jConfirm('Remove Skill', warn, partial(doDebuff, aLink));
}

function checkForPrompt(aLink) {
  if (!disableDeactivatePrompts) {
    doPrompt(aLink);
  } else {
    doDebuff(aLink);
  }
}

function interceptDebuff(e) {
  var aLink = e.target;
  if (aLink.tagName === 'IMG') {
    hideQTip(e.target);
    aLink = aLink.parentNode;
  } else if (aLink.tagName !== 'A') {return;}
  e.stopPropagation();
  e.preventDefault();
  checkForPrompt(aLink);
}

export default function fastDebuff() {
  var profileRightColumn = getElementById('profileRightColumn');
  if (profileRightColumn) {
    on(profileRightColumn.lastElementChild, 'click', interceptDebuff, true);
  }
}
<commit_msg>refactor disableDeactivatePrompts - stop running code at evaluate/compile<commit_after>import errorDialog from '../app/errorDialog';
import {getElementById} from '../common/getElement';
import getValue from '../system/getValue';
import hideQTip from '../common/hideQTip';
import jConfirm from '../common/jConfirm';
import on from '../common/on';
import partial from '../common/partial';
import removeskill from '../app/profile/removeskill';
import {sendEvent} from '../support/fshGa';

var disableDeactivatePrompts;

function debuffSuccess(aLink, json) {
  if (json.s) {aLink.parentNode.innerHTML = '';}
}

function doDebuff(aLink) { // jQuery.min
  sendEvent('profile', 'doDebuff');
  var buffId = aLink.href.match(/(\d+)$/)[1];
  removeskill(buffId).done(errorDialog).done(partial(debuffSuccess, aLink));
}

function doPrompt(aLink) {
  var onclick = aLink.getAttribute('onclick');
  var warn = onclick
    .match(/Are you sure you wish to remove the .* skill\?/)[0];
  jConfirm('Remove Skill', warn, partial(doDebuff, aLink));
}

function checkForPrompt(aLink) {
  if (!disableDeactivatePrompts) {
    doPrompt(aLink);
  } else {
    doDebuff(aLink);
  }
}

function interceptDebuff(e) {
  var aLink = e.target;
  if (aLink.tagName === 'IMG') {
    hideQTip(e.target);
    aLink = aLink.parentNode;
  } else if (aLink.tagName !== 'A') {return;}
  e.stopPropagation();
  e.preventDefault();
  checkForPrompt(aLink);
}

export default function fastDebuff() {
  var profileRightColumn = getElementById('profileRightColumn');
  if (profileRightColumn) {
    disableDeactivatePrompts = getValue('disableDeactivatePrompts');
    on(profileRightColumn.lastElementChild, 'click', interceptDebuff, true);
  }
}

{'fraction_non_alphanumeric': 0.15451807228915662, 'fraction_numerical': 0.0012048192771084338, 'mean_word_length': 4.7357512953367875, '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': '2109464', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1072, 'n_words': 239}