Digistive

Рейтинг
59
Регистрация
01.09.2015


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);
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
}
);
}
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 файл большой и содержит много других не относящихся к рандомной выдачи картинок функций.

iccup, это PHP, а мне нужно JS

---------- Добавлено 10.06.2019 в 09:31 ----------

ivan-lev:
А какую ошибку выдаёт? )))

Флаг появляется, но вместе с ним на странице выводится и часть кода

ivan-lev:
И куда именно вставлять?

Вставить хотел вот так:


var countryRand;
var countries = ['<img src="http://сайт.ру/uk_flag.png">', '<img src="http://сайт.ру/china_flag.png">', '<img src="http://сайт.ру/ru_flag.png">'];

countryRand = rand(0,3);
Sitealert:
Это невалидный код. Правильно так
<img src="" alt="">

Ну да конечно, будто alt на что-то влияет

Ребят, а по сабжу кто нибудь поможет?

'[umka:
;16058606']А из всего перечисленного у вас с чем конкретно трудности возникают?
С получанием адреса текущей страницы, с запоминанием её в куке или с перекидыванием на эту страницу?

Со всем сразу. Отсутствие данного кода. Сам в программировании не разбираюсь, поэтому прошу помочь.

LEOnidUKG:
Делайте перенаправление на PHP
или
делайте запрос на эту страницу через ajax

А как именно это сделать?

SeVlad:
Серьёзно было в первых же 2х ответах.

На любой вопрос отправлять в гугл? Это называется помощь? Тогда в чем смысл всего этого форума?

SeVlad:
и даже такие подарки, какие сделал Samail

Прям подарки? Мда, сколько же меркантильности в ваших словам... Похоже зажрались вы ребята тут. Скоро из серча сделаете второй FL

Sitealert:
Samail не подсказал, а разжевал и в рот положил. Подсказывали все до него.

Серьезно? 2 строчки короткого кода называется разжевал?

Sitealert:
А кто же ещё? Ты и развёл. Потому как из-за отсутствия подробностей началось обсуждение всевозможных вариантов.

Ну просто видимо до некоторых с трудом доходит.... И меня не волнуют ваши обсуждения, всего то требовалось, поделиться готовым кодом, на джаве скрипт или ксс не принципиально.

1 234 5
Всего: 42