text: /**
   * Add the specified CSS to the current document.
   *
   * @title Add CSS
   */
  (function addcss(document, s) {
  	/* Try to get the parameter string from the bookmarklet/search query.
  	   Fall back to the current text selection, if any. If those options
  	   both fail, prompt the user.
  	*/
  	s = s || (function () { /*%s*/; }).toString()
  		.replace(/^function\s*\(\s*\)\s*\{\s*\/\*/, '')
  		.replace(/\*\/\s*\;?\s*\}\s*$/, '')
  		.replace(/\u0025s/, '');
  
  	/**
  	 * Get the active text selection, diving into frames and
  	 * text controls when necessary and possible.
  	 */
  	function getActiveSelection(doc) {
  		if (arguments.length === 0) {
  			doc = document;
  		}
  
  		if (!doc || typeof doc.getSelection !== 'function') {
  			return '';
  		}
  
  		if (!doc.activeElement) {
  			return doc.getSelection() + '';
  		}
  
  		var activeElement = doc.activeElement;
  
  		/* Recurse for FRAMEs and IFRAMEs. */
  		try {
  			if (
  				typeof activeElement.contentDocument === 'object'
  				&& activeElement.contentDocument !== null
  			) {
  				return getActiveSelection(activeElement.contentDocument);
  			}
  		} catch (e) {
  			return doc.getSelection() + '';
  		}
  
  		/* Get the selection from inside a text control. */
  		if (typeof activeElement.value === 'string') {
  			if (activeElement.selectionStart !== activeElement.selectionEnd) {
  				return activeElement.value.substring(activeElement.selectionStart, activeElement.selectionEnd);
  			}
  
  			return activeElement.value;
  		}
  
  		/* Get the normal selection. */
  		return doc.getSelection() + '';
  	}
  
  	if (s === '') {
  		s = getActiveSelection() || prompt('Please enter your CSS code:');
  	} else {
  		s = s.replace(/(^|\s|")~("|\s|$)/g, '$1' + getActiveSelection() + '$2');
  	}
  
  	if (s) {
  		document.head.appendChild(document.createElementNS('http://www.w3.org/1999/xhtml', 'style')).textContent = s;
  
  		/* Recurse for frames and iframes. */
  		try {
  			Array.prototype.slice.call(document.querySelectorAll('frame, iframe, object[type^="text/html"], object[type^="application/xhtml+xml"]')).forEach(function (elem) {
  				addcss(elem.contentDocument, s);
  			});
  		} catch (e) {
  			/* Catch exceptions for out-of-domain access, but do not do anything with them. */
  		}
  	}
  })(document);
  