From 7ac21fb5ba429a3b77ae929c1f3f22d605617724 Mon Sep 17 00:00:00 2001 From: Jonathan Hornung Date: Wed, 18 Nov 2015 10:02:22 +0100 Subject: [PATCH] fix: fixed small bug --- bower.json | 2 +- dist/angular-youtube-api-factory.min.js | 4 ++-- package.json | 2 +- src/angular-youtube-api-factory.js | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index 147557c..1264e82 100644 --- a/bower.json +++ b/bower.json @@ -4,7 +4,7 @@ "authors": [ "Jonathan Hornung " ], - "version": "0.3.4", + "version": "0.3.5", "description": "angular factory for youtube rest api connection", "main": "dist/angular-youtube-api-factory.min.js", "moduleType": [], diff --git a/dist/angular-youtube-api-factory.min.js b/dist/angular-youtube-api-factory.min.js index 7451f7a..393d7aa 100644 --- a/dist/angular-youtube-api-factory.min.js +++ b/dist/angular-youtube-api-factory.min.js @@ -1,3 +1,3 @@ -/*! angular-youtube-api-factory 17-11-2015 */ -"use strict";angular.module("jtt_youtube",[]).factory("youtubeFactory",["$http","youtubeSearchDataService",function(a,b){var c={};return c.getVideosFromChannelById=function(c){var d=b.getNew("videosFromChannelById",c);return a({method:"GET",url:d.url,params:d.object})},c.getVideosFromSearchByString=function(c){var d=b.getNew("videosFromSearchByString",c);return a({method:"GET",url:d.url,params:d.object})},c.getVideosFromPlaylistById=function(c){var d=b.getNew("videosFromPlaylistById",c);return a({method:"GET",url:d.url,params:d.object})},c.getChannelById=function(c){var d=b.getNew("channelById",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("youtubeSearchDataService",function(){this.getApiBaseUrl=function(a){return"https://content.googleapis.com/youtube/v3/"},this.getNew=function(a,b){var c={object:{},url:""};switch(a){case"videosFromChannelById":c.object={part:"id,snippet",type:"video",channelId:b.channelId,order:b.order||"date",key:b.key,maxResults:b.maxResults||20},b.searchString&&(c.object.q=b.searchString),c.url=this.getApiBaseUrl()+"search?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&");break;case"videosFromSearchByString":c.object={part:"id,snippet",type:"video",q:b.searchString,order:b.order||"date",key:b.key,maxResults:b.maxResults||20},c.url=this.getApiBaseUrl()+"search?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&");break;case"videosFromPlaylistById":c.object={part:"id,snippet",type:"video",playlistId:b.playlistId,key:b.key,maxResults:b.maxResults||20},c.url=this.getApiBaseUrl()+"playlistItems?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&");break;case"channelById":c.object={part:"id,snippet",type:"channel",channelId:b.channelId,key:b.key,maxResults:b.maxResults||1},c.url=this.getApiBaseUrl()+"search?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&")}return c}}); \ No newline at end of file +/*! angular-youtube-api-factory 18-11-2015 */ +"use strict";angular.module("jtt_youtube",[]).factory("youtubeFactory",["$http","youtubeSearchDataService",function(a,b){var c={};return c.getVideosFromChannelById=function(c){var d=b.getNew("videosFromChannelById",c);return a({method:"GET",url:d.url,params:d.object})},c.getVideosFromSearchByString=function(c){var d=b.getNew("videosFromSearchByString",c);return a({method:"GET",url:d.url,params:d.object})},c.getVideosFromPlaylistById=function(c){var d=b.getNew("videosFromPlaylistById",c);return a({method:"GET",url:d.url,params:d.object})},c.getChannelById=function(c){var d=b.getNew("channelById",c);return a({method:"GET",url:d.url,params:d.object})},c}]).service("youtubeSearchDataService",function(){this.getApiBaseUrl=function(a){return"https://content.googleapis.com/youtube/v3/"},this.getNew=function(a,b){var c={object:{},url:""};switch(a){case"videosFromChannelById":c.object={part:"id,snippet",type:"video",channelId:b.channelId,order:b.order||"date",key:b.key,maxResults:b.maxResults||20},b.q&&(c.object.q=b.q),c.url=this.getApiBaseUrl()+"search?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&");break;case"videosFromSearchByString":c.object={part:"id,snippet",type:"video",q:b.q,order:b.order||"date",key:b.key,maxResults:b.maxResults||20},c.url=this.getApiBaseUrl()+"search?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&");break;case"videosFromPlaylistById":c.object={part:"id,snippet",type:"video",playlistId:b.playlistId,key:b.key,maxResults:b.maxResults||20},c.url=this.getApiBaseUrl()+"playlistItems?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&");break;case"channelById":c.object={part:"id,snippet",type:"channel",channelId:b.channelId,key:b.key,maxResults:b.maxResults||1},c.url=this.getApiBaseUrl()+"search?",b.nextPageToken&&(c.url+="pageToken="+b.nextPageToken+"&")}return c}}); \ No newline at end of file diff --git a/package.json b/package.json index 21aadd7..5422a0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-youtube-api-factory", - "version": "0.3.4", + "version": "0.3.5", "description": "angularjs factory for youtube json rest api requests", "main": "Gruntfile.js", "scripts": { diff --git a/src/angular-youtube-api-factory.js b/src/angular-youtube-api-factory.js index 0a0dfac..ac43774 100644 --- a/src/angular-youtube-api-factory.js +++ b/src/angular-youtube-api-factory.js @@ -80,8 +80,8 @@ angular.module("jtt_youtube", []) maxResults: _params.maxResults || 20, }; - if (_params.searchString) { - youtubeSearchData.object.q = _params.searchString; + if (_params.q) { + youtubeSearchData.object.q = _params.q; } youtubeSearchData.url = this.getApiBaseUrl()+"search?"; @@ -95,7 +95,7 @@ angular.module("jtt_youtube", []) youtubeSearchData.object = { part: "id,snippet", type: "video", - q: _params.searchString, + q: _params.q, order: _params.order || "date", key: _params.key, maxResults: _params.maxResults || 20,