SeeSaw 1.4

Installation

Install SeeSaw.py where you normally install third-party macros.

1. Out of the box

With the installation above, SeeSaw should be ready to use. jQuery is loaded into the body of page from its CDN (see http://jquery.com/download) while a minimised version of SeeSaw's own JavaScript (seesaw.js) is embedded there.

If you are new to SeeSaw you can jump straight to Testing.

2. From the filesystem

Alternatively, jQuery and seesaw.js can be loaded from the filesystem. Edit jqueryjs and seesawjs at the top of the Configuration section in SeeSaw.py to paths that will cause your web server to load jquery-1.9.1.js and seesaw.js from the locations where you choose to store those files.

In this case, both jQuery and seesaw.js are loaded into the body of the page.

3. To the page head

Finally, the type of installation required prior to this release can still be used, with jQuery and seesaw.js being loaded into the page's head.

From within MoinMoin
In this case, set both jquerys and seesawjs at the top of the Configuration section in SeeSaw.py to None and configure html_head in your wiki's wikiconfig.py configuration file as follows:
    html_head = '''
<script type="text/javascript" src="<url_prefix_static>/common/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<url_prefix_static>/common/js/seesaw.js"></script>
'''
replacing <url_prefix_static> with the value of url_prefix_static used by the configuration file, assuming the files have been installed within MoinMoin's htdocs/common/js directory.

From outside MoinMoin
Alternatively, the files can be loaded from the filesystem using paths outside the MoinMoin installation, as in installation type 2 above, e.g.
    html_head = '''
<script type="text/javascript" src="/somewhere/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="/somewhere/seesaw.js"></script>
'''

Installation Notes

Testing

The following markup should work:
   <<SeeSaw()>> <<SeeSaw(type=button, image=arrow)>>
   {{{#!wiki seesaw section
   This is the section
   }}}
It should present a link displaying the word Show and a button containing a right arrow, which change to Hide and a down arrow when either is clicked, revealing the section containing the text
   This is the section
Clicking either again should cause a return to the initial state.

A set of ready-to-run examples demonstrating all of the features can be downloaded from SeeSaw's page at MoinMoin's MacroMarket.

Images in Links and Buttons

Two image sets, each consisting of an image for showing and one for hiding, are provided as embedded data in the source code for use with the image option. Further image sets can be added by adding to moreimages in the Configuration section of SeeSaw.py. The images can be provided as data or as files. The simplest place to install files would be in htdocs/common within MoinMoin's installation tree. If providing files, it is necessary to configure imageprefix. For the case above, the value would be
   imageprefix = '<url_prefix_static>/common'
Replace <url_prefix_static> with the value of the variable url_prefix_static in your wiki's configuration file.

The files can be installed anywhere in the filesystem as long as your web server is configured appropriately for accessing them.

Anti-jump Solution

Previously page jump could sometimes be seen during the rendering of pages, i.e. sections to be hidden initially were shown briefly before being withdrawn. I used to provide a workaround for that situation, which involved adding CSS to html_head in wikiconfig.py. However, I've now decided, as it does no harm, to implement the fix unconditionally, taking advantage of the new installation mechanism to inject the CSS into the page at the point of the first SeeSaw call. The CSS of earlier releases has been extended following SeeSaw's applicability to tables as of version 1.3.

Jim Wight
jkwight@gmail.com
April 2013