[textpattern commit] r3241 - Decorate the toggling H3 elements with a fixed "lever" and a conditional "expanded" class...

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 1, 2009, 7:58:14 AM7/1/09
to txp...@googlegroups.com
Author: r.wetzlmayr
Date: Wed Jul 1 03:25:06 2009
New Revision: 3241

Modified:
development/4.x/textpattern/include/txp_article.php
development/4.x/textpattern/include/txp_form.php
development/4.x/textpattern/include/txp_page.php
development/4.x/textpattern/textpattern.js

Log:
Decorate the toggling H3 elements with a fixed "lever" and a
conditional "expanded" class. Attach the toggling behaviour on all elements
matching the ".lever a" selector upon page load.

Modified: development/4.x/textpattern/include/txp_article.php
==============================================================================
--- development/4.x/textpattern/include/txp_article.php (original)
+++ development/4.x/textpattern/include/txp_article.php Wed Jul 1 03:25:06
2009
@@ -439,7 +439,7 @@

//-- advanced --------------

- echo '<h3 class="plain"><a href="#advanced"
onclick="toggleDisplay(\'advanced\'); return
false;">'.gTxt('advanced_options').'</a></h3>'.
+ echo '<h3 class="plain lever"><a
href="#advanced">'.gTxt('advanced_options').'</a></h3>'.
'<div id="advanced" class="toggle"
style="display:'.(get_pref('pane_article_advanced_visible') ? 'block' : 'none').'">';

// markup selection
@@ -489,7 +489,7 @@

//-- recent articles --------------

- echo '<h3 class="plain"><a href="#recent"
onclick="toggleDisplay(\'recent\'); return
false;">'.gTxt('recent_articles').'</a>'.'</h3>'.
+ echo '<h3 class="plain lever"><a
href="#recent">'.gTxt('recent_articles').'</a>'.'</h3>'.
'<div id="recent" class="toggle"
style="display:'.(get_pref('pane_article_recent_visible') ? 'block' : 'none').'">';

$recents = safe_rows_start("Title, ID",'textpattern',"1=1 order by
LastMod desc limit 10");
@@ -714,7 +714,7 @@
$rs);

//-- "More" section
- echo n.n.'<h3 class="plain"><a href="#more"
onclick="toggleDisplay(\'more\'); return false;">'.gTxt('more').'</a></h3>',
+ echo n.n.'<h3 class="plain lever"><a
href="#more">'.gTxt('more').'</a></h3>',
'<div id="more" class="toggle"
style="display:'.(get_pref('pane_article_more_visible') ? 'block' : 'none').'">';

//-- comments stuff --------------
@@ -946,8 +946,8 @@
if ($textile_body == USE_TEXTILE or $textile_excerpt == USE_TEXTILE)
{
return n.hed(
- '<a href="#textile_help" onclick="toggleDisplay(\'textile_help\');
return false;">'.gTxt('textile_help').'</a>'
- , 3, ' class="plain"').
+ '<a href="#textile_help">'.gTxt('textile_help').'</a>'
+ , 3, ' class="plain lever"').

n.'<div id="textile_help" class="toggle"
style="display:'.(get_pref('pane_article_textile_help_visible') ? 'block' : 'none').'">'.


Modified: development/4.x/textpattern/include/txp_form.php
==============================================================================
--- development/4.x/textpattern/include/txp_form.php (original)
+++ development/4.x/textpattern/include/txp_form.php Wed Jul 1 03:25:06
2009
@@ -137,40 +137,40 @@
tdtl(
hed(gTxt('tagbuilder'), 2).

- hed('<a href="#article-tags"
onclick="toggleDisplay(\'article-tags\'); return
false;">'.gTxt('articles').'</a>'.
- sp.popHelp('form_articles'), 3, ' class="plain"').
+ hed('<a href="#article-tags">'.gTxt('articles').'</a>'.
+ sp.popHelp('form_articles'), 3, ' class="plain lever"').
'<div id="article-tags" class="toggle on"
style="display:block">'.popTagLinks('article').'</div>'.

- hed('<a href="#link-tags" onclick="toggleDisplay(\'link-tags\');
return false;">'.gTxt('links').'</a>'.
- sp.popHelp('form_place_link'), 3, ' class="plain"').
+ hed('<a href="#link-tags">'.gTxt('links').'</a>'.
+ sp.popHelp('form_place_link'), 3, ' class="plain lever"').
'<div id="link-tags" class="toggle"
style="display:none">'.popTagLinks('link').'</div>'.

- hed('<a href="#comment-tags"
onclick="toggleDisplay(\'comment-tags\'); return
false;">'.gTxt('comments').'</a>'.
- sp.popHelp('form_comments'), 3, ' class="plain"').
+ hed('<a href="#comment-tags">'.gTxt('comments').'</a>'.
+ sp.popHelp('form_comments'), 3, ' class="plain lever"').
'<div id="comment-tags" class="toggle"
style="display:none">'.popTagLinks('comment').'</div>'.

- hed('<a href="#comment-detail-tags"
onclick="toggleDisplay(\'comment-detail-tags\'); return
false;">'.gTxt('comment_details').'</a>'.
- sp.popHelp('form_comment_details'), 3, ' class="plain"').
+ hed('<a href="#comment-detail-tags">'.gTxt('comment_details').'</a>'.
+ sp.popHelp('form_comment_details'), 3, ' class="plain lever"').
'<div id="comment-detail-tags" class="toggle"
style="display:none">'.popTagLinks('comment_details').'</div>'.

- hed('<a href="#comment-form-tags"
onclick="toggleDisplay(\'comment-form-tags\'); return
false;">'.gTxt('comment_form').'</a>'.
- sp.popHelp('form_comment_form'), 3, ' class="plain"').
+ hed('<a href="#comment-form-tags">'.gTxt('comment_form').'</a>'.
+ sp.popHelp('form_comment_form'), 3, ' class="plain lever"').
'<div id="comment-form-tags" class="toggle"
style="display:none">'.popTagLinks('comment_form').'</div>'.

- hed('<a href="#search-result-tags"
onclick="toggleDisplay(\'search-result-tags\'); return
false;">'.gTxt('search_results_form').'</a>'.
- sp.popHelp('form_search_results'), 3, ' class="plain"').
+ hed('<a
href="#search-result-tags">'.gTxt('search_results_form').'</a>'.
+ sp.popHelp('form_search_results'), 3, ' class="plain lever"').
'<div id="search-result-tags" class="toggle"
style="display:none">'.popTagLinks('search_result').'</div>'.

- hed('<a href="#file-tags" onclick="toggleDisplay(\'file-tags\');
return false;">'.gTxt('file_download_tags').'</a>'.
- sp.popHelp('form_file_download_tags'), 3, ' class="plain"').
+ hed('<a href="#file-tags">'.gTxt('file_download_tags').'</a>'.
+ sp.popHelp('form_file_download_tags'), 3, ' class="plain lever"').
'<div id="file-tags" class="toggle"
style="display:none">'.popTagLinks('file_download').'</div>'.

- hed('<a href="#category-tags"
onclick="toggleDisplay(\'category-tags\'); return
false;">'.gTxt('category_tags').'</a>'.
- sp.popHelp('form_category_tags'), 3, ' class="plain"').
+ hed('<a href="#category-tags">'.gTxt('category_tags').'</a>'.
+ sp.popHelp('form_category_tags'), 3, ' class="plain lever"').
'<div id="category-tags" class="toggle"
style="display:none">'.popTagLinks('category').'</div>'.

- hed('<a href="#section-tags"
onclick="toggleDisplay(\'section-tags\'); return
false;">'.gTxt('section_tags').'</a>'.
- sp.popHelp('form_section_tags'), 3, ' class="plain"').
+ hed('<a href="#section-tags">'.gTxt('section_tags').'</a>'.
+ sp.popHelp('form_section_tags'), 3, ' class="plain lever"').
'<div id="section-tags" class="toggle"
style="display:none">'.popTagLinks('section').'</div>'
).
tdtl(

Modified: development/4.x/textpattern/include/txp_page.php
==============================================================================
--- development/4.x/textpattern/include/txp_page.php (original)
+++ development/4.x/textpattern/include/txp_page.php Wed Jul 1 03:25:06
2009
@@ -49,28 +49,28 @@
, 2).

n.n.hed(
- '<a href="#article-tags" onclick="toggleDisplay(\'article-tags\');
return false;">'.gTxt('page_article_hed').'</a>'
- , 3, ' class="plain"').
+ '<a href="#article-tags">'.gTxt('page_article_hed').'</a>'
+ , 3, ' class="plain lever"').
n.'<div id="article-tags" class="toggle on"
style="display:block">'.taglinks('page_article').'</div>'.

- n.n.hed('<a href="#article-nav-tags"
onclick="toggleDisplay(\'article-nav-tags\'); return
false;">'.gTxt('page_article_nav_hed').'</a>'
- , 3, ' class="plain"').
+ n.n.hed('<a
href="#article-nav-tags">'.gTxt('page_article_nav_hed').'</a>'
+ , 3, ' class="plain lever"').
n.'<div id="article-nav-tags" class="toggle"
style="display:none">'.taglinks('page_article_nav').'</div>'.

- n.n.hed('<a href="#nav-tags" onclick="toggleDisplay(\'nav-tags\');
return false;">'.gTxt('page_nav_hed').'</a>'
- , 3, ' class="plain"').
+ n.n.hed('<a href="#nav-tags">'.gTxt('page_nav_hed').'</a>'
+ , 3, ' class="plain lever"').
n.'<div id="nav-tags" class="toggle"
style="display:none">'.taglinks('page_nav').'</div>'.

- n.n.hed('<a href="#xml-tags" onclick="toggleDisplay(\'xml-tags\');
return false;">'.gTxt('page_xml_hed').'</a>'
- , 3, ' class="plain"').
+ n.n.hed('<a href="#xml-tags">'.gTxt('page_xml_hed').'</a>'
+ , 3, ' class="plain lever"').
n.'<div id="xml-tags" class="toggle"
style="display:none">'.taglinks('page_xml').'</div>'.

- n.n.hed('<a href="#misc-tags" onclick="toggleDisplay(\'misc-tags\');
return false;">'.gTxt('page_misc_hed').'</a>'
- , 3, ' class="plain"').
+ n.n.hed('<a href="#misc-tags">'.gTxt('page_misc_hed').'</a>'
+ , 3, ' class="plain lever"').
n.'<div id="misc-tags" class="toggle"
style="display:none">'.taglinks('page_misc').'</div>'.

- n.n.hed('<a href="#file-tags" onclick="toggleDisplay(\'file-tags\');
return false;">'.gTxt('page_file_hed').'</a>'
- , 3, ' class="plain"').
+ n.n.hed('<a href="#file-tags">'.gTxt('page_file_hed').'</a>'
+ , 3, ' class="plain lever"').
n.'<div id="file-tags" class="toggle"
style="display:none">'.taglinks('page_file').'</div>'

,' class="column"').

Modified: development/4.x/textpattern/textpattern.js
==============================================================================
--- development/4.x/textpattern/textpattern.js (original)
+++ development/4.x/textpattern/textpattern.js Wed Jul 1 03:25:06 2009
@@ -40,7 +40,7 @@
}

// -------------------------------------------------------------
-// basic confirmation for potentially powerful choice
+// basic confirmation for potentially powerful choice
// (like deletion, for example)

function verify(msg)
@@ -84,7 +84,7 @@
var inrange = false;
var elem = window.document.longform.elements;
var cnt = elem.length;
-
+
for (var i = 0; i < cnt; i++)
{
if (elem[i].name == 'selected[]')
@@ -214,13 +214,32 @@
// send state of toggle pane to server
sendAsyncEvent(
{
- event: textpattern.event,
+ event: textpattern.event,
step: 'save_pane_state',
pane: $(obj).attr('id'),
visible: ($(obj).css('display') == 'block')
}
);
}
+ return false;
+}
+
+// -------------------------------------------------------------
+// direct show/hide referred #segment; decorate parent lever
+
+function toggleDisplayHref()
+{
+ var href = $(this).attr('href');
+ var lever = $(this).parent('.lever');
+ if (href) toggleDisplay(href.substr(1));
+ if (lever) {
+ if ($(href+':visible').length) {
+ lever.addClass('expanded');
+ } else {
+ lever.removeClass('expanded');
+ }
+ }
+ return false;
}

// -------------------------------------------------------------
@@ -285,4 +304,6 @@
$(document).ready(function() {
// disable spellchecking on all elements of type "code" in capable
browsers
if(jQuery.browser.mozilla){$(".code").attr("spellcheck", false)};
+ // attach toggle behaviour
+ $('.lever a').click(toggleDisplayHref);
});

Reply all
Reply to author
Forward
0 new messages