Title: Fix for News Fader not Working for Chrome SMF 1.1.x
Post by: Zarniwoop on 24 December 2013, 13:12:44
http://www.simplemachines.org/community/index.php?topic=335705.0 Um, a quick note, I think you meand var smfFadeContent array instead of var smfFaderContent Anyway I made the changes on 1.1.11 too, and it worked for me, thanks! From BoardIndexTemplate.php, lines 35-78 (give or take) echo ' <div id="smfFadeScroller" style="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": 0, "g": 0, "b": 0}, smfFadeTo = {"r": 255, "g": 255, "b": 255}; // 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>
to this: echo ' <div id="smfFadeScroller" style="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": 0, "g": 0, "b": 0}, smfFadeTo = {"r": 255, "g": 255, "b": 255}; // Surround each item with... anything special? var smfFadeBefore = "<b>", smfFadeAfter = "</b>";
var foreColor, backEl, backColor;
// List all the lines of the news for display. var smfFadeContent = new Array( "', implode('", "', $context['fader_news_lines']), '" );
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])}; }
// ]]></script> <script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/fader.js"></script>
|