File size: 6,502 Bytes
ec4fcc3
 
 
 
 
 
48f798b
ec4fcc3
 
4589b25
48f798b
ec4fcc3
48f798b
ec4fcc3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
class CustomProfileEditor extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        .editor-container {
          background: linear-gradient(135deg, #3b5998 0%, #2c3e50 100%);
          padding: 20px;
          border-radius: 10px;
          color: #00ff00;
          margin: 20px 0;
        }
.editor-tabs {
          display: flex;
          margin-bottom: 15px;
        }
        .tab {
          padding: 10px 20px;
          background: #3b5998;
          cursor: pointer;
          margin-right: 5px;
          border-radius: 5px 5px 0 0;
        }
        .tab.active {
          background: #4a6ea9;
        }
        .editor-content {
          background: rgba(0,0,0,0.5);
          padding: 20px;
          border-radius: 0 5px 5px 5px;
        }
        .form-group {
          margin-bottom: 15px;
        }
        label {
          display: block;
          margin-bottom: 5px;
        }
        input, textarea, select {
          width: 100%;
          padding: 8px;
          border-radius: 4px;
          border: 1px solid #ccc;
          background: rgba(255,255,255,0.9);
        }
        .color-picker {
          display: flex;
          gap: 10px;
          margin-top: 10px;
        }
        .color-option {
          width: 30px;
          height: 30px;
          border-radius: 50%;
          cursor: pointer;
        }
        .save-btn {
          background: #3b5998;
          color: white;
          border: none;
          padding: 10px 20px;
          border-radius: 5px;
          cursor: pointer;
        }
        .save-btn:hover {
          background: #4a6ea9;
        }
      </style>
      <div class="editor-container">
        <div class="editor-tabs">
          <div class="tab active" data-tab="profile">Profile</div>
          <div class="tab" data-tab="background">Background</div>
          <div class="tab" data-tab="colors">Colors</div>
        </div>
        <div class="editor-content">
          <div class="tab-content" id="profile-tab">
            <div class="form-group">
              <label for="profile-name">Display Name</label>
              <input type="text" id="profile-name" value="John Doe">
            </div>
            <div class="form-group">
              <label for="profile-headline">Headline</label>
              <input type="text" id="profile-headline" value="MySpace Enthusiast">
            </div>
            <div class="form-group">
              <label for="profile-bio">About Me</label>
              <textarea id="profile-bio" rows="5">Welcome to my MySpace profile!</textarea>
            </div>
          </div>
          <div class="tab-content" id="background-tab" style="display:none;">
            <div class="form-group">
              <label>Background Image</label>
              <select id="background-select">
                <option value="none">No Background</option>
                <option value="space">Space Theme</option>
                <option value="hearts">Hearts</option>
                <option value="stars">Stars</option>
                <option value="custom">Custom URL</option>
              </select>
            </div>
            <div class="form-group" id="custom-bg-group" style="display:none;">
              <label for="custom-bg-url">Custom Background URL</label>
              <input type="text" id="custom-bg-url" placeholder="https://example.com/image.jpg">
            </div>
          </div>
          <div class="tab-content" id="colors-tab" style="display:none;">
            <div class="form-group">
              <label>Text Color</label>
              <div class="color-picker">
                <div class="color-option" style="background:white;" data-color="white"></div>
                <div class="color-option" style="background:black;" data-color="black"></div>
                <div class="color-option" style="background:#ff0000;" data-color="#ff0000"></div>
                <div class="color-option" style="background:#00ff00;" data-color="#00ff00"></div>
                <div class="color-option" style="background:#0000ff;" data-color="#0000ff"></div>
              </div>
            </div>
            <div class="form-group">
              <label>Link Color</label>
              <div class="color-picker">
                <div class="color-option" style="background:#3b5998;" data-color="#3b5998"></div>
                <div class="color-option" style="background:#ff00ff;" data-color="#ff00ff"></div>
                <div class="color-option" style="background:#00ffff;" data-color="#00ffff"></div>
                <div class="color-option" style="background:#ffff00;" data-color="#ffff00"></div>
                <div class="color-option" style="background:#ff9900;" data-color="#ff9900"></div>
              </div>
            </div>
          </div>
          <button class="save-btn">Save Changes</button>
        </div>
      </div>
    `;

    // Tab switching
    this.shadowRoot.querySelectorAll('.tab').forEach(tab => {
      tab.addEventListener('click', () => {
        this.shadowRoot.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
        this.shadowRoot.querySelectorAll('.tab-content').forEach(c => c.style.display = 'none');
        
        tab.classList.add('active');
        const tabId = tab.getAttribute('data-tab') + '-tab';
        this.shadowRoot.getElementById(tabId).style.display = 'block';
      });
    });

    // Background select change
    this.shadowRoot.getElementById('background-select').addEventListener('change', (e) => {
      const customGroup = this.shadowRoot.getElementById('custom-bg-group');
      customGroup.style.display = e.target.value === 'custom' ? 'block' : 'none';
    });

    // Color picker
    this.shadowRoot.querySelectorAll('.color-option').forEach(option => {
      option.addEventListener('click', (e) => {
        const color = e.target.getAttribute('data-color');
        const pickerGroup = e.target.closest('.form-group');
        const label = pickerGroup.querySelector('label').textContent.toLowerCase();
        console.log(`Setting ${label} color to: ${color}`);
        // Would apply this color to the appropriate elements
      });
    });

    // Save button
    this.shadowRoot.querySelector('.save-btn').addEventListener('click', () => {
      alert('Profile saved! (This is a demo)');
    });
  }
}
customElements.define('custom-profile-editor', CustomProfileEditor);