├── .gitignore ├── changelog.txt ├── index.html ├── lib ├── cookie.polypage.jquery.js ├── events.polypage.jquery.js ├── gui.polypage.jquery.js ├── jquery.js ├── keyboard.polypage.jquery.js └── polypage.jquery.js ├── readme.markdown ├── skins ├── default.css └── plain.css └── spec ├── index.html ├── matchers.js ├── polypage-base-spec.js ├── polypage-cookie-spec.js ├── polypage-events-spec.js ├── polypage-gui-spec.js └── screw-unit ├── jquery-1.2.3.js ├── jquery.fn.js ├── jquery.print.js ├── screw.assets.js ├── screw.behaviors.js ├── screw.builder.js ├── screw.css ├── screw.events.js ├── screw.matchers.js └── screw.server.js /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | PolyPage Change Log 2 | 3 | 4 | 0.9.1 5 | 6 | - Fix default states. 7 | 8 | 9 | 0.9 10 | 11 | - Some performance improvements. 12 | - Provide hooks for custom show/hide animations via base:{ show:func, hide:func } 13 | - options for ppBase now go on the root object... {base:{opts}} becomes {opts} 14 | 15 | 16 | 0.8.3 17 | 18 | - Split extensions out into separate files to make mix'n'match easier. 19 | - Extensions are now auto loaded into the $(el).polypage() function when they are available. 20 | 21 | 22 | 0.8.2 23 | 24 | - Fixed a regression which broke alphabetical sorting. 25 | - Added a new extension to handle keyboard shortcuts. (ALT + first_char_in_state_name toggles the state) 26 | - Added a friendly error message when you have syntax errors in class names. 27 | 28 | 29 | 0.8.1 30 | 31 | - Readme updates. 32 | - extensions now take a 'polypage' option to assist with custom bindings. 33 | - API Change, ppbase options are now passed in via $(el).polypage({ base: {} }); so it is inline with other extensions. 34 | 35 | 36 | 0.8 37 | 38 | - This release is a big refactoring to split the PolyPage logic into a Base library and series of smaller modules. 39 | - A public event API for triggering page state changes and being notified of them. 40 | - The plugin now is a real JS object so theoretically you could have several PolyPage's co-existing on one html page. 41 | - PolyPage now follows the jQuery standard and is fully chainable, and scoped, in most cases $(document).polypage() is fine. 42 | - The GUI, Event bindings and Cookie support is now 100% independent of the polypage Base functionality. You can now run polypage with no GUI or DOM injection at all. 43 | - A decent amount of high level test coverage on the key components. 44 | 45 | 46 | 0.7 47 | 48 | * Officially note the MooTools branch. 49 | * Added a test suite around the public API, this was long overdue, sorry. 50 | * Pulled in some of Yoan's changes to allow #state tiggering on 'a' and 'form' elements. 51 | * Started a skins folder based on Rich's suggestion, if you've got any good ones I would love to have them in the repo. 52 | 53 | 54 | 0.6 55 | 56 | * PolyPage can now be intialized on a jQuery collection using the $(selector).polypage() syntax. the matched elements are used as the container for the navigation controls. This is now the recommended way to initialize jQuery although the $.polypage.init() method still works for backwards compatibility at the moment. (Thanks to Phil Oye) 57 | * Some refactoring of cookie support and setState(); 58 | * Fixes a bug where setting a cookie and a hash in the url to both be on would cause an infinite loop of toggling. 59 | * Added a customizable label to make it clear the toggles are page states, use the 'label' option to change. (Thanks to Phil Oye) 60 | * Increased the specificity of the CSS selectors so they are unlikely to be affected by other page styling. 61 | * If no PolyPage elements exist on a page then we now avoid adding an empty toggle box to the page. (thanks to Phil Oye for the suggestion) 62 | * The 'pp' classname prefix can now be changed via the 'prefix' option. 63 | * The classname separator can now be changed via the 'separator' option. 64 | 65 | 66 | 0.5.1 67 | 68 | * Upgraded to work with jQuery 1.3.x 69 | * Fixed a CSS typo 70 | 71 | 72 | 0.5 73 | 74 | * Regex improvements 75 | * Support for numbers in state names. 76 | * Safari 3 support. 77 | * Alphabetically sort states in the toggle list to avoid confusing users with changing orders across different pages. 78 | * IE6 support. 79 | * Anchor the toggles to the top of the html rather than the viewport. 80 | 81 | 82 | 0.4 83 | 84 | * Fixed a major bug with cookies, all cookies are now scoped to the root of the domain. (thanks Nat) 85 | 86 | 87 | 0.3 88 | 89 | * Added cookie support. 90 | * Wrapped the plugin in a closure. 91 | * Added MIT & GPL Licenses. 92 | 93 | 94 | 0.2 95 | 96 | * Upgraded jQuery. 97 | * Fixed some false negative results. 98 | * Made the syntax slightly easier. 99 | 100 | 101 | 0.1 102 | 103 | * Initial release. 104 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 |
6 | 7 | 8 |Polypage was designed to ease the process of showing multiple page states in html mock-ups. By simply adding class names to a document you can imply state and conditional view logic.
64 | 65 |This page is using PolyPage! You may have noticed the options in the top right corner of this page. Try toggling them to see the text below change to reflect your choices.
67 |Any class names that you would like Polypage to process should begin with pp_
Polypage will ignore all other classes in the document.
The pp_
prefix is then followed by a state, this can be any page state that you wish to use, some examples; logged_in
, administrator
, group_owner
, blank_state
. A complete class name might look something like pp_logged_in
When the page loads states are collected automatically from your used class names, because of this it is not necessary to tell Polypage what states you are using in a particular page.
80 |States can be joined together and negated to add some basic logic to pages. The syntax for this follows natural language. Some examples; pp_logged_in_and_admin
, pp_not_logged_in
, pp_admin_or_group_owner
.
The state of a page can be easily changed by toggling the state options on and off in the grey box in the top left corner of the window.
82 |Polypage has support for defaults and persistence through several different means:
83 |polypage.init()
function will set default on states for the page.The source code is available on GitHub
95 |This version is still an early release but is in regular use by several companies. 96 | Check-out the changelog for more details on what's new.
97 | 98 |Who knows? I'm open to suggestions / patches
100 | 101 |'+this.options.label+'