Because of the add_action I'm doing on get_content(), where I'm appending social media icons to the end of the post, it appears that calls to get_the_excerpt() are picking up the part of the javascript and appending it to the end of the text returned from get_the_excerpt(). I suppose this is caused by the fact that the "" tags are being stripped out (due to the fact get_the_excerpt() filters them out) as a partial answer.
However, why is this being picked up by get_the_excerpt() in the first place?
It results in the text:
Here is the excerpt.document.write('')...
if((get_option('myTest_facebook_like') || get_option('myTest_plus1') || get_option('myTest_tweet')) && !get_option('myTest_share_title')){
add_action('the_content', 'myTest_get_social', 10);
}
function myTest_get_social($myTest_share = '') {
global $post;
if((get_option('myTest_plus1') == '' && get_option('myTest_facebook_like') == '' && get_option('myTest_tweet') == '') || in_category("dont-show-social", $post ) || get_post_meta($post->ID, '_noShare', true)) return $myTest_share;
$myTest_share .= '<div class="share" style="margin:10px 0">';
$myTest_permalink = is_front_page() ? get_bloginfo('siteurl') : get_permalink();
if(get_option('myTest_plus1')){
$myTest_share .='<script type="text/javascript">document.write(\'<div class="g-plusone" href="'.$myTest_permalink.'" data-size="medium" data-count="true"></div>\');</script>';
global $post;
if(get_post_meta($post->ID, '_myTest_plus1_href', true)){$myTest_share .= '<script type="text/javascript">function myTest_plus1(){window.location="'.get_post_meta($post->ID, '_myTest_plus1_href', true).'";}</script>';}
}