Forum / Development Forum / Feedback / path replace on mouseover javascript events 


+   Reply to Thread

I always work with Dreamweaver when i want to develop my web pages, and as some of you know, Dreamweaver includes some javascript automatically when you insert a rollover image type to your webpage.

I've noticed that Rain was not replacing the urls of the javascript of the onmouseover behaviour.

So i dig in the code a bit and i've added this to the path_replace function:



if( in_array( "onmouseover", self::$path_replace_list ) ){
    $exp = array_merge( $exp , array( '/<a(.*?)onmouseover="(.*)\'(\w+\/.*?)\'(.*?)"/i' ) );
    $sub = array_merge( $sub , array( '<a$1onmouseover="$2\'' . self::$tpl_dir . '/$3\'$4"') );    
   }



i've also added this entry to the $path_replace_list

static $path_replace_list = array( 'a', 'img', 'link', 'script', 'input', 'onmouseover' );



Now my Rain is replacing the directories even in the onmouseover events.

Just wanted to share this with you guys.
BTW, just for curiosity, the code created by Dreamweaver looks like this:


<a href="policies.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('btnPolicies','','img/btnPolicies_s2.jpg',1)"><img src="img/btnPolicies_s1.jpg" alt="Policies" name="btnPolicies" width="200" height="37" border="0" id="btnPolicies" /></a>


After Rain "fall down" it looks like this:


<a href="policies.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('btnPolicies','','tpl/img/btnPolicies_s2.jpg',1)"><img src="tpl/img/btnPolicies_s1.jpg" alt="Policies" name="btnPolicies" width="200" height="37" border="0" id="btnPolicies" /></a>
Thanks for your contribution, very useful for all the Dreamweaver users.

+   Reply to Thread