Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions www/core/directives/formattext.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ angular.module('mm.core')
* -shorten: If shorten is present, max-height="100" will be applied.
* -expand-on-click: This attribute will be discarded. The text will be expanded if shortened and fullview-on-click not true.
*/
.directive('mmFormatText', function($interpolate, $mmText, $compile, $translate, $mmUtil, $mmSitesManager, $mmFS) {
.directive('mmFormatText', function($interpolate, $mmText, $compile, $translate, $mmUtil, $mmSitesManager, $mmFS, $window) {

var extractVariableRegex = new RegExp('{{([^|]+)(|.*)?}}', 'i'),
tagsToIgnore = ['AUDIO', 'VIDEO', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA', 'A'];
Expand Down Expand Up @@ -416,14 +416,33 @@ angular.module('mm.core')
if (matches && matches[1]) {
var newUrl = $mmFS.concatenatePaths(site.getURL(), '/media/player/vimeo/wsplayer.php?video=') +
matches[1] + '&token=' + site.getToken();

// Width and height are mandatory, we need to calcualte one.
if (el.width) {
newUrl = newUrl + '&width=' + el.width;
width = el.width;
} else {
width = getElementWidth(el);
if (!width) {
width = $window.innerWidth;
}
}

if (el.height) {
newUrl = newUrl + '&height=' + el.height;
height = el.height;
} else {
height = getElementHeight(angular.element(el));
if (!height) {
height = width;
}
}

el.src = newUrl;
el.src = newUrl + '&width=' + width + '&height=' + height;
if (!el.width) {
el.width = width;
}
if (!el.height) {
el.height = height;
}
}
}
}
Expand Down