Skip to content

Commit

Permalink
Set basedWidth and basedHeight
Browse files Browse the repository at this point in the history
Signed-off-by: Jessica González <suki@missallsunday.com>
  • Loading branch information
MissAllSunday committed Jul 26, 2016
1 parent acf4ad9 commit 0e264f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions Themes/default/scripts/ohyoutube.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Copyright (C) 2016 Jessica González
@license http://www.mozilla.org/MPL/ MPL 2.0
@version 1.2.6
@version 1.2.7
*/

var _oh = function(){
Expand All @@ -10,6 +10,8 @@ var _oh = function(){
this.defaultWidth = typeof(_ohWidth) !== 'undefined' ? _ohWidth : 480;
this.defaultHeight = typeof(_ohHeight) !== 'undefined' ? _ohHeight : 270;
this.aspectRatio = this.defaultHeight / this.defaultWidth;
this.basedWidth = this.basedElement.width() >= this.defaultWidth ? this.defaultWidth : this.basedElement.width();
this.basedHeight = this.basedElement.height() >= this.defaultHeight ? this.defaultHeight : this.basedElement.height();

this.main();
this.responsive();
Expand All @@ -24,8 +26,8 @@ _oh.prototype.main = function(){
var _element = $(this);
_element.videoID = this.id.replace('oh_','');
_element.imgsrc = $this.getImage(_element.videoID);
_element.imgHeight = $this.basedElement.height();
_element.imgWidth = $this.basedElement.width();
_element.imgHeight = $this.basedHeight;
_element.imgWidth = $this.basedWidth;

if (typeof _element.imgsrc !== 'undefined'){
_element.css({'background-image': 'url('+ _element.imgsrc +')', 'background-size': 'cover'});
Expand Down Expand Up @@ -118,4 +120,4 @@ _oh.prototype.getImage = function(youtubeID)
_ohObject.refresh();
});
});
})(jQuery);
})(jQuery);
10 changes: 5 additions & 5 deletions Themes/default/scripts/ohyoutube.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0e264f9

Please sign in to comment.