From 69092995de4c1f45d174c286bfdfeaa702c9727c Mon Sep 17 00:00:00 2001 From: Shane Church Date: Thu, 21 Jul 2016 10:50:02 -0500 Subject: [PATCH 1/2] Updated npm packages and fixed issue where Feedly changed class name for "Open Website" button, breaking the extension. --- .gitignore | 1 + app/scripts/content.js | 36 ++++++++++++++++++--------------- package.json | 45 +++++++++++++++++++++--------------------- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index b5006e5..3c2a653 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ app/bower_components test/bower_components package *.swp +.vscode diff --git a/app/scripts/content.js b/app/scripts/content.js index 94978a6..a3c8409 100644 --- a/app/scripts/content.js +++ b/app/scripts/content.js @@ -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); @@ -61,7 +61,7 @@ function genericOverlay(message, icon, duration, overlay) { text: message, icon: icon }; - + if (overlay === undefined || overlay === null) { overlay = iosOverlay(settings); } @@ -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; @@ -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) { @@ -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); @@ -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); @@ -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'); @@ -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) { @@ -178,7 +182,7 @@ function onBoilerpipeArticleExtracted(data, overlay) { if (articleImage !== null) { contentElement.insertBefore(articleImage, contentElement.firstChild); } - + addUndoButton(articlePreviewHTML); successOverlay('done', overlay); } @@ -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'); @@ -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) { @@ -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 = ''; @@ -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 diff --git a/package.json b/package.json index 4f9b676..5b92f61 100644 --- a/package.json +++ b/package.json @@ -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" From ac40898d77fa2443ec2ec62c758ddac3a0192abb Mon Sep 17 00:00:00 2001 From: Andrea Grandi Date: Thu, 21 Jul 2016 19:24:17 +0100 Subject: [PATCH 2/2] Increase version number to 0.7.1 --- app/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/manifest.json b/app/manifest.json index b573a92..8f4e0e6 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -1,6 +1,6 @@ { "name": "__MSG_appName__", - "version": "0.7.0", + "version": "0.7.1", "manifest_version": 2, "description": "__MSG_appDescription__", "icons": {