Skip to content
Browse files

safer hash reading

  • Loading branch information...
1 parent aeb8a2f commit f0c3714ba692e3c61ed96b74193a883ab17e2dec @mrclay mrclay committed with Mar 4, 2012
Showing with 13 additions and 4 deletions.
  1. +13 −4 min/builder/_index.js
View
17 min/builder/_index.js
@@ -214,10 +214,19 @@ var MUB = {
if (location.hash) {
// make links out of URIs from bookmarklet
$('#getBm').hide();
- $('#bmUris').html('<p><strong>Found by bookmarklet:</strong> /<a href=#>' +
- location.hash.substr(1).split(',').join('</a> | /<a href=#>') +
- '</a></p>'
- );
+ var i = 0, found = location.hash.substr(1).split(','), l = found.length;
+ $('#bmUris').html('<p><strong>Found by bookmarklet:</strong> /</p>');
+ var $p = $('#bmUris p');
+ for (; i < l; i++) {
+ $p.append($('<a href=#></a>').text(found[i])[0]);
+ if (i < (l - 1)) {
+ $p.append(', /');
+ }
+ }
+// $('#bmUris').html('<p><strong>Found by bookmarklet:</strong> /<a href=#>' +
+// location.hash.substr(1).split(',').join('</a> | /<a href=#>') +
+// '</a></p>'
+// );
$('#bmUris a').click(function () {
MUB.addButtonClick();
$('#sources li:last input').val(this.innerHTML);

0 comments on commit f0c3714

Please sign in to comment.
Something went wrong with that request. Please try again.