I don't know if anyone has done this yet... Hope Bloc doesn't mind...
Here's a mod to turn the News Block into a News Fader.
Open TPortalBlocks.template.php and replace this:
// TPortal newsbox
function TPortal_newsbox()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo ' <div style="padding: 5px;" >', $context['random_news_line'], '</div>';
}
With this:
// TPortal newsbox Fader Mod By Siath
function TPortal_newsbox()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;
// Show the news fader? (assuming there are things to show...)
if (!empty($settings['enable_news']) && $settings['newsfader_time'] > 0)
{
echo ' <div style="padding: 5px;" >';
// Prepare all the javascript settings.
echo '
<div id="smfFadeScroller" style="text-align: center; width: 90%; padding: 2px;"><b>', $context['news_lines'][0], '</b></div>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
// The fading delay (in ms.)
var smfFadeDelay = ', empty($settings['newsfader_time']) ? 5000 : $settings['newsfader_time'], ';
// Fade from... what text color? To which background color?
var smfFadeFrom = {"r": 155, "g": 185, "b": 255}, smfFadeTo = {"r": 0, "g": 0, "b": 0};
// Surround each item with... anything special?
var smfFadeBefore = "<b>", smfFadeAfter = "</b>";
var foreColor, backEl, backColor;
if (typeof(document.getElementById(\'smfFadeScroller\').currentStyle) != "undefined")
{
foreColor = document.getElementById(\'smfFadeScroller\').currentStyle.color.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};
backEl = document.getElementById(\'smfFadeScroller\');
while (backEl.currentStyle.backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined")
backEl = backEl.parentNode;
backColor = backEl.currentStyle.backgroundColor.match(/#([\da-f][\da-f])([\da-f][\da-f])([\da-f][\da-f])/);
smfFadeTo = {"r": eval("0x" + backColor[1]), "g": eval("0x" + backColor[2]), "b": eval("0x" + backColor[3])};
}
else if (typeof(window.opera) == "undefined" && typeof(document.defaultView) != "undefined")
{
foreColor = document.defaultView.getComputedStyle(document.getElementById(\'smfFadeScroller\'), null).color.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeFrom = {"r": parseInt(foreColor[1]), "g": parseInt(foreColor[2]), "b": parseInt(foreColor[3])};
backEl = document.getElementById(\'smfFadeScroller\');
while (document.defaultView.getComputedStyle(backEl, null).backgroundColor == "transparent" && typeof(backEl.parentNode) != "undefined" && typeof(backEl.parentNode.tagName) != "undefined")
backEl = backEl.parentNode;
backColor = document.defaultView.getComputedStyle(backEl, null).backgroundColor.match(/rgb\((\d+), (\d+), (\d+)\)/);
smfFadeTo = {"r": parseInt(backColor[1]), "g": parseInt(backColor[2]), "b": parseInt(backColor[3])};
}
// List all the lines of the news for display.
var smfFadeContent = new Array(
"', implode('",
"', $context['fader_news_lines']), '"
);
// ]]></script>
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/fader.js"></script>
</div>';
} else {
// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo ' <div style="padding: 5px;" >', $context['random_news_line'], '</div>';
}
}
Now just turn on the news and set the speed with out turning on the fader. If you don't want the news to fade just set the fader time to '0' and it will act like a normal random news block.
My friend wanted his news to fade and not to show on the board only in the news block. SO that's how this came about.
Have fun,
Siath
i enabled the news fader from admin panel , i set fader to 6000 , i didn't check this
QuoteShow news fader on board index
(should this be check ??? )
but didn't worked :(
here is my TPortalBlocks.template.php
[edit] i do have more than 1 news and i used it in the default theme , but still not working :(
Having more than one item shouldn't matter.
Want to see it in action go here (warning this site contains Erotic stories, no pics though): New Talos (http://newtalos.com/forum/index.php?action=forum) this is my friends site.
Make sure you turn the NEWS to on, and have the fader timer set, you can turn the fader off or on but the news must be on.
Enable News? ---*Must turn this on*
Show news fader on board index ---*On of off doesn't matter, on will just show the other fader for board*
Fading delay between items for the news fader ---*Must have a value greater than 0, 0 turns the fader block off making it run like a normal news block again*
Siath
yes it is not working for me
Did you get it working?
Sorry I have been offline for a couple months.
Siath
i have not, no .
Well, I can't help you with out a soce snippet or the files that has the code. Also tell me how you have the seetings set.
Siath
Is this code still releven for smf rc2 and tp TinyPortal 1.0 RC1?
Only one way to find out QUBBAH. :)