<commit_before>/**
 * @author <NAME> [Ajnasz] http://ajnasz.hu <EMAIL> 
 * @licence General Public Licence v2 
 */
HP = function() {
  this.M = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
  this.get.M = this.set.M = this.M;
};
HP.prototype = {
  M: null, // Manager
  get: {
    trolls: function() {
      return this.M.getCharPref('extensions.hupper.trolls');
    },
    /**
    * @return {Boolean}
    */
    filtertrolls: function() {
      return this.M.getBoolPref('extensions.hupper.filtertrolls');
    },
    trollcolor: function() {
      return this.M.getCharPref('extensions.hupper.trollcolor');
    },
    /**
    * @return hide, hilight
    */
    trollfiltermethod: function() {
      // hide, hilight
      return this.M.getCharPref('extensions.hupper.trollfiltermethod');
    },
    /**
    * @return {String}
    */
    huppers: function() {
      return this.M.getCharPref('extensions.hupper.huppers');
    },
    filterhuppers: function() {
      return this.M.getBoolPref('extensions.hupper.filterhuppers');
    },
    huppercolor: function() {
      return this.M.getCharPref('extensions.hupper.huppercolor');
    },
    replacenewcommenttext: function() {
      return this.M.getBoolPref('extensions.hupper.replacenewcommenttext');
    },
    newcommenttext: function() {
      return this.M.getCharPref('extensions.hupper.newcommenttext');
    },
    extracommentlinks: function() {
      return this.M.getBoolPref('extensions.hupper.extracommentlinks');
    },
    hilightforumlinesonhover: function() {
      return this.M.getBoolPref('extensions.hupper.hilightforumlinesonhover');
    },
    insertpermalink: function() {
      return this.M.getBoolPref('extensions.hupper.insertpermalink');
    },
    insertnewtexttonode: function() {
      return this.M.getBoolPref('extensions.hupper.insertnewtexttonode');
    },
    fadeparentcomment: function() {
      return this.M.getBoolPref('extensions.hupper.fadeparentcomment');
    },
    showqnavbox: function() {
      return this.M.getBoolPref('extensions.hupper.showqnavbox');
    },
    hidetrollanswers: function() {
      return this.M.getBoolPref('extensions.hupper.hidetrollanswers');
    },
    hideads: function() {
      return this.M.getBoolPref('extensions.hupper.hideads');
    },
    highlightusers: function() {
      return this.M.getCharPref('extensions.hupper.highlightusers');
    }
  },
  set: {
    M: this.M,
    trolls: function(value) {
      this.M.setCharPref('extensions.hupper.trolls', value);
    },
    /**
    * @return {Boolean}
    */
    filtertrolls: function(value) {
      this.M.setBoolPref('extensions.hupper.filtertrolls', value);
    },
    /**
    * @return hide, hilight
    */
    trollfiltermethod: function(value) {
      // hide, hilight
      this.M.setCharPref('extensions.hupper.trollfiltermethod', value);
    },
    trollcolor: function(value) {
      this.M.setCharPref('extensions.hupper.trollcolor', value);
    },
    /**
    * @return {String}
    */
    huppers: function(value) {
      this.M.setCharPref('extensions.hupper.huppers', value);
    },
    filterhuppers: function(value) {
      this.M.setBoolPref('extensions.hupper.filterhuppers', value);
    },
    huppercolor: function(value) {
      this.M.setCharPref('extensions.hupper.huppercolor', value);
    },
    replacenewcommenttext: function(value) {
      this.M.setBoolPref('extensions.hupper.replacenewcommenttext', value);
    },
    newcommenttext: function(value) {
      this.M.setCharPref('extensions.hupper.newcommenttext', value);
    },
    extracommentlinks: function(value) {
      this.M.setBoolPref('extensions.hupper.extracommentlinks', value);
    },
    hilightforumlinesonhover: function(value) {
      this.M.setBoolPref('extensions.hupper.hilightforumlinesonhover', value);
    },
    insertpermalink: function(value) {
      this.M.setBoolPref('extensions.hupper.insertpermalink', value);
    },
    insertnewtexttonode: function(value) {
      this.M.setBoolPref('extensions.hupper.insertnewtexttonode', value);
    },
    fadeparentcomment: function(value) {
      this.M.setBoolPref('extensions.hupper.fadeparentcomment', value);
    },
    showqnavbox: function(value) {
      this.M.setBoolPref('extensions.hupper.showqnavbox', value);
    },
    hidetrollanswers: function(value) {
      this.M.setBoolPref('extensions.hupper.hidetrollanswers', value);
    },
    hideads: function(value) {
      this.M.setBoolPref('extensions.hupper.hideads', value);
    },
    highlightusers: function(value) {
      this.M.setCharPref('extensions.hupper.highlightusers', value);
    },
  }
};
setPrefWinVals = function() {
  document.getElementById('enable-trollfilter').checked = hp.get.filtertrolls();
  document.getElementById('trolls').value = hp.get.trolls();
  document.getElementById('troll-color').value = hp.get.trollcolor();
  document.getElementById('trollfilter-method').value = hp.get.trollfiltermethod();
  document.getElementById('enable-hupperfilter').checked = hp.get.filterhuppers();
  document.getElementById('huppers').value = hp.get.huppers();
  document.getElementById('hupper-color').value = hp.get.huppercolor();
  document.getElementById('enable-new-comment-changer').checked = hp.get.replacenewcommenttext();
  document.getElementById('new-comment-text').value = hp.get.newcommenttext();
  document.getElementById('enable-extra-comment-links').checked = hp.get.extracommentlinks();
  document.getElementById('hilight-forum-lines-onhover').checked = hp.get.hilightforumlinesonhover();
  document.getElementById('insert-permalink').checked = hp.get.insertpermalink();
  document.getElementById('insert-new-text-to-node').checked = hp.get.insertnewtexttonode();
  document.getElementById('fade-parent-comment').checked = hp.get.fadeparentcomment();
  document.getElementById('show-quick-nav-box').checked = hp.get.showqnavbox();
  document.getElementById('hide-troll-answers').checked = hp.get.hidetrollanswers();
  document.getElementById('hupper-highlightusers').value = hp.get.highlightusers();
};
savePreferences = function() {
  if(!checkHLUsers()) {return false;}
  hp.set.filtertrolls(document.getElementById('enable-trollfilter').checked);
  hp.set.trolls(document.getElementById('trolls').value);
  hp.set.trollcolor(document.getElementById('troll-color').value);
  hp.set.trollfiltermethod(document.getElementById('trollfilter-method').value);
  hp.set.filterhuppers(document.getElementById('enable-hupperfilter').checked);
  hp.set.huppers(document.getElementById('huppers').value);
  hp.set.huppercolor(document.getElementById('hupper-color').value);
  hp.set.replacenewcommenttext(document.getElementById('enable-new-comment-changer').checked);
  hp.set.newcommenttext(document.getElementById('new-comment-text').value);
  hp.set.extracommentlinks(document.getElementById('enable-extra-comment-links').checked);
  hp.set.hilightforumlinesonhover(document.getElementById('hilight-forum-lines-onhover').checked);
  hp.set.insertpermalink(document.getElementById('insert-permalink').checked);
  hp.set.insertnewtexttonode(document.getElementById('insert-new-text-to-node').checked);
  hp.set.fadeparentcomment(document.getElementById('fade-parent-comment').checked);
  hp.set.showqnavbox(document.getElementById('show-quick-nav-box').checked);
  hp.set.hidetrollanswers(document.getElementById('hide-troll-answers').checked);
  hp.set.highlightusers(document.getElementById('hupper-highlightusers').value);
  return true;
};
var disableFields = function() {
  document.getElementById('trollfilter-method').addEventListener('command', onChangeFilterMethod, false);
};
var onChangeFilterMethod = function() {
  if(document.getElementById('trollfilter-method').value == 'hide') {
    document.getElementById('hide-troll-answers').disabled = false;
  } else {
    document.getElementById('hide-troll-answers').disabled = true;
  }
};
var checkHLUsers = function() {
  var hlUsers = document.getElementById('hupper-highlightusers').value.split(',');
  var trolls = document.getElementById('troll-color').value.split(',');
  var huppers = document.getElementById('huppers').value.split(',');
  var hlUsersObj = {};
  for(var i = 0, hlUsers.length, hlUser; i < hl; i++) {
    hlUser = hlUsers[i].split(':');
    hlUsersObj[hlUser[0]] = hlUsers[1];
  }
  var used = new Array();
  for(i = 0, hl = huppers.length; i < hl; i++) {
    if(hlUsersObj[huppers[i]]) {
      used.push(huppers[i]);
    }
  }
  for(i = 0, trolls.length;; i < tl i++) {
    if(hlUsersObj[huppers[i]]) {<commit_msg>[svn]  - remove HP, moved to hp.js  - fix some for loop  - add login save functions<commit_after>/**
 * @author <NAME> [Ajnasz] http://ajnasz.hu <EMAIL> 
 * @licence General Public Licence v2 
 */
setPrefWinVals = function() {
  document.getElementById('enable-trollfilter').checked = hp.get.filtertrolls();
  document.getElementById('trolls').value = hp.get.trolls();
  document.getElementById('troll-color').value = hp.get.trollcolor();
  document.getElementById('trollfilter-method').value = hp.get.trollfiltermethod();
  document.getElementById('enable-hupperfilter').checked = hp.get.filterhuppers();
  document.getElementById('huppers').value = hp.get.huppers();
  document.getElementById('hupper-color').value = hp.get.huppercolor();
  document.getElementById('enable-new-comment-changer').checked = hp.get.replacenewcommenttext();
  document.getElementById('new-comment-text').value = hp.get.newcommenttext();
  document.getElementById('enable-extra-comment-links').checked = hp.get.extracommentlinks();
  document.getElementById('hilight-forum-lines-onhover').checked = hp.get.hilightforumlinesonhover();
  document.getElementById('insert-permalink').checked = hp.get.insertpermalink();
  document.getElementById('insert-new-text-to-node').checked = hp.get.insertnewtexttonode();
  document.getElementById('fade-parent-comment').checked = hp.get.fadeparentcomment();
  document.getElementById('show-quick-nav-box').checked = hp.get.showqnavbox();
  document.getElementById('hide-troll-answers').checked = hp.get.hidetrollanswers();
  document.getElementById('hupper-highlightusers').value = hp.get.highlightusers();
  document.getElementById('hupper-password').value = new _passwordManager().getPassword();
  document.getElementById('hupper-username').value = hp.get.username();
};
savePreferences = function() {
  if(!checkHLUsers()) {return false;}
  hp.set.filtertrolls(document.getElementById('enable-trollfilter').checked);
  hp.set.trolls(document.getElementById('trolls').value);
  hp.set.trollcolor(document.getElementById('troll-color').value);
  hp.set.trollfiltermethod(document.getElementById('trollfilter-method').value);
  hp.set.filterhuppers(document.getElementById('enable-hupperfilter').checked);
  hp.set.huppers(document.getElementById('huppers').value);
  hp.set.huppercolor(document.getElementById('hupper-color').value);
  hp.set.replacenewcommenttext(document.getElementById('enable-new-comment-changer').checked);
  hp.set.newcommenttext(document.getElementById('new-comment-text').value);
  hp.set.extracommentlinks(document.getElementById('enable-extra-comment-links').checked);
  hp.set.hilightforumlinesonhover(document.getElementById('hilight-forum-lines-onhover').checked);
  hp.set.insertpermalink(document.getElementById('insert-permalink').checked);
  hp.set.insertnewtexttonode(document.getElementById('insert-new-text-to-node').checked);
  hp.set.fadeparentcomment(document.getElementById('fade-parent-comment').checked);
  hp.set.showqnavbox(document.getElementById('show-quick-nav-box').checked);
  hp.set.hidetrollanswers(document.getElementById('hide-troll-answers').checked);
  hp.set.highlightusers(document.getElementById('hupper-highlightusers').value);
  hp.set.username(document.getElementById('hupper-username').value);
  new _passwordManager().addPassword(document.getElementById('hupper-password').value);
  return true;
};
var disableFields = function() {
  document.getElementById('trollfilter-method').addEventListener('command', onChangeFilterMethod, false);
};
var onChangeFilterMethod = function() {
  if(document.getElementById('trollfilter-method').value == 'hide') {
    document.getElementById('hide-troll-answers').disabled = false;
  } else {
    document.getElementById('hide-troll-answers').disabled = true;
  }
};
var checkHLUsers = function() {
  var hlUsers = document.getElementById('hupper-highlightusers').value.split(',');
  var trolls = document.getElementById('troll-color').value.split(',');
  var huppers = document.getElementById('huppers').value.split(',');
  var hlUsersObj = {};
  for(var i = 0, hl = hlUsers.length, hlUser; i < hl; i++) {
    hlUser = hlUsers[i].split(':');
    hlUsersObj[hlUser[0]] = hlUsers[1];
  }
  var used = new Array();
  for(var i = 0, hl = huppers.length; i < hl; i++) {
    if(hlUsersObj[huppers[i]]) {
      used.push(huppers[i]);
    }
  }
  for(var i = 0,tl= trolls.length; i < tl; i++) {
    if(hlUsersObj[huppers[i]]) {
{'fraction_non_alphanumeric': 0.16128041759422737, 'fraction_numerical': 0.000997927381592078, 'mean_word_length': 4.769707705934455, 'pattern_counts': {'":': 0, '<': 13, '<?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': '1449516', 'n_tokens_mistral': 4220, 'n_tokens_neox': 4137, 'n_words': 467}