Skip to content

Instantly share code, notes, and snippets.

@JT5D
Forked from ttscoff/grab links.bookmarklet
Created December 22, 2013 11:32
Show Gist options
  • Select an option

  • Save JT5D/8081144 to your computer and use it in GitHub Desktop.

Select an option

Save JT5D/8081144 to your computer and use it in GitHub Desktop.

Revisions

  1. @ttscoff ttscoff revised this gist Jul 30, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -42,6 +42,7 @@
    }
    }, collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function (a) {
    a.stopPropagation();
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid rgb(194, 130, 148)"
    }).addClass("mkhovered") : $("div,table,article,section,aside").css({
  2. @ttscoff ttscoff revised this gist Jul 5, 2013. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -97,7 +97,8 @@
    fontFamily: "menlo, courier, monospace"
    }).append($("<pre id=linkoutput>").css({
    padding: "20px",
    margin: "40px"
    margin: "40px",
    textAlign: "left"
    }).text("Collected from: [" + document.title.replace(/[\r\n]+/, "") + "](" + document.location.href + ")\n\n\n" + collection.join("\n"))).append($("<a href=#>Click here to close</a>").css({
    display: "block",
    padding: "10px",
    @@ -109,7 +110,7 @@
    textAlign: "center",
    borderRadius: "10px",
    fontFamily: "Helvetica, Arial, sans-serif",
    fontWeight: "bold"
    fontWeight: "bold",
    }).click(function (ev) {
    $(this).closest("div").remove();
    $("div,table,article,section,aside").unbind();
  3. @ttscoff ttscoff revised this gist Jul 5, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@
    // Do a better job of incrementing/decrementing padding

    (function () {
    function callback() {
    function callback() {
    (function ($) {
    var jQuery = $;
    $("#loadingp").fadeOut("fast", function () {
    @@ -54,7 +54,7 @@
    }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [],
    linkage = $(this).find("a"),
    avoidUrls = ["twitter\.com\/intent","www\.facebook\.com\/dialog","alpha\\.app\\.net\\/intent"];
    avoidUrls = ["twitter\\.com\\/intent","www\\.facebook\\.com\\/dialog","alpha\\.app\\.net\\/intent"];
    linkage.each(function (i, link) {
    var $link = $(link);
    var parser = document.createElement("a");
  4. @ttscoff ttscoff revised this gist Jul 5, 2013. 1 changed file with 116 additions and 113 deletions.
    229 changes: 116 additions & 113 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,14 @@
    // version 2.2
    // Updated jQuery to stable head
    // removed padding changes on hover, too messy
    // avoid Tweet This, ADN and Facebook Share links

    // version 2.1
    //
    //
    // Fixed jQuery injection

    // version 2.0
    //
    //
    // no repeated urls
    // handle relative links and local hashes better
    // better handling of title attributes
    @@ -15,114 +20,112 @@

    (function () {
    function callback() {
    (function ($) {
    var jQuery = $;
    $("#loadingp").fadeOut("fast", function () {
    $(this).remove();
    });
    var selectLinks = function () {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    range, selection;
    if (doc.body.createTextRange) {
    range = doc.body.createTextRange();
    range.moveToElementText(text);
    range.select();
    } else if (window.getSelection) {
    selection = window.getSelection();
    range = doc.createRange();
    range.selectNodeContents(text);
    selection.removeAllRanges();
    selection.addRange(range);
    }
    }, collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function (a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid rgb(194, 130, 148)",
    paddingLeft: "+=10",
    paddingRight: "+=10",
    paddingBottom: "+=10",
    paddingTop: "+=10"
    }).addClass("mkhovered") : $("div,table,article,section,aside").css({
    outline: "none",
    paddingLeft: "-=10",
    paddingRight: "-=10",
    paddingBottom: "-=10",
    paddingTop: "-=10"
    }).removeClass("mkhovered");
    if (a.type === "click") {
    a.preventDefault();
    $(".mkhovered").css({
    outline: "none",
    padding: "-=10"
    }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [],
    linkage = $(this).find("a");
    linkage.each(function (i, link) {
    var $link = $(link);
    var parser = document.createElement("a");
    parser.href = $link.attr("href");
    if ($.inArray(parser.href, norepeat) === -1) {
    console.log(parser.href);
    norepeat.push(parser.href);
    if ($link.attr("title") && $link.attr("title").length > 3) {
    linkText = $link.attr("title");
    } else {
    if ($link.text() === undefined || $link.text().length < 4) {
    if (document.location.hostname === parser.hostname && parser.hash !== "") {
    linkText = parser.hash;
    } else {
    linkText = parser.href;
    }
    } else {
    linkText = $link.text();
    }
    }
    collection.push(["- [" + linkText.replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 50).replace(/[\[\]\|]+/g, "") + "](" + parser.href + ")"]);
    }
    });
    $("<div>").css({
    position: "fixed",
    top: "0",
    left: "0",
    right: "0",
    bottom: "0",
    overflow: "auto",
    backgroundColor: "#efefef",
    color: "#333",
    zIndex: "99999",
    fontFamily: "menlo, courier, monospace"
    }).append($("<pre id=linkoutput>").css({
    padding: "20px",
    margin: "40px"
    }).text("Collected from: [" + document.title.replace(/[\r\n]+/, "") + "](" + document.location.href + ")\n\n\n" + collection.join("\n"))).append($("<a href=#>Click here to close</a>").css({
    display: "block",
    padding: "10px",
    color: "#fff",
    fontSize: "16px",
    background: "rgba(194, 56, 96, 1)",
    margin: "0 auto",
    width: "220px",
    textAlign: "center",
    borderRadius: "10px",
    fontFamily: "Helvetica, Arial, sans-serif",
    fontWeight: "bold"
    }).click(function (ev) {
    $(this).closest("div").remove();
    $("div,table,article,section,aside").unbind();
    })).appendTo("body");
    selectLinks();
    return false;
    }
    })
    })(jQuery.noConflict(true))
    }
    var s = document.createElement("script");
    s.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
    if (s.addEventListener) {
    s.addEventListener("load", callback, false)
    } else if (s.readyState) {
    s.onreadystatechange = callback
    }
    document.body.appendChild(s);
    })()
    (function ($) {
    var jQuery = $;
    $("#loadingp").fadeOut("fast", function () {
    $(this).remove();
    });
    var selectLinks = function () {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    range, selection;
    if (doc.body.createTextRange) {
    range = doc.body.createTextRange();
    range.moveToElementText(text);
    range.select();
    } else if (window.getSelection) {
    selection = window.getSelection();
    range = doc.createRange();
    range.selectNodeContents(text);
    selection.removeAllRanges();
    selection.addRange(range);
    }
    }, collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function (a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid rgb(194, 130, 148)"
    }).addClass("mkhovered") : $("div,table,article,section,aside").css({
    outline: "none"
    }).removeClass("mkhovered");
    if (a.type === "click") {
    a.preventDefault();
    $(".mkhovered").css({
    outline: "none"
    }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [],
    linkage = $(this).find("a"),
    avoidUrls = ["twitter\.com\/intent","www\.facebook\.com\/dialog","alpha\\.app\\.net\\/intent"];
    linkage.each(function (i, link) {
    var $link = $(link);
    var parser = document.createElement("a");
    parser.href = $link.attr("href");
    for (i in avoidUrls) {
    var re = new RegExp(avoidUrls[i]);
    if (re.test(parser.href)) {
    return false;
    }
    }
    if ($.inArray(parser.href, norepeat) === -1) {
    console.log(parser.href);
    norepeat.push(parser.href);
    if ($link.attr("title") && $link.attr("title").length > 3) {
    linkText = $link.attr("title");
    } else {
    if ($link.text() === undefined || $link.text().length < 4) {
    if (document.location.hostname === parser.hostname && parser.hash !== "") {
    linkText = parser.hash;
    } else {
    linkText = parser.href;
    }
    } else {
    linkText = $link.text();
    }
    }
    collection.push(["- [" + linkText.replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 50).replace(/[\[\]\|]+/g, "") + "](" + parser.href + ")"]);
    }
    });
    $("<div>").css({
    position: "fixed",
    top: "0",
    left: "0",
    right: "0",
    bottom: "0",
    overflow: "auto",
    backgroundColor: "#efefef",
    color: "#333",
    zIndex: "99999",
    fontFamily: "menlo, courier, monospace"
    }).append($("<pre id=linkoutput>").css({
    padding: "20px",
    margin: "40px"
    }).text("Collected from: [" + document.title.replace(/[\r\n]+/, "") + "](" + document.location.href + ")\n\n\n" + collection.join("\n"))).append($("<a href=#>Click here to close</a>").css({
    display: "block",
    padding: "10px",
    color: "#fff",
    fontSize: "16px",
    background: "rgba(194, 56, 96, 1)",
    margin: "0 auto",
    width: "220px",
    textAlign: "center",
    borderRadius: "10px",
    fontFamily: "Helvetica, Arial, sans-serif",
    fontWeight: "bold"
    }).click(function (ev) {
    $(this).closest("div").remove();
    $("div,table,article,section,aside").unbind();
    })).appendTo("body");
    selectLinks();
    return false;
    }
    })
    })(jQuery.noConflict(true))
    }
    var s = document.createElement("script");
    s.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
    if (s.addEventListener) {
    s.addEventListener("load", callback, false)
    } else if (s.readyState) {
    s.onreadystatechange = callback
    }
    document.body.appendChild(s);
    })()
  5. @ttscoff ttscoff revised this gist Jul 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grablinks.js
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@
    a.preventDefault();
    $(".mkhovered").css({
    outline: "none",
    padding: "-=10px"
    padding: "-=10"
    }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [],
    linkage = $(this).find("a");
  6. @ttscoff ttscoff revised this gist Jul 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grablinks.js
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@
    a.preventDefault();
    $(".mkhovered").css({
    outline: "none",
    padding: "-10px"
    padding: "-=10px"
    }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [],
    linkage = $(this).find("a");
  7. @ttscoff ttscoff revised this gist Jul 5, 2013. 1 changed file with 118 additions and 100 deletions.
    218 changes: 118 additions & 100 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@
    // version 2.1
    //
    // Fixed jQuery injection

    // version 2.0
    //
    // no repeated urls
    // handle relative links and local hashes better
    // better handling of title attributes
    @@ -8,103 +13,116 @@
    // truncate long titles at 50 chars
    // Do a better job of incrementing/decrementing padding

    (function(e, a, g, h, f, c, b, d) {
    if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) {
    c = a.createElement("script");
    c.type = "text/javascript";
    c.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + g + "/jquery.min.js";
    c.onload = c.onreadystatechange = function() {
    if (!b && (!(d = this.readyState) || d == "loaded" || d == "complete")) {
    h((f = e.jQuery).noConflict(1), b = 1);
    f(c).remove()
    }
    };
    a.documentElement.childNodes[0].appendChild(c)
    }
    })(window, document, "1.7", function($, L) {
    $(document).ready(function() {
    $("#loadingp").fadeOut("fast",function(){ $(this).remove(); });
    var selectLinks = function() {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    range, selection;
    if (doc.body.createTextRange) {
    range = doc.body.createTextRange();
    range.moveToElementText(text);
    range.select();
    } else if (window.getSelection) {
    selection = window.getSelection();
    range = doc.createRange();
    range.selectNodeContents(text);
    selection.removeAllRanges();
    selection.addRange(range);
    }
    }, collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function(a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid rgb(194, 130, 148)",
    paddingLeft:"+=10", paddingRight:"+=10", paddingBottom:"+=10", paddingTop:"+=10"
    }).addClass("mkhovered") : $("div,table,article,section,aside").css({
    outline: "none",
    paddingLeft:"-=10", paddingRight:"-=10", paddingBottom:"-=10", paddingTop:"-=10"
    }).removeClass("mkhovered");
    if (a.type === "click") {
    a.preventDefault();
    $(".mkhovered").css({ outline: "none", padding:"-10px" }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [], linkage = $(this).find("a");
    linkage.each(function(i, link) {
    var $link = $(link);
    var parser = document.createElement("a");
    parser.href = $link.attr("href");
    if ($.inArray(parser.href,norepeat) === -1) {
    console.log(parser.href);
    norepeat.push(parser.href);
    if ($link.attr("title") && $link.attr("title").length > 3) {
    linkText = $link.attr("title");
    } else {
    if ($link.text() === undefined || $link.text().length < 4) {
    if (document.location.hostname === parser.hostname && parser.hash !== "") {
    linkText = parser.hash;
    } else {
    linkText = parser.href;
    }
    } else {
    linkText = $link.text();
    }
    }
    collection.push(["- [" + linkText.replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 50).replace(/[\[\]\|]+/g, "") + "](" + parser.href + ")"]);
    }
    });
    $("<div>").css({
    position: "fixed",
    top: "0",
    left: "0",
    right: "0",
    bottom: "0",
    overflow: "auto",
    backgroundColor: "#efefef",
    color: "#333",
    zIndex: "99999",
    fontFamily: "menlo, courier, monospace"
    }).append($("<pre id=linkoutput>").css({padding: "20px", margin: "40px"}).text("Collected from: ["+document.title.replace(/[\r\n]+/,"")+"]("+document.location.href+")\n\n\n"+collection.join("\n"))).append($("<a href=#>Click here to close</a>").css({
    display: "block",
    padding: "10px",
    color: "#fff",
    fontSize: "16px",
    background: "rgba(194, 56, 96, 1)",
    margin: "0 auto",
    width: "220px",
    textAlign: "center",
    borderRadius: "10px",
    fontFamily: "Helvetica, Arial, sans-serif",
    fontWeight: "bold"
    }).click(function(ev){
    $(this).closest("div").remove();
    $("div,table,article,section,aside").unbind();
    })).appendTo("body");
    selectLinks();
    return false;
    }
    });
    });
    });
    (function () {
    function callback() {
    (function ($) {
    var jQuery = $;
    $("#loadingp").fadeOut("fast", function () {
    $(this).remove();
    });
    var selectLinks = function () {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    range, selection;
    if (doc.body.createTextRange) {
    range = doc.body.createTextRange();
    range.moveToElementText(text);
    range.select();
    } else if (window.getSelection) {
    selection = window.getSelection();
    range = doc.createRange();
    range.selectNodeContents(text);
    selection.removeAllRanges();
    selection.addRange(range);
    }
    }, collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function (a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid rgb(194, 130, 148)",
    paddingLeft: "+=10",
    paddingRight: "+=10",
    paddingBottom: "+=10",
    paddingTop: "+=10"
    }).addClass("mkhovered") : $("div,table,article,section,aside").css({
    outline: "none",
    paddingLeft: "-=10",
    paddingRight: "-=10",
    paddingBottom: "-=10",
    paddingTop: "-=10"
    }).removeClass("mkhovered");
    if (a.type === "click") {
    a.preventDefault();
    $(".mkhovered").css({
    outline: "none",
    padding: "-10px"
    }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [],
    linkage = $(this).find("a");
    linkage.each(function (i, link) {
    var $link = $(link);
    var parser = document.createElement("a");
    parser.href = $link.attr("href");
    if ($.inArray(parser.href, norepeat) === -1) {
    console.log(parser.href);
    norepeat.push(parser.href);
    if ($link.attr("title") && $link.attr("title").length > 3) {
    linkText = $link.attr("title");
    } else {
    if ($link.text() === undefined || $link.text().length < 4) {
    if (document.location.hostname === parser.hostname && parser.hash !== "") {
    linkText = parser.hash;
    } else {
    linkText = parser.href;
    }
    } else {
    linkText = $link.text();
    }
    }
    collection.push(["- [" + linkText.replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 50).replace(/[\[\]\|]+/g, "") + "](" + parser.href + ")"]);
    }
    });
    $("<div>").css({
    position: "fixed",
    top: "0",
    left: "0",
    right: "0",
    bottom: "0",
    overflow: "auto",
    backgroundColor: "#efefef",
    color: "#333",
    zIndex: "99999",
    fontFamily: "menlo, courier, monospace"
    }).append($("<pre id=linkoutput>").css({
    padding: "20px",
    margin: "40px"
    }).text("Collected from: [" + document.title.replace(/[\r\n]+/, "") + "](" + document.location.href + ")\n\n\n" + collection.join("\n"))).append($("<a href=#>Click here to close</a>").css({
    display: "block",
    padding: "10px",
    color: "#fff",
    fontSize: "16px",
    background: "rgba(194, 56, 96, 1)",
    margin: "0 auto",
    width: "220px",
    textAlign: "center",
    borderRadius: "10px",
    fontFamily: "Helvetica, Arial, sans-serif",
    fontWeight: "bold"
    }).click(function (ev) {
    $(this).closest("div").remove();
    $("div,table,article,section,aside").unbind();
    })).appendTo("body");
    selectLinks();
    return false;
    }
    })
    })(jQuery.noConflict(true))
    }
    var s = document.createElement("script");
    s.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js";
    if (s.addEventListener) {
    s.addEventListener("load", callback, false)
    } else if (s.readyState) {
    s.onreadystatechange = callback
    }
    document.body.appendChild(s);
    })()
  8. @ttscoff ttscoff revised this gist Jul 4, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grab links.bookmarklet
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement('script')).src='https://gist.github.com/ttscoff/5834741/raw/grablinks.js?x='+(Math.random());})();
    javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/ttscoff/5834741/raw/grablinks.js?x="+(Math.random());})();
  9. @ttscoff ttscoff revised this gist Jul 4, 2013. 2 changed files with 7 additions and 6 deletions.
    2 changes: 1 addition & 1 deletion grab links.bookmarklet
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(n,j,l,k,m,p,i,o){if(!(m=n.jQuery)||l>m.fn.jquery||k(m)){p=j.createElement("script");p.type="text/javascript";p.src="http://ajax.googleapis.com/ajax/libs/jquery/"+l+"/jquery.min.js";p.onload=p.onreadystatechange=function(){if(!i&&(!(o=this.readyState)||o=="loaded"||o=="complete")){k((m=n.jQuery).noConflict(1),i=1);m(p).remove()}};j.documentElement.childNodes[0].appendChild(p)}})(window,document,"1.7",function(b,a){b(document).ready(function(){var c=function(){var g=document,h=g.getElementById("linkoutput"),e,f;if(g.body.createTextRange){e=g.body.createTextRange();e.moveToElementText(h);e.select()}else{if(window.getSelection){f=window.getSelection();e=g.createRange();e.selectNodeContents(h);f.removeAllRanges();f.addRange(e)}}},d=[];b("div,table,article,section,aside").on("mouseover mouseout click",function(e){e.type==="mouseover"?b(this).css({outline:"1px solid red",padding:"+10px"}):b("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(e.type==="click"){e.preventDefault();var j,f,h,g=[],k=b(this).find("a");k.each(function(m,n){var l=b(n);var o=document.createElement("a");o.href=l.attr("href");if(b.inArray(o.href,g)===-1){console.log(o.href);g.push(o.href);if(l.attr("title")&&l.attr("title").length>3){h=l.attr("title")}else{if(l.text()===undefined||l.text().length<4){if(document.location.hostname===o.hostname&&o.hash!==""){h=o.hash}else{h=o.href}}else{h=l.text()}}d.push(["- ["+h.replace(/[\n\r\s]+/g," ").replace(/(^\s*|\s*$)/g,"").slice(0,100).replace(/[\[\]\|]+/g,"")+"]("+o.href+")"])}});b("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append(b("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(d.join("\n")).click(function(){c()})).click(function(i){if(i.target.tagName=="DIV"){b(this).remove();b("div,table,article,section,aside").unbind()}}).appendTo("body");c();return false}})})});
    javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement('script')).src='https://gist.github.com/ttscoff/5834741/raw/grablinks.js?x='+(Math.random());})();
    11 changes: 6 additions & 5 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,12 @@
    // version 1.5.1
    // version 2.0
    // no repeated urls
    // handle relative links and local hashes better
    // better handling of title attributes
    // add origin link at top of output
    // don't force selection on click, allow copying individual parts
    // add a close button
    // truncate long titles at 50 chars
    // Do a better job of incrementing/decrementing padding

    (function(e, a, g, h, f, c, b, d) {
    if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) {
    @@ -42,10 +43,10 @@
    $("div,table,article,section,aside").on("mouseover mouseout click", function(a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid rgb(194, 130, 148)",
    padding:"+10px"
    }).addClass("mkhovered") : $(this).css({
    paddingLeft:"+=10", paddingRight:"+=10", paddingBottom:"+=10", paddingTop:"+=10"
    }).addClass("mkhovered") : $("div,table,article,section,aside").css({
    outline: "none",
    padding:"-10px"
    paddingLeft:"-=10", paddingRight:"-=10", paddingBottom:"-=10", paddingTop:"-=10"
    }).removeClass("mkhovered");
    if (a.type === "click") {
    a.preventDefault();
    @@ -106,4 +107,4 @@
    }
    });
    });
    });
    });
  10. @ttscoff ttscoff revised this gist Jul 4, 2013. 1 changed file with 30 additions and 15 deletions.
    45 changes: 30 additions & 15 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,11 @@
    // version 1.5
    // version 1.5.1
    // no repeated urls
    // handle relative links and local hashes better
    // better handling of title attributes
    // add origin link at top of output
    // don't force selection on click, allow copying individual parts
    // add a close button
    // truncate long titles at 50 chars

    (function(e, a, g, h, f, c, b, d) {
    if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) {
    @@ -18,6 +22,7 @@
    }
    })(window, document, "1.7", function($, L) {
    $(document).ready(function() {
    $("#loadingp").fadeOut("fast",function(){ $(this).remove(); });
    var selectLinks = function() {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    @@ -36,14 +41,15 @@
    }, collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function(a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid red",
    outline: "1px solid rgb(194, 130, 148)",
    padding:"+10px"
    }) : $("div,table,article,section,aside").css({
    }).addClass("mkhovered") : $(this).css({
    outline: "none",
    padding:"-10px"
    });
    }).removeClass("mkhovered");
    if (a.type === "click") {
    a.preventDefault();
    $(".mkhovered").css({ outline: "none", padding:"-10px" }).removeClass("mkhovered");
    var i, url, linkText, norepeat = [], linkage = $(this).find("a");
    linkage.each(function(i, link) {
    var $link = $(link);
    @@ -65,7 +71,7 @@
    linkText = $link.text();
    }
    }
    collection.push(["- [" + linkText.replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 100).replace(/[\[\]\|]+/g, "") + "](" + parser.href + ")"]);
    collection.push(["- [" + linkText.replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 50).replace(/[\[\]\|]+/g, "") + "](" + parser.href + ")"]);
    }
    });
    $("<div>").css({
    @@ -77,18 +83,27 @@
    overflow: "auto",
    backgroundColor: "#efefef",
    color: "#333",
    zIndex: "99999"
    }).append($("<pre id=linkoutput>").css({padding: "20px", margin: "40px"}).text(collection.join("\n")).click(function(){
    selectLinks();
    })).click(function(ev){
    if (ev.target.tagName == "DIV") {
    $(this).remove();
    $("div,table,article,section,aside").unbind();
    }
    }).appendTo("body");
    zIndex: "99999",
    fontFamily: "menlo, courier, monospace"
    }).append($("<pre id=linkoutput>").css({padding: "20px", margin: "40px"}).text("Collected from: ["+document.title.replace(/[\r\n]+/,"")+"]("+document.location.href+")\n\n\n"+collection.join("\n"))).append($("<a href=#>Click here to close</a>").css({
    display: "block",
    padding: "10px",
    color: "#fff",
    fontSize: "16px",
    background: "rgba(194, 56, 96, 1)",
    margin: "0 auto",
    width: "220px",
    textAlign: "center",
    borderRadius: "10px",
    fontFamily: "Helvetica, Arial, sans-serif",
    fontWeight: "bold"
    }).click(function(ev){
    $(this).closest("div").remove();
    $("div,table,article,section,aside").unbind();
    })).appendTo("body");
    selectLinks();
    return false;
    }
    });
    });
    });
    });
  11. @ttscoff ttscoff revised this gist Jul 4, 2013. 2 changed files with 29 additions and 6 deletions.
    2 changes: 1 addition & 1 deletion grab links.bookmarklet
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(n,j,l,k,m,p,i,o){if(!(m=n.jQuery)||l>m.fn.jquery||k(m)){p=j.createElement("script");p.type="text/javascript";p.src="http://ajax.googleapis.com/ajax/libs/jquery/"+l+"/jquery.min.js";p.onload=p.onreadystatechange=function(){if(!i&&(!(o=this.readyState)||o=="loaded"||o=="complete")){k((m=n.jQuery).noConflict(1),i=1);m(p).remove()}};j.documentElement.childNodes[0].appendChild(p)}})(window,document,"1.7",function(b,a){b(document).ready(function(){var c=function(){var g=document,h=g.getElementById("linkoutput"),e,f;if(g.body.createTextRange){e=g.body.createTextRange();e.moveToElementText(h);e.select()}else{if(window.getSelection){f=window.getSelection();e=g.createRange();e.selectNodeContents(h);f.removeAllRanges();f.addRange(e)}}},d=[];b("div,table,article,section,aside").on("mouseover mouseout click",function(e){e.type==="mouseover"?b(this).css({outline:"1px solid red",padding:"+10px"}):b("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(e.type==="click"){e.preventDefault();var f,g=b(this).find("a");g.each(function(j,k){var l=b(k).text()===undefined?b(k).attr("href"):b(k).text().replace(/[\n\r\s]+/g," ").replace(/(^\s*|\s*$)/g,"").slice(0,100);var h=/^http/.test(b(k).attr("href"))?b(k).attr("href"):document.location.protocol+"//"+document.location.hostname+b(k).attr("href");d.push(["- ["+l.replace(/[\[\]\|]+/g,"")+"]("+h+")"])});b("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append(b("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(d.join("\n")).click(function(){c()})).click(function(h){if(h.target.tagName=="DIV"){b(this).remove();b("div,table,article,section,aside").unbind()}}).appendTo("body");c();return false}})})});
    javascript:(function(n,j,l,k,m,p,i,o){if(!(m=n.jQuery)||l>m.fn.jquery||k(m)){p=j.createElement("script");p.type="text/javascript";p.src="http://ajax.googleapis.com/ajax/libs/jquery/"+l+"/jquery.min.js";p.onload=p.onreadystatechange=function(){if(!i&&(!(o=this.readyState)||o=="loaded"||o=="complete")){k((m=n.jQuery).noConflict(1),i=1);m(p).remove()}};j.documentElement.childNodes[0].appendChild(p)}})(window,document,"1.7",function(b,a){b(document).ready(function(){var c=function(){var g=document,h=g.getElementById("linkoutput"),e,f;if(g.body.createTextRange){e=g.body.createTextRange();e.moveToElementText(h);e.select()}else{if(window.getSelection){f=window.getSelection();e=g.createRange();e.selectNodeContents(h);f.removeAllRanges();f.addRange(e)}}},d=[];b("div,table,article,section,aside").on("mouseover mouseout click",function(e){e.type==="mouseover"?b(this).css({outline:"1px solid red",padding:"+10px"}):b("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(e.type==="click"){e.preventDefault();var j,f,h,g=[],k=b(this).find("a");k.each(function(m,n){var l=b(n);var o=document.createElement("a");o.href=l.attr("href");if(b.inArray(o.href,g)===-1){console.log(o.href);g.push(o.href);if(l.attr("title")&&l.attr("title").length>3){h=l.attr("title")}else{if(l.text()===undefined||l.text().length<4){if(document.location.hostname===o.hostname&&o.hash!==""){h=o.hash}else{h=o.href}}else{h=l.text()}}d.push(["- ["+h.replace(/[\n\r\s]+/g," ").replace(/(^\s*|\s*$)/g,"").slice(0,100).replace(/[\[\]\|]+/g,"")+"]("+o.href+")"])}});b("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append(b("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(d.join("\n")).click(function(){c()})).click(function(i){if(i.target.tagName=="DIV"){b(this).remove();b("div,table,article,section,aside").unbind()}}).appendTo("body");c();return false}})})});
    33 changes: 28 additions & 5 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,8 @@
    // version 1.5
    // no repeated urls
    // handle relative links and local hashes better
    // better handling of title attributes

    (function(e, a, g, h, f, c, b, d) {
    if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) {
    c = a.createElement("script");
    @@ -39,11 +44,29 @@
    });
    if (a.type === "click") {
    a.preventDefault();
    var i, linkage = $(this).find("a");
    var i, url, linkText, norepeat = [], linkage = $(this).find("a");
    linkage.each(function(i, link) {
    var linktext = $(link).text() === undefined ? $(link).attr("href") : $(link).text().replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 100);
    var url = /^http/.test($(link).attr("href")) ? $(link).attr("href") : document.location.protocol + "//" + document.location.hostname + $(link).attr("href");
    collection.push(["- [" + linktext.replace(/[\[\]\|]+/g, "") + "](" + url + ")"]);
    var $link = $(link);
    var parser = document.createElement("a");
    parser.href = $link.attr("href");
    if ($.inArray(parser.href,norepeat) === -1) {
    console.log(parser.href);
    norepeat.push(parser.href);
    if ($link.attr("title") && $link.attr("title").length > 3) {
    linkText = $link.attr("title");
    } else {
    if ($link.text() === undefined || $link.text().length < 4) {
    if (document.location.hostname === parser.hostname && parser.hash !== "") {
    linkText = parser.hash;
    } else {
    linkText = parser.href;
    }
    } else {
    linkText = $link.text();
    }
    }
    collection.push(["- [" + linkText.replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 100).replace(/[\[\]\|]+/g, "") + "](" + parser.href + ")"]);
    }
    });
    $("<div>").css({
    position: "fixed",
    @@ -68,4 +91,4 @@
    }
    });
    });
    });
    });
  12. @ttscoff ttscoff revised this gist Jul 4, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grab links.bookmarklet
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var selectLinks=function(){var doc=document,text=doc.getElementById("linkoutput"),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}},collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red",padding:"+10px"}):$("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find("a");linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr("href"):$(link).text().replace(/[\n\r\s]+/g,"").replace(/(^\s*|\s*$)/g,"").slice(0,100);var url=/^http/.test($(link).attr("href"))?$(link).attr("href"):document.location.protocol+"//"+document.location.hostname+$(link).attr("href");collection.push(["- ["+linktext.replace(/[\[\]\|]+/g,"")+"]("+url+")"]);});$("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append($("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(collection.join("\n")).click(function(){selectLinks();})).click(function(ev){if(ev.target.tagName=="DIV"){$(this).remove();$("div,table,article,section,aside").unbind();}}).appendTo("body");selectLinks();return false;}});});});
    javascript:(function(n,j,l,k,m,p,i,o){if(!(m=n.jQuery)||l>m.fn.jquery||k(m)){p=j.createElement("script");p.type="text/javascript";p.src="http://ajax.googleapis.com/ajax/libs/jquery/"+l+"/jquery.min.js";p.onload=p.onreadystatechange=function(){if(!i&&(!(o=this.readyState)||o=="loaded"||o=="complete")){k((m=n.jQuery).noConflict(1),i=1);m(p).remove()}};j.documentElement.childNodes[0].appendChild(p)}})(window,document,"1.7",function(b,a){b(document).ready(function(){var c=function(){var g=document,h=g.getElementById("linkoutput"),e,f;if(g.body.createTextRange){e=g.body.createTextRange();e.moveToElementText(h);e.select()}else{if(window.getSelection){f=window.getSelection();e=g.createRange();e.selectNodeContents(h);f.removeAllRanges();f.addRange(e)}}},d=[];b("div,table,article,section,aside").on("mouseover mouseout click",function(e){e.type==="mouseover"?b(this).css({outline:"1px solid red",padding:"+10px"}):b("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(e.type==="click"){e.preventDefault();var f,g=b(this).find("a");g.each(function(j,k){var l=b(k).text()===undefined?b(k).attr("href"):b(k).text().replace(/[\n\r\s]+/g," ").replace(/(^\s*|\s*$)/g,"").slice(0,100);var h=/^http/.test(b(k).attr("href"))?b(k).attr("href"):document.location.protocol+"//"+document.location.hostname+b(k).attr("href");d.push(["- ["+l.replace(/[\[\]\|]+/g,"")+"]("+h+")"])});b("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append(b("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(d.join("\n")).click(function(){c()})).click(function(h){if(h.target.tagName=="DIV"){b(this).remove();b("div,table,article,section,aside").unbind()}}).appendTo("body");c();return false}})})});
  13. @ttscoff ttscoff revised this gist Jul 3, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grab links.bookmarklet
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var selectLinks=function(){var doc=document,text=doc.getElementById("linkoutput"),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}},collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red",padding:"+10px"}):$("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find("a");linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr("href"):$(link).text().replace(/[\n\r\s]+/g,"").replace(/(^\s*|\s*$)/g,"").slice(0,100);var url=/^http/.test($(link).attr("href"))?$(link).attr("href"):document.location.protocol+"//"+document.location.hostname+$(link).attr("href");collection.push(["-["+linktext.replace(/[\[\]\|]+/g,"")+"]("+url+")"]);});$("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append($("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(collection.join("\n")).click(function(){selectLinks();})).click(function(ev){if(ev.target.tagName=="DIV"){$(this).remove();$("div,table,article,section,aside").unbind();}}).appendTo("body");selectLinks();return false;}});});});
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var selectLinks=function(){var doc=document,text=doc.getElementById("linkoutput"),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}},collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red",padding:"+10px"}):$("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find("a");linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr("href"):$(link).text().replace(/[\n\r\s]+/g,"").replace(/(^\s*|\s*$)/g,"").slice(0,100);var url=/^http/.test($(link).attr("href"))?$(link).attr("href"):document.location.protocol+"//"+document.location.hostname+$(link).attr("href");collection.push(["- ["+linktext.replace(/[\[\]\|]+/g,"")+"]("+url+")"]);});$("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append($("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(collection.join("\n")).click(function(){selectLinks();})).click(function(ev){if(ev.target.tagName=="DIV"){$(this).remove();$("div,table,article,section,aside").unbind();}}).appendTo("body");selectLinks();return false;}});});});
  14. @ttscoff ttscoff revised this gist Jul 3, 2013. 2 changed files with 31 additions and 21 deletions.
    2 changes: 1 addition & 1 deletion grab links.bookmarklet
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red"}):$("div,table,article,section,aside").css({outline:"none"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find("a");linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr("href"):$(link).text().replace(/[\n\r\s]+/g," ").replace(/(^\s*|\s*$)/g,"").slice(0,100);var url=/^http/.test($(link).attr("href"))?$(link).attr("href"):document.location.protocol+"//"+document.location.hostname+$(link).attr("href");collection.push(["- ["+linktext.replace(/[\[\]\|]+/g,"")+"]("+url+")"]);});$("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append($("<pre id=linkoutput>").css("padding","20px").text(collection.join("\n"))).appendTo("body").click(function(){var doc=document,text=doc.getElementById("linkoutput"),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}});return false;}});});});
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var selectLinks=function(){var doc=document,text=doc.getElementById("linkoutput"),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}},collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red",padding:"+10px"}):$("div,table,article,section,aside").css({outline:"none",padding:"-10px"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find("a");linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr("href"):$(link).text().replace(/[\n\r\s]+/g,"").replace(/(^\s*|\s*$)/g,"").slice(0,100);var url=/^http/.test($(link).attr("href"))?$(link).attr("href"):document.location.protocol+"//"+document.location.hostname+$(link).attr("href");collection.push(["-["+linktext.replace(/[\[\]\|]+/g,"")+"]("+url+")"]);});$("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append($("<pre id=linkoutput>").css({padding:"20px",margin:"40px"}).text(collection.join("\n")).click(function(){selectLinks();})).click(function(ev){if(ev.target.tagName=="DIV"){$(this).remove();$("div,table,article,section,aside").unbind();}}).appendTo("body");selectLinks();return false;}});});});
    50 changes: 30 additions & 20 deletions grablinks.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    javascript: (function(e, a, g, h, f, c, b, d) {
    (function(e, a, g, h, f, c, b, d) {
    if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) {
    c = a.createElement("script");
    c.type = "text/javascript";
    @@ -13,12 +13,29 @@ javascript: (function(e, a, g, h, f, c, b, d) {
    }
    })(window, document, "1.7", function($, L) {
    $(document).ready(function() {
    var collection = [];
    var selectLinks = function() {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    range, selection;
    if (doc.body.createTextRange) {
    range = doc.body.createTextRange();
    range.moveToElementText(text);
    range.select();
    } else if (window.getSelection) {
    selection = window.getSelection();
    range = doc.createRange();
    range.selectNodeContents(text);
    selection.removeAllRanges();
    selection.addRange(range);
    }
    }, collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function(a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid red"
    outline: "1px solid red",
    padding:"+10px"
    }) : $("div,table,article,section,aside").css({
    outline: "none"
    outline: "none",
    padding:"-10px"
    });
    if (a.type === "click") {
    a.preventDefault();
    @@ -38,24 +55,17 @@ javascript: (function(e, a, g, h, f, c, b, d) {
    backgroundColor: "#efefef",
    color: "#333",
    zIndex: "99999"
    }).append($("<pre id=linkoutput>").css("padding", "20px").text(collection.join("\n"))).appendTo("body").click(function() {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    range, selection;
    if (doc.body.createTextRange) {
    range = doc.body.createTextRange();
    range.moveToElementText(text);
    range.select();
    } else if (window.getSelection) {
    selection = window.getSelection();
    range = doc.createRange();
    range.selectNodeContents(text);
    selection.removeAllRanges();
    selection.addRange(range);
    }).append($("<pre id=linkoutput>").css({padding: "20px", margin: "40px"}).text(collection.join("\n")).click(function(){
    selectLinks();
    })).click(function(ev){
    if (ev.target.tagName == "DIV") {
    $(this).remove();
    $("div,table,article,section,aside").unbind();
    }
    });
    }).appendTo("body");
    selectLinks();
    return false;
    }
    });
    });
    });
    });
  15. @ttscoff ttscoff renamed this gist Jul 3, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  16. @ttscoff ttscoff revised this gist Jul 3, 2013. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  17. @ttscoff ttscoff revised this gist Jul 3, 2013. No changes.
  18. @ttscoff ttscoff revised this gist Jul 3, 2013. 2 changed files with 62 additions and 1 deletion.
    61 changes: 61 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,61 @@
    javascript: (function(e, a, g, h, f, c, b, d) {
    if (!(f = e.jQuery) || g > f.fn.jquery || h(f)) {
    c = a.createElement("script");
    c.type = "text/javascript";
    c.src = "http://ajax.googleapis.com/ajax/libs/jquery/" + g + "/jquery.min.js";
    c.onload = c.onreadystatechange = function() {
    if (!b && (!(d = this.readyState) || d == "loaded" || d == "complete")) {
    h((f = e.jQuery).noConflict(1), b = 1);
    f(c).remove()
    }
    };
    a.documentElement.childNodes[0].appendChild(c)
    }
    })(window, document, "1.7", function($, L) {
    $(document).ready(function() {
    var collection = [];
    $("div,table,article,section,aside").on("mouseover mouseout click", function(a) {
    a.type === "mouseover" ? $(this).css({
    outline: "1px solid red"
    }) : $("div,table,article,section,aside").css({
    outline: "none"
    });
    if (a.type === "click") {
    a.preventDefault();
    var i, linkage = $(this).find("a");
    linkage.each(function(i, link) {
    var linktext = $(link).text() === undefined ? $(link).attr("href") : $(link).text().replace(/[\n\r\s]+/g, " ").replace(/(^\s*|\s*$)/g, "").slice(0, 100);
    var url = /^http/.test($(link).attr("href")) ? $(link).attr("href") : document.location.protocol + "//" + document.location.hostname + $(link).attr("href");
    collection.push(["- [" + linktext.replace(/[\[\]\|]+/g, "") + "](" + url + ")"]);
    });
    $("<div>").css({
    position: "fixed",
    top: "0",
    left: "0",
    right: "0",
    bottom: "0",
    overflow: "auto",
    backgroundColor: "#efefef",
    color: "#333",
    zIndex: "99999"
    }).append($("<pre id=linkoutput>").css("padding", "20px").text(collection.join("\n"))).appendTo("body").click(function() {
    var doc = document,
    text = doc.getElementById("linkoutput"),
    range, selection;
    if (doc.body.createTextRange) {
    range = doc.body.createTextRange();
    range.moveToElementText(text);
    range.select();
    } else if (window.getSelection) {
    selection = window.getSelection();
    range = doc.createRange();
    range.selectNodeContents(text);
    selection.removeAllRanges();
    selection.addRange(range);
    }
    });
    return false;
    }
    });
    });
    });
    2 changes: 1 addition & 1 deletion grab links.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red"}):$("div,table,article,section,aside").css({outline:"none"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find('a');linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr('href'):$(link).text();var url=/^http/.test($(link).attr('href'))?$(link).attr('href'):document.location.protocol+"//"+document.location.hostname+$(link).attr('href');collection.push(["-["+linktext+"]("+url+")"]);});$('<div>').css({position:'fixed',top:'0',left:'0',right:'0',bottom:'0',overflow:'auto',backgroundColor:'#efefef',color:'#333',zIndex:'99999'}).append($('<pre id="linkoutput">').css('padding','20px').text(collection.join("\n"))).appendTo('body').click(function(){var doc=document,text=doc.getElementById('linkoutput'),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}});return false;}});});});
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red"}):$("div,table,article,section,aside").css({outline:"none"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find("a");linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr("href"):$(link).text().replace(/[\n\r\s]+/g," ").replace(/(^\s*|\s*$)/g,"").slice(0,100);var url=/^http/.test($(link).attr("href"))?$(link).attr("href"):document.location.protocol+"//"+document.location.hostname+$(link).attr("href");collection.push(["- ["+linktext.replace(/[\[\]\|]+/g,"")+"]("+url+")"]);});$("<div>").css({position:"fixed",top:"0",left:"0",right:"0",bottom:"0",overflow:"auto",backgroundColor:"#efefef",color:"#333",zIndex:"99999"}).append($("<pre id=linkoutput>").css("padding","20px").text(collection.join("\n"))).appendTo("body").click(function(){var doc=document,text=doc.getElementById("linkoutput"),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}});return false;}});});});
  19. @ttscoff ttscoff revised this gist Jun 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion grab links.js
    Original file line number Diff line number Diff line change
    @@ -1 +1 @@
    javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f%3De.jQuery)%7C%7Cg>f.fn.jquery%7C%7Ch(f))%7Bc%3Da.createElement("script")%3Bc.type%3D"text/javascript"%3Bc.src%3D"http://ajax.googleapis.com/ajax/libs/jquery/"%2Bg%2B"/jquery.min.js"%3Bc.onload%3Dc.onreadystatechange%3Dfunction()%7Bif(!b%26%26(!(d%3Dthis.readyState)%7C%7Cd%3D%3D"loaded"%7C%7Cd%3D%3D"complete"))%7Bh((f%3De.jQuery).noConflict(1),b%3D1)%3Bf(c).remove()%7D%7D%3Ba.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,"1.7",function(%24,L)%7B%24(document).ready(function()%7Bvar collection%3D%5B%5D%3B%24("div,table,article,section,aside").on("mouseover mouseout click",function(a)%7Ba.type%3D%3D%3D"mouseover"%3F%24(this).css(%7Boutline:"1px solid red"%7D):%24("div,table,article,section,aside").css(%7Boutline:"none"%7D)%3Bif(a.type%3D%3D%3D"click")%7Ba.preventDefault()%3Bvar i,linkage%3D%24(this).find(%27a%27)%3Blinkage.each(function(i,link)%7Bvar linktext%3D%24(link).text()%3D%3D%3Dundefined%3F%24(link).attr(%27href%27):%24(link).text()%3Bcollection.push(%5B"-%5B"%2Blinktext%2B"%5D("%2B%24(link).attr(%27href%27)%2B")"%5D)%3B%7D)%3B%24(%27<div>%27).css(%7Bposition:%27fixed%27,top:%270%27,left:%270%27,right:%270%27,bottom:%270%27,overflow:%27auto%27,backgroundColor:%27%23efefef%27,color:%27%23333%27,zIndex:%2799999%27%7D).append(%24(%27<pre id%3D"linkoutput">%27).css(%27padding%27,%2720px%27).text(collection.join("%5Cn"))).appendTo(%27body%27).click(function()%7Bvar doc%3Ddocument,text%3Ddoc.getElementById(%27linkoutput%27),range,selection%3Bif(doc.body.createTextRange)%7Brange%3Ddoc.body.createTextRange()%3Brange.moveToElementText(text)%3Brange.select()%3B%7Delse if(window.getSelection)%7Bselection%3Dwindow.getSelection()%3Brange%3Ddoc.createRange()%3Brange.selectNodeContents(text)%3Bselection.removeAllRanges()%3Bselection.addRange(range)%3B%7D%7D)%3Breturn false%3B%7D%7D)%3B%7D)%3B%7D)%3B
    javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(function(){var collection=[];$("div,table,article,section,aside").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red"}):$("div,table,article,section,aside").css({outline:"none"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find('a');linkage.each(function(i,link){var linktext=$(link).text()===undefined?$(link).attr('href'):$(link).text();var url=/^http/.test($(link).attr('href'))?$(link).attr('href'):document.location.protocol+"//"+document.location.hostname+$(link).attr('href');collection.push(["-["+linktext+"]("+url+")"]);});$('<div>').css({position:'fixed',top:'0',left:'0',right:'0',bottom:'0',overflow:'auto',backgroundColor:'#efefef',color:'#333',zIndex:'99999'}).append($('<pre id="linkoutput">').css('padding','20px').text(collection.join("\n"))).appendTo('body').click(function(){var doc=document,text=doc.getElementById('linkoutput'),range,selection;if(doc.body.createTextRange){range=doc.body.createTextRange();range.moveToElementText(text);range.select();}else if(window.getSelection){selection=window.getSelection();range=doc.createRange();range.selectNodeContents(text);selection.removeAllRanges();selection.addRange(range);}});return false;}});});});
  20. @ttscoff ttscoff created this gist Jun 21, 2013.
    1 change: 1 addition & 0 deletions grab links.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    javascript:(function(e,a,g,h,f,c,b,d)%7Bif(!(f%3De.jQuery)%7C%7Cg>f.fn.jquery%7C%7Ch(f))%7Bc%3Da.createElement("script")%3Bc.type%3D"text/javascript"%3Bc.src%3D"http://ajax.googleapis.com/ajax/libs/jquery/"%2Bg%2B"/jquery.min.js"%3Bc.onload%3Dc.onreadystatechange%3Dfunction()%7Bif(!b%26%26(!(d%3Dthis.readyState)%7C%7Cd%3D%3D"loaded"%7C%7Cd%3D%3D"complete"))%7Bh((f%3De.jQuery).noConflict(1),b%3D1)%3Bf(c).remove()%7D%7D%3Ba.documentElement.childNodes%5B0%5D.appendChild(c)%7D%7D)(window,document,"1.7",function(%24,L)%7B%24(document).ready(function()%7Bvar collection%3D%5B%5D%3B%24("div,table,article,section,aside").on("mouseover mouseout click",function(a)%7Ba.type%3D%3D%3D"mouseover"%3F%24(this).css(%7Boutline:"1px solid red"%7D):%24("div,table,article,section,aside").css(%7Boutline:"none"%7D)%3Bif(a.type%3D%3D%3D"click")%7Ba.preventDefault()%3Bvar i,linkage%3D%24(this).find(%27a%27)%3Blinkage.each(function(i,link)%7Bvar linktext%3D%24(link).text()%3D%3D%3Dundefined%3F%24(link).attr(%27href%27):%24(link).text()%3Bcollection.push(%5B"-%5B"%2Blinktext%2B"%5D("%2B%24(link).attr(%27href%27)%2B")"%5D)%3B%7D)%3B%24(%27<div>%27).css(%7Bposition:%27fixed%27,top:%270%27,left:%270%27,right:%270%27,bottom:%270%27,overflow:%27auto%27,backgroundColor:%27%23efefef%27,color:%27%23333%27,zIndex:%2799999%27%7D).append(%24(%27<pre id%3D"linkoutput">%27).css(%27padding%27,%2720px%27).text(collection.join("%5Cn"))).appendTo(%27body%27).click(function()%7Bvar doc%3Ddocument,text%3Ddoc.getElementById(%27linkoutput%27),range,selection%3Bif(doc.body.createTextRange)%7Brange%3Ddoc.body.createTextRange()%3Brange.moveToElementText(text)%3Brange.select()%3B%7Delse if(window.getSelection)%7Bselection%3Dwindow.getSelection()%3Brange%3Ddoc.createRange()%3Brange.selectNodeContents(text)%3Bselection.removeAllRanges()%3Bselection.addRange(range)%3B%7D%7D)%3Breturn false%3B%7D%7D)%3B%7D)%3B%7D)%3B