File size: 1,961 Bytes
6a7089a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Evaluate Test Page</title>
  <style>
    body { font-family: system-ui, sans-serif; padding: 2rem; }
    .result { padding: 1rem; margin: 1rem 0; background: #f5f5f5; border-radius: 4px; }
    #counter { font-size: 2rem; font-weight: bold; }
  </style>
</head>
<body>
  <h1>JavaScript Evaluate Test Page</h1>

  <div class="result">
    <p>Counter: <span id="counter">0</span></p>
    <button onclick="increment()">Increment</button>
    <button onclick="decrement()">Decrement</button>
    <button onclick="reset()">Reset</button>
  </div>

  <div class="result">
    <p>Message: <span id="message">Hello, World!</span></p>
  </div>

  <div class="result">
    <p>Data: <span id="data"></span></p>
  </div>

  <script>
    // Global state for testing
    window.testData = {
      name: 'PinchTab',
      version: '1.0.0',
      features: ['snapshot', 'screenshot', 'pdf', 'evaluate']
    };

    let count = 0;

    function increment() {
      count++;
      document.getElementById('counter').textContent = count;
      return count;
    }

    function decrement() {
      count--;
      document.getElementById('counter').textContent = count;
      return count;
    }

    function reset() {
      count = 0;
      document.getElementById('counter').textContent = count;
      return count;
    }

    function setMessage(msg) {
      document.getElementById('message').textContent = msg;
      return msg;
    }

    function getData() {
      return window.testData;
    }

    function asyncOperation() {
      return new Promise(resolve => {
        setTimeout(() => resolve({ status: 'complete', timestamp: Date.now() }), 100);
      });
    }

    // Math utilities for testing
    window.calculate = {
      add: (a, b) => a + b,
      multiply: (a, b) => a * b,
      factorial: (n) => n <= 1 ? 1 : n * window.calculate.factorial(n - 1)
    };
  </script>
</body>
</html>