<commit_before>/*
 * Copyright 2009-2011 Mozilla Foundation and contributors
 * Licensed under the New BSD license. See LICENSE.txt or:
 * http://opensource.org/licenses/BSD-3-Clause
 */

define(function(require, exports, module) {


var l10n = require('gcli/l10n');
var util = require('gcli/util');
var dom = require('gcli/util').dom;

var gcli = require('gcli/index');

var Argument = require('gcli/argument').Argument;

var types = require('gcli/types');
var Conversion = require('gcli/types').Conversion;
var Type = require('gcli/types').Type;
var SelectionType = require('gcli/types').SelectionType;
var Status = require('gcli/types').Status;

var field = require('gcli/ui/field');
var Field = require('gcli/ui/field').Field;


/**
 * Utility to create a link to a bug number
 */
function getBugLink(bugid) {
  return '<br/>To comment on this command, use <a target="_blank" ' +
      'href="https://bugzilla.mozilla.org/show_bug.cgi?id=' + bugid + '">' +
      'bug ' + bugid + '</a>.';
}

/**
 * A type for the resources in the current page
 */
function ResourceType(typeSpec) {
  if (typeSpec != null) {
    throw new Error('ResourceType can not be customized');
  }
}

ResourceType.prototype = Object.create(types.SelectionType.prototype);

ResourceType.prototype.lookup = function() {
  var reply = [];
  for (var i = 0; i < document.styleSheets.length; i++) {
    var sheet = document.styleSheets[i];
    reply.push({
      name: sheet.href || 'style#' + i,
      value: sheet
    });
  }
  reply.push({
    name: 'page',
    value: window.document
  });
  return reply;
};

ResourceType.prototype.name = 'resource';


/**
 * A CSS expression that refers to a single node
 */
function NodeType(typeSpec) {
  if (typeSpec != null) {
    throw new Error('NodeType can not be customized');
  }
}

NodeType.prototype = Object.create(Type.prototype);<commit_msg>Review fix: Add comment clarifying style readability https://github.com/joewalker/gcli/commit/aeef964dedbcde2c9de80290de556be19b9a81f4#commitcomment-567064<commit_after>/*
 * Copyright 2009-2011 Mozilla Foundation and contributors
 * Licensed under the New BSD license. See LICENSE.txt or:
 * http://opensource.org/licenses/BSD-3-Clause
 */

define(function(require, exports, module) {


var l10n = require('gcli/l10n');
var util = require('gcli/util');
var dom = require('gcli/util').dom;

var gcli = require('gcli/index');

var Argument = require('gcli/argument').Argument;

var types = require('gcli/types');
var Conversion = require('gcli/types').Conversion;
var Type = require('gcli/types').Type;
var SelectionType = require('gcli/types').SelectionType;
var Status = require('gcli/types').Status;

var field = require('gcli/ui/field');
var Field = require('gcli/ui/field').Field;


/**
 * Utility to create a link to a bug number
 */
function getBugLink(bugid) {
  return '<br/>To comment on this command, use <a target="_blank" ' +
      'href="https://bugzilla.mozilla.org/show_bug.cgi?id=' + bugid + '">' +
      'bug ' + bugid + '</a>.';
}

/**
 * A type for the resources in the current page
 */
function ResourceType(typeSpec) {
  if (typeSpec != null) {
    throw new Error('ResourceType can not be customized');
  }
}

ResourceType.prototype = Object.create(types.SelectionType.prototype);

ResourceType.prototype.lookup = function() {
  var reply = [];
  for (var i = 0; i < document.styleSheets.length; i++) {
    var sheet = document.styleSheets[i];
    // When we're in chrome, replace style#i with style#Ln where n is the line
    // number of the style element in the HTML document.
    reply.push({
      name: sheet.href || 'style#' + i,
      value: sheet
    });
  }
  reply.push({
    name: 'page',
    value: window.document
  });
  // There are other page resources that we need to include here too
  return reply;
};

ResourceType.prototype.name = 'resource';


/**
 * A CSS expression that refers to a single node
 */
function NodeType(typeSpec) {
  if (typeSpec != null) {
    throw new Error('NodeType can not be customized');
  }
}

NodeType.prototype = Object.create(Type.prototype);
{'fraction_non_alphanumeric': 0.14939995101640952, 'fraction_numerical': 0.012980651481753612, 'mean_word_length': 3.8503562945368173, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 3, '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': '5134440', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1282, 'n_words': 354}