<commit_before><!DOCTYPE html>
<html>
<head><title>SmoothScroll Options</title>
<style type="text/css">
body {
         font-size: 13.4px;
         font-family: Verdana, sans-serif;
         color: #333333;
         text-align: center;
         margin: auto;
         background-color: #000000;
         }
input {
         color: #010101;
         background-color: transparent;
         padding: 3px;
         -webkit-border-radius: 4px;
         border: 1px solid #343434;
         width: 38px;
         outline: none;
         text-align: center;
}

#page {
        border: 3px solid #28AEA8; 
        -webkit-border-radius: 20px; 
        width: 800px; 
        text-align: left; 
        padding: 30px;
        -webkit-box-shadow: #BBB 0px 0px 20px;
        margin-bottom: 10px;
}

.title {
         margin: 30px auto;
         color: #4400CC;
         font-size: 40px;
         background-image:url(../img/128n.png);
         width: 400px;
         padding-left: 140px;
         /*height: 120px;*/
         background-repeat: no-repeat;
         /*background-position: center right;*/
         background-position: 0% 50%;
         text-align: left;
         font-weight: bold;
}
a {
        text-decoration: none;
        color: #333333;
}

a:hover {
        text-decoration: underline;
        color: #444444;
}

button#save {
    -webkit-box-shadow: #999 0px 0px 3px;
     cursor:pointer; 
     padding: 4px 10px;
     width: 180px;
     font-size: 20px;
     background-color: #fafafa;
     -webkit-border-radius: 4px;
     border: 1px solid #BBB;
     color: #444;
     font-weight:bold;
     display:block;
     margin:0 auto;
}

.setting-name { width: 150px; }
.note { font-size: 80%; color: #666; padding-left: 10px; cursor:help; }
input[type=text] { margin-right:10px; -webkit-box-shadow: #CCC 0px 0px 2px; border-color:#999; }
label[title] { cursor:help; }
</style>
<script src="../src/sscr.js"></script>


<script>

/**
 * Options page logic.
 */
(function(window, undefined){

/**
 * List of available options
 */
var options = [
  'framerate', 
  'animtime',
  'scrollsz',
  'arrscroll',
  //'pgscroll',
  'pulseAlgorithm',
  'pulseScale',
  'pulseNormalize',
  'keyboardsupport',
  'exclude'
];

function byId(id) { return document.getElementById(id); }

function isNodeName(el, tag) {
    return el.nodeName.toLowerCase() === tag.toLowerCase();
}

/**
 * Fills up the form with the saved values from local storage.
 */
function init() {
    options.forEach(function(key, i) {
        if (/keyboardsupport|pulseAlgorithm/.test(key)) {
            byId(key).checked = (localStorage[key] == "true");
        } else if (localStorage[key]) {
            byId(key).value = localStorage[key];
        }
    });
}

/**
 * Saves the values from the form to local storage.
 */
function save() {

    var i, key, opt, elem, error;

    // save options to the local storage
    options.forEach(function(key, i) {
        // <input type="text"> and <textarea>
        if (!/keyboardsupport|pulseAlgorithm/.test(key)) {
            elem = byId(key);
            opt = elem.value;
            // every <input> 
            if (isNodeName(elem, "input")) {
              // should be a number
              opt = parseInt(opt, 10);
              if (isNaN(opt)) {
                  error = "Numeric Values Only!";
                  return; // stop iteration
               }
            }
            localStorage[key] = opt;
        } else { // keyboardsupport | pulseAlgorithm
            localStorage[key] = byId(key).checked;
        }
    });

    // update message
    if (!error) {
        var saving  = byId("saving");
        var message = byId("message");
        saving.innerHTML  = "Settings saved!";
        message.innerHTML = '<a href="#" onclick="reload()">' +
                            'Reload this page and test the new scroll settings!</a>';
        setTimeout(function () {
            saving.innerHTML = "&nbsp;";
        }, 1500);
    }
    // error message
    else {
        alert(error);
    } 
}

function get_manifest(callback) {
    var xhr = new XMLHttpRequest();
    xhr.onload = function () {
        callback(JSON.parse(xhr.responseText));
    };
    xhr.open('GET', '../manifest.json', true);
    xhr.send(null);
}

get_manifest(function (manifest) {
    version = manifest.version;
    byId("version").innerHTML = version;
});

function reload() {
    window.location.reload();
}

// Restores select box state to saved value from localStorage.
//function restore_options() {
//}

// public interface
window.onload = init;
window.reload = reload;
window.save = save;

})(window);
</script>

</head>
<body style="width: 100%; background-color: #FFFFFF; text-align: center;">
<center>


<div class="title">SmoothScroll <div style="color: #CBCBCB; font-size: 22px; font-weight: normal;"> Version <span id="version"></span></div></div><commit_msg>run init on DOMContentLoaded options.html<commit_after><!DOCTYPE html>
<html>
<head><title>SmoothScroll Options</title>
<style type="text/css">
body {
         font-size: 13.4px;
         font-family: Verdana, sans-serif;
         color: #333333;
         text-align: center;
         margin: auto;
         background-color: #000000;
         }
input {
         color: #010101;
         background-color: transparent;
         padding: 3px;
         -webkit-border-radius: 4px;
         border: 1px solid #343434;
         width: 38px;
         outline: none;
         text-align: center;
}

#page {
        border: 3px solid #28AEA8; 
        -webkit-border-radius: 20px; 
        width: 800px; 
        text-align: left; 
        padding: 30px;
        -webkit-box-shadow: #BBB 0px 0px 20px;
        margin-bottom: 10px;
}

.title {
         margin: 30px auto;
         color: #4400CC;
         font-size: 40px;
         background-image:url(../img/128n.png);
         width: 400px;
         padding-left: 140px;
         /*height: 120px;*/
         background-repeat: no-repeat;
         /*background-position: center right;*/
         background-position: 0% 50%;
         text-align: left;
         font-weight: bold;
}
a {
        text-decoration: none;
        color: #333333;
}

a:hover {
        text-decoration: underline;
        color: #444444;
}

button#save {
    -webkit-box-shadow: #999 0px 0px 3px;
     cursor:pointer; 
     padding: 4px 10px;
     width: 180px;
     font-size: 20px;
     background-color: #fafafa;
     -webkit-border-radius: 4px;
     border: 1px solid #BBB;
     color: #444;
     font-weight:bold;
     display:block;
     margin:0 auto;
}

.setting-name { width: 150px; }
.note { font-size: 80%; color: #666; padding-left: 10px; cursor:help; }
input[type=text] { margin-right:10px; -webkit-box-shadow: #CCC 0px 0px 2px; border-color:#999; }
label[title] { cursor:help; }
</style>
<script src="../src/sscr.js"></script>


<script>

/**
 * Options page logic.
 */
(function(window, undefined){

/**
 * List of available options
 */
var options = [
  'framerate', 
  'animtime',
  'scrollsz',
  'arrscroll',
  //'pgscroll',
  'pulseAlgorithm',
  'pulseScale',
  'pulseNormalize',
  'keyboardsupport',
  'exclude'
];

function byId(id) { return document.getElementById(id); }

function isNodeName(el, tag) {
    return el.nodeName.toLowerCase() === tag.toLowerCase();
}

/**
 * Fills up the form with the saved values from local storage.
 */
function init() {
    options.forEach(function(key, i) {
        if (/keyboardsupport|pulseAlgorithm/.test(key)) {
            byId(key).checked = (localStorage[key] == "true");
        } else if (localStorage[key]) {
            byId(key).value = localStorage[key];
        }
    });
}

/**
 * Saves the values from the form to local storage.
 */
function save() {

    var i, key, opt, elem, error;

    // save options to the local storage
    options.forEach(function(key, i) {
        // <input type="text"> and <textarea>
        if (!/keyboardsupport|pulseAlgorithm/.test(key)) {
            elem = byId(key);
            opt = elem.value;
            // every <input> 
            if (isNodeName(elem, "input")) {
              // should be a number
              opt = parseInt(opt, 10);
              if (isNaN(opt)) {
                  error = "Numeric Values Only!";
                  return; // stop iteration
               }
            }
            localStorage[key] = opt;
        } else { // keyboardsupport | pulseAlgorithm
            localStorage[key] = byId(key).checked;
        }
    });

    // update message
    if (!error) {
        var saving  = byId("saving");
        var message = byId("message");
        saving.innerHTML  = "Settings saved!";
        message.innerHTML = '<a href="#" onclick="reload()">' +
                            'Reload this page and test the new scroll settings!</a>';
        setTimeout(function () {
            saving.innerHTML = "&nbsp;";
        }, 1500);
    }
    // error message
    else {
        alert(error);
    } 
}

function get_manifest(callback) {
    var xhr = new XMLHttpRequest();
    xhr.onload = function () {
        callback(JSON.parse(xhr.responseText));
    };
    xhr.open('GET', '../manifest.json', true);
    xhr.send(null);
}

get_manifest(function (manifest) {
    version = manifest.version;
    byId("version").innerHTML = version;
});

function reload() {
    window.location.reload();
}

// Restores select box state to saved value from localStorage.
//function restore_options() {
//}

// public interface
window.addEventListener("DOMContentLoaded", init, false);
window.reload = reload;
window.save = save;

})(window);
</script>

</head>
<body style="width: 100%; background-color: #FFFFFF; text-align: center;">
<center>


<div class="title">SmoothScroll <div style="color: #CBCBCB; font-size: 22px; font-weight: normal;"> Version <span id="version"></span></div></div>
{'fraction_non_alphanumeric': 0.14832146490335707, 'fraction_numerical': 0.02706002034587996, 'mean_word_length': 2.2106466361854995, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, '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': '3261233', 'n_tokens_mistral': 3371, 'n_tokens_neox': 3074, 'n_words': 738}