Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/cjs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/esm/index.mjs

Large diffs are not rendered by default.

58 changes: 0 additions & 58 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -259,36 +259,7 @@ <h2 class="sub-headline">
<div class="header-container-image">
<img class="head-image" src="./pexels-niklas-jeromin-12734294.jpg" />
</div>
<canvas id="myCanvas" width="200" height="200" style="border:1px solid #000000;"></canvas>

<script>
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
var centerX = canvas.width / 2;
var centerY = canvas.height / 2;
var radius = 70;

ctx.beginPath();
ctx.arc(centerX, centerY, radius, 0, 2 * Math.PI);
ctx.fillStyle = 'blue';
ctx.fill();
ctx.stroke();
</script>

<!-- The Modal -->
<div id="myModal" class="modal">

<!-- Modal content -->
<div class="modal-content">
<span class="close">&times;</span>
<p>Some text in the Modal..</p>
</div>

</div>

<div class="content" id="haha">
<button id="myBtn222">Open Modal</button>
<a href="https://www.google.com">asdf asfasdfasfdasdf</a>
<div class="skeleton-text"></div>
<div class="skeleton-text"></div>
<div class="skeleton-text"></div>
Expand All @@ -297,35 +268,6 @@ <h2 class="sub-headline">
<div class="skeleton-text"></div>
<div class="skeleton-text"></div>
</div>

<script>
// Get the modal
var modal = document.getElementById("myModal");

// Get the button that opens the modal
var btn = document.getElementById("myBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal
btn.onclick = function () {
modal.style.display = "block";
}

// When the user clicks on <span> (x), close the modal
span.onclick = function () {
modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
}
}

</script>
</body>

</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gleap",
"version": "13.7.6",
"version": "13.7.7",
"main": "build/cjs/index.js",
"module": "build/esm/index.mjs",
"exports": {
Expand Down
1 change: 1 addition & 0 deletions published/13.7.7/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion published/latest/index.js

Large diffs are not rendered by default.

28 changes: 18 additions & 10 deletions src/ScreenCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const replaceStyleNodes = (clone, styleSheet, cssTextContent, styleId) => {
cloneTargetNode.remove();
}
}
} catch (exp) { }
} catch (exp) {}
}
};

Expand All @@ -224,7 +224,7 @@ const getTextContentFromStyleSheet = (styleSheet) => {
} else if (styleSheet.rules) {
cssRules = styleSheet.rules;
}
} catch (exp) { }
} catch (exp) {}

var cssTextContent = "";
if (cssRules) {
Expand All @@ -236,15 +236,15 @@ const getTextContentFromStyleSheet = (styleSheet) => {
}

return cssTextContent;
}
};

const downloadAllCSSUrlResources = (clone, remote) => {
var promises = [];
for (var i = 0; i < document.styleSheets.length; i++) {
const styleSheet = document.styleSheets[i];

// Skip if the stylesheet is meant for print
if (styleSheet.media && styleSheet.media.mediaText === 'print') {
if (styleSheet.media && styleSheet.media.mediaText === "print") {
continue;
}

Expand Down Expand Up @@ -349,12 +349,12 @@ const handleAdoptedStyleSheets = (doc, clone, shadowNodeId) => {
clone.insertBefore(shadowStyleNode, clone.firstElementChild);
}
}
}
};

const deepClone = (host) => {
let shadowNodeId = 1;

const cloneNode = (node, parent, shadowRoot) => {
const cloneNode = async (node, parent, shadowRoot) => {
const walkTree = (nextn, nextp, innerShadowRoot) => {
while (nextn) {
cloneNode(nextn, nextp, innerShadowRoot);
Expand All @@ -371,7 +371,12 @@ const deepClone = (host) => {

if (node instanceof HTMLCanvasElement) {
try {
clone.setAttribute("bb-canvas-data", resizeImage(node.toDataURL(), 750, 750));
const boundingRect = node.getBoundingClientRect();
const resizedImage = await resizeImage(node.toDataURL(), 900, 900);

clone.setAttribute("bb-canvas-data", resizedImage);
clone.setAttribute("bb-canvas-height", boundingRect.height);
clone.setAttribute("bb-canvas-width", boundingRect.width);
} catch (exp) {
console.warn("Gleap: Failed to clone canvas data.", exp);
}
Expand All @@ -393,7 +398,7 @@ const deepClone = (host) => {
clone.setAttribute("bb-width", boundingRect.width);
}

if ((node.scrollTop > 0 || node.scrollLeft > 0)) {
if (node.scrollTop > 0 || node.scrollLeft > 0) {
clone.setAttribute("bb-scrollpos", true);
clone.setAttribute("bb-scrolltop", node.scrollTop);
clone.setAttribute("bb-scrollleft", node.scrollLeft);
Expand All @@ -407,7 +412,7 @@ const deepClone = (host) => {
var val = node.value;
if (
node.getAttribute("gleap-ignore") === "value" ||
node.classList.contains('gl-mask')
node.classList.contains("gl-mask")
) {
val = new Array(val.length + 1).join("*");
}
Expand Down Expand Up @@ -494,7 +499,10 @@ const prepareScreenshotData = (remote) => {
}

// Adjust the base node
const baseUrl = window.location.href.substring(0, window.location.href.lastIndexOf("/"));
const baseUrl = window.location.href.substring(
0,
window.location.href.lastIndexOf("/")
);
var newBaseUrl = baseUrl + "/";
if (existingBasePath) {
if (existingBasePath.startsWith("http")) {
Expand Down