Uutiset:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu
Advertisement:

Collapse the information center on index?

Aloittaja Sig, helmikuu 08, 2005, 02:34:10 AP

« edellinen - seuraava »

Sig

How do i make that happen as an option for my users?

Oldiesmann

#1
Themes/default/BoardIndex.template.php

Find
// Here's where the "Info Center" starts...
echo '
<br />


Add after that
<script language="JavaScript" type="text/javascript"><!--
function setcookie(name, value, expire)
{
var theDate = new Date();
theDate.setTime(expire);

if (expire)
document.cookie = name + "=" + escape(value) + "; expires=" + theDate.toGMTString();
else
document.cookie = name + "=" + escape(value);
}
function getcookie(name)
{
var cookies = document.cookie.split(/[;][ ]?/), temp;

for (var i = 0; i < cookies.length; i++)
{
temp = cookies[i].split("=");
if (temp[0] == name)
return temp[1];
}

return typeof(undefined) != "undefined" ? undefined : 0;
}

function boardIndexCollapse(what)
{
var collapseImage = document.getElementById("collapse_" + what);
var collapseRow = document.getElementById("row_" + what);

if (!collapseImage)
return;

if (collapseRow.style.display == "")
{
collapseRow.style.display = "none";
collapseImage.src = smf_images_url + "/expand.gif";

setcookie("boardindex" + what, "1", new Date().getTime() + 525600 * 60);
}
else
{
collapseRow.style.display = "";
collapseImage.src = smf_images_url + "/collapse.gif";

setcookie("boardindex" + what, "0", new Date());
}
}

function boardIndexCheck()
{
var bars = ["recent", "calendar", "members", "sp1", "users", "pm", "login"];

for (var i = 0; i < bars.length; i++)
{
if (getcookie("boardindex" + bars[i]) == "1")
boardIndexCollapse(bars[i]);
}
}
// --></script>


Find
<tr>
<td class="catbg" colspan="2">', $txt[214], '</td>
</tr>
<tr>


Replace
<tr>
<td class="catbg" colspan="2"><a href="javascript:boardIndexCollapse('recent');"><img src="', $settings['images_url'], '/collapse.gif" alt="" border="0" id="collapse_recent" /> ', $txt[214], '</a></td>
</tr>
<tr id="row_recent">


Find
<tr>
<td class="catbg" colspan="2">', $context['calendar_only_today'] ? $txt['calendar47b'] : $txt['calendar47'], '</td>
</tr><tr>


Replace
<tr>
<td class="catbg" colspan="2"><a href="javascript:boardIndexCollapse('calendar');"><img src="', $settings['images_url'], '/collapse.gif" alt="" border="0" id="collapse_calendar" /> ', $context['calendar_only_today'] ? $txt['calendar47b'] : $txt['calendar47'], '</a></td>
</tr><tr id="row_calendar">


Find
<tr>
<td class="catbg" colspan="2">', $txt[331], '</td>
</tr>
<tr>


Replace
<tr>
<td class="catbg" colspan="2"><a href="javascript:boardIndexCollapse('members');"><img src="', $settings['images_url'], '/collapse.gif" alt="" border="0" id="collapse_members" /> ', $txt[331], '</a></td>
</tr>
<tr id="row_members">


Find
<tr>
<td class="catbg" colspan="2">', $txt[645], '</td>
</tr>
<tr>


Replace
<tr>
<td class="catbg" colspan="2"><a href="javascript:boardIndexCollapse('sp1');"><img src="', $settings['images_url'], '/collapse.gif" alt="" border="0" id="collapse_sp1" /> ', $txt[645], '</a></td>
</tr>
<tr id="row_sp1">


Find
<tr>
<td class="catbg" colspan="2">', $txt[158], '</td>
</tr><tr>


Replace
<tr>
<td class="catbg" colspan="2"><a href="javascript:boardIndexCollapse('users');"><img src="', $settings['images_url'], '/collapse.gif" alt="" border="0" id="collapse_users" /> ', $txt[158], '</a></td>
</tr><tr id="row_users">


Find
<tr>
<td class="catbg" colspan="2">', $txt[34], ' <a href="', $scripturl, '?action=reminder" class="smalltext">(' . $txt[315] . ')</a></td>
</tr>
<tr>


Replace
<tr>
<td class="catbg" colspan="2"><a href="javascript:collapse('login');"><img src="', $settings['images_url'], '/collapse.gif" alt="" border="0" id="collapse_login" /> ', $txt[34], '</a> <a href="', $scripturl, '?action=reminder" class="smalltext">(' . $txt[315] . ')</a></td>
</tr>
<tr id="row_login">


Find
echo '
</table></div>';


Replace
echo '
</table></div>
<script language="JavaScript" type="text/javascript"><!--
setTimeout("boardIndexCheck()", 80);
// --></script>';
Michael Eshom
Christian Metal Fans

Sig

hmmm, i tried that and got an error.

Maybe I mis pasted something, I'll try again.

Oldiesmann

I think I messed up... There should be some "echo" statements in there at the beginning
Michael Eshom
Christian Metal Fans

Sig

Lainaus käyttäjältä: Oldiesmann - helmikuu 08, 2005, 03:32:54 IP
I think I messed up... There should be some "echo" statements in there at the beginning

yeah I tried again and can't get it to work  :(

Oldiesmann

Ok... Give me a few minutes here to figure this out...

* Oldiesmann goes browsing to figure out what he did wrong
Michael Eshom
Christian Metal Fans

Oldiesmann

Ok. I see what the deal is (I think):

Add that big script block right after this:

// Here's where the "Info Center" starts...
echo '
<br />
Michael Eshom
Christian Metal Fans

Advertisement: