OneCompiler

Cricket hastag

190
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Cricket Hashtags</title> <style> body { font-family: Arial, sans-serif; margin: 0; padding: 0; background-color: #f8f9fa; display: flex; flex-direction: column; align-items: center; } .container { max-width: 800px; margin: 20px; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .title { text-align: center; color: #343a40; } .copy-button, .copy-all-button { display: block; margin: 20px auto; padding: 10px 20px; font-size: 16px; background-color: #007bff; color: #fff; border: none; border-radius: 5px; cursor: pointer; } .copy-message { display: none; margin-top: 10px; padding: 10px; background-color: #28a745; color: #fff; border-radius: 5px; text-align: center; } </style> </head> <body> <div class="container"> <h1 class="title">Cricket Hashtags</h1> <button class="copy-button" onclick="copyHashtags()">Copy 10 Random Hashtags</button> <button class="copy-all-button" onclick="copyAllHashtags()">Copy All Hashtags</button> <div class="copy-message" id="copyMessage">Hashtags copied!</div> </div> <script> const hashtags = [ "#cricketlove", "#cricketfever", "#cricketworldcup", "#cricketfans", "#cricketlife", "#cricketlover", "#cricketlovers", "#cricketer", "#cricketmatch", "#cricketmemes", "#testcricket", "#cricketforlife", "#cricketindia", "#indiacricket", "#lovecricket", "#cricketmerijaan", "#indiancricketteam", "#indiancricket", "#ipl", "#t20worldcup", "#ipl2024", "#csk", "#mumbaiindians", "#viratkohli", "#msdhoni", "#rohitsharma", "#dhoni", "#kingkohli", "#babarazam", "#stevesmith", "#abdevilliers", "#benstokes", "#kanewilliamson", "#cricket", "#cricketers", "#worldcup", "#crickets", "#ashes", "#cricketphotography", "#cricketmania", "#cricketseason", "#cricketfamily", "#cricketaddict", "#cricketgram", "#cricketworld", "#crickettainment", "#cricketclub", "#cricketcoach", "#cricketnation", "#cricketshot", "#cricketgear", "#cricketacademy", "#cricketfield", "#crickettraining", "#cricketground", "#cricketloverz", "#cricketblogger", "#crickettalk", "#cricketplayers", "#cricketfansforever", "#cricketbats", "#cricketvideos", "#cricketbuzz", "#cricketenthusiast", "#cricketfamilylove", "#cricketupdate", "#crickettimes", "#cricketbroadcast", "#cricketinfo", "#cricketedits", "#cricketart", "#cricketlive", "#cricketfansofinstagram", "#cricketreels", "#cricketmemesdaily", "#cricketblog", "#cricketlife❤️" ];
    function copyHashtags() {
        const requiredHashtag = "#viratkohli";
        let remainingHashtags = hashtags.filter(tag => tag !== requiredHashtag);

        const randomHashtags = [requiredHashtag];
        while (randomHashtags.length < 10) {
            const randomIndex = Math.floor(Math.random() * remainingHashtags.length);
            const selectedHashtag = remainingHashtags.splice(randomIndex, 1)[0];
            if (!randomHashtags.includes(selectedHashtag)) {
                randomHashtags.push(selectedHashtag);
            }
        }

        copyToClipboard(randomHashtags.join(' '));
    }

    function copyAllHashtags() {
        copyToClipboard(hashtags.join(' '));
    }

    function copyToClipboard(text) {
        const tempInput = document.createElement('textarea');
        tempInput.value = text;
        document.body.appendChild(tempInput);
        tempInput.select();
        document.execCommand('copy');
        document.body.removeChild(tempInput);

        // Show copy message
        const copyMessage = document.getElementById('copyMessage');
        copyMessage.style.display = 'block';

        // Hide message after 2 seconds
        setTimeout(() => {
            copyMessage.style.display = 'none';
        }, 2000);
    }
</script>
</body> </html>