AI promts and usage

I am adding the promts or how I have used AI during Fab Academy.

ChatGPT Gemini Claude

Reflection box- class ChatGPT

promt-1 : font-family: 'Courier New', monospace; can you add this font to
<p> At the beginning of this week, I found myself trying to understand the concepts being taught and the expectations of the assignment. After two days of exploration and valuable guidance from our instructor, I was able to gain clarity and develop the work presented below. </p>

promt-2 : add this inside a box to make it like a note

.reflection-box {
border-left: 5px solid #2A1458;
background-color: hsla(28, 100%, 92%, 0.5);
padding: 15px 20px;
margin: 20px 0;
font-family: 'Courier New', monospace;
border-radius: 6px;
}

the above is the reflection-box class created.


Slideshow Gallery

Claude

I am inspired by this page: JS Slideshow Gallery W3schools.com

Promt + code 1: : Hi there, i wanted to add slideshow gallery into my html page, i am new to javascript. i would like to follow a smilar style of slide show so i can have uliplt galleris in 1 page. can you create a template for it so i can cop thata edit it and use it. also teach me what to add, what to keep in mind and change . creatw teh html, javascript and css styles seprates.


<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
  font-family: Arial;
  margin: 0;
}

* {
  box-sizing: border-box;
}

img {
  vertical-align: middle;
}

/* Position the image container */
.container {
  position: relative;
}

/* Hide the images by default */
.mySlides {
  display: none;
}
</style>

<body>

<h2 style="text-align:center">Slideshow Gallery</h2>

<div class="container">
  <div class="mySlides">
    <div class="numbertext">1 / 6</div>
    <img src="img_woods_wide.jpg" style="width:100%">
  </div>

  <a class="prev" onclick="plusSlides(-1)">❮</a>
  <a class="next" onclick="plusSlides(1)">❯</a>
</div>

<script>
let slideIndex = 1;
showSlides(slideIndex);

function plusSlides(n) {
  showSlides(slideIndex += n);
}
</script>

</body>
</html>

Promt + the styles I was using : theese are the styles I have till now, also i wan the images to have teh styel of img-box.

Code received

Download Slideshow_Gallery.html file
Download Slideshow_Gallery.css file
Download Slideshow_gallery.js file

After saving these in the folder, I linked the JavaScript file to each html page that uses the javascript. Add it within but at the end of the head tag. I have saved my js file as "galley.js" fro the attached files it is "Slideshow_gallery.js". Add the contents inside slideshow_gallery.css to your styles file or link it to your html

 
  <link rel="stylesheet" href="../ai-use/slideshow_gallery.css"/> 
<script src="../ai-use/Slideshow_gallery.js" defer> </script >

USE

I usually type the image path and the explaination along with it, in VScode. Then I paste it along with the "slideshow_gallery.html" Gallery and apply the promt

Promt : Convert the above images and caption to match the skeleton of the below gallery.(the slideshow_gallery.html)


Video under 1mb

Claude

can you change the file such that it can compress the videos to under 1mb

I also uploaded the preset file shared to us to compress the final project video under 25 mb.

The preset file to compress videos to under 1mb, use this in handbrake software.

1mb Preset
25mb Preset

Created this box style using Claude

Prompt + css file

Cat scroll-bar

I thought it would be whimsical to have a simple cat as a scroll bar. I found the typical scrollbar a bit boring. Since AI is here I thought why not.

1st promt : I need a scroll bar for a webpage, a small catbody with the tail as the scroll length and the scroll bar as cat bosy minimal black cat. so when the scroll bar moves down it looks like a cat body moving up and down html code. the cats body is vertical and vertical tail. this should repalce the current scroll bar. 2nd prompt : when i added this code the vscode html file the cat took lot of the scape. i need the rewritten code as java script so i can add to an exisiting file
/* cat-scrollbar.js
   self-contained: injects its own css + html, no other setup needed.
   usage: <script src="cat-scrollbar.js" defer></script> before </body> */
(function () {
  if (window.__catScrollbar) return;
  window.__catScrollbar = true;

  function init() {
    // ---------- css ----------
    var css = `
      html { scrollbar-width: none; -ms-overflow-style: none; }
      html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; height: 0; }

      #cat-scroll {
        --cat: #111;
        --cat-eye: #f2f2f2;
        position: fixed; top: 0; right: 4px; bottom: 0;
        width: 36px; max-width: 36px;
        z-index: 2147483000;
        touch-action: none; user-select: none; -webkit-user-select: none;
        margin: 0; padding: 0;
      }
      #cat-scroll[hidden] { display: none; }
      @media (prefers-color-scheme: dark) {
        #cat-scroll { --cat: #0b0b0b; --cat-eye: #e8e8e8; }
      }
      #cat-scroll #cat-tail {
        position: absolute; top: 0; left: 0;
        width: 36px; height: 100%;
        overflow: visible; cursor: pointer; display: block;
      }
      #cat-scroll #cat-tail path {
        fill: none; stroke: var(--cat); stroke-width: 3; stroke-linecap: round;
      }
      #cat-scroll #cat-body {
        position: absolute; left: 0; top: 0;
        width: 36px; height: 64px;
        cursor: grab; will-change: transform;
      }
      #cat-scroll #cat-body:active { cursor: grabbing; }
      #cat-scroll #cat-body svg {
        display: block; width: 36px; height: 64px; max-width: none;
      }
      #cat-scroll .fur { fill: var(--cat); }
      #cat-scroll .eye { fill: var(--cat-eye); }
      #cat-scroll #cat-body:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 8px; }
    `;
    var style = document.createElement('style');
    style.id = 'cat-scroll-style';
    style.textContent = css;
    document.head.appendChild(style);

    // ---------- html ----------
    var wrap = document.createElement('div');
    wrap.id = 'cat-scroll';
    wrap.hidden = true;
    wrap.innerHTML =
      '<svg id="cat-tail" width="36" aria-hidden="true"><path id="cat-tail-path" d=""/></svg>' +
      '<div id="cat-body" role="scrollbar" aria-orientation="vertical" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" tabindex="0" aria-label="page scroll">' +
        '<svg viewBox="0 0 36 64" width="36" height="64" aria-hidden="true">' +
          '<ellipse class="fur" cx="18" cy="42" rx="10" ry="18"/>' +
          '<polygon class="fur" points="7,15 8,1 18,10"/>' +
          '<polygon class="fur" points="29,15 28,1 18,10"/>' +
          '<ellipse class="fur" cx="18" cy="17" rx="11" ry="9.5"/>' +
          '<ellipse class="fur" cx="12" cy="60" rx="4.5" ry="3"/>' +
          '<ellipse class="fur" cx="24" cy="60" rx="4.5" ry="3"/>' +
          '<ellipse class="eye" cx="13.5" cy="17" rx="1.4" ry="2"/>' +
          '<ellipse class="eye" cx="22.5" cy="17" rx="1.4" ry="2"/>' +
        '</svg>' +
      '</div>';
    document.body.appendChild(wrap);

    var tail = wrap.querySelector('#cat-tail-path');
    var cat = wrap.querySelector('#cat-body');

    // ---------- logic ----------
    var PAD = 4, trackH = 0, catH = 64, dragging = false, grabOffset = 0;

    function maxScroll() { return document.documentElement.scrollHeight - window.innerHeight; }
    function maxCatY() { return trackH - catH - PAD * 2; }

    function drawTail() {
      var x = 18, top = PAD + catH * 0.7, bottom = trackH - PAD, seg = 44, amp = 8;
      var d = 'M' + x + ' ' + top, y = top, first = true;
      while (y + seg <= bottom) {
        d += first
          ? ' Q' + (x + amp) + ' ' + (y + seg / 2) + ' ' + x + ' ' + (y + seg)
          : ' T' + x + ' ' + (y + seg);
        first = false;
        y += seg;
      }
      if (bottom - y > 6) d += first ? ' L' + x + ' ' + bottom : ' T' + (x + 5) + ' ' + bottom;
      tail.setAttribute('d', d);
    }

    function update() {
      var max = maxScroll();
      var p = max > 0 ? Math.min(1, Math.max(0, window.scrollY / max)) : 0;
      cat.style.transform = 'translateY(' + (PAD + p * maxCatY()) + 'px)';
      cat.setAttribute('aria-valuenow', Math.round(p * 100));
    }

    function layout() {
      trackH = wrap.clientHeight || window.innerHeight;
      wrap.hidden = maxScroll() <= 0;
      drawTail();
      update();
    }

    function scrollToCatY(y) {
      var p = Math.min(1, Math.max(0, (y - PAD) / maxCatY()));
      window.scrollTo(0, p * maxScroll());
    }

    // drag the cat
    cat.addEventListener('pointerdown', function (e) {
      dragging = true;
      grabOffset = e.clientY - cat.getBoundingClientRect().top;
      cat.setPointerCapture(e.pointerId);
      e.preventDefault();
    });
    cat.addEventListener('pointermove', function (e) {
      if (dragging) scrollToCatY(e.clientY - grabOffset);
    });
    function stop() { dragging = false; }
    cat.addEventListener('pointerup', stop);
    cat.addEventListener('pointercancel', stop);

    // click the tail to jump
    wrap.addEventListener('pointerdown', function (e) {
      if (e.target.closest('#cat-body')) return;
      scrollToCatY(e.clientY - catH / 2);
    });

    // keyboard
    cat.addEventListener('keydown', function (e) {
      var steps = { ArrowDown: 60, ArrowUp: -60, PageDown: innerHeight * 0.9, PageUp: -innerHeight * 0.9 };
      if (steps[e.key]) { window.scrollBy(0, steps[e.key]); e.preventDefault(); }
      if (e.key === 'Home') { window.scrollTo(0, 0); e.preventDefault(); }
      if (e.key === 'End') { window.scrollTo(0, maxScroll()); e.preventDefault(); }
    });

    window.addEventListener('scroll', update, { passive: true });
    window.addEventListener('resize', layout);
    window.addEventListener('load', layout);
    if (window.ResizeObserver) new ResizeObserver(layout).observe(document.documentElement);
    layout();
  }

  if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);
  else init();
})();