<commit_before><html>

<!-- these 4 files always have to be included -->
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>


<!-- these two file always have to be included -->
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>

<style>
       .changing {
           box-shadow: 1px 1px 2px 0px red;
        }
</style>

<script type="text/javascript">

    // Dictionary (systemDictionary is global variable from adapter-settings.js)
    systemDictionary = {
        "upnp-discovery adapter settings":  {"de": "Einstellungen","en": "Settings", "ru": "настройки"},
        "upnpDeviceIP":                     {"en": "Upnp Device IP", "de": "Upnp Geräte IP", "ru": "Upnp прибор IP"},
        "rootXMLurl":                       {"en": "Root xml URL", "de": "Root xml URL", "ru": "Root xml URL"},
        "test2":                            {"en": "Test 2", "de": "Test 2", "ru": "Тест 2"},
        "Add Device or Service":            {"en": "Add device or service", "de": "Gerät oder Dienst Hinzufügen", "ru": "Добавить устройство или услугу"},
        "autoDiscover":             {"en": "Enable auto-discover", "de": "Automatische Erkennung von upnp Geräten", "ru": "Включение автоматического обнаружения"},
        "autoSubscription":             {"en": "Enable auto-subscription", "de": "Abonnieren von Statusaktualisierungen aktivieren", "ru": "Включить автоматическую подписку"},
        "autoConfig":               {"en": "Enable auto-config", "de": "Automatische Konfiguration von upnp Geräten", "ru": "Включение автонастройки"},
        "on save adapter restarts with new config immediately": {
            "de": "Beim Speichern von Einstellungen wird der Adapter sofort neu gestartet.",
            "ru": "Сразу после сохранения настроек драйвер перезапуститься с новыми значениями"
        }
    };
    var onChange = null;

    // the function loadSettings has to exist ...
    function load(settings, onChange) {
        // example: select elements with id=key and class=value and insert value
        for (var key in settings) {
            if (!settings.hasOwnProperty(key)) continue;
            var $value = $('#' + key + '.value');
            if ($value.attr('type') === 'checkbox') {
                $value.prop('checked', settings[key]).change(function () {
                    onChange();
                });
            } else {
                $value.val(settings[key]).change(function () {
                    onChange();
                }).keyup(function () {
                    $(this).trigger('change');
                });
            }
        }

        socket.emit('getState', adapter + '.' + instance + '.enableAutoDiscover', function (err, state) {
            $('#enableAutoDiscover').prop('checked', state && state.val);
        });
        socket.emit('getState', adapter + '.' + instance + '.enableAutoSubscription', function (err, state) {
            $('#enableAutoSubscription').prop('checked', state && state.val);
        });

        socket.emit('subscribe', adapter + '.' + instance + '.enableAutoDiscover');
        socket.emit('subscribe', adapter + '.' + instance + '.enableAutoSubscription');

        socket.on('stateChange', function (id, state) {
            if (id === adapter + '.' + instance + '.enableAutoDiscover') {
                if (state && state.ack) {
                    $('#enableAutoDiscover')
                            .removeClass('changing')
                            .prop('checked', state.val);
                }
            }
            if (id === adapter + '.' + instance + '.enableAutoSubscription') {
                if (state && state.ack) {
                    $('#enableAutoSubscription')
                            .removeClass('changing')
                            .prop('checked', state.val);
                }
            }
        });
        onChange(false);
        $('#enableAutoDiscover').change(function () {
            socket.emit('setState', adapter + '.' + instance + '.enableAutoDiscover', $('#enableAutoDiscover').addClass('changing').prop('checked'));
        });
        $('#enableAutoSubscription').change(function () {
            socket.emit('setState', adapter + '.' + instance + '.enableAutoSubscription', $('#enableAutoSubscription').addClass('changing').prop('checked'));
        });
    }

    function save(callback) {
        var obj = {};
        $('.value').each(function () {
            var $this = $(this);
            if ($this.attr('type') === 'checkbox') {
                obj[$this.attr('id')] = $this.prop('checked');
            } else {
                obj[$this.attr('id')] = $this.val();
            }
        });
        callback(obj);
    }
</script>


<div id="adapter-container">

    <table>
        <tr>
            <td><img src="upnp-discovery.png"/></td>
            <td><h3 class="translate">upnp-discovery adapter settings</h3></td>
        </tr>
        <tr>
            <td><label for="enableAutoDiscover" class="translate">autoDiscover</label></td>
            <td><input class="value" id="enableAutoDiscover" type="checkbox"/></td><commit_msg>fix config problem<commit_after><html>

<!-- these 4 files always have to be included -->
<link rel="stylesheet" type="text/css" href="../../lib/css/themes/jquery-ui/redmond/jquery-ui.min.css"/>
<script type="text/javascript" src="../../lib/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../lib/js/jquery-ui-1.10.3.full.min.js"></script>


<!-- these two file always have to be included -->
<link rel="stylesheet" type="text/css" href="../../css/adapter.css"/>
<script type="text/javascript" src="../../js/translate.js"></script>
<script type="text/javascript" src="../../js/adapter-settings.js"></script>


<script type="text/javascript">

    // Dictionary (systemDictionary is global variable from adapter-settings.js)
    systemDictionary = {
        "upnp-discovery adapter settings":  {"de": "Einstellungen","en": "Settings", "ru": "настройки"},
        "upnpDeviceIP":                     {"en": "Upnp Device IP", "de": "Upnp Geräte IP", "ru": "Upnp прибор IP"},
        "rootXMLurl":                       {"en": "Root xml URL", "de": "Root xml URL", "ru": "Root xml URL"},
        "test2":                            {"en": "Test 2", "de": "Test 2", "ru": "Тест 2"},
        "Add Device or Service":            {"en": "Add device or service", "de": "Gerät oder Dienst Hinzufügen", "ru": "Добавить устройство или услугу"},
        "autoDiscover":             {"en": "Enable auto-discover", "de": "Automatische Erkennung von upnp Geräten", "ru": "Включение автоматического обнаружения"},
        "autoSubscription":             {"en": "Enable auto-subscription", "de": "Abonnieren von Statusaktualisierungen aktivieren", "ru": "Включить автоматическую подписку"},
        "autoConfig":               {"en": "Enable auto-config", "de": "Automatische Konfiguration von upnp Geräten", "ru": "Включение автонастройки"},
        "on save adapter restarts with new config immediately": {
            "de": "Beim Speichern von Einstellungen wird der Adapter sofort neu gestartet.",
            "ru": "Сразу после сохранения настроек драйвер перезапуститься с новыми значениями"
        }
    };
    var onChange = null;

    // the function loadSettings has to exist ...
    function load(settings, onChange) {
        // example: select elements with id=key and class=value and insert value
       if (!settings) return;
        $('.value').each(function () {
            var key = $(this).attr('id');
            var $key = $('#' + key + '.value');
            if ($key.attr('type') === 'checkbox') {
                $key.prop('checked', settings[key]).change(function() {
                    onChange();
                });
            } else {
                $key.val(settings[key]).change(function() {
                    onChange();
                }).keyup(function() {
                    onChange();
                });
            }
        });


        onChange(false);

    }

    function save(callback) {
        var obj = {};
        $('.value').each(function () {
            var $this = $(this);
            if ($this.attr('type') === 'checkbox') {
                obj[$this.attr('id')] = $this.prop('checked');
            } else {
                obj[$this.attr('id')] = $this.val();
            }
        });
        callback(obj);
    }
</script>


<div id="adapter-container">

    <table>
        <tr>
            <td><img src="upnp-discovery.png"/></td>
            <td><h3 class="translate">upnp-discovery adapter settings</h3></td>
        </tr>
        <tr>
            <td><label for="enableAutoDiscover" class="translate">autoDiscover</label></td>
            <td><input class="value" id="enableAutoDiscover" type="checkbox"/></td>
{'fraction_non_alphanumeric': 0.1793192311822184, 'fraction_numerical': 0.0036508106947278, 'mean_word_length': 2.1766712141882674, 'pattern_counts': {'":': 70, '<': 77, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '4178018', 'n_tokens_mistral': 2654, 'n_tokens_neox': 2668, 'n_words': 607}