(function(){function t(a,b,c,d){function e(){if(f)return null;var h=b;b.childNodes&&b.childNodes.length&&!l?b=b[d?"lastChild":"firstChild"]:b[d?"previousSibling":"nextSibling"]?(b=b[d?"previousSibling":"nextSibling"],l=!1):b.parentNode&&(b=b.parentNode,b===a&&(f=!0),l=!0,e());h===c&&(f=!0);return h}d=!!d;b=b||a[d?"lastChild":"firstChild"];var f=!b,l=!1;return e}function v(a){for(var b=1;b\u2026\\n\u00a0\\*]+",selectable:"selectable-content",marker:"txtselect_marker",ignored:null,selectMessage:null,location:new g,validate:!1,enableHaschange:!0, onMark:null,onUnmark:null,onHashRead:function(){var a=A(this.selectable,"user_selection_true");a&&!this.hashWasRead&&(this.hashWasRead=!0,window.setTimeout(function(){for(var b=0,c=0;a;)b+=a.offsetLeft,c+=a.offsetTop,a=a.offsetParent;window.scrollTo(b,c-150)},1))},isBlock:function(a){return"BR"==a.nodeName||-1==G(I(a,"display"),["inline","none"])}};n.prototype={init:function(){this.selectable="string"==typeof this.options.selectable?document.getElementById(this.options.selectable):this.options.selectable; "string"==typeof this.options.marker?(this.marker=document.getElementById(this.options.marker),null===this.marker&&(this.marker=document.createElement("a"),this.marker.setAttribute("id",this.options.marker),this.marker.setAttribute("href","#"),document.body.appendChild(this.marker))):this.marker=this.options.marker;if("string"!=typeof this.options.regexp)throw"regexp is set as string";this.regexp=new RegExp(this.options.regexp,"ig");this.selectable&&(this.isIgnored=this.constructIgnored(this.options.ignored), this.options.selectMessage&&this.initMessage(),this.enumerateElements(),"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch?(this.touchEnd=p(this.touchEnd,this),m(this.selectable,"touchend",this.touchEnd)):(this.mouseUp=p(this.mouseUp,this),m(this.selectable,"mouseup",this.mouseUp)),this.markerClick=p(this.markerClick,this),m(this.marker,"click",this.markerClick),m(this.marker,"touchend",this.markerClick),this.hideMarker=p(this.hideMarker,this),m(document,"click",this.hideMarker), this.options.enableHaschange&&(this.hashChange=p(this.hashChange,this),this.options.location.addHashchange(this.hashChange)),this.readHash())},destroy:function(){u(this.marker,"show");this.options.selectMessage&&this.hideMessage();r(this.selectable,"mouseup",this.mouseUp);r(this.selectable,"touchEnd",this.touchEnd);r(this.marker,"click",this.markerClick);r(this.marker,"touchend",this.markerClick);r(document,"click",this.hideMarker);this.options.location.destroy();var a=q(this.selectable,"user_selection_true"); this.removeTextSelection(a);for(var b=q(this.selectable,"closewrap"),a=b.length;a--;)b[a].parentNode.removeChild(b[a]);b=q(this.selectable,"masha_index");for(a=b.length;a--;)b[a].parentNode.removeChild(b[a])},mouseUp:function(a){var b=J(a);window.setTimeout(p(function(){this.showMarker(b)},this),1)},touchEnd:function(){window.setTimeout(p(function(){var a=window.getSelection();if(a.rangeCount&&(a=a.getRangeAt(0).getClientRects(),a.length)){var a=a[a.length-1],b=document.body;this.showMarker({x:a.left+ a.width+b.scrollLeft,y:a.top+a.height/2+b.scrollTop})}},this),1)},hashChange:function(){if(this.lastHash!=this.options.location.getHash()){var a=[],b;for(b in this.ranges)a.push(b);this.deleteSelections(a);this.readHash()}},hideMarker:function(a){(a.target||a.srcElement)!=this.marker&&u(this.marker,"show");this.lastRange=null},markerClick:function(a){D(a);a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;a=a.target||a.srcElement;if(!k(this.marker,"masha-marker-bar")||k(a,"masha-social")||k(a, "masha-marker"))if(u(this.marker,"show"),this.rangeIsSelectable()&&(this.addSelection(),this.updateHash(),this.options.onMark&&this.options.onMark.call(this),this.options.selectMessage&&this._showMessage(),k(a,"masha-social")&&(a=a.getAttribute("data-pattern"))))a=a.replace("{url}",encodeURIComponent(window.location.toString())),this.openShareWindow(a)},openShareWindow:function(a){window.open(a,"","status=no,toolbar=no,menubar=no,width=800,height=400")},getMarkerCoords:function(a,b){return{x:b.x+ 5,y:b.y-33,width:b.width}},getPositionChecksum:function(a){for(var b="",c=0;3>c;c++){var d=(a()||"").charAt(0);d&&(d=d.charCodeAt(0)%62,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890".charAt(d));b+=d}return b},showMarker:function(a){var b=new RegExp(this.options.regexp,"g"),c=window.getSelection().toString();""!=c&&b.test(c)&&this.rangeIsSelectable()&&(a=this.getMarkerCoords(this.marker,a),this.marker.style.top=a.y+"px",this.marker.style.left=a.x+"px",a=window.getSelection(),a.rangeCount&& (this.lastRange=a.getRangeAt(0)),z(this.marker,"show"))},deleteSelections:function(a){for(var b=a.length;b--;){var c=a[b],d=q(this.selectable,c),e=A(d[d.length-1],"closewrap");e.parentNode.removeChild(e);this.removeTextSelection(d);delete this.ranges[c]}},removeTextSelection:function(a){for(var b=a.length;b--;){for(var c=a[b],d=0;d").attr("href",location); var b=encodeURI($('#news-title').text()); var a=encodeURIComponent(location); $("#share-popup .social .tw").attr("href","http://twitter.com/share?url="+a+"&text="+b); $("#share-popup .social .tw").attr("onclick","window.open('http://twitter.com/share?url="+a+"&text="+b+"','plusshare','width=650,height=400,resizable=1,scrollbars=1,left='+(screen.availWidth/2-325)+',top='+(screen.availHeight/2-200)+'');return false;"); $("#share-popup .social .fb").attr("href","http://www.facebook.com/share.php?u="+a); $("#share-popup .social .fb").attr("onclick","window.open('http://www.facebook.com/share.php?u="+a+"','plusshare','width=650,height=400,resizable=1,scrollbars=1,left='+(screen.availWidth/2-325)+',top='+(screen.availHeight/2-200)+'');return false;"); $("#share-popup .social .vk").attr("href","http://vk.com/share.php?url="+a); $("#share-popup .social .vk").attr("onclick","window.open('http://vk.com/share.php?url="+a+"','plusshare','width=650,height=400,resizable=1,scrollbars=1,left='+(screen.availWidth/2-325)+',top='+(screen.availHeight/2-200)+'');return false;"); $("#share-popup .social .gp").attr("href","https://plus.google.com/share?url="+ a); $("#share-popup .social .gp").attr("onclick","window.open('https://plus.google.com/share?url="+a+"','plusshare','width=650,height=500,resizable=1,scrollbars=1,left='+(screen.availWidth/2-325)+',top='+(screen.availHeight/2-250)+'');return false;"); }; function showSharePopup(b){ a=$(b).offset(); $("#share-popup").fadeTo('fast', 1); $("#share-popup").addClass('show').css({ left:a.left+5+$("#share-popup").width()>=$(window).width()?$(window).width()-$("#share-popup").width()-15:a.left+5, top:a.top-$("#share-popup").height()-25 }); }; function hideSharePopup(b,a){ $("#share-popup").removeClass('show'); $("#share-popup").hide(); }; jQuery(function($) { var timeoutHover = null; $("body").append(''); $("#share-popup").hover(function() { if(typeof timeout_hover != "undefined") { window.clearTimeout(timeout_hover) } }, function() { timeout_hover = window.setTimeout(function() { hideSharePopup() }, 2E3) }); MaSha.instance = new MaSha({selectable:$("#dle-content")[0], "ignored":".ignore-select", onMark:function() { updateSharePopupContent(); showSharePopup($(".num" + (this.counter - 1), $(this.selectable))[0]) }, onUnmark:function() { "undefined" != typeof hideSharePopup && hideSharePopup("", !0); updateSharePopupContent() }}); updateSharePopupContent() });