Skip to content

Commit 661b843

Browse files
committed
<timed> tag now only support timed-inactive class ajax inline wont double up
1 parent 420d178 commit 661b843

32 files changed

Lines changed: 8559 additions & 7518 deletions

API/dotpipe.js

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ let domContentLoad = (again = false) => {
191191

192192
let elementsArray_time = document.getElementsByTagName("timed");
193193
Array.from(elementsArray_time).forEach(function (elem) {
194+
195+
setTimers(elem);
194196
if (elem.classList.contains("time-inactive"))
195197
return;
196198
if (elem.classList.contains("time-active")) {
@@ -199,7 +201,7 @@ let domContentLoad = (again = false) => {
199201
}
200202
else if (elem.classList.contains("time-inactive")) {
201203
auto = false;
202-
}
204+
}
203205
});
204206

205207
let elementsArray_dyn = document.getElementsByTagName("dyn");
@@ -218,6 +220,8 @@ let domContentLoad = (again = false) => {
218220
processCartTags();
219221
processOrderConfirmationTags();
220222
processColumnsTags();
223+
224+
221225
let elements_Carousel = document.getElementsByTagName("carousel");
222226
Array.from(elements_Carousel).forEach(function (elem) {
223227
if (!elem.classList.contains("turn-auto"))
@@ -279,30 +283,19 @@ let domContentLoad = (again = false) => {
279283
var ev = elemv.getAttribute("event");
280284
if (!ev) {
281285
elemv.addEventListener("click", function () {
282-
pipes(elemv, auto);
286+
pipes(elemv, false);
283287
});
284288
return;
285289
}
286290
var rv = ev.split(";");
287291
Array.from(rv).forEach((v) => {
288292
elemv.addEventListener(v, function () {
289-
pipes(elemv, auto);
293+
pipes(elemv, false);
290294
});
291295
});
292296
});
293297
}
294298

295-
/**
296-
* columns-component.js - Multi-column layout component for dotPipe.js
297-
* This handles the <columns> custom element for creating responsive multi-column layouts
298-
* with dynamic content loading
299-
*/
300-
301-
// Initialize columns component functionality when DOM is loaded
302-
document.addEventListener("DOMContentLoaded", function () {
303-
// Process all columns tags
304-
processColumnsTags();
305-
});
306299

307300
/**
308301
* Process all columns tags in the document
@@ -4281,8 +4274,30 @@ function parseCSVLine(line) {
42814274
});
42824275
}
42834276

4284-
// Usage example to generate a nonce
4285-
function generateNonce() {
4277+
/**
4278+
* Calculates the SHA-256 hash of a string
4279+
* @param {string} message - The input string
4280+
* @returns {Promise<string>} - The SHA-256 hash as a hex string
4281+
*/
4282+
async function sha256(message) {
4283+
// Convert the message string to an array of bytes
4284+
const msgBuffer = new TextEncoder().encode(message);
4285+
4286+
// Hash the message using the SubtleCrypto API
4287+
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
4288+
4289+
// Convert the hash buffer to a hex string
4290+
const hashArray = Array.from(new Uint8Array(hashBuffer));
4291+
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
4292+
4293+
return hashHex;
4294+
}
4295+
4296+
/**
4297+
* Generates a secure nonce using SHA-256
4298+
* @returns {Promise<string>} - A 16-character nonce
4299+
*/
4300+
async function generateNonce() {
42864301
const randomBytes = new Uint8Array(16);
42874302
crypto.getRandomValues(randomBytes);
42884303
return sha256(randomBytes.join('')).then(hash => hash.slice(0, 16));

activeMenu/dotpipe.js

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ let domContentLoad = (again = false) => {
191191

192192
let elementsArray_time = document.getElementsByTagName("timed");
193193
Array.from(elementsArray_time).forEach(function (elem) {
194+
195+
setTimers(elem);
194196
if (elem.classList.contains("time-inactive"))
195197
return;
196198
if (elem.classList.contains("time-active")) {
@@ -199,7 +201,7 @@ let domContentLoad = (again = false) => {
199201
}
200202
else if (elem.classList.contains("time-inactive")) {
201203
auto = false;
202-
}
204+
}
203205
});
204206

205207
let elementsArray_dyn = document.getElementsByTagName("dyn");
@@ -218,6 +220,8 @@ let domContentLoad = (again = false) => {
218220
processCartTags();
219221
processOrderConfirmationTags();
220222
processColumnsTags();
223+
224+
221225
let elements_Carousel = document.getElementsByTagName("carousel");
222226
Array.from(elements_Carousel).forEach(function (elem) {
223227
if (!elem.classList.contains("turn-auto"))
@@ -279,30 +283,19 @@ let domContentLoad = (again = false) => {
279283
var ev = elemv.getAttribute("event");
280284
if (!ev) {
281285
elemv.addEventListener("click", function () {
282-
pipes(elemv, auto);
286+
pipes(elemv, false);
283287
});
284288
return;
285289
}
286290
var rv = ev.split(";");
287291
Array.from(rv).forEach((v) => {
288292
elemv.addEventListener(v, function () {
289-
pipes(elemv, auto);
293+
pipes(elemv, false);
290294
});
291295
});
292296
});
293297
}
294298

295-
/**
296-
* columns-component.js - Multi-column layout component for dotPipe.js
297-
* This handles the <columns> custom element for creating responsive multi-column layouts
298-
* with dynamic content loading
299-
*/
300-
301-
// Initialize columns component functionality when DOM is loaded
302-
document.addEventListener("DOMContentLoaded", function () {
303-
// Process all columns tags
304-
processColumnsTags();
305-
});
306299

307300
/**
308301
* Process all columns tags in the document
@@ -4281,8 +4274,30 @@ function parseCSVLine(line) {
42814274
});
42824275
}
42834276

4284-
// Usage example to generate a nonce
4285-
function generateNonce() {
4277+
/**
4278+
* Calculates the SHA-256 hash of a string
4279+
* @param {string} message - The input string
4280+
* @returns {Promise<string>} - The SHA-256 hash as a hex string
4281+
*/
4282+
async function sha256(message) {
4283+
// Convert the message string to an array of bytes
4284+
const msgBuffer = new TextEncoder().encode(message);
4285+
4286+
// Hash the message using the SubtleCrypto API
4287+
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
4288+
4289+
// Convert the hash buffer to a hex string
4290+
const hashArray = Array.from(new Uint8Array(hashBuffer));
4291+
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
4292+
4293+
return hashHex;
4294+
}
4295+
4296+
/**
4297+
* Generates a secure nonce using SHA-256
4298+
* @returns {Promise<string>} - A 16-character nonce
4299+
*/
4300+
async function generateNonce() {
42864301
const randomBytes = new Uint8Array(16);
42874302
crypto.getRandomValues(randomBytes);
42884303
return sha256(randomBytes.join('')).then(hash => hash.slice(0, 16));

addons/channeladminmanager.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
class ChannelAdminManager {
2+
constructor() {
3+
this.adminKey = 'channel_admins';
4+
}
5+
6+
// Create new channel
7+
createChannel(channelName, creatorHandle) {
8+
const channelId = this.generateChannelId();
9+
const adminKey = `channel_admin_${channelId}`;
10+
11+
// Set creator as admin
12+
localStorage.setItem(adminKey, creatorHandle);
13+
14+
// Add channel to list
15+
const channels = this.getChannels();
16+
channels.push({
17+
id: channelId,
18+
name: channelName,
19+
admin: creatorHandle,
20+
created: new Date().toISOString()
21+
});
22+
23+
localStorage.setItem('channels', JSON.stringify(channels));
24+
25+
// Add creator to channel members
26+
const sessionManager = new ChatSessionManager();
27+
sessionManager.addUserToChannel(channelId, creatorHandle);
28+
29+
return channelId;
30+
}
31+
32+
// Check if user is admin of channel
33+
isChannelAdmin(channelId, userHandle) {
34+
const adminKey = `channel_admin_${channelId}`;
35+
const admin = localStorage.getItem(adminKey);
36+
return admin === userHandle;
37+
}
38+
39+
// Get channel admin
40+
getChannelAdmin(channelId) {
41+
const adminKey = `channel_admin_${channelId}`;
42+
return localStorage.getItem(adminKey);
43+
}
44+
45+
// Transfer ownership
46+
transferOwnership(channelId, newAdmin) {
47+
const adminKey = `channel_admin_${channelId}`;
48+
localStorage.setItem(adminKey, newAdmin);
49+
50+
// Update channels list
51+
const channels = this.getChannels();
52+
const channelIndex = channels.findIndex(ch => ch.id === channelId);
53+
if (channelIndex !== -1) {
54+
channels[channelIndex].admin = newAdmin;
55+
localStorage.setItem('channels', JSON.stringify(channels));
56+
}
57+
}
58+
59+
getChannels() {
60+
const stored = localStorage.getItem('channels');
61+
return stored ? JSON.parse(stored) : [];
62+
}
63+
64+
generateChannelId() {
65+
return 'ch_' + Date.now().toString(36) + Math.random().toString(36).substr(2);
66+
}
67+
}

0 commit comments

Comments
 (0)