-
Notifications
You must be signed in to change notification settings - Fork 0
Got rid of Bower and implemented Article View #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
46c25dd
b8e2116
8906f16
570a2db
2f09dd1
06af33a
b75d65c
128f46e
be1d72f
e84f679
af3c8db
f5dcf30
eb6c86a
fd86d25
8473b23
5d2db3b
c78e8f8
643c92c
cf3e281
5c656ff
6e28880
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "pocket", | ||
| "version": "1.13.0", | ||
| "version": "1.14.0", | ||
| "description": "Kitt Pocket extension.", | ||
| "private": "true", | ||
| "scripts": { | ||
|
|
@@ -17,26 +17,39 @@ | |
| }, | ||
| "homepage": "https://github.com/realyze/watchpocket", | ||
| "devDependencies": { | ||
| "bower-installer": "0.7.1", | ||
| "browserify": "~10.2.0", | ||
|
||
| "cssify": "0.7.0", | ||
| "grunt": "0.4.5", | ||
| "grunt-browserify": "3.8.0", | ||
| "grunt-bumpup": "0.5.2", | ||
| "grunt-cli": "0.1.13", | ||
| "grunt-contrib-clean": "0.5.0", | ||
| "grunt-contrib-concat": "0.4.0", | ||
| "grunt-contrib-copy": "0.5.0", | ||
| "grunt-contrib-jshint": "0.10.0", | ||
| "grunt-contrib-watch": "0.6.1", | ||
| "grunt-crx": "oncletom/grunt-crx", | ||
| "grunt-exec": "0.4.5", | ||
| "grunt-s3": "0.2.0-alpha.3", | ||
| "grunt-usemin": "2.1.1", | ||
| "grunt-contrib-copy": "0.5.0", | ||
| "grunt-contrib-concat": "0.4.0", | ||
| "grunt-bumpup": "0.5.2", | ||
| "grunt-crx": "0.3.3", | ||
| "browserify": "3.38.1", | ||
| "grunt-browserify": "2.0.3", | ||
| "cssify": "0.5.0", | ||
| "uglifyify": "2.1.1", | ||
| "grunt-contrib-clean": "0.5.0", | ||
| "watchify": "0.6.4", | ||
| "grunt-contrib-watch": "0.6.1", | ||
| "grunt-s3": "0.2.0-alpha.3" | ||
| "watchify": "3.2.2" | ||
| }, | ||
| "dependencies": { | ||
| "minilog": "^2.0.4" | ||
| "angular": "^1.3.16", | ||
| "angular-animate": "^1.3.16", | ||
| "angular-moment": "^0.10.1", | ||
| "angular-truncate-2": "^0.1.2", | ||
| "ionic-framework": "^1.0.0-beta.13.2", | ||
| "jquery": "^2.1.4", | ||
| "minilog": "^2.0.4", | ||
| "moment": "^2.10.3", | ||
| "q": "^1.4.1", | ||
| "underscore": "^1.8.3" | ||
|
||
| }, | ||
| "browserify": { | ||
| "transform": [ | ||
| "cssify" | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,13 +9,13 @@ | |
|
|
||
| <body ng-controller="bookmarksCtrl"> | ||
|
|
||
| <div class="bar bar-footer bar-calm item-input-inset"> | ||
| <div class="bar bar-header bar-calm item-input-inset"> | ||
|
||
| <button class="button ion-ios7-close" ng-click="wipeCache()" ng-show="debugMode"></button> | ||
| <label class="item-input-wrapper"> | ||
| <i class="icon ion-ios7-search placeholder-icon"></i> | ||
| <input type="search" placeholder="Search" ng-model="searchText"> | ||
| </label> | ||
| <button class="button ion-plus" ng-click="addCurrent()"></button> | ||
| <button id="add-or-article-view" class="button ion-ios7-plus" ng-click="addCurrentOrArticleView()"></button> | ||
| </div> | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| var $ = require('../vendor/jquery/jquery'); | ||
| var $ = require('jquery'); | ||
|
|
||
| require('../css/auth.css'); | ||
|
|
||
|
|
@@ -8,7 +8,6 @@ var waitForChrome = function(callback) { | |
| window.setTimeout(function() { | ||
| waitForChrome(callback); | ||
| }, 250); | ||
| return; | ||
| } else { | ||
| callback(); | ||
| } | ||
|
|
@@ -17,7 +16,6 @@ var waitForChrome = function(callback) { | |
| $(function() { | ||
| waitForChrome(function() { | ||
|
|
||
| var token = null; | ||
| var url = null; | ||
|
|
||
| var search = window.location.search; | ||
|
|
@@ -33,9 +31,6 @@ $(function() { | |
| var key = terms[i].split('=')[0]; | ||
| var value = terms[i].split('=')[1]; | ||
|
|
||
| if (key === 'token') { | ||
| token = value; | ||
| } | ||
| if (key === 'url') { | ||
| // This is only way, which I managed to get URL with symbols like (=,?,...) through login process | ||
| url = decodeURIComponent(window.atob(value)); | ||
|
|
@@ -46,16 +41,16 @@ $(function() { | |
| // The tab originally had no URL | ||
| url = 'about:blank'; | ||
| } | ||
| console.log('Response with ' + token + ' and ' + url); | ||
| console.log('Response with ' + url); | ||
|
|
||
| if (token === 'MyLittlePinkPony' && url) { | ||
| if (url) { | ||
|
||
| chrome.runtime.sendMessage({command: 'getOauthRequestToken'}, function(err, reqToken) { | ||
| chrome.runtime.sendMessage({command: 'getOauthAccessToken'}, function(err, accessToken) { | ||
| if (err) { | ||
| console.warn('Could not authenticate with pocket: ' + JSON.stringify(err)); | ||
| return; | ||
| } | ||
| console.log('Authentication to pocket successfull.'); | ||
| console.log('Authentication to pocket successful.'); | ||
| window.location.href = url; | ||
| }); | ||
| }); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,11 @@ | ||
| var _ = require('../vendor/underscore/underscore'); | ||
| require('../vendor/ionic/ionic.bundle'); | ||
| require('../vendor/angular-truncate/angular-truncate'); | ||
| require('../vendor/moment/moment'); | ||
| require('../vendor/angular-moment/angular-moment'); | ||
| require('../vendor/ngAnimate-animate.css/animate'); | ||
|
|
||
| require('../vendor/ionic/css/ionic.css'); | ||
| var _ = require('underscore'); | ||
|
||
| require('ionic-framework'); | ||
|
|
||
| require('../../node_modules/ionic-framework/release/css/ionic.css'); | ||
| require('../vendor/animate.css/animate.css'); | ||
| require('../css/pocket.css'); | ||
|
|
||
| var Minilog = require("../../node_modules/minilog"); | ||
| var Minilog = require('minilog'); | ||
| var common = require('./common'); | ||
|
|
||
| var log = Minilog('app'); | ||
|
|
@@ -22,10 +18,6 @@ var CLEAN_CACHE_SEARCH_STRING = 'salsa:ccache'; | |
|
|
||
| window.angular.module('pocket', [ | ||
| 'ionic', | ||
| 'truncate', | ||
| 'angularMoment', | ||
| 'ngAnimate', | ||
| 'ngAnimate-animate.css' | ||
| ]) | ||
|
|
||
| .controller('bookmarksCtrl', function($scope, $ionicLoading) { | ||
|
|
@@ -35,12 +27,25 @@ window.angular.module('pocket', [ | |
|
|
||
| $scope.bookmarks = []; | ||
| $scope.allResultsFetched = false; | ||
| $scope.pagePocketed = false; | ||
|
|
||
| $scope.$watch('bookmarks', function(newVal, oldVal) { | ||
| if (newVal !== oldVal && newVal === []) { | ||
| $scope.allResultsFetched = false; | ||
| $scope.loadNextPage(); | ||
| } | ||
| // Change add button to article view if page has already been pocketed | ||
| // or back to add button if it has been removed | ||
| common.getActiveTab().then(function(tab) { | ||
| var item = _.findWhere($scope.bookmarks, {url: tab.url}); | ||
| if (item && !$scope.pagePocketed) { | ||
|
||
| document.getElementById('add-or-article-view').setAttribute('class', 'button ion-ios7-paper'); | ||
| } | ||
| else if (!item && $scope.pagePocketed) { | ||
| document.getElementById('add-or-article-view').setAttribute('class', 'button ion-ios7-plus'); | ||
| } | ||
| $scope.pagePocketed = !!item; | ||
| }); | ||
| }, true); | ||
|
|
||
| $scope.loadNextPage = function() { | ||
|
|
@@ -147,7 +152,6 @@ window.angular.module('pocket', [ | |
| count: count, | ||
| }) | ||
| }, function(response) { | ||
| log.debug('reponse', response); | ||
| if ( ! response) { | ||
| window.close(); | ||
| return; | ||
|
|
@@ -172,15 +176,32 @@ window.angular.module('pocket', [ | |
| }); | ||
| }; | ||
|
|
||
| $scope.addCurrent = function() { | ||
| $scope.addCurrentOrArticleView = function() { | ||
|
||
| common.getActiveTab().then(function(tab) { | ||
| chrome.runtime.sendMessage(null, { | ||
| command: 'addBookmark', | ||
| url: tab.url | ||
| }, function() { | ||
| window.close(); | ||
| $scope.$apply(); | ||
| }); | ||
| if ($scope.pagePocketed) { | ||
| chrome.runtime.sendMessage(null, { | ||
| command: 'requestArticleView', | ||
| url: tab.url | ||
| }, function(response) { | ||
| common.getActiveTab().then(function(tab) { | ||
| chrome.tabs.sendMessage(tab.id, { | ||
| command: 'showArticleView', | ||
| title: response.title, | ||
| html: response.article | ||
| }); | ||
| window.close(); | ||
| }); | ||
| }); | ||
| } | ||
| else { | ||
| chrome.runtime.sendMessage(null, { | ||
| command: 'addBookmark', | ||
| url: tab.url | ||
| }, function() { | ||
| window.close(); | ||
| $scope.$apply(); | ||
| }); | ||
| } | ||
| }); | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| var Q = require('../vendor/q/q'); | ||
| var Q = require('q'); | ||
|
|
||
| var getActiveTab = function() { | ||
| var defer = Q.defer(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| module.exports = { | ||
| consumerKey: '28148-433066734282d2aef4f9aafe', | ||
| pocket_api_endpoint: 'https://getpocket.com/v3' | ||
| consumerKey: '38767-70f457996273e97445b7e8f4', | ||
|
||
| pocket_api_endpoint: 'https://getpocket.com/v3', | ||
| article_view_endpoint: 'http://text.getpocket.com/v3/text' | ||
|
||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
|
|
||
| chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | ||
| if (request.command === 'showArticleView') { | ||
| document.head.innerHTML = '<style>img { max-width: 100% }</style>'; | ||
|
||
| document.body.innerHTML = '<h1>' + request.title + '</h1>' + request.html; | ||
| } | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Death to trailing whitespace!