(function(){function r(a,b,c,d){function e(){if(f)return null;var h=b;b.childNodes&&b.childNodes.length&&!k?b=b[d?"lastChild":"firstChild"]:b[d?"previousSibling":"nextSibling"]?(b=b[d?"previousSibling":"nextSibling"],k=!1):b.parentNode&&(b=b.parentNode,b===a&&(f=!0),k=!0,e());h===c&&(f=!0);return h}d=!!d;b=b||a[d?"lastChild":"firstChild"];var f=!b,k=!1;return e}function t(a){for(var b=1;b\u2026\\n\u00a0\\*]+",selectable:"selectable-content",marker:"txtselect_marker",ignored:null,selectMessage:null,location:new j,validate:!1,enableHaschange:!0,onMark:null,onUnmark:null,onHashRead:function(){var a=z(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){var b;if(!(b="BR"==a.nodeName)){b="display";var c="";document.defaultView&&document.defaultView.getComputedStyle?c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b):a.currentStyle&&(b=b.replace(/\-(\w)/g,function(a,b){return b.toUpperCase()}),c=a.currentStyle[b]);b=-1==E(c,["inline","none"])}return b}};m.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=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),l(this.selectable,"touchend",this.touchEnd)):(this.mouseUp=p(this.mouseUp,this),l(this.selectable,"mouseup",this.mouseUp)),this.markerClick=p(this.markerClick,this),l(this.marker,"click",this.markerClick), l(this.marker,"touchend",this.markerClick),this.hideMarker=p(this.hideMarker,this),l(document,"click",this.hideMarker),this.options.enableHaschange&&(this.hashChange=p(this.hashChange,this),this.options.location.addHashchange(this.hashChange)),this.readHash())},destroy:function(){s(this.marker,"show");this.options.selectMessage&&this.hideMessage();q(this.selectable,"mouseup",this.mouseUp);q(this.selectable,"touchEnd",this.touchEnd);q(this.marker,"click",this.markerClick);q(this.marker,"touchend", this.markerClick);q(document,"click",this.hideMarker);this.options.location.destroy();var a=n(this.selectable,"user_selection_true");this.removeTextSelection(a);for(var b=n(this.selectable,"closewrap"),a=b.length;a--;)b[a].parentNode.removeChild(b[a]);b=n(this.selectable,"masha_index");for(a=b.length;a--;)b[a].parentNode.removeChild(b[a])},mouseUp:function(a){var b;if(null==a.pageX){var c=document.documentElement,d=document.body;b={x:a.clientX+(c&&c.scrollLeft||d&&d.scrollLeft||0)-(c.clientLeft|| 0),y:a.clientY+(c&&c.scrollTop||d&&d.scrollTop||0)-(c.clientTop||0)}}else b={x:a.pageX,y:a.pageY};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();if(a=a[a.length-1])var b={x:a.left+a.width+document.body.scrollLeft,y:a.top+a.height/2+document.body.scrollTop};this.showMarker(b)}},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&&s(this.marker,"show")},markerClick:function(a){C(a);a.stopPropagation?a.stopPropagation():a.cancelBubble=!0;a=a.target||a.srcElement;if(!g(this.marker,"masha-marker-bar")||g(a,"masha-social")||g(a,"masha-marker"))if(s(this.marker,"show"),this.rangeIsSelectable()&&(this.addSelection(),this.updateHash(),this.options.onMark&&this.options.onMark.call(this),this.options.selectMessage&& this._showMessage(),g(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}},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=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",x(this.marker,"show"))},deleteSelections:function(a){for(var b=a.length;b--;){var c=a[b],d=n(this.selectable,c),e=z(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() });