Plugin Directory

Changeset 1469773


Ignore:
Timestamp:
08/08/2016 07:57:08 AM (10 years ago)
Author:
inboundrocket
Message:

version 0.4

Location:
selection-sharer/tags/0.4
Files:
6 copied

Legend:

Unmodified
Added
Removed
  • selection-sharer/tags/0.4/css/selection-sharer.css

    r1091760 r1469773  
    1 @keyframes selectionSharerPopover-animation{0%{transform:matrix(0.97,0,0,1,0,12);filter:alpha(opacity=0);opacity:0}20%{transform:matrix(0.99,0,0,1,0,2);filter:alpha(opacity=70);opacity:.7}40%{transform:matrix(1,0,0,1,0,-1);filter:alpha(opacity=100);opacity:1}100%,70%{transform:matrix(1,0,0,1,0,0);filter:alpha(opacity=100);opacity:1}}#selectionSharerPopover{display:none;position:absolute;top:-100px;left:-100px;z-index:1010}#selectionSharerPopover:after{content:'';display:block;position:absolute;bottom:-3px;left:50%;margin-left:-4px;width:8px;height:8px;-webkit-transform:rotate(45deg);transform:rotate(45deg);background:#262625;box-shadow:0 0 2px #262625}#selectionSharerPopover.anim{transition:top .075s ease-out;animation:selectionSharerPopover-animation 180ms forwards linear;-webkit-animation:selectionSharerPopover-animation 180ms forwards linear}#selectionSharerPopover-inner{position:relative;overflow:hidden;-webkit-border-radius:5px;border-radius:5px;border:1px solid;border-color:#262625 #1c1c1b #121211;box-shadow:0 1px 3px -1px rgba(0,0,0,.7),inset 0 0 1px rgba(255,255,255,.07),inset 0 0 2px rgba(255,255,255,.15);background-image:linear-gradient(to bottom,rgba(49,49,47,.97),#262625);background-repeat:repeat-x}#selectionSharerPopover .selectionSharerPopover-clip{position:absolute;bottom:-11px;display:block;left:50%;clip:rect(12px 24px 24px 0);margin-left:-12px;width:24px;height:24px;line-height:24px}#selectionSharerPopover .selectionSharerPopover-arrow{display:block;width:20px;height:20px;-webkit-transform:rotate(45deg) scale(0.5);transform:rotate(45deg) scale(0.5);background-color:#454543;border:2px solid #121211;box-sizing:content-box}.selectionSharer ul{padding:0;display:inline}.selectionSharer ul li{float:left;list-style:none;background:0 0;margin:0}.selectionSharer a.action{display:block;text-indent:-200px;margin:5px 7px;width:20px;height:20px;border:none}.selectionSharer a:hover{color:#ccc}.selectionSharer a.tweet{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="171" height="139"><g transform="translate(-282.32053,-396.30734)"><path style="fill:white" d="m 453.82593,412.80619 c -6.3097,2.79897 -13.09189,4.68982 -20.20852,5.54049 7.26413,-4.35454 12.84406,-11.24992 15.47067,-19.46675 -6.79934,4.03295 -14.3293,6.96055 -22.34461,8.53841 -6.41775,-6.83879 -15.56243,-11.111 -25.68298,-11.111 -19.43159,0 -35.18696,15.75365 -35.18696,35.18525 0,2.75781 0.31128,5.44359 0.91155,8.01875 -29.24344,-1.46723 -55.16995,-15.47582 -72.52461,-36.76396 -3.02879,5.19662 -4.76443,11.24048 -4.76443,17.6891 0,12.20777 6.21194,22.97747 15.65332,29.28716 -5.76773,-0.18265 -11.19331,-1.76565 -15.93716,-4.40083 -0.004,0.14663 -0.004,0.29412 -0.004,0.44248 0,17.04767 12.12889,31.26806 28.22555,34.50266 -2.95247,0.80436 -6.06101,1.23398 -9.26989,1.23398 -2.2673,0 -4.47114,-0.22124 -6.62011,-0.63114 4.47801,13.97857 17.47214,24.15143 32.86992,24.43441 -12.04227,9.43796 -27.21366,15.06335 -43.69965,15.06335 -2.84014,0 -5.64082,-0.16722 -8.39349,-0.49223 15.57186,9.98421 34.06703,15.8094 53.93768,15.8094 64.72024,0 100.11301,-53.61524 100.11301,-100.11387 0,-1.52554 -0.0343,-3.04251 -0.10204,-4.55261 6.87394,-4.95995 12.83891,-11.15646 17.55618,-18.21305 z" /></g></svg>') 2px/18px no-repeat}.selectionSharer a.facebook{background:url('data:image/svg+xml;utf8,<svg viewBox="0 0 33 33" width="25" height="25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path style="fill:white" d="M 17.996,32L 12,32 L 12,16 l-4,0 l0-5.514 l 4-0.002l-0.006-3.248C 11.993,2.737, 13.213,0, 18.512,0l 4.412,0 l0,5.515 l-2.757,0 c-2.063,0-2.163,0.77-2.163,2.209l-0.008,2.76l 4.959,0 l-0.585,5.514L 18,16L 17.996,32z"></path></g></svg>') 0/18px no-repeat;display:none}.selectionSharer a.linkedin{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="300px" height="300px" viewBox="0 0 300 300" enable-background="new 0 0 300 300" xml:space="preserve"><g transform="translate(0.000000,300.000000) scale(0.100000,-0.100000)"><path fill="white" d="M343.999,2812.002C222.998,2770,155,2672.002,155,2540c0-62.002,5-85,27.998-132.998 c108.003-219.004,459.004-206.001,560,21.997c16.001,36.001,18.003,60,15,125c-5,97.002-27.998,146.001-91.997,203.003 C586.001,2827.002,453.999,2850,343.999,2812.002z"/> <path fill="white" d="M2035.996,2052.998c-150.996-31.997-257.998-92.998-365-210l-68.994-75l-7.002,79.004 c-5,42.998-10.996,100.996-14.004,127.998l-5.996,50l-253.999,2.998L1067.998,2030l6.001-62.002c3.003-35,8.999-452.998,12.002-930 L1092.998,170h288.003H1670l2.002,597.998C1675,1365,1675,1365,1697.998,1410.996c34.004,70,87.002,125.005,150,156.006 c75,36.997,192.998,38.999,257.998,5c59.004-31.001,111.006-95,137.002-172.002c21.006-64.004,22.002-77.002,25-647.002 L2270.996,170h290h290l-3.994,642.998c-2.998,547.998-6.006,652.002-20,707.002c-42.998,172.998-97.002,280-187.998,371.001 C2494.004,2037.998,2257.002,2101.001,2035.996,2052.998z"/><path fill="white" d="M167.002,2022.998c-4.004-2.998-7.002-421.997-7.002-930V170h295h295l-2.002,927.998L745,2025 l-286.001,2.998C302.002,2028.999,171.001,2027.002,167.002,2022.998z"/></g></svg>') 2px/18px no-repeat}.selectionSharer a.email{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="94" height="64"><g transform="translate(-10, -10)" fill="transparent"><rect x="0" y="0" width="114" height="114"></rect><path d="M12,12 L102,12 L102,72 L12,72 L12,12 Z M16,12 L53,49 C55.6666667,51 58.3333333,51 61,49 L98,12 L16,12 Z M15,72 L45,42 L15,72 Z M69,42 L99,72 L69,42 Z" stroke="white" stroke-width="5"></path></g></svg>') 0/20px no-repeat}#selectionSharerPopunder.fixed{transition:bottom .5s ease-in-out;width:100%;position:fixed;left:0;bottom:-50px}.selectionSharer{transition:-webkit-transform .6s ease-in-out}.selectionSharer.moveDown{-webkit-transform:translate3d(0,60px,0)}#selectionSharerPopunder{position:absolute;left:0;width:100%;height:0;transition:height .5s ease-in-out;background:#ccc;border:none;box-shadow:inset 0 10px 5px -10px rgba(0,0,0,.5),inset 0 -10px 5px -10px rgba(0,0,0,.5);border-radius:0;overflow:hidden}#selectionSharerPopunder.show{height:50px}.selectionSharerPlaceholder{height:1em;margin-bottom:-2em;transition:height .5s ease-in-out}.selectionSharerPlaceholder.show{height:50px!important}#selectionSharerPopunder-inner ul{overflow:hidden;float:right;margin:0}#selectionSharerPopunder-inner ul li{padding:5px 4px 5px 1px;overflow:hidden}#selectionSharerPopunder-inner label{color:#fff;font-weight:300;line-height:50px;margin:0 7px 0 10px}#selectionSharerPopunder-inner a{width:25px;height:25px;background-size:25px}#selectionSharerPopunder-inner a.tweet{background-position:0 2px}
     1@keyframes selectionSharerPopover-animation{0%{transform:matrix(0.97,0,0,1,0,12);filter:alpha(opacity=0);opacity:0}20%{transform:matrix(0.99,0,0,1,0,2);filter:alpha(opacity=70);opacity:.7}40%{transform:matrix(1,0,0,1,0,-1);filter:alpha(opacity=100);opacity:1}100%,70%{transform:matrix(1,0,0,1,0,0);filter:alpha(opacity=100);opacity:1}}#selectionSharerPopover{display:none;position:absolute;top:-100px;left:-100px;z-index:1010}#selectionSharerPopover:after{content:'';display:block;position:absolute;bottom:-3px;left:50%;margin-left:-4px;width:8px;height:8px;-webkit-transform:rotate(45deg);transform:rotate(45deg);background:#262625;box-shadow:0 0 2px #262625}#selectionSharerPopover.anim{transition:top .075s ease-out;animation:selectionSharerPopover-animation 180ms forwards linear;-webkit-animation:selectionSharerPopover-animation 180ms forwards linear}#selectionSharerPopover-inner{position:relative;overflow:hidden;-webkit-border-radius:5px;border-radius:5px;border:1px solid;border-color:#262625 #1c1c1b #121211;box-shadow:0 1px 3px -1px rgba(0,0,0,.7),inset 0 0 1px rgba(255,255,255,.07),inset 0 0 2px rgba(255,255,255,.15);background:linear-gradient(to bottom,rgba(49,49,47,.97),#262625);background-repeat:repeat-x}#selectionSharerPopover .selectionSharerPopover-clip{position:absolute;bottom:-11px;display:block;left:50%;clip:rect(12px 24px 24px 0);margin-left:-12px;width:24px;height:24px;line-height:24px}#selectionSharerPopover .selectionSharerPopover-arrow{display:block;width:20px;height:20px;-webkit-transform:rotate(45deg) scale(0.5);transform:rotate(45deg) scale(0.5);background-color:#454543;border:2px solid #121211;box-sizing:content-box}.selectionSharer ul{padding:0;display:inline}.selectionSharer ul li{float:left;list-style:none;background:0 0;margin:0}.selectionSharer a.action{display:block;text-indent:-200px;margin:5px 7px;width:20px;height:20px;border:none}.selectionSharer a:hover{color:#ccc}.selectionSharer a.tweet{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="171" height="139"><g transform="translate(-282.32053,-396.30734)"><path style="fill:white" d="m 453.82593,412.80619 c -6.3097,2.79897 -13.09189,4.68982 -20.20852,5.54049 7.26413,-4.35454 12.84406,-11.24992 15.47067,-19.46675 -6.79934,4.03295 -14.3293,6.96055 -22.34461,8.53841 -6.41775,-6.83879 -15.56243,-11.111 -25.68298,-11.111 -19.43159,0 -35.18696,15.75365 -35.18696,35.18525 0,2.75781 0.31128,5.44359 0.91155,8.01875 -29.24344,-1.46723 -55.16995,-15.47582 -72.52461,-36.76396 -3.02879,5.19662 -4.76443,11.24048 -4.76443,17.6891 0,12.20777 6.21194,22.97747 15.65332,29.28716 -5.76773,-0.18265 -11.19331,-1.76565 -15.93716,-4.40083 -0.004,0.14663 -0.004,0.29412 -0.004,0.44248 0,17.04767 12.12889,31.26806 28.22555,34.50266 -2.95247,0.80436 -6.06101,1.23398 -9.26989,1.23398 -2.2673,0 -4.47114,-0.22124 -6.62011,-0.63114 4.47801,13.97857 17.47214,24.15143 32.86992,24.43441 -12.04227,9.43796 -27.21366,15.06335 -43.69965,15.06335 -2.84014,0 -5.64082,-0.16722 -8.39349,-0.49223 15.57186,9.98421 34.06703,15.8094 53.93768,15.8094 64.72024,0 100.11301,-53.61524 100.11301,-100.11387 0,-1.52554 -0.0343,-3.04251 -0.10204,-4.55261 6.87394,-4.95995 12.83891,-11.15646 17.55618,-18.21305 z" /></g></svg>') 2px/18px no-repeat}.selectionSharer a.facebook{background:url('data:image/svg+xml;utf8,<svg viewBox="0 0 33 33" width="25" height="25" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path style="fill:white" d="M 17.996,32L 12,32 L 12,16 l-4,0 l0-5.514 l 4-0.002l-0.006-3.248C 11.993,2.737, 13.213,0, 18.512,0l 4.412,0 l0,5.515 l-2.757,0 c-2.063,0-2.163,0.77-2.163,2.209l-0.008,2.76l 4.959,0 l-0.585,5.514L 18,16L 17.996,32z"></path></g></svg>') 0/18px no-repeat;display:none}.selectionSharer a.linkedin{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="300px" height="300px" viewBox="0 0 300 300" enable-background="new 0 0 300 300" xml:space="preserve"><g transform="translate(0.000000,300.000000) scale(0.100000,-0.100000)"><path fill="white" d="M343.999,2812.002C222.998,2770,155,2672.002,155,2540c0-62.002,5-85,27.998-132.998 c108.003-219.004,459.004-206.001,560,21.997c16.001,36.001,18.003,60,15,125c-5,97.002-27.998,146.001-91.997,203.003 C586.001,2827.002,453.999,2850,343.999,2812.002z"/> <path fill="white" d="M2035.996,2052.998c-150.996-31.997-257.998-92.998-365-210l-68.994-75l-7.002,79.004 c-5,42.998-10.996,100.996-14.004,127.998l-5.996,50l-253.999,2.998L1067.998,2030l6.001-62.002c3.003-35,8.999-452.998,12.002-930 L1092.998,170h288.003H1670l2.002,597.998C1675,1365,1675,1365,1697.998,1410.996c34.004,70,87.002,125.005,150,156.006 c75,36.997,192.998,38.999,257.998,5c59.004-31.001,111.006-95,137.002-172.002c21.006-64.004,22.002-77.002,25-647.002 L2270.996,170h290h290l-3.994,642.998c-2.998,547.998-6.006,652.002-20,707.002c-42.998,172.998-97.002,280-187.998,371.001 C2494.004,2037.998,2257.002,2101.001,2035.996,2052.998z"/><path fill="white" d="M167.002,2022.998c-4.004-2.998-7.002-421.997-7.002-930V170h295h295l-2.002,927.998L745,2025 l-286.001,2.998C302.002,2028.999,171.001,2027.002,167.002,2022.998z"/></g></svg>') 2px/18px no-repeat}.selectionSharer a.email{background:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="94" height="64"><g transform="translate(-10, -10)" fill="transparent"><rect x="0" y="0" width="114" height="114"></rect><path d="M12,12 L102,12 L102,72 L12,72 L12,12 Z M16,12 L53,49 C55.6666667,51 58.3333333,51 61,49 L98,12 L16,12 Z M15,72 L45,42 L15,72 Z M69,42 L99,72 L69,42 Z" stroke="white" stroke-width="5"></path></g></svg>') 0/20px no-repeat}#selectionSharerPopunder.fixed{transition:bottom .5s ease-in-out;width:100%;position:fixed;left:0;bottom:-50px}.selectionSharer{transition:-webkit-transform .6s ease-in-out}.selectionSharer.moveDown{-webkit-transform:translate3d(0,60px,0)}#selectionSharerPopunder{position:absolute;left:0;width:100%;height:0;transition:height .5s ease-in-out;background:#ccc;border:none;box-shadow:inset 0 10px 5px -10px rgba(0,0,0,.5),inset 0 -10px 5px -10px rgba(0,0,0,.5);border-radius:0;overflow:hidden}#selectionSharerPopunder.show{height:50px}.selectionSharerPlaceholder{height:1em;margin-bottom:-2em;transition:height .5s ease-in-out}.selectionSharerPlaceholder.show{height:50px!important}#selectionSharerPopunder-inner ul{overflow:hidden;float:right;margin:0}#selectionSharerPopunder-inner ul li{padding:5px 4px 5px 1px;overflow:hidden}#selectionSharerPopunder-inner label{color:#fff;font-weight:300;line-height:50px;margin:0 7px 0 10px}#selectionSharerPopunder-inner a{width:25px;height:25px;background-size:25px}#selectionSharerPopunder-inner a.tweet{background-position:0 2px}
  • selection-sharer/tags/0.4/js/selection-sharer.js

    r1091760 r1469773  
    1 !function(e){var t=function(t){var n=this;t=t||{},"string"==typeof t&&(t={elements:t}),this.sel=null,this.textSelection="",this.htmlSelection="",this.appId=e('meta[property="fb:app_id"]').attr("content")||e('meta[property="fb:app_id"]').attr("value"),this.url2share=e('meta[property="og:url"]').attr("content")||e('meta[property="og:url"]').attr("value")||window.location.href,this.getSelectionText=function(e){var t="",o="",e=e||window.getSelection();if(e.rangeCount){for(var i=document.createElement("div"),r=0,a=e.rangeCount;a>r;++r)i.appendChild(e.getRangeAt(r).cloneContents());o=i.textContent,t=i.innerHTML}return n.textSelection=o,n.htmlSelection=t||o,o},this.selectionDirection=function(e){var t=e||window.getSelection(),n=document.createRange();if(!t.anchorNode)return 0;n.setStart(t.anchorNode,t.anchorOffset),n.setEnd(t.focusNode,t.focusOffset);var o=n.collapsed?"backward":"forward";return n.detach(),o},this.showPopunder=function(){n.popunder=n.popunder||document.getElementById("selectionSharerPopunder");var e=window.getSelection(),t=n.getSelectionText(e);if(e.isCollapsed||t.length<10||!t.match(/ /))return n.hidePopunder();if(n.popunder.classList.contains("fixed"))return n.popunder.style.bottom=0;var o=e.getRangeAt(0),i=o.endContainer.parentNode;if(n.popunder.classList.contains("show")){if(Math.ceil(n.popunder.getBoundingClientRect().top)==Math.ceil(i.getBoundingClientRect().bottom))return;return n.hidePopunder(n.showPopunder)}if(i.nextElementSibling)n.pushSiblings(i);else{n.placeholder||(n.placeholder=document.createElement("div"),n.placeholder.className="selectionSharerPlaceholder");var r=window.getComputedStyle(i).marginBottom;n.placeholder.style.height=r,n.placeholder.style.marginBottom=-2*parseInt(r,10)+"px",i.parentNode.insertBefore(n.placeholder)}var a=window.pageYOffset+i.getBoundingClientRect().bottom;n.popunder.style.top=Math.ceil(a)+"px",setTimeout(function(){n.placeholder&&n.placeholder.classList.add("show"),n.popunder.classList.add("show")},0)},this.pushSiblings=function(e){for(;e=e.nextElementSibling;)e.classList.add("selectionSharer"),e.classList.add("moveDown")},this.hidePopunder=function(e){if(e=e||function(){},"fixed"==n.popunder)return n.popunder.style.bottom="-50px",e();n.popunder.classList.remove("show"),n.placeholder&&n.placeholder.classList.remove("show");for(var t=document.getElementsByClassName("moveDown");el=t[0];)el.classList.remove("moveDown");setTimeout(function(){n.placeholder&&document.body.insertBefore(n.placeholder),e()},600)},this.show=function(e){setTimeout(function(){var t=window.getSelection(),o=n.getSelectionText(t);if(!t.isCollapsed&&o&&o.length>10&&o.match(/ /)){var i=t.getRangeAt(0),r=i.getBoundingClientRect().top-5,a=r+window.scrollY-n.$popover.height(),l=0;if(e)l=e.pageX;else{var s=t.anchorNode.parentNode;l+=s.offsetWidth/2;do l+=s.offsetLeft;while(s=s.offsetParent)}switch(n.selectionDirection(t)){case"forward":l-=n.$popover.width();break;case"backward":l+=n.$popover.width();break;default:return}n.$popover.removeClass("anim").css("top",a+10).css("left",l).show(),setTimeout(function(){n.$popover.addClass("anim").css("top",a)},0)}},10)},this.hide=function(){n.$popover.hide()},this.smart_truncate=function(e,t){if(!e||!e.length)return e;var n=e.length>t,o=n?e.substr(0,t-1):e;return o=n?o.substr(0,o.lastIndexOf(" ")):o,n?o+"...":o},this.getRelatedTwitterAccounts=function(){var t=[],n=e('meta[name="twitter:creator"]').attr("content")||e('meta[name="twitter:creator"]').attr("value");n&&t.push(n);for(var o=document.getElementsByTagName("a"),i=0,r=o.length;r>i;i++)if(o[i].attributes.href&&"string"==typeof o[i].attributes.href.value){var a=o[i].attributes.href.value.match(/^https?:\/\/twitter\.com\/([a-z0-9_]{1,20})/i);a&&a.length>1&&-1==["widgets","intent"].indexOf(a[1])&&t.push(a[1])}return t.length>0?t.join(","):""},this.shareTwitter=function(e){e.preventDefault();var t="“"+n.smart_truncate(n.textSelection.trim(),114)+"”",o="http://twitter.com/intent/tweet?text="+encodeURIComponent(t)+"&related="+n.relatedTwitterAccounts+"&url="+encodeURIComponent(window.location.href);n.viaTwitterAccount&&t.length<114-n.viaTwitterAccount.length&&(o+="&via="+n.viaTwitterAccount);var i=640,r=440,a=screen.width/2-i/2,l=screen.height/2-r/2-100;return window.open(o,"share_twitter","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+i+", height="+r+", top="+l+", left="+a),n.hide(),!1},this.shareFacebook=function(e){e.preventDefault();var t=n.htmlSelection.replace(/<p[^>]*>/gi,"\n").replace(/<\/p>|  /gi,"").trim(),o="https://www.facebook.com/dialog/feed?app_id="+n.appId+"&display=page&name="+encodeURIComponent(t)+"&link="+encodeURIComponent(n.url2share)+"&redirect_uri="+encodeURIComponent(n.url2share);window.location.href=o,window.open(o,"share_linkedin","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+w+", height="+h+", top="+top+", left="+left)},this.shareLinkedIn=function(e){e.preventDefault();var t=n.htmlSelection.replace(/<p[^>]*>/gi,"\n").replace(/<\/p>|  /gi,"").trim(),o="https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(n.url2share)+"&title="+encodeURIComponent(t),i=640,r=440,a=screen.width/2-i/2,l=screen.height/2-r/2-100;window.open(o,"share_linkedin","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+i+", height="+r+", top="+l+", left="+a)},this.shareEmail=function(){var t=n.htmlSelection.replace(/<p[^>]*>/gi,"\n").replace(/<\/p>|  /gi,"").trim(),o={};return o.subject=encodeURIComponent("Quote from "+document.title),o.body=encodeURIComponent("“"+t+"”")+"%0D%0A%0D%0AFrom: "+document.title+"%0D%0A"+window.location.href,e(this).attr("href","mailto:?subject="+o.subject+"&body="+o.body),n.hide(),!0},this.render=function(){var t='<div class="selectionSharer" id="selectionSharerPopover" style="position:absolute;">  <div id="selectionSharerPopover-inner">    <ul>      <li><a class="action tweet" href="" title="Share this selection on Twitter" target="_blank">Tweet</a></li>      <li><a class="action facebook" href="" title="Share this selection on Facebook" target="_blank">Facebook</a></li>      <li><a class="action linkedin" href="" title="Share this selection on LinkedIn" target="_blank">LinkedIn</a></li>      <li><a class="action email" href="" title="Share this selection by email" target="_blank"><svg width="20" height="20"><path stroke="#FFF" stroke-width="6" d="m16,25h82v60H16zl37,37q4,3 8,0l37-37M16,85l30-30m22,0 30,30"/></svg></a></li>    </ul>  </div>  <div class="selectionSharerPopover-clip"><span class="selectionSharerPopover-arrow"></span></div></div>',o='<div id="selectionSharerPopunder" class="selectionSharer">  <div id="selectionSharerPopunder-inner">    <label>Share this selection</label>    <ul>      <li><a class="action tweet" href="" title="Share this selection on Twitter" target="_blank">Tweet</a></li>      <li><a class="action facebook" href="" title="Share this selection on Facebook" target="_blank">Facebook</a></li>      <li><a class="action linkedin" href="" title="Share this selection on LinkedIn" target="_blank">LinkedIn</a></li>      <li><a class="action email" href="" title="Share this selection by email" target="_blank"><svg width="20" height="20"><path stroke="#FFF" stroke-width="6" d="m16,25h82v60H16zl37,37q4,3 8,0l37-37M16,85l30-30m22,0 30,30"/></svg></a></li>    </ul>  </div></div>';n.$popover=e(t),n.$popover.find("a.tweet").click(n.shareTwitter),n.$popover.find("a.facebook").click(n.shareFacebook),n.$popover.find("a.linkedin").click(n.shareLinkedIn),n.$popover.find("a.email").click(n.shareEmail),e("body").append(n.$popover),n.$popunder=e(o),n.$popunder.find("a.tweet").click(n.shareTwitter),n.$popunder.find("a.facebook").click(n.shareFacebook),n.$popunder.find("a.linkedin").click(n.shareLinkedIn),n.$popunder.find("a.email").click(n.shareEmail),e("body").append(n.$popunder),n.appId&&n.url2share&&e(".selectionSharer a.facebook").css("display","inline-block")},this.setElements=function(t){"string"==typeof t&&(t=e(t)),n.$elements=t instanceof e?t:e(t),n.$elements.mouseup(n.show).mousedown(n.hide).addClass("selectionShareable"),n.$elements.bind("touchstart",function(){n.isMobile=!0}),document.onselectionchange=n.selectionChanged},this.selectionChanged=function(e){n.isMobile&&(n.lastSelectionChanged&&clearTimeout(n.lastSelectionChanged),n.lastSelectionChanged=setTimeout(function(){n.showPopunder(e)},300))},this.render(),t.elements&&this.setElements(t.elements)};e.fn.selectionSharer=function(){var e=new t;return e.setElements(this),this},"function"==typeof define?define(function(){return t.load=function(e,n,o){var i=new t;i.setElements("p"),o()},t}):window.SelectionSharer=t}(jQuery);
     1!function(e){var t=function(t){var n=this;t=t||{},"string"==typeof t&&(t={elements:t}),this.sel=null,this.textSelection="",this.htmlSelection="",this.appId=e('meta[property="fb:app_id"]').attr("content")||e('meta[property="fb:app_id"]').attr("value"),this.url2share=e('meta[property="og:url"]').attr("content")||e('meta[property="og:url"]').attr("value")||window.location.href,this.getSelectionText=function(e){var t="",o="",e=e||window.getSelection();if(e.rangeCount){for(var i=document.createElement("div"),r=0,a=e.rangeCount;a>r;++r)i.appendChild(e.getRangeAt(r).cloneContents());o=i.textContent,t=i.innerHTML}return n.textSelection=o,n.htmlSelection=t||o,o},this.selectionDirection=function(e){var t=e||window.getSelection(),n=document.createRange();if(!t.anchorNode)return 0;n.setStart(t.anchorNode,t.anchorOffset),n.setEnd(t.focusNode,t.focusOffset);var o=n.collapsed?"backward":"forward";return n.detach(),o},this.showPopunder=function(){n.popunder=n.popunder||document.getElementById("selectionSharerPopunder");var e=window.getSelection(),t=n.getSelectionText(e);if(e.isCollapsed||t.length<10||!t.match(/ /))return n.hidePopunder();if(n.popunder.classList.contains("fixed"))return n.popunder.style.bottom=0;var o=e.getRangeAt(0),i=o.endContainer.parentNode;if(n.popunder.classList.contains("show")){if(Math.ceil(n.popunder.getBoundingClientRect().top)==Math.ceil(i.getBoundingClientRect().bottom))return;return n.hidePopunder(n.showPopunder)}if(i.nextElementSibling)n.pushSiblings(i);else{n.placeholder||(n.placeholder=document.createElement("div"),n.placeholder.className="selectionSharerPlaceholder");var r=window.getComputedStyle(i).marginBottom;n.placeholder.style.height=r,n.placeholder.style.marginBottom=-2*parseInt(r,10)+"px",i.parentNode.insertBefore(n.placeholder)}var a=window.pageYOffset+i.getBoundingClientRect().bottom;n.popunder.style.top=Math.ceil(a)+"px",setTimeout(function(){n.placeholder&&n.placeholder.classList.add("show"),n.popunder.classList.add("show")},0)},this.pushSiblings=function(e){for(;e=e.nextElementSibling;)e.classList.add("selectionSharer"),e.classList.add("moveDown")},this.hidePopunder=function(e){if(e=e||function(){},"fixed"==n.popunder)return n.popunder.style.bottom="-50px",e();n.popunder.classList.remove("show"),n.placeholder&&n.placeholder.classList.remove("show");for(var t=document.getElementsByClassName("moveDown");el=t[0];)el.classList.remove("moveDown");setTimeout(function(){n.placeholder&&document.body.insertBefore(n.placeholder),e()},600)},this.show=function(e){setTimeout(function(){var t=window.getSelection(),o=n.getSelectionText(t);if(!t.isCollapsed&&o&&o.length>10&&o.match(/ /)){var i=t.getRangeAt(0),r=i.getBoundingClientRect().top-5,a=r+window.pageYOffset-n.$popover.height(),l=0;if(e)l=e.pageX;else{var s=t.anchorNode.parentNode;l+=s.offsetWidth/2;do l+=s.offsetLeft;while(s=s.offsetParent)}switch(n.selectionDirection(t)){case"forward":l-=n.$popover.width();break;case"backward":l+=n.$popover.width();break;default:return}n.$popover.removeClass("anim").css("top",a+10).css("left",l).show(),setTimeout(function(){n.$popover.addClass("anim").css("top",a)},0)}},10)},this.hide=function(){n.$popover.hide()},this.smart_truncate=function(e,t){if(!e||!e.length)return e;var n=e.length>t,o=n?e.substr(0,t-1):e;return o=n?o.substr(0,o.lastIndexOf(" ")):o,n?o+"...":o},this.getRelatedTwitterAccounts=function(){var t=[],n=e('meta[name="twitter:creator"]').attr("content")||e('meta[name="twitter:creator"]').attr("value");n&&t.push(n);for(var o=document.getElementsByTagName("a"),i=0,r=o.length;r>i;i++)if(o[i].attributes.href&&"string"==typeof o[i].attributes.href.value){var a=o[i].attributes.href.value.match(/^https?:\/\/twitter\.com\/([a-z0-9_]{1,20})/i);a&&a.length>1&&-1==["widgets","intent"].indexOf(a[1])&&t.push(a[1])}return t.length>0?t.join(","):""},this.shareTwitter=function(e){e.preventDefault();var t="“"+n.smart_truncate(n.textSelection.trim(),114)+"”",o="http://twitter.com/intent/tweet?text="+encodeURIComponent(t)+"&related="+n.relatedTwitterAccounts+"&url="+encodeURIComponent(window.location.href);n.viaTwitterAccount&&t.length<114-n.viaTwitterAccount.length&&(o+="&via="+n.viaTwitterAccount);var i=640,r=440,a=screen.width/2-i/2,l=screen.height/2-r/2-100;return window.open(o,"share_twitter","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+i+", height="+r+", top="+l+", left="+a),n.hide(),!1},this.shareFacebook=function(e){e.preventDefault();var t=n.htmlSelection.replace(/<p[^>]*>/gi,"\n").replace(/<\/p>|  /gi,"").trim(),o="https://www.facebook.com/dialog/feed?app_id="+n.appId+"&display=page&name="+encodeURIComponent(t)+"&link="+encodeURIComponent(n.url2share)+"&redirect_uri="+encodeURIComponent(n.url2share);window.location.href=o,window.open(o,"share_linkedin","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+w+", height="+h+", top="+top+", left="+left)},this.shareLinkedIn=function(e){e.preventDefault();var t=n.htmlSelection.replace(/<p[^>]*>/gi,"\n").replace(/<\/p>|  /gi,"").trim(),o="https://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(n.url2share)+"&title="+encodeURIComponent(t),i=640,r=440,a=screen.width/2-i/2,l=screen.height/2-r/2-100;window.open(o,"share_linkedin","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width="+i+", height="+r+", top="+l+", left="+a)},this.shareEmail=function(){var t=n.htmlSelection.replace(/<p[^>]*>/gi,"\n").replace(/<\/p>|  /gi,"").trim(),o={};return o.subject=encodeURIComponent("Quote from "+document.title),o.body=encodeURIComponent("“"+t+"”")+"%0D%0A%0D%0AFrom: "+document.title+"%0D%0A"+window.location.href,e(this).attr("href","mailto:?subject="+o.subject+"&body="+o.body),n.hide(),!0},this.render=function(){var t='<div class="selectionSharer" id="selectionSharerPopover" style="position:absolute;">  <div id="selectionSharerPopover-inner">    <ul>      <li><a class="action tweet" href="" title="Share this selection on Twitter" target="_blank">Tweet</a></li>      <li><a class="action facebook" href="" title="Share this selection on Facebook" target="_blank">Facebook</a></li>      <li><a class="action linkedin" href="" title="Share this selection on LinkedIn" target="_blank">LinkedIn</a></li>      <li><a class="action email" href="" title="Share this selection by email" target="_blank"><svg width="20" height="20"><path stroke="#FFF" stroke-width="6" d="m16,25h82v60H16zl37,37q4,3 8,0l37-37M16,85l30-30m22,0 30,30"/></svg></a></li>    </ul>  </div>  <div class="selectionSharerPopover-clip"><span class="selectionSharerPopover-arrow"></span></div></div>',o='<div id="selectionSharerPopunder" class="selectionSharer">  <div id="selectionSharerPopunder-inner">    <label>Share this selection</label>    <ul>      <li><a class="action tweet" href="" title="Share this selection on Twitter" target="_blank">Tweet</a></li>      <li><a class="action facebook" href="" title="Share this selection on Facebook" target="_blank">Facebook</a></li>      <li><a class="action linkedin" href="" title="Share this selection on LinkedIn" target="_blank">LinkedIn</a></li>      <li><a class="action email" href="" title="Share this selection by email" target="_blank"><svg width="20" height="20"><path stroke="#FFF" stroke-width="6" d="m16,25h82v60H16zl37,37q4,3 8,0l37-37M16,85l30-30m22,0 30,30"/></svg></a></li>    </ul>  </div></div>';n.$popover=e(t),n.$popover.find("a.tweet").click(n.shareTwitter),n.$popover.find("a.facebook").click(n.shareFacebook),n.$popover.find("a.linkedin").click(n.shareLinkedIn),n.$popover.find("a.email").click(n.shareEmail),e("body").append(n.$popover),n.$popunder=e(o),n.$popunder.find("a.tweet").click(n.shareTwitter),n.$popunder.find("a.facebook").click(n.shareFacebook),n.$popunder.find("a.linkedin").click(n.shareLinkedIn),n.$popunder.find("a.email").click(n.shareEmail),e("body").append(n.$popunder),n.appId&&n.url2share&&e(".selectionSharer a.facebook").css("display","inline-block")},this.setElements=function(t){"string"==typeof t&&(t=e(t)),n.$elements=t instanceof e?t:e(t),n.$elements.mouseup(n.show).mousedown(n.hide).addClass("selectionShareable"),n.$elements.bind("touchstart",function(){n.isMobile=!0}),document.onselectionchange=n.selectionChanged},this.selectionChanged=function(e){n.isMobile&&(n.lastSelectionChanged&&clearTimeout(n.lastSelectionChanged),n.lastSelectionChanged=setTimeout(function(){n.showPopunder(e)},300))},this.render(),t.elements&&this.setElements(t.elements)};e.fn.selectionSharer=function(){var e=new t;return e.setElements(this),this},"function"==typeof define?define(function(){return t.load=function(e,n,o){var i=new t;i.setElements("p"),o()},t}):window.SelectionSharer=t}(jQuery);
  • selection-sharer/tags/0.4/readme.txt

    r1320780 r1469773  
    11=== Selection Sharer by Hans van Gent ===
    2 Contributors: jcvangent
     2Contributors: jcvangent, inboundrocket
    33Tags: medium, Twitter, Facebook, LinkedIn, email, sharing, selection, content, plugin
    44Requires at least: 2.5
    55Tested up to: 4.4
    6 Stable tag: 0.3
     6Stable tag: 0.4
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3838== Changelog ==
    3939
     40= 0.4 =
     41Finally got some time to look into the IE11 issue, made a small adaptation in the code. Thanks a lot, Alex for the helpful tips there!
     42While we're smashing bugs, smashed another one as well. Hope you like it!
     43
     44In the meantime, we're working heavily on a different plugin, which features this as part of a more sophisticated suite to help you generate leads from your website called [Inbound Rocket](https://wordpress.org/plugins/inbound-rocket/), be sure to check it out!
     45
    4046= 0.3 =
    4147Been popping out updates like there is no tomorrow :-) This one features LinkedIn support, so you can easily have your visitors share your content towards LinkedIn!
  • selection-sharer/tags/0.4/selection-sharer.php

    r1091760 r1469773  
    44Plugin URI: http://wordpress.org/extend/plugins/selection-sharer/
    55Description: Medium like popover menu to share on Twitter, Facebook, LinkedIn or by email any text selected on the page, based on the code of @xdamman (https://github.com/xdamman/selection-sharer)
    6 Version: 0.3
     6Version: 0.4
    77Author: J.C. van Gent
    88Author URI: http://jcvangent.com/
Note: See TracChangeset for help on using the changeset viewer.