GameSentenceMiner 2.16.1__py3-none-any.whl → 2.16.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
GameSentenceMiner/gsm.py CHANGED
@@ -790,7 +790,6 @@ async def async_main(reloading=False):
790
790
 
791
791
 
792
792
  def main():
793
- """Main function to run the Game Sentence Miner."""
794
793
  logger.info("Starting GSM")
795
794
  try:
796
795
  asyncio.run(async_main())
@@ -491,6 +491,70 @@ function escapeRegex(string) {
491
491
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
492
492
  }
493
493
 
494
+ // Screenshot functionality
495
+ function initializeScreenshotButton() {
496
+ const screenshotButton = document.getElementById('screenshotToggle');
497
+
498
+ if (!screenshotButton) {
499
+ return; // Screenshot button not available on this page
500
+ }
501
+
502
+ screenshotButton.addEventListener('click', takeScreenshot);
503
+ }
504
+
505
+ async function takeScreenshot() {
506
+ try {
507
+ // Check if html2canvas is available
508
+ if (typeof html2canvas === 'undefined') {
509
+ console.error('html2canvas library not loaded');
510
+ return;
511
+ }
512
+
513
+ // Generate timestamp for filename
514
+ const now = new Date();
515
+ const timestamp = now.getFullYear() + '-' +
516
+ String(now.getMonth() + 1).padStart(2, '0') + '-' +
517
+ String(now.getDate()).padStart(2, '0') + '_' +
518
+ String(now.getHours()).padStart(2, '0') + '-' +
519
+ String(now.getMinutes()).padStart(2, '0') + '-' +
520
+ String(now.getSeconds()).padStart(2, '0');
521
+
522
+ const filename = `screenshot_${timestamp}.png`;
523
+
524
+ // Capture the entire page
525
+ const canvas = await html2canvas(document.body, {
526
+ useCORS: true,
527
+ allowTaint: true,
528
+ scale: 1,
529
+ scrollX: 0,
530
+ scrollY: 0,
531
+ width: document.body.scrollWidth,
532
+ height: document.body.scrollHeight
533
+ });
534
+
535
+ // Convert canvas to blob
536
+ canvas.toBlob(function(blob) {
537
+ // Create download link
538
+ const link = document.createElement('a');
539
+ link.download = filename;
540
+ link.href = URL.createObjectURL(blob);
541
+
542
+ // Trigger download
543
+ document.body.appendChild(link);
544
+ link.click();
545
+ document.body.removeChild(link);
546
+
547
+ // Clean up the URL object after a short delay to avoid race condition
548
+ setTimeout(function() {
549
+ URL.revokeObjectURL(link.href);
550
+ }, 100);
551
+ }, 'image/png');
552
+
553
+ } catch (error) {
554
+ console.error('Screenshot failed:', error);
555
+ }
556
+ }
557
+
494
558
  // Initialize shared functionality when DOM loads
495
559
  document.addEventListener('DOMContentLoaded', function() {
496
560
  // Initialize theme toggle
@@ -499,6 +563,9 @@ document.addEventListener('DOMContentLoaded', function() {
499
563
  // Initialize modal handlers
500
564
  initializeModalHandlers();
501
565
 
566
+ // Initialize screenshot button
567
+ initializeScreenshotButton();
568
+
502
569
  // Initialize settings manager if settings toggle exists
503
570
  if (document.getElementById('settingsToggle')) {
504
571
  new SettingsManager();
@@ -4,6 +4,10 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>Anki vs GSM Kanji Stats</title>
7
+
8
+ <!-- Include html2canvas for screenshot functionality -->
9
+ <script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
10
+
7
11
  <!-- Include Chart.js from a CDN -->
8
12
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
9
13
 
@@ -1,7 +1,7 @@
1
1
  <!-- Navigation Component -->
2
2
  <div class="navigation" style="display: flex; justify-content: center; align-items: center; margin-bottom: 30px; padding: 15px; background: var(--bg-secondary); border-radius: 8px; box-shadow: 0 2px 8px var(--shadow-color); border: 1px solid var(--border-color);">
3
3
  <div style="display: flex; gap: 15px;">
4
- <a href="/" class="nav-link">Home</a>
4
+ <!-- <a href="/" class="nav-link">Home</a> -->
5
5
  <a href="/stats" class="nav-link">Statistics</a>
6
6
  <a href="/search" class="nav-link">Search</a>
7
7
  <a href="/database" class="nav-link">Database Management</a>
@@ -10,6 +10,9 @@
10
10
  <button class="theme-toggle" id="settingsToggle" title="Settings">
11
11
  <span id="settingsIcon">⚙️</span>
12
12
  </button>
13
+ <button class="theme-toggle" id="screenshotToggle" title="Take screenshot">
14
+ <span id="screenshotIcon">📷</span>
15
+ </button>
13
16
  <button class="theme-toggle" id="themeToggle" title="Toggle dark mode">
14
17
  <span id="themeIcon">🌙</span>
15
18
  </button>
@@ -6,6 +6,9 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>GSM Database Management</title>
8
8
 
9
+ <!-- Include html2canvas for screenshot functionality -->
10
+ <script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js"></script>
11
+
9
12
  <!-- Include shared theme styles -->
10
13
  {% include 'components/theme-styles.html' %}
11
14