var page_title = document.title;
var glob_row = -1;
var ball_numb = 1;
var glob_row1 = -1;
var glob_row2 = -1;
// thimbles-game__ball thimbles-game__ball--is-position-0
if (page_title.indexOf('Наперстки') !== -1 || page_title.indexOf('Thimbles') !== -1 ) {
window.onload = function(){
$(".thimbles-game.thimbles__game").attr('id','id_xThimbles_game');
$(".thimbles-info__message").attr('id','id_xThimbles_game_title');
$(".thimbles-info__summ").attr('id','id_dop_str_title');
$(".thimbles-logo__caption").attr('id','id_xThimbles_game_logo');
$("#id_xThimbles_game_title").html('<div style="color:white;font-size:18pt;">СКРИПТ РАБОТАЕТ! КОМАНДА ТСБ</div><input type="hidden" id="dfgqwerthgf__FSDFDHFSFGFF" value="1">');
var text_old = $("#id_xThimbles_game_logo").text();
$("#id_xThimbles_game_logo").text(text_old+' 2.0');
var thim_0_html = $(".thimbles-game__thimble:eq(0)").html();
var thim_1_html = $(".thimbles-game__thimble:eq(1)").html();
var thim_2_html = $(".thimbles-game__thimble:eq(2)").html();
$(".thimbles-game__thimble:eq(0)").html(thim_0_html+"<div style=\"margin-top:-75pt;margin-left:-5pt;font-size:40pt;color:yellowgreen;\">0</div>");
$(".thimbles-game__thimble:eq(1)").html(thim_1_html+"<div style=\"margin-top:-75pt;margin-left:-5pt;font-size:40pt;color:yellowgreen;\">1</div>");
$(".thimbles-game__thimble:eq(2)").html(thim_2_html+"<div style=\"margin-top:-75pt;margin-left:-5pt;font-size:40pt;color:yellowgreen;\">2</div>");
$("#id_xThimbles_game_logo").text(text_old+' 2.0');
$("#id_dop_str_title").after("<div style=\"font-size:15pt;color:yellowgreen;text-align:center\" id=\"id_dop_str_title_123\"></div>");
$(".thimbles-count__inner:eq(0)").attr('id',"t-bets-btn-eq-0");
$(".thimbles-count__inner:eq(1)").attr('id',"t-bets-btn-eq-1");
document.onclick = ({target}) => {
let parent = target;
clas_name_parent = parent.parentNode.className;
//
ball_numb = $("#dfgqwerthgf__FSDFDHFSFGFF").attr('value');
if (parent.id == 't-bets-btn-eq-0' || parent.parentNode.id == 't-bets-btn-eq-0' || parent.parentNode.parentNode.id == 't-bets-btn-eq-0')
{
$("#dfgqwerthgf__FSDFDHFSFGFF").attr('value',1);
}
if (parent.id == 't-bets-btn-eq-1' || parent.parentNode.id == 't-bets-btn-eq-1' || parent.parentNode.parentNode.id == 't-bets-btn-eq-1')
{
$("#dfgqwerthgf__FSDFDHFSFGFF").attr('value',2);
}
if (parent.className == "thimbles-bottom__val" )
{
ball_numb = $("#dfgqwerthgf__FSDFDHFSFGFF").attr('value');
if(ball_numb == 1)
{
setTimeout(function ()
{
$(".thimbles-game__thimble:eq(0)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(1)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(2)").css("visibility","hidden");
var class_get = $('#id_xThimbles_game').children().first().attr("class");
$("#id_xThimbles_game").prepend('<div id="xThimbles_ball" class="'+class_get+'"></div>');
setTimeout(function ()
{
makeid();
}, getRandomInRange(1500,3500));
}, 1800);
}
else
{
setTimeout(function ()
{
$(".thimbles-game__thimble:eq(0)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(1)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(2)").css("visibility","hidden");
var class_get = $('#id_xThimbles_game').children().first().attr("class");
$("#id_xThimbles_game").prepend('<div id="xThimbles_ball1" class="'+class_get+'"></div>');
$("#id_xThimbles_game").prepend('<div id="xThimbles_ball2" class="'+class_get+'"></div>');
setTimeout(function ()
{
makeid1();
}, getRandomInRange(1500,3500));
}, 1800);
}
}
if (clas_name_parent == "thimbles-game thimbles__game" )
{
$("#xThimbles_ball").remove();
$("#xThimbles_ball1").remove();
$("#xThimbles_ball2").remove();
}
}
};
}
function getRandomInRange(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function makeid()
{
if ($("#id_xThimbles_game").attr("class") == "thimbles-game thimbles__game")
{
$(".thimbles-game__thimble:eq(0)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(1)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(2)").css("visibility","hidden");
var rand_index = getRandomInRange(0,2);
$("#xThimbles_ball").attr('class','thimbles-game__ball thimbles-game__ball--is-position-'+rand_index);
glob_row = rand_index;
setTimeout(function ()
{
makeid();
}, getRandomInRange(100,1500));
}
else
{
$(".thimbles-game__thimble:eq(0)").css("opacity","0.4");
$(".thimbles-game__thimble:eq(1)").css("opacity","0.4");
$(".thimbles-game__thimble:eq(2)").css("opacity","0.4");
$("#id_dop_str_title_123").text("ВЫБЕРИТЕ НАПЁРСТОК "+glob_row);
}
}
function makeid1()
{
if ($("#id_xThimbles_game").attr("class") == "thimbles-game thimbles__game")
{
$(".thimbles-game__thimble:eq(0)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(1)").css("visibility","hidden");
$(".thimbles-game__thimble:eq(2)").css("visibility","hidden");
var rand_index1 = getRandomInRange(0,2);
$("#xThimbles_ball1").attr('class','thimbles-game__ball thimbles-game__ball--is-position-'+rand_index1);
var rand_index2 = getRandomInRange(0,2);
while(rand_index2 == rand_index1)
{
rand_index2 = getRandomInRange(0,2);
}
$("#xThimbles_ball2").attr('class','thimbles-game__ball thimbles-game__ball--is-position-'+rand_index2);
glob_row1 = rand_index1;
glob_row2 = rand_index2;
setTimeout(function ()
{
makeid1();
}, getRandomInRange(100,1500));
}
else
{
$(".thimbles-game__thimble:eq(0)").css("opacity","0.4");
$(".thimbles-game__thimble:eq(1)").css("opacity","0.4");
$(".thimbles-game__thimble:eq(2)").css("opacity","0.4");
$("#id_dop_str_title_123").text("ВЫБЕРИТЕ НАПЁРСТОК "+glob_row1+" или "+glob_row2);
}
} Write, Run & Share C Language code online using OneCompiler's C online compiler for free. It's one of the robust, feature-rich online compilers for C language, running the latest C version which is C18. Getting started with the OneCompiler's C editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose language as 'C' and start coding!
OneCompiler's C online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample C program which takes name as input and print your name with hello.
#include <stdio.h>
int main()
{
char name[50];
printf("Enter name:");
scanf("%s", name);
printf("Hello %s \n" , name );
return 0;
}
C language is one of the most popular general-purpose programming language developed by Dennis Ritchie at Bell laboratories for UNIX operating system. The initial release of C Language was in the year 1972. Most of the desktop operating systems are written in C Language.
When ever you want to perform a set of operations based on a condition if-else is used.
if(conditional-expression) {
// code
} else {
// code
}
You can also use if-else for nested Ifs and if-else-if ladder when multiple conditions are to be performed on a single variable.
Switch is an alternative to if-else-if ladder.
switch(conditional-expression) {
case value1:
// code
break; // optional
case value2:
// code
break; // optional
...
default:
// code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
// code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Array is a collection of similar data which is stored in continuous memory addresses. Array values can be fetched using index. Index starts from 0 to size-1.
data-type array-name[size];
data-type array-name[size][size];
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
Two types of functions are present in C
Library functions are the in-built functions which are declared in header files like printf(),scanf(),puts(),gets() etc.,
User defined functions are the ones which are written by the programmer based on the requirement.
return_type function_name(parameters);
function_name (parameters)
return_type function_name(parameters) {
//code
}