cdn.duyet.net

CI/CD Pipeline License: MIT Version

Modern, high-performance CDN hosting JavaScript libraries, utilities, and CSS for blog projects.

✨ Features

📚 Available Libraries

Utilities (v2)

Smooth Scroll

Provides buttery-smooth scrolling behavior with pulse algorithm.

<script src="https://cdn.duyet.net/v2/js/smooth-scroll.min.js"></script>

Features:

Configuration:

// Optional: Configure before script loads
window.smoothScrollOptions = {
  frameRate: 300,
  animationTime: 1000,
  stepSize: 85,
  pulseAlgorithm: true,
  keyboardSupport: true,
  respectReducedMotion: true
};

// Or configure after loading
SmoothScroll.configure({
  animationTime: 800
});

Lazy Load

Modern image lazy loading with IntersectionObserver.

<script src="https://cdn.duyet.net/v2/js/lazyload.min.js"></script>

<!-- In your HTML -->
<img class="lazy"
     data-src="image.jpg"
     data-srcset="image-400w.jpg 400w, image-800w.jpg 800w"
     alt="Description">

Features:

API:

// Refresh for dynamically added images
LazyLoad.refresh();

// Load all images immediately
LazyLoad.loadAll();

// Configure
LazyLoad.configure({
  selector: 'img.lazy',
  rootMargin: '50px',
  threshold: 0.01
});

Recent Posts Widget

Displays Blogger/Blogspot recent posts without document.write().

<div id="recent-posts-widget"></div>
<script src="https://cdn.duyet.net/v2/js/recent-posts.min.js"></script>
<script src="YOUR_BLOG_URL/feeds/posts/default?alt=json-in-script&callback=showRecentPosts"></script>

Configuration:

window.recentPostsConfig = {
  numposts: 5,
  showpostdate: true,
  showpostsummary: true,
  numchars: 100,
  containerId: 'recent-posts-widget'
};

Legacy Libraries (v1)

React DnD 2.1.4

<script src="https://cdn.duyet.net/react-dnd/dist/ReactDnD.min.js"></script>

React Tags 3.0.1

<script src="https://cdn.duyet.net/react-tags/dist/ReactTags.min.js"></script>

Draft.js

<script src="https://cdn.duyet.net/Draft/Draft.js"></script>

Google Code Prettify

<script src="https://cdn.duyet.net/code-prettify/loader/run_prettify.js"></script>
<link rel="stylesheet" href="https://cdn.duyet.net/prettify_skin.css">

🚀 Quick Start

Using via CDN

Simply include the scripts in your HTML:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Blog</title>
</head>
<body>
  <!-- Your content -->
  <img class="lazy" data-src="image.jpg" alt="Lazy loaded">

  <!-- Include CDN scripts -->
  <script src="https://cdn.duyet.net/v2/js/smooth-scroll.min.js"></script>
  <script src="https://cdn.duyet.net/v2/js/lazyload.min.js"></script>
</body>
</html>

Self-Hosting

  1. Clone the repository:
    git clone https://github.com/duyet/cdn.duyet.net.git
    cd cdn.duyet.net
    
  2. Install dependencies:
    npm install
    
  3. Build for production:
    npm run build
    
  4. Serve the dist/ directory with your web server.

🛠️ Development

Prerequisites

Setup

# Install dependencies
npm install

# Start development server
npm run dev

# Run tests
npm test

# Run tests with UI
npm run test:ui

# Run linting
npm run lint

# Format code
npm run format

# Build for production
npm run build

# Preview production build
npm run preview

Project Structure

cdn.duyet.net/
├── src/                    # Modern source files
│   ├── smooth-scroll.js    # Smooth scrolling library
│   ├── lazyload.js        # Image lazy loading
│   └── recent-posts.js    # Blog widget
├── v1/                    # Version 1 API (stable)
│   ├── js/
│   └── css/
├── v2/                    # Version 2 API (current)
│   ├── js/
│   └── css/
├── code-prettify/         # Google Code Prettify
├── Draft/                 # Draft.js editor
├── react-dnd/            # React DnD library
├── react-tags/           # React Tags input
├── .github/              # GitHub Actions workflows
├── vite.config.js        # Vite configuration
├── package.json          # Dependencies & scripts
├── _headers              # Cache & security headers
└── README.md             # This file

📊 Performance

🔒 Security

🤝 Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details.

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

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Credits

📮 Contact

📈 Changelog

See CHANGELOG.md for version history and updates.


Made with ❤️ by Duyet