-
webv4 add menu items
From
Mortifis@VERT/ALLEYCAT to
echicken on Fri Apr 3 19:44:48 2020
... been diggin in yer webv4 and got lost lol ... how to I add a menu drop onãthe top navbar ... or under the more drop down?ããThanks, hope yer well!ãã---ã þ Synchronet þ AlleyCat! BBS Lake Echo, NS Canadaã
-
From
echicken@VERT/ECBBS to
Mortifis on Fri Apr 3 23:08:02 2020
Re: webv4 add menu itemsã By: Mortifis to echicken on Fri Apr 03 2020 19:44:48ãã Mo> ... been diggin in yer webv4 and got lost lol ... how to I add a menu drop onã Mo> the top navbar ... or under the more drop down?ãã
https://github.com/echicken/synchronet-web-v4/wiki/Customization#pagesããJust create a subdirectory of webv4/pages/ and put more stuff in there. Those subdirectories can have their own subdirectories, etc. (I think).ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Mortifis@VERT/ALLEYCAT to
echicken on Sat Apr 4 17:02:20 2020
Re: webv4 add menu items
By: Mortifis to echicken on Fri Apr 03 2020 19:44:48
https://github.com/echicken/synchronet-web-v4/wiki/Customization#pages
Just create a subdirectory of webv4/pages/ and put more stuff in there. Those subdirectories can have their own subdirectories, etc. (I think).
---
echicken
Hmmm ... 1st I created a script 001-own.xjs page in webv4/pages and when I load webv4 it throws an error
!JavaScript /sbbs/webv4/lib/pages.js line 62: TypeError: f.readln() is null
also tied putting it in more/004-owm.xjs throws the same error ... apparently I do not know how to add pages or sidebars :'
---
þ Synchronet þ AlleyCat! BBS Lake Echo, NS Canada
-
From
echicken@VERT/ECBBS to
Mortifis on Sat Apr 4 16:30:13 2020
Re: webv4 add menu itemsã By: Mortifis to echicken on Sat Apr 04 2020 17:02:20ãã Mo> Hmmm ... 1st I created a script 001-own.xjs page in webv4/pages and when Iã Mo> load webv4 it throws an error ã Mo> !JavaScript /sbbs/webv4/lib/pages.js line 62: TypeError: f.readln() is nullãã Mo> also tied putting it in more/004-owm.xjs throws the same error ... apparently Iã Mo> do not know how to add pages or sidebars :'ããIs 001-own.xjs empty? If not, can you put its contents somewhere (pastebin, etc.) where I can see them?ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Mortifis@VERT/ALLEYCAT to
echicken on Sat Apr 4 17:39:59 2020
Re: webv4 add menu items
By: Mortifis to echicken on Sat Apr 04 2020 17:02:20
Is 001-own.xjs empty? If not, can you put its contents somewhere (pastebin, etc.) where I can see them?
---
echicken
It's not empty but I changed the externsion to .ssjs and it is working now ... thanks echicken, I'll slowly figure it out ... then I will try to figure out how to change the css colors ...
---
þ Synchronet þ AlleyCat! BBS Lake Echo, NS Canada
-
From
echicken@VERT/ECBBS to
Mortifis on Sat Apr 4 17:09:47 2020
Re: webv4 add menu itemsã By: Mortifis to echicken on Sat Apr 04 2020 17:39:59ãã Mo> It's not empty but I changed the externsion to .ssjs and it is working now ...ã Mo> thanks echicken, I'll slowly figure it out ... then I will try to figure outããThat's confusing. At a glance I can't see why that alone would resolve the error you got. Did you make any other changes while you were at it?ããAlso, XJS and SSJS files are subtly different, and XJS is almost always preferable for front-end / user-facing stuff. I'm sure you get the general idea of <?xjs ... ?> from your PHP experience. Did you change the extension as an experiment, or is this actually an SSJS file?ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Mortifis@VERT/ALLEYCAT to
echicken on Sat Apr 4 19:26:08 2020
Re: webv4 add menu items
By: Mortifis to echicken on Sat Apr 04 2020 17:39:59
That's confusing. At a glance I can't see why that alone would resolve the error you got. Did you make any other changes while you were at it?
Also, XJS and SSJS files are subtly different, and XJS is almost always preferable for front-end / user-facing stuff. I'm sure you get the general idea of <?xjs ... ?> from your PHP experience. Did you change the extension as an experiment, or is this actually an SSJS file?
---
echicken
it was orinally an .xjs file, I stripped the <?xjs ?> tags and changed the extension to ssjs. I was getting the same error with the sbbslist.xjs so I did the same to that both work ... no worries, thanks for the help, I'll keep playing with it
(Nice web interface btw :-)
~Mortifis
---
þ Synchronet þ AlleyCat! BBS Lake Echo, NS Canada
-
From
echicken@VERT/ECBBS to
Mortifis on Sat Apr 4 20:06:58 2020
Re: webv4 add menu itemsã By: Mortifis to echicken on Sat Apr 04 2020 19:26:08ãã Mo> it was orinally an .xjs file, I stripped the <?xjs ?> tags and changed theã Mo> extension to ssjs. I was getting the same error with the sbbslist.xjs so I didã Mo> the same to that both work ... no worries, thanks for the help, I'll keepããWhen doing this, you'd also need to convert any non-js stuff into printed JS strings:ãã<div>hi</div>ããbecomes:ããwrite('<div>hi</div>');ããbut that's a huge pain. I'd rather figure out the cause of the problem than engage in that kind of workaround.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Mortifis@VERT/ALLEYCAT to
echicken on Sun Apr 5 03:54:51 2020
... been huntin' n' peckin' ... which webv4 file has the function emit(...) please ?
---
þ Synchronet þ AlleyCat! BBS Lake Echo, NS Canada
-
From
echicken@VERT/ECBBS to
Mortifis on Sun Apr 5 12:42:32 2020
Re: webv4 add menu itemsã By: Mortifis to echicken on Sun Apr 05 2020 03:54:51ãã Mo> ... been huntin' n' peckin' ... which webv4 file has the function emit(...)ã Mo> please ?ããThe file root/api/events.ssjs is an HTTP EventSource and has the emit() function in it.ããThe client requests this page and remains connected. Events are streamed to tbe browser as they happen. This was a change I introduced in a move away from having the browser poll the server at intervals for updates (new telegrams, who's online, etc.).ããThe event emitters are in lib/events/. Clients can subscribe to any of the event types in there.ããAn event emitter must expose a 'cycle' function. events.ssjs will call this function during its loop. The 'cycle' function should check for new data to send, and then push it to the client.ããPushing an event to the client is a matter of calling 'emit', as in:ããemit({ event: 'my_event', data: 'some data' });ããor:ããemit({ event: 'an_event', data: { an: 'object' } });ãã'data' can be a string or an object.ããOn the client side, there's a function included in (I think) every page called registerEventListener, so you would need to do something like this, client-side, in JS:ããregisterEventListener('my_event', function (e) {ã const data = JSON.parse(e.data);ã});ããNow whenever the server pushes a 'my_event' to the client, this function will be called. You can do whatever you need to with 'e', which is the object that your event emitter passed to emit().ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Roxanne@VERT/ALLEYCAT to
echicken on Sun Apr 5 19:32:54 2020
Re: webv4 add menu items
By: Mortifis to echicken on Sun Apr 05 2020 03:54:51
The file root/api/events.ssjs is an HTTP EventSource and has the emit() function in it.
The client requests this page and remains connected. Events are streamed to tbe browser as they happen. This was a change I introduced in a move away from having the browser poll the server at intervals for updates (new telegrams, who's online, etc.).
The event emitters are in lib/events/. Clients can subscribe to any of the event types in there.
An event emitter must expose a 'cycle' function. events.ssjs will call this function during its loop. The 'cycle' function should check for new data to send, and then push it to the client.
Pushing an event to the client is a matter of calling 'emit', as in:
emit({ event: 'my_event', data: 'some data' });
or:
emit({ event: 'an_event', data: { an: 'object' } });
'data' can be a string or an object.
On the client side, there's a function included in (I think) every page called registerEventListener, so you would need to do something like this, client-side, in JS:
registerEventListener('my_event', function (e) {
const data = JSON.parse(e.data);
});
Now whenever the server pushes a 'my_event' to the client, this function will be called. You can do whatever you need to with 'e', which is the object that your event emitter passed to emit().
---
echicken
excellent explaination, thank you!
---
þ Synchronet þ AlleyCat! BBS Lake Echo, NS Canada
-
From
Mortifis@VERT/ALLEYCAT to
echicken on Sun Apr 5 23:12:04 2020
Sorry to keep troubling you ...
I have a line is a script:
writeln('<a href="?pages/More/telegram.ssjs&to='+sys.host+'@'+sys.users[j].name +'"'>+sys.users[j].name+'</a>');
Throwing error:
!JavaScript SyntaxError: invalid XML attribute value
is that because of the &=to portion?
Thanks,
~Mortifis
---
þ Synchronet þ AlleyCat! BBS Lake Echo, NS Canada
-
From
echicken@VERT/ECBBS to
Mortifis on Sun Apr 5 22:31:39 2020
Re: webv4 add menu itemsã By: Mortifis to echicken on Sun Apr 05 2020 23:12:04ãã Mo> writeln('<a href="?pages/More/telegram.ssjs&to='+sys.host+'@'+sys.users[j].nameã Mo> +'"'>+sys.users[j].name+'</a>');ãã Mo> !JavaScript SyntaxError: invalid XML attribute valueãã Mo> is that because of the &=to portion?ããNo, that's fine. You've got a misplaced apostrophe/single-quote:ãã Mo> +'"'>+sys.users[j].name+'</a>');ããShould be:ãã+'">'+sys.users[j].name+'</a>');ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã