<commit_before>/*
 * This Source Code is subject to the terms of the Mozilla Public License
 * version 2.0 (the "License"). You can obtain a copy of the License at
 * http://mozilla.org/MPL/2.0/.
 */

"use strict";

let {setSubmitHandler, setResetHandler} = require("./events");
let state = require("./state");
let {$, setActivePanel} = require("./utils");

setSubmitHandler("notes", alert.bind(null, "FIXME"));
setResetHandler("notes", setActivePanel.bind(null, "password-list"));

function edit(password, notes)
{
  $("notes-website-name").textContent = state.site;
  $("notes-user-name").textContent = password.name;

  let revisionField = $("notes-password-revision");
  revisionField.hidden = !password.revision;
  revisionField.textContent = password.revision;

  setActivePanel("notes");
  $("notes-textarea").value = notes;
}
exports.edit = edit;<commit_msg>Issue #33 - Update site name on notes page when state changes, for consistency<commit_after>/*
 * This Source Code is subject to the terms of the Mozilla Public License
 * version 2.0 (the "License"). You can obtain a copy of the License at
 * http://mozilla.org/MPL/2.0/.
 */

"use strict";

let {setSubmitHandler, setResetHandler} = require("./events");
let state = require("./state");
let {$, setActivePanel} = require("./utils");

setSubmitHandler("notes", alert.bind(null, "FIXME"));
setResetHandler("notes", setActivePanel.bind(null, "password-list"));

state.on("update", updateSiteName);
updateSiteName();

function updateSiteName()
{
  $("notes-website-name").textContent = state.site;
}

function edit(password, notes)
{
  $("notes-user-name").textContent = password.name;

  let revisionField = $("notes-password-revision");
  revisionField.hidden = !password.revision;
  revisionField.textContent = password.revision;

  setActivePanel("notes");
  $("notes-textarea").value = notes;
}
exports.edit = edit;
{'fraction_non_alphanumeric': 0.16409984067976632, 'fraction_numerical': 0.0053106744556558685, 'mean_word_length': 5.057877813504823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4582776', 'n_tokens_mistral': 582, 'n_tokens_neox': 566, 'n_words': 146}