JSFiddle - React, Tailwind, and code Playground

by Ronny

HTML

<a href="http://google.com">Google</a>
<a href="http://jsfiddle.net/fwef#fasdf">Google + anchor</a>
<a href="#">#</a>
<a name="fawef">awef</a>

JavaScript

(function() {
    var selector = "a[href]:not([href=#])";

        function share(e) {
            var $this = $(this);
            if (e.ctrlKey && e.shiftKey) {
                e.preventDefault();
                if (e.which === 115 || e.which === 19) { // 's', share current page
                    openShare(document.location.href);
                } else if ($this.is(selector)) {
                    openShare($this.attr('href'));
                }
            }
        }

        function openShare(url) {
            var d = document,
                f = 'http://www.facebook.com/share',
                l = d.location,
                e = encodeURIComponent,
                p = '.php?src=bm&v=4&i=1255024403&u=' + e(url);
            window.open(f + 'r' + p, 'sharer', 'toolbar=0,status=0,resizable=1,width=626,height=436')
        }

        jQuery(document).ready(function() {
            //var $ = $jquery;
            $(selector).click(share);
            $(document).keypress(share);
        });
})()