1/* 2 * ShareBar - Creates a dynamic, vertical sharing bar to the left of a WordPress post and hides it if browser window is too small 3 * Copyright 2010 Monji Dolon, http://mdolon.com/ 4 * Released under the MIT, BSD, and GPL Licenses. 5 * More information: http://devgrow.com/sharebar 6 */ 7jQuery.fn.sharebar = function(options) { 8 var defaults = {horizontal: true, swidth: 65, minwidth: 1000, position: 'left', leftOffset: 20, rightOffset: 10}; 9 var opts = jQuery.extend(defaults, options); var o = jQuery.meta ? jQuery.extend({}, opts, jQueryjQuery.data()) : opts; 10 11 var w = jQuery(window).width(); 12 var sharebar = jQuery('#sharebar'); 13 var sharebarx = jQuery('#sharebarx'); 14 var parent = jQuery(sharebar).parent().width(); 15 var start = sharebar_init(); 16 17 function sharebar_init() { 18 if (sharebar.length) { 19 jQuery(sharebar).css('width',o.swidth+'px'); 20 if (o.position == 'left') jQuery(sharebar).css('marginLeft',(0-o.swidth-o.leftOffset)); 21 else { 22 jQuery(sharebar).css('marginLeft',(parent+o.rightOffset)); 23 } 24 if(w < o.minwidth && o.horizontal) jQuery(sharebarx).slideDown(); 25 else jQuery(sharebar).fadeIn(); 26 jQuery.event.add(window, "scroll", sharebar_scroll); 27 jQuery.event.add(window, "resize", sharebar_resize); 28 return jQuery(sharebar).offset().top; 29 } 30 31 return 0; 32 } 33 34 function sharebar_resize() { 35 var w = jQuery(window).width(); 36 if(w<o.minwidth){ 37 jQuery(sharebar).fadeOut(); 38 if(o.horizontal) jQuery(sharebarx).slideDown(); 39 40 } else{ 41 jQuery(sharebar).fadeIn(); 42 if(o.horizontal) jQuery(sharebarx).slideUp(); 43 } 44 } 45 46 function sharebar_scroll() { 47 var p = jQuery(window).scrollTop(); 48 var w = jQuery(window).width(); 49 jQuery(sharebar).css('position',((p+10)>start) ? 'fixed' : 'absolute'); 50 jQuery(sharebar).css('top',((p+10)>start) ? '10px' : ''); 51 } 52 53};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.