diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 730a7d7e3..f874d4e6c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,7 @@ ```.firebaserc { "projects": { - "default": "your-firebase-project-id", + "default": "your-firebase-project-id" } } ``` diff --git a/src/js/account.js b/src/js/account.js index 12af2af92..b586aa0d4 100644 --- a/src/js/account.js +++ b/src/js/account.js @@ -216,7 +216,7 @@ firebase.auth().onAuthStateChanged(function (user) { const diffTime = Math.abs(date2 - date1); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); - text += ` (${diffDays} days ago)`; + text += ` (${diffDays} day${diffDays != 1 ? "s" : ""} ago)`; $(".pageAccount .group.createdDate").text(text); diff --git a/src/js/script.js b/src/js/script.js index 24a6857bd..7ff82f5f6 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -226,30 +226,25 @@ function refreshThemeColorObject() { } function copyResultToClipboard() { - if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) { - Misc.showNotification( - "Sorry, this feature is not supported in Firefox", - 4000 - ); - } else { - $(".pageTest .ssWatermark").removeClass("hidden"); - $(".pageTest .buttons").addClass("hidden"); - let src = $("#middle"); - var sourceX = src.position().left; /*X position from div#target*/ - var sourceY = src.position().top; /*Y position from div#target*/ - var sourceWidth = src.width(); /*clientWidth/offsetWidth from div#target*/ - var sourceHeight = src.height(); /*clientHeight/offsetHeight from div#target*/ - $(".notification").addClass("hidden"); - $(".pageTest .loginTip").addClass("hidden"); - try { - html2canvas(document.body, { - backgroundColor: themeColors.bg, - height: sourceHeight + 50, - width: sourceWidth + 50, - x: sourceX - 25, - y: sourceY - 25, - }).then(function (canvas) { - canvas.toBlob(function (blob) { + $(".pageTest .ssWatermark").removeClass("hidden"); + $(".pageTest .buttons").addClass("hidden"); + let src = $("#middle"); + var sourceX = src.position().left; /*X position from div#target*/ + var sourceY = src.position().top; /*Y position from div#target*/ + var sourceWidth = src.width(); /*clientWidth/offsetWidth from div#target*/ + var sourceHeight = src.height(); /*clientHeight/offsetHeight from div#target*/ + $(".notification").addClass("hidden"); + $(".pageTest .loginTip").addClass("hidden"); + try { + html2canvas(document.body, { + backgroundColor: themeColors.bg, + height: sourceHeight + 50, + width: sourceWidth + 50, + x: sourceX - 25, + y: sourceY - 25, + }).then(function (canvas) { + canvas.toBlob(function (blob) { + try { navigator.clipboard .write([ new ClipboardItem( @@ -268,6 +263,7 @@ function copyResultToClipboard() { $(".pageTest .loginTip").removeClass("hidden"); }) .catch((f) => { + open(URL.createObjectURL(blob)) $(".notification").removeClass("hidden"); Misc.showNotification("Error saving image to clipboard", 2000); $(".pageTest .ssWatermark").addClass("hidden"); @@ -275,16 +271,24 @@ function copyResultToClipboard() { if (firebase.auth().currentUser == null) $(".pageTest .loginTip").removeClass("hidden"); }); - }); + } catch(e) { + open(URL.createObjectURL(blob)) + $(".notification").removeClass("hidden"); + Misc.showNotification("Error saving image to clipboard", 2000); + $(".pageTest .ssWatermark").addClass("hidden"); + $(".pageTest .buttons").removeClass("hidden"); + if (firebase.auth().currentUser == null) + $(".pageTest .loginTip").removeClass("hidden"); + } }); - } catch (e) { - $(".notification").removeClass("hidden"); - Misc.showNotification("Error creating image", 2000); - $(".pageTest .ssWatermark").addClass("hidden"); - $(".pageTest .buttons").removeClass("hidden"); - if (firebase.auth().currentUser == null) - $(".pageTest .loginTip").removeClass("hidden"); - } + }); + } catch (e) { + $(".notification").removeClass("hidden"); + Misc.showNotification("Error creating image", 2000); + $(".pageTest .ssWatermark").addClass("hidden"); + $(".pageTest .buttons").removeClass("hidden"); + if (firebase.auth().currentUser == null) + $(".pageTest .loginTip").removeClass("hidden"); } }