Extension talk:DisplayFilter.php

From Organic Design wiki

Could make a general dynamic CSS solution

The general approach here is to make a #filter parser-function which creates a link for dynamically adjusting the CSS styles of the page. Each filter link is defined as a state-machine which rotates through the states when the link is clicked (actually the event its hooked in to can be changed too, but the default is onClick). Each state is a set of CSS rules, here's an example:

{{#filter:
.bot { display: none; }
|
.bot { display: block; }
}}

In this example the resulting link will toggle the page CSS styles between two states when clicked. The two states define the visibility of all elements in the page having their class attribute equal to "bot".

Currently this is not a full CSS specification, it only works globally and for class and/or id selection, because the text is being parsed by the PHP and converted to a simple JS selection loop. Later it will use the document.stylesheets list so any arbitrary CSS rules and formatting will be allowed.