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

Commit 11b6b0f

Browse files
committed
Add a second image polyfill script (see #7369)
1 parent 1913bf8 commit 11b6b0f

File tree

10 files changed

+371
-17
lines changed

10 files changed

+371
-17
lines changed

assets/respimage/0.9.6/respimage.js

+334
Large diffs are not rendered by default.

assets/respimage/0.9.6/respimage.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

system/config/constants.php

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
define('HIGHLIGHTER', '3.0.83');
3232
define('HTML5SHIV', '3.7.0');
3333
define('PICTUREFILL', '2.1.0');
34+
define('RESPIMAGE', '0.9.6');
3435
define('SWIPE', '2.0');
3536
define('JQUERY', '1.11.0');
3637
define('JQUERY_UI', '1.10.4');

system/docs/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Contao Open Source CMS changelog
44
Version 3.4.0-beta1 (2014-10-03)
55
--------------------------------
66

7+
### Improved
8+
Add a second image polyfill script (see #7369).
9+
710
### Fixed
811
Handle disabled modules in the module loader.
912

system/modules/core/config/config.php

+1
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@
452452
'HIGHLIGHTER' => '3.0.83',
453453
'HTML5SHIV' => '3.7.0',
454454
'PICTUREFILL' => '2.1.0',
455+
'RESPIMAGE' => '0.9.6',
455456
'SWIPE' => '2.0',
456457
'JQUERY' => '1.11.0',
457458
'JQUERY_UI' => '1.10.4',

system/modules/core/dca/tl_layout.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
'palettes' => array
100100
(
101101
'__selector__' => array('rows', 'cols', 'addJQuery', 'addMooTools', 'static'),
102-
'default' => '{title_legend},name;{header_legend},rows;{column_legend},cols;{sections_legend:hide},sections,sPosition;{webfonts_legend:hide},webfonts;{style_legend},framework,stylesheet,external,loadingOrder;{feed_legend:hide},newsfeeds,calendarfeeds;{modules_legend},modules;{expert_legend:hide},template,doctype,viewport,titleTag,cssClass,onload,head;{jquery_legend},addJQuery;{mootools_legend},addMooTools;{script_legend:hide},addPicturefill,analytics,script;{static_legend},static'
102+
'default' => '{title_legend},name;{header_legend},rows;{column_legend},cols;{sections_legend:hide},sections,sPosition;{webfonts_legend:hide},webfonts;{style_legend},framework,stylesheet,external,loadingOrder;{picturefill_legend:hide},picturefill;{feed_legend:hide},newsfeeds,calendarfeeds;{modules_legend},modules;{expert_legend:hide},template,doctype,viewport,titleTag,cssClass,onload,head;{jquery_legend},addJQuery;{mootools_legend},addMooTools;{script_legend:hide},analytics,script;{static_legend},static'
103103
),
104104

105105
// Subpalettes
@@ -333,12 +333,14 @@
333333
'eval' => array('decodeEntities'=>true, 'maxlength'=>255, 'tl_class'=>'w50'),
334334
'sql' => "varchar(255) NOT NULL default ''"
335335
),
336-
'addPicturefill' => array
336+
'picturefill' => array
337337
(
338-
'label' => &$GLOBALS['TL_LANG']['tl_layout']['addPicturefill'],
338+
'label' => &$GLOBALS['TL_LANG']['tl_layout']['picturefill'],
339339
'exclude' => true,
340-
'inputType' => 'checkbox',
341-
'sql' => "char(1) NOT NULL default ''"
340+
'inputType' => 'select',
341+
'options' => array('picturefill.js', 'respimage.js'),
342+
'eval' => array('includeBlankOption'=>true),
343+
'sql' => "varchar(16) NOT NULL default ''"
342344
),
343345
'viewport' => array
344346
(

system/modules/core/languages/en/tl_layout.xlf

+7-4
Original file line numberDiff line numberDiff line change
@@ -284,11 +284,11 @@
284284
<trans-unit id="tl_layout.mootools.1">
285285
<source>Here you can select one or more MooTools templates.</source>
286286
</trans-unit>
287-
<trans-unit id="tl_layout.addPicturefill.0">
288-
<source>Include picturefill.js</source>
287+
<trans-unit id="tl_layout.picturefill.0">
288+
<source>Image polyfill</source>
289289
</trans-unit>
290-
<trans-unit id="tl_layout.addPicturefill.1">
291-
<source>Include the picturefill.js script (responsive images).</source>
290+
<trans-unit id="tl_layout.picturefill.1">
291+
<source>Here you can select a responsive images polyfill.</source>
292292
</trans-unit>
293293
<trans-unit id="tl_layout.analytics.0">
294294
<source>Analytics templates</source>
@@ -338,6 +338,9 @@
338338
<trans-unit id="tl_layout.style_legend">
339339
<source>Style sheets</source>
340340
</trans-unit>
341+
<trans-unit id="tl_layout.picturefill_legend">
342+
<source>Responsive images</source>
343+
</trans-unit>
341344
<trans-unit id="tl_layout.feed_legend">
342345
<source>RSS/Atom feeds</source>
343346
</trans-unit>

system/modules/core/pages/PageRegular.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,13 @@ protected function createTemplate($objPage, $objLayout)
428428
}
429429

430430
// Picturefill
431-
if ($objLayout->addPicturefill)
431+
if ($objLayout->picturefill == 'respimage.js')
432432
{
433-
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/picturefill/' . $GLOBALS['TL_ASSETS']['PICTUREFILL'] . '/picturefill.min.js|static';
433+
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/respimage/' . $GLOBALS['TL_ASSETS']['RESPIMAGE'] . '/respimage.min.js|static|async';
434+
}
435+
elseif ($objLayout->picturefill == 'picturefill.js')
436+
{
437+
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/picturefill/' . $GLOBALS['TL_ASSETS']['PICTUREFILL'] . '/picturefill.min.js|static|async';
434438
}
435439

436440
// Check whether TL_APPEND_JS exists (see #4890)

system/modules/core/templates/picture/picture_default.html5

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
<?php if ($this->sources || $this->img['src'] !== $this->img['srcset']): ?>
1818
<script>
19-
window.picturefill && window.picturefill({
20-
elements: [document.images[document.images.length - 1]]
21-
});
19+
(function(p) {
20+
p && p({
21+
elements: [document.images[document.images.length - 1]]
22+
});
23+
})(window.picturefill || window.respimage);
2224
</script>
2325
<?php endif; ?>

system/modules/core/templates/picture/picture_default.xhtml

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
<?php if ($this->sources || $this->img['src'] !== $this->img['srcset']): ?>
1818
<script type="text/javascript">
1919
/* <![CDATA[ */
20-
window.picturefill && window.picturefill({
21-
elements: [document.images[document.images.length - 1]]
22-
});
20+
(function(p) {
21+
p && p({
22+
elements: [document.images[document.images.length - 1]]
23+
});
24+
})(window.picturefill || window.respimage);
2325
/* ]]> */
2426
</script>
2527
<?php endif; ?>

0 commit comments

Comments
 (0)