2021-08-06 One click generates the following page image Intended use.

  • Click on the menu whenever you feel like it
  • View generated pages
    • Follow the link if you want to follow it.
      • If you want to rewrite the link, rewrite it.
      • I wonā€™t rewrite it, but if you want to comment on it, you can write a comment on this look back page like ā€œI used to write this, butā€¦ā€
        • They may look at multiple links and find relationships.
        • If you want to write it and then title it further and make it a stand-alone page, do so.
    • If you see something and donā€™t feel like taking action, delete link.
      • Maybe this is important
      • If you donā€™t do this, youā€™ll have more meaningless links and your Scrapbox will become a garbage dump.
    • I think you should remove the links, even the ones that rewrite the page you linked to.
      • Because thereā€™s not much point in information that says, ā€œI looked back at this day in retrospect.ā€
    • Ideally, this look-back page should be used as a temporary home for the information generated by the look-back, and the page should eventually scatter and disappear.
      • If you canā€™t find a good place to stay, you have no choice but to stay here, like Nodes of Thought.

Comparison with previous version [ScrapboxSRS

  • I think we used to give out too many links.
    • It would be a burden to see it all.
    • There was an unnecessarily large amount of other information.
    • I hadnā€™t seen them in three years, and I was like, ā€œNo, thereā€™s too many of them.ā€
  • Interpretation of the meaning of the score is difficult and not good.
    • So I made it ā€œ100 days agoā€, ā€œ1 year agoā€, and ā€œn years agoā€.
      • n years agoā€ is anything other than one year ago that is a near multiple of one year.
  • I made each section three.
    • I think about 9 3x3ā€™s is about right. This is the intention.

I used it. - Reflections on ā€œ2021-08-05 Reflectionā€

[/takker/Scrapbox lookback feature#610c18a51280f00000ed3fc3](https://scrapbox.io/takker/Scrapbox lookback feature#610c18a51280f00000ed3fc3).

  • I changed the external project link notation so that the link does not appear in the related pages list even if the link remains.

    • I see

2021-08-06 script.js

const LINE_PER_SECTION = 3;
const day = 60 * 60 * 24 * 1000;
const year = day * 365;
 
const project_name = scrapbox.Project.name;
const project_root = `https://scrapbox.io/${project_name}`;
const menu_title = "Looking Back";.
const make_title = () => `${strftime(new Date())}${menu_title}`;
 
// score: 0 is best
const sections = [
  {
    title: "100 days ago",.
    score: (diff) => Math.abs(diff - 100 * day),
  },
  {
    title: "1 year ago",.
    score: (diff) => Math.abs(diff - year),
  },
  {
    title: "n years ago",.
    score: (diff) => {
      // excludes 1 year ago
      if (diff < year * 1.5) {
        return year;
      }
      const mod = diff % year;
      return Math.min(mod, year - mod);
    },
  },
];
 
const main = () => {
  // calc scores
  const now = Date.now();
  const scored_pages = [];
  scrapbox.Project.pages.forEach((page) => {
    const updated = page.updated;
    if (updated === 0) return;
    const diff = now - updated * 1000;
    const p = { ...page };
    sections.forEach((sction) => {
      p[sction.title] = sction.score(diff);
    });
    scored_pages.push(p);
  });
 
  // generate page contents
  const lines = [];
  sections.forEach((section) => {
    scored_pages.sort((a, b) => a[section.title] - b[section.title]);
    lines.push(section.title);
    scored_pages.slice(0, LINE_PER_SECTION).forEach((page) => {
      const title = page["title"];
      const date = strftime(new Date(page.updated * 1000));
      lines.push(` ${date} [${title}]`);
    });
    lines.push("");
  });
  create_page(make_title(), lines);
};
 
function create_page(title, lines) {
  const body = encodeURIComponent(lines.join("\n"));
  window.open(`${project_root}/${title}?body=${body}`);
}
 
function pad(number) {
  if (number < 10) {
    return "0" + number;
  }
  return number;
}
 
function strftime(d) {
  return (
    d.getUTCFullYear() +
    "-" +
    pad(d.getUTCMonth() + 1) +
    "-" +
    pad(d.getUTCDate())
  );
}
 
const WAIT = { title: "Please wait...", image: null, onClick: () => null };
const onClick = () => {
  scrapbox.PageMenu(menu_title).addItem(WAIT);
  main();
  scrapbox.PageMenu(menu_title).removeAllItems();
};
 
scrapbox.PageMenu.addMenu({
  title: menu_title,
  image: "https://gyazo.com/11140c8b35b407c5d490a94ec6f2528f/raw",
  onClick,
});

old version

orthographical variants - Reflection (Scrapbox)


This page is auto-translated from /nishio/ScrapboxęŒÆ悊čæ”ć‚Šę©Ÿčƒ½ using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. Iā€™m very happy to spread my thought to non-Japanese readers.