View source with raw comments or as raw
    1:- module(
    2  footer,
    3  [
    4    footer//1, % +Options
    5    server_information//0
    6  ]
    7).

Footer

Footer for SWI-Prolog Web pages.

author
- Wouter Beek
version
- 2014/01 */
   17:- use_module(library(http/html_head)).   18:- use_module(library(http/html_write)).   19:- use_module(library(http/js_write)).   20:- use_module(openid).   21:- use_module(tagit).   22:- use_module(annotation).   23
   24:- html_resource(css('footer.css'), []).   25
   26
   27'community-content'(Options) -->
   28	{ option(object(Object), Options) }, !,
   29	html(div(id='community-content',
   30		 [ \tagit_footer(Object, []),
   31		   \annotation(Object)
   32		 ])).
   33'community-content'(_) -->
   34	[].
 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
   46footer(Options) -->
   47	html_requires(css('footer.css')),
   48	html(div(class=footer,
   49		 [ \'community-content'(Options),
   50		   \'footer-footer'(Options)
   51		 ])),
   52	balance_columns_script.
   53
   54'footer-footer'(Options) -->
   55	html(div(id=footer,
   56		 [ \show_user(Options),
   57		   \server_information
   58		 ])).
   59
   60show_user(Options) -->
   61	{ option(show_user(false), Options) }, !.
   62show_user(_) -->
   63	current_user.
   64
   65balance_columns_script -->
   66	js_script({|javascript||
   67		   $().ready(function()
   68	           { var $navtree = $(".navwindow");
   69		     var $navcontent = $(".navcontent");
   70		     if ( $navtree.length > 0 && $navcontent.length > 0 )
   71		     { var $window = $(window).on("resize", function()
   72		       { var ch = $navcontent.height();
   73			 var nh = $navtree.height();
   74			 if ( nh > 400 && nh > ch + 200 )
   75			 { if ( ch < 300 ) ch = 300;
   76			   $navtree.height(ch);
   77			   $navtree.css('overflow-y', 'scroll');
   78
   79			   var current = $navtree.find("li.nav.current");
   80			   if ( current.position().top > ch-40 )
   81			   { $navtree.scrollTop(current.position().top - (ch-40));
   82			   }
   83			 }
   84		       }).trigger("resize")
   85		     }
   86		   });
   87		  |}).
   88
   89
   90prolog_version(Version) :-
   91  current_prolog_flag(version_git, Version), !.
   92prolog_version(Version) :-
   93  current_prolog_flag(version_data, swi(Ma,Mi,Pa,_)),
   94  format(atom(Version), '~w.~w.~w', [Ma,Mi,Pa]).
 server_information// is det
Emit server information.
   99server_information -->
  100  {prolog_version(Version)},
  101  html(
  102    a([id=powered,href='http://www.swi-prolog.org'], [
  103      'Powered by SWI-Prolog ',
  104      Version
  105    ])
  106  )