Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
fb6bde60
Commit
fb6bde60
authored
6 months ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Basically the same as before, but without the help of bullshit-lib.js. Untested.
parent
520520bb
No related branches found
No related tags found
1 merge request
!455
Update branch with changes from master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtrn/bullshit/999-bullshit.xjs
+86
-65
86 additions, 65 deletions
xtrn/bullshit/999-bullshit.xjs
with
86 additions
and
65 deletions
xtrn/bullshit/999-bullshit.xjs
+
86
−
65
View file @
fb6bde60
<!--Bulletins-->
<script type="text/javascript" src="./js/graphics-converter.js"></script>
<script type="text/javascript">
const _gc = new GraphicsConverter();
</script>
<div class="well well-sm">
<h4>Bulletins</h4>
</div>
<?xjs
load("sbbsdefs.js");
const bullshit = load({}, '../xtrn/bullshit/bullshit-lib.js');
const settings = bullshit.loadSettings('../xtrn/bullshit/');
// Deuce's URL-ifier
function linkify(body) {
urlRE = /(?:https?|ftp|telnet|ssh|gopher|rlogin|news):\/\/[^\s'"'<>()]*|[-\w.+]+@(?:[-\w]+\.)+[\w]{2,6}/gi;
body = body.replace(urlRE, function (str) {
var ret = '';
var p = 0;
var link = str.replace(/\.*$/, '');
var linktext = link;
if (link.indexOf('://') == -1) link = 'mailto:' + link;
return format(
'<a class="ulLink" href="%s">%s</a>%s',
link, linktext, str.substr(linktext.length)
);
});
return body;
}
const list = bullshit.loadList(settings);
?>
<div>
<ul class="list-group">
<?xjs list.forEach(function (e, i) { ?>
<li class="list-group-item striped">
<strong><? write(e.title); ?></strong><br>
<em><? write(e.date); ?></em>
<div id="bfdiv<? write(i); ?>" class="message">
<?xjs if (e.type == 'file') { ?>
<?xjs
const f = new File(e.path);
f.open('r');
const body = f.read();
f.close();
?>
<script type="text/javascript">
_gc.from_ans(atob('<? write(base64_encode(body)); ?>'), '#bfdiv' + <? write(i); ?>);
</script>
<?xjs } else {
const mb = new MsgBase(settings.messageBase);
mb.open();
const mbody = mb.get_msg_body(e.num);
mb.close();
write(linkify(mbody).replace(/\r?\n/g, '<br>'));
} ?>
</div>
</li>
<?xjs }); ?>
</ul>
</div>
\ No newline at end of file
<!--Bulletins-->
<script type="text/javascript" src="./js/graphics-converter.js"></script>
<script type="text/javascript">
const _gc = new GraphicsConverter();
</script>
<div class="well well-sm">
<h4>Bulletins</h4>
</div>
<?xjs
load('smbdefs.js');
// Deuce's URL-ifier
function linkify(body) {
urlRE = /(?:https?|ftp|telnet|ssh|gopher|rlogin|news):\/\/[^\s'"'<>()]*|[-\w.+]+@(?:[-\w]+\.)+[\w]{2,6}/gi;
body = body.replace(urlRE, function (str) {
var ret = '';
var p = 0;
var link = str.replace(/\.*$/, '');
var linktext = link;
if (link.indexOf('://') == -1) link = 'mailto:' + link;
return format(
'<a class="ulLink" href="%s">%s</a>%s',
link, linktext, str.substr(linktext.length)
);
});
return body;
}
var maxMessages = 10;
var list = []; // { type, title, date, body }
var f = new File(system.ctrl_dir + 'modopts.d/bullshit.ini');
if (f.open('r')) {
messageBase = f.iniGetValue('bullshit', 'messageBase');
maxMessages = f.iniGetValue('bullshit', 'maxMessages', 10);
if (messageBase !== null) {
var mb = new MsgBase(messageBase);
if (mb.open()) {
for (var n = mb.first_msg; n <= mb.last_msg; n++) {
var h = mb.get_msg_header(false, n);
if (h === null || (h.attr&MSG_DELETE) > 0) continue;
list.push({ type: 'message', title: h.subject, date: h.when_written_time, body: mb.get_msg_body(n) });
}
}
if (list.length > maxMessages) list = list.slice(-maxMessages);
}
files = f.iniGetObject('bullshit:files');
var fkeys = Object.keys(files);
for (var n = 0; n < fkeys.length; n++) {
if (!file_exists(files[fkeys[n]])) continue;
var ff = new File(files[fkeys[n]]);
if (!ff.open('r')) continue;
var body = ff.read();
ff.close();
list.push({ type: 'file', title: fkeys[n], date: file_date(files[fkeys[n]]), body: body });
}
f.close();
list = list.sort(function (a, b) { return b.date - a.date; });
}
?>
<div>
<ul class="list-group">
<? list.forEach(function (e, i) { ?>
<li class="list-group-item striped">
<strong><? write(e.title); ?></strong><br>
<em><? write(system.timestr(e.date)); ?></em>
<div id="bfdiv<? write(i); ?>" class="message">
<? if (e.type == 'file') { ?>
<script type="text/javascript">
_gc.from_ans(atob('<? write(base64_encode(e.body)); ?>'), '#bfdiv' + <? write(i); ?>);
</script>
<?xjs
} else {
write(linkify(e.body).replace(/\r?\n/g, '<br>'));
}
?>
</div>
</li>
<? }); ?>
</ul>
</div>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment