mardi 29 décembre 2015

Download modal window with a time delay - DLE Eglish


This hack allows download files (Attachment) of the modal window with a time delay. The archive is ready file to overwrite.


Setting

- Open engine/modules/functions.php and find

$tpl->compile( 'attachment' );

$replace_1[] = $tpl->result['attachment'];

$tpl->result['attachment'] = str_replace( $row['name'], "\1", $tpl->result['attachment'] );

$replace_2[] = $tpl->result['attachment'];

$tpl->result['attachment'] = '';


-Replace:

$replace_1[] = "<div class="DownLoadWindow">
<div class="quote">
<a href="#" onclick="showDownLoad(); return false;">Download <b>{$row['name']}</b></a>
</div>
</div>
<div id="DownLoadWindow" title="Download {$row['name']}" style="display:none;" >
<table id="timer_1" border="0" cellpadding="2" cellspacing="2"><tbody><tr>
<td>Download will be available through:</td>
<td id="timer_num"></td>
<td>&#1089;&#1077;&#1082;.</td>
</tr></tbody></table>
<div style="display:none" id="timer_2">
Name: <b>{$row['name']}.</b><br /><br />
Size: <b>{$size}.</b> <br /><br />
Downloads: <b>{$row['dcount']} time.</b> <br /><br />
<a href="{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}" >Download <b>{$row['name']}</b></a></div>
</div>
<script type="text/javascript">

timer_num = 15;
function timer_fc(){
if(timer_num>0){
$('#timer_num').text(timer_num);
timer_num--;
setTimeout("timer_fc()", 1000)
}else{
$('#timer_1').hide(); $('#timer_2').show();
}}
timer_fc();

function showDownLoad() {
$(function(){
$('#DownLoadWindow').dialog({
width: 420,
buttons: {
"Close window" : function() {
$(this).dialog("close");
},
}

});
});
}
</script>";
$replace_2[] = "<div class="DownLoadWindow">
<div class="quote">
<a href="#" onclick="showDownLoad(); return false;">Download <b>{$row['name']}</b></a>
</div>
</div>
<div id="DownLoadWindow" title="Download {$row['name']}" style="display:none;" >
<table id="timer_1" border="0" cellpadding="2" cellspacing="2"><tbody><tr>
<td>Download will be available through:</td>
<td id="timer_num"></td>
<td>Sec.</td>
</tr></tbody></table>
<div style="display:none" id="timer_2">
Name: <b>{$row['name']}.</b><br /><br />
Size: <b>{$size}.</b> <br /><br />
downloads: <b>{$row['dcount']} time.</b> <br /><br />
<a href="{$config['http_home_url']}engine/download.php?id={$row['id']}{$area}" >Download <b>{$row['name']}</b></a>
</div></div>
<script type="text/javascript">

timer_num = 40; // The number of the delay in seconds
function timer_fc(){
if(timer_num>0){
$('#timer_num').text(timer_num);
timer_num--;
setTimeout("timer_fc()", 1000)
}else{
$('#timer_1').hide(); $('#timer_2').show();
}}
timer_fc();

function showDownLoad() {
$(function(){
$('#DownLoadWindow').dialog({
width: 420,
buttons: {
"Close window" : function() {
$(this).dialog("close");
},
}

});
});
}
</script>";


Where in a row (timer_num = 40; // The number of the delay in seconds), specify the time delay

- In any file style.css (if this is not possible in any CSS file) at the end of file add:
#timer_num {width:70px; height:70px; background: url('../images/timer.gif') no-repeat; text-align:center; font-size:36px; color:#666}


-Throw timer.gif file in the images folder of your template.

Aucun commentaire:

Enregistrer un commentaire