-
Notifications
You must be signed in to change notification settings - Fork 10
/
footer.pl
107 lines (89 loc) · 2.39 KB
/
footer.pl
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
:- module(
footer,
[
footer//1, % +Options
server_information//0
]
).
/** <module> Footer
Footer for SWI-Prolog Web pages.
@author Wouter Beek
@version 2014/01
*/
:- use_module(library(http/html_head)).
:- use_module(library(http/html_write)).
:- use_module(library(http/js_write)).
:- use_module(openid).
:- use_module(tagit).
:- use_module(annotation).
:- html_resource(css('footer.css'), []).
'community-content'(Options) -->
{ option(object(Object), Options) }, !,
html(div(id='community-content',
[ \tagit_footer(Object, []),
\annotation(Object)
])).
'community-content'(_) -->
[].
%% footer(+Options)// is det.
%
% Emit the footer, which contains the community content, server
% address and user information. Options:
%
% * object(Object)
% Display community content area for Object.
% * show_user(+Boolean)
% If =false=, omit the user
footer(Options) -->
html_requires(css('footer.css')),
html(div(class=footer,
[ \'community-content'(Options),
\'footer-footer'(Options)
])),
balance_columns_script.
'footer-footer'(Options) -->
html(div(id=footer,
[ \show_user(Options),
\server_information
])).
show_user(Options) -->
{ option(show_user(false), Options) }, !.
show_user(_) -->
current_user.
balance_columns_script -->
js_script({|javascript||
$().ready(function()
{ var $navtree = $(".navwindow");
var $navcontent = $(".navcontent");
if ( $navtree.length > 0 && $navcontent.length > 0 )
{ var $window = $(window).on("resize", function()
{ var ch = $navcontent.height();
var nh = $navtree.height();
if ( nh > 400 && nh > ch + 200 )
{ if ( ch < 300 ) ch = 300;
$navtree.height(ch);
$navtree.css('overflow-y', 'scroll');
var current = $navtree.find("li.nav.current");
if ( current.position().top > ch-40 )
{ $navtree.scrollTop(current.position().top - (ch-40));
}
}
}).trigger("resize")
}
});
|}).
prolog_version(Version) :-
current_prolog_flag(version_git, Version), !.
prolog_version(Version) :-
current_prolog_flag(version_data, swi(Ma,Mi,Pa,_)),
format(atom(Version), '~w.~w.~w', [Ma,Mi,Pa]).
%! server_information// is det.
% Emit server information.
server_information -->
{prolog_version(Version)},
html(
a([id=powered,href='http://www.swi-prolog.org'], [
'Powered by SWI-Prolog ',
Version
])
).