   sourceSite = sourcePageElement.data('site')
 
   destinationPageElement = itemElement.parents('.page:first')
-  journalElement = thisPageElement.find('.journal')
   equals = (a, b) -> a and b and a.get(0) == b.get(0)
 
   moveWithinPage = not sourcePageElement or equals(sourcePageElement, destinationPageElement)

      page.story.push heading, hits...
      page.story[0].text = 'We could not find this page in the expected context.'

    wiki.buildPage( page, undefined, $pageElement ).addClass('ghost')

  registerNeighbors = (data, site) ->
    if _.include ['local', 'origin', 'view', null, undefined], site

  action.id = item.id
  pageHandler.put thisPageElement, action

initDragging = ($page) ->
  $story = $page.find('.story')
  $story.sortable(connectWith: '.page .story').on("sortupdate", handleDragging)


initAddButton = ($page) ->
  $page.find(".add-factory").live "click", (evt) ->
    return if $page.hasClass 'ghost'
    evt.preventDefault()
    createFactory($page)

createFactory = ($page) ->
  item =
    type: "factory"
    id: util.randomBytes(8)
  itemElement = $("<div />", class: "item factory").data('item',item).attr('data-id', item.id)
  itemElement.data 'pageElement', $page
  $page.find(".story").append(itemElement)
  plugin.do itemElement, item
  beforeElement = itemElement.prev('.item')
  before = wiki.getItem(beforeElement)
  pageHandler.put $page, {item: item, id: item.id, type: "add", after: before?.id}

buildPageHeader = ({title,tooltip,header_href,favicon_src})->
  """<h1 title="#{tooltip}"><a href="#{header_href}"><img src="#{favicon_src}" height="32px" class="favicon"></a> #{title}</h1>"""

emitHeader = ($page, page) ->
  site = $page.data('site')
  isRemotePage = site? and site != 'local' and site != 'origin' and site != 'view'
  header = ''

