PageSourceSearch

https://classaction.cv/demo/demo-seed.js

js classaction.cv collected 2026-10-07 13:18:09 UTC 10,747 bytes, 144 lines download raw bytes

1/**
2 * demo/demo-seed.js
3 *
4 * Seeds sample course data so the demo runs without authentication or
5 * cloud sync. Runs synchronously before app.js boots.
6 *
7 * ISOLATION: Redirects window.localStorage to sessionStorage so demo
8 * data can never bleed into the real /app/ on the same origin.
9 * Everything lives in sessionStorage and disappears when the tab closes.
10 */
11
12(function seedDemo() {
13  'use strict';
14
15  // ---- STORAGE ISOLATION ----
16  // Replace localStorage with sessionStorage so the demo can never
17  // contaminate the real app. This runs before any other script reads
18  // or writes localStorage.
19  Object.defineProperty(window, 'localStorage', {
20    get: function () { return window.sessionStorage; },
21    configurable: false,
22  });
23
24  // Provide the greeting helper that boot-head.js normally defines
25  window.getClassActionWelcomeGreeting = function (date) {
26    var source = date instanceof Date ? date : new Date();
27    var hour = source.getHours();
28    if (hour < 12) return 'Good Morning';
29    if (hour < 18) return 'Good Afternoon';
30    return 'Good Evening';
31  };
32
33  const COURSE_ID = 'demo_legal_research_spring_2026';
34  const NOW = Date.parse('2026-03-19T09:10:00-04:00');
35  const prefix = `alr_${COURSE_ID}_`;
36
37  function h(marks) { return marks.map(function(m) { return { status: m }; }); }
38
39  // ---- course registry ----
40  const registry = [{
41    id: COURSE_ID,
42    name: 'Legal Research',
43    created: Date.parse('2026-01-08T09:00:00-05:00'),
44    lastAccessed: NOW
45  }];
46
47  // ---- students (9 classes of attendance for classes 1-9) ----
48  const students = [
49    { name: 'Rubin Ben Shushan', expertise: 'Healthcare, Litigation', history: h(['P','P','P','P','L','P','P','P','P']) },
50    { name: 'Yaakov Toledo', expertise: 'Constitutional', history: h(['P','P','L','P','P','P','P','P','L']) },
51    { name: 'Priya Desai', expertise: 'Tax, Transactional', history: h(['P','P','P','P','P','L','P','P','P']) },
52    { name: 'Ezra Mizrahi', expertise: 'Criminal', history: h(['P','A','P','P','P','P','L','P','P']) },
53    { name: 'Miriam Sasson', expertise: 'Family, Litigation', history: h(['P','P','P','L','P','P','P','P','P']) },
54    { name: 'Noa Benhamou', expertise: 'National Security', history: h(['P','P','P','P','P','P','P','L','P']) },
55    { name: 'Sofia Ibarra', expertise: 'Labor & Employment, Transactional', history: h(['P','P','L','P','P','P','P','P','P']) },
56    { name: 'Avi Elbaz', expertise: 'Constitutional, Criminal', history: h(['P','P','P','P','L','P','P','P','P']) },
57    { name: 'Aline Uwimana', expertise: 'Healthcare', history: h(['P','P','P','P','P','P','L','P','P']) },
58    { name: 'Ethan Nguyen', expertise: 'Tax', history: h(['P','L','P','P','P','P','P','P','P']) },
59    { name: 'Diane Mukamana', expertise: 'Family', history: h(['P','P','P','P','P','L','P','P','P']) },
60    { name: 'Daniel Park', expertise: 'Litigation, Transactional', history: h(['P','P','P','P','P','P','P','L','P']) },
61    { name: 'Talia Dayan', expertise: 'Labor & Employment', history: h(['P','P','P','L','P','P','P','P','P']) },
62    { name: 'Adrian Ross', expertise: 'National Security, Constitutional', history: h(['P','P','P','P','P','P','L','P','P']) },
63    { name: 'Zoe Shah', expertise: 'Healthcare, Family', history: h(['P','P','L','P','P','P','P','P','P']) },
64    { name: 'Lior Nahmias', expertise: 'Criminal, Litigation', history: h(['P','P','P','P','L','P','P','P','P']) },
65    { name: 'Isabel Vega', expertise: 'Tax, Labor & Employment', history: h(['P','P','P','P','P','P','P','L','P']) },
66    { name: 'Owen Walker', expertise: 'Transactional', history: h(['P','L','P','P','P','P','P','P','P']) },
67    { name: 'Nina Young', expertise: 'Constitutional, National Security', history: h(['P','P','P','P','P','L','P','P','P']) },
68    { name: 'Gabriel Zane', expertise: 'Healthcare, Tax', history: h(['P','P','P','L','P','P','P','P','P']) }
69  ];
70
71  // ---- lesson archive ----
72  const archive = {
73    '1': { date: '2026-01-14', topic: 'Research & Belief', roadmap: '<ul><li>Challenge existing ideas to work from evidence over belief</li><li>NYT article assignment to focus on precision citation</li></ul>', reflection: 'Students responded well to in-class exercise', callLog: '' },
74    '2': { date: '2026-01-21', topic: 'Legal Authority', roadmap: '<ul><li>Mandatory versus persuasive authority</li><li>Hierarchy across constitutions, statutes, cases, and rules</li></ul>', reflection: 'The ranking exercise made the hierarchy visible quickly', callLog: '' },
75    '3': { date: '2026-01-28', topic: 'Keywords & Issue Spotting', roadmap: '<ul><li>Pull facts apart into legal issues</li><li>Turn facts into search terms</li><li>Compare narrow and broad keyword strings</li></ul>', reflection: 'Need to keep one more example ready on synonyms and party posture.', callLog: '' },
76    '4': { date: '2026-02-04', topic: 'Secondary Sources', roadmap: '<ul><li>When to start with treatises and practice guides</li><li>Use secondary sources to map the field</li><li>Capture citations worth checking later</li></ul>', reflection: 'Students immediately saw why secondary sources save time at the front end.', callLog: '' },
77    '5': { date: '2026-02-11', topic: 'Statutes', roadmap: '<ul><li>Read text in context</li><li>Track definitions, cross-references, and effective dates</li><li>Pair statutes with regulations and notes</li></ul>', reflection: 'The statutory interpretation walkthrough felt solid and practical.', callLog: '' },
78    '6': { date: '2026-02-18', topic: 'Cases I', roadmap: '<ul><li>Pull procedural posture and holding quickly</li><li>Use headnotes carefully</li><li>Start a clean authority chain</li></ul>', reflection: 'Case reading pace improved once students named the exact question they were researching.', 
78callLog: '' },
79    '7': { date: '2026-02-25', topic: 'Cases II', roadmap: '<ul><li>Update and validate cases</li><li>Spot narrowing and distinguishing language</li><li>Build a short line of authority</li></ul>', reflection: 'Worth repeating the Shepardizing versus summarizing distinction next year.', callLog: '' },
80    '8': { date: '2026-03-11', topic: 'Administrative Law', roadmap: '<ul><li>Find regulations and agency guidance</li><li>Map statutes to implementing rules</li><li>Note when agency materials are binding or advisory</li></ul>', reflection: 'Students liked the regulation-to-statute tracing exercise more than expected.', callLog: '' },
81    '9': { date: '2026-03-18', topic: 'Court Administration', roadmap: '<ul><li>Use court rules, jury instructions, dockets, and analytics</li><li>Identify what each source can and cannot answer</li><li>Close with a short filing-strategy hypo</li></ul>', reflection: '', callLog: '' },
82    '10': { date: '2026-03-25', topic: 'Comprehensive Review', roadmap: '<ul><li>Review the full research workflow</li><li>Handle student questions</li><li>Set rules for verification and citation checking</li></ul>', reflection: '', callLog: '' },
83    '11': { date: '2026-04-08', topic: 'AI in Legal Research', roadmap: '<ul><li>Where AI tools help and where they mislead</li><li>Prompt for structure, not blind answers</li><li>Verify every citation and proposition</li></ul>', reflection: '', callLog: '' },
84    '12': { date: '2026-04-15', topic: 'AI Workflow Design', roadmap: '<ul><li>Turn an assignment into a repeatable workflow</li><li>Use AI for outlining and counterarguments</li><li>Keep human review in the loop</li></ul>', reflection: '', callLog: '' },
85    '13': { date: '2026-04-22', topic: 'Fact Research', roadmap: '<ul><li>Separate legal research from factual investigation</li><li>Use public records and agency sites carefully</li><li>Document source reliability and gaps</li></ul>', reflection: '', callLog: '' }
86  };
87
88  // ---- config ----
89  const config = {
90    timerDefault: 15,
91    classCount: 13,
92    links: [
93      { name: 'Lexis', url: 'https://www.plus.lexis.com/' },
94      { name: 'Westlaw', url: 'https://next.westlaw.com/' },
95      { name: 'Bloomberg Law', url: 'https://www.bloomberglaw.com/' },
96      { name: 'Congress.gov', url: 'https://www.congress.gov/' }
97    ],
98    subTitle: '',
99    ntfyEnabled: true,
100    ntfyDing: false,
101    ntfyServer: '',
102    ntfyTopic: '',
103    ntfyNewestFirst: true,
104    brandTheme: { primary: '#8a100e', secondary: '#bc9b6a' },
105    brandThemeCustomized: false,
106    hideStats: false,
107    hideWelcome: false
108  };
109
110  // ---- inbox ----
111  const inbox = [
112    { ts: Date.parse('2026-03-18T08:42:00-04:00'), title: 'Question', message: 'For statutes, should we start with the code text itself or with a secondary source that explains the scheme?' },
113    { ts: Date.parse('2026-03-18T09:11:00-04:00'), title: 'Question', message: 'Do court rules count as primary authority for the memo, or do we treat them more like practice materials?' },
114    { ts: Date.parse('2026-03-18T09:34:00-04:00'), title: 'Question', message: 'When we Shepardize or KeyCite a case, how far down the rabbit hole are we expected to go for class?' },
115    { ts: Date.parse('2026-03-18T10:03:00-04:00'), title: 'Question', message: 'For the administrative law class, should we cite agency guidance if the regulation itself is silent?' }
116  ];
117
118  // ---- scratchpad ----
119  const todos = [
120    { text: 'Remind students to update one lead case before next class', done: false, ts: NOW - 720000 },
121    { text: 'Keep the secondary-source checklist in the quick links area', done: true, ts: NOW - 1440000 }
122  ];
123
124  // ---- write to storage (all goes to sessionStorage via the override) ----
125  localStorage.setItem('alr_course_registry', JSON.stringify(registry));
126  localStorage.setItem('alr_last_active_course', COURSE_ID);
127  sessionStorage.setItem('alr_active_session_course', COURSE_ID);
128
129  localStorage.setItem(prefix + 'students', JSON.stringify(students));
130  localStorage.setItem(prefix + 'archive', JSON.stringify(archive));
131  localStorage.setItem(prefix + 'config', JSON.stringify(config));
132  localStorage.setItem(prefix + 'groups_cache', JSON.stringify([]));
133  localStorage.setItem(prefix + 'theme', 'light');
134  localStorage.setItem(prefix + 'ntfy_inbox', JSON.stringify(inbox));
135  localStorage.setItem(prefix + 'ntfy_last_seen_ts', String(Date.parse('2026-03-17T17:00:00-04:00')));
136  localStorage.setItem(prefix + 'scratch_todos', JSON.stringify(todos));
137  localStorage.setItem(prefix + 'scratch_notes', 'Hosted Legal Research demo. Feel free to edit the notes and to-do list; the demo resets to this seeded state on reload.');
138  localStorage.setItem(prefix + 'sm_layout', JSON.stringify([]));
139  localStorage.setItem(prefix + 'sm_config', JSON.stringify({ mode: 'grid', rows: 4, cols: 6, curve: 0.35 }));
140
141  // Signal demo mode and starting class to app.js
142  window.__DEMO_MODE = true;
143  window.__DEMO_START_CLASS = 1;
144})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.