Difference between revisions of "Widget:Ppplanner05"

Line 1: Line 1:
<div id="container" style="position: relative; cursor: pointer; border: 1px solid #ccc; padding: 0px; margin: 0px;">
+
<div id="container" style="position: relative; cursor: pointer; width: 790px; margin: 0 auto; border: 1px solid #ccc; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);">
   <img id="runImage" src="https://docs.analytica.com/images/d/d2/Ppplanner03.png" style="width: 801px; height: 406px;">
+
   <img id="runImage" src="https://docs.analytica.com/images/d/d2/Ppplanner03.png" style="width: 100%; height: auto; display: block;">
 
</div>
 
</div>
  
Line 10: Line 10:
  
 
   function showIframe() {
 
   function showIframe() {
    // Hide the initial image and interact button
 
 
     runImage.style.display = 'none';
 
     runImage.style.display = 'none';
 
     if (interactButton) {
 
     if (interactButton) {
Line 17: Line 16:
  
 
     if (!iframeAdded) {
 
     if (!iframeAdded) {
      // Create and configure the iframe
 
 
       const iframe = document.createElement('iframe');
 
       const iframe = document.createElement('iframe');
 
       iframe.src = 'https://acp.analytica.com/view0?invite=4711&code=3885603542485212689';
 
       iframe.src = 'https://acp.analytica.com/view0?invite=4711&code=3885603542485212689';
       iframe.style.width = '801px';
+
       iframe.style.width = '100%';
       iframe.style.height = '406px';
+
       iframe.style.height = '400px'; // Match the height proportionally for 790px width
 
       iframe.style.border = 'none';
 
       iframe.style.border = 'none';
  
      // Append the iframe to the container
 
 
       container.appendChild(iframe);
 
       container.appendChild(iframe);
 
       iframeAdded = true;
 
       iframeAdded = true;
  
      // Create maximize button with icon
 
 
       const maximizeButton = document.createElement('button');
 
       const maximizeButton = document.createElement('button');
 
       maximizeButton.style.position = 'absolute';
 
       maximizeButton.style.position = 'absolute';
Line 43: Line 39:
 
       maximizeButton.title = 'Click to use full screen';
 
       maximizeButton.title = 'Click to use full screen';
  
      // Add hover effect for maximize button
+
       maximizeButton.addEventListener('click', function () {
       maximizeButton.addEventListener('mouseover', function () {
+
         if (container.requestFullscreen) {
         maximizeButton.style.fontWeight = 'bold';
+
          container.requestFullscreen();
         maximizeButton.style.fontSize = '16px';
+
        } else if (container.webkitRequestFullscreen) { container.webkitRequestFullscreen(); }
      });
+
        else if (container.msRequestFullscreen) { container.msRequestFullscreen(); }
      maximizeButton.addEventListener('mouseout', function () {
+
 
         maximizeButton.style.fontWeight = '';
+
        iframe.style.width = '100%';
         maximizeButton.style.fontSize = '';
+
         iframe.style.height = '100%';
 +
         maximizeButton.style.display = 'none';
 +
         minimizeButton.style.display = 'inline-block';
 
       });
 
       });
  
      // Create minimize button with icon, initially hidden
 
 
       const minimizeButton = document.createElement('button');
 
       const minimizeButton = document.createElement('button');
 
       minimizeButton.style.position = 'absolute';
 
       minimizeButton.style.position = 'absolute';
Line 69: Line 66:
 
       minimizeButton.style.display = 'none';
 
       minimizeButton.style.display = 'none';
  
      // Add hover effect for minimize button
 
      minimizeButton.addEventListener('mouseover', function () {
 
        minimizeButton.style.fontWeight = 'bold';
 
        minimizeButton.style.fontSize = '20px';
 
      });
 
      minimizeButton.addEventListener('mouseout', function () {
 
        minimizeButton.style.fontWeight = '';
 
        minimizeButton.style.fontSize = '';
 
      });
 
 
      // Add click event for maximize button to enter fullscreen mode
 
      maximizeButton.addEventListener('click', function () {
 
        if (container.requestFullscreen) {
 
          container.requestFullscreen();
 
        } else if (container.webkitRequestFullscreen) { /* Safari */
 
          container.webkitRequestFullscreen();
 
        } else if (container.msRequestFullscreen) { /* IE11 */
 
          container.msRequestFullscreen();
 
        }
 
 
        // Adjust iframe to fill the container
 
        iframe.style.width = '100%';
 
        iframe.style.height = '100%';
 
 
        maximizeButton.style.display = 'none';
 
        minimizeButton.style.display = 'inline-block';
 
      });
 
 
      // Add click event for minimize button to exit fullscreen mode
 
 
       minimizeButton.addEventListener('click', function () {
 
       minimizeButton.addEventListener('click', function () {
 
         if (document.exitFullscreen) {
 
         if (document.exitFullscreen) {
 
           document.exitFullscreen();
 
           document.exitFullscreen();
         } else if (document.webkitExitFullscreen) { /* Safari */
+
         } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
          document.webkitExitFullscreen();
+
         else if (document.msExitFullscreen) { document.msExitFullscreen(); }
         } else if (document.msExitFullscreen) { /* IE11 */
 
          document.msExitFullscreen();
 
        }
 
 
 
        // Restore iframe dimensions when exiting fullscreen
 
        iframe.style.width = '801px';
 
        iframe.style.height = '406px';
 
  
 +
        iframe.style.width = '100%';
 +
        iframe.style.height = '400px';
 
         minimizeButton.style.display = 'none';
 
         minimizeButton.style.display = 'none';
 
         maximizeButton.style.display = 'inline-block';
 
         maximizeButton.style.display = 'inline-block';
 
       });
 
       });
  
      // Append buttons to the container
 
 
       container.appendChild(maximizeButton);
 
       container.appendChild(maximizeButton);
 
       container.appendChild(minimizeButton);
 
       container.appendChild(minimizeButton);
Line 121: Line 83:
 
   }
 
   }
  
  // Create the "Click to interact" button with updated styling
 
 
   const interactButton = document.createElement('button');
 
   const interactButton = document.createElement('button');
 
   interactButton.textContent = "Click to interact with the model in Analytica Cloud Platform";
 
   interactButton.textContent = "Click to interact with the model in Analytica Cloud Platform";
 
   interactButton.style.position = 'absolute';
 
   interactButton.style.position = 'absolute';
   interactButton.style.bottom = '7px';
+
   interactButton.style.bottom = '10px';
   interactButton.style.right = '90px';
+
   interactButton.style.right = '10px';
   interactButton.style.padding = '5px 10px';
+
   interactButton.style.padding = '10px 20px';
   interactButton.style.fontSize = '16px'; // Font size 16px
+
   interactButton.style.fontSize = '14px';
   interactButton.style.fontWeight = 'bold'; // Bold text
+
   interactButton.style.fontWeight = 'bold';
   interactButton.style.backgroundColor = '#d3d3d3';  
+
   interactButton.style.backgroundColor = '#d3d3d3';
   interactButton.style.color = 'black';  
+
   interactButton.style.color = 'black';
 
   interactButton.style.border = 'none';
 
   interactButton.style.border = 'none';
 
   interactButton.style.borderRadius = '5px';
 
   interactButton.style.borderRadius = '5px';
Line 137: Line 98:
 
   interactButton.style.opacity = '0.9';
 
   interactButton.style.opacity = '0.9';
  
  // Add click event to interact button to display the iframe and hide button
 
 
   interactButton.addEventListener('click', function (event) {
 
   interactButton.addEventListener('click', function (event) {
     event.stopPropagation(); // Prevent the event from bubbling to the container
+
     event.stopPropagation();
 
     showIframe();
 
     showIframe();
 
   });
 
   });
  
  // Append the interact button to the container
 
 
   container.appendChild(interactButton);
 
   container.appendChild(interactButton);
 
  // Add click event listener to the image container
 
 
   container.addEventListener('click', showIframe);
 
   container.addEventListener('click', showIframe);
 
});
 
});
 
</script>
 
</script>

Revision as of 05:23, 10 November 2024

 <img id="runImage" src="https://docs.analytica.com/images/d/d2/Ppplanner03.png" style="width: 100%; height: auto; display: block;">

<script> document.addEventListener('DOMContentLoaded', function () {

 let iframeAdded = false;
 const container = document.getElementById('container');
 const runImage = document.getElementById('runImage');
 function showIframe() {
   runImage.style.display = 'none';
   if (interactButton) {
     interactButton.style.display = 'none';
   }
   if (!iframeAdded) {
     const iframe = document.createElement('iframe');
     iframe.src = 'https://acp.analytica.com/view0?invite=4711&code=3885603542485212689';
     iframe.style.width = '100%';
     iframe.style.height = '400px'; // Match the height proportionally for 790px width
     iframe.style.border = 'none';
     container.appendChild(iframe);
     iframeAdded = true;
     const maximizeButton = document.createElement('button');
     maximizeButton.style.position = 'absolute';
     maximizeButton.style.bottom = '10px';
     maximizeButton.style.right = '100px';
     maximizeButton.style.width = '30px';
     maximizeButton.style.height = '30px';
     maximizeButton.style.backgroundImage = 'url("https://docs.analytica.com/images/9/9c/Arrows-maximize.png")';
     maximizeButton.style.backgroundSize = 'contain';
     maximizeButton.style.backgroundRepeat = 'no-repeat';
     maximizeButton.style.backgroundColor = 'transparent';
     maximizeButton.style.border = 'none';
     maximizeButton.style.cursor = 'pointer';
     maximizeButton.title = 'Click to use full screen';
     maximizeButton.addEventListener('click', function () {
       if (container.requestFullscreen) {
         container.requestFullscreen();
       } else if (container.webkitRequestFullscreen) { container.webkitRequestFullscreen(); }
       else if (container.msRequestFullscreen) { container.msRequestFullscreen(); }
       iframe.style.width = '100%';
       iframe.style.height = '100%';
       maximizeButton.style.display = 'none';
       minimizeButton.style.display = 'inline-block';
     });
     const minimizeButton = document.createElement('button');
     minimizeButton.style.position = 'absolute';
     minimizeButton.style.bottom = '8px';
     minimizeButton.style.right = '120px';
     minimizeButton.style.width = '30px';
     minimizeButton.style.height = '30px';
     minimizeButton.style.backgroundImage = 'url("https://docs.analytica.com/images/8/82/Arrows-minimize.png")';
     minimizeButton.style.backgroundSize = 'contain';
     minimizeButton.style.backgroundRepeat = 'no-repeat';
     minimizeButton.style.backgroundColor = 'transparent';
     minimizeButton.style.border = 'none';
     minimizeButton.style.cursor = 'pointer';
     minimizeButton.title = 'Exit full screen';
     minimizeButton.style.display = 'none';
     minimizeButton.addEventListener('click', function () {
       if (document.exitFullscreen) {
         document.exitFullscreen();
       } else if (document.webkitExitFullscreen) { document.webkitExitFullscreen(); }
       else if (document.msExitFullscreen) { document.msExitFullscreen(); }
       iframe.style.width = '100%';
       iframe.style.height = '400px';
       minimizeButton.style.display = 'none';
       maximizeButton.style.display = 'inline-block';
     });
     container.appendChild(maximizeButton);
     container.appendChild(minimizeButton);
   }
 }
 const interactButton = document.createElement('button');
 interactButton.textContent = "Click to interact with the model in Analytica Cloud Platform";
 interactButton.style.position = 'absolute';
 interactButton.style.bottom = '10px';
 interactButton.style.right = '10px';
 interactButton.style.padding = '10px 20px';
 interactButton.style.fontSize = '14px';
 interactButton.style.fontWeight = 'bold';
 interactButton.style.backgroundColor = '#d3d3d3';
 interactButton.style.color = 'black';
 interactButton.style.border = 'none';
 interactButton.style.borderRadius = '5px';
 interactButton.style.cursor = 'pointer';
 interactButton.style.opacity = '0.9';
 interactButton.addEventListener('click', function (event) {
   event.stopPropagation();
   showIframe();
 });
 container.appendChild(interactButton);
 container.addEventListener('click', showIframe);

}); </script>