- 1
$(this).parents('#orig').clone().appendTo('#main');
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158
$(this).parents('#orig').clone().appendTo('#main');
Клонирование элементов формы
+162
$('p.li').click(function(){
var li = $(this).attr("id");
switch (li) {
case 'a': ($('div.win').load('a.html')); break
case 'b': ($('div.win').load('b.html')); break
case 'c': ($('div.win').load('c.html')); break
case 'd': ($('div.win').load('d.html')); break
case 'e': ($('div.win').load('e.html')); break
case 'f': ($('div.win').load('f.html')); break
default: ($('div.win').load('Error.html'));
}
+163
....
this.add_var = function(code){
if(!this.undef.oneOf(code[1])){
vName = code[1];
if(this.isName(vName)){
if(this.type[vName] == undefined){
this.type[vName] = 'var';
if(code[2] == '='){
if(!this.undef.oneOf(code[3])){
if(this.isNumber(code[3])){
value = parseFloat(code[3]);
this.vars[vName] = value;
return value;
}else if(this.isName(code[3])){
if(this.vars[code[3]] != undefined){
value = this.vars[code[3]];
this.vars[vName] = value;
return value;
}else{
return 'Error:variable ' + code[3] + ' undefined.'
}
}else{
return 'Error:value must be variable or number'
}
}else{
return 'Error:you not type var value.'
}
}else{
return 'nil';
}
}else{
return 'Error:variable already defined.';
}
}else{
return 'Error: in variable name.'
}
}else{
return 'Error: you not type var name.'
}
}
....
Часть исходника интерпретатора функционального ЯПа добавляющая переменные в контекст.
Представляет собой каскад всевозможных проверок.
+145
function getTimezoneName() {
tmSummer = new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0));
so = -1 * tmSummer.getTimezoneOffset();
tmWinter = new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0));
wo = -1 * tmWinter.getTimezoneOffset();
if (-660 == so && -660 == wo) return 'Pacific/Midway';
if (-600 == so && -600 == wo) return 'Pacific/Tahiti';
if (-570 == so && -570 == wo) return 'Pacific/Marquesas';
if (-540 == so && -600 == wo) return 'America/Adak';
if (-540 == so && -540 == wo) return 'Pacific/Gambier';
if (-480 == so && -540 == wo) return 'US/Alaska';
if (-480 == so && -480 == wo) return 'Pacific/Pitcairn';
if (-420 == so && -480 == wo) return 'US/Pacific';
if (-420 == so && -420 == wo) return 'US/Arizona';
if (-360 == so && -420 == wo) return 'US/Mountain';
if (-360 == so && -360 == wo) return 'America/Guatemala';
if (-360 == so && -300 == wo) return 'Pacific/Easter';
if (-300 == so && -360 == wo) return 'US/Central';
if (-300 == so && -300 == wo) return 'America/Bogota';
if (-240 == so && -300 == wo) return 'US/Eastern';
if (-240 == so && -240 == wo) return 'America/Caracas';
if (-240 == so && -180 == wo) return 'America/Santiago';
if (-180 == so && -240 == wo) return 'Canada/Atlantic';
if (-180 == so && -180 == wo) return 'America/Montevideo';
if (-180 == so && -120 == wo) return 'America/Sao_Paulo';
if (-150 == so && -210 == wo) return 'America/St_Johns';
if (-120 == so && -180 == wo) return 'America/Godthab';
if (-120 == so && -120 == wo) return 'America/Noronha';
if (-60 == so && -60 == wo) return 'Atlantic/Cape_Verde';
if (0 == so && -60 == wo) return 'Atlantic/Azores';
if (0 == so && 0 == wo) return 'Africa/Casablanca';
if (60 == so && 0 == wo) return 'Europe/London';
if (60 == so && 60 == wo) return 'Africa/Algiers';
if (60 == so && 120 == wo) return 'Africa/Windhoek';
if (120 == so && 60 == wo) return 'Europe/Amsterdam';
if (120 == so && 120 == wo) return 'Africa/Harare';
if (180 == so && 120 == wo) return 'Europe/Athens';
if (180 == so && 180 == wo) return 'Africa/Nairobi';
if (240 == so && 180 == wo) return 'Europe/Moscow';
if (240 == so && 240 == wo) return 'Asia/Dubai';
if (270 == so && 210 == wo) return 'Asia/Tehran';
if (270 == so && 270 == wo) return 'Asia/Kabul';
if (300 == so && 240 == wo) return 'Asia/Baku';
if (300 == so && 300 == wo) return 'Asia/Karachi';
if (330 == so && 330 == wo) return 'Asia/Calcutta';
if (345 == so && 345 == wo) return 'Asia/Katmandu';
if (360 == so && 300 == wo) return 'Asia/Yekaterinburg';
if (360 == so && 360 == wo) return 'Asia/Colombo';
if (390 == so && 390 == wo) return 'Asia/Rangoon';
if (420 == so && 360 == wo) return 'Asia/Almaty';
if (420 == so && 420 == wo) return 'Asia/Bangkok';
if (480 == so && 420 == wo) return 'Asia/Krasnoyarsk';
if (480 == so && 480 == wo) return 'Australia/Perth';
if (540 == so && 480 == wo) return 'Asia/Irkutsk';
if (540 == so && 540 == wo) return 'Asia/Tokyo';
if (570 == so && 570 == wo) return 'Australia/Darwin';
if (570 == so && 630 == wo) return 'Australia/Adelaide';
if (600 == so && 540 == wo) return 'Asia/Yakutsk';
if (600 == so && 600 == wo) return 'Australia/Brisbane';
if (600 == so && 660 == wo) return 'Australia/Sydney';
if (630 == so && 660 == wo) return 'Australia/Lord_Howe';
if (660 == so && 600 == wo) return 'Asia/Vladivostok';
if (660 == so && 660 == wo) return 'Pacific/Guadalcanal';
if (690 == so && 690 == wo) return 'Pacific/Norfolk';
if (720 == so && 660 == wo) return 'Asia/Magadan';
if (720 == so && 720 == wo) return 'Pacific/Fiji';
if (720 == so && 780 == wo) return 'Pacific/Auckland';
if (765 == so && 825 == wo) return 'Pacific/Chatham';
if (780 == so && 780 == wo) return 'Pacific/Enderbury'
if (840 == so && 840 == wo) return 'Pacific/Kiritimati';
return 'US/Pacific';
}
var tz = getTimezoneName();
уныло, но чем-то умиляет. Наверное, проделанным рассчетом
+159
/** Связанный JavaScript **/
/*
var script = new Array();
var s = 0;
linked = e.match(/<script type=("|')text\/javascript("|') src=("|').*?("|')><\/script>/gi);
if (linked != null)
{
src_link = new Array();
j = 0;
for (i = 0; i < linked.length; i++)
{
e = e.replace(linked[i], '');
new_link = linked[i].match(/src=("|').*?("|')>/gi);
if (new_link != null)
{
script[s] = document.createElement('script');
script[s].setAttribute('type', 'text/javascript');
script[s].id = 'JavaScript_' + hist.length + '_' + j;
script[s].setAttribute('src', new_link[0].substr(5, (new_link[0].length - (5 + 2))));
s++; j++;
}
}
}
*/
/** Внедрённый JavaScript **/
/*
e = e.replace(/[\r\n]/g, ' ');
intruded = e.match(/<script type=("|')text\/javascript("|')>.*?<\/script>/gi);
if (intruded != null)
{
for (i = 0; i < intruded.length; i++)
{
inner = '';
e = e.replace(intruded[i], '');
inner = intruded[i].replace(/<script type=("|')text\/javascript("|')>/, '').replace(/<\/script>/, '');
if (navigator.appName == 'Microsoft Internet Explorer')
{
script[s] = inner;
}
else
{
script[s] = document.createElement('script');
script[s].setAttribute('type', 'text/javascript');
script[s].id = 'JavaScript_' + hist.length + '_' + i;
script[s].innerHTML = inner;
}
s++;
}
}
*/
А вставить в элемент и найти через getElementsByTagName("script") слишком просто :D
+184
if (''.length>0){
// O_O - или я чего-то не знаю или это писали индусы
}
+168
<!--
function scr_width() { // Определяем функцию
var height=0;
var width=0;
if (self.screen) { // for NN4 and IE4
width = screen.width
height = screen.height
}
else
if (self.java) { // for NN3 with enabled Java
var jkit = java.awt.Toolkit.getDefaultToolkit();
var scrsize = jkit.getScreenSize();
width = scrsize.width;
height = scrsize.height;
}
if (width==1024) { // Если разрешение 1024рх, то выводим 7 блоков
document.write("<table width='100%' align='center'><tr>");
document.write("<td><img src='img/1.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/2.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/3.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/4.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/5.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/6.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/7.gif' height='126px'> width='126px'></td>");
document.write("</tr></table>");
}
if (width==1152) { // Если разрешение 1152рх, то выводим 7 блоков
document.write("<table width='100%' align='center'><tr>");
document.write("<td><img src='img/1.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/2.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/3.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/4.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/5.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/6.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/7.gif' height='126px'> width='126px'></td>");
document.write("</tr></table>");
}
if (width==1280) { // Если разрешение 1280рх, то выводим 8 блоков
document.write("<table width='100%' align='center'><tr>");
document.write("<td><img src='img/1.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/2.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/3.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/4.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/5.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/6.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/7.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/8.gif' height='126px'> width='126px'></td>");
document.write("</tr></table>");
}
if (width>1280) { // Если разрешение больше 1280рх, то выводим все блоки
document.write("<table width='100%' align='center'><tr>");
document.write("<td><img src='img/1.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/2.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/3.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/4.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/5.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/6.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/7.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/8.gif' height='126px'> width='126px'></td>");
document.write("<td><img src='img/9.gif' height='126px'> width='126px'></td>");
document.write("</tr></table>");
}
}
scr_width() // Вызов функции
//-->
ололо
+169
for (i = 0; i < 1000; i++) /** Уничтожаем потоки **/ /** УНИЧТОЖИТЬ ЭТУ ХЕРЬ И НАПИСАТЬ ЧТОТО ПРИЛИЧНОЕ **/
{
clear = true;
if (hash_interval != i)
{
for (k in flowException)
{
if (k == i)
{
clear = false;
break;
}
}
if (clear == true)
{
clearInterval(i);
}
}
}
Собственно потоками в данном случае называются индикаторы setInterval
+164
function createSettings()
{
var queryVariables = getQueryVariables();
var settings =
"<settings"+"\n"+
" map_type=\"combine\""+"\n";
if (queryVariables["workspaceId"] != undefined)
settings += " default_ws_id=\"" + queryVariables["workspaceId"] + "\""+"\n";
else settings += " default_ws_id=\"2\""+"\n";
if (queryVariables["scaleLevel"] != undefined)
settings += " start_scale=\"" + queryVariables["scaleLevel"] + "\""+"\n";
else settings += " start_scale=\"1\""+"\n";
if (queryVariables["x"] != undefined)
settings += " start_x=\"" + queryVariables["x"] + "\""+"\n";
else settings += " start_x=\"50.06542\""+"\n";
if (queryVariables["y"] != undefined)
settings += " start_y=\"" + queryVariables["y"] + "\""+"\n";
else settings += " start_y=\"42.335648\""+"\n";
settings +=
" max_objects_to_load =\"1000000\""+"\n"+
" thematic_layers_opacity=\"0.5\""+"\n"+
" min_chart_square=\"2000\""+"\n"+
" vector_parallel_load=\"true\""+"\n"+
" draw_when_vector_loaded=\"true\""+"\n"+
" min_dist_points=\"50\""+"\n"+
" min_dist_points_labels=\"20\""+"\n"+
" min_dist_mpoints=\"10\""+"\n"+
" min_dist_mpoints_labels=\"20\""+"\n"+
" show_points_for_new_selection=\"true\""+"\n"+
" waves_color=\"white\""+"\n"+
" skin=\"blue.swf\""+"\n"+
" info1=\"Геопортал Роскосмоса\" "+"\n"+
' username="guest" '+"\n"+
' password="8071c11b0c08015469a2b48b750849a0" '+"\n"+
/*" username=\"guest\""+"\n"+
" password=\"8071c11b0c08015469a2b48b750849a0\""+"\n"+*/
" />";
return settings;
}
Роскосмос запустил конкурента Google Maps
http://lenta.ru/news/2010/12/21/geoportal/
Геопортал разрабатывался ОАО "Российские космические системы" совместно с НИИ точных приборов.
На создание ресурса было потрачено 10 миллионов рублей.
http://geoportal.ntsomz.ru/
+160
var countdownfrom=35*10
var currentsecond=document.getElementById('countdown').innerHTML=countdownfrom+1
function cntredirect(){
if (currentsecond!=0){
currentsecond-=1
curs=currentsecond/10
cc=curs
cc=cc.toString();
if(curs>=10)
if(cc.length<4)cc=cc+".0";
if(curs<10){
if(cc.length<3)cc=cc+".0";
}
document.getElementById('countdown').innerHTML=cc
}
else{
document.getElementById('linkplace').innerHTML=' <a href="'+'http://dl4.rapidshare.ru/1710955/24966/GK.komprenda.user.js">Щелкните здесь для скачивания файла (ссылка активна 12 часов)</a>'
return
}
setTimeout("cntredirect()",100)
}
cntredirect()
славянская рапида, реализация обратного отсчета