Spaces:
Running
Running
Create a user-friendly HTML animation on this topic, in French [Voici un **cours clair et pédagogique en français** sur le **concept de *statement* en COBOL**, avec la **traduction du terme**, des **explications progressives**, et des **exemples commentés**, parfaitement adapté aux **débutants**.
8198c28 verified Download script.js from Robertuk/cobol-command-carnival: direct link, hf CLI and curl.
- Browser
- Download file 2.63 kB
-
https://huggingface.co/spaces/Robertuk/cobol-command-carnival/resolve/main/script.js
- Command line
-
hf download hf://spaces/Robertuk/cobol-command-carnival/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Robertuk/cobol-command-carnival/resolve/main/script.js
2.63 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Add copy buttons to all code blocks | |
| document.querySelectorAll('pre').forEach((pre) => { | |
| const button = document.createElement('button'); | |
| button.className = 'copy-btn'; | |
| button.innerHTML = '<i data-feather="copy"></i>'; | |
| button.addEventListener('click', () => { | |
| const code = pre.querySelector('code').innerText; | |
| navigator.clipboard.writeText(code).then(() => { | |
| button.innerHTML = '<i data-feather="check"></i>'; | |
| setTimeout(() => { | |
| button.innerHTML = '<i data-feather="copy"></i>'; | |
| feather.replace(); | |
| }, 2000); | |
| }); | |
| }); | |
| pre.style.position = 'relative'; | |
| pre.appendChild(button); | |
| }); | |
| // Create the animated hierarchy visualization | |
| const hierarchyContainer = document.getElementById('hierarchy-animation'); | |
| const hierarchyData = [ | |
| { name: "Programme COBOL", color: "bg-primary-500" }, | |
| { name: "Division", color: "bg-primary-400" }, | |
| { name: "Section", color: "bg-primary-300" }, | |
| { name: "Paragraphe", color: "bg-secondary-500" }, | |
| { name: "Phrase", color: "bg-secondary-400" }, | |
| { name: "Instruction", color: "bg-secondary-300" }, | |
| { name: "Chaîne de caractères", color: "bg-gray-300" } | |
| ]; | |
| // Build the hierarchy visualization | |
| let delay = 0; | |
| hierarchyData.forEach((item, index) => { | |
| setTimeout(() => { | |
| const element = document.createElement('div'); | |
| element.className = `hierarchy-item ${item.color} text-white animate-fade-in`; | |
| element.style.animationDelay = `${delay}s`; | |
| // Add indentation | |
| element.style.marginLeft = `${index * 1}rem`; | |
| // Add arrow for parent items | |
| if (index < hierarchyData.length - 1) { | |
| element.innerHTML = `${item.name} <i data-feather="chevron-down" class="inline ml-2"></i>`; | |
| } else { | |
| element.textContent = item.name; | |
| } | |
| hierarchyContainer.appendChild(element); | |
| feather.replace(); | |
| }, delay * 300); | |
| delay += 0.3; | |
| }); | |
| // Add interactive code examples | |
| const codeExamples = document.querySelectorAll('pre code'); | |
| codeExamples.forEach((example) => { | |
| example.addEventListener('click', function() { | |
| this.classList.toggle('bg-gray-900'); | |
| this.classList.toggle('bg-gray-800'); | |
| }); | |
| }); | |
| }); |