Icons instead of text markers to show/hide articles optional parts

This commit is contained in:
Abs62 2012-09-16 19:54:00 +04:00
parent a66a71a471
commit bc7a8b39c8
6 changed files with 8 additions and 5 deletions

View file

@ -369,6 +369,7 @@ div.xdxf
{
color: blue;
cursor: pointer;
vertical-align: center;
}
/************* Spelling suggestions *****************/

View file

@ -109,9 +109,9 @@ std::string ArticleMaker::makeHtmlHeader( QString const & word,
"function processIframeClick() { if( overIframeId != null ) { overIframeId = overIframeId.replace( 'gdexpandframe-', '' ); gdMakeArticleActive( overIframeId ) } }"
"function init() { window.addEventListener('blur', processIframeClick, false); }"
"window.addEventListener('load', init, false);"
"function gdExpandOptPart( expanderId, optionalId ) { var d1=document.getElementById(expanderId); var i = 0; if( d1.innerHTML == '[+]' ) {"
"d1.innerHTML = '[-]'; for( i = 0; i < 1000; i++ ) { var d2=document.getElementById( optionalId + i ); if( !d2 ) break; d2.style.display='inline'; } }"
"else { d1.innerHTML = '[+]'; for( i = 0; i < 1000; i++ ) { var d2=document.getElementById( optionalId + i ); if( !d2 ) break; d2.style.display='none'; } } }"
"function gdExpandOptPart( expanderId, optionalId ) { var d1=document.getElementById(expanderId); var i = 0; if( d1.alt == '[+]' ) {"
"d1.alt = '[-]'; d1.src = 'qrcx://localhost/icons/collapse_opt.png'; for( i = 0; i < 1000; i++ ) { var d2=document.getElementById( optionalId + i ); if( !d2 ) break; d2.style.display='inline'; } }"
"else { d1.alt = '[+]'; d1.src = 'qrcx://localhost/icons/expand_opt.png'; for( i = 0; i < 1000; i++ ) { var d2=document.getElementById( optionalId + i ); if( !d2 ) break; d2.style.display='none'; } } }"
"</script>";
result += "</head><body>";

4
dsl.cc
View file

@ -1157,8 +1157,8 @@ void DslArticleRequest::run()
string prefix = "O" + dict.getId().substr( 0, 7 ) + "_" + QString::number( dict.articleNom ).toStdString();
string id1 = prefix + "_expand";
string id2 = prefix + "_opt_";
string button = "<span class=\"hidden_expand_opt\" id=\"" + id1 +
"\" onclick=\"gdExpandOptPart('" + id1 + "','" + id2 +"')\">[+]</span>";
string button = "<img src=\"qrcx://localhost/icons/expand_opt.png\" class=\"hidden_expand_opt\" id=\"" + id1 +
"\" onclick=\"gdExpandOptPart('" + id1 + "','" + id2 +"')\" alt=\"[+]\"/>";
if( articleText.compare( articleText.size() - 4, 4, "</p>" ) == 0 )
articleText.insert( articleText.size() - 4, " " + button );
else

BIN
icons/collapse_opt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
icons/expand_opt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -49,6 +49,8 @@
<file>icons/macicon.png</file>
<file>icons/icon32_sdict.png</file>
<file>icons/icon32_aard.png</file>
<file>icons/expand_opt.png</file>
<file>icons/collapse_opt.png</file>
<file>article-style-st-babylon.css</file>
<file>qt-style-st-babylon.css</file>
</qresource>