code: function previewOnLoad() {
      pwindow = iframe.contentWindow;
      var p$ = pwindow && pwindow.$;        // preview jquery object
      if (!p$ || p$.editorLoaded) return;   // not ready || already initialized
  
      var pdoc = pwindow.document;
  
      // handle pane adjust event over preview
      pdoc.addEventListener('dragover', function(e) {
        adjustPanes(e.clientX, e.clientY, true); // handle over preview
        e.preventDefault();
      });
  
      // handle pane adjuster drop event over preview
      // (firefox will try to navigate to the url if text is dropped on it)
      pdoc.addEventListener('drop', function(e) {
        e.preventDefault();
      });
  
      pRef = pwindow.pubRef || {};
      var relPath = pRef.relPath || '';
  
      $css = p$('<link rel="stylesheet" href="' + relPath + '/pub/css/pub-preview.css">');
      p$('head').append($css);
      $css.get(0).disabled = true;
      toggleFragments();
  
      var $script = p$('<script src="' + relPath + '/pub/js/pub-preview.js"></script>');
      p$('body').append($script);
  
      p$.editorLoaded = true;
      clearInterval(previewPoller);
    }
docs: preview iframe onload handler - initializes pwindow and $css