zenjoul80 commited on
Commit
096c237
·
verified ·
1 Parent(s): adc48af

Rename style.css to app.js

Browse files
Files changed (2) hide show
  1. app.js +83 -0
  2. style.css +0 -28
app.js ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Initialize code tabs
2
+ document.querySelectorAll('.code-tabs button').forEach(button => {
3
+ button.addEventListener('click', () => {
4
+ const tabId = button.getAttribute('data-tab');
5
+ const parent = button.parentElement.parentElement;
6
+
7
+ // Update active tab button
8
+ parent.querySelectorAll('.code-tabs button').forEach(btn => {
9
+ btn.classList.remove('active');
10
+ });
11
+ button.classList.add('active');
12
+
13
+ // Update active content
14
+ parent.querySelectorAll('.code-content').forEach(content => {
15
+ content.classList.remove('active');
16
+ });
17
+ parent.querySelector(`#${tabId}`).classList.add('active');
18
+ });
19
+ });
20
+
21
+ // Example runners
22
+ document.querySelectorAll('.run-example').forEach(button => {
23
+ button.addEventListener('click', () => {
24
+ const exampleCard = button.closest('.example-card');
25
+ const outputDiv = exampleCard.querySelector('.example-output');
26
+ const code = exampleCard.querySelector('code').textContent;
27
+
28
+ // Clear previous output
29
+ outputDiv.innerHTML = '';
30
+
31
+ // Execute the example code
32
+ try {
33
+ // Create a function with the code and pass ARK to it
34
+ const func = new Function('ARK', code);
35
+ func(ARK);
36
+ } catch (error) {
37
+ outputDiv.textContent = `Error: ${error.message}`;
38
+ }
39
+ });
40
+ });
41
+
42
+ // Smooth scrolling for anchor links
43
+ document.querySelectorAll('a[href^="#"]').forEach(anchor => {
44
+ anchor.addEventListener('click', function(e) {
45
+ e.preventDefault();
46
+ document.querySelector(this.getAttribute('href')).scrollIntoView({
47
+ behavior: 'smooth'
48
+ });
49
+ });
50
+ });
51
+
52
+ // Create a demo element using ARKjs when page loads
53
+ document.addEventListener('DOMContentLoaded', () => {
54
+ ARK.create('div')
55
+ .css({
56
+ position: 'fixed',
57
+ bottom: '20px',
58
+ right: '20px',
59
+ padding: '10px 15px',
60
+ backgroundColor: '#34a853',
61
+ color: 'white',
62
+ borderRadius: '4px',
63
+ boxShadow: '0 2px 10px rgba(0,0,0,0.2)',
64
+ cursor: 'pointer'
65
+ })
66
+ .text('ARKjs is ready!')
67
+ .on('click', () => {
68
+ ARK.create('div')
69
+ .css({
70
+ position: 'fixed',
71
+ top: '50%',
72
+ left: '50%',
73
+ transform: 'translate(-50%, -50%)',
74
+ padding: '20px',
75
+ backgroundColor: 'white',
76
+ boxShadow: '0 0 20px rgba(0,0,0,0.3)',
77
+ zIndex: '1000'
78
+ })
79
+ .html('<h3>ARKjs Demo</h3><p>This modal was created with ARKjs!</p>')
80
+ .appendTo('body');
81
+ })
82
+ .appendTo('body');
83
+ });
style.css DELETED
@@ -1,28 +0,0 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }