Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions src/inject/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ chrome.extension.sendMessage({}, function(response) {
{
//Clear the data
clearData();
//Remove the title attribute
//Remove the title attribute
element.removeAttr('title');

var baseURL = window.location.origin, //Get the URL
Expand All @@ -45,18 +45,38 @@ chrome.extension.sendMessage({}, function(response) {
$.get(fullURL, function(data) {
var content = $(data).find('#bodyContent').find('p').html(),
cssRules = {
position: 'fixed',
top: 10+"px",
left: 10+"px",
position: 'fixed',
top: 10+"px",
left: 10+"px",
right: 10+"px",
maxHeight: 500+"px",
padding: 1.4+"em",
background: "#fff",
boxShadow: "2px 2px 15px rgba(50,50,50,.75)",
zIndex: 100
};
// Select article pictures that are taller than 100px
var picture = $(data).find('#bodyContent').find('img').filter(function(index) {
return $(this).attr('height') > 100;
});
// Display popup with picture
if (picture.attr('src') !== undefined) {
var new_html = '';
new_html += '<div id="popup-notification" style="display: flex;">';
new_html += '<div style="margin-top: 10px; margin-bottom: 10px; padding-left: 10px; align-self: center;">';
new_html += content;
new_html += '</div>';
new_html += '<img src=';
new_html += picture.attr('src');
new_html += ' style="width: auto; max-height: 500px; margin: 0px; padding: 0px; margin-right: 10px;">';
new_html += '</div>';
new_html += '</div>';
$(new_html).css(cssRules).appendTo('body').fadeIn();
}
// If no picture exists, display text-only popup
else {
$('<div id="popup-notification" style="padding: 10px;">'+content+'</div>').css(cssRules).appendTo('body').fadeIn();
}

$('<div id="popup-notification">'+content+'</div>').css(cssRules).appendTo('body').fadeIn();
});
}
}
Expand Down