-
−2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
this.params.IsCellEditable = function(rowNumber, cellNumber) {
cellNumber == 1;
this.params.ButtonList = this.params.ButtonList.filter(b=>b[0] === "OnRefresh");
let textContr = new CTextArea('textContr');
textContr.SourceName = "value";
textContr.ViewName = "Params";
textContr.ComEdit = true;
this.params.arrEditObj[1] = textContr;
}
Найдено в нашем проекте в старом модуле, в авторстве никто не признаётся.
Во-первых, строка 2 бессмысленна. Во-вторых, всё последующее имело бы хоть какой-то смысл _вне_ этой функции, а внутри уже на строке 3 выкидывает ошибку, потому что контекст там и есть this.param из первой строчки. В-третьих, строка 3 призвана выкидывать из тулбара виджета this.param все кнопки, кроме OnRefresh, но на самом деле она там только одна и есть. В-четвёртых, строчки 7 и 8 просто лишние (ну, это из логики используемого в проекте движка следует). В-пятых, из названия метода можно предположить (и это действительно так), что он должен бы возвращать булевское значение, но он всегда возвращает только undefined и, таким образом, все ячейки виджета оказываются нередактируемыми — что совсем лишает смысла создание контрола для редактирования в строках 5—9.
Редкостная бредятина. Кто-то в полном затмении писал, и даже десяти секунд не потратил на тестирование.
torbasow,
06 Мая 2016
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
function floatToStringPrec(f, precisionDigits)
{
var PRECISION = Math.pow(10, precisionDigits);
var integerPart = Math.floor(f);
var fractionalPart = f % 1;
if (fractionalPart == 0)
{
return integerPart.toString();
}
var zeroesInFracPart = -Math.log10(fractionalPart);
if (Math.floor(zeroesInFracPart) == zeroesInFracPart)
{
zeroesInFracPart--;
}
else
{
zeroesInFracPart = Math.floor(zeroesInFracPart);
}
fractionalPart = Math.round(fractionalPart * PRECISION);
while (fractionalPart % 10 == 0)
{
fractionalPart /= 10;
}
var zeroes = '';
if (zeroesInFracPart > 0)
{
zeroes = Array(zeroesInFracPart + 1).join('0');
}
return integerPart.toString() + '.' + zeroes + fractionalPart.toString();
}
Преобразовать плавающего питуха в строку; сохранить не более precisionDigits цифр после запятой (остальные - округлить).
gost,
05 Мая 2016
-
0
- 1
var routers = new (R(views))();
Чет по другому не придумал как в роутер view передать
arny,
04 Мая 2016
-
0
- 1
- 2
- 3
//- ASAP OR DIE♪
// re: ASAP OR DIE♪
//- next time, you should die
mcheguevara2,
04 Мая 2016
-
+4
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
if (aKeqboard[i][j] == 'Пробел') {
var sLang = storage.get("language");
sContent += '<td width="770" height="78" align="center"><div id="search_btn_' + (id++) + '" class="k_s_' + sLang + ' k_f k_c_b" style="color: transparent;" onclick=\"opacit(' + id + ');\"></div></td>';
}
else
if (aKeqboard[i][j] == 'ПробелENG') {
var sLang = storage.get("language");
sContent += '<td width="703" height="78" align="center"><div id="search_btn_' + (id++) + '" class="k_s_eng_' + sLang + ' k_f k_c_b" style="color: transparent;" onclick=\"opacit_ALE(' + id + ');\"></div></td>';
}
else
if (aKeqboard[i][j] == 'Shiftrus' || aKeqboard[i][j] == 'Shiftrusm' || aKeqboard[i][j] == 'Shifteng' || aKeqboard[i][j] == 'Shiftengm')
sContent += '<td width="167" height="78" align="center"><div id="search_btn_' + (id++) + '" class="shift_' + sLang + '" style="color: transparent;" onclick=\"opacit(' + id + ');\"></div></td>';
else
if (aKeqboard[i][j] == 'mShiftrus' || aKeqboard[i][j] == 'mShiftrusm' || aKeqboard[i][j] == 'mShifteng' || aKeqboard[i][j] == 'mShiftengm')
sContent += '<td width="77" height="78" align="center"><div id="search_btn_' + (id++) + '" class="mshift" style="color: transparent;" onclick=\"opacit(' + id + ');\"></div></td>';
else
if (aKeqboard[i][j] == 'Eng')
sContent += '<td width="123" height="78" align="center"><div id="search_btn_' + (id++) + '" class="eng_button" onclick=\"opacit(' + id + ');\"></div></td>';
else
if (aKeqboard[i][j] == 'Рус')
sContent += '<td width="212" height="78" align="center"><div id="search_btn_' + (id++) + '" class="rus_button" onclick=\"opacit_ALR(' + id + ');\"></div></td>';
else
if (aKeqboard[i][j] == 'Рус2') {
if (this._statusEng == true) { sContent += '<td width="167" height="78" align="center"><div id="search_btn_' + (id++) + '" class="rus_button2_eng" onclick=\"opacit_ALABC(' + id + ');\"></div></td>'; }
else if (this._statusEng == false) { sContent += '<td width="167" height="78" align="center"><div id="search_btn_' + (id++) + '" class="rus_button2" onclick=\"opacit_ALR(' + id + ');\"></div></td>'; }
}
else
if (aKeqboard[i][j] == '.,?123') {
if (this._statusEng == true) { sContent += '<td width="167" height="78" align="center"><div id="search_btn_' + (id++) + '" class="digit123" onclick=\"opacit_ALDABC(' + id + ');\"></div></td>'; }
else if (this._statusEng == false) { sContent += '<td width="167" height="78" align="center"><div id="search_btn_' + (id++) + '" class="digit123" onclick=\"opacit_ALD(' + id + ');\"></div></td>'; }
}
else
if (aKeqboard[i][j] == ' ')
sContent += '<td width="0" height="78" align="center"><div id="search_btn_' + (id++) + '" class="k_s_' + sLang + ' k_f k_c_b" onclick=\"opacit(' + id + ');\" style="display: none;"></div></td>';
else
if (aKeqboard[i][j] == '...')
sContent += '<td width="75" height="78" align="center"><div id="search_btn_' + (id++) + '" class="k_s_' + sLang + ' k_f k_c_b" onclick=\"opacit(' + id + ');\" style="display: none;"></div></td>';
else
if (aKeqboard[i][j] == 'Стереть') {
var sLang = storage.get("language");
sContent += '<td width="120" height="78" align="center"><div id="search_btn_' + (id++) + '" class="k_b_' + sLang + ' k_f_del k_c_w" onclick=\"opacit(' + id + ' );\"></div></td>';
}
else
if (aKeqboard[i][j].length > 1) {
sContent += '<td width="167" height="70" align="center"><div id="search_btn_' + (id++) + '" class="k_b_green k_f k_c_w" onclick=\"opacit(' + id + ');\"></div></td>';
}
else {
sContent += '<td width="80" height="70" align="center"><div id="search_btn_' + (id++) + '" class="k_v k_f k_c_b" onclick=\"opacit(' + id + ');\"></div></td>';
}
}
lorines,
29 Апреля 2016
-
+3
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
function captcha_answer (res) {
if (res.email == 0) {
$('#email').css('border','1px solid #C5C5C5');
$(".email").text("");
$(".email").hide();
}
if (res.email == 1) {
$('#email').css('border','1px solid red');
$(".email").text("E-mail слишком короткий");
$(".email").show();
}
if (res.email == 2) {
$('#email').css('border','1px solid red');
$(".email").text("E-mail слишком длинный");
$(".email").show();
}
if (res.email == 3) {
$('#email').css('border','1px solid red');
$(".email").text("Некорректный E-mail");
$(".email").show();
}
if (res.email == 4) {
$('#email').css('border','1px solid red');
$(".email").text("E-mail занят");
$(".email").show();
}
if (res.nickname == 0) {
$('#nickname').css('border','1px solid #C5C5C5');
$(".nickname").text("");
$(".nickname").hide();
}
if (res.nickname == 1) {
$('#nickname').css('border','1px solid red');
$(".nickname").text("Ник слишком короткий");
$(".nickname").show();
}
if (res.nickname == 2) {
$('#nickname').css('border','1px solid red');
$(".nickname").text("Ник слишком длинный");
$(".nickname").show();
}
if (res.nickname == 3) {
$('#nickname').css('border','1px solid red');
$(".nickname").text("Ник занят");
$(".nickname").show();
}
if (res.password_1 == 0) {
$('#password_1').css('border','1px solid #C5C5C5');
$(".password_1").text("");
$(".password_1").hide();
}
if (res.password_1 == 1) {
$('#password_1').css('border','1px solid red');
$(".password_1").text("Пароль слишком короткий");
$(".password_1").show();
}
if (res.password_1 == 2) {
$('#password_1').css('border','1px solid red');
$(".password_1").text("Пароль слишком длинный");
$(".password_1").show();
}
if (res.password_2 == 0) {
$('#password_2').css('border','1px solid #C5C5C5');
$(".password_2").text("");
$(".password_2").hide();
}
if (res.password_2 == 1) {
$('#password_2').css('border','1px solid red');
$(".password_2").text("");
$(".password_2").show();
}
if (res.password_2 == 2) {
$('#password_2').css('border','1px solid red');
$(".password_2").text("Пароли не совпадают");
$(".password_2").show();
}
};
Есть скрипт, он аяксом посылает запрос на страницу, скрипт "отвечает" в формате json, ответы типа {"email":"1"} а вот это собственно "расшифровка" ответов :)
slowpoke59rus,
27 Апреля 2016
-
+2
- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
function plays(){
var snd = new Audio("http://boobooka.com/wp-content/uploads/2013/02/33bells33.mp3");
snd.preload = "auto";
snd.play();
}
function showTime()
{
var dat = new Date();
var ch = dat.getDate();
var montha = new Array();
montha[0] = "января";
montha[1] = "февраля";
montha[2] = "марта";
montha[3] = "апреля";
montha[4] = "мая";
montha[5] = "июня";
montha[6] = "июля";
montha[7] = "августа";
montha[8] = "сентября";
montha[9] = "октября";
montha[10] = "ноября";
montha[11] = "декабря";
var mon = montha[dat.getMonth()];
var ye = dat.getYear()+ 1900;
var ned = dat.getDay();
var day = new Array();
day[1] = "Понедельник";
day[2] = "Вторник";
day[3] = "Среда";
day[4] = "Четверг";
day[5] = "Пятница";
day[6] = "Суббота";
day[0] = "Воскресенье";
var nedel = day[dat.getDay()];
var H = '' + dat.getHours();
H = H.length<2 ? '0' + H:H;
var M = '' + dat.getMinutes();
M = M.length<2 ? '0' + M:M;
var S = '' + dat.getSeconds();
S =S.length<2 ? '0' + S:S;
var clock = H + ':' + M + ':' + S;
var cl = H + M + S;
var chislo = ch+" "+mon;
var chisl = ye+" года";
document.getElementById('time_div').innerHTML=clock;
document.getElementById('ned_div').innerHTML=nedel;
document.getElementById('chi_div').innerHTML=chislo;
document.getElementById('chis_div').innerHTML=chisl;
if(clock == '09:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '09:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '09:50:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '10:30:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '10:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '11:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '11:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '12:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '12:30:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '13:10:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '13:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '14:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '14:20:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '15:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '15:10:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '15:50:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '16:00:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '16:40:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '16:45:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '17:25:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '17:30:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '18:10:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '18:15:00'){if(1<=ned && ned<=6){plays();}}
if(clock == '18:55:00'){if(1<=ned && ned<=6){plays();}}
setTimeout(showTime,1000);
if(1<=ned && ned<=6)
{
if(cl >= 090000 && cl < 094000) {document.getElementById('mes_div').innerHTML="Идет 1-й урок (09:00-09:40)";}
if(cl >= 094000 && cl < 095000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (09:40-09:50)";}
if(cl >= 095000 && cl < 103000) {document.getElementById('mes_div').innerHTML="Идет 2-й урок (09:50-10:30)";}
if(cl >= 103000 && cl < 104000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (10:30-10:40)";}
if(cl >= 104000 && cl < 112000) {document.getElementById('mes_div').innerHTML="Идет 3-й урок (10:40-11:20)";}
if(cl >= 112000 && cl < 114000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (11:20-11:40)";}
if(cl >= 114000 && cl < 122000) {document.getElementById('mes_div').innerHTML="Идет 4-й урок (11:40-12:20)";}
if(cl >= 122000 && cl < 123000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (12:20-12:30)";}
if(cl >= 123000 && cl < 131000) {document.getElementById('mes_div').innerHTML="Идет 5-й урок (12:30-13:10)";}
if(cl >= 131000 && cl < 132000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (13:10-13:20)";}
if(cl >= 132000 && cl < 140000) {document.getElementById('mes_div').innerHTML="Идет 6-й урок (13:20-14:00)";}
if(cl >= 140000 && cl < 142000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (14:00-14:20)";}
if(cl >= 142000 && cl < 150000) {document.getElementById('mes_div').innerHTML="Идет 7-й урок (14:20-15:00)";}
if(cl >= 150000 && cl < 151000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (15:00-15:10)";}
if(cl >= 151000 && cl < 155000) {document.getElementById('mes_div').innerHTML="Идет 8-й урок (15:10-15:50)";}
if(cl >= 155000 && cl < 160000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (15:50-16:00)";}
if(cl >= 160000 && cl < 164000) {document.getElementById('mes_div').innerHTML="Идет 9-й урок (16:00-16:40)";}
if(cl >= 164000 && cl < 164500) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (16:40-16:45)";}
if(cl >= 164500 && cl < 172500) {document.getElementById('mes_div').innerHTML="Идет 10-й урок (16:45-17:25)";}
if(cl >= 172500 && cl < 173000) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (17:25-17:30)";}
if(cl >= 173000 && cl < 181000) {document.getElementById('mes_div').innerHTML="Идет 11-й урок (17:30-18:10)";}
if(cl >= 181000 && cl < 181500) {document.getElementById('mes_div').innerHTML="ПЕРЕМЕНА!!! (18:10-18:15)";}
if(cl >= 181500 && cl < 185500) {document.getElementById('mes_div').innerHTML="Идет 12-й урок (18:15-18:55)";}
if(cl >= 185500 && cl < 235959) {document.getElementById('mes_div').innerHTML=" ";}
Исходный код из "научно-практической" работы школьника.
Прихватил с конференции. (Не всё влезло)
RigFox,
27 Апреля 2016
-
+3
- 1
- 2
- 3
setTimeout(function() {
$('#kostyl').click().click();
}, 2000);
Применить сортировку по этому столбцу в таблице после её подгрузки и отработки жс, который строит эту таблицу.
deep,
26 Апреля 2016
-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
function toggleAdPanelMobile(e) {
if (mobilecheck()) {
if ($(e.target).parents('.catalog-container').length || $(e.target).hasClass('button')) {
if ($('#site-content').hasClass('open')) {
$siteAdv.show();
}
} else {
if (!$('#site-content').hasClass('open')) {
$siteAdv.show();
}
}
}
}
Главное, что работает
inferusvv ,
26 Апреля 2016
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Task 8_1</title>
<script type="text/javascript">
function charRemover(item) {
var charsMoreThanTwoTimes = "";
var charsMoreThanTwoTimes2 = "";
var tmpString="";
var result = "";
var almostResult = "";
var nextWordBeginning = 0;
for (var a = 0; a < item.length; a++) {
if ((a == nextWordBeginning+1)&&(nextWordBeginning > 0)) {tmpString="";}
if ((a!=item.length-1)&&((item[a]!=' ') && (item[a]!=',') && (item[a]!='.') && (item[a]!=';') && (item[a]!=':') && (item[a]!='!') && (item[a]!='?')))
{
tmpString = tmpString + item[a];
}
else if ((a == item.length -1 ) && ((item[a]!=' ') && (item[a]!=',') && (item[a]!='.') && (item[a]!=';') && (item[a]!=':') && (item[a]!='!') && (item[a]!='?')))
{
tmpString = tmpString + item[a];
for (var j = 0; j < tmpString.length; j++)
{
var counter = 0;
for (var k = 0; k < tmpString.length; k++)
{
if (tmpString[k] == tmpString[j]) {counter++; }
}
if (counter == 1) {almostResult = almostResult + tmpString[j];}
if (counter > 1) { charsMoreThanTwoTimes = charsMoreThanTwoTimes + tmpString[j];}
}
}
else if ((a != item.length-1)&&((item[a]==' ') || (item[a]==',') || (item[a]=='.') || (item[a]==';') || (item[a]==':') || (item[a]=='!'))){
for (var j = 0; j < tmpString.length; j++)
{
var counter = 0;
for (var k = 0; k < tmpString.length; k++)
{
if (tmpString[k] == tmpString[j]) {counter++;}
}
if (counter == 1) {almostResult = almostResult + tmpString[j];}
if (counter > 1) { charsMoreThanTwoTimes = charsMoreThanTwoTimes + tmpString[j];}
}
almostResult = almostResult + item[a];
nextWordBeginning = a;
}
}
counter = 0;
//пройдемся еще раз и удалим символы, которые встречаются более одного раза
for (var i = 0; i < almostResult.length; i++)
{
var shoundCharToBeRemoved = false;
for (var j = 0 ; j < charsMoreThanTwoTimes.length; j++)
{
if (almostResult[i] == charsMoreThanTwoTimes[j]) {shoundCharToBeRemoved = true;}
}
if (shoundCharToBeRemoved == true) {}
else {result = result + almostResult[i];}
}
return result;
}
var sourceString = "У попа была собака";
var destString = charRemover(sourceString);
</script>
</head>
<body>
<script type="text/javascript">
document.write(destString);
</script>
</body>
</html>
Только что начал изучать JavaScript. Знаю, что говнокод, так что не судите строго !
Сама задача: Нanucaть функцuю, нa вxoд кoтoрoй nрuxoдuт cтрoкa, cocтoящaя uз неcкoлькux cлoв. cлoвa
рaзделены nрoбельнымu cuмвoлaмu (nрoбел, тaбуляцuя) u знaкaмu nреnuнaнuя (?!:;,.). Нужнo
вернуть cтрoку, в кoтoрoй будут удaлены вcе cuмвoлы, noвтoряющuеcя xoть в oднoм uз cлoв бoлее
oднoro рaзa.
ololenok,
22 Апреля 2016