1/* ------------------------------------------------------------------------ 2Please note - this has been modified from it's original version to be HTML5 compatible 3 * ------------------------------------------------------------------------- */ 4 5 6/* ------------------------------------------------------------------------ 7 * prettySociable plugin. 8 * Version: 1.2.1 9 * Description: Include this plugin in your webpage and let people 10 * share your content like never before. 11 * Website: http://no-margin-for-errors.com/projects/prettySociable/ 12 * 13 * Thank You: 14 * Chris Wallace, for the nice icons 15 * http://www.chris-wallace.com/2009/05/28/free-social-media-icons-socialize/ 16 * ------------------------------------------------------------------------- */ 17 18(function (jQuery) { 19 jQuery.prettySociable = { 20 version: 1.21 21 }; 22 jQuery.prettySociable = function (settings) { 23 jQuery.prettySociable.settings = jQuery.extend({ 24 animationSpeed: 'fast', 25 opacity: 0.80, 26 share_label: 'Drag to share', 27 label_position: 'top', 28 share_on_label: 'Share on ', 29 hideflash: false, 30 hover_padding: 0, 31 websites: { 32 facebook: { 33 'active': true, 34 'encode': true, 35 'title': 'Facebook', 36 'url': 'http://www.facebook.com/share.php?u=', 37 'icon': '../truethemes-framework/prettySociable/facebook.png', 38 'sizes': { 39 'width': 70, 40 'height': 70 41 } 42 }, 43 twitter: { 44 'active': true, 45 'encode': true, 46 'title': 'Twitter', 47 'url': 'http://twitter.com/home?status=', 48 'icon': '../truethemes-framework/prettySociable/twitter.png', 49 'sizes': { 50 'width': 70, 51 'height': 70 52 } 53 }, 54 delicious: { 55 'active': true, 56 'encode': true, 57 'title': 'Delicious', 58 'url': 'http://del.icio.us/post?url=', 59 'icon': '../truethemes-framework/prettySociable/delicious.png', 60 'sizes': { 61 'width': 70, 62 'height': 70 63 } 64 }, 65 digg: { 66 'active': true, 67 'encode': true, 68 'title': 'Digg', 69 'url': 'http://digg.com/submit?phase=2&url=', 70 'icon': '../truethemes-framework/prettySociable/digg.png', 71 'sizes': { 72 'width': 70, 73 'height': 70 74 } 75 }, 76 linkedin: { 77 'active': false, 78 'encode': true, 79 'title': 'LinkedIn', 80 'url': 'http://www.linkedin.com/shareArticle?mini=true&ro=true&url=', 81 'icon': '../truethemes-framework/prettySociable/linkedin.png', 82 'sizes': { 83 'width': 70, 84 'height': 70 85 } 86 }, 87 reddit: { 88 'active': false, 89 'encode': true, 90 'title': 'Reddit', 91 'url': 'http://reddit.com/submit?url=', 92 'icon': '../truethemes-framework/prettySociable/reddit.png', 93 'sizes': { 94 'width': 70, 95 'height': 70 96 } 97 }, 98 stumbleupon: { 99 'active': false, 100 'encode': false, 101 'title': 'StumbleUpon', 102 'url': 'http://stumbleupon.com/submit?url=', 103 'icon': '../truethemes-framework/prettySociable/stumbleupon.png', 104 'sizes': { 105 'width': 70, 106 'height': 70 107 } 108 }, 109 tumblr: { 110 'active': false, 111 'encode': true, 112 'title': 'tumblr', 113 'url': 'http://www.tumblr.com/share?v=3&u=', 114 'icon': '../truethemes-framework/prettySociable/tumblr.png', 115 'sizes': { 116 'width': 70, 117 'height': 70 118 } 119 } 120 }, 121 urlshortener: { 122 bitly: { 123 'active': false 124 } 125 }, 126 tooltip: { 127 offsetTop: 0, 128 offsetLeft: 15 129 }, 130 popup: { 131 width: 900, 132 height: 500 133 }, 134 callback: function () {} 135 }, settings); 136 var websites, settings = jQuery.prettySociable.settings, 137 show_timer, ps_hover; 138 jQuery.each(settings.websites, function (i) { 139 var preload = new Image(); 140 preload.src = this.icon; 141 }); 142 jQuery('a[data-gal^=prettySociable]').hover(function () { 143 _self = this; 144 _container = this; 145 if (jQuery(_self).find('img').size() > 0) { 146 _self = jQuery(_self).find('img'); 147 } else if (jQuery.browser.msie) { 148 if (jQuery(_self).find('embed').size() > 0) { 149 _self = jQuery(_self).find('embed'); 150 jQuery(_self).css({ 151 'display': 'block' 152 }); 153 } 154 } else { 155 if (jQuery(_self).find('object').size() > 0) { 156 _self = jQuery(_self).find('object'); 157 jQuery(_self).css({ 158 'display': 'block' 159 }); 160 } 161 } 162jQuery(_self).css({'cursor':'move','position':'relative','z-index':1005});offsetLeft=(parseFloat(jQuery(_self).css('borderLeftWidth')))?parseFloat(jQuery(_self).css('borderLeftWidth')):0;offsetTop=(parseFloat(jQuery(_self).css('borderTopWidth')))?parseFloat(jQuery(_self).css('borderTopWidth')):0;offsetLeft+=(parseFloat(jQuery(_self).css('paddingLeft')))?parseFloat(jQuery(_self).css('paddingLeft')):0;offsetTop+=(parseFloat(jQuery(_self).css('paddingTop')))?parseFloat(jQuery(_self).css('paddingTop')):0;ps_hover=jQuery('<div id="ps_hover"> \ 163 <div class="ps_hd"> \ 164 <div class="ps_c"></div> \ 165 </div> \ 166 <div class="ps_bd"> \ 167 <div class="ps_c"> \ 168 <div class="ps_s"> \ 169 </div> \ 170 </div> \ 171 </div> \ 172 <div class="ps_ft"> \ 173 <div class="ps_c"></div> \ 174 </div> \ 175 <div id="ps_title"> \ 176 <div class="ps_tt_l"> \ 177 '+settings.share_label+' \ 178 </div> \ 179 </div> \ 180 </div>').css({'width':jQuery(_self).width()+(settings.hover_padding+8)*2,'to
180p':jQuery(_self).position().top-settings.hover_padding-8+parseFloat(jQuery(_self).css('marginTop'))+offsetTop,'left':jQuery(_self).position().left-settings.hover_padding-8+parseFloat(jQuery(_self).css('marginLeft'))+offsetLeft}).hide().insertAfter(_container).fadeIn(settings.animationSpeed);jQuery('#ps_title').animate({top:-15},settings.animationSpeed);jQuery(ps_hover).find('>.ps_bd .ps_s').height(jQuery(_self).height()+settings.hover_padding*2);fixCrappyBrowser('ps_hover',this);DragHandler.attach(jQuery(this)[0]);jQuery(this)[0].dragBegin=function(e){_self=this;show_timer=window.setTimeout(function(){jQuery('object,embed').css('visibility','hidden');jQuery(_self).animate({'opacity':0},settings.animationSpeed);jQuery(ps_hover).remove();overlay.show();tooltip.show(_self);tooltip.follow(e.mouseX,e.mouseY);sharing.show();},200);};jQuery(this)[0].drag=function(e){tooltip.follow(e.mouseX,e.mouseY);} 181jQuery(this)[0].dragEnd=function(element,x,y){jQuery('object,embed').css('visibility','visible');jQuery(this).attr('style',0);overlay.hide();tooltip.checkCollision(element.mouseX,element.mouseY);};},function(){jQuery(ps_hover).fadeOut(settings.animationSpeed,function(){jQuery(this).remove()});}).click(function(){clearTimeout(show_timer);});var tooltip={show:function(caller){tooltip.link_to_share=(jQuery(caller).attr('href')!="#")?jQuery(caller).attr('href'):location.href;if(settings.urlshortener.bitly.active){if(window.BitlyCB){BitlyCB.myShortenCallback=function(data){var result;for(var r in data.results){result=data.results[r];result['longUrl']=r;break;};tooltip.link_to_share=result['shortUrl'];};BitlyClient.shorten(tooltip.link_to_share,'BitlyCB.myShortenCallback');};};attributes=jQuery(caller).attr('data-gal').split(';');for(var i=1;i<attributes.length;i++){attributes[i]=attributes[i].split(':');};desc=(jQuery('meta[name=Description]').attr('content'))?jQuery('meta[name=Description]').attr('content'):"";if(attributes.length==1){attributes[1]=['title',document.title];attributes[2]=['excerpt',desc];} 182ps_tooltip=jQuery('<div id="ps_tooltip"> \ 183 <div class="ps_hd"> \ 184 <div class="ps_c"></div> \ 185 </div> \ 186 <div class="ps_bd"> \ 187 <div class="ps_c"> \ 188 <div class="ps_s"> \ 189 </div> \ 190 </div> \ 191 </div> \ 192 <div class="ps_ft"> \ 193 <div class="ps_c"></div> \ 194 </div> \ 195 </div>').appendTo('body');jQuery(ps_tooltip).find('.ps_s').html("<p><strong>"+attributes[1][1]+"</strong><br />"+attributes[2][1]+"</p>");fixCrappyBrowser('ps_tooltip');},checkCollision:function(x,y){collision="";scrollPos=_getScroll();jQuery.each(websites,function(i){if((x+scrollPos.scrollLeft>jQuery(this).offset().left&&x+scrollPos.scrollLeft<jQuery(this).offset().left+jQuery(this).width())&&(y+scrollPos.scrollTop>jQuery(this).offset().top&&y+scrollPos.scrollTop<jQuery(this).offset().top+jQuery(this).height())){collision=jQuery(this).find('a');}});if(collision!=""){jQuery(collision).click();} 196sharing.hide();jQuery('#ps_tooltip').remove();},follow:function(x,y){scrollPos=_getScroll();settings.tooltip.offsetTop=(settings.tooltip.offsetTop)?settings.tooltip.offsetTop:0;settings.tooltip.offsetLeft=(settings.tooltip.offsetLeft)?settings.tooltip.offsetLeft:0;jQuery('#ps_tooltip').css({'top':y+settings.tooltip.offsetTop+scrollPos.scrollTop,'left':x+settings.tooltip.offsetLeft+scrollPos.scrollLeft});}} 197var sharing={show:function(){websites_container=jQuery('<ul />');jQuery.each(settings.websites,function(i){var _self=this;if(_self.active){link=jQuery('<a />').attr({'href':'#'}).html('<img src="'+_self.icon+'" alt="'+_self.title+'" width="'+_self.sizes.width+'" height="'+_self.sizes.height+'" />').hover(function(){sharing.showTitle(_self.title,jQuery(this).width(),jQuery(this).position().left,jQuery(this).height(),jQuery(this).position().top);},function(){sharing.hideTitle();}).click(function(){shareURL=(_self.encode)?encodeURIComponent(tooltip.link_to_share):tooltip.link_to_share;popup=window.open(_self.url+shareURL,"prettySociable","location=0,status=0,scrollbars=1,width="+settings.popup.width+",height="+sett
197ings.popup.height);});jQuery('<li>').append(link).appendTo(websites_container);};});jQuery('<div id="ps_websites"><p class="ps_label"></p></div>').append(websites_container).appendTo('body');fixCrappyBrowser('ps_websites');scrollPos=_getScroll();jQuery('#ps_websites').css({'top':jQuery(window).height()/2-jQuery('#ps_websites').height()/2+scrollPos.scrollTop,'left':jQuery(window).width()/2-jQuery('#ps_websites').width()/2+scrollPos.scrollLeft});websites=jQuery.makeArray(jQuery('#ps_websites li'));},hide:function(){jQuery('#ps_websites').fadeOut(settings.animationSpeed,function(){jQuery(this).remove()});},showTitle:function(title,width,left,height,top){jQuerylabel=jQuery('#ps_websites .ps_label');jQuerylabel.text(settings.share_on_label+title) 198jQuerylabel.css({'left':left-jQuerylabel.width()/2+width/2,'opacity':0,'display':'block'}).stop().animate({'opacity':1,'top':top-height+45},settings.animationSpeed);},hideTitle:function(){jQuery('#ps_websites .ps_label').stop().animate({'opacity':0,'top':10},settings.animationSpeed);}};var overlay={show:function(){jQuery('<div id="ps_overlay" />').css('opacity',0).appendTo('body').height(jQuery(document).height()).fadeTo(settings.animationSpeed,settings.opacity);},hide:function(){jQuery('#ps_overlay').fadeOut(settings.animationSpeed,function(){jQuery(this).remove();});}} 199var DragHandler={_oElem:null,attach:function(oElem){oElem.onmousedown=DragHandler._dragBegin;oElem.dragBegin=new Function();oElem.drag=new Function();oElem.dragEnd=new Function();return oElem;},_dragBegin:function(e){var oElem=DragHandler._oElem=this;if(isNaN(parseInt(oElem.style.left))){oElem.style.left='0px';} 200if(isNaN(parseInt(oElem.style.top))){oElem.style.top='0px';} 201var x=parseInt(oElem.style.left);var y=parseInt(oElem.style.top);e=e?e:window.event;oElem.mouseX=e.clientX;oElem.mouseY=e.clientY;oElem.dragBegin(oElem,x,y);document.onmousemove=DragHandler._drag;document.onmouseup=DragHandler._dragEnd;return false;},_drag:function(e){var oElem=DragHandler._oElem;var x=parseInt(oElem.style.left);var y=parseInt(oElem.style.top);e=e?e:window.event;oElem.style.left=x+(e.clientX-oElem.mouseX)+'px';oElem.style.top=y+(e.clientY-oElem.mouseY)+'px';oElem.mouseX=e.clientX;oElem.mouseY=e.clientY;oElem.drag(oElem,x,y);return false;},_dragEnd:function(){var oElem=DragHandler._oElem;var x=parseInt(oElem.style.left);var y=parseInt(oElem.style.top);oElem.dragEnd(oElem,x,y);document.onmousemove=null;document.onmouseup=null;DragHandler._oElem=null;}};function _getScroll(){if(self.pageYOffset){scrollTop=self.pageYOffset;scrollLeft=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft;}else if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft;} 202return{scrollTop:scrollTop,scrollLeft:scrollLeft};};function fixCrappyBrowser(element,caller){if(jQuery.browser.msie&&jQuery.browser.version==6){if(typeof DD_belatedPNG!='undefined'){if(element=='ps_websites'){jQuery('#'+element+' img').each(function(){DD_belatedPNG.fixPng(jQuery(this)[0]);});}else{DD_belatedPNG.fixPng(jQuery('#'+element+' .ps_hd .ps_c')[0]);DD_belatedPNG.fixPng(jQuery('#'+element+' .ps_hd')[0]);DD_belatedPNG.fixPng(jQuery('#'+element+' .ps_bd .ps_c')[0]);DD_belatedPNG.fixPng(jQuery('#'+element+' .ps_bd')[0]);DD_belatedPNG.fixPng(jQuery('#'+element+' .ps_ft .ps_c')[0]);DD_belatedPNG.fixPng(jQuery('#'+element+' .ps_ft')[0]);}};};}};})(jQuery); 203 204 205//prettySocialble init script 206jQuery(document).ready(function () { 207 jQuery.prettySociable(); 208 jQuery.prettySociable.settings.urlshortener.bitly.active = true; 209});
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.