Skip to content

iTarek/Java-Quran-Web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“– Java Quran Web

A simple yet elegant Vanilla JavaScript Quran web application displaying the authentic Mushaf Madina layout with QCF4 fonts.

License: GPL v3 JavaScript PRs Welcome

🌐 Live Demo

Click here to view the Live Demo


πŸ“Έ Screenshots

Main Quran Page View

Quran Page - Surah Al-Baqarah Beautiful rendering of the Quran using QCF4 fonts with authentic Mushaf Madina layout

Navigation Modal

Navigation Modal - Surah List Easy navigation through Surahs and Juz with an elegant modal interface


✨ Overview

Java Quran Web is a lightweight, pure JavaScript web application that renders the Holy Quran in the traditional Mushaf Madina format. The project focuses on simplicity, performance, and authentic visual representation using the industry-standard QCF4 (Quran Complex Fonts v4) font system.

Key Features

  • πŸ“œ Authentic Mushaf Layout - Pixel-perfect replication of the printed Mushaf Madina (604 pages)
  • 🎨 QCF4 Font System - Professional-grade fonts from King Fahd Complex for Printing the Holy Quran
  • ⚑ Zero Dependencies - Pure vanilla JavaScript, HTML, and CSS
  • πŸ“± Responsive Design - Dynamic scaling using CSS Container Queries for all screen sizes
  • 🧭 Easy Navigation - Browse by Surah, Juz, page number, or keyboard shortcuts
  • 🎯 Verse Highlighting - Interactive verse-level highlighting on hover
  • πŸ“– Tafseer & Translation - Instant access to Arabic Tafseer (Al-Muyassar) and English Translation (Saheeh Intl)
  • 🎧 Audio Playback - Listen to verse recitation (Mishary Alafasy) directly from the Tafseer view
  • 🟑 External API - Public JavaScript API to navigate and highlight any ayah programmatically
  • πŸ”— URL Navigation - Direct linking to any page or specific ayah via URL parameters
  • πŸ”„ RTL Support - Full right-to-left layout for Arabic text
  • πŸš€ Fast Loading - Dynamic font loading and efficient rendering

πŸ› οΈ Technology Stack

This project is built with pure web technologies, no frameworks required:

  • HTML5 - Semantic markup and modern web standards
  • CSS3 - Custom styling with CSS Grid and Flexbox
  • Vanilla JavaScript (ES6+) - No frameworks, just clean modern JS
  • QCF4 Fonts - Official Quran fonts in WOFF2 format

Why Vanilla JavaScript?

We chose vanilla JavaScript to:

  • βœ… Keep the project lightweight and fast
  • βœ… Avoid framework bloat and dependencies
  • βœ… Make the codebase accessible to all developers
  • βœ… Ensure long-term compatibility and maintainability
  • βœ… Focus on web fundamentals

πŸ“ Project Structure

Java-Quran-Web/
β”œβ”€β”€ index.html              # Main HTML entry point
β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ app.css            # Main application styles
β”‚   └── qcf4-fonts.css     # QCF4 font declarations
β”œβ”€β”€ js/
β”‚   β”œβ”€β”€ app.js             # Main application controller
β”‚   β”œβ”€β”€ data-loader.js     # Data fetching and parsing
β”‚   β”œβ”€β”€ navigation.js      # Navigation logic (optional)
β”‚   └── renderer.js        # Page rendering engine
β”œβ”€β”€ assets/
β”‚   └── fonts/
β”‚       β”œβ”€β”€ qcf4/          # QCF4 font files (WOFF2)
β”‚       └── kitab/         # Kitab font files (WOFF2)
└── data/
    β”œβ”€β”€ suwar.json         # Surah metadata
    β”œβ”€β”€ page_mapping.json  # Page-to-verse mappings
    β”œβ”€β”€ mushaf_metadata.json # Layout metadata
    └── quran_layout.csv   # Glyph positioning data

πŸš€ Getting Started

Prerequisites

  • A modern web browser (Chrome, Firefox, Safari, Edge)
  • A local web server (for development)

Installation

  1. Clone the repository

    git clone https://github.com/iTarek/Java-Quran-Web.git
    cd Java-Quran-Web
  2. Start a local server

    # Using Python 3
    python -m http.server 8000
    
    # Using Node.js
    npx http-server
    
    # Using PHP
    php -S localhost:8000
  3. Open in browser

    Navigate to http://localhost:8000 in your browser.


🎯 Usage

Basic Navigation

  • Arrow Buttons - Click the left/right arrows to navigate between pages
  • Header/Footer Click - Click on the page header or footer to open the navigation modal
  • Surah Navigation - Browse and jump to any Surah from the navigation menu
  • Juz Navigation - Access any of the 30 Juz sections

URL Navigation

You can navigate directly to any page using URL hashes:

http://localhost:8000/#page/1    # Al-Fatiha (Page 1)
http://localhost:8000/#page/293  # Al-Kahf (Page 293)

Direct Ayah Navigation (URL Parameters)

Navigate directly to any specific ayah with automatic page detection and highlighting:

http://localhost:8000/?surah=2&ayah=255   # Ayat Al-Kursi
http://localhost:8000/?s=36&a=1           # Surah Ya-Sin, Ayah 1

The ayah will be highlighted in yellow to distinguish it from hover highlights.

Verse Interaction

  • Hover - Hover over any verse to see gray highlighting
  • Click - Click any verse to open the Tafseer & Audio modal
  • Persistent Highlight - Yellow highlighting for API/URL navigation

Keyboard Shortcuts

  • Right Arrow - Go to previous page
  • Left Arrow - Go to next page
  • Space - Open navigation menu (Surah/Juz list)
  • Escape - Close any open modal (Tafseer or Navigation)

Tafseer & Audio

Clicking on any ayah opens a modal with:

  1. Arabic Tafseer: Al-Tafseer Al-Muyassar (Ψ§Ω„Ψͺفسير Ψ§Ω„Ω…ΩŠΨ³Ψ±)
  2. English Translation: Saheeh International
  3. Audio Player: Listen to the verse recitation by Mishary Rashid Alafasy
    • Click β–Ά to play (icon turns green w/ red stop square)
    • Click β–  to stop
    • Audio automatically stops when closing the modal

πŸ”Œ Public API

Java Quran Web exposes a public JavaScript API for integration with other applications:

Navigate to Any Ayah

// Navigate to Surah Al-Baqarah (2), Ayah 255 (Ayat Al-Kursi)
await quranApp.goToAyah(2, 255);

// Navigate with options
await quranApp.goToAyah(2, 255, {
  persistent: true,  // Keep highlight until cleared (default: true)
  scroll: true       // Scroll ayah into view (default: true)
});

Clear Persistent Highlight

// Remove the yellow persistent highlight
quranApp.clearPersistentHighlight();

Additional Methods

// Highlight ayah on current page (gray, temporary)
quranApp.highlightAyah(surah, ayah);

// Remove all hover highlights
quranApp.removeAllHighlights();

// Get current page number
quranApp.currentPage;  // e.g., 42

// Check if app is ready
quranApp.isReady;  // true/false

Embedding in Other Applications

<iframe src="https://yourdomain.com/quran/?surah=2&ayah=255" width="100%" height="600"></iframe>

Or programmatically after loading:

// Wait for app to initialize, then navigate
window.addEventListener('load', async () => {
  await quranApp.goToAyah(2, 255);
});

πŸ—οΈ Architecture

Core Components

1. QuranApp (app.js)

The main application controller that:

  • Initializes the data loader and renderer
  • Manages application state
  • Handles navigation between pages
  • Controls the overlay modal for navigation

2. QuranDataLoader (data-loader.js)

Responsible for:

  • Loading all Quran data files
  • Parsing CSV layout data
  • Providing data access methods
  • Caching loaded data

3. PageRenderer (renderer.js)

Handles:

  • Dynamic font loading
  • Page layout rendering
  • Glyph-by-glyph positioning
  • Header and footer generation
  • Verse grouping and highlighting

Data Flow

User Action β†’ QuranApp β†’ DataLoader β†’ Renderer β†’ DOM Update
  1. User navigates to a page
  2. QuranApp requests page data from DataLoader
  3. Renderer fetches layout data for that page
  4. Fonts are dynamically loaded if needed
  5. Page is rendered line-by-line with proper formatting

🎨 Styling

The application uses a carefully crafted color scheme inspired by traditional Quran manuscripts:

--primary-color: #2c5530;   /* Dark green */
--secondary-color: #d4af37;  /* Gold */
--bg-color: #faf8f3;         /* Off-white */
--text-color: #1a1a1a;       /* Near black */
--border-color: #e0d4b8;     /* Beige */

Responsive Design

The application adapts to different screen sizes:

  • Desktop: Full Mushaf page view
  • Tablet: Optimized layout with touch controls
  • Mobile: Single-column view with adjusted font sizes

πŸ“Š Technical Details

QCF4 Font System

The QCF4 fonts are vector-based fonts that encode:

  • Arabic Quranic text glyphs
  • Tajweed rules
  • Pause marks (waqf signs)
  • Verse endings (ayah markers)
  • Chapter decorations (surah names)

Each glyph is mapped to a Unicode character in the Private Use Area (0xF100+).

Mushaf Layout

The application renders all 604 pages of the Mushaf Madina:

  • 15 lines per page - Exact match to printed Mushaf
  • Dynamic line centering - Specific lines are centered per page
  • Page headers - Display Surah name and Juz number
  • Page footers - Show Arabic page numbers
  • Basmalah placement - Special handling for "Ψ¨Ψ³Ω… Ψ§Ω„Ω„Ω‡ Ψ§Ω„Ψ±Ψ­Ω…Ω† Ψ§Ω„Ψ±Ψ­ΩŠΩ…"


🀝 Contributing

We need your help to make this better!

This is a simple, clean implementation, but there's always room for improvement. Here's how you can contribute:

Ways to Contribute

  1. πŸ› Report Bugs - Found an issue? Open an issue
  2. πŸ’‘ Suggest Features - Have an idea? We'd love to hear it!
  3. πŸ“ Improve Documentation - Help make the docs clearer
  4. 🎨 Enhance Design - Improve the UI/UX
  5. ⚑ Optimize Performance - Make it faster
  6. πŸ§ͺ Add Tests - Help us build a test suite
  7. 🌍 Add Translations - Translate the interface to other languages

Feature Ideas

Please see the Roadmap (Version 2.0) for prioritized features such as Search, Bookmarking, Dark Mode, and Offline Support. We welcome community contributions for the following enhancements:

  • Touch Gestures - Swipe navigation for mobile
  • Print Optimization - Better print layouts
  • Accessibility - Screen reader support and ARIA labels

Development Workflow

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Test thoroughly
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to your branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Code Style

  • Use clear, descriptive variable names
  • Add comments for complex logic
  • Follow existing code patterns
  • Keep functions small and focused
  • Test on multiple browsers

πŸ“œ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Font Licensing

The QCF4 fonts are proprietary to the King Fahd Complex for the Printing of the Holy Quran. Please ensure you have the proper licensing to use these fonts in your project.


πŸ™ Acknowledgments

  • King Fahd Complex - For the QCF4 font system
  • All Contributors - For making this project better

πŸ’» Browser Support

Browser Version Status
Chrome 90+ βœ… Fully Supported
Firefox 88+ βœ… Fully Supported
Safari 14+ βœ… Fully Supported
Edge 90+ βœ… Fully Supported
Opera 76+ βœ… Fully Supported

πŸ“ˆ Roadmap

Version 1.0 (Foundation)

  • Basic Mushaf rendering using QCF4 fonts
  • Page navigation & Surah/Juz indexing
  • Responsive layout with Container Queries
  • Hover highlighting for verses

Version 1.1 (Interactive)

  • Public JavaScript API (goToAyah)
  • URL parameter navigation (?surah=2&ayah=255)
  • Persistent highlighting (Yellow) vs Hover (Gray)
  • Tafseer Modal (Arabic Al-Muyassar & English Saheeh)
  • Audio Recitation (Verse-by-verse playback)
  • Keyboard Navigation (Arrows & Space for Menu)
  • Footer Navigation Controls

Version 2.0 (Planned)

  • Full Search functionality (Arabic & English)
  • Bookmarking & Favorites system
  • PWA (Progressive Web App) offline support
  • Dark Mode / Themes
  • Multiple Reciter options

⭐ Show Your Support

If you find this project useful, please consider:

  • ⭐ Starring the repository
  • πŸ› Reporting bugs
  • πŸ’¬ Sharing feedback
  • 🀝 Contributing code
  • πŸ“’ Spreading the word

Made with ❀️ for the Muslim Ummah

Jazakum Allahu Khairan - May Allah reward you with goodness

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors