JSFiddle - React, Tailwind, and code Playground

by brysmi

JavaScript

javascript: (function() {
  // Change `silent` to true to invoke the promptless, self-closing 
  // version of the bookmarklet.
  var silent = false;
  
  var url = location.href;
  var title = document.title;

    // uncommment to open your pinboard page in chrome
    var re = new RegExp("^chrome://(.*)");
    if (re.test(url)) {
        window.location = "http://pinboard.in/u:brysmi";
        return;
    }

  // Look for a single hAtom entry on the page, and iff one is found, extract
  // the entry-title in place of the document title:
  if(document.querySelector) {
    if(1 === document.getElementsByClassName('hentry').length) {
      title = document.querySelector(
          '.hentry .entry-title, .hentry h1, .hentry h2, .hentry h3'
        ).innerText;
    }
  }
  
  // Grab the text selection (if any) and <blockquote> it in the description.
  if('' !== (text = String(document.getSelection()))) {
    text = ['<blockquote>', text, '</blockquote>', "\n\n"].join('');
  }
  else {
    var s = [],
    metas = document.getElementsByTagName('head')[0].getElementsByTagName('meta');
    for (var i = 0, L = metas.length; i < L; i++) {
      if (metas[i].name == 'description') {
        s[s.length] = metas[i].content;
      }
    }
    text = s.join(',');
    if (text.length === 0) {
      silent = true;
    }
    else {
      // I should take 2 minutes to clean this
      text = ['<blockquote>', text, '</blockquote>', "\n\n"].join('');
    }
  }

  // Grab all rel-tag microformats from the page and prefix the tags param
  if(document.querySelectorAll) {
    var tags = [].slice.call(
      document.querySelectorAll('a[rel~=tag]'),0).map(
        function(a) { 
          return a.href.split('/').pop(); 
        }
      ).join(' ');
  }
  
  // Assembles default form pre-fill arguments.
  // Note: 'tags' is not currently supported but should be.
  var args = [
    'http://pinboard.in/add?url=', encodeURIComponent(url),
    '&description=', encodeURIComponent(text),
   ...