Created
December 11, 2013 19:33
-
-
Save dergachev/7916890 to your computer and use it in GitHub Desktop.
Show anchors backtick.io command. From http://bit.ly/7akCur
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { /* v2.2 -- http://bit.ly/7akCur */ | |
function ls(u, c) { | |
var h = document.getElementsByTagName("head")[0]; | |
var s = document.createElement("script"); | |
s.src = u; | |
var d = false; | |
s.onload = s.onreadystatechange = function () { | |
if (!d && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) { | |
d = true; | |
c(); | |
s.onload = s.onreadystatechange = null; | |
h.removeChild(s); | |
} | |
}; | |
h.appendChild(s); | |
} | |
var $; | |
var loc = location.href; | |
var anchorPos = location.href.lastIndexOf('#'); | |
if (anchorPos > -1) { | |
loc = loc.substring(0, anchorPos); /* if already has an anchor, it needs to be replaced */ | |
} | |
function a(e, n, t) { | |
$('<a href="' + loc + '#' + n + '" title="' + t + ': ' + n + '"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGdSURBVDjLpVMxa8JAFL6rAQUHXQoZpLU/oUOnDtKtW/MDBFHHThUKTgrqICgOEtd2EVxb2qFkKTgVChbSCnZTiVBEMBRLiEmafleCDaWxDX3w8e7dve+7l3cv1LZt8h/jvA56vV7DNM20YRgE/jyRSOR+ytvwEgAxvVwui/BF+LTvCtjNwKvj/X8CbgXPOHMEZl559HsTu93uPQi7jBiNRgMEx8PR0GIxRB+y2eze2gqQeAXoSCaqqu5bpsWIdyzGvvRrBW7rdDo2I6ZSKeq7B8x0XV/bwJWAJEnHSMwBDUEQWq5GfsJthUJhlVuv11uckyiGgiH2RWK73RYRb2cymbG7gnK5vIX9USwWI1yAI/KjLGK7teEI8HN1TizrnZWdRxxsNps8vI3YLpVKbB2EWB6XkMHzgAlvriYRSW+app1Mpy/jSCRSRSyDUON5nuJGytaAHI/vVPv9p/FischivL96gEP2bGxorhVFqYXDYQFCScwBYa9EKU1OlAkB+QLEU2AGaJ7PWKlUDiF2BBw4P9Mt/KUoije+5uAv9gGcjD6Kg4wu3AAAAABJRU5ErkJggg==" /></a>').insertBefore(e); | |
} | |
ls("http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js", function () { | |
$ = jQuery; | |
$("a[name]").each(function (i) { | |
a(this, this.name, "NAME"); | |
}); | |
$("[id]:not(input[type='hidden'])").each(function (i) { | |
a(this, this.id, "ID"); | |
}); | |
}); | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Show Anchors", | |
"description": "Allows you to easily link to a specific section of a webpage" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment