Answer the question
In order to leave comments, you need to log in
How do sites work where you can see your history of downloaded torrents?
There is a site iknowwhatyoudownload.com where you can see your history of downloaded torrents. But it does not display absolutely all the torrents that you have downloaded. Which torrents does it add to the list, and which remain unnoticed by this site? And who else besides this site knows the history of downloaded files?
Answer the question
In order to leave comments, you need to log in
This is how it should work, there may be errors, I can not check.
// PHP
$db =&JFactory::getDBO();
$query = 'SELECT * FROM `#__virtuemart_countries` WHERE virtuemart_country_id >= "1" AND virtuemart_country_id <= "30"';
$db->setQuery($query);
$result = $db->loadObjectList();
$si = [];
$sk = [];
foreach($result as $row) {
$si[$row->virtuemart_country_id] = $row->country_3_code;
$sk[$row->virtuemart_country_id] = $row->country_3_code;
};
// JS
jQuery(function($) {
$('body').on('change', '#virtuemart_country_id', function() {
var ssnull = '',
s = {
i: <?php echo json_encode($si) ?>,
k: <?php echo json_encode($sk) ?>,
},
selector = {
i: $('#inn_field'),
k: $('#kpp_field'),
}
val = $(this).val();
if (val == 0) {
selector.i.val($ssnull);
selector.k.val($ssnull);
return;
}
$.each(s, function(key, data) {
$.each(data, function(index, value) {
if(val == index + 1) {
selector[key].val(value);
}
});
});
});
});
Get rid of jQuery and reduce your code by as much as 100 kb.!
document.getElementById('virtuemart_country_id').onchange = function(e)
{
...
}
jQuery(function($) {
$('body').on('change', '#virtuemart_country_id', function() {
$ssnull = '';
for (var j = 1; j < 30; j++) {
window['$s'+j+'_i'] = '<?php echo $s'+j+'_i ?>'; window['$s'+j+'_k'] = '<?php echo $s'+j+'_k ?>';
}
if($(this).val() == 0) {$('#inn_field').val($ssnull); $('#kpp_field').val($ssnull);}
for (var x = 1; x < 30; x++) {
if($(this).val() == x) {$('#inn_field').val( window['$s'+x+'_i']); $('#kpp_field').val( window['$s'+j+'_k']);}
}
}
)});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question