File size: 21,792 Bytes
a14a321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65ebb50
 
 
 
 
 
 
 
a14a321
 
 
 
 
 
 
65ebb50
a14a321
 
 
 
 
 
 
 
 
 
 
65ebb50
a14a321
 
 
 
 
 
 
 
 
 
 
 
 
 
65ebb50
a14a321
 
 
65ebb50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
 
65ebb50
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
65ebb50
 
 
 
 
 
 
 
 
 
 
a14a321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65ebb50
 
 
 
 
 
 
a14a321
65ebb50
 
 
a14a321
 
 
 
 
65ebb50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a14a321
 
 
65ebb50
a14a321
 
65ebb50
a14a321
 
65ebb50
a14a321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674bbd7
a14a321
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>The Selfish Gene - Chapter Summaries</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .chapter-card {
            transition: all 0.3s ease;
            transform-origin: top;
        }
        .chapter-card:hover {
            transform: scale(1.02);
            box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
        }
        .chapter-content {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.5s ease;
        }
        .chapter-content.open {
            max-height: 1000px;
        }
        .active-tab {
            border-bottom: 3px solid #3b82f6;
            color: #3b82f6;
        }
        .search-highlight {
            background-color: #fef08a;
        }
        .core-idea {
            background-color: #f0f9ff;
            border-left: 4px solid #3b82f6;
        }
        .example {
            background-color: #f0fdf4;
            border-left: 4px solid #10b981;
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <!-- Header -->
        <header class="text-center mb-12">
            <h1 class="text-4xl md:text-5xl font-bold text-gray-800 mb-4">The Selfish Gene</h1>
            <p class="text-xl text-gray-600 mb-6">by Richard Dawkins - Expanded Chapter Summaries</p>
            <div class="relative max-w-2xl mx-auto">
                <input type="text" id="searchInput" placeholder="Search chapters..." 
                       class="w-full px-6 py-3 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 shadow-sm">
                <i class="fas fa-search absolute right-6 top-3.5 text-gray-400"></i>
            </div>
        </header>

        <!-- Tabs -->
        <div class="flex overflow-x-auto mb-8 border-b border-gray-200">
            <button class="tab-btn px-6 py-3 font-medium text-gray-600 whitespace-nowrap" data-tab="all">All Chapters</button>
            <button class="tab-btn px-6 py-3 font-medium text-gray-600 whitespace-nowrap" data-tab="core">Core Ideas</button>
            <button class="tab-btn px-6 py-3 font-medium text-gray-600 whitespace-nowrap" data-tab="examples">Detailed Examples</button>
        </div>

        <!-- Chapters Container -->
        <div id="chaptersContainer" class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
            <!-- Chapters will be inserted here by JavaScript -->
        </div>

        <!-- Back to Top Button -->
        <button id="backToTop" class="fixed bottom-6 right-6 bg-blue-500 text-white p-3 rounded-full shadow-lg opacity-0 invisible transition-all duration-300">
            <i class="fas fa-arrow-up"></i>
        </button>
    </div>

    <script>
        // Book data with expanded summaries
        const chapters = [
            {
                title: "Chapter 1: Why are people?",
                coreIdeas: [
                    "Humans exist because of Darwinian evolution—organisms are vehicles created by genes for their own preservation.",
                    "Dawkins argues against common misconceptions that animals or humans behave 'for the good of the species,' proposing instead a gene-centered view.",
                    "Genes survive by making individuals act in ways that benefit those genes directly, even if harmful to others."
                ],
                examples: [
                    {
                        title: "Selfish Behavior",
                        content: "Blackheaded gulls living in close colonies steal and eat chicks from neighboring nests when the parents are away. This selfish act directly benefits the predator gull's genes by providing food, thus increasing the chance of survival and reproduction of those genes."
                    },
                    {
                        title: "Apparent Altruism (which is actually selfish)",
                        content: "Bees sting intruders to protect their colony, dying in the process. While this seems altruistic, it actually helps their own genetic relatives (their sisters) survive and reproduce, indirectly preserving their shared genes."
                    }
                ]
            },
            {
                title: "Chapter 2: The Replicators",
                coreIdeas: [
                    "Life began when simple molecules accidentally developed the ability to replicate themselves ('replicators').",
                    "Natural selection favored replicators that were stable, fast at replicating, and good at making accurate copies.",
                    "Evolution emerged naturally from these processes, gradually forming complex life."
                ],
                examples: [
                    {
                        title: "Primordial Replicators",
                        content: "Imagine early earth as a 'primordial soup' of chemicals. Randomly, some molecules began self-copying. Occasional errors in copying (mutations) occurred—like typos when repeatedly copying a book by hand. Most mutations failed, but rare helpful mutations allowed some replicators to copy themselves more effectively. Over billions of years, replicators became increasingly complex, eventually leading to sophisticated molecules like DNA."
                    }
                ]
            },
            {
                title: "Chapter 3: Immortal Coils",
                coreIdeas: [
                    "Modern genes, especially DNA molecules, are advanced replicators living inside complex 'survival machines' (bodies).",
                    "Bodies exist purely as vehicles that genes construct to protect and propagate themselves through generations, giving genes a form of immortality."
                ],
                examples: [
                    {
                        title: "DNA Replication",
                        content: "Each human body contains trillions of cells, each cell holding DNA—complete 'blueprints' for building the entire organism. Every time cells divide, DNA replicates exactly, spreading genes across generations. Your body is temporary, but your genes continue on through offspring, making genes essentially immortal."
                    }
                ]
            },
            {
                title: "Chapter 4: The Gene Machine",
                coreIdeas: [
                    "Organisms are elaborate machines created by genes to ensure their survival.",
                    "Genes 'program' organisms to act in ways that enhance gene survival, shaping complex structures and behaviors solely to propagate themselves more effectively."
                ],
                examples: [
                    {
                        title: "Eyesight Evolution",
                        content: "Animals have eyes not because 'eyes help animals survive,' but because genes that built eyes outperformed genes that didn't. For instance, a hawk's genes coded for excellent eyesight, enabling successful hunting, thus ensuring that these genes proliferate more successfully compared to competitors without such beneficial traits."
                    }
                ]
            },
            {
                title: "Chapter 5: Aggression: Stability and the Selfish Machine",
                coreIdeas: [
                    "Aggression and competitive behaviors evolved as stable strategies determined by genetic success, explained using game theory.",
                    "Genes code behaviors that maximize individual survival and reproduction through balanced risk and reward calculations."
                ],
                examples: [
                    {
                        title: "Ritualistic Displays",
                        content: "Animals often use aggression rituals (threat displays, bluffing) instead of actual combat because genes promoting less risky, stable strategies are more successful. Deer engage in ritualistic antler displays rather than fighting to death, because serious injuries would negatively affect their reproductive success, ultimately harming their genes' chances."
                    }
                ]
            },
            {
                title: "Chapter 6: Genesmanship",
                coreIdeas: [
                    "Genes manipulate not only the physical bodies but also behavior and interactions between organisms to enhance their own survival chances.",
                    "This 'genesmanship' includes manipulation, deceit, and strategic alliances between individuals."
                ],
                examples: [
                    {
                        title: "Parasitic Manipulation",
                        content: "Parasites, such as certain worms or viruses, manipulate host behavior to increase their own reproductive success. For example, some parasites make their hosts less cautious or even suicidal, facilitating transmission to new hosts, thus increasing the parasite's genetic spread."
                    }
                ]
            },
            {
                title: "Chapter 7: Family Planning",
                coreIdeas: [
                    "Parental care involves strategic genetic conflicts.",
                    "Parents balance resources allocated to offspring to maximize their genetic success, while offspring evolve tactics to extract maximum resources from parents, leading to an inherent 'genetic conflict.'"
                ],
                examples: [
                    {
                        title: "Bird Chick Demands",
                        content: "Bird chicks loudly demand food to convince parents to give them extra care. From the chick's gene perspective, maximum parental resources enhance their own survival. From the parents' gene perspective, over-investment in one chick reduces resources available for future offspring, creating tension and strategic conflict."
                    }
                ]
            },
            {
                title: "Chapter 8: Battle of the Generations",
                coreIdeas: [
                    "Conflicts arise between generations due to differing genetic interests over reproductive success and resource distribution.",
                    "Genes strategically balance resources allocated between current and future offspring, leading to competition between parents and offspring."
                ],
                examples: [
                    {
                        title: "Human Pregnancy Conflict",
                        content: "Human pregnancy demonstrates intergenerational conflict. A fetus releases chemicals to extract nutrients from the mother beyond what's optimal for the mother's health, enhancing fetal survival (and its genes) at the mother's expense, illustrating genetic conflict."
                    }
                ]
            },
            {
                title: "Chapter 9: Battle of the Sexes",
                coreIdeas: [
                    "Reproductive strategies differ between males and females, causing genetic conflicts between sexes.",
                    "Genes shape differing sexual behaviors to optimize their own chances of reproduction, leading to sexual selection and conflict."
                ],
                examples: [
                    {
                        title: "Peacock Sexual Selection",
                        content: "Male peacocks display extravagant tails to attract females. Females select males based on tail quality, indirectly assessing genetic fitness. Males compete intensely, whereas females carefully select mates to maximize genetic quality of offspring, exemplifying strategic genetic conflicts between sexes."
                    }
                ]
            },
            {
                title: "Chapter 10: You Scratch My Back, I'll Ride on Yours",
                coreIdeas: [
                    "Cooperation and reciprocal altruism evolve when organisms mutually benefit genetically.",
                    "Genes favor cooperation if long-term interactions lead to repeated mutual benefit, even between non-relatives."
                ],
                examples: [
                    {
                        title: "Vampire Bat Altruism",
                        content: "Vampire bats share blood meals within their colonies. A bat that shares blood today is likely to be repaid in the future when it is hungry. Such 'reciprocal altruism' improves genetic survival for both parties, evolving stable cooperative behaviors."
                    }
                ]
            },
            {
                title: "Chapter 11: Memes: The New Replicators",
                coreIdeas: [
                    "Dawkins introduces 'memes,' units of cultural transmission analogous to genes.",
                    "Memes (ideas, behaviors, cultural phenomena) replicate through imitation, evolving independently of biological genes, creating cultural evolution."
                ],
                examples: [
                    {
                        title: "Cultural Memes",
                        content: "Popular tunes, fashion styles, and technologies (e.g., smartphones, internet memes) rapidly spread by imitation and evolve culturally. Successful memes proliferate rapidly regardless of biological advantage, resembling genetic replication but in cultural space."
                    }
                ]
            },
            {
                title: "Chapter 12: Nice Guys Finish First",
                coreIdeas: [
                    "Contrary to selfishness always dominating, cooperation can be evolutionarily successful.",
                    "Dawkins uses game theory ('Tit-for-Tat') to illustrate how cooperative strategies become stable evolutionary outcomes, even in competitive environments."
                ],
                examples: [
                    {
                        title: "Tit-for-Tat Strategy",
                        content: "'Tit-for-Tat,' where animals start by cooperating but retaliate if cheated, demonstrates a robust cooperative strategy. Cleaner fish remove parasites from larger fish, cooperating mutually. If a cleaner fish cheats (bites instead of cleaning), the larger fish stops visiting, thus cooperation remains evolutionarily stable."
                    }
                ]
            },
            {
                title: "Chapter 13: The Long Reach of the Gene",
                coreIdeas: [
                    "Genes influence the world far beyond an organism's immediate body ('extended phenotype').",
                    "Genes control behaviors that shape environments and interactions, indirectly enhancing their own survival."
                ],
                examples: [
                    {
                        title: "Beaver Dams",
                        content: "Beavers build dams, altering ecosystems dramatically. This environmental manipulation directly improves the beavers' survival prospects, enhancing the genes' own chances of passing on. Thus, beaver dams are an example of genes' indirect control extending beyond the organism's physical body."
                    }
                ]
            }
        ];

        // DOM Elements
        const chaptersContainer = document.getElementById('chaptersContainer');
        const searchInput = document.getElementById('searchInput');
        const tabButtons = document.querySelectorAll('.tab-btn');
        const backToTopBtn = document.getElementById('backToTop');

        // Current filter state
        let currentTab = 'all';
        let currentSearchTerm = '';

        // Initialize the app
        function init() {
            renderChapters();
            setupEventListeners();
        }

        // Render chapters based on current filters
        function renderChapters() {
            chaptersContainer.innerHTML = '';
            
            const filteredChapters = chapters.filter(chapter => {
                // Filter by search term
                if (currentSearchTerm === '') return true;
                
                const searchFields = [
                    chapter.title,
                    ...chapter.coreIdeas,
                    ...chapter.examples.map(e => e.title + ' ' + e.content)
                ];
                
                return searchFields.some(field => 
                    field.toLowerCase().includes(currentSearchTerm)
                );
            });

            filteredChapters.forEach((chapter, index) => {
                const chapterCard = document.createElement('div');
                chapterCard.className = 'chapter-card bg-white rounded-xl shadow-md overflow-hidden border border-gray-100';
                
                let coreIdeasHtml = '';
                if (currentTab === 'all' || currentTab === 'core') {
                    coreIdeasHtml = `
                        <div class="core-idea p-4 mb-4 rounded">
                            <h4 class="font-semibold text-blue-700 mb-2">Core Ideas:</h4>
                            <ul class="list-disc pl-5 space-y-2">
                                ${chapter.coreIdeas.map(idea => 
                                    `<li class="text-gray-700">${highlightSearchTerms(idea)}</li>`
                                ).join('')}
                            </ul>
                        </div>
                    `;
                }

                let examplesHtml = '';
                if (currentTab === 'all' || currentTab === 'examples') {
                    examplesHtml = `
                        <div class="space-y-4">
                            <h4 class="font-semibold text-green-700 mb-2">Detailed Examples:</h4>
                            ${chapter.examples.map(example => `
                                <div class="example p-4 mb-4 rounded">
                                    <h5 class="font-semibold text-green-800">${highlightSearchTerms(example.title)}</h5>
                                    <p class="text-gray-700 mt-1">${highlightSearchTerms(example.content)}</p>
                                </div>
                            `).join('')}
                        </div>
                    `;
                }

                chapterCard.innerHTML = `
                    <div class="p-6 cursor-pointer" onclick="toggleChapterContent(${index})">
                        <div class="flex justify-between items-start">
                            <h3 class="text-xl font-bold text-gray-800 mb-2">${highlightSearchTerms(chapter.title)}</h3>
                            <i class="fas fa-chevron-down text-gray-400 transition-transform duration-300" id="chevron-${index}"></i>
                        </div>
                        ${currentTab !== 'examples' ? coreIdeasHtml : ''}
                    </div>
                    <div class="chapter-content px-6 pb-6" id="content-${index}">
                        ${examplesHtml}
                    </div>
                `;
                chaptersContainer.appendChild(chapterCard);
            });
        }

        // Highlight search terms in text
        function highlightSearchTerms(text) {
            if (!currentSearchTerm) return text;
            
            const regex = new RegExp(currentSearchTerm, 'gi');
            return text.replace(regex, match => 
                `<span class="search-highlight">${match}</span>`
            );
        }

        // Toggle chapter content visibility
        function toggleChapterContent(index) {
            const content = document.getElementById(`content-${index}`);
            const chevron = document.getElementById(`chevron-${index}`);
            
            content.classList.toggle('open');
            chevron.classList.toggle('rotate-180');
        }

        // Set up event listeners
        function setupEventListeners() {
            // Search input
            searchInput.addEventListener('input', (e) => {
                currentSearchTerm = e.target.value.toLowerCase().trim();
                renderChapters();
            });

            // Tab buttons
            tabButtons.forEach(button => {
                button.addEventListener('click', () => {
                    currentTab = button.dataset.tab;
                    tabButtons.forEach(btn => btn.classList.remove('active-tab'));
                    button.classList.add('active-tab');
                    renderChapters();
                });
            });

            // Set first tab as active by default
            tabButtons[0].classList.add('active-tab');

            // Back to top button
            window.addEventListener('scroll', () => {
                if (window.pageYOffset > 300) {
                    backToTopBtn.classList.remove('opacity-0', 'invisible');
                    backToTopBtn.classList.add('opacity-100', 'visible');
                } else {
                    backToTopBtn.classList.remove('opacity-100', 'visible');
                    backToTopBtn.classList.add('opacity-0', 'invisible');
                }
            });

            backToTopBtn.addEventListener('click', () => {
                window.scrollTo({
                    top: 0,
                    behavior: 'smooth'
                });
            });
        }

        // Make toggle function available globally
        window.toggleChapterContent = toggleChapterContent;

        // Initialize the app
        document.addEventListener('DOMContentLoaded', init);
    </script>

</html>