Browse Source

Iteration on embed

pull/2237/head
jlukic 10 years ago
parent
commit
25ba7f0321
3 changed files with 49 additions and 15 deletions
  1. 25
      src/definitions/modules/embed.js
  2. 24
      src/definitions/modules/embed.less
  3. 15
      src/themes/default/modules/embed.variables

25
src/definitions/modules/embed.js

@ -207,7 +207,10 @@ $.fn.embed = function(parameters) {
},
type: function() {
var source = module.get.source();
return sources[source].type;
return (sources[source] !== undefined)
? sources[source].type
: false
;
},
url: function() {
return (settings.url)
@ -225,19 +228,21 @@ $.fn.embed = function(parameters) {
matchedSource = false
;
url = url || module.get.url();
$.each(sources, function(name, source) {
if(url.search(source.domain) !== -1) {
matchedSource = name;
return false;
}
});
if(url) {
$.each(sources, function(name, source) {
if(url.search(source.domain) !== -1) {
matchedSource = name;
return false;
}
});
}
return matchedSource;
},
icon: function() {
var
source = module.get.source()
;
return (sources[source].icon !== undefined)
return (sources[source] !== undefined)
? sources[source].icon
: false
;
@ -248,7 +253,7 @@ $.fn.embed = function(parameters) {
source = settings.source || $module.data(metadata.source),
url
;
url = (sources[source].url !== undefined)
url = (sources[source] !== undefined)
? sources[source].url.replace('{id}', id)
: false
;
@ -302,7 +307,7 @@ $.fn.embed = function(parameters) {
html = templates.iframe(url, parameters);
}
else {
module.error(error.noURL);
module.error(error.noURL, $module);
}
return html;
},

24
src/definitions/modules/embed.less

@ -99,7 +99,6 @@
z-index: @iconZIndex;
}
/*******************************
States
*******************************/
@ -127,4 +126,25 @@
display: block;
}
.loadUIOverrides();
.loadUIOverrides();
/*******************************
Variations
*******************************/
.ui.square.embed {
padding-bottom: @squareRatio;
}
.ui[class*="4:3"].embed {
padding-bottom: @standardRatio;
}
.ui[class*="16:9"].embed {
padding-bottom: @widescreenRatio;
}
.ui[class*="21:9"].embed {
padding-bottom: @ultraWidescreenRatio;
}

15
src/themes/default/modules/embed.variables

@ -8,8 +8,6 @@
/* Simple */
@background: @lightGrey;
@widescreenRatio: (9/16) * 100%;
@standardRatio: (3/4) * 100%;
/* Placeholder */
@placeholderBackground: @background;
@ -27,4 +25,15 @@
/* Video */
@hoverIconBackground: rgba(0, 0, 0, 0);
@hoverIconColor: @white;
@hoverIconColor: @white;
/*-------------------
Variations
--------------------*/
/* Aspect Ratios */
@squareRatio: (1/1) * 100%;
@widescreenRatio: (9/16) * 100%;
@ultraWidescreenRatio: (9/21) * 100%;
@standardRatio: (3/4) * 100%;
Loading…
Cancel
Save