On 18 Jan 2009, 5:59 pm, waltd wrote:
I could certainly add this feature, but mine was deliberately written
to be simple.
For your purpose (as a navigation element), I would recommend that the
state be carried in the URL rather than a cookie. Could you post a
link to your site so I can see this in practice? I’d like to see what
sorts of hooks are naturally there in your design that I could work
off of. It’s relatively simple to read the current URL and parse it
for specific content, there might be a way to make a separate
ScriptyAccordionNav or something like that which would be tightly
bound to this particular use-case. I think that would make more sense
than bogging down a general-purpose tool with additional features.
Walter
Hi Walter,
I patched your action bit.
1.) I added the dl tag as a separator
2.) I replaced the “Show first element open” checkbox with a popup.
That way I can define, what element shall be open on page load, not just the first.
Well this way the open state is hardcoded into JS but it serves my needs to use the accordion as a menu.
Would have liked to populate the popup dynamically accorting to the number of trigger tags, but IMO that information is only available after a first publish.
If you know of a way to count the trigger tags in fwInterface() without a publish roundtrip, let me know.
Below a diff of the changes. You can apply it manually or with the Unix patch command to your scriptyaccordion.fwaction file v 0.4.
Peter
--- scriptyaccordion.fwaction.orig 2009-01-02 13:59:42.000000000 +0100
+++ scriptyaccordion.fwaction 2009-01-23 11:53:04.000000000 +0100
@@ -196,7 +196,21 @@
</action-popup>
<action-popup name="triggerElm" title="Trigger Elements"/>
<action-popup name="toggleElm" title="Show/Hide Elements"/>
-<action-checkbox name="show" title="Show the first element open when the page loads" />
+
+<action-popup name = "show" title = "Show Element open when page loads">
+ <value name = "None" value = "none">
+ <value name = "1" value = "0">
+ <value name = "2" value = "1">
+ <value name = "3" value = "2">
+ <value name = "4" value = "3">
+ <value name = "5" value = "4">
+ <value name = "6" value = "5">
+ <value name = "7" value = "6">
+ <value name = "8" value = "7">
+ <value name = "9" value = "8">
+</action-popup>
+
+
<action-checkbox name="exclusive" title="Show only one element at a time" />
<action-markup custom name="toggleScript">
var box = $('__this__');
@@ -243,7 +257,7 @@
<action-include name="scriptyHandlerFunctions">
var triggers = "h2 h3 h4 h5 h6 p div li img".split(' ');
- var toggles = "p div ul ol li".split(' ');
+ var toggles = "p div ul ol dl li".split(' ');
function fwInterface(){
fwPage.libsList = new Object();
var myTriggers = triggers.slice();
@@ -271,6 +285,7 @@
}
function fwBeforeEndBody(){
+ var showElement = fwParameters['show'].toString();
var theHead = fwDocument.fwTags.fwFind("head");
var myself = fwItem.toString();
var toggle = fwParameters['toggleElm'].fwValue || toggles[0];
@@ -282,7 +297,7 @@
}
var observerScript = (fwParameters['exclusive'].fwBoolValue) ? fwMarkups['toggleScript'] : fwMarkups['individualScript'];
observerScript = observerScript.toString().replace(/__this__/,myself).replace(/__trigger__/g,trigger).replace(/__toggle__/g,toggle).replace(/__event__/g,event);;
- observerScript = (fwParameters['show'].fwBoolValue) ? observerScript.toString().replace(/__show__/,'bods.first().show();') : observerScript.toString().replace(/__show__/,'');
+ observerScript = (showElement != "none") ? observerScript.toString().replace(/__show__/,'bods['+showElement+'].show();') : observerScript.toString().replace(/__show__/,'');
var scriptTag = theHead.fwAddJavaScript();
observerScript.fwConvertLineEndings = true;
scriptTag.fwAddRaw('document.observe(');
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options