Among the many PJBlog plugins available, the WBC related posts plugin has always been one of my favorites. It works well, and after installing it I never really felt the need to replace it.
A while ago, though, I came across the enhanced edition of the WBC related posts plugin in the forum. Since it offered more features, I decided to switch over and try that version instead.
During local testing, I noticed a small but annoying problem. The first time the module loaded, the links displayed normally and followed the link color style defined by the current skin. For example, when the page first showed the related posts tab, everything looked fine. But after clicking over to hot posts and then switching back to related posts, the links below no longer followed the skin’s original link styling. Instead, they all appeared in a fixed #333333 color.
It was not a serious bug, but visually it was hard to ignore. Once I saw it, I wanted to get it fixed properly.
I checked around and found that the same issue existed elsewhere too. Some people had already raised the question, but there was no clear answer, so the only option was to dig into it myself.
At first I assumed it was a CSS problem. I opened css.css in the plugin folder and checked it several times, but that turned out not to be the cause. After that I looked into wbc_getarticle.asp, but nothing there stood out either.
In the end I turned my attention to ajaxJS.js. That file seemed much more suspicious, except it was encrypted. I tried a few decryption methods I found online, but none of them worked. Eventually the script was manually decrypted, and once that was done the issue became obvious almost immediately: the hardcoded #333333 value was sitting right there in the script.
Here is the decrypted code, with the line that needs attention left exactly as it appeared:
var wbc_RelatedArticle_frameloaded=false;var wbc_RelatedArticle_tabs=new Array(30);var wbc_related_t10="com";var wbc_RelatedArticle_checkjs="no";var wbc_related_t9="kk";var wbc_related_t11="b"+wbc_related_t9+"ss";var google_ad_client="pub-0315357258946623";var wbc_Rela_d=new Date();var wbc_RelatedArticle_check="http://www.b"+wbc_related_t9+"ss."+wbc_related_t10+"/plugin_response"+".asp?u="+wbc_Rela_d.getHours();document.writeln("<script type=\"text\/javascript\" src=\"http://www."+wbc_related_t11+".com/plugin_response.asp?u="+wbc_Rela_d.getHours()+"\">");document.writeln("<\/script>");document.getElementById("Side_wbc_RelatedArticle").style.display='none';var wbc_related_t1="pu"+"b-031";function wbc_RelatedArticle_createxmlhttp(){var a=false;try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){a=false}}if(!a&&typeof XMLHttpRequest!='undefined'){a=new XMLHttpRequest();if(a.overrideMimeType){a.overrideMimeType('text/xml')}}return a}function wbc_RelatedArticle_getdata(a,b,c,d){a=a+"&"+Math.random();var e=wbc_RelatedArticle_createxmlhttp();if(!e){alert("Your browser does not support XMLHTTP!!");return}if(document.getElementById(b)!=null){document.getElementById(b).innerHTML="Loading..."}e.onreadystatechange=requestdata;e.open("GET",a,true);e.send(null);function requestdata(){if(e.readyState==4){if(e.status==200){if(document.getElementById(c)!=null&&e.responseText!=''){document.getElementById(c).innerHTML=e.responseText}if(document.getElementById(b)!=null){document.getElementById(b).innerHTML=""}if(d!=null){eval(d)}}else{if(document.getElementById(c)!=null)document.getElementById(c).innerHTML=e.responseText}}}}var wbc_related_t2="8946623";function wbc_switchTab(b,c){var d="wbc_relate",contpage='wbc_relate';var e=document.getElementById(d);for(var i=1;i<e.getElementsByTagName('li').length;i++){var x=e.getElementsByTagName('li')[i];x.className="";var y=x.getElementsByTagName('a');var a=document.getElementsByTagName("a");[color=Red]/*y[0].style.color="#333333"*/[/color]}document.getElementById(b).className="Selected";var f=document.getElementById(contpage);for(var j=0;j<f.getElementsByTagName('h6').length;j++){var g=f.getElementsByTagName('h6')[j];g.style.display="none"}document.getElementById(c).style.display="block"}function wbc_blurAnchors(){var b=document.getElementById("wbc_relate");if(b.getElementsByTagName){var a=b.getElementsByTagName("a");for(var i=0;i<a.length;i++){a[i].onfocus=function(){this.blur()}}}}var wbc_related_t12="ww";function wbc_checkjs(){var a=document.getElementsByTagName("script"),wbc_findajaxjs=false;wbc_RelatedArticle_checkjs=false;for(x=0;x<a.length;x++){var e=document.getElementsByTagName("script")[x];if(e.src.indexOf("ugins/wbc_RelatedArticle/ajaxjs.js")>0){wbc_findajaxjs=true}if(e.src==wbc_RelatedArticle_check&&wbc_RelatedArticle_check.indexOf("plugin"+"_"+"response")>0&&wbc_RelatedArticle_check.indexOf("ttp"+"://"+"w"+wbc_related_t12)>0&&wbc_RelatedArticle_check.indexOf("bk")>0&&wbc_RelatedArticle_check.indexOf("kss")>wbc_RelatedArticle_check.indexOf("tt")&&wbc_findajaxjs&&google_ad_client==wbc_related_t1+"535"+wbc_related_t3+wbc_related_t2){wbc_RelatedArticle_checkjs=true;x=1000}}}var wbc_related_t3="725";function wbc_RelatedArticle_do(a,b){var c="";if(wbc_RelatedArticle_checkjs=="no"){wbc_checkjs()}if(wbc_RelatedArticle_checkjs){if(window.location.toString().toLowerCase().split("article").length>1){if(document.getElementById("wbc_RelatedArticle_list")==null){var j=0;for(i=0;i<document.getElementsByTagName("DIV").length;i++){var e=document.getElementsByTagName("DIV")[i];if(e.className=='Content-body'){if(j==0){j++}else{if(e.innerHTML.split("icon_trackback.gif").length>1)e.innerHTML+='<div id="wbc_RelatedArticle_list"></div>'}}}}if(!wbc_RelatedArticle_frameloaded){wbc_RelatedArticle_getdata('Plugins/wbc_RelatedArticle/wbc_getarticle.asp?getframe=true&actionid='+a+'&'+b,'wbc_RelatedArticle_fb','wbc_RelatedArticle_list','wbc_RelatedArticle_frameloaded="true";wbc_RelatedArticle_do("'+a+'");document.getElementById("wbc_relate").innerHTML+="<div id=\'wbc_ad\'></div>";document.getElementById("wbc_ad").innerHTML=document.getElementById("Side_wbc_RelatedArticle").getElementsByTagName("div")[0].innerHTML;wbc_blurAnchors();')}else{if((!wbc_RelatedArticle_tabs[a])||(b!=null)){wbc_RelatedArticle_getdata('Plugins/wbc_RelatedArticle/wbc_getarticle.asp?actionid='+a+'&'+b,'wbc_RelatedArticle_fb','wbc_relat_c'+a);wbc_RelatedArticle_tabs[a]=true}}}}}setTimeout("wbc_RelatedArticle_do('1')",100);
The problematic part is the line that forces the anchor color to #333333 when switching tabs. After commenting it out, the links immediately returned to the normal style defined by the skin, even after toggling between different tabs.
So the fix is very simple: locate that line in ajaxJS.js, comment it out, and the display will go back to normal.
After making the change, I re-encrypted the script again for regular use, which made the whole setup feel a bit cleaner.
Even with this small issue, the plugin itself is still excellent, and the enhanced version is worth using once this display bug is corrected.