Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 095d945

Browse files
committed
Add a new parameter for low-resolution background image, and trigger it if viewport width is smaller than 600px ( => mobile )
1 parent eee00e3 commit 095d945

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

core/src/plugins/gui.ajax/manifest.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,19 @@
120120
label="CONF_MESSAGE[Background Attributes (6)]" description="CONF_MESSAGE[Attributes of the image used as a background]"
121121
mandatory="false" expose="true" default="background-repeat:repeat;background-size:140%;background-position:50% 50%;"/>
122122

123+
<global_param name="WELCOME_PAGE_BACKGROUND_LOWRES" group="CONF_MESSAGE[Page Background Images]" type="image" label="CONF_MESSAGE[Low-Resolution Background]" description="CONF_MESSAGE[Make sure to use a smaller resolution image, otherwise mobile loading is very slow.]" mandatory="false"
124+
editable="true"
125+
uploadAction="store_binary_temp"
126+
loadAction="get_global_binary_param"
127+
defaultImage="plugins/gui.ajax/res/themes/orbit/images/hires-photos/03-mobile.jpg"
128+
expose="true"
129+
/>
130+
131+
<global_param name="WELCOME_PAGE_BACKGROUND_ATTRIBUTES_LOWRES" group="CONF_MESSAGE[Page Background Images]" type="select"
132+
choices="background-repeat:no-repeat;background-position:50% 50%;|CONF_MESSAGE[Center in Page (no-repeat)],background-repeat:repeat;background-size:140%;background-position:50% 50%;|CONF_MESSAGE[Fetch Window (repeat vertically)],background-repeat:no-repeat;background-size:100%; background-position:center center;|CONF_MESSAGE[Fetch Window (no repeat)],background-repeat:repeat;|CONF_MESSAGE[Tile (repeat both directions)]"
133+
label="CONF_MESSAGE[Background Attributes (Low Resolution)]" description="CONF_MESSAGE[Attributes of the image used as a background]"
134+
mandatory="false" expose="true" default="background-repeat:repeat;background-size:140%;background-position:50% 50%;"/>
135+
123136
<global_param name="CUSTOM_SHAREPAGE_BACKGROUND_1" group="CONF_MESSAGE[Minisite]" type="image" label="CONF_MESSAGE[Custom Background (1)]" description="CONF_MESSAGE[Image used as a background]" mandatory="false"
124137
editable="true"
125138
uploadAction="store_binary_temp"

core/src/plugins/gui.ajax/res/js/ui/prototype/class.AjxpPane.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ Class.create("AjxpPane", {
519519
bStyles.push("background-image:url('"+bgrounds[paramPrefix+index]+"');" + (bgrounds[paramPrefix + 'ATTRIBUTES_'+index]?bgrounds[paramPrefix + 'ATTRIBUTES_'+index]:''));
520520
index++;
521521
}
522+
if(document.viewport.getWidth() < 600 && bgrounds[paramPrefix+'LOWRES']){
523+
// This is probably a mobile, let's force switching to low res.
524+
bStyles = ["background-image:url('"+bgrounds[paramPrefix+'LOWRES']+"');" + (bgrounds[paramPrefix + 'ATTRIBUTES_'+'LOWRES']?bgrounds[paramPrefix + 'ATTRIBUTES_'+'LOWRES']:'')];
525+
}
522526
if (bStyles.length) {
523527
i = Math.floor( Math.random() * bStyles.length);
524528
var bg = bStyles[i];

core/src/plugins/gui.ajax/res/themes/orbit/css/media.css

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,7 @@ and (max-width : 420px){
180180
font-size: 20px;
181181
font-weight: lighter;
182182
text-transform: uppercase;
183-
margin: 0px 0;
184-
}
185-
186-
div#background-imager{
187-
background-image: url(../images/hires-photos/03-mobile.jpg) !important;
188-
background-position: 50% 50%;
189-
background-repeat: repeat repeat;
183+
margin: 0 0;
190184
}
191185

192186
div.dialogBox{

core/src/plugins/gui.mobile/ajxp-mobile.css

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ a.m-2.disabled {
104104
background-image: url('../gui.ajax/res/themes/vision/images/grid_t.png');
105105
}
106106

107-
.ajxp_theme_orbit div#background-imager{
108-
background-image: url(../gui.ajax/res/themes/orbit/images/hires-photos/03-mobile.jpg) !important;
109-
background-position: 50% 50%;
110-
background-repeat: repeat repeat;
111-
}
112-
113107
#uploadBrowseButton{
114108
display: none !important;
115109
}

0 commit comments

Comments
 (0)