chrome_extension/js/hover.js
/**
 * This is where we actually put content into the hover div. We start by
 * placing our loading gif so the user knows that we are retreiving the data.
 * Next we trigger an ajax call to the link and extract the selftext_html
 * from the JSON result.
 *
 * @argument {string} linkId The id of the link to fetch.
 **/
This is where we actually put content into the hover div. We start by
placing our loading gif so the user knows that we are retreiving the data.
Next we trigger an ajax call to the link and extract the selftext_html
from the JSON result.

@argument {string} linkId The id of the link to fetch.
This is where we actually put content into the hover div . We start by placing our loading gif so the user knows that we are retreiving the data . Next we trigger an ajax call to the link and extract the selftext_html from the JSON result . @argument { string } linkId The id of the link to fetch .
function populateHover(linkId) {
  lastLink = linkId;
  $('#reddit-hover').html('<img src="' + chrome.extension.getURL(getLoadingImage()) + '" />');
  $.ajax({
    url: window.location.protocol + '//www.reddit.com/api/expando',
    type: 'POST',
    data: {
      'link_id': linkId
    },
    success: function(data) {
      $('#reddit-hover').html(html_entity_decode(data));
      $('#reddit-hover').prepend(getOptionsDiv());
      if (markAsVisitedEnabled()) {
	chrome.extension.sendRequest({action: 'addUrlToHistory', url: lastUrl});
      }
    }
  }).fail(function() {
    hideHover();
    lastUrl = '';
    lastLink = null;
    $('#reddit-hover').html('');
  });
}
function populateHover ( linkId ) { lastLink = linkId ; $ ( '#reddit-hover' ) . html ( '<img src="' + chrome . extension . getURL ( getLoadingImage ( ) ) + '" />' ) ; $ . ajax ( { url : window . location . protocol + '//www.reddit.com/api/expando' , type : 'POST' , data : { 'link_id' : linkId } , success : function ( data ) { $ ( '#reddit-hover' ) . html ( html_entity_decode ( data ) ) ; $ ( '#reddit-hover' ) . prepend ( getOptionsDiv ( ) ) ; if ( markAsVisitedEnabled ( ) ) { chrome . extension . sendRequest ( { action : 'addUrlToHistory' , url : lastUrl } ) ; } } } ) . fail ( function ( ) { hideHover ( ) ; lastUrl = '' ; lastLink = null ; $ ( '#reddit-hover' ) . html ( '' ) ; } ) ; }
This is where we actually put content into the hover div.
This is where we actually put content into the hover div .