Posting code fix. It doesn’t look like the developer answers or checks the threads as most of the forum questions remain unresolved.
So if you get a JS error like the one above open the sharebar.js file and look for a function named function sharebar_init()
Replace the contents with this:
function sharebar_init(){
var $sharebar = jQuery(sharebar);
if ($sharebar.length > 0) {
jQuery(sharebar).css('width',o.swidth+'px');
if (o.position == 'left') jQuery(sharebar).css('marginLeft',(0-o.swidth-o.leftOffset));
else {
jQuery(sharebar).css('marginLeft',(parent+o.rightOffset));
}
if(w < o.minwidth && o.horizontal) jQuery(sharebarx).slideDown();
else jQuery(sharebar).fadeIn();
jQuery.event.add(window, "scroll", sharebar_scroll);
jQuery.event.add(window, "resize", sharebar_resize);
return jQuery(sharebar).offset().top;
} else {
return 0;
}
}
I have marked this as resolved but in future updates you might have to fix this unless the developer reads some of the forum threads…
Hope this helps someone.
Cheers!
Here is my patch, found this issue after I coded it up and was looking for a way to send it to the developer. Hope s/he starts checking these issues.
Index: sharebar.php
===================================================================
--- sharebar.php (revision 707593)
+++ sharebar.php (working copy)
@@ -155,7 +155,7 @@
echo '<link rel="stylesheet" href="'.get_bloginfo('wpurl').'/wp-content/plugins/sharebar/css/sharebar.css" type="text/css" media="screen" />';
if($horizontal) $hori = 'true'; else $hori = 'false';
if(!$width) $width = 1000;
- echo "\n"; ?><script type="text/javascript">jQuery(document).ready(function($) { $('.sharebar').sharebar({horizontal:'<?php echo $hori; ?>',swidth:'<?php echo $swidth; ?>',minwidth:<?php echo $width; ?>,position:'<?php echo $position; ?>',leftOffset:<?php echo $leftoffset; ?>,rightOffset:<?php echo $rightoffset; ?>}); });</script><?php echo "\n"; ?><!-- Sharebar Plugin by Monjurul Dolon (http://mdolon.com/) - more info at: http://devgrow.com/sharebar-wordpress-plugin --><?php echo "\n"; ?><?php
+ echo "\n"; ?><script type="text/javascript">jQuery(document).ready(function($) { if(!$('.sharebar').length){ return; } $('.sharebar').sharebar({horizontal:'<?php echo $hori; ?>',swidth:'<?php echo $swidth; ?>',minwidth:<?php echo $width; ?>,position:'<?php echo $position; ?>',leftOffset:<?php echo $leftoffset; ?>,rightOffset:<?php echo $rightoffset; ?>}); });</script><?php echo "\n"; ?><!-- Sharebar Plugin by Monjurul Dolon (http://mdolon.com/) - more info at: http://devgrow.com/sharebar-wordpress-plugin --><?php echo "\n"; ?><?php
}
}
Actually my patch does not work as well as @lifeinthegrid patch … here is his patch in patchable format
Index: js/sharebar.js
===================================================================
--- js/sharebar.js (revision 707593)
+++ js/sharebar.js (working copy)
@@ -15,6 +15,8 @@
var start = sharebar_init();
function sharebar_init(){
+ var $sharebar = jQuery(sharebar);
+ if ($sharebar.length <= 0) { return 0; }
jQuery(sharebar).css('width',o.swidth+'px');
if (o.position == 'left') jQuery(sharebar).css('marginLeft',(0-o.swidth-o.leftOffset));
else {