<commit_before>/**
 * @license MPL 1.1/GPL 2.0/LGPL 2.1, see license.txt
 * @author <NAME> <<EMAIL>>
 * @copyright 2011 JSONovich Team. All Rights Reserved.
 * @description Adds custom logic to the buttons on our options dialog.
 *
 * Changelog:
 * [2011-08] - Created options observer
 */

'use strict';

XPCOMUtils.defineLazyGetter(this, 'l', function() {
    return require('l10n').bundle('options');
});
XPCOMUtils.defineLazyGetter(this, 'valid', function() {
    return require('validate');
});

var prefNameConv = 'mime.conversions',
prefNameExt = 'mime.extensionMap',
events = {},
observer = {
    observe: function(aSubject, aTopic, aData) {
        if(aTopic != 'addon-options-displayed' || aData != ADDON_LNAME + '@' + ADDON_DOMAIN) {
            return;
        }
        var container = aSubject.querySelector('#detail-rows'); // normal add-ons manager
        if(!container) { // fennec XBL add-ons manager
            container = aSubject.getAnonymousElementByAttribute(aSubject.querySelector('[addonID="'+aData+'"]'), 'anonid', 'options-box');
        }
        [].forEach.call(container.querySelectorAll('setting,setting button,.preferences-description'), function(node) {
            ['title', 'desc', 'label'].forEach(function(attr) {
                var t = node.getAttribute(attr);
                if(t) {
                    node.setAttribute(attr, l(t));
                }
            });
            if(node.textContent) {
                node.textContent = l(node.textContent);
            }
        });
        for(var k in events) {
            aSubject.getElementById(k).addEventListener('click', events[k], false);
        }
    }
},
observing = false,
prefs = require('prefs').branch,
prefBranch = null,

clearPrefs = exports.clear = function clearPrefs() {
    prefs(ADDON_PREFROOT, true).uninstall();
    prefs(ADDON_PREFROOT + '@' + ADDON_DOMAIN, true).uninstall();
};

function resetPrefs() {
    clearPrefs();
    require('chrome/DefaultPrefs').set(prefs(ADDON_PREFROOT, true).set);<commit_msg>Minor function change in inline options fix.<commit_after>/**
 * @license MPL 1.1/GPL 2.0/LGPL 2.1, see license.txt
 * @author <NAME> <<EMAIL>>
 * @copyright 2011 JSONovich Team. All Rights Reserved.
 * @description Adds custom logic to the buttons on our options dialog.
 *
 * Changelog:
 * [2011-08] - Created options observer
 */

'use strict';

XPCOMUtils.defineLazyGetter(this, 'l', function() {
    return require('l10n').bundle('options');
});
XPCOMUtils.defineLazyGetter(this, 'valid', function() {
    return require('validate');
});

var prefNameConv = 'mime.conversions',
prefNameExt = 'mime.extensionMap',
events = {},
observer = {
    observe: function(aSubject, aTopic, aData) {
        if(aTopic != 'addon-options-displayed' || aData != ADDON_LNAME + '@' + ADDON_DOMAIN) {
            return;
        }
        var container = aSubject.getElementById('detail-rows'); // normal add-ons manager
        if(!container) { // fennec XBL add-ons manager
            container = aSubject.getAnonymousElementByAttribute(aSubject.querySelector('[addonID="'+aData+'"]'), 'anonid', 'options-box');
        }
        [].forEach.call(container.querySelectorAll('setting,setting button,.preferences-description'), function(node) {
            ['title', 'desc', 'label'].forEach(function(attr) {
                var t = node.getAttribute(attr);
                if(t) {
                    node.setAttribute(attr, l(t));
                }
            });
            if(node.textContent) {
                node.textContent = l(node.textContent);
            }
        });
        for(var k in events) {
            aSubject.getElementById(k).addEventListener('click', events[k], false);
        }
    }
},
observing = false,
prefs = require('prefs').branch,
prefBranch = null,

clearPrefs = exports.clear = function clearPrefs() {
    prefs(ADDON_PREFROOT, true).uninstall();
    prefs(ADDON_PREFROOT + '@' + ADDON_DOMAIN, true).uninstall();
};

function resetPrefs() {
    clearPrefs();
    require('chrome/DefaultPrefs').set(prefs(ADDON_PREFROOT, true).set);
{'fraction_non_alphanumeric': 0.15316858331294347, 'fraction_numerical': 0.008808416931734769, 'mean_word_length': 2.945945945945946, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3841491', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1246, 'n_words': 245}