make always preload images before rendering the page a display setting
This commit is contained in:
parent
b8c7b2f81d
commit
ddbe3c7426
5
boot.php
5
boot.php
@ -992,6 +992,10 @@ class App {
|
||||
if ($user_scalable === false)
|
||||
$user_scalable = 1;
|
||||
|
||||
$preload_images = ((local_channel()) ? get_pconfig(local_channel(),'system','preload_images') : 0);
|
||||
if ($preload_images === false)
|
||||
$preload_images = 0;
|
||||
|
||||
$interval = ((local_channel()) ? get_pconfig(local_channel(),'system','update_interval') : 80000);
|
||||
if($interval < 10000)
|
||||
$interval = 80000;
|
||||
@ -1005,6 +1009,7 @@ class App {
|
||||
*/
|
||||
$tpl = get_markup_template('head.tpl');
|
||||
$this->page['htmlhead'] = replace_macros($tpl, array(
|
||||
'$preload_images' => $preload_images,
|
||||
'$user_scalable' => $user_scalable,
|
||||
'$baseurl' => $this->get_baseurl(),
|
||||
'$local_channel' => local_channel(),
|
||||
|
@ -155,6 +155,7 @@ function settings_post(&$a) {
|
||||
|
||||
$theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->channel['channel_theme']);
|
||||
$mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : '');
|
||||
$preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0);
|
||||
$user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0);
|
||||
$nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0);
|
||||
$title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0);
|
||||
@ -184,6 +185,7 @@ function settings_post(&$a) {
|
||||
set_pconfig(local_channel(),'system','mobile_theme',$mobile_theme);
|
||||
}
|
||||
|
||||
set_pconfig(local_channel(),'system','preload_images',$preload_images);
|
||||
set_pconfig(local_channel(),'system','user_scalable',$user_scalable);
|
||||
set_pconfig(local_channel(),'system','update_interval', $browser_update);
|
||||
set_pconfig(local_channel(),'system','itemspage', $itemspage);
|
||||
@ -803,6 +805,9 @@ function settings_content(&$a) {
|
||||
$theme_selected = (!x($_SESSION,'theme')? $default_theme : $_SESSION['theme']);
|
||||
$mobile_theme_selected = (!x($_SESSION,'mobile_theme')? $default_mobile_theme : $_SESSION['mobile_theme']);
|
||||
|
||||
$preload_images = get_pconfig(local_channel(),'system','preload_images');
|
||||
$preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0
|
||||
|
||||
$user_scalable = get_pconfig(local_channel(),'system','user_scalable');
|
||||
$user_scalable = (($user_scalable===false)? '1': $user_scalable); // default if not set: 1
|
||||
|
||||
@ -836,7 +841,8 @@ function settings_content(&$a) {
|
||||
'$uid' => local_channel(),
|
||||
|
||||
'$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false),
|
||||
'$mobile_theme' => (($mobile_themes) ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false),
|
||||
'$mobile_theme' => (($mobile_themes) ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false),
|
||||
'$preload_images' => array('preload_images', t("Preload images before rendering the page"), $preload_images, t("Subjectiv page load time will be longer but page will be ready when displayed"), $yes_no),
|
||||
'$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no),
|
||||
'$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')),
|
||||
'$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')),
|
||||
|
@ -618,7 +618,7 @@ function updateConvItems(mode,data) {
|
||||
/* autocomplete @nicknames */
|
||||
$(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1");
|
||||
|
||||
var bimgs = $(".wall-item-body img").not(function() { return this.complete; });
|
||||
var bimgs = ((preloadImages) ? false : $(".wall-item-body img").not(function() { return this.complete; }));
|
||||
var bimgcount = bimgs.length;
|
||||
|
||||
if (bimgcount) {
|
||||
@ -632,8 +632,6 @@ function updateConvItems(mode,data) {
|
||||
collapseHeight();
|
||||
}
|
||||
|
||||
//collapseHeight();
|
||||
|
||||
}
|
||||
|
||||
function collapseHeight() {
|
||||
@ -742,8 +740,7 @@ function liveUpdate() {
|
||||
var dready = new Date();
|
||||
console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.');
|
||||
|
||||
|
||||
if(update_mode === 'update') {
|
||||
if(update_mode === 'update' || preloadImages) {
|
||||
console.log('LOADING images...');
|
||||
|
||||
$('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() {
|
||||
@ -757,7 +754,9 @@ function liveUpdate() {
|
||||
$("#profile-jot-text-loading").spin(false);
|
||||
|
||||
// adjust scroll position if new content was added above viewport
|
||||
$(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff);
|
||||
if(update_mode === 'update') {
|
||||
$(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff);
|
||||
}
|
||||
|
||||
in_progress = false;
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
var justifiedGalleryActive = false;
|
||||
{{if $channel_hash}}var channelHash = '{{$channel_hash}}';{{/if}}
|
||||
{{if $channel_id}}var channelId = '{{$channel_id}}';{{/if}}{{* Used in e.g. autocomplete *}}
|
||||
var preloadImages = {{$preload_images}};
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -65,6 +65,7 @@
|
||||
{{include file="field_checkbox.tpl" field=$channel_list_mode}}
|
||||
{{include file="field_checkbox.tpl" field=$network_list_mode}}
|
||||
{{include file="field_checkbox.tpl" field=$user_scalable}}
|
||||
{{include file="field_checkbox.tpl" field=$preload_images}}
|
||||
{{if $expert}}
|
||||
<div class="form-group">
|
||||
<a class="btn btn-default "href="pdledit">{{$layout_editor}}</a>
|
||||
|
Reference in New Issue
Block a user