mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-08 17:51:20 +02:00
survey changes
This commit is contained in:
parent
521109b4ff
commit
cc3d8f5dda
@ -2,6 +2,13 @@
|
|||||||
if (window.isDownloadScriptInitialized) return; // Prevent re-execution
|
if (window.isDownloadScriptInitialized) return; // Prevent re-execution
|
||||||
window.isDownloadScriptInitialized = true;
|
window.isDownloadScriptInitialized = true;
|
||||||
|
|
||||||
|
// Global PDF processing count tracking for survey system
|
||||||
|
window.incrementPdfProcessingCount = function() {
|
||||||
|
let pdfProcessingCount = parseInt(localStorage.getItem('pdfProcessingCount') || '0');
|
||||||
|
pdfProcessingCount++;
|
||||||
|
localStorage.setItem('pdfProcessingCount', pdfProcessingCount.toString());
|
||||||
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
pdfPasswordPrompt,
|
pdfPasswordPrompt,
|
||||||
multipleInputsForSingleRequest,
|
multipleInputsForSingleRequest,
|
||||||
@ -312,6 +319,11 @@
|
|||||||
pdf_pages: pageCount,
|
pdf_pages: pageCount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Increment PDF processing count for survey tracking
|
||||||
|
if (success && typeof window.incrementPdfProcessingCount === 'function') {
|
||||||
|
window.incrementPdfProcessingCount();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,6 +271,11 @@ class PdfContainer {
|
|||||||
pdf_pages: pageCount,
|
pdf_pages: pageCount,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Increment PDF processing count for survey tracking
|
||||||
|
if (success && typeof window.incrementPdfProcessingCount === 'function') {
|
||||||
|
window.incrementPdfProcessingCount();
|
||||||
|
}
|
||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,19 +66,16 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
const dontShowAgain = document.getElementById('dontShowAgain');
|
const dontShowAgain = document.getElementById('dontShowAgain');
|
||||||
const takeSurveyButton = document.getElementById('takeSurvey');
|
const takeSurveyButton = document.getElementById('takeSurvey');
|
||||||
|
|
||||||
const viewThresholds = [5, 10, 15, 22, 30, 50, 75, 100, 150, 200];
|
const pdfProcessingThresholds = [8, 15, 22, 35, 50, 75, 100, 150];
|
||||||
|
|
||||||
// Check if survey version changed and reset page views if it did
|
// Check if survey version changed and reset PDF processing count if it did
|
||||||
const storedVersion = localStorage.getItem('surveyVersion');
|
const storedVersion = localStorage.getItem('surveyVersion');
|
||||||
if (storedVersion && storedVersion !== surveyVersion) {
|
if (storedVersion && storedVersion !== surveyVersion) {
|
||||||
localStorage.setItem('pageViews', '0');
|
localStorage.setItem('pdfProcessingCount', '0');
|
||||||
localStorage.setItem('surveyVersion', surveyVersion);
|
localStorage.setItem('surveyVersion', surveyVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
let pageViews = parseInt(localStorage.getItem('pageViews') || '0');
|
let pdfProcessingCount = parseInt(localStorage.getItem('pdfProcessingCount') || '0');
|
||||||
|
|
||||||
pageViews++;
|
|
||||||
localStorage.setItem('pageViews', pageViews.toString());
|
|
||||||
|
|
||||||
function shouldShowSurvey() {
|
function shouldShowSurvey() {
|
||||||
if(!window.showSurvey) {
|
if(!window.showSurvey) {
|
||||||
@ -90,11 +87,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If survey version changed and we hit a threshold, show the survey
|
// If survey version changed and we hit a threshold, show the survey
|
||||||
if (localStorage.getItem('surveyVersion') !== surveyVersion && viewThresholds.includes(pageViews)) {
|
if (localStorage.getItem('surveyVersion') !== surveyVersion && pdfProcessingThresholds.includes(pdfProcessingCount)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return viewThresholds.includes(pageViews);
|
return pdfProcessingThresholds.includes(pdfProcessingCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldShowSurvey()) {
|
if (shouldShowSurvey()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user