Establishment of Colonial Rule in Kenya

πŸ›οΈ ESTABLISHMENT OF COLONIAL RULE IN KENYA πŸ‡°πŸ‡ͺ

πŸ“š A Comprehensive Educational Guide to Kenya’s Colonial History πŸŽ“

🌍 CAUSES OF THE SCRAMBLE FOR EAST AFRICA

Factors that contributed to the scramble and partition of East Africa:

1

πŸ‡ͺπŸ‡Ί Rise of Nationalism in Europe

The Unification of Germany after the Franco-Prussian war (1870-71) upset the balance of power in Europe. There was need to rebalance through acquisition of colonies in Africa, including East Africa. Germans felt that securing colonial possessions was the only way their nation could gain recognition among other European powers.

2

πŸ—ΊοΈ Strategic Location of East Africa

Europeans were concerned with the source of the River Nile in East Africa and control of the Suez Canal. From the days of Portuguese conquest in the 15th century, East Africa proved to be a strategic location for fresh supplies. This is why Germans and British competed for possessions in the region.

3

🏭 Economic Development Needs

Industrialized nations rushed for colonies to tap raw materials to keep their factories running. There was popular belief that East Africa contained pockets of precious metals awaiting exploitation. They were also driven by search for markets for European goods and places to invest their capital.

4

πŸ“° Rise of Public Opinion in Europe

There was growth of public support towards the acquisition of colonies. For example, the Daily Press in London spoke well about acquiring colonies, influencing government policy.

5

πŸ‘₯ Social Factors

  • 🚫 Stamp out slave trade and replace it with legitimate trade
  • 🎭 Spread European culture to East Africa
  • β›ͺ Protect missionaries already operating in East Africa

βœ‚οΈ THE PROCESS OF PARTITION

The Berlin Conference failed to fully resolve the rivalry between Germans and British in East Africa. Activities of Karl Peters and Harry Johnstone for Germans and British respectively in the Mount Kilimanjaro region depicted intense rivalry which almost led to war.

πŸ“œ The Anglo-German Agreement of 1886

🀝 Terms of the Agreement:

  • Sultan’s Territory: 16 KM coastal strip from Vanga to Lamu, plus islands of Zanzibar, Pemba, Mafia, Lamu, Pate and towns like Lamu, Kisimayu, Mogadishu, Merca, and Brava
  • German Territory: Coastline of Witu, region between River Umba (North) and River Ruvuma (South)
  • British Territory: Territory north of River Umba up to River Juba
⚠️ Failed to determine western boundary – Uganda remained contested

🏝️ The Heligoland Treaty of 1890

πŸ“‹ Terms of the Heligoland Treaty:

  • πŸ‡ΊπŸ‡¬ Germany officially recognized Uganda as British sphere of influence
  • 🏝️ Germany abandoned claim over Witu territory in exchange for Heligoland island in North Sea
  • πŸ›οΈ Germany accepted British protectorate over Zanzibar and Pemba
  • 🌊 Germany acquired strip of land on Lake Tanganyika and coastal region of Tanganyika
  • πŸ‘‘ Sultan of Zanzibar retained 16km coastal strip
βœ… This treaty ended the scramble for and partition of East Africa

πŸ‡¬πŸ‡§ BRITISH OCCUPATION OF KENYA

πŸ› οΈ Methods Used by the British to Occupy Kenya

πŸ“ a) Signing of Treaties

  • Treaty by Sir William Mackinnon and Sultan of Zanzibar Barghash (1887) – put Zanzibar under British for 50 years
  • The Maasai Agreements of 1904 and 1911 between Oloibon Lenana and the British
  • The Anglo-German Treaties of 1886 and 1890

🀝 b) Collaboration

The British collaborated with communities like the Wanga and Maasai who were later used as bases to extend British authority over other areas.

🏰 c) Establishing Operational Bases

The British built forts like Fort Smith (Kabete) and Fort Hall (Murang’a) to enhance their political control.

🏒 d) Use of Company Rule

Due to fear of enormous costs of effective occupation and administration, the British mandated the IBEA Company to administer the Kenyan protectorate.

πŸ›οΈ THE IMPERIAL BRITISH EAST AFRICA COMPANY (IBEACO)

Sir William Mackinnon’s company was given the royal charter in 1888 with the following powers:

πŸ’Ό Powers of IBEACO:

  • πŸ’° Levying and collecting taxes and institute custom duties
  • βš–οΈ Establishing political authority and maintaining law and order
  • πŸ›’ Promoting legitimate trade and eradicating slave trade
  • πŸŽ“ Developing and civilizing indigenous peoples

βœ… Achievements of the IBEAC

  • πŸ›‘οΈ Successfully quelled local aggression from communities such as Nandi, Maasai and Akamba
  • 🏰 Established series of forts at Kibwezi, Machakos, Smith and Dagoretti
  • πŸ›£οΈ Improved transport and communication by pioneering road construction (e.g., Sclater’s Road between Kibwezi and Busia in 1894)
  • ⛓️ Succeeded in eradicating slavery to some extent and securing freedom for many slaves
  • 🌱 Developed rubber industry along the coast and interior

πŸ€” Reasons Why Britain Used IBEA Company

  • πŸ“Š Absence of clear policy on administration of colonial possessions
  • πŸ’΅ Company could provide cheap administrative capital
  • πŸ‘₯ Problem of inadequate personnel for colonial administration
  • πŸ“ˆ IBEACO’s long experience and heavy investment in the region

❌ Why Company Rule Failed by 1895

  • πŸ’Ž Region lacked strategic natural resources for export
  • πŸ’° Company lacked sufficient capital for day-to-day operations
  • 🚒 Transportation proved expensive and slow (no navigable rivers)
  • πŸ“ž Poor coordination due to lack of proper communication channels
  • πŸ’Έ Corruption among company officials
  • βš”οΈ Numerous resistances, especially in Nandi country
  • πŸ‘” Officials lacked administrative experience
  • 🦠 Harsh tropical climate and diseases like malaria and sleeping sickness
πŸ’” The company surrendered the Charter in 1895 to the British government for compensation of
*** QuickLaTeX cannot compile formula:
250,000
        </div>

        <div class="section-divider"></div>

        <h2>🔑 FACTORS THAT FACILITATED BRITISH CONTROL</h2>

        <div class="causes-grid">
            <div class="cause-card">
                <h4>⛪ Christian Missionary Factor</h4>
                Created atmosphere of friendship with Africans and occasionally called for protection against hostile communities.
            </div>

            <div class="cause-card">
                <h4>🏢 Trading Company Presence</h4>
                IBEACO agents signed treaties with African rulers as means of initiating effective occupation.
            </div>

            <div class="cause-card">
                <h4>⚔️ Superior Military Power</h4>
                European armies were more efficient, witnessed in ability to quell wars of resistance like Nandi resistance.
            </div>

            <div class="cause-card">
                <h4>💔 Disunity Among African Communities</h4>
                Wanga vs neighbors, Nandi vs Maasai conflicts, Mijikenda vs coastal Arabs - all advantageous to British.
            </div>

            <div class="cause-card">
                <h4>📜 Treaty Signing & Collaboration</h4>
                Maasai Agreement of 1900, various Wanga treaties with British.
            </div>

            <div class="cause-card">
                <h4>👑 Indirect Rule Policy</h4>
                British policy was readily acceptable, reducing chances of resistance.
            </div>

            <div class="cause-card">
                <h4>💰 Financial Support</h4>
                Strong financial backing from the home government in Britain.
            </div>
        </div>

        <div class="section-divider"></div>

        <div class="highlight-box">
            <h2>🎓 Educational Summary</h2>
            The establishment of colonial rule in Kenya was a complex process involving European power struggles, economic interests, strategic considerations, and the exploitation of local divisions. Understanding this history helps us comprehend modern Kenya's development and challenges.
            <span class="emoji-large">📖</span>
            <span class="emoji-large">🌍</span>
            <span class="emoji-large">🎯</span>
        </div>

    </div>
</body>
</html>
<!-- /wp:html -->

<!-- wp:heading {"style":{"color":{"gradient":"linear-gradient(135deg,rgb(6,147,227) 0%,rgb(210,156,156) 34%,rgb(149,230,187) 100%)"}}} -->
<h2 class="wp-block-heading has-background" style="background:linear-gradient(135deg,rgb(6,147,227) 0%,rgb(210,156,156) 34%,rgb(149,230,187) 100%)">UNLOCK SELF-ASSESSMENT TEST ON TOPIC</h2>
<!-- /wp:heading -->

<!-- wp:html {"um_is_restrict":true,"um_who_access":"1","um_roles_access":["customer"],"um_message_type":"1"} -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Kenya Colonial Rule Quiz</title>
    <style>
        .quiz-container {
            max-width: 800px;
            margin: 20px auto;
            padding: 30px;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.1);
            color: white;
        }

        .quiz-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .quiz-title {
            font-size: 2.5em;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .quiz-subtitle {
            font-size: 1.2em;
            opacity: 0.9;
            margin-bottom: 20px;
        }

        .progress-bar {
            width: 100%;
            height: 8px;
            background: rgba(255,255,255,0.3);
            border-radius: 4px;
            margin-bottom: 30px;
            overflow: hidden;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #f39c12, #e74c3c);
            border-radius: 4px;
            transition: width 0.3s ease;
            width: 10%;
        }

        .question-card {
            background: white;
            color: #333;
            padding: 30px;
            border-radius: 15px;
            margin-bottom: 20px;
            box-shadow: 0 8px 25px rgba(0,0,0,0.1);
            display: none;
        }

        .question-card.active {
            display: block;
            animation: slideIn 0.5s ease;
        }

        @keyframes slideIn {
            from { opacity: 0; transform: translateX(30px); }
            to { opacity: 1; transform: translateX(0); }
        }

        .question-number {
            background: #3498db;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            margin-bottom: 20px;
            font-size: 1.2em;
        }

        .question-text {
            font-size: 1.3em;
            margin-bottom: 25px;
            color: #2c3e50;
            line-height: 1.6;
        }

        .options {
            display: grid;
            gap: 15px;
        }

        .option {
            background: #f8f9fa;
            border: 2px solid #e9ecef;
            padding: 15px 20px;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 1.1em;
            display: flex;
            align-items: center;
        }

        .option:hover {
            background: #e3f2fd;
            border-color: #2196f3;
            transform: translateY(-2px);
        }

        .option.selected {
            background: #2196f3;
            color: white;
            border-color: #1976d2;
        }

        .option-letter {
            background: #34495e;
            color: white;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 15px;
            font-weight: bold;
        }

        .option.selected .option-letter {
            background: white;
            color: #2196f3;
        }

        .navigation {
            display: flex;
            justify-content: space-between;
            margin-top: 30px;
        }

        .nav-btn {
            padding: 12px 25px;
            border: none;
            border-radius: 25px;
            font-size: 1.1em;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .prev-btn {
            background: #95a5a6;
            color: white;
        }

        .prev-btn:hover {
            background: #7f8c8d;
        }

        .prev-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .next-btn {
            background: linear-gradient(45deg, #e74c3c, #c0392b);
            color: white;
        }

        .next-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
        }

        .results-card {
            background: white;
            color: #333;
            padding: 40px;
            border-radius: 15px;
            text-align: center;
            display: none;
        }

        .results-card.active {
            display: block;
            animation: fadeIn 0.8s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: scale(0.9); }
            to { opacity: 1; transform: scale(1); }
        }

        .score-circle {
            width: 150px;
            height: 150px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 30px;
            font-size: 2.5em;
            font-weight: bold;
            color: white;
        }

        .score-excellent { background: linear-gradient(45deg, #27ae60, #2ecc71); }
        .score-good { background: linear-gradient(45deg, #f39c12, #e67e22); }
        .score-fair { background: linear-gradient(45deg, #e74c3c, #c0392b); }

        .performance-text {
            font-size: 1.5em;
            margin-bottom: 20px;
            font-weight: bold;
        }

        .analysis {
            background: #f8f9fa;
            padding: 25px;
            border-radius: 10px;
            margin: 25px 0;
            text-align: left;
        }

        .analysis h3 {
            color: #2c3e50;
            margin-bottom: 15px;
        }

        .topic-score {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 10px 0;
            padding: 10px;
            background: white;
            border-radius: 8px;
        }

        .topic-bar {
            width: 100px;
            height: 8px;
            background: #ecf0f1;
            border-radius: 4px;
            overflow: hidden;
        }

        .topic-fill {
            height: 100%;
            background: linear-gradient(90deg, #3498db, #2980b9);
            border-radius: 4px;
        }

        .restart-btn {
            background: linear-gradient(45deg, #9b59b6, #8e44ad);
            color: white;
            padding: 15px 30px;
            border: none;
            border-radius: 25px;
            font-size: 1.2em;
            font-weight: bold;
            cursor: pointer;
            margin-top: 20px;
            transition: all 0.3s ease;
        }

        .restart-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(155, 89, 182, 0.4);
        }

        .emoji-large {
            font-size: 1.5em;
            margin: 0 5px;
        }
    </style>
</head>
<body>
    <div class="quiz-container">
        <div class="quiz-header">
            <h1 class="quiz-title">🏛️ Kenya Colonial Rule Quiz 🇰🇪</h1>
            Test Your Knowledge of Colonial History
            <div class="progress-bar">
                <div class="progress-fill" id="progressFill"></div>
            </div>
        </div>

        <!-- Question Cards -->
        <div class="question-card active" id="question1">
            <div class="question-number">1</div>
            <div class="question-text">
                🇪🇺 What major European event upset the balance of power and contributed to the scramble for East Africa?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    World War I
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    The Franco-Prussian War (1870-71)
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    The Napoleonic Wars
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    The Industrial Revolution
                </div>
            </div>
        </div>

        <div class="question-card" id="question2">
            <div class="question-number">2</div>
            <div class="question-text">
                🗺️ Why was East Africa strategically important to Europeans in relation to Egypt?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    It had gold mines
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    It controlled the source of River Nile and Suez Canal route
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    It had the best harbors
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    It was closest to Europe
                </div>
            </div>
        </div>

        <div class="question-card" id="question3">
            <div class="question-number">3</div>
            <div class="question-text">
                📜 Which treaty ended the scramble for and partition of East Africa?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    The Berlin Conference Treaty
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    The Anglo-German Agreement of 1886
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    The Heligoland Treaty of 1890
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    The Treaty of Versailles
                </div>
            </div>
        </div>

        <div class="question-card" id="question4">
            <div class="question-number">4</div>
            <div class="question-text">
                🤝 According to the Heligoland Treaty of 1890, what did Germany receive in exchange for abandoning claims over Witu?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    Zanzibar Island
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    Heligoland Island in the North Sea
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    Uganda Territory
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    Coastal strip of Kenya
                </div>
            </div>
        </div>

        <div class="question-card" id="question5">
            <div class="question-number">5</div>
            <div class="question-text">
                🏢 Who founded the Imperial British East Africa Company (IBEACO)?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    Karl Peters
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    Harry Johnstone
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    Sir William Mackinnon
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    Frederick Lugard
                </div>
            </div>
        </div>

        <div class="question-card" id="question6">
            <div class="question-number">6</div>
            <div class="question-text">
                📅 In what year was IBEACO given the royal charter?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    1886
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    1887
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    1888
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    1890
                </div>
            </div>
        </div>

        <div class="question-card" id="question7">
            <div class="question-number">7</div>
            <div class="question-text">
                🛣️ Which road did IBEACO construct to assist in transportation of railway building materials?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    The Great North Road
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    Sclater's Road between Kibwezi and Busia
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    The Mombasa-Nairobi Road
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    The Coastal Highway
                </div>
            </div>
        </div>

        <div class="question-card" id="question8">
            <div class="question-number">8</div>
            <div class="question-text">
                💰 For how much compensation did IBEACO surrender its charter to the British government in 1895?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>

*** Error message:
Missing $ inserted.

150,000
B
200,000                 </div>                 <div class="option" data-answer="c">                     <div class="option-letter">C</div>250,000
D
*** QuickLaTeX cannot compile formula:
300,000
                </div>
            </div>
        </div>

        <div class="question-card" id="question9">
            <div class="question-number">9</div>
            <div class="question-text">
                🤝 Which African communities collaborated with the British during colonization?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    Nandi and Kikuyu
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    Wanga and Maasai
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    Luo and Kamba
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    Turkana and Samburu
                </div>
            </div>
        </div>

        <div class="question-card" id="question10">
            <div class="question-number">10</div>
            <div class="question-text">
                📋 What were the Maasai Agreements signed between Oloibon Lenana and the British?
            </div>
            <div class="options">
                <div class="option" data-answer="a">
                    <div class="option-letter">A</div>
                    1903 and 1910
                </div>
                <div class="option" data-answer="b">
                    <div class="option-letter">B</div>
                    1904 and 1911
                </div>
                <div class="option" data-answer="c">
                    <div class="option-letter">C</div>
                    1905 and 1912
                </div>
                <div class="option" data-answer="d">
                    <div class="option-letter">D</div>
                    1906 and 1913
                </div>
            </div>
        </div>

        <!-- Navigation -->
        <div class="navigation">
            <button class="nav-btn prev-btn" id="prevBtn" onclick="previousQuestion()" disabled>
                ⬅️ Previous
            </button>
            <button class="nav-btn next-btn" id="nextBtn" onclick="nextQuestion()">
                Next ➡️
            </button>
        </div>

        <!-- Results Card -->
        <div class="results-card" id="resultsCard">
            <div class="score-circle" id="scoreCircle">
                <span id="scoreText">0/10</span>
            </div>
            <div class="performance-text" id="performanceText"></div>
            
            <div class="analysis">
                <h3>📊 Detailed Analysis</h3>
                <div class="topic-score">
                    <span>Scramble Causes (Q1-2)</span>
                    <div class="topic-bar">
                        <div class="topic-fill" id="topicFill1"></div>
                    </div>
                    <span id="topicScore1">0/2</span>
                </div>
                
                <div class="topic-score">
                    <span>Treaties & Partition (Q3-4)</span>
                    <div class="topic-bar">
                        <div class="topic-fill" id="topicFill2"></div>
                    </div>
                    <span id="topicScore2">0/2</span>
                </div>
                
                <div class="topic-score">
                    <span>IBEACO Company (Q5-8)</span>
                    <div class="topic-bar">
                        <div class="topic-fill" id="topicFill3"></div>
                    </div>
                    <span id="topicScore3">0/4</span>
                </div>
                
                <div class="topic-score">
                    <span>British Methods (Q9-10)</span>
                    <div class="topic-bar">
                        <div class="topic-fill" id="topicFill4"></div>
                    </div>
                    <span id="topicScore4">0/2</span>
                </div>
            </div>

            <div id="recommendations"></div>
            
            <button class="restart-btn" onclick="restartQuiz()">
                🔄 Take Quiz Again
            </button>
        </div>
    </div>

    <script>
        let currentQuestion = 1;
        let userAnswers = {};
        const totalQuestions = 10;
        
        // Correct answers
        const correctAnswers = {
            1: 'b', // Franco-Prussian War
            2: 'b', // River Nile and Suez Canal
            3: 'c', // Heligoland Treaty
            4: 'b', // Heligoland Island
            5: 'c', // Sir William Mackinnon
            6: 'c', // 1888
            7: 'b', // Sclater's Road
            8: 'c', //

*** Error message:
Missing $ inserted.

250,000 9: ‘b’, // Wanga and Maasai 10: ‘b’ // 1904 and 1911 };// Initialize quiz document.addEventListener(‘DOMContentLoaded’, function() { setupOptionListeners(); updateProgress(); });function setupOptionListeners() { const options = document.querySelectorAll(‘.option’); options.forEach(option => { option.addEventListener(‘click’, function() { const questionCard = this.closest(‘.question-card’); const questionId = parseInt(questionCard.id.replace(‘question’, ”)); // Remove previous selection questionCard.querySelectorAll(‘.option’).forEach(opt => { opt.classList.remove(‘selected’); }); // Add selection to clicked option this.classList.add(‘selected’); // Store answer userAnswers[questionId] = this.dataset.answer; }); }); }function nextQuestion() { if (currentQuestion < totalQuestions) { document.getElementById(`question{currentQuestion}`).classList.remove('active');                 currentQuestion++;                 document.getElementById(`question{currentQuestion}`).classList.add(‘active’); updateNavigation(); updateProgress(); } else { // Show results showResults(); } }function previousQuestion() { if (currentQuestion > 1) { document.getElementById(`question{currentQuestion}`).classList.remove('active');                 currentQuestion--;                 document.getElementById(`question{currentQuestion}`).classList.add(‘active’); updateNavigation(); updateProgress(); } }function updateNavigation() { const prevBtn = document.getElementById(‘prevBtn’); const nextBtn = document.getElementById(‘nextBtn’); prevBtn.disabled = currentQuestion === 1; if (currentQuestion === totalQuestions) { nextBtn.textContent = ‘🏁 Finish Quiz’; } else { nextBtn.textContent = ‘Next ➑️’; } }function updateProgress() { const progress = (currentQuestion / totalQuestions) * 100; document.getElementById(‘progressFill’).style.width = progress + ‘%’; }function showResults() { // Hide all question cards and navigation document.querySelectorAll(‘.question-card’).forEach(card => { card.classList.remove(‘active’); }); document.querySelector(‘.navigation’).style.display = ‘none’; // Calculate score let score = 0; let topicScores = [0, 0, 0, 0]; // [causes, treaties, ibeaco, methods] for (let i = 1; i <= totalQuestions; i++) { if (userAnswers[i] === correctAnswers[i]) { score++; // Update topic scores if (i <= 2) topicScores[0]++; // Scramble causes else if (i <= 4) topicScores[1]++; // Treaties else if (i <= 8) topicScores[2]++; // IBEACO else topicScores[3]++; // British methods } } // Display results displayResults(score, topicScores); document.getElementById('resultsCard').classList.add('active'); }function displayResults(score, topicScores) { const scoreText = document.getElementById('scoreText'); const scoreCircle = document.getElementById('scoreCircle'); const performanceText = document.getElementById('performanceText'); const recommendations = document.getElementById('recommendations'); scoreText.textContent = `
*** QuickLaTeX cannot compile formula:
{score}/10`;
            
            // Set performance level and styling
            let performance, emoji, recommendations_text;
            if (score >= 8) {
                performance = "Excellent! Outstanding Knowledge! 🌟";
                scoreCircle.className = 'score-circle score-excellent';
                emoji = "🎉";
                recommendations_text = "<div style='background: #d5f4e6; padding: 20px; border-radius: 10px; margin-top: 20px;'><h4>🎓 Excellent Performance!</h4>You have demonstrated exceptional understanding of Kenya's colonial history. You're ready for advanced topics in this area!</div>";
            } else if (score >= 6) {
                performance = "Good Work! Solid Understanding! 👍";
                scoreCircle.className = 'score-circle score-good';
                emoji = "😊";
                recommendations_text = "<div style='background: #fef9e7; padding: 20px; border-radius: 10px; margin-top: 20px;'><h4>👍 Good Performance!</h4>You have a solid grasp of the material. Review the areas where you scored lower to strengthen your knowledge further.</div>";
            } else {
                performance = "Keep Studying! Room for Improvement! 📚";
                scoreCircle.className = 'score-circle score-fair';
                emoji = "💪";
                recommendations_text = "<div style='background: #fadbd8; padding: 20px; border-radius: 10px; margin-top: 20px;'><h4>📚 Keep Learning!</h4>This is a good start! Focus on reviewing the colonial history material, especially the areas highlighted below. Practice makes perfect!</div>";
            }
            
            performanceText.innerHTML = `

*** Error message:
Missing $ inserted.

{emoji}
*** QuickLaTeX cannot compile formula:
{performance}`;
            recommendations.innerHTML = recommendations_text;
            
            // Update topic scores
            const topics = [
                { max: 2, name: "Scramble Causes" },
                { max: 2, name: "Treaties & Partition" },
                { max: 4, name: "IBEACO Company" },
                { max: 2, name: "British Methods" }
            ];
            
            topics.forEach((topic, index) => {
                const scoreSpan = document.getElementById(`topicScore

*** Error message:
Missing $ inserted.

{index + 1}`); const fillDiv = document.getElementById(`topicFill
*** QuickLaTeX cannot compile formula:
{index + 1}`);
                const percentage = (topicScores[index] / topic.max) * 100;
                
                scoreSpan.textContent = `

*** Error message:
Missing $ inserted.

{topicScores[index]}/${topic.max}`; fillDiv.style.width = percentage + ‘%’; }); }function restartQuiz() { currentQuestion = 1; userAnswers = {}; // Reset all selections document.querySelectorAll(‘.option’).forEach(option => { option.classList.remove(‘selected’); }); // Show first question document.querySelectorAll(‘.question-card’).forEach(card => { card.classList.remove(‘active’); }); document.getElementById(‘question1’).classList.add(‘active’); // Hide results and show navigation document.getElementById(‘resultsCard’).classList.remove(‘active’); document.querySelector(‘.navigation’).style.display = ‘flex’; // Reset navigation updateNavigation(); updateProgress(); }

Discover more from ELIMU ASSISTANT

Subscribe to get the latest posts sent to your email.

Elimu Assistant Team

By Elimu Assistant Team

Get in Touch! Need educational resources? Reach out! I'm here to help. Name: Mr. Atika Email: nyamotima@yahoo.com Phone: 0728450425 (Safaricom) | 0738619279 (Airtel)

Leave a Reply

Discover more from ELIMU ASSISTANT

Subscribe now to keep reading and get access to the full archive.

Continue reading