Heh / index.html
Novacibes's picture
Update index.html
00a112b verified
Raw History Blame Contribute Delete
20 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AutoPaper — Academic Paper Generator</title>
<!-- ============ CSS ============ -->
<style>
/* ----- Reset & Base ----- */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Times New Roman', 'Palatino', Georgia, serif;
background: #f5f3f0;
color: #1a1a1a;
line-height: 1.7;
padding: 40px 20px;
}
.container {
max-width: 900px;
margin: 0 auto;
background: #ffffff;
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
padding: 60px 80px;
border-radius: 4px;
}
/* ----- Typography (LaTeX-style) ----- */
h1 {
font-size: 28px;
font-weight: 700;
text-align: center;
margin-top: 10px;
margin-bottom: 6px;
letter-spacing: -0.3px;
line-height: 1.3;
}
.authors {
text-align: center;
font-size: 16px;
margin: 8px 0 4px 0;
color: #2c2c2c;
}
.affiliation {
text-align: center;
font-size: 14px;
color: #555;
margin-bottom: 20px;
}
.abstract-label {
font-weight: 700;
font-size: 15px;
text-transform: uppercase;
letter-spacing: 1px;
margin-top: 30px;
margin-bottom: 8px;
border-top: 1px solid #ddd;
padding-top: 18px;
}
.abstract-text {
font-size: 15px;
text-align: justify;
margin-bottom: 28px;
padding: 0 4px;
}
h2 {
font-size: 20px;
font-weight: 700;
margin-top: 32px;
margin-bottom: 12px;
border-bottom: 1px solid #eaeaea;
padding-bottom: 6px;
}
h3 {
font-size: 17px;
font-weight: 600;
margin-top: 22px;
margin-bottom: 8px;
font-style: italic;
}
p {
font-size: 15px;
text-align: justify;
margin-bottom: 12px;
text-indent: 1.8em;
}
p.no-indent {
text-indent: 0;
}
/* ----- Figures & Tables ----- */
.figure-box {
margin: 28px 0;
text-align: center;
background: #fafafa;
padding: 20px 10px 12px 10px;
border-radius: 4px;
border: 1px solid #eee;
}
.figure-box svg {
max-width: 100%;
height: auto;
}
.figure-box .caption {
font-size: 13px;
color: #444;
margin-top: 10px;
font-style: italic;
}
.table-wrap {
margin: 28px 0;
overflow-x: auto;
font-size: 14px;
}
.table-wrap table {
width: 100%;
border-collapse: collapse;
background: #fafafa;
}
.table-wrap th,
.table-wrap td {
border: 1px solid #ccc;
padding: 8px 14px;
text-align: center;
}
.table-wrap th {
background: #eee;
font-weight: 600;
}
.table-wrap .caption {
font-size: 13px;
color: #444;
margin-top: 8px;
font-style: italic;
text-align: center;
}
/* ----- Math ----- */
.math {
font-family: 'Cambria', 'Times New Roman', serif;
font-style: italic;
padding: 0 2px;
}
.math-block {
text-align: center;
font-size: 18px;
padding: 12px 0;
font-family: 'Cambria', 'Times New Roman', serif;
font-style: italic;
letter-spacing: 0.5px;
}
/* ----- References ----- */
.references {
margin-top: 40px;
border-top: 1px solid #ddd;
padding-top: 20px;
}
.references h2 {
border-bottom: none;
font-size: 18px;
}
.references ol {
padding-left: 28px;
font-size: 13px;
line-height: 1.8;
color: #222;
}
.references ol li {
margin-bottom: 4px;
}
/* ----- Controls (UI outside paper) ----- */
.controls {
max-width: 900px;
margin: 0 auto 30px auto;
display: flex;
flex-wrap: wrap;
gap: 12px;
justify-content: center;
align-items: center;
}
.controls button {
background: #1a1a1a;
color: #fff;
border: none;
padding: 12px 32px;
font-size: 15px;
font-family: 'Segoe UI', sans-serif;
border-radius: 30px;
cursor: pointer;
transition: background 0.2s;
letter-spacing: 0.3px;
}
.controls button:hover {
background: #333;
}
.controls button.secondary {
background: #e8e6e3;
color: #1a1a1a;
}
.controls button.secondary:hover {
background: #d5d2cd;
}
.controls .seed-input {
padding: 10px 16px;
font-size: 14px;
border: 1px solid #ccc;
border-radius: 30px;
font-family: 'Segoe UI', sans-serif;
width: 200px;
outline: none;
}
.controls .seed-input:focus {
border-color: #1a1a1a;
}
.badge {
font-size: 13px;
color: #777;
font-family: 'Segoe UI', sans-serif;
}
/* ----- Responsive ----- */
@media (max-width: 700px) {
.container {
padding: 30px 24px;
}
h1 {
font-size: 22px;
}
.controls {
flex-direction: column;
align-items: stretch;
}
.controls .seed-input {
width: 100%;
}
}
@media print {
body {
background: #fff;
padding: 0;
}
.container {
box-shadow: none;
padding: 40px 60px;
border-radius: 0;
}
.controls {
display: none !important;
}
.figure-box {
background: #fff;
border: 1px solid #ddd;
}
.table-wrap table {
background: #fff;
}
}
</style>
</head>
<body>
<!-- ============ CONTROLS ============ -->
<div class="controls">
<button id="generateBtn">⟳ Generate New Paper</button>
<button class="secondary" id="printBtn">🖨 Print / PDF</button>
<input type="text" id="seedInput" class="seed-input" placeholder="Seed (optional)" />
<span class="badge" id="seedDisplay">seed: random</span>
</div>
<!-- ============ PAPER ============ -->
<div class="container" id="paperContainer">
<!-- Everything inside is generated by JavaScript -->
</div>
<!-- ============ JAVASCRIPT ============ -->
<script>
// ================================================================
// SCIGEN — A Markov-chain academic paper generator
// Ported from the classic SCIgen (MIT) to pure JavaScript.
// Generates grammatically correct but semantically random CS papers.
// ================================================================
(function() {
'use strict';
// ---- PRNG with seed support ----
let _seed = 42;
function setSeed(s) {
_seed = (typeof s === 'number' && !isNaN(s)) ? s : 42;
}
// Mulberry32 PRNG
function nextRandom() {
_seed = (_seed + 0x6D2B79F5) | 0;
let t = Math.imul(_seed ^ (_seed >>> 15), 1 | _seed);
t ^= t + Math.imul(t ^ (t >>> 7), 61 | t);
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
}
function randInt(min, max) {
return Math.floor(nextRandom() * (max - min + 1)) + min;
}
function pick(arr) {
return arr[randInt(0, arr.length - 1)];
}
// ---- Word lists (adapted from SCIgen) ----
const NOUNS = [
'algorithm', 'network', 'system', 'method', 'approach', 'framework',
'model', 'architecture', 'protocol', 'technique', 'paradigm', 'ontology',
'heuristic', 'metric', 'kernel', 'schema', 'taxonomy', 'workflow',
'pipeline', 'repository', 'infrastructure', 'interface', 'component',
'module', 'agent', 'node', 'cluster', 'graph', 'tree', 'vector',
'matrix', 'tensor', 'distribution', 'function', 'process', 'thread',
'packet', 'stream', 'buffer', 'cache', 'proxy', 'gateway'
];
const ADJECTIVES = [
'adaptive', 'distributed', 'scalable', 'robust', 'efficient', 'novel',
'hierarchical', 'incremental', 'probabilistic', 'deterministic',
'stochastic', 'dynamic', 'static', 'recursive', 'iterative',
'asymptotic', 'optimal', 'heuristic', 'greedy', 'genetic', 'neural',
'bayesian', 'frequentist', 'semantic', 'syntactic', 'lexical',
'morphological', 'phonological', 'cognitive', 'computational',
'quantum', 'classical', 'relativistic', 'topological', 'algebraic'
];
const VERBS = [
'optimizes', 'computes', 'estimates', 'approximates', 'simulates',
'generates', 'constructs', 'derives', 'formulates', 'solves',
'classifies', 'clusters', 'regresses', 'predicts', 'interpolates',
'extrapolates', 'normalizes', 'regularizes', 'converges', 'diverges',
'encodes', 'decodes', 'encrypts', 'decrypts', 'compresses', 'decompresses'
];
const ADVERBS = [
'efficiently', 'robustly', 'adaptively', 'recursively', 'iteratively',
'approximately', 'exactly', 'rapidly', 'gradually', 'significantly',
'marginally', 'substantially', 'qualitatively', 'quantitatively'
];
const PREPOSITIONS = [
'of', 'in', 'for', 'on', 'with', 'at', 'by', 'through', 'across',
'among', 'between', 'within', 'without', 'via', 'per'
];
const CONJUNCTIONS = [
'and', 'or', 'but', 'while', 'whereas', 'although', 'because', 'since'
];
// ---- Paper sections ----
const SECTION_TITLES = [
'Introduction', 'Background', 'Related Work', 'Methodology',
'Experimental Setup', 'Results', 'Discussion', 'Conclusion',
'Future Work', 'Limitations', 'Implementation Details'
];
// ---- Sentence templates (produce grammatically correct English) ----
function generateSentence() {
const templates = [
function() { return `The ${pick(ADJECTIVES)} ${pick(NOUNS)} ${pick(VERBS)} the ${pick(ADJECTIVES)} ${pick(NOUNS)}.`; },
function() { return `We ${pick(VERBS)} the ${pick(NOUNS)} ${pick(ADVERBS)}.`; },
function() { return `Our ${pick(NOUNS)} ${pick(VERBS)} the ${pick(NOUNS)} ${pick(PREPOSITIONS)} ${pick(NOUNS)}.`; },
function() { return `This ${pick(ADJECTIVES)} ${pick(NOUNS)} ${pick(VERBS)} ${pick(ADVERBS)} ${pick(NOUNS)}.`; },
function() { return `The ${pick(NOUNS)} ${pick(VERBS)} ${pick(NOUNS)} ${pick(CONJUNCTIONS)} ${pick(NOUNS)}.`; },
function() { return `${pick(ADJECTIVES)} ${pick(NOUNS)} ${pick(VERBS)} the ${pick(ADJECTIVES)} ${pick(NOUNS)} ${pick(PREPOSITIONS)} ${pick(NOUNS)}.`; },
function() { return `We ${pick(VERBS)} ${pick(NOUNS)} ${pick(ADVERBS)} using ${pick(NOUNS)}.`; },
function() { return `The ${pick(NOUNS)} ${pick(VERBS)} ${pick(NOUNS)} ${pick(ADVERBS)}.`; },
function() { return `Our ${pick(ADJECTIVES)} ${pick(NOUNS)} ${pick(VERBS)} the ${pick(NOUNS)} ${pick(PREPOSITIONS)} ${pick(NOUNS)}.`; },
function() { return `This ${pick(NOUNS)} ${pick(VERBS)} ${pick(NOUNS)} ${pick(CONJUNCTIONS)} ${pick(NOUNS)}.`; },
];
return pick(templates)();
}
function generateParagraph(sentences) {
const count = sentences || randInt(4, 8);
let paras = [];
for (let i = 0; i < count; i++) {
paras.push(generateSentence());
}
return paras.join(' ');
}
function generateTitle() {
const templates = [
function() { return `${pick(ADJECTIVES)} ${pick(NOUNS)} for ${pick(ADJECTIVES)} ${pick(NOUNS)}`; },
function() { return `Toward ${pick(ADJECTIVES)} ${pick(NOUNS)}: ${pick(VERBS)} ${pick(NOUNS)}`; },
function() { return `${pick(ADJECTIVES)} ${pick(NOUNS)} ${pick(PREPOSITIONS)} ${pick(NOUNS)}`; },
function() { return `${pick(NOUNS)} ${pick(VERBS)} ${pick(NOUNS)}: ${pick(ADJECTIVES)} ${pick(NOUNS)}`; },
function() { return `${pick(ADJECTIVES)} ${pick(NOUNS)} ${pick(CONJUNCTIONS)} ${pick(ADJECTIVES)} ${pick(NOUNS)}`; },
function() { return `On the ${pick(NOUNS)} ${pick(PREPOSITIONS)} ${pick(NOUNS)}`; },
function() { return `${pick(VERBS)} ${pick(NOUNS)} ${pick(ADVERBS)} ${pick(PREPOSITIONS)} ${pick(NOUNS)}`; },
];
let t = pick(templates)();
return t.charAt(0).toUpperCase() + t.slice(1);
}
function generateAbstract() {
let sentences = [];
for (let i = 0; i < randInt(5, 9); i++) {
sentences.push(generateSentence());
}
return sentences.join(' ');
}
// ---- Fake authors ----
const FIRST_NAMES = ['John', 'Jane', 'Michael', 'Sarah', 'David', 'Emily',
'Robert', 'Lisa', 'William', 'Karen', 'James', 'Nancy', 'Charles',
'Betty', 'Thomas', 'Helen', 'Daniel', 'Sandra', 'Matthew', 'Donna'
];
const LAST_NAMES = ['Smith', 'Johnson', 'Williams', 'Brown', 'Jones',
'Garcia', 'Miller', 'Davis', 'Rodriguez', 'Martinez', 'Hernandez',
'Lopez', 'Wilson', 'Anderson', 'Thomas', 'Taylor', 'Moore', 'Jackson',
'Martin', 'Lee', 'Perez', 'Thompson', 'White', 'Harris', 'Sanchez'
];
const UNIVS = ['MIT', 'Stanford University', 'UC Berkeley', 'Cambridge',
'Oxford', 'ETH Zurich', 'Tsinghua University', 'University of Tokyo',
'Carnegie Mellon', 'University of Washington', 'University of Toronto',
'University of London'
];
function generateAuthors() {
const count = randInt(1, 4);
let names = [];
for (let i = 0; i < count; i++) {
names.push(pick(FIRST_NAMES) + ' ' + pick(LAST_NAMES));
}
return names;
}
// ---- Fake figures (SVG) ----
function generateFigure() {
const chartType = pick(['bar', 'scatter', 'line']);
let svg = '';
const w = 420,
h = 220;
if (chartType === 'bar') {
const bars = randInt(5, 9);
const data = [];
let total = 0;
for (let i = 0; i < bars; i++) {
const v = nextRandom() * 0.7 + 0.1;
data.push(v);
total += v;
}
const maxVal = Math.max(...data) * 1.25;
const barWidth = w / (bars * 1.8);
const gap = barWidth * 0.6;
svg =
`<svg viewBox="0 0 ${w} ${h}" xmlns="http://www.w3.org/2000/svg" style="background:#fafafa;border-radius:4px;">`;
svg += `<rect x="0" y="0" width="${w}" height="${h}" fill="#fafafa" rx="4"/>`;
for (let i = 0; i < data.length; i++) {
const x = i * (barWidth + gap) + gap;
const barH = (data[i] / maxVal) * (h - 40);
const y = h - 20 - barH;
const hue = (i / data.length) * 270 + 180;
svg +=
`<rect x="${x}" y="${y}" width="${barWidth}" height="${barH}" fill="hsl(${hue},65%,55%)" rx="2"/>`;
}
svg += `<line x1="10" y1="${h-20}" x2="${w-10}" y2="${h-20}" stroke="#888" stroke-width="1"/>`;
svg +=
`<line x1="10" y1="10" x2="10" y2="${h-20}" stroke="#888" stroke-width="1"/>`;
svg += `</svg>`;
} else if (chartType === 'scatter') {
const points = randInt(15, 35);
svg =
`<svg viewBox="0 0 ${w} ${h}" xmlns="http://www.w3.org/2000/svg" style="background:#fafafa;border-radius:4px;">`;
svg += `<rect x="0" y="0" width="${w}" height="${h}" fill="#fafafa" rx="4"/>`;
for (let i = 0; i < points; i++) {
const x = nextRandom() * (w - 30) + 15;
const y = nextRandom() * (h - 30) + 15;
const r = nextRandom() * 4 + 2;
const hue = 200 + nextRandom() * 60;
svg +=
`<circle cx="${x}" cy="${y}" r="${r}" fill="hsla(${hue},70%,50%,0.7)" stroke="hsla(${hue},70%,40%,0.3)" stroke-width="0.5"/>`;
}
svg += `</svg>`;
} else { // line
const pts = randInt(8, 14);
svg =
`<svg viewBox="0 0 ${w} ${h}" xmlns="http://www.w3.org/2000/svg" style="background:#fafafa;border-radius:4px;">`;
svg += `<rect x="0" y="0" width="${w}" height="${h}" fill="#fafafa" rx="4"/>`;
let path = '';
let lastY = 0;
for (let i = 0; i < pts; i++) {
const x = (i / (pts - 1)) * (w - 30) + 15;
const y = h - 20 - (nextRandom() * 0.6 + 0.1) * (h - 40);
if (i === 0) path += `M ${x} ${y}`;
else path += ` L ${x} ${y}`;
lastY = y;
}
svg += `<polyline points="${path.substring(path.indexOf('M') + 2).trim()}" fill="none" stroke="#2563eb" stroke-width="2.5" stroke-linecap="round"/>`;
svg += `<circle cx="${15}" cy="${h-20-(nextRandom()*0.6+0.1)*(h-40)}" r="5" fill="#2563eb" opacity="0.3"/>`;
svg += `</svg>`;