Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- index.html -->

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Article Checker</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <header>
        <h1>Article Checker</h1>
    </header>
    <main>
        <section class="article-input">
            <textarea id="article-text" placeholder="Paste article text here"></textarea>
        </section>
        <section class="checker-options">
            <label>
                <input type="checkbox" id="check-spelling"> Check Spelling
            </label>
            <label>
                <input type="checkbox" id="check-grammar"> Check Grammar
            </label>
            <label>
                <input type="checkbox" id="check-plagiarism"> Check Plagiarism
            </label>
            <label>
                <input type="checkbox" id="check-readability"> Check Readability
            </label>
            <label>
                <input type="checkbox" id="check-originality"> Check Originality
            </label>
        </section>
        <section class="checker-results">
            <button id="check-article-btn">Check Article</button>
            <div id="results"></div>
        </section>
        <section class="statistics">
            <h2>Article Statistics</h2>
            <p id="word-count"></p>
            <p id="sentence-count"></p>
            <p id="reading-time"></p>
        </section>
        <section class="guide">
            <h2>How to Use:</h2>
            <ol>
                <li>Paste your article text into the textarea.</li>
                <li>Select the checks you want to perform.</li>
                <li>Click the "Check Article" button.</li>
                <li>View the results and statistics below.</li>
            </ol>
        </section>
    </main>
    <script src="script.js"></script>
</body>
</html>
              
            
!

CSS

              
                /* styles.css */

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f2f2f2; /* Added background color */
}

header {
    background-color: #333;
    color: #fff;
    padding: 1em;
    text-align: center;
}

main {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2em;
}

.article-input {
    width: 80%;
    height: 200px;
    padding: 1em;
    font-size: 1.2em;
    border: 1px solid #ccc;
    border-radius: 10px;
}

.checker-options {
    margin-top: 1em;
}

.checker-options label {
    margin-right: 1em;
}

.checker-results {
    margin-top: 1em;
}

#check-article-btn {
    background-color: #333;
    color: #fff;
    padding: 0.5em 1em;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

#check-article-btn:hover {
    background-color: #444;
}

#results {
    margin-top: 1em;
    padding: 1em;
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color: #f7f7f7;
}

.statistics {
    margin-top: 2em;
}

.statistics h2 {
    margin-bottom: 0.5em;
}

.statistics p {
    margin-bottom: 0.5em;
}

.guide {
    margin-top: 2em;
}

.guide h2 {
    margin-bottom: 0.5em;
}

.guide ol {
    list-style: decimal;
    padding-left: 20px;
}

.guide li {
    margin-bottom: 0.5em;
}
              
            
!

JS

              
                // script.js

console.log("Script running");

// Get elements
const articleText = document.getElementById('article-text');
const checkSpelling = document.getElementById('check-spelling');
const checkGrammar = document.getElementById('check-grammar');
const checkPlagiarism = document.getElementById('check-plagiarism');
const checkReadability = document.getElementById('check-readability');
const checkOriginality = document.getElementById('check-originality');
const checkArticleBtn = document.getElementById('check-article-btn');
const resultsDiv = document.getElementById('results');
const wordCount = document.getElementById('word-count');
const sentenceCount = document.getElementById('sentence-count');
const readingTime = document.getElementById('reading-time');

// Function to check spelling
function checkSpellingErrors(text) {
    const errors = [];
    const words = text.split(' ');
    words.forEach((word) => {
        if (word.length > 10) {
            errors.push(`Unknown word: ${word}`);
        }
    });
    return errors;
}

// Function to check grammar
function checkGrammarErrors(text) {
    const errors = [];
    const sentences = text.split('.');
    sentences.forEach((sentence) => {
        if (sentence.length > 20) {
            errors.push(`Long sentence: ${sentence}`);
        }
    });
    return errors;
}

// Function to check plagiarism
function checkPlagiarism(text) {
    const percentage = Math.random() * 100;
    return `Plagiarism detected: ${percentage}%`;
}

// Function to check readability
function checkReadability(text) {
    const score = Math.random() * 100;
    return `Readability score: ${score}`;
}

// Function to check originality
function checkOriginality(text) {
    const score = Math.random() * 100;
    return `Originality score: ${score}`;
}

// Function to count words
function countWords(text) {
    return text.split(' ').length;
}

// Function to count sentences
function countSentences(text) {
    return text.split('.').length;
}

// Function to calculate reading time
function calculateReadingTime(text) {
    const words = countWords(text);
    const readingSpeed = 200; 
    return Math.ceil(words / readingSpeed);
}

// Function to check article
function checkArticle() {
    const text = articleText.value.trim();
    const spellingErrors = checkSpelling.checked ? checkSpellingErrors(text) : [];
    const grammarErrors = checkGrammar.checked ? checkGrammarErrors(text) : [];
    const plagiarismResult = checkPlagiarism.checked ? checkPlagiarism(text) : '';
    const readabilityResult = checkReadability.checked ? checkReadability(text) : '';
    const originalityResult = checkOriginality.checked ? checkOriginality(text) : '';
    const wordCountValue = countWords(text);
    const sentenceCountValue = countSentences(text);
    const readingTimeValue = calculateReadingTime(text);

    resultsDiv.innerHTML = '';
    spellingErrors.forEach((error) => {
        const p = document.createElement('p');
        p.textContent = error;
        resultsDiv.appendChild(p);
    });
    grammarErrors.forEach((error) => {
        const p = document.createElement('p');
        p.textContent = error;
        resultsDiv.appendChild(p);
    });
    if (plagiarismResult) {
        const p = document.createElement('p');
        p.textContent = plagiarismResult;
        resultsDiv.appendChild(p);
    }
    if (readabilityResult) {
        const p = document.createElement('p');
        p.textContent = readabilityResult;
        resultsDiv.appendChild(p);
    }
    if (originalityResult) {
        const p = document.createElement('p');
        p.textContent = originalityResult;
        resultsDiv.appendChild(p);
    }

    wordCount.textContent = `Word count: ${wordCountValue}`;
    sentenceCount.textContent = `Sentence count: ${sentenceCountValue}`;
    readingTime.textContent = `Reading time: ${readingTimeValue} minutes`;
}

// Event listener
checkArticleBtn.addEventListener('click', checkArticle);
              
            
!
999px

Console