diff --git a/public_html/css/home.css b/public_html/css/home.css index d51f1667..46eb93e2 100644 --- a/public_html/css/home.css +++ b/public_html/css/home.css @@ -10,10 +10,11 @@ } #home .post { - text-align: left; + text-align: center; margin: 0 auto; display: inline-block; max-width: 60%; + min-width: 32em; } #home .post .left { display: inline-block; diff --git a/public_html/css/post.css b/public_html/css/post.css index 8ffbf750..cbd00740 100644 --- a/public_html/css/post.css +++ b/public_html/css/post.css @@ -1,34 +1,3 @@ -.post-type-image .object-wrapper { - max-width: 100%; - position: relative; -} -.post-type-image .object-wrapper img { - position: absolute; - width: 100%; - height: 100%; -} - -.post-type-youtube .object-wrapper { - max-width: 800px; - position: relative; -} -.post-type-youtube .object-wrapper .padding-fix { - padding-bottom: 75%; -} -.post-type-youtube .object-wrapper iframe { - position: absolute; - width: 100%; - height: 100%; - border: 0; -} - -.post-type-video .object-wrapper { - max-width: 100%; -} -.post-type-video .object-wrapper video { - width: 100%; -} - #post-current-search-wrapper { text-align: center; } @@ -195,6 +164,25 @@ position: relative; margin-bottom: 0.5em; } +.post-content .object-wrapper { + max-width: 100%; + position: relative; +} +.post-content .object-wrapper img, +.post-content .object-wrapper object, +.post-content .object-wrapper iframe, +.post-content .object-wrapper video { + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + border: 0; +} +.post-content .object-wrapper video { + background: black; +} + .post-notes-target { position: absolute; pointer-events: none; diff --git a/public_html/js/Presenters/HomePresenter.js b/public_html/js/Presenters/HomePresenter.js index 4829467a..6bb71878 100644 --- a/public_html/js/Presenters/HomePresenter.js +++ b/public_html/js/Presenters/HomePresenter.js @@ -41,7 +41,14 @@ App.Presenters.HomePresenter = function( if ($el.find('#post-content-target').length > 0) { presenterManager.initPresenters([ [postContentPresenter, {post: post, $target: $el.find('#post-content-target')}]], - function() {}); + function() { + var $wrapper = $el.find('.object-wrapper'); + $wrapper.css({ + maxWidth: $wrapper.attr('data-width') + 'px', + width: 'auto', + margin: '0 auto'}); + postContentPresenter.updatePostNotesSize(); + }); } }).fail(function(response) { diff --git a/public_html/js/Presenters/PostContentPresenter.js b/public_html/js/Presenters/PostContentPresenter.js index db9f874a..e03d865b 100644 --- a/public_html/js/Presenters/PostContentPresenter.js +++ b/public_html/js/Presenters/PostContentPresenter.js @@ -45,8 +45,14 @@ App.Presenters.PostContentPresenter = function( } function updatePostNotesSize() { - $target.find('.post-notes-target').width($target.find('.object-wrapper').outerWidth()); - $target.find('.post-notes-target').height($target.find('.object-wrapper').outerHeight()); + var $postNotes = $target.find('.post-notes-target'); + var $objectWrapper = $target.find('.object-wrapper'); + $postNotes.css({ + width: $objectWrapper.outerWidth() + 'px', + height: $objectWrapper.outerHeight() + 'px', + left: ($objectWrapper.offset().left - $objectWrapper.parent().offset().left) + 'px', + top: ($objectWrapper.offset().top - $objectWrapper.parent().offset().top) + 'px', + }); } function addNewPostNote() { diff --git a/public_html/templates/home.tpl b/public_html/templates/home.tpl index fa646943..9f8238fe 100644 --- a/public_html/templates/home.tpl +++ b/public_html/templates/home.tpl @@ -5,7 +5,7 @@
<% if (post && post.id) { %> -