angular-lazytube
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -22,3 +22,3 @@ angular.module('oblador.lazytube', [ | ||
angular.module("oblador.lazytube.templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("templates/lazytube/directive.html","<div class=\"yt-wrap\" ng-class=\"{\'yt-responsive\' : responsive }\" ng-style=\"wrapperStyle\"><a ng-href=\"http://www.youtube.com/watch?v={{id}}\" ng-click=\"showVideo($event)\" ng-show=\"!active\" ng-style=\"placeholderStyle\" class=\"yt-placeholder\"><i class=\"yt-btn\"></i></a><iframe class=\"yt-embed\" ng-if=\"active\" width=\"{{width}}\" height=\"{{height}}\" ng-src=\"{{embedUrl}}\" frameborder=\"0\" allowfullscreen></iframe></div>"); | ||
$templateCache.put("templates/lazytube/styles.html","<style type=\"text/css\">.yt-responsive{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%}.yt-placeholder{display:block;position:relative;background:#000 no-repeat 50% 50%;background-size:cover;margin:4px 0}.yt-responsive .yt-placeholder,.yt-responsive .yt-embed{position:absolute;top:0;left:0;width:100%;height:100%;margin:0}.yt-btn:before{content:\"\\25B6\\FE0E\";color:#fff;font-family:Helvetica,sans-serif}.yt-btn{position:absolute;left:50%;top:50%;width:84px;line-height:58px;margin:-29px 0 0 -42px;font-style:normal;background:#000;background:rgba(0,0,0,.8);text-align:center;font-size:28px;border-radius:10px;text-indent:5px}a:hover .yt-btn{background:#cc181e}</style>");}]); | ||
$templateCache.put("templates/lazytube/styles.html","<style type=\"text/css\">.yt-responsive{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%}.yt-placeholder{display:block;position:relative;background:#000 no-repeat 50% 50%;background-size:cover;margin:4px 0}.yt-responsive .yt-embed,.yt-responsive .yt-placeholder{position:absolute;top:0;left:0;width:100%;height:100%;margin:0}.yt-btn:before{content:\"\\25B6\\FE0E\";color:#fff;font-family:Helvetica,sans-serif}.yt-btn{position:absolute;left:50%;top:50%;width:84px;line-height:58px;margin:-29px 0 0 -42px;font-style:normal;background:#000;background:rgba(0,0,0,.8);text-align:center;font-size:28px;border-radius:10px;text-indent:5px}a:hover .yt-btn{background:#cc181e}</style>");}]); | ||
@@ -45,7 +45,11 @@ angular.module('oblador.lazytube.directive', ['oblador.lazytube.config']). | ||
if(!id) { | ||
var url = $attrs.href || $attrs.src; | ||
if(!url || !url.match(urlPattern)) { | ||
var url = $attrs.href || $attrs.src || $attrs.ngSrc; | ||
if(!url) { | ||
return; | ||
} | ||
id = RegExp.$2; | ||
var r = url.match(urlPattern); | ||
if (!r) { | ||
return; | ||
} | ||
id = r[2]; | ||
} | ||
@@ -52,0 +56,0 @@ |
@@ -1,2 +0,2 @@ | ||
angular.module("oblador.lazytube",["oblador.lazytube.templates","oblador.lazytube.config","oblador.lazytube.directive"]),angular.module("oblador.lazytube.config",[]).factory("obLazytubeConfig",function(){return{width:560,height:315,responsive:!0,urlParams:{autoplay:1}}}),angular.module("oblador.lazytube.templates",[]).run(["$templateCache",function(e){e.put("templates/lazytube/directive.html",'<div class="yt-wrap" ng-class="{\'yt-responsive\' : responsive }" ng-style="wrapperStyle"><a ng-href="http://www.youtube.com/watch?v={{id}}" ng-click="showVideo($event)" ng-show="!active" ng-style="placeholderStyle" class="yt-placeholder"><i class="yt-btn"></i></a><iframe class="yt-embed" ng-if="active" width="{{width}}" height="{{height}}" ng-src="{{embedUrl}}" frameborder="0" allowfullscreen></iframe></div>'),e.put("templates/lazytube/styles.html",'<style type="text/css">.yt-responsive{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%}.yt-placeholder{display:block;position:relative;background:#000 no-repeat 50% 50%;background-size:cover;margin:4px 0}.yt-responsive .yt-placeholder,.yt-responsive .yt-embed{position:absolute;top:0;left:0;width:100%;height:100%;margin:0}.yt-btn:before{content:"\\25B6\\FE0E";color:#fff;font-family:Helvetica,sans-serif}.yt-btn{position:absolute;left:50%;top:50%;width:84px;line-height:58px;margin:-29px 0 0 -42px;font-style:normal;background:#000;background:rgba(0,0,0,.8);text-align:center;font-size:28px;border-radius:10px;text-indent:5px}a:hover .yt-btn{background:#cc181e}</style>')}]),angular.module("oblador.lazytube.directive",["oblador.lazytube.config"]).directive("obLazytube",["$sce","$window","$templateCache","obLazytubeConfig",function(e,t,a,o){angular.element(document).find("head").prepend(a.get("templates/lazytube/styles.html"));var l=/^(?:(https?:)?\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,r="autohide autoplay cc_load_policy color controls disablekb enablejsapi end fs iv_load_policy list listType loop modestbranding origin playerapiid playlist playsinline rel showinfo start theme".split(" ");return{restrict:"A",templateUrl:"templates/lazytube/directive.html",replace:!0,transclude:!0,scope:!0,link:function(a,i,n){var s=n.obLazytube;if(!s){var d=n.href||n.src;if(!d||!d.match(l))return;s=RegExp.$2}a.id=s;var p="https:"===t.location.protocol?"https:":"http:",c=a.width=i.attr("width")||o.width,u=a.height=i.attr("height")||o.height,h=a.responsive=angular.isDefined(n.noResponsive)?!1:o.responsive;a.wrapperStyle={},a.placeholderStyle={backgroundImage:n.obPlaceholder?"url("+n.obPlaceholder+")":"url("+p+"//i.ytimg.com/vi/"+s+"/hqdefault.jpg)"},h?a.wrapperStyle.paddingBottom=100*u/c+"%":(a.placeholderStyle.width=c+"px",a.placeholderStyle.height=u+"px"),a.showVideo=function(t){var l=angular.copy(o.urlParams);angular.forEach(r,function(e){var t=n[e];angular.isDefined(t)&&(l[e]=t)});var i=[];angular.forEach(l,function(e,t){i.push(t+"="+encodeURIComponent(e))}),a.embedUrl=e.trustAsResourceUrl(p+"//www.youtube.com/embed/"+s+"/?"+i.join("&")),a.active=!0,t.preventDefault()}}}}]); | ||
//# sourceMappingURL=angular-lazytube.min.js.map | ||
angular.module("oblador.lazytube",["oblador.lazytube.templates","oblador.lazytube.config","oblador.lazytube.directive"]),angular.module("oblador.lazytube.config",[]).factory("obLazytubeConfig",function(){return{width:560,height:315,responsive:!0,urlParams:{autoplay:1}}}),angular.module("oblador.lazytube.templates",[]).run(["$templateCache",function(e){e.put("templates/lazytube/directive.html",'<div class="yt-wrap" ng-class="{\'yt-responsive\' : responsive }" ng-style="wrapperStyle"><a ng-href="http://www.youtube.com/watch?v={{id}}" ng-click="showVideo($event)" ng-show="!active" ng-style="placeholderStyle" class="yt-placeholder"><i class="yt-btn"></i></a><iframe class="yt-embed" ng-if="active" width="{{width}}" height="{{height}}" ng-src="{{embedUrl}}" frameborder="0" allowfullscreen></iframe></div>'),e.put("templates/lazytube/styles.html",'<style type="text/css">.yt-responsive{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%}.yt-placeholder{display:block;position:relative;background:#000 no-repeat 50% 50%;background-size:cover;margin:4px 0}.yt-responsive .yt-embed,.yt-responsive .yt-placeholder{position:absolute;top:0;left:0;width:100%;height:100%;margin:0}.yt-btn:before{content:"\\25B6\\FE0E";color:#fff;font-family:Helvetica,sans-serif}.yt-btn{position:absolute;left:50%;top:50%;width:84px;line-height:58px;margin:-29px 0 0 -42px;font-style:normal;background:#000;background:rgba(0,0,0,.8);text-align:center;font-size:28px;border-radius:10px;text-indent:5px}a:hover .yt-btn{background:#cc181e}</style>')}]),angular.module("oblador.lazytube.directive",["oblador.lazytube.config"]).directive("obLazytube",["$sce","$window","$templateCache","obLazytubeConfig",function(e,t,a,o){angular.element(document).find("head").prepend(a.get("templates/lazytube/styles.html"));var l=/^(?:(https?:)?\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,r="autohide autoplay cc_load_policy color controls disablekb enablejsapi end fs iv_load_policy list listType loop modestbranding origin playerapiid playlist playsinline rel showinfo start theme".split(" ");return{restrict:"A",templateUrl:"templates/lazytube/directive.html",replace:!0,transclude:!0,scope:!0,link:function(a,i,n){var s=n.obLazytube;if(!s){var c=n.href||n.src||n.ngSrc;if(!c)return;var d=c.match(l);if(!d)return;s=d[2]}a.id=s;var p="https:"===t.location.protocol?"https:":"http:",u=a.width=i.attr("width")||o.width,h=a.height=i.attr("height")||o.height,b=a.responsive=angular.isDefined(n.noResponsive)?!1:o.responsive;a.wrapperStyle={},a.placeholderStyle={backgroundImage:n.obPlaceholder?"url("+n.obPlaceholder+")":"url("+p+"//i.ytimg.com/vi/"+s+"/hqdefault.jpg)"},b?a.wrapperStyle.paddingBottom=100*h/u+"%":(a.placeholderStyle.width=u+"px",a.placeholderStyle.height=h+"px"),a.showVideo=function(t){var l=angular.copy(o.urlParams);angular.forEach(r,function(e){var t=n[e];angular.isDefined(t)&&(l[e]=t)});var i=[];angular.forEach(l,function(e,t){i.push(t+"="+encodeURIComponent(e))}),a.embedUrl=e.trustAsResourceUrl(p+"//www.youtube.com/embed/"+s+"/?"+i.join("&")),a.active=!0,t.preventDefault()}}}}]); | ||
//# sourceMappingURL=angular-lazytube.min.js.map |
@@ -21,4 +21,4 @@ var gulp = require('gulp'); | ||
gulp.task('clean', function(cb) { | ||
del(targets, cb); | ||
gulp.task('clean', function() { | ||
del.sync([targets]); | ||
}); | ||
@@ -25,0 +25,0 @@ |
{ | ||
"name": "angular-lazytube", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Lazy loading youtube videos with angular", | ||
@@ -27,15 +27,15 @@ "keywords": [ | ||
"devDependencies": { | ||
"http-server": "^0.7.4", | ||
"gulp": "~3.8.0", | ||
"gulp-uglify": "~1.0.2", | ||
"gulp-jshint": "~1.9.0", | ||
"gulp-concat": "~2.4.3", | ||
"gulp-rename": "~1.2.0", | ||
"gulp-angular-templatecache": "~1.5.0", | ||
"event-stream": "~3.2.1", | ||
"gulp-htmlmin": "~0.2.0", | ||
"del": "~1.1.1", | ||
"gulp-ng-annotate": "~0.4.3", | ||
"gulp-sourcemaps": "~1.3.0" | ||
"del": "^2.2.0", | ||
"event-stream": "^3.3.2", | ||
"gulp": "^3.9.1", | ||
"gulp-angular-templatecache": "^1.8.0", | ||
"gulp-concat": "^2.6.0", | ||
"gulp-htmlmin": "^1.3.0", | ||
"gulp-jshint": "^2.0.0", | ||
"gulp-ng-annotate": "^1.1.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^1.6.0", | ||
"gulp-uglify": "^1.5.2", | ||
"http-server": "^0.8.5" | ||
} | ||
} |
@@ -21,7 +21,11 @@ angular.module('oblador.lazytube.directive', ['oblador.lazytube.config']). | ||
if(!id) { | ||
var url = $attrs.href || $attrs.src; | ||
if(!url || !url.match(urlPattern)) { | ||
var url = $attrs.href || $attrs.src || $attrs.ngSrc; | ||
if(!url) { | ||
return; | ||
} | ||
id = RegExp.$2; | ||
var r = url.match(urlPattern); | ||
if (!r) { | ||
return; | ||
} | ||
id = r[2]; | ||
} | ||
@@ -28,0 +32,0 @@ |
Sorry, the diff of this file is not supported yet
27106
246