... 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?
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 :'
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
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
... been huntin' n' peckin' ... which webv4 file has the function emit(...)
please ?
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
writeln('<a href="?pages/More/telegram.ssjs&to='+sys.host+'@'+sys.users[j].name
+'"'>+sys.users[j].name+'</a>');
!JavaScript SyntaxError: invalid XML attribute value
is that because of the &=to portion?
+'"'>+sys.users[j].name+'</a>');
Sysop: | digital man |
---|---|
Location: | Riverside County, California |
Users: | 1,063 |
Nodes: | 17 (0 / 17) |
Uptime: | 35:02:33 |
Calls: | 501,357 |
Calls today: | 2 |
Files: | 109,427 |
D/L today: |
2,217 files (272M bytes) |
Messages: | 302,469 |