Hi all,
I would like to use javascript with toggles in my Trac plugin. I use
Trac 0.11. I follow these instructions to use toggle function:
http://www.tjkdesign.com/articles/toggle_elements.asp
and I try to use it with Trac.
I adapted like I thought. The folder TJK_ToggleDL is in folder htdocs.
I added in my Python source file :
...
def process_request(self, req):
data = {}
# This tuple is for Genshi (template_name, data, content_type)
# Without data the trac layout will not appear.
add_stylesheet(req, 'hw/TJK_ToggleDL/TJK_ToggleDL.css')
add_stylesheet(req, 'hw/TJK_ToggleDL/TJK_ToggleDL_ie5mac.css')
add_javascript(req, 'hw/TJK_ToggleDL/TJK_ToggleDL.js')
add_javascript(req, 'hw/js/script.js')
...
In script.js I put :
...
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(TJK_ToggleDL());
In my HTML file I have:
...
<head>
<style type="text/css" media="screen">
#content li {margin:10px 0 0 20px}
#TJK_DL {margin:10px 220px 20px 20px}
#TJK_DL dt a {border:none}
/* no need to show these ones if there is no script support
*/
#TJK_ToggleON,#TJK_ToggleOFF {display:none}
/********************/
p.highlighter {border:1px inset #555;padding:9px}
</style>
<title>Welcome !</title>
</head>
<body>
<a id="TJK_ToggleON">Open All</a><a id="TJK_ToggleOFF">Close All</a>
<dl id="TJK_DL">
<dt>Question 1</dt>
<dd>The vitality of conceptual synergies...</dd>
<dt>Question 2</dt>
<dd>To focus on improvement, not cost, ...</dd>
<dt>Question 3</dt>
<dd>The vitality of conceptual synergies...</dd>
<dt>Question 4</dt>
<dd>The vitality of conceptual synergies...</dd>
</dl>
...
And when I run the plugin, I cannot click on the Question, I don't
have the picture + and -, and I have only this that is displayed:
Question 1
Question 2
Question 3
Question 4
If someone has any idea it could be very useful for me.
Pingvince
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---