Skip to content

Commit 4ec2bba

Browse files
authored
Merge pull request #78 from lyonx/search
Add notes and search support
2 parents 8466e5f + 1fbab40 commit 4ec2bba

14 files changed

+615
-388
lines changed

widget/assets/css/style.css

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -734,11 +734,19 @@ html[browser="Firefox"] .layout3 .list-layout .list-item-media .list-media-holde
734734
.holder.now-playing .media-header-link a{
735735
color:#fff;
736736
}
737-
.holder.now-playing .media-player-action-btns .icon{
738-
font-size:25px;
737+
.holder.now-playing .media-player-action-btns{
738+
display: flex;
739+
justify-content: center;
740+
margin-top: 8px;
739741
}
740-
.holder.now-playing .media-player-action-btns .icon + .icon{
741-
margin-left:60px;
742+
.holder.now-playing .media-player-action-btns span{
743+
font-size: 18px;
744+
padding: 8px 16px;
745+
margin-top: 12px;
746+
display: block;
747+
}
748+
.holder.now-playing .media-player-action-btns .media-center-btn{
749+
margin: 12px 16px 0 16px;
742750
}
743751
.holder.now-playing .media-player-btns .icon.icon-sm{
744752
font-size:22px;
@@ -1382,11 +1390,12 @@ input.volume-button[type=range]:focus::-ms-fill-upper {
13821390
}
13831391
.layout1-detail .li-actions,
13841392
.layout2-detail .li-actions{
1393+
display: flex;
13851394
position: relative;
13861395
}
13871396
.item-actions{
13881397
margin: 16px 0;
1389-
padding: 8px 16px;
1398+
padding: 0 0 0 16px;
13901399
border-top: 1px solid #ddd;
13911400
border-bottom: 1px solid #ddd;
13921401
display: flex;
@@ -1402,8 +1411,10 @@ input.volume-button[type=range]:focus::-ms-fill-upper {
14021411
.layout2-detail .li-actions i{
14031412
flex-shrink: 0;
14041413
position: relative;
1405-
display: inline-block;
1406-
margin-left: 8px;
1414+
display: block;
1415+
padding: 16px;
1416+
flex-shrink: 0;
1417+
top: 0;
14071418
}
14081419
.layout2-detail .li-actions .share,
14091420
.layout2-detail .li-actions .bookmark{
@@ -1414,8 +1425,4 @@ input.volume-button[type=range]:focus::-ms-fill-upper {
14141425
}
14151426
.layout1-detail .audio-player-holder img{
14161427
max-height: 400px;
1417-
}
1418-
/* Hide share button until functionality is ready*/
1419-
.share{
1420-
/* display: none !important; */
1421-
}
1428+
}

widget/assets/js/videogular.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ angular.module("com.2fdevs.videogular")
131131
*/
132132
angular.module("com.2fdevs.videogular")
133133
.controller("vgController",
134-
['$scope', '$window', 'vgConfigLoader', 'vgFullscreen', 'VG_UTILS', 'VG_STATES', 'VG_VOLUME_KEY', function ($scope, $window, vgConfigLoader, vgFullscreen, VG_UTILS, VG_STATES, VG_VOLUME_KEY) {
134+
['$scope', '$rootScope', '$window', 'vgConfigLoader', 'vgFullscreen', 'VG_UTILS', 'VG_STATES', 'VG_VOLUME_KEY', function ($scope, $rootScope, $window, vgConfigLoader, vgFullscreen, VG_UTILS, VG_STATES, VG_VOLUME_KEY) {
135135
var currentTheme = null;
136136
var isFullScreenPressed = false;
137137
var isMetaDataLoaded = false;
@@ -516,6 +516,7 @@ angular.module("com.2fdevs.videogular")
516516
if (vgFullscreen.isAvailable) {
517517
document.addEventListener(vgFullscreen.onchange, this.onFullScreenChange.bind(this));
518518
}
519+
$rootScope.videogularScope = $scope;
519520
};
520521

521522
this.onUpdateTheme = function onUpdateTheme(newValue) {

widget/bookmarkHandler.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ var bookmarks = {
1919
});
2020
} else if ($scope.WidgetMedia) {
2121
$scope.WidgetMedia.item.bookmarked = true;
22+
} else if ($scope.NowPlaying) {
23+
$scope.NowPlaying.item.bookmarked = true;
2224
}
2325
if (!$scope.$$phase) {
2426
$scope.$apply();
@@ -37,6 +39,8 @@ var bookmarks = {
3739
});
3840
} else if ($scope.WidgetMedia) {
3941
$scope.WidgetMedia.item.bookmarked = false;
42+
} else if ($scope.NowPlaying) {
43+
$scope.NowPlaying.item.bookmarked = false;
4044
}
4145
if (!$scope.$$phase) {
4246
$scope.$apply();

widget/controllers/widget.home.controller.js

Lines changed: 69 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,64 @@
99
$rootScope.deviceHeight = window.innerHeight;
1010
$rootScope.deviceWidth = window.innerWidth || 320;
1111

12+
var _path = $location.path();
13+
$scope.first = true;
14+
/**
15+
* @name handleBookmarkNav
16+
* @type {function}
17+
* Handles incoming bookmark navigation
18+
*/
1219
var handleBookmarkNav = function handleBookmarkNav() {
13-
buildfire.deeplink.getData(function(data){
14-
if(data && data.link){
15-
var targetGuid = data.link;
16-
var itemLinks = _items.map(item => item.guid);
17-
var index = itemLinks.indexOf(targetGuid);
18-
if (index < 0) {
19-
console.warn('bookmarked item not found.');
20-
} else {
21-
WidgetHome.goToItem(index, _items[index]);
20+
if ($scope.first) {
21+
buildfire.deeplink.getData(function(data){
22+
if(data && data.link){
23+
var targetGuid = data.link;
24+
var itemLinks = _items.map(item => item.guid);
25+
var index = itemLinks.indexOf(targetGuid);
26+
if (index < 0) {
27+
console.warn('bookmarked item not found.');
28+
} else {
29+
if (data.timeIndex) {
30+
_items[index].seekTo = data.timeIndex;
31+
}
32+
$rootScope.deeplinkFirstNav = true;
33+
WidgetHome.goToItem(index, _items[index]);
34+
}
35+
$scope.first = false;
36+
if (!$scope.$$phase) $scope.$apply();
2237
}
23-
}
24-
});
38+
});
39+
}
2540
};
2641

2742
/**
2843
* Private variables
2944
*
30-
* _items used to hold RSS feed items and helps in lazy loading.
45+
* @name _items used to hold RSS feed items and helps in lazy loading.
3146
* @type {object}
3247
* @private
3348
*
34-
* limit used to load a number of items in list on scroll
49+
* @name limit used to load a number of items in list on scroll
3550
* @type {number}
3651
* @private
3752
*
38-
* chunkData used to hold chunks of _items.
53+
* @name chunkData used to hold chunks of _items.
3954
* @type {object}
4055
* @private
4156
*
42-
* nextChunkDataIndex used to hold index of next chunk.
57+
* @name nextChunkDataIndex used to hold index of next chunk.
4358
* @type {number}
4459
* @private
4560
*
46-
* nextChunk used to hold chunk based on nextChunkDataIndex token.
61+
* @name nextChunk used to hold chunk based on nextChunkDataIndex token.
4762
* @type {object}
4863
* @private
4964
*
50-
* totalChunks used to hold number of available chunks i.e. chunkData.length.
65+
* @name totalChunks used to hold number of available chunks i.e. chunkData.length.
5166
* @type {number}
5267
* @private
5368
*
54-
* currentRssUrl used to hold previously saved rss url.
69+
* @name currentRssUrl used to hold previously saved rss url.
5570
* @type {string}
5671
* @private
5772
*
@@ -81,36 +96,37 @@
8196
}
8297
};
8398

84-
/*
85-
* WidgetHome.data is used to hold user's data object which used throughout the app.
99+
/**
100+
* @name WidgetHome.data is used to hold user's data object which used throughout the app.
86101
* @type {object}
87102
*/
88103
WidgetHome.data = null;
89104
WidgetHome.view=null;
90105

91-
/*
92-
* WidgetHome.items is used to listing items.
106+
/**
107+
* @name WidgetHome.items is used to listing items.
93108
* @type {object}
94109
*/
95110
WidgetHome.items = [];
96111

97-
/*
98-
* WidgetHome.busy is used to disable ng-infinite scroll when more data not available to show.
112+
/**
113+
* @name WidgetHome.busy is used to disable ng-infinite scroll when more data not available to show.
99114
* @type {boolean}
100115
*/
101116
WidgetHome.busy = false;
102117

103-
/*
104-
* WidgetHome.isItems is used to show info message when _items.length == 0.
118+
/**
119+
* @name WidgetHome.isItems is used to show info message when _items.length == 0.
105120
* @type {boolean}
106121
*/
107122
WidgetHome.isItems = true;
108123

109124
$rootScope.showFeed = true;
110125

111126
/**
112-
* resetDefaults() private method
127+
* @name resetDefaults()
113128
* Used to reset default values
129+
* @private
114130
*/
115131
var resetDefaults = function () {
116132
chunkData = null;
@@ -123,9 +139,9 @@
123139
WidgetHome.isItems = true;
124140
ItemDetailsService.setData(null);
125141
};
126-
142+
127143
/**
128-
* getImageUrl() private method
144+
* @name getImageUrl()
129145
* Used to extract image url
130146
* @param item
131147
* @returns {*}
@@ -161,7 +177,8 @@
161177
};
162178

163179
/**
164-
* getFeedData() private method
180+
* @name getFeedData()
181+
* @private
165182
* used to fetch RSS feed Data object if a valid RSS feed url provided
166183
* @param rssUrl
167184
*/
@@ -187,6 +204,7 @@
187204
handleBookmarkNav();
188205
Buildfire.spinner.hide();
189206
isInit = false;
207+
searchEngine.indexFeed(rssUrl);
190208
}
191209
, error = function (err) {
192210
Buildfire.spinner.hide();
@@ -196,7 +214,8 @@
196214
};
197215

198216
/**
199-
* onUpdateCallback() private method
217+
* @name onUpdateCallback()
218+
* @private
200219
* Will be called when DataStore.onUpdate() have been made.
201220
* @param event
202221
*/
@@ -228,7 +247,8 @@
228247
};
229248

230249
/**
231-
* init() private function
250+
* @name init()
251+
* @private
232252
* It is used to fetch previously saved user's data
233253
*/
234254
var init = function () {
@@ -266,17 +286,17 @@
266286
};
267287

268288
/**
269-
* init() function invocation to fetch previously saved user's data from datastore.
289+
* @name init() function invocation to fetch previously saved user's data from datastore.
270290
*/
271291
init();
272292

273293
/**
274-
* DataStore.onUpdate() will invoked when there is some change in datastore
294+
* @name DataStore.onUpdate() will invoked when there is some change in datastore
275295
*/
276296
DataStore.onUpdate().then(null, null, onUpdateCallback);
277297

278298
/**
279-
* WidgetHome.showDescription() method
299+
* @name WidgetHome.showDescription() method
280300
* will be called to check whether the description have text to show or no.
281301
* @param description
282302
* @returns {boolean}
@@ -291,7 +311,7 @@
291311
};
292312

293313
/**
294-
* WidgetHome.getTitle() method
314+
* @name WidgetHome.getTitle() method
295315
* Will used to extract item title
296316
* @param item
297317
* @returns {item.title|*}
@@ -312,7 +332,7 @@
312332
};
313333

314334
/**
315-
* WidgetHome.getItemSummary() method
335+
* @name WidgetHome.getItemSummary() method
316336
* Will used to extract item summary
317337
* @param item
318338
* @returns {*}
@@ -327,7 +347,7 @@
327347
};
328348

329349
/**
330-
* WidgetHome.getItemPublishDate() method
350+
* @name WidgetHome.getItemPublishDate() method
331351
* Will used to extract item published date
332352
* @param item
333353
* @returns {*}
@@ -344,12 +364,12 @@
344364
};
345365

346366
/**
347-
* WidgetHome.goToItem() method
367+
* @name WidgetHome.goToItem() method
348368
* will used to redirect on details page
349369
* @param index
350370
*/
351371
WidgetHome.goToItem = function (index, item) {
352-
viewedItems.markViewed($scope, item.link)
372+
viewedItems.markViewed($scope, item.guid)
353373
if (WidgetHome.items[index]) {
354374
WidgetHome.items[index].index = index;
355375
}
@@ -362,7 +382,7 @@
362382

363383
WidgetHome.bookmark = function ($event, item) {
364384
$event.stopImmediatePropagation();
365-
const isBookmarked = item.bookmarked ? true : false;
385+
var isBookmarked = item.bookmarked ? true : false;
366386
if (isBookmarked) {
367387
bookmarks.delete($scope, item);
368388
} else {
@@ -373,14 +393,14 @@
373393
WidgetHome.share = function ($event, item) {
374394
$event.stopImmediatePropagation();
375395

376-
const options = {
396+
var options = {
377397
subject: item.title,
378-
text: `${item.title}, by ${item.author}`,
398+
text: item.title + ", by " + item.author,
379399
// image: item.image.url,
380400
link: item.link
381401
};
382402

383-
const callback = err => {
403+
var callback = function(err) {
384404
if (err) {
385405
console.warn(err);
386406
}
@@ -389,19 +409,18 @@
389409
buildfire.device.share(options, callback);
390410
};
391411

392-
393-
const initAuthUpdate = () => {
394-
Buildfire.auth.onLogin(() => {
412+
var initAuthUpdate = function () {
413+
Buildfire.auth.onLogin(function () {
395414
init();
396415
});
397-
398-
Buildfire.auth.onLogout(() => {
416+
417+
Buildfire.auth.onLogout(function () {
399418
init();
400419
});
401420
};
402421

403422
/**
404-
* WidgetHome.loadMore() function
423+
* @name WidgetHome.loadMore() function
405424
* will used to load more items on scroll to implement lazy loading
406425
*/
407426
WidgetHome.loadMore = function () {

0 commit comments

Comments
 (0)