<commit_before>"use strict";

/* exported Module_CleanPage */
function Module_CleanPage() {

  var loggingEnabled = false;

  return {
    perform: perform,
  };

  function log(line) {
    if (loggingEnabled) {
      console.log("CleanPage: " + line);
    }
  }

  // is the module installed on the page
  function isInstalled() {
    var len = $('#btnToggleArticle').length;
    var result = len > 0;
    log("isInstalled: " + result + "(" + len + ")");
    return result;
  }

  //  removeSiblings - remove siblings of selector
  //    filter: selector of siblings not to remove
  //    exclude: exclude siblings with this text in tag, id, or class
  function removeSiblings(selector, filter, exclude) {
    var toRemove = filter ?
      $(selector).siblings().not(filter) : $(selector).siblings();

    toRemove.each(function (i, val) {
      var _this = $(val);
      var tag = val.nodeName.toLowerCase();
      var _id = $(val).attr('id');
      var _class = $(val).attr('class');
      var tag_id_class = tag + " id='" + _id + "' class='" + _class + "'";
      if (!exclude || !tag_id_class.includes(exclude)) {
        _this.remove();
      }
    });
  }

  // add a link to the Unicode Converter if not present
    /*
  function addUnicodeConverterLink() {
    addToolsDiv();
    
    if (!$("#unicodeConverter").length) {
      var link = $(" \
            <a id='unicodeConverter' style='margin-right: 20px;color: #0000FF;font-size: 12px;' \
                href='http://holly4.github.io/UnicodeConverter' \
                            target='_blank'>Unicode Converter \
            </a>");
      link.appendTo("#ffh-tools");
    }
  }
  */
  
  // install - install the feature
  function install(removeVideo) {
    removeSiblings('#wrapper', '#templateHolder', 'janrain');
    removeSiblings('#doc');
    removeSiblings('#content .main');
    removeSiblings('#commenting', 'article');
    $(".freeform").remove();

    if (removeVideo) {
      $(".video-container").remove();
    }

    // enable the hidden comment count
    $('#livefyre_comment_stream .fyre-stream-stats').css('display', 'inline');

    // change font on main username display to distinguish I's from l's
    $(".fyre-user-profile-link span").css("font-family", '"Tahoma"');

    // remove extra padding at the top
    $("#doc").each(function () {
      this.style.setProperty( 'padding', '0px', 'important' );
    });

    $(".main").each(function () {
      this.style.setProperty( 'padding-top', '0px', 'important' );
    });

    $("#commenting").each(function () {
      this.style.setProperty( 'padding', '0px', 'important' );
    });

    // fix issue where the main editor and the user avatar overlap making
    // it imposible to select with the mouse the first dozen or so letters in a comment
    $('#livefyre_comment_stream .fyre-editor').first().css('padding-top', 16);
    $('article').first().hide();

    // add a link to the Unicode Converter
    // TODO: Make configurable
    addUnicodeConverterLink();

    // add button to toggle article display
    // TODO: Add to commmon buttons div
    $('#content .main').prepend("<button id='toggleArticle'>Show Article</button><br>");
    $('#toggleArticle').css('margin', '20px 20px 0px 0px');
    $('#toggleArticle').click(function () {
      if ($(this).text() == 'Show Article') {
        $('article').first().show();
        $(this).text('Hide Article');
        $(this).css('margin-bottom', '20px');
      } else {
        $('article').first().hide();
        $(this).text('Show Article');<commit_msg>recomment out addUnicodeConverterLink()<commit_after>"use strict";

/* exported Module_CleanPage */
function Module_CleanPage() {

  var loggingEnabled = false;

  return {
    perform: perform,
  };

  function log(line) {
    if (loggingEnabled) {
      console.log("CleanPage: " + line);
    }
  }

  // is the module installed on the page
  function isInstalled() {
    var len = $('#btnToggleArticle').length;
    var result = len > 0;
    log("isInstalled: " + result + "(" + len + ")");
    return result;
  }

  //  removeSiblings - remove siblings of selector
  //    filter: selector of siblings not to remove
  //    exclude: exclude siblings with this text in tag, id, or class
  function removeSiblings(selector, filter, exclude) {
    var toRemove = filter ?
      $(selector).siblings().not(filter) : $(selector).siblings();

    toRemove.each(function (i, val) {
      var _this = $(val);
      var tag = val.nodeName.toLowerCase();
      var _id = $(val).attr('id');
      var _class = $(val).attr('class');
      var tag_id_class = tag + " id='" + _id + "' class='" + _class + "'";
      if (!exclude || !tag_id_class.includes(exclude)) {
        _this.remove();
      }
    });
  }

  // add a link to the Unicode Converter if not present
    /*
  function addUnicodeConverterLink() {
    addToolsDiv();
    
    if (!$("#unicodeConverter").length) {
      var link = $(" \
            <a id='unicodeConverter' style='margin-right: 20px;color: #0000FF;font-size: 12px;' \
                href='http://holly4.github.io/UnicodeConverter' \
                            target='_blank'>Unicode Converter \
            </a>");
      link.appendTo("#ffh-tools");
    }
  }
  */
  
  // install - install the feature
  function install(removeVideo) {
    removeSiblings('#wrapper', '#templateHolder', 'janrain');
    removeSiblings('#doc');
    removeSiblings('#content .main');
    removeSiblings('#commenting', 'article');
    $(".freeform").remove();

    if (removeVideo) {
      $(".video-container").remove();
    }

    // enable the hidden comment count
    $('#livefyre_comment_stream .fyre-stream-stats').css('display', 'inline');

    // change font on main username display to distinguish I's from l's
    $(".fyre-user-profile-link span").css("font-family", '"Tahoma"');

    // remove extra padding at the top
    $("#doc").each(function () {
      this.style.setProperty( 'padding', '0px', 'important' );
    });

    $(".main").each(function () {
      this.style.setProperty( 'padding-top', '0px', 'important' );
    });

    $("#commenting").each(function () {
      this.style.setProperty( 'padding', '0px', 'important' );
    });

    // fix issue where the main editor and the user avatar overlap making
    // it imposible to select with the mouse the first dozen or so letters in a comment
    $('#livefyre_comment_stream .fyre-editor').first().css('padding-top', 16);
    $('article').first().hide();

    // add a link to the Unicode Converter
    // TODO: Make configurable
    //addUnicodeConverterLink();

    // add button to toggle article display
    // TODO: Add to commmon buttons div
    $('#content .main').prepend("<button id='toggleArticle'>Show Article</button><br>");
    $('#toggleArticle').css('margin', '20px 20px 0px 0px');
    $('#toggleArticle').click(function () {
      if ($(this).text() == 'Show Article') {
        $('article').first().show();
        $(this).text('Hide Article');
        $(this).css('margin-bottom', '20px');
      } else {
        $('article').first().hide();
        $(this).text('Show Article');
{'fraction_non_alphanumeric': 0.17419354838709677, 'fraction_numerical': 0.0064516129032258064, 'mean_word_length': 2.8032, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '3850071', 'n_tokens_mistral': 2179, 'n_tokens_neox': 2107, 'n_words': 529}