mirror of
https://github.com/discourse/discourse-adplugin.git
synced 2025-07-08 06:12:11 +00:00
FEATURE: add support for fluid ad size in Google Ad Manager
No width or height will be set on containers when ad size is fluid.
This commit is contained in:
parent
cf27a7be64
commit
116f9dd238
@ -126,6 +126,10 @@ function getWidthAndHeight(placement, settings, isMobile) {
|
|||||||
renderCounts[placement] += 1;
|
renderCounts[placement] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size === "fluid") {
|
||||||
|
return { width: 'fluid', height: 'fluid' };
|
||||||
|
}
|
||||||
|
|
||||||
const sizeObj = {
|
const sizeObj = {
|
||||||
width: parseInt(splitWidthInt(size), 10),
|
width: parseInt(splitWidthInt(size), 10),
|
||||||
height: parseInt(splitHeightInt(size), 10)
|
height: parseInt(splitHeightInt(size), 10)
|
||||||
@ -281,12 +285,16 @@ export default AdComponent.extend({
|
|||||||
|
|
||||||
@computed("width", "height")
|
@computed("width", "height")
|
||||||
adWrapperStyle(w, h) {
|
adWrapperStyle(w, h) {
|
||||||
|
if (w !== 'fluid') {
|
||||||
return `width: ${w}px; height: ${h}px;`.htmlSafe();
|
return `width: ${w}px; height: ${h}px;`.htmlSafe();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("width")
|
@computed("width")
|
||||||
adTitleStyleMobile(w) {
|
adTitleStyleMobile(w) {
|
||||||
|
if (w !== 'fluid') {
|
||||||
return `width: ${w}px;`.htmlSafe();
|
return `width: ${w}px;`.htmlSafe();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed(
|
@computed(
|
||||||
|
@ -163,6 +163,7 @@ dfp_plugin:
|
|||||||
default: "728*90 - leaderboard"
|
default: "728*90 - leaderboard"
|
||||||
type: list
|
type: list
|
||||||
choices: &dfp_choices
|
choices: &dfp_choices
|
||||||
|
- fluid
|
||||||
- 728*90 - leaderboard
|
- 728*90 - leaderboard
|
||||||
- 336*280 - large rectangle
|
- 336*280 - large rectangle
|
||||||
- 300*250 - medium rectangle
|
- 300*250 - medium rectangle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user