Skip to content

Commit

Permalink
Merge branch 'hotfix/0.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Muffo committed Jul 21, 2016
2 parents 4cd8680 + ac40898 commit 850ae97
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ app/bower_components
test/bower_components
package
*.swp
.vscode
2 changes: 1 addition & 1 deletion app/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "__MSG_appName__",
"version": "0.7.0",
"version": "0.7.1",
"manifest_version": 2,
"description": "__MSG_appDescription__",
"icons": {
Expand Down
36 changes: 20 additions & 16 deletions app/scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function loadingOverlay() {
top: 'auto', // Top position relative to parent in px
left: 'auto' // Left position relative to parent in px
};

// Create the spinner and the overlay
var target = document.createElement('div');
document.body.appendChild(target);
Expand All @@ -61,7 +61,7 @@ function genericOverlay(message, icon, duration, overlay) {
text: message,
icon: icon
};

if (overlay === undefined || overlay === null) {
overlay = iosOverlay(settings);
}
Expand Down Expand Up @@ -90,13 +90,17 @@ function failOverlay(message, overlay) {
function addButton(btnText, btnClass, btnAction, deleteBtnClass) {

// Search the button to open the website and the container element
var openWebsiteBtn = document.querySelector('.websiteCallForAction');
var openWebsiteBtn = document.querySelector('.u100Entry .fx-button.secondary.full-width');
var entryElement = document.querySelector('.u100Entry');

if (openWebsiteBtn === null || entryElement === null) {
return;
}

if(openWebsiteBtn.className.indexOf('websiteCallForAction') === -1) {
openWebsiteBtn.className += ' websiteCallForAction';
}

// Create a new button used to load the article
var newButton = openWebsiteBtn.cloneNode();
newButton.className = btnClass;
Expand All @@ -108,7 +112,7 @@ function addButton(btnText, btnClass, btnAction, deleteBtnClass) {

// Add the new button to the page
entryElement.insertBefore(newButton, openWebsiteBtn);

// Remove the old button
var oldButton = document.querySelector('.' + deleteBtnClass);
if (oldButton === null) {
Expand All @@ -120,7 +124,7 @@ function addButton(btnText, btnClass, btnAction, deleteBtnClass) {
function addShowFullArticleBtn() {
addButton('Show Full Article', 'showFullArticleBtn',
fetchPageContent, 'showArticlePreviewBtn');

// Add keyboard shortcut
if (options.enableShortcut) {
Mousetrap.bind('f f', fetchPageContent);
Expand All @@ -130,7 +134,7 @@ function addShowFullArticleBtn() {
function addShowArticlePreviewBtn(showPreviewFunction) {
addButton('Show Article Preview', 'showArticlePreviewBtn',
showPreviewFunction, 'showFullArticleBtn');

// Add keyboard shortcut
if (options.enableShortcut) {
Mousetrap.bind('f f', showPreviewFunction);
Expand All @@ -140,12 +144,12 @@ function addShowArticlePreviewBtn(showPreviewFunction) {

/* ===================== Boilerpipe ===================== */
/**
* Process the content of the article and add it to the page
* Process the content of the article and add it to the page
*
* @param data Object JSON decoded response. Null if the request failed.
*/
function onBoilerpipeArticleExtracted(data, overlay) {

// Check if the API failed to extract the text
if (data.status === null || data.status !== 'success') {
console.log('[FullyFeedly] API failed to extract the content');
Expand All @@ -163,7 +167,7 @@ function onBoilerpipeArticleExtracted(data, overlay) {
failOverlay('contentNotFound', overlay);
return;
}

// If there is an image we want to keep it
var articleImage = contentElement.querySelector('img');
if (articleImage !== null) {
Expand All @@ -178,7 +182,7 @@ function onBoilerpipeArticleExtracted(data, overlay) {
if (articleImage !== null) {
contentElement.insertBefore(articleImage, contentElement.firstChild);
}

addUndoButton(articlePreviewHTML);
successOverlay('done', overlay);
}
Expand All @@ -203,10 +207,10 @@ function boilerpipeRequest(xhr, overlay) {

/* ===================== Readability ===================== */
/**
* Process the content of the article and add it to the page
* Process the content of the article and add it to the page
*/
function onReadabilityArticleExtracted(data, overlay) {

// Check if the API failed to extract the text
if (data.content === null) {
console.log('[FullyFeedly] API failed to extract the content');
Expand All @@ -224,7 +228,7 @@ function onReadabilityArticleExtracted(data, overlay) {
failOverlay('contentNotFound', overlay);
return;
}

// If there is an image we want to keep it
var articleImage = contentElement.querySelector('img');
if (articleImage !== null) {
Expand Down Expand Up @@ -285,11 +289,11 @@ function fetchPageContent() {
// Get the link and convert it for usage as parameter in the GET request
var pageUrl = linkElement.getAttribute('href');
var encodedPageUrl = encodeURIComponent(pageUrl);

// Show loading overlay
var overlay = loadingOverlay();

// Create the asynch HTTP request
// Create the asynch HTTP request
var xhr = new XMLHttpRequest();
var url = '';

Expand Down Expand Up @@ -327,7 +331,7 @@ function fetchPageContent() {

// Add a button to undo the operation and show the original preview of the article
function addUndoButton(articlePreviewHTML) {

function getShowPreviewFunction(articlePreviewHTML) {
return function() {
// Search the element with the content
Expand Down
45 changes: 23 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
{
"name": "fullyfeedly",
"version": "0.0.0",
"dependencies": {},
"dependencies": {
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-jshint": "~0.9.2",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-connect": "~0.7.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-htmlmin": "~0.2.0",
"grunt-bower-install": "~1.0.0",
"grunt-contrib-imagemin": "~0.7.1",
"grunt-contrib-watch": "~0.6.1",
"grunt-usemin": "~2.1.0",
"grunt-mocha": "~0.4.10",
"grunt-svgmin": "~0.4.0",
"grunt-concurrent": "~0.5.0",
"load-grunt-tasks": "~0.4.0",
"time-grunt": "~0.3.1",
"jshint-stylish": "~0.1.5",
"grunt-chrome-manifest": "~0.2.0",
"grunt-contrib-compress": "~0.9.1"
"grunt": "~1.0.1",
"grunt-bower-install": "~1.6.0",
"grunt-chrome-manifest": "~0.3.0",
"grunt-concurrent": "~2.3.0",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-compress": "~1.3.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-connect": "~1.0.2",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-cssmin": "~1.0.1",
"grunt-contrib-htmlmin": "~2.0.0",
"grunt-contrib-imagemin": "~1.0.1",
"grunt-contrib-jshint": "~1.0.0",
"grunt-contrib-uglify": "~2.0.0",
"grunt-contrib-watch": "~1.0.0",
"grunt-mocha": "~1.0.2",
"grunt-svgmin": "~3.3.0",
"grunt-usemin": "~3.1.1",
"jshint-stylish": "~2.2.0",
"load-grunt-tasks": "~3.5.0",
"time-grunt": "~1.4.0"
},
"engines": {
"node": ">=0.8.0"
Expand Down

0 comments on commit 850ae97

Please sign in to comment.