Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/84730a6e4a15
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 01:03:22 2012
Кодировка: UTF-8
allpy: 84730a6e4a15

allpy

changeset 489:84730a6e4a15

blocks3d/www: move to rest2web site-build system * translate source comments to english * use jquery * remove self-written bikes * add README
author boris (netbook) <bnagaev@gmail.com>
date Mon, 21 Feb 2011 00:02:27 +0300
parents 81220300eef2
children 126f99bf234d
files .hgignore blocks3d/www/README blocks3d/www/array.js blocks3d/www/blocks.js blocks3d/www/crc32.js blocks3d/www/crc32_color.js blocks3d/www/css.css blocks3d/www/dechex.js blocks3d/www/down.php blocks3d/www/html.php blocks3d/www/input/blocks.js blocks3d/www/input/crc32.js blocks3d/www/input/crc32_color.js blocks3d/www/input/css.css blocks3d/www/input/dechex.js blocks3d/www/input/index.txt blocks3d/www/input/json2.js blocks3d/www/input/template.txt blocks3d/www/json2.js blocks3d/www/macros.py blocks3d/www/mainpanel.js blocks3d/www/r2w.ini blocks3d/www/screen.js blocks3d/www/top.php
diffstat 24 files changed, 1055 insertions(+), 1552 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Sun Feb 20 22:19:16 2011 +0300
     1.2 +++ b/.hgignore	Mon Feb 21 00:02:27 2011 +0300
     1.3 @@ -3,6 +3,7 @@
     1.4  # Compiler-generated junk
     1.5  *.pyc
     1.6  build
     1.7 +output
     1.8  *.o
     1.9  blocks3d/wt/blocks3d-wt
    1.10  debian/.dep
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/blocks3d/www/README	Mon Feb 21 00:02:27 2011 +0300
     2.3 @@ -0,0 +1,11 @@
     2.4 +build-dependencies:
     2.5 + * rest2web
     2.6 + * yui-compressor
     2.7 + * libjs-jquery
     2.8 +
     2.9 +build template file:
    2.10 + cd www
    2.11 + mkdir output
    2.12 + r2w
    2.13 +output file is build to output/index.html
    2.14 +
     3.1 --- a/blocks3d/www/array.js	Sun Feb 20 22:19:16 2011 +0300
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,190 +0,0 @@
     3.4 -
     3.5 -//////////////////////////
     3.6 -// скопировать массив :)
     3.7 -//////////////////////////
     3.8 -
     3.9 -
    3.10 -function array_clon(obj)
    3.11 -{
    3.12 -    if (typeof(obj) == 'object')
    3.13 -    {
    3.14 -        
    3.15 -        if (typeof(obj.length) === 'undefined')
    3.16 -        {
    3.17 -            var obj1 = {}; // хэш
    3.18 -        }
    3.19 -        else
    3.20 -        {
    3.21 -            var obj1 = []; // массив
    3.22 -        }
    3.23 -        
    3.24 -        
    3.25 -        for (var i in obj)
    3.26 -        {
    3.27 -            obj1[i] = array_clon(obj[i]);
    3.28 -        }
    3.29 -        
    3.30 -        return obj1;
    3.31 -    }  
    3.32 -    else
    3.33 -    {
    3.34 -        return obj;
    3.35 -    }
    3.36 -}
    3.37 -
    3.38 -
    3.39 -
    3.40 -
    3.41 -
    3.42 -/////////////////////////////////////
    3.43 -// взять элемент массива без ошибок
    3.44 -/////////////////////////////////////
    3.45 -
    3.46 -function ae(obj, indexes)
    3.47 -{
    3.48 -    if (typeof(indexes) != 'object')
    3.49 -    {
    3.50 -        indexes = [indexes];
    3.51 -    }
    3.52 -    
    3.53 -    var index;
    3.54 -    var r = obj;
    3.55 -    
    3.56 -    var i;
    3.57 -    
    3.58 -    for (i = 0; i < indexes.length; i++)
    3.59 -    {
    3.60 -        try
    3.61 -        {
    3.62 -            index = indexes[i];
    3.63 -            r = r[index];
    3.64 -        }
    3.65 -        catch(e)
    3.66 -        {
    3.67 -            return 0;
    3.68 -        }
    3.69 -    
    3.70 -    }
    3.71 -    
    3.72 -    if (!r)
    3.73 -    {
    3.74 -        return 0;
    3.75 -    }
    3.76 -    
    3.77 -    return r;
    3.78 -}
    3.79 -
    3.80 -
    3.81 -
    3.82 -
    3.83 -
    3.84 -
    3.85 -
    3.86 -
    3.87 -
    3.88 -///////////////////
    3.89 -// поиск в массиве 
    3.90 -///////////////////
    3.91 -// где, что
    3.92 -function indexOf (input, elt /*, from*/)
    3.93 -{
    3.94 -    
    3.95 -    var r;
    3.96 -    
    3.97 -    try
    3.98 -    {
    3.99 -        return input.indexOf(elt /*, from*/);
   3.100 -    }
   3.101 -    catch(e)
   3.102 -    {
   3.103 -        var len = input.length >>> 0;
   3.104 -
   3.105 -        var from = Number(arguments[1]) || 0;
   3.106 -        from = (from < 0)
   3.107 -             ? Math.ceil(from)
   3.108 -             : Math.floor(from);
   3.109 -        if (from < 0)
   3.110 -          from += len;
   3.111 -
   3.112 -        for (; from < len; from++)
   3.113 -        {
   3.114 -          if (from in input &&
   3.115 -              input[from] === elt)
   3.116 -            return from;
   3.117 -        }
   3.118 -        return -1;
   3.119 -    }
   3.120 -}
   3.121 -
   3.122 -//  
   3.123 -//  
   3.124 -//  if (!Array.prototype.indexOf)
   3.125 -//  {
   3.126 -//    Array.prototype.indexOf = function(elt /*, from*/)
   3.127 -//    {
   3.128 -//      var len = this.length >>> 0;
   3.129 -//  
   3.130 -//      var from = Number(arguments[1]) || 0;
   3.131 -//      from = (from < 0)
   3.132 -//           ? Math.ceil(from)
   3.133 -//           : Math.floor(from);
   3.134 -//      if (from < 0)
   3.135 -//        from += len;
   3.136 -//  
   3.137 -//      for (; from < len; from++)
   3.138 -//      {
   3.139 -//        if (from in this &&
   3.140 -//            this[from] === elt)
   3.141 -//          return from;
   3.142 -//      }
   3.143 -//      return -1;
   3.144 -//    };
   3.145 -//  }
   3.146 -//  
   3.147 -//  
   3.148 -
   3.149 -
   3.150 -
   3.151 -
   3.152 -
   3.153 -
   3.154 -function sortNumber(a, b)
   3.155 -{
   3.156 -    return a - b;
   3.157 -}
   3.158 -
   3.159 -
   3.160 -// возвращает список ключей словаря
   3.161 -function array_keys(arr)
   3.162 -{
   3.163 -    var keys = [];
   3.164 -    
   3.165 -    var key;
   3.166 -    
   3.167 -    for (key in arr)
   3.168 -    {
   3.169 -        keys.push(key);
   3.170 -    }
   3.171 -    
   3.172 -    return keys;
   3.173 -}
   3.174 -
   3.175 -
   3.176 -
   3.177 -
   3.178 -// возвращает список значений словаря
   3.179 -function array_values(arr)
   3.180 -{
   3.181 -    var values = [];
   3.182 -    
   3.183 -    var key;
   3.184 -    
   3.185 -    for (key in arr)
   3.186 -    {
   3.187 -        values.push(arr[key]);
   3.188 -    }
   3.189 -    
   3.190 -    return values;
   3.191 -}
   3.192 -
   3.193 -
     4.1 --- a/blocks3d/www/blocks.js	Sun Feb 20 22:19:16 2011 +0300
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,511 +0,0 @@
     4.4 -
     4.5 -/*
     4.6 -?????? ??????
     4.7 -???? - ??? ???????:
     4.8 -    start: integer
     4.9 -    end: integer
    4.10 -    IDs: list of IDs
    4.11 -    //cores: number of all continued part of cores, taking part in klika 
    4.12 -*/
    4.13 -
    4.14 -var blocks = {};
    4.15 -
    4.16 -// fasta_dict[ID] = ????? ??????????????????
    4.17 -var fasta_dict = {};
    4.18 -
    4.19 -
    4.20 -/////////////////////////////////
    4.21 -// ???????????????? ?????????
    4.22 -/////////////////////////////////
    4.23 -
    4.24 -var h1_height = 50; // ?????? ?????? ? ??????????
    4.25 -var mainpanel_height = 100; // ?????? ?????? ??????????
    4.26 -var legend_interval = 10; // ????? ??????? ??????? ?????? ???????
    4.27 -
    4.28 -
    4.29 -var letter_width = 9; // ?????? ???????
    4.30 -var letter_height = 17; // ?????? ???????
    4.31 -var scroller_height_width = 16; // ?????? = ?????? ????? ?????????
    4.32 -
    4.33 -var boundary = 70; // ????? ?? ??????? ??????
    4.34 -
    4.35 -
    4.36 -
    4.37 -
    4.38 -
    4.39 -//////////////////////////////////////////////
    4.40 -// ??????????? ?????????? ???????????? ????
    4.41 -//////////////////////////////////////////////
    4.42 -
    4.43 -
    4.44 -var selected_block_i; // ????? ???? ??? ???????
    4.45 -var ID_order = []; // ??????? ?????????? ID ?? ??????
    4.46 -
    4.47 -var ID_order_now = []; // ID_order, ??????????? ??? ??????? ??????????
    4.48 -
    4.49 -var max_ID_length; // ???????????? ????? ????????
    4.50 -var seq_length; // ????? ??????????????????
    4.51 -var IDs_count; // ??????? ? ??? ????? ??????????????????
    4.52 -
    4.53 -// alignment_strings[ID] = ??????? ? ??????????????????? ?? ??? <pre>
    4.54 -var alignment_strings = {};
    4.55 -
    4.56 -
    4.57 -//useful_positions[ID][position] = ????? ?????, 
    4.58 -//???? ???? ??????? ?????? ? ?????? ?????? ?????? ?????.
    4.59 -var useful_positions = {};
    4.60 -
    4.61 -
    4.62 -var blocks_inited = 0;
    4.63 -
    4.64 -
    4.65 -
    4.66 -// ???????? ???? ???????
    4.67 -function blocks_init()
    4.68 -{
    4.69 -    if (blocks_inited)
    4.70 -    {
    4.71 -        return;
    4.72 -    }
    4.73 -    
    4.74 -    blocks_inited = 1;
    4.75 -    
    4.76 -    
    4.77 -    var ID, block;
    4.78 -    var i, j, k;
    4.79 -    var t = '';
    4.80 -    
    4.81 -    var seq;
    4.82 -    
    4.83 -    // ???????? max_ID_length
    4.84 -    
    4.85 -    
    4.86 -    max_ID_length = 0;
    4.87 -    
    4.88 -    for (ID in fasta_dict)
    4.89 -    {
    4.90 -        max_ID_length = Math.max(max_ID_length, ID.length);
    4.91 -    }
    4.92 -    
    4.93 -    
    4.94 -    // ????? ??????????????????
    4.95 -    
    4.96 -    for (ID in fasta_dict)
    4.97 -    {
    4.98 -        seq_length = fasta_dict[ID].length;
    4.99 -        break;
   4.100 -    }
   4.101 -    
   4.102 -    
   4.103 -    // ??????? ? ??? ????? ??????????????????
   4.104 -    IDs_count = array_keys(fasta_dict).length;
   4.105 -    
   4.106 -    
   4.107 -
   4.108 -    
   4.109 -    ///////////////////////////////////////
   4.110 -    // ????????? ???? ??? ??????? ?????
   4.111 -    ///////////////////////////////////////
   4.112 -    
   4.113 -    for (i = 0; i < blocks.length; i++)
   4.114 -    {
   4.115 -        blocks[i].color = crc32_color(json(blocks[i]));
   4.116 -    }
   4.117 -    
   4.118 -    
   4.119 -    
   4.120 -    
   4.121 -    
   4.122 -    
   4.123 -    
   4.124 -    
   4.125 -    
   4.126 -    
   4.127 -    ////////////////////////////////////////////////////////////
   4.128 -    // ??????? ???????, ??????? ??? ????? ????????????? ???????
   4.129 -    ////////////////////////////////////////////////////////////
   4.130 -    
   4.131 -    useful_positions = {};
   4.132 -    
   4.133 -    for (ID in fasta_dict)
   4.134 -    {
   4.135 -        useful_positions[ID] = [];
   4.136 -    }
   4.137 -    
   4.138 -    for (i = 0; i < blocks.length; i++)
   4.139 -    {
   4.140 -        block = blocks[i];
   4.141 -        
   4.142 -        for (k = 0; k < block.IDs.length; k++)
   4.143 -        {
   4.144 -            ID = block.IDs[k];
   4.145 -            
   4.146 -            for (j = block.start; j <= block.end; j++)
   4.147 -            {
   4.148 -                useful_positions[ID][j] = i;
   4.149 -            }
   4.150 -        }
   4.151 -        
   4.152 -    }
   4.153 -    
   4.154 -    
   4.155 -    
   4.156 -    
   4.157 -    
   4.158 -    // ???????? ??????? ??? <pre>, ????? ?????? ??? ?? ???????
   4.159 -    
   4.160 -    alignment_strings = {};
   4.161 -    
   4.162 -    
   4.163 -    var block_i;
   4.164 -    
   4.165 -    for (ID in fasta_dict)
   4.166 -    {
   4.167 -        t = '';
   4.168 -        
   4.169 -        seq = fasta_dict[ID];
   4.170 -        
   4.171 -        for (j = 0; j < seq_length; j++)
   4.172 -        {
   4.173 -            block_i = useful_positions[ID][j];
   4.174 -            
   4.175 -            if (block_i || block_i === 0)
   4.176 -            {
   4.177 -                // ???? ??????? ?????? ? ?????? ?????
   4.178 -                
   4.179 -                t += '<font ';
   4.180 -                //t += ' id="a_' + ID + '_' + j + '" ';
   4.181 -                t += ' style="background:' + blocks[block_i].color + '; cursor:pointer;" ' ;
   4.182 -                t += ' onclick=letter_click("' + ID + '",' + j + ') ' ;
   4.183 -                t += '>';
   4.184 -            }
   4.185 -
   4.186 -            t += seq.charAt(j);
   4.187 -
   4.188 -            if (block_i || block_i === 0)
   4.189 -            {
   4.190 -                t += '</font>';
   4.191 -            }
   4.192 -            
   4.193 -        }
   4.194 -        
   4.195 -        alignment_strings[ID] = t;
   4.196 -        
   4.197 -        
   4.198 -    }
   4.199 -    
   4.200 -    
   4.201 -    
   4.202 -    
   4.203 -    ////////////////////////////
   4.204 -    // ???????? ???????????????
   4.205 -    ////////////////////////////
   4.206 -    
   4.207 -    set_table_width_height();
   4.208 -    
   4.209 -    
   4.210 -    
   4.211 -    ///////////////////////////////////////
   4.212 -    // ???????? ????? ? ???????? ???????
   4.213 -    ///////////////////////////////////////
   4.214 -    
   4.215 -    t = '';
   4.216 -    
   4.217 -    var c = Math.floor(seq_length / legend_interval); // ????? ????????
   4.218 -    var number; // ??????? ?????
   4.219 -    
   4.220 -    for (i = 1; i <= c; i++)
   4.221 -    {
   4.222 -        number = i * legend_interval;
   4.223 -        number = '' + number; // ??????? ? ??????
   4.224 -        
   4.225 -        for (j = 0; j < legend_interval - number.length; j++)
   4.226 -        {
   4.227 -            t += '&nbsp;';
   4.228 -        }
   4.229 -        
   4.230 -        t += number;
   4.231 -        
   4.232 -    }
   4.233 -    
   4.234 -    t = '<pre><nobr>' + t + '</nobr></pre>';
   4.235 -    
   4.236 -    $('legend').innerHTML = t;
   4.237 -    
   4.238 -    
   4.239 -    
   4.240 -    
   4.241 -    
   4.242 -    
   4.243 -    
   4.244 -    
   4.245 -    ////////////////////////
   4.246 -    // ?????? ?? ????????
   4.247 -    ////////////////////////
   4.248 -    
   4.249 -    
   4.250 -    ID_order = array_keys(fasta_dict);
   4.251 -    
   4.252 -    blocks_show();
   4.253 -    
   4.254 -}
   4.255 -
   4.256 -
   4.257 -
   4.258 -
   4.259 -
   4.260 -
   4.261 -// ????????? ?????? ? ?????? ???????? ???????
   4.262 -function set_table_width_height()
   4.263 -{
   4.264 -    /*
   4.265 -    ? <pre> ?????? ??????????? ??????? ?? ????????? ??????? ? ????? ?????? ? ? ????? ?????
   4.266 -    */
   4.267 -    
   4.268 -    
   4.269 -    
   4.270 -    
   4.271 -    $('mainpanel').style.height = mainpanel_height + 'px';
   4.272 -    $('h1_header').style.height = h1_height + 'px';
   4.273 -    
   4.274 -    
   4.275 -    $('legend').style.height = (letter_height * 2) + 'px';
   4.276 -    
   4.277 -    
   4.278 -    var screen_width = get_ww();
   4.279 -    var screen_height = get_wh();
   4.280 -    
   4.281 -    // ?????? ???????? ? ??????????: (????? ???????? + 3 ??????? (" : ")) * ?????? ??????? (9)
   4.282 -    var IDs_panel_width = (max_ID_length + 3) * letter_width;
   4.283 -    $('IDs').style.width = IDs_panel_width + 'px';
   4.284 -    
   4.285 -    
   4.286 -    
   4.287 -    
   4.288 -    // ??????? ???, ??? ????????
   4.289 -    var width_1 = screen_width - IDs_panel_width - boundary;
   4.290 -    
   4.291 -    // ??????? ?? ??? ???????? ?? ?????????
   4.292 -    var width_2 = letter_width * seq_length;
   4.293 -    
   4.294 -    var width = Math.min(width_1, width_2);
   4.295 -    
   4.296 -    
   4.297 -    // ??????? ???, ??? ????????
   4.298 -    var height_1 = screen_height - h1_height - mainpanel_height - letter_height * 2 - boundary;
   4.299 -    
   4.300 -    // ??????? ?? ??? ???????? ?? ?????????
   4.301 -    var height_2 = letter_height * (IDs_count + 2);
   4.302 -    
   4.303 -    var height = Math.min(height_1, height_2);
   4.304 -    
   4.305 -    
   4.306 -    
   4.307 -    
   4.308 -    
   4.309 -    
   4.310 -    $('legend').style.width = width + 'px';
   4.311 -    
   4.312 -    if (height != height_2)
   4.313 -    {
   4.314 -        // ??????? ?????? ????? ?????????
   4.315 -        width += scroller_height_width;
   4.316 -    }
   4.317 -    
   4.318 -    $('alignment').style.width = width + 'px';
   4.319 -    
   4.320 -    
   4.321 -    
   4.322 -    
   4.323 -    
   4.324 -    
   4.325 -    
   4.326 -    $('IDs').style.height = height + 'px';
   4.327 -    
   4.328 -    if (width != width_2)
   4.329 -    {
   4.330 -        // ??????? ?????? ????? ?????????
   4.331 -        height += scroller_height_width;
   4.332 -    }    
   4.333 -    
   4.334 -    $('alignment').style.height = height + 'px';
   4.335 -    
   4.336 -    
   4.337 -}
   4.338 -
   4.339 -
   4.340 -
   4.341 -
   4.342 -
   4.343 -
   4.344 -
   4.345 -
   4.346 -
   4.347 -
   4.348 -
   4.349 -
   4.350 -// ??????????? ??? ????????? ?????? ? ?????????????
   4.351 -function alignment_onscroll()
   4.352 -{
   4.353 -    
   4.354 -    $('legend').scrollLeft = $('alignment').scrollLeft;
   4.355 -    
   4.356 -    $('IDs').scrollTop = $('alignment').scrollTop;
   4.357 -    
   4.358 -}
   4.359 -
   4.360 -
   4.361 -
   4.362 -
   4.363 -
   4.364 -
   4.365 -
   4.366 -
   4.367 -
   4.368 -
   4.369 -
   4.370 -
   4.371 -
   4.372 -
   4.373 -
   4.374 -
   4.375 -
   4.376 -
   4.377 -
   4.378 -
   4.379 -// ??????? ?? ????? pre ? ?????????????, ???? ??? ?????????
   4.380 -function blocks_make_pre()
   4.381 -{
   4.382 -    if (json(ID_order) == json(ID_order_now))
   4.383 -    {
   4.384 -        return; // ?????? ?? ??????????
   4.385 -    }
   4.386 -    
   4.387 -    var ID, block;
   4.388 -    var i, j;
   4.389 -    var t = '';
   4.390 -    
   4.391 -    
   4.392 -    
   4.393 -    /////////////////
   4.394 -    // Alignment
   4.395 -    /////////////////
   4.396 -    
   4.397 -    t = '';
   4.398 -    
   4.399 -    t += "<pre>";
   4.400 -    
   4.401 -    for (i = 0; i < ID_order.length; i++)
   4.402 -    {
   4.403 -        ID = ID_order[i];
   4.404 -        
   4.405 -        t += alignment_strings[ID];
   4.406 -        
   4.407 -        if (i != ID_order.length - 1)
   4.408 -        {
   4.409 -            t += "\n";
   4.410 -        }
   4.411 -    }
   4.412 -    
   4.413 -    t += "</pre>\n";
   4.414 -    
   4.415 -    $('alignment').innerHTML = t;
   4.416 -    
   4.417 -    
   4.418 -    
   4.419 -    
   4.420 -    //////////////////////
   4.421 -    // ?????? ????????
   4.422 -    //////////////////////
   4.423 -    
   4.424 -    
   4.425 -    t = '';
   4.426 -    
   4.427 -    t += "<pre>";
   4.428 -    
   4.429 -    for (i = 0; i < ID_order.length; i++)
   4.430 -    {
   4.431 -        ID = ID_order[i];
   4.432 -        
   4.433 -        // ??????? ????????
   4.434 -        for (j = 0; j < max_ID_length - ID.length; j++)
   4.435 -        {
   4.436 -            t += ' ';
   4.437 -        }
   4.438 -        
   4.439 -        // ????????
   4.440 -        t += ID + ' : ';
   4.441 -        
   4.442 -        t += "\n";
   4.443 -    }
   4.444 -    
   4.445 -    t += "</pre>\n";
   4.446 -    
   4.447 -    $('IDs').innerHTML = t;
   4.448 -    
   4.449 -    
   4.450 -    ID_order_now = array_clon(ID_order);
   4.451 -}
   4.452 -
   4.453 -
   4.454 -
   4.455 -
   4.456 -
   4.457 -// ???? ?? ????? - ????????? ???? ???? ??????
   4.458 -function letter_click(ID, pos)
   4.459 -{
   4.460 -    selected_block_i = useful_positions[ID][pos];
   4.461 -    
   4.462 -    // ??????? ??????????????????, ???????? ? ????
   4.463 -    ID_order = array_clon(blocks[selected_block_i].IDs);
   4.464 -    
   4.465 -    // ? ?????? ??? ?????????
   4.466 -    for (ID in fasta_dict)
   4.467 -    {
   4.468 -        if (indexOf(ID_order, ID) == -1)
   4.469 -        {
   4.470 -            ID_order.push(ID);
   4.471 -        }
   4.472 -    }
   4.473 -    
   4.474 -    blocks_show();
   4.475 -}
   4.476 -
   4.477 -
   4.478 -
   4.479 -
   4.480 -
   4.481 -
   4.482 -function blocks_show()
   4.483 -{
   4.484 -    var t = '';
   4.485 -    
   4.486 -    if (selected_block_i || selected_block_i === 0)
   4.487 -    {
   4.488 -        t += 'Block ' + selected_block_i + '. ';
   4.489 -        
   4.490 -        //t += 'Include cores: ' + blocks[selected_block_i].cores.join(', ');
   4.491 -        
   4.492 -        
   4.493 -    }
   4.494 -    
   4.495 -    
   4.496 -    
   4.497 -    mp_set(t);
   4.498 -    
   4.499 -    blocks_make_pre();
   4.500 -}
   4.501 -
   4.502 -
   4.503 -
   4.504 -
   4.505 -
   4.506 -
   4.507 -
   4.508 -
   4.509 -
   4.510 -
   4.511 -
   4.512 -
   4.513 -
   4.514 -
     5.1 --- a/blocks3d/www/crc32.js	Sun Feb 20 22:19:16 2011 +0300
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,25 +0,0 @@
     5.4 -function crc32 ( str ) {
     5.5 -    // http://kevin.vanzonneveld.net
     5.6 -    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
     5.7 -    // +   improved by: T0bsn
     5.8 -    // -    depends on: utf8_encode
     5.9 -    // *     example 1: crc32('Kevin van Zonneveld');
    5.10 -    // *     returns 1: 1249991249
    5.11 -
    5.12 -    //str = this.utf8_encode(str);
    5.13 -    
    5.14 -    var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
    5.15 -
    5.16 -    var crc = 0;
    5.17 -    var x = 0;
    5.18 -    var y = 0;
    5.19 -
    5.20 -    crc = crc ^ (-1);
    5.21 -    for (var i = 0, iTop = str.length; i < iTop; i++) {
    5.22 -        y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
    5.23 -        x = "0x" + table.substr( y * 9, 8 );
    5.24 -        crc = ( crc >>> 8 ) ^ x;
    5.25 -    }
    5.26 -
    5.27 -    return crc ^ (-1);
    5.28 -}
    5.29 \ No newline at end of file
     6.1 --- a/blocks3d/www/crc32_color.js	Sun Feb 20 22:19:16 2011 +0300
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,32 +0,0 @@
     6.4 -
     6.5 -
     6.6 -// выдает цвет в зависимости от something (это должна быть строка)
     6.7 -function crc32_color(something)
     6.8 -{
     6.9 -    var crc = crc32(something);
    6.10 -    var rgb = []; // [r, g, b] (берутся последние 3 байте подписи)
    6.11 -    
    6.12 -    rgb[0] = crc & 0xFF;
    6.13 -    rgb[1] = (crc >> 8) & 0xFF;
    6.14 -    rgb[2] = (crc >> 16) & 0xFF;
    6.15 -    
    6.16 -    var j;
    6.17 -    
    6.18 -    // подсветлим цвета
    6.19 -    for (j = 0; j < 3; j++)
    6.20 -    {
    6.21 -        rgb[j] |= 128;
    6.22 -    }
    6.23 -    
    6.24 -    for (j = 0; j < 3; j++)
    6.25 -    {
    6.26 -        rgb[j] = dechex(rgb[j]);
    6.27 -        
    6.28 -        if (rgb[j].length == 1)
    6.29 -        {
    6.30 -            rgb[j] = '0' + rgb[j];
    6.31 -        }
    6.32 -    }
    6.33 -    
    6.34 -    return '#' + rgb.join('');
    6.35 -}
    6.36 \ No newline at end of file
     7.1 --- a/blocks3d/www/css.css	Sun Feb 20 22:19:16 2011 +0300
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,84 +0,0 @@
     7.4 -
     7.5 -body
     7.6 -{
     7.7 -    font: 14px 'Arial', Tahoma, Arial;
     7.8 -    cursor: default;
     7.9 -}
    7.10 -A
    7.11 -{ 
    7.12 -    font: 14px 'Arial', Tahoma, Arial;
    7.13 -    color: blue;
    7.14 -    text-decoration: none;
    7.15 -    cursor: pointer;
    7.16 -}
    7.17 -A:hover
    7.18 -{
    7.19 -    color: black;
    7.20 -    font-family: 'Arial' , Tahoma, Arial;
    7.21 -    text-decoration: underline;
    7.22 -}
    7.23 -
    7.24 -h1
    7.25 -{
    7.26 -    font: bold 19px 'Arial' , Tahoma, Arial;
    7.27 -    color: #004080;
    7.28 -}
    7.29 -
    7.30 -h2
    7.31 -{
    7.32 -    font: bold 17px 'Arial' , Tahoma, Arial;
    7.33 -    color: #784080;
    7.34 -}
    7.35 -
    7.36 -h3
    7.37 -{
    7.38 -    font: bold 15px 'Arial' , Tahoma, Arial;
    7.39 -    color: #000000;
    7.40 -}
    7.41 -
    7.42 -TD
    7.43 -{
    7.44 -    font: 14px 'Arial', Tahoma, Arial;
    7.45 -}
    7.46 -
    7.47 -
    7.48 -table
    7.49 -{
    7.50 -    border-color: black;
    7.51 -    border-Collapse: collapse;
    7.52 -    border-width: 1px;
    7.53 -}
    7.54 -
    7.55 -
    7.56 -
    7.57 -img
    7.58 -{
    7.59 -    border:none;
    7.60 -}
    7.61 -
    7.62 -
    7.63 -
    7.64 -
    7.65 -
    7.66 -
    7.67 -
    7.68 -#mainpanel
    7.69 -{
    7.70 -    overflow: auto;
    7.71 -}
    7.72 -
    7.73 -#h1_header
    7.74 -{
    7.75 -    overflow: hidden;
    7.76 -}
    7.77 -
    7.78 -
    7.79 -#legend, #IDs
    7.80 -{
    7.81 -    overflow: hidden;
    7.82 -}
    7.83 -
    7.84 -#alignment
    7.85 -{
    7.86 -    overflow: auto;
    7.87 -}
     8.1 --- a/blocks3d/www/dechex.js	Sun Feb 20 22:19:16 2011 +0300
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,17 +0,0 @@
     8.4 -function dechex (number) {
     8.5 -    // http://kevin.vanzonneveld.net
     8.6 -    // +   original by: Philippe Baumann
     8.7 -    // +   bugfixed by: Onno Marsman
     8.8 -    // +   improved by: http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript
     8.9 -    // +   input by: pilus
    8.10 -    // *     example 1: dechex(10);
    8.11 -    // *     returns 1: 'a'
    8.12 -    // *     example 2: dechex(47);
    8.13 -    // *     returns 2: '2f'
    8.14 -    // *     example 3: dechex(-1415723993);
    8.15 -    // *     returns 3: 'ab9dc427'
    8.16 -    if (number < 0) {
    8.17 -        number = 0xFFFFFFFF + number + 1;
    8.18 -    }
    8.19 -    return parseInt(number, 10).toString(16);
    8.20 -}
    8.21 \ No newline at end of file
     9.1 --- a/blocks3d/www/down.php	Sun Feb 20 22:19:16 2011 +0300
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,2 +0,0 @@
     9.4 -</body>
     9.5 -</html>
    10.1 --- a/blocks3d/www/html.php	Sun Feb 20 22:19:16 2011 +0300
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,34 +0,0 @@
    10.4 -<?
    10.5 -
    10.6 -[inc]top.php
    10.7 -
    10.8 -?>
    10.9 -
   10.10 -<script type="text/javascript">
   10.11 -//<!--
   10.12 -
   10.13 -[inc_js]array.js
   10.14 -[inc_js]json2.js
   10.15 -[inc_js]mainpanel.js
   10.16 -[inc_js]screen.js
   10.17 -[inc_js]crc32_color.js
   10.18 -[inc_js]crc32.js
   10.19 -[inc_js]dechex.js
   10.20 -[inc_js]blocks.js
   10.21 -
   10.22 -
   10.23 -
   10.24 -
   10.25 -
   10.26 -self_js_text
   10.27 -
   10.28 -
   10.29 -//-->
   10.30 -</script>
   10.31 -
   10.32 -
   10.33 -<?
   10.34 -
   10.35 -[inc]down.php
   10.36 -
   10.37 -?>
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/blocks3d/www/input/blocks.js	Mon Feb 21 00:02:27 2011 +0300
    11.3 @@ -0,0 +1,290 @@
    11.4 +
    11.5 +/*
    11.6 +list of blocks
    11.7 +block = {
    11.8 +    start: integer
    11.9 +    end: integer
   11.10 +    IDs: list of IDs
   11.11 +}
   11.12 +*/
   11.13 +
   11.14 +var blocks = {};
   11.15 +
   11.16 +// fasta_dict[ID] = string reprentation of sequence
   11.17 +var fasta_dict = {};
   11.18 +
   11.19 +
   11.20 +// parameters
   11.21 +
   11.22 +var h1_height = 50; // header cell height
   11.23 +var mainpanel_height = 100; // toolbar height
   11.24 +var legend_interval = 10; // interval of position number captions
   11.25 +
   11.26 +var letter_width = 9; // letter width
   11.27 +var letter_height = 17; // letter height
   11.28 +var scroller_height_width = 16; // scrollbar height and width
   11.29 +
   11.30 +var boundary = 70; // margin
   11.31 +
   11.32 +// autogenerated variables
   11.33 +
   11.34 +var selected_block_i; // current block
   11.35 +var ID_order = []; // ID sequence
   11.36 +
   11.37 +var ID_order_now = []; // currently used ID_order
   11.38 +
   11.39 +var max_ID_length; // max name length
   11.40 +var seq_length; // sequence length
   11.41 +var IDs_count; // total number of sequences
   11.42 +
   11.43 +// alignment_strings[ID] = string with sequence for <pre>
   11.44 +var alignment_strings = {};
   11.45 +
   11.46 +
   11.47 +// useful_positions[ID][position] = block id
   11.48 +// (if this element is a part of at least one block)
   11.49 +var useful_positions = {};
   11.50 +
   11.51 +
   11.52 +var blocks_inited = false;
   11.53 +
   11.54 +// run application
   11.55 +function blocks_init()
   11.56 +{
   11.57 +    if (blocks_inited)
   11.58 +    {
   11.59 +        return;
   11.60 +    }
   11.61 +    blocks_inited = true;
   11.62 +
   11.63 +    var ID, block;
   11.64 +    var i, j, k;
   11.65 +    var t = '';
   11.66 +
   11.67 +    var seq;
   11.68 +
   11.69 +    // calculate max_ID_length
   11.70 +    max_ID_length = 0;
   11.71 +    for (ID in fasta_dict)
   11.72 +    {
   11.73 +        max_ID_length = Math.max(max_ID_length, ID.length);
   11.74 +    }
   11.75 +
   11.76 +    // sequence length
   11.77 +    for (ID in fasta_dict)
   11.78 +    {
   11.79 +        seq_length = fasta_dict[ID].length;
   11.80 +        break;
   11.81 +    }
   11.82 +    // number of sequences
   11.83 +    IDs_count = 0;
   11.84 +    $.each(fasta_dict, function(k,v) { IDs_count+=1});
   11.85 +
   11.86 +    // calculate a color for each block
   11.87 +    for (i = 0; i < blocks.length; i++)
   11.88 +    {
   11.89 +        blocks[i].color = crc32_color(json(blocks[i]));
   11.90 +    }
   11.91 +
   11.92 +    // mark colorable positions
   11.93 +    useful_positions = {};
   11.94 +    for (ID in fasta_dict)
   11.95 +    {
   11.96 +        useful_positions[ID] = [];
   11.97 +    }
   11.98 +    for (i = 0; i < blocks.length; i++)
   11.99 +    {
  11.100 +        block = blocks[i];
  11.101 +        for (k = 0; k < block.IDs.length; k++)
  11.102 +        {
  11.103 +            ID = block.IDs[k];
  11.104 +            for (j = block.start; j <= block.end; j++)
  11.105 +            {
  11.106 +                useful_positions[ID][j] = i;
  11.107 +            }
  11.108 +        }
  11.109 +    }
  11.110 +
  11.111 +    // pre-calculate strings for <pre>
  11.112 +    alignment_strings = {};
  11.113 +    var block_i;
  11.114 +    for (ID in fasta_dict)
  11.115 +    {
  11.116 +        t = '';
  11.117 +        seq = fasta_dict[ID];
  11.118 +        for (j = 0; j < seq_length; j++)
  11.119 +        {
  11.120 +            block_i = useful_positions[ID][j];
  11.121 +            if (block_i || block_i === 0)
  11.122 +            {
  11.123 +                // current element is a part of block
  11.124 +                t += '<font ';
  11.125 +                t += ' style="background:' + blocks[block_i].color + '; cursor:pointer;" ' ;
  11.126 +                t += ' onclick=letter_click("' + ID + '",' + j + ') ' ;
  11.127 +                t += '>';
  11.128 +            }
  11.129 +            t += seq.charAt(j);
  11.130 +            if (block_i || block_i === 0)
  11.131 +            {
  11.132 +                t += '</font>';
  11.133 +            }
  11.134 +        }
  11.135 +        alignment_strings[ID] = t;
  11.136 +    }
  11.137 +
  11.138 +    // style
  11.139 +    set_table_width_height();
  11.140 +
  11.141 +    // position numbers
  11.142 +    t = '';
  11.143 +    var c = Math.floor(seq_length / legend_interval); // number of captions
  11.144 +    var current_number; // current number
  11.145 +    for (i = 1; i <= c; i++)
  11.146 +    {
  11.147 +        current_number = i * legend_interval;
  11.148 +        current_number = '' + current_number; // convert to string
  11.149 +        for (j = 0; j < legend_interval - current_number.length; j++)
  11.150 +        {
  11.151 +            t += '&nbsp;';
  11.152 +        }
  11.153 +        t += current_number;
  11.154 +    }
  11.155 +    t = '<pre><nobr>' + t + '</nobr></pre>';
  11.156 +    $('#legend').html(t);
  11.157 +
  11.158 +    // run
  11.159 +    ID_order = [];
  11.160 +    $.each(fasta_dict, function(k,v) { ID_order.push(k); });
  11.161 +    blocks_show();
  11.162 +}
  11.163 +
  11.164 +// set width and height of main table
  11.165 +function set_table_width_height()
  11.166 +{
  11.167 +    /*
  11.168 +    in-<pre> string should have '\n' at start and at end
  11.169 +    */
  11.170 +    $('#mainpanel').height(mainpanel_height);
  11.171 +    $('#h1_header').height(h1_height);
  11.172 +    $('#legend').height(letter_height * 2);
  11.173 +    var screen_width = $(document).width();
  11.174 +    var screen_height = $(document).height();
  11.175 +    
  11.176 +    // width of panel with names = (width of name + 3 chars (" : ")) * width of char (9)
  11.177 +    var IDs_panel_width = (max_ID_length + 3) * letter_width;
  11.178 +    $('#IDs').width(IDs_panel_width);
  11.179 +
  11.180 +    // keep remaining
  11.181 +    var width_1 = screen_width - IDs_panel_width - boundary;
  11.182 +    // self-width
  11.183 +    var width_2 = letter_width * seq_length;
  11.184 +    var width = Math.min(width_1, width_2);
  11.185 +
  11.186 +    // keep remaining
  11.187 +    var height_1 = screen_height - h1_height - mainpanel_height - letter_height * 2 - boundary;
  11.188 +    // self-height
  11.189 +    var height_2 = letter_height * (IDs_count + 2);
  11.190 +    var height = Math.min(height_1, height_2);
  11.191 +
  11.192 +    $('#legend').width(width);
  11.193 +    if (height != height_2)
  11.194 +    {
  11.195 +        // add scrollbar size
  11.196 +        width += scroller_height_width;
  11.197 +    }
  11.198 +
  11.199 +    $('#alignment').width(width);
  11.200 +    $('#IDs').height(height);
  11.201 +
  11.202 +    if (width != width_2)
  11.203 +    {
  11.204 +        // add scrollbar size
  11.205 +        height += scroller_height_width;
  11.206 +    }
  11.207 +
  11.208 +    $('#alignment').height(height);
  11.209 +}
  11.210 +
  11.211 +// handler of scrolling
  11.212 +function alignment_onscroll()
  11.213 +{
  11.214 +    $('#legend').get(0).scrollLeft = $('#alignment').get(0).scrollLeft;
  11.215 +    $('#IDs').get(0).scrollTop = $('#alignment').get(0).scrollTop;
  11.216 +}
  11.217 +
  11.218 +// renders <pre> with alignment, if needed
  11.219 +function blocks_make_pre()
  11.220 +{
  11.221 +    if (json(ID_order) == json(ID_order_now))
  11.222 +    {
  11.223 +        return; // nothing changed
  11.224 +    }
  11.225 +
  11.226 +    var ID, block;
  11.227 +    var i, j;
  11.228 +    var t = '';
  11.229 +
  11.230 +    // Alignment
  11.231 +    t = '';
  11.232 +    t += "<pre>";
  11.233 +    for (i = 0; i < ID_order.length; i++)
  11.234 +    {
  11.235 +        ID = ID_order[i];
  11.236 +        t += alignment_strings[ID];
  11.237 +        if (i != ID_order.length - 1)
  11.238 +        {
  11.239 +            t += "\n";
  11.240 +        }
  11.241 +    }
  11.242 +    t += "</pre>\n";
  11.243 +    $('#alignment').html(t);
  11.244 +
  11.245 +    // panel with names
  11.246 +    t = '';
  11.247 +    t += "<pre>";
  11.248 +    for (i = 0; i < ID_order.length; i++)
  11.249 +    {
  11.250 +        ID = ID_order[i];
  11.251 +        // add spaces
  11.252 +        for (j = 0; j < max_ID_length - ID.length; j++)
  11.253 +        {
  11.254 +            t += ' ';
  11.255 +        }
  11.256 +        // name
  11.257 +        t += ID + ' : ';
  11.258 +        t += "\n";
  11.259 +    }
  11.260 +    t += "</pre>\n";
  11.261 +    $('#IDs').html(t);
  11.262 +
  11.263 +    ID_order_now = $.extend(true, [], ID_order);
  11.264 +}
  11.265 +
  11.266 +// handler of click event of letter
  11.267 +function letter_click(ID, pos)
  11.268 +{
  11.269 +    selected_block_i = useful_positions[ID][pos];
  11.270 +    // add block sequences
  11.271 +    ID_order = $.extend(true, [], blocks[selected_block_i].IDs);
  11.272 +    // other sequences
  11.273 +    for (ID in fasta_dict)
  11.274 +    {
  11.275 +        if ($.inArray(ID, ID_order) == -1)
  11.276 +        {
  11.277 +            ID_order.push(ID);
  11.278 +        }
  11.279 +    }
  11.280 +    blocks_show();
  11.281 +}
  11.282 +
  11.283 +function blocks_show()
  11.284 +{
  11.285 +    var t = '';
  11.286 +    if (selected_block_i || selected_block_i === 0)
  11.287 +    {
  11.288 +        t += 'Block ' + selected_block_i + '. ';
  11.289 +    }
  11.290 +    $('#mainpanel').html(t);
  11.291 +    blocks_make_pre();
  11.292 +}
  11.293 +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/blocks3d/www/input/crc32.js	Mon Feb 21 00:02:27 2011 +0300
    12.3 @@ -0,0 +1,27 @@
    12.4 +
    12.5 +function crc32 ( str ) {
    12.6 +    // http://kevin.vanzonneveld.net
    12.7 +    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
    12.8 +    // +   improved by: T0bsn
    12.9 +    // -    depends on: utf8_encode
   12.10 +    // *     example 1: crc32('Kevin van Zonneveld');
   12.11 +    // *     returns 1: 1249991249
   12.12 +
   12.13 +    //str = this.utf8_encode(str); // commented by bnagaev
   12.14 +    
   12.15 +    var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
   12.16 +
   12.17 +    var crc = 0;
   12.18 +    var x = 0;
   12.19 +    var y = 0;
   12.20 +
   12.21 +    crc = crc ^ (-1);
   12.22 +    for (var i = 0, iTop = str.length; i < iTop; i++) {
   12.23 +        y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
   12.24 +        x = "0x" + table.substr( y * 9, 8 );
   12.25 +        crc = ( crc >>> 8 ) ^ x;
   12.26 +    }
   12.27 +
   12.28 +    return crc ^ (-1);
   12.29 +}
   12.30 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/blocks3d/www/input/crc32_color.js	Mon Feb 21 00:02:27 2011 +0300
    13.3 @@ -0,0 +1,31 @@
    13.4 +
    13.5 +/**
    13.6 + * returns color, corresponding to something (using crc32 value)
    13.7 + *
    13.8 + * something -- string
    13.9 + */
   13.10 +function crc32_color(something)
   13.11 +{
   13.12 +    var crc = crc32(something);
   13.13 +    var rgb = []; // [r, g, b] (3 last bytes of crc32 are used)
   13.14 +    rgb[0] = crc & 0xFF;
   13.15 +    rgb[1] = (crc >> 8) & 0xFF;
   13.16 +    rgb[2] = (crc >> 16) & 0xFF;
   13.17 +    var j;
   13.18 +    // lighten
   13.19 +    for (j = 0; j < 3; j++)
   13.20 +    {
   13.21 +        rgb[j] |= 128;
   13.22 +    }
   13.23 +    for (j = 0; j < 3; j++)
   13.24 +    {
   13.25 +        rgb[j] = dechex(rgb[j]);
   13.26 +        
   13.27 +        if (rgb[j].length == 1)
   13.28 +        {
   13.29 +            rgb[j] = '0' + rgb[j];
   13.30 +        }
   13.31 +    }
   13.32 +    return '#' + rgb.join('');
   13.33 +}
   13.34 +
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/blocks3d/www/input/css.css	Mon Feb 21 00:02:27 2011 +0300
    14.3 @@ -0,0 +1,78 @@
    14.4 +
    14.5 +body
    14.6 +{
    14.7 +    font: 14px 'Arial', Tahoma, Arial;
    14.8 +    cursor: default;
    14.9 +}
   14.10 +
   14.11 +A
   14.12 +{
   14.13 +    font: 14px 'Arial', Tahoma, Arial;
   14.14 +    color: blue;
   14.15 +    text-decoration: none;
   14.16 +    cursor: pointer;
   14.17 +}
   14.18 +
   14.19 +A:hover
   14.20 +{
   14.21 +    color: black;
   14.22 +    font-family: 'Arial' , Tahoma, Arial;
   14.23 +    text-decoration: underline;
   14.24 +}
   14.25 +
   14.26 +h1
   14.27 +{
   14.28 +    font: bold 19px 'Arial' , Tahoma, Arial;
   14.29 +    color: #004080;
   14.30 +}
   14.31 +
   14.32 +h2
   14.33 +{
   14.34 +    font: bold 17px 'Arial' , Tahoma, Arial;
   14.35 +    color: #784080;
   14.36 +}
   14.37 +
   14.38 +h3
   14.39 +{
   14.40 +    font: bold 15px 'Arial' , Tahoma, Arial;
   14.41 +    color: #000000;
   14.42 +}
   14.43 +
   14.44 +TD
   14.45 +{
   14.46 +    font: 14px 'Arial', Tahoma, Arial;
   14.47 +}
   14.48 +
   14.49 +table
   14.50 +{
   14.51 +    border-color: black;
   14.52 +    border-Collapse: collapse;
   14.53 +    border-width: 1px;
   14.54 +}
   14.55 +
   14.56 +img
   14.57 +{
   14.58 +    border:none;
   14.59 +}
   14.60 +
   14.61 +#mainpanel
   14.62 +{
   14.63 +    overflow: auto;
   14.64 +}
   14.65 +
   14.66 +#h1_header
   14.67 +{
   14.68 +    overflow: hidden;
   14.69 +}
   14.70 +
   14.71 +
   14.72 +#legend, #IDs
   14.73 +{
   14.74 +    overflow: hidden;
   14.75 +}
   14.76 +
   14.77 +#alignment
   14.78 +{
   14.79 +    overflow: auto;
   14.80 +}
   14.81 +
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/blocks3d/www/input/dechex.js	Mon Feb 21 00:02:27 2011 +0300
    15.3 @@ -0,0 +1,19 @@
    15.4 +
    15.5 +function dechex (number) {
    15.6 +    // http://kevin.vanzonneveld.net
    15.7 +    // +   original by: Philippe Baumann
    15.8 +    // +   bugfixed by: Onno Marsman
    15.9 +    // +   improved by: http://stackoverflow.com/questions/57803/how-to-convert-decimal-to-hex-in-javascript
   15.10 +    // +   input by: pilus
   15.11 +    // *     example 1: dechex(10);
   15.12 +    // *     returns 1: 'a'
   15.13 +    // *     example 2: dechex(47);
   15.14 +    // *     returns 2: '2f'
   15.15 +    // *     example 3: dechex(-1415723993);
   15.16 +    // *     returns 3: 'ab9dc427'
   15.17 +    if (number < 0) {
   15.18 +        number = 0xFFFFFFFF + number + 1;
   15.19 +    }
   15.20 +    return parseInt(number, 10).toString(16);
   15.21 +}
   15.22 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/blocks3d/www/input/index.txt	Mon Feb 21 00:02:27 2011 +0300
    16.3 @@ -0,0 +1,67 @@
    16.4 +restindex
    16.5 +    format: html
    16.6 +    page-title: Blocks3D
    16.7 +    encoding: utf-8
    16.8 +    output-encoding: None
    16.9 +/restindex
   16.10 +
   16.11 +<style type="text/css">
   16.12 +{include_minified;css.css}
   16.13 +</style>
   16.14 +
   16.15 +<table width="100%" cellpadding="0" cellspacing="0">
   16.16 +
   16.17 +    <tr align="left" valign="top">
   16.18 +        <td colspan="2">
   16.19 +            <div id="h1_header"><h1>Reliable blocks finding</h1></div>
   16.20 +        </td>
   16.21 +    </tr>
   16.22 +    
   16.23 +    <tr align="left" valign="top">
   16.24 +        <td colspan="2">
   16.25 +            <div id="mainpanel">Enable Javascript!</div>
   16.26 +        </td>
   16.27 +    </tr>
   16.28 +
   16.29 +    <tr align="left" valign="top">
   16.30 +        <td>
   16.31 +        </td>
   16.32 +        <td>
   16.33 +            <div id="legend"></div>
   16.34 +        </td>
   16.35 +    </tr>
   16.36 +
   16.37 +
   16.38 +    <tr align=left valign=top>
   16.39 +        <td>
   16.40 +            <div id="IDs"></div>
   16.41 +        </td>
   16.42 +        <td>
   16.43 +            <div id="alignment" onscroll="alignment_onscroll()"></div>
   16.44 +        </td>
   16.45 +    </tr>
   16.46 +
   16.47 +</table>
   16.48 +
   16.49 +
   16.50 +</table>
   16.51 +
   16.52 +<script type="text/javascript">
   16.53 +//<!--
   16.54 +
   16.55 +{include_minified;/usr/share/javascript/jquery/jquery.min.js}
   16.56 +{include_minified;json2.js}
   16.57 +{include_minified;crc32_color.js}
   16.58 +{include_minified;crc32.js}
   16.59 +{include_minified;dechex.js}
   16.60 +{include_minified;blocks.js}
   16.61 +
   16.62 +self_js_text
   16.63 +
   16.64 +$(document).ready(function() {
   16.65 +    blocks_init();
   16.66 +    });
   16.67 +
   16.68 +//-->
   16.69 +</script>
   16.70 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/blocks3d/www/input/json2.js	Mon Feb 21 00:02:27 2011 +0300
    17.3 @@ -0,0 +1,495 @@
    17.4 +/*
    17.5 +    http://www.JSON.org/json2.js
    17.6 +    2009-06-29
    17.7 +
    17.8 +    Public Domain.
    17.9 +
   17.10 +    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
   17.11 +
   17.12 +    See http://www.JSON.org/js.html
   17.13 +
   17.14 +    This file creates a global JSON object containing two methods: stringify
   17.15 +    and parse.
   17.16 +
   17.17 +        JSON.stringify(value, replacer, space)
   17.18 +            value       any JavaScript value, usually an object or array.
   17.19 +
   17.20 +            replacer    an optional parameter that determines how object
   17.21 +                        values are stringified for objects. It can be a
   17.22 +                        function or an array of strings.
   17.23 +
   17.24 +            space       an optional parameter that specifies the indentation
   17.25 +                        of nested structures. If it is omitted, the text will
   17.26 +                        be packed without extra whitespace. If it is a number,
   17.27 +                        it will specify the number of spaces to indent at each
   17.28 +                        level. If it is a string (such as '\t' or '&nbsp;'),
   17.29 +                        it contains the characters used to indent at each level.
   17.30 +
   17.31 +            This method produces a JSON text from a JavaScript value.
   17.32 +
   17.33 +            When an object value is found, if the object contains a toJSON
   17.34 +            method, its toJSON method will be called and the result will be
   17.35 +            stringified. A toJSON method does not serialize: it returns the
   17.36 +            value represented by the name/value pair that should be serialized,
   17.37 +            or undefined if nothing should be serialized. The toJSON method
   17.38 +            will be passed the key associated with the value, and this will be
   17.39 +            bound to the object holding the key.
   17.40 +
   17.41 +            For example, this would serialize Dates as ISO strings.
   17.42 +
   17.43 +                Date.prototype.toJSON = function (key) {
   17.44 +                    function f(n) {
   17.45 +                        // Format integers to have at least two digits.
   17.46 +                        return n < 10 ? '0' + n : n;
   17.47 +                    }
   17.48 +
   17.49 +                    return this.getUTCFullYear()   + '-' +
   17.50 +                         f(this.getUTCMonth() + 1) + '-' +
   17.51 +                         f(this.getUTCDate())      + 'T' +
   17.52 +                         f(this.getUTCHours())     + ':' +
   17.53 +                         f(this.getUTCMinutes())   + ':' +
   17.54 +                         f(this.getUTCSeconds())   + 'Z';
   17.55 +                };
   17.56 +
   17.57 +            You can provide an optional replacer method. It will be passed the
   17.58 +            key and value of each member, with this bound to the containing
   17.59 +            object. The value that is returned from your method will be
   17.60 +            serialized. If your method returns undefined, then the member will
   17.61 +            be excluded from the serialization.
   17.62 +
   17.63 +            If the replacer parameter is an array of strings, then it will be
   17.64 +            used to select the members to be serialized. It filters the results
   17.65 +            such that only members with keys listed in the replacer array are
   17.66 +            stringified.
   17.67 +
   17.68 +            Values that do not have JSON representations, such as undefined or
   17.69 +            functions, will not be serialized. Such values in objects will be
   17.70 +            dropped; in arrays they will be replaced with null. You can use
   17.71 +            a replacer function to replace those with JSON values.
   17.72 +            JSON.stringify(undefined) returns undefined.
   17.73 +
   17.74 +            The optional space parameter produces a stringification of the
   17.75 +            value that is filled with line breaks and indentation to make it
   17.76 +            easier to read.
   17.77 +
   17.78 +            If the space parameter is a non-empty string, then that string will
   17.79 +            be used for indentation. If the space parameter is a number, then
   17.80 +            the indentation will be that many spaces.
   17.81 +
   17.82 +            Example:
   17.83 +
   17.84 +            text = JSON.stringify(['e', {pluribus: 'unum'}]);
   17.85 +            // text is '["e",{"pluribus":"unum"}]'
   17.86 +
   17.87 +
   17.88 +            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
   17.89 +            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
   17.90 +
   17.91 +            text = JSON.stringify([new Date()], function (key, value) {
   17.92 +                return this[key] instanceof Date ?
   17.93 +                    'Date(' + this[key] + ')' : value;
   17.94 +            });
   17.95 +            // text is '["Date(---current time---)"]'
   17.96 +
   17.97 +
   17.98 +        JSON.parse(text, reviver)
   17.99 +            This method parses a JSON text to produce an object or array.
  17.100 +            It can throw a SyntaxError exception.
  17.101 +
  17.102 +            The optional reviver parameter is a function that can filter and
  17.103 +            transform the results. It receives each of the keys and values,
  17.104 +            and its return value is used instead of the original value.
  17.105 +            If it returns what it received, then the structure is not modified.
  17.106 +            If it returns undefined then the member is deleted.
  17.107 +
  17.108 +            Example:
  17.109 +
  17.110 +            // Parse the text. Values that look like ISO date strings will
  17.111 +            // be converted to Date objects.
  17.112 +
  17.113 +            myData = JSON.parse(text, function (key, value) {
  17.114 +                var a;
  17.115 +                if (typeof value === 'string') {
  17.116 +                    a =
  17.117 +/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
  17.118 +                    if (a) {
  17.119 +                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
  17.120 +                            +a[5], +a[6]));
  17.121 +                    }
  17.122 +                }
  17.123 +                return value;
  17.124 +            });
  17.125 +
  17.126 +            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
  17.127 +                var d;
  17.128 +                if (typeof value === 'string' &&
  17.129 +                        value.slice(0, 5) === 'Date(' &&
  17.130 +                        value.slice(-1) === ')') {
  17.131 +                    d = new Date(value.slice(5, -1));
  17.132 +                    if (d) {
  17.133 +                        return d;
  17.134 +                    }
  17.135 +                }
  17.136 +                return value;
  17.137 +            });
  17.138 +
  17.139 +
  17.140 +    This is a reference implementation. You are free to copy, modify, or
  17.141 +    redistribute.
  17.142 +
  17.143 +    This code should be minified before deployment.
  17.144 +    See http://javascript.crockford.com/jsmin.html
  17.145 +
  17.146 +    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
  17.147 +    NOT CONTROL.
  17.148 +*/
  17.149 +
  17.150 +/*jslint evil: true */
  17.151 +
  17.152 +/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
  17.153 +    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
  17.154 +    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
  17.155 +    lastIndex, length, parse, prototype, push, replace, slice, stringify,
  17.156 +    test, toJSON, toString, valueOf
  17.157 +*/
  17.158 +
  17.159 +// Create a JSON object only if one does not already exist. We create the
  17.160 +// methods in a closure to avoid creating global variables.
  17.161 +
  17.162 +var JSON = JSON || {};
  17.163 +
  17.164 +(function () {
  17.165 +
  17.166 +    function f(n) {
  17.167 +        // Format integers to have at least two digits.
  17.168 +        return n < 10 ? '0' + n : n;
  17.169 +    }
  17.170 +
  17.171 +    if (typeof Date.prototype.toJSON !== 'function') {
  17.172 +
  17.173 +        Date.prototype.toJSON = function (key) {
  17.174 +
  17.175 +            return isFinite(this.valueOf()) ?
  17.176 +                   this.getUTCFullYear()   + '-' +
  17.177 +                 f(this.getUTCMonth() + 1) + '-' +
  17.178 +                 f(this.getUTCDate())      + 'T' +
  17.179 +                 f(this.getUTCHours())     + ':' +
  17.180 +                 f(this.getUTCMinutes())   + ':' +
  17.181 +                 f(this.getUTCSeconds())   + 'Z' : null;
  17.182 +        };
  17.183 +
  17.184 +        String.prototype.toJSON =
  17.185 +        Number.prototype.toJSON =
  17.186 +        Boolean.prototype.toJSON = function (key) {
  17.187 +            return this.valueOf();
  17.188 +        };
  17.189 +    }
  17.190 +
  17.191 +    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  17.192 +        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  17.193 +        gap,
  17.194 +        indent,
  17.195 +        meta = {    // table of character substitutions
  17.196 +            '\b': '\\b',
  17.197 +            '\t': '\\t',
  17.198 +            '\n': '\\n',
  17.199 +            '\f': '\\f',
  17.200 +            '\r': '\\r',
  17.201 +            '"' : '\\"',
  17.202 +            '\\': '\\\\'
  17.203 +        },
  17.204 +        rep;
  17.205 +
  17.206 +
  17.207 +    function quote(string) {
  17.208 +
  17.209 +// If the string contains no control characters, no quote characters, and no
  17.210 +// backslash characters, then we can safely slap some quotes around it.
  17.211 +// Otherwise we must also replace the offending characters with safe escape
  17.212 +// sequences.
  17.213 +
  17.214 +        escapable.lastIndex = 0;
  17.215 +        return escapable.test(string) ?
  17.216 +            '"' + string.replace(escapable, function (a) {
  17.217 +                var c = meta[a];
  17.218 +                return typeof c === 'string' ? c :
  17.219 +                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  17.220 +            }) + '"' :
  17.221 +            '"' + string + '"';
  17.222 +    }
  17.223 +
  17.224 +
  17.225 +    function str(key, holder) {
  17.226 +
  17.227 +// Produce a string from holder[key].
  17.228 +
  17.229 +        var i,          // The loop counter.
  17.230 +            k,          // The member key.
  17.231 +            v,          // The member value.
  17.232 +            length,
  17.233 +            mind = gap,
  17.234 +            partial,
  17.235 +            value = holder[key];
  17.236 +
  17.237 +// If the value has a toJSON method, call it to obtain a replacement value.
  17.238 +
  17.239 +        if (value && typeof value === 'object' &&
  17.240 +                typeof value.toJSON === 'function') {
  17.241 +            value = value.toJSON(key);
  17.242 +        }
  17.243 +
  17.244 +// If we were called with a replacer function, then call the replacer to
  17.245 +// obtain a replacement value.
  17.246 +
  17.247 +        if (typeof rep === 'function') {
  17.248 +            value = rep.call(holder, key, value);
  17.249 +        }
  17.250 +
  17.251 +// What happens next depends on the value's type.
  17.252 +
  17.253 +        switch (typeof value) {
  17.254 +        case 'string':
  17.255 +            return quote(value);
  17.256 +
  17.257 +        case 'number':
  17.258 +
  17.259 +// JSON numbers must be finite. Encode non-finite numbers as null.
  17.260 +
  17.261 +            return isFinite(value) ? String(value) : 'null';
  17.262 +
  17.263 +        case 'boolean':
  17.264 +        case 'null':
  17.265 +
  17.266 +// If the value is a boolean or null, convert it to a string. Note:
  17.267 +// typeof null does not produce 'null'. The case is included here in
  17.268 +// the remote chance that this gets fixed someday.
  17.269 +
  17.270 +            return String(value);
  17.271 +
  17.272 +// If the type is 'object', we might be dealing with an object or an array or
  17.273 +// null.
  17.274 +
  17.275 +        case 'object':
  17.276 +
  17.277 +// Due to a specification blunder in ECMAScript, typeof null is 'object',
  17.278 +// so watch out for that case.
  17.279 +
  17.280 +            if (!value) {
  17.281 +                return 'null';
  17.282 +            }
  17.283 +
  17.284 +// Make an array to hold the partial results of stringifying this object value.
  17.285 +
  17.286 +            gap += indent;
  17.287 +            partial = [];
  17.288 +
  17.289 +// Is the value an array?
  17.290 +
  17.291 +            if (Object.prototype.toString.apply(value) === '[object Array]') {
  17.292 +
  17.293 +// The value is an array. Stringify every element. Use null as a placeholder
  17.294 +// for non-JSON values.
  17.295 +
  17.296 +                length = value.length;
  17.297 +                for (i = 0; i < length; i += 1) {
  17.298 +                    partial[i] = str(i, value) || 'null';
  17.299 +                }
  17.300 +
  17.301 +// Join all of the elements together, separated with commas, and wrap them in
  17.302 +// brackets.
  17.303 +
  17.304 +                v = partial.length === 0 ? '[]' :
  17.305 +                    gap ? '[\n' + gap +
  17.306 +                            partial.join(',\n' + gap) + '\n' +
  17.307 +                                mind + ']' :
  17.308 +                          '[' + partial.join(',') + ']';
  17.309 +                gap = mind;
  17.310 +                return v;
  17.311 +            }
  17.312 +
  17.313 +// If the replacer is an array, use it to select the members to be stringified.
  17.314 +
  17.315 +            if (rep && typeof rep === 'object') {
  17.316 +                length = rep.length;
  17.317 +                for (i = 0; i < length; i += 1) {
  17.318 +                    k = rep[i];
  17.319 +                    if (typeof k === 'string') {
  17.320 +                        v = str(k, value);
  17.321 +                        if (v) {
  17.322 +                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
  17.323 +                        }
  17.324 +                    }
  17.325 +                }
  17.326 +            } else {
  17.327 +
  17.328 +// Otherwise, iterate through all of the keys in the object.
  17.329 +
  17.330 +                for (k in value) {
  17.331 +                    if (Object.hasOwnProperty.call(value, k)) {
  17.332 +                        v = str(k, value);
  17.333 +                        if (v) {
  17.334 +                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
  17.335 +                        }
  17.336 +                    }
  17.337 +                }
  17.338 +            }
  17.339 +
  17.340 +// Join all of the member texts together, separated with commas,
  17.341 +// and wrap them in braces.
  17.342 +
  17.343 +            v = partial.length === 0 ? '{}' :
  17.344 +                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
  17.345 +                        mind + '}' : '{' + partial.join(',') + '}';
  17.346 +            gap = mind;
  17.347 +            return v;
  17.348 +        }
  17.349 +    }
  17.350 +
  17.351 +// If the JSON object does not yet have a stringify method, give it one.
  17.352 +
  17.353 +    if (typeof JSON.stringify !== 'function') {
  17.354 +        JSON.stringify = function (value, replacer, space) {
  17.355 +
  17.356 +// The stringify method takes a value and an optional replacer, and an optional
  17.357 +// space parameter, and returns a JSON text. The replacer can be a function
  17.358 +// that can replace values, or an array of strings that will select the keys.
  17.359 +// A default replacer method can be provided. Use of the space parameter can
  17.360 +// produce text that is more easily readable.
  17.361 +
  17.362 +            var i;
  17.363 +            gap = '';
  17.364 +            indent = '';
  17.365 +
  17.366 +// If the space parameter is a number, make an indent string containing that
  17.367 +// many spaces.
  17.368 +
  17.369 +            if (typeof space === 'number') {
  17.370 +                for (i = 0; i < space; i += 1) {
  17.371 +                    indent += ' ';
  17.372 +                }
  17.373 +
  17.374 +// If the space parameter is a string, it will be used as the indent string.
  17.375 +
  17.376 +            } else if (typeof space === 'string') {
  17.377 +                indent = space;
  17.378 +            }
  17.379 +
  17.380 +// If there is a replacer, it must be a function or an array.
  17.381 +// Otherwise, throw an error.
  17.382 +
  17.383 +            rep = replacer;
  17.384 +            if (replacer && typeof replacer !== 'function' &&
  17.385 +                    (typeof replacer !== 'object' ||
  17.386 +                     typeof replacer.length !== 'number')) {
  17.387 +                throw new Error('JSON.stringify');
  17.388 +            }
  17.389 +
  17.390 +// Make a fake root object containing our value under the key of ''.
  17.391 +// Return the result of stringifying the value.
  17.392 +
  17.393 +            return str('', {'': value});
  17.394 +        };
  17.395 +    }
  17.396 +
  17.397 +
  17.398 +// If the JSON object does not yet have a parse method, give it one.
  17.399 +
  17.400 +    if (typeof JSON.parse !== 'function') {
  17.401 +        JSON.parse = function (text, reviver) {
  17.402 +
  17.403 +// The parse method takes a text and an optional reviver function, and returns
  17.404 +// a JavaScript value if the text is a valid JSON text.
  17.405 +
  17.406 +            var j;
  17.407 +
  17.408 +            function walk(holder, key) {
  17.409 +
  17.410 +// The walk method is used to recursively walk the resulting structure so
  17.411 +// that modifications can be made.
  17.412 +
  17.413 +                var k, v, value = holder[key];
  17.414 +                if (value && typeof value === 'object') {
  17.415 +                    for (k in value) {
  17.416 +                        if (Object.hasOwnProperty.call(value, k)) {
  17.417 +                            v = walk(value, k);
  17.418 +                            if (v !== undefined) {
  17.419 +                                value[k] = v;
  17.420 +                            } else {
  17.421 +                                delete value[k];
  17.422 +                            }
  17.423 +                        }
  17.424 +                    }
  17.425 +                }
  17.426 +                return reviver.call(holder, key, value);
  17.427 +            }
  17.428 +
  17.429 +
  17.430 +// Parsing happens in four stages. In the first stage, we replace certain
  17.431 +// Unicode characters with escape sequences. JavaScript handles many characters
  17.432 +// incorrectly, either silently deleting them, or treating them as line endings.
  17.433 +
  17.434 +            cx.lastIndex = 0;
  17.435 +            if (cx.test(text)) {
  17.436 +                text = text.replace(cx, function (a) {
  17.437 +                    return '\\u' +
  17.438 +                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  17.439 +                });
  17.440 +            }
  17.441 +
  17.442 +// In the second stage, we run the text against regular expressions that look
  17.443 +// for non-JSON patterns. We are especially concerned with '()' and 'new'
  17.444 +// because they can cause invocation, and '=' because it can cause mutation.
  17.445 +// But just to be safe, we want to reject all unexpected forms.
  17.446 +
  17.447 +// We split the second stage into 4 regexp operations in order to work around
  17.448 +// crippling inefficiencies in IE's and Safari's regexp engines. First we
  17.449 +// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
  17.450 +// replace all simple value tokens with ']' characters. Third, we delete all
  17.451 +// open brackets that follow a colon or comma or that begin the text. Finally,
  17.452 +// we look to see that the remaining characters are only whitespace or ']' or
  17.453 +// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
  17.454 +
  17.455 +            if (/^[\],:{}\s]*$/.
  17.456 +test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  17.457 +replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  17.458 +replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
  17.459 +
  17.460 +// In the third stage we use the eval function to compile the text into a
  17.461 +// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
  17.462 +// in JavaScript: it can begin a block or an object literal. We wrap the text
  17.463 +// in parens to eliminate the ambiguity.
  17.464 +
  17.465 +                j = eval('(' + text + ')');
  17.466 +
  17.467 +// In the optional fourth stage, we recursively walk the new structure, passing
  17.468 +// each name/value pair to a reviver function for possible transformation.
  17.469 +
  17.470 +                return typeof reviver === 'function' ?
  17.471 +                    walk({'': j}, '') : j;
  17.472 +            }
  17.473 +
  17.474 +// If the text is not JSON parseable, then a SyntaxError is thrown.
  17.475 +
  17.476 +            throw new SyntaxError('JSON.parse');
  17.477 +        };
  17.478 +    }
  17.479 +}());
  17.480 +
  17.481 +
  17.482 +
  17.483 +
  17.484 +// JSON
  17.485 +function json(obj7)
  17.486 +{
  17.487 +    if (typeof(obj7) == 'string')
  17.488 +    {
  17.489 +        // decode
  17.490 +        return JSON.parse(obj7);
  17.491 +    }
  17.492 +    else
  17.493 +    {
  17.494 +        // encode
  17.495 +        return JSON.stringify(obj7);
  17.496 +    }
  17.497 +}
  17.498 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/blocks3d/www/input/template.txt	Mon Feb 21 00:02:27 2011 +0300
    18.3 @@ -0,0 +1,13 @@
    18.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    18.5 +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    18.6 +<head>
    18.7 +    <title><% title %></title>
    18.8 +    <meta http-equiv="Content-Type"
    18.9 +        content="text/html; charset=<% final_encoding %>" />
   18.10 +</head>
   18.11 +<body>
   18.12 +    <div id="main">
   18.13 +        <% body %>
   18.14 +    </div>
   18.15 +</body>
   18.16 +</html>
    19.1 --- a/blocks3d/www/json2.js	Sun Feb 20 22:19:16 2011 +0300
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,496 +0,0 @@
    19.4 -/*
    19.5 -    http://www.JSON.org/json2.js
    19.6 -    2009-06-29
    19.7 -
    19.8 -    Public Domain.
    19.9 -
   19.10 -    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
   19.11 -
   19.12 -    See http://www.JSON.org/js.html
   19.13 -
   19.14 -    This file creates a global JSON object containing two methods: stringify
   19.15 -    and parse.
   19.16 -
   19.17 -        JSON.stringify(value, replacer, space)
   19.18 -            value       any JavaScript value, usually an object or array.
   19.19 -
   19.20 -            replacer    an optional parameter that determines how object
   19.21 -                        values are stringified for objects. It can be a
   19.22 -                        function or an array of strings.
   19.23 -
   19.24 -            space       an optional parameter that specifies the indentation
   19.25 -                        of nested structures. If it is omitted, the text will
   19.26 -                        be packed without extra whitespace. If it is a number,
   19.27 -                        it will specify the number of spaces to indent at each
   19.28 -                        level. If it is a string (such as '\t' or '&nbsp;'),
   19.29 -                        it contains the characters used to indent at each level.
   19.30 -
   19.31 -            This method produces a JSON text from a JavaScript value.
   19.32 -
   19.33 -            When an object value is found, if the object contains a toJSON
   19.34 -            method, its toJSON method will be called and the result will be
   19.35 -            stringified. A toJSON method does not serialize: it returns the
   19.36 -            value represented by the name/value pair that should be serialized,
   19.37 -            or undefined if nothing should be serialized. The toJSON method
   19.38 -            will be passed the key associated with the value, and this will be
   19.39 -            bound to the object holding the key.
   19.40 -
   19.41 -            For example, this would serialize Dates as ISO strings.
   19.42 -
   19.43 -                Date.prototype.toJSON = function (key) {
   19.44 -                    function f(n) {
   19.45 -                        // Format integers to have at least two digits.
   19.46 -                        return n < 10 ? '0' + n : n;
   19.47 -                    }
   19.48 -
   19.49 -                    return this.getUTCFullYear()   + '-' +
   19.50 -                         f(this.getUTCMonth() + 1) + '-' +
   19.51 -                         f(this.getUTCDate())      + 'T' +
   19.52 -                         f(this.getUTCHours())     + ':' +
   19.53 -                         f(this.getUTCMinutes())   + ':' +
   19.54 -                         f(this.getUTCSeconds())   + 'Z';
   19.55 -                };
   19.56 -
   19.57 -            You can provide an optional replacer method. It will be passed the
   19.58 -            key and value of each member, with this bound to the containing
   19.59 -            object. The value that is returned from your method will be
   19.60 -            serialized. If your method returns undefined, then the member will
   19.61 -            be excluded from the serialization.
   19.62 -
   19.63 -            If the replacer parameter is an array of strings, then it will be
   19.64 -            used to select the members to be serialized. It filters the results
   19.65 -            such that only members with keys listed in the replacer array are
   19.66 -            stringified.
   19.67 -
   19.68 -            Values that do not have JSON representations, such as undefined or
   19.69 -            functions, will not be serialized. Such values in objects will be
   19.70 -            dropped; in arrays they will be replaced with null. You can use
   19.71 -            a replacer function to replace those with JSON values.
   19.72 -            JSON.stringify(undefined) returns undefined.
   19.73 -
   19.74 -            The optional space parameter produces a stringification of the
   19.75 -            value that is filled with line breaks and indentation to make it
   19.76 -            easier to read.
   19.77 -
   19.78 -            If the space parameter is a non-empty string, then that string will
   19.79 -            be used for indentation. If the space parameter is a number, then
   19.80 -            the indentation will be that many spaces.
   19.81 -
   19.82 -            Example:
   19.83 -
   19.84 -            text = JSON.stringify(['e', {pluribus: 'unum'}]);
   19.85 -            // text is '["e",{"pluribus":"unum"}]'
   19.86 -
   19.87 -
   19.88 -            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
   19.89 -            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
   19.90 -
   19.91 -            text = JSON.stringify([new Date()], function (key, value) {
   19.92 -                return this[key] instanceof Date ?
   19.93 -                    'Date(' + this[key] + ')' : value;
   19.94 -            });
   19.95 -            // text is '["Date(---current time---)"]'
   19.96 -
   19.97 -
   19.98 -        JSON.parse(text, reviver)
   19.99 -            This method parses a JSON text to produce an object or array.
  19.100 -            It can throw a SyntaxError exception.
  19.101 -
  19.102 -            The optional reviver parameter is a function that can filter and
  19.103 -            transform the results. It receives each of the keys and values,
  19.104 -            and its return value is used instead of the original value.
  19.105 -            If it returns what it received, then the structure is not modified.
  19.106 -            If it returns undefined then the member is deleted.
  19.107 -
  19.108 -            Example:
  19.109 -
  19.110 -            // Parse the text. Values that look like ISO date strings will
  19.111 -            // be converted to Date objects.
  19.112 -
  19.113 -            myData = JSON.parse(text, function (key, value) {
  19.114 -                var a;
  19.115 -                if (typeof value === 'string') {
  19.116 -                    a =
  19.117 -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
  19.118 -                    if (a) {
  19.119 -                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
  19.120 -                            +a[5], +a[6]));
  19.121 -                    }
  19.122 -                }
  19.123 -                return value;
  19.124 -            });
  19.125 -
  19.126 -            myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
  19.127 -                var d;
  19.128 -                if (typeof value === 'string' &&
  19.129 -                        value.slice(0, 5) === 'Date(' &&
  19.130 -                        value.slice(-1) === ')') {
  19.131 -                    d = new Date(value.slice(5, -1));
  19.132 -                    if (d) {
  19.133 -                        return d;
  19.134 -                    }
  19.135 -                }
  19.136 -                return value;
  19.137 -            });
  19.138 -
  19.139 -
  19.140 -    This is a reference implementation. You are free to copy, modify, or
  19.141 -    redistribute.
  19.142 -
  19.143 -    This code should be minified before deployment.
  19.144 -    See http://javascript.crockford.com/jsmin.html
  19.145 -
  19.146 -    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
  19.147 -    NOT CONTROL.
  19.148 -*/
  19.149 -
  19.150 -/*jslint evil: true */
  19.151 -
  19.152 -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
  19.153 -    call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
  19.154 -    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
  19.155 -    lastIndex, length, parse, prototype, push, replace, slice, stringify,
  19.156 -    test, toJSON, toString, valueOf
  19.157 -*/
  19.158 -
  19.159 -// Create a JSON object only if one does not already exist. We create the
  19.160 -// methods in a closure to avoid creating global variables.
  19.161 -
  19.162 -var JSON = JSON || {};
  19.163 -
  19.164 -(function () {
  19.165 -
  19.166 -    function f(n) {
  19.167 -        // Format integers to have at least two digits.
  19.168 -        return n < 10 ? '0' + n : n;
  19.169 -    }
  19.170 -
  19.171 -    if (typeof Date.prototype.toJSON !== 'function') {
  19.172 -
  19.173 -        Date.prototype.toJSON = function (key) {
  19.174 -
  19.175 -            return isFinite(this.valueOf()) ?
  19.176 -                   this.getUTCFullYear()   + '-' +
  19.177 -                 f(this.getUTCMonth() + 1) + '-' +
  19.178 -                 f(this.getUTCDate())      + 'T' +
  19.179 -                 f(this.getUTCHours())     + ':' +
  19.180 -                 f(this.getUTCMinutes())   + ':' +
  19.181 -                 f(this.getUTCSeconds())   + 'Z' : null;
  19.182 -        };
  19.183 -
  19.184 -        String.prototype.toJSON =
  19.185 -        Number.prototype.toJSON =
  19.186 -        Boolean.prototype.toJSON = function (key) {
  19.187 -            return this.valueOf();
  19.188 -        };
  19.189 -    }
  19.190 -
  19.191 -    var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  19.192 -        escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  19.193 -        gap,
  19.194 -        indent,
  19.195 -        meta = {    // table of character substitutions
  19.196 -            '\b': '\\b',
  19.197 -            '\t': '\\t',
  19.198 -            '\n': '\\n',
  19.199 -            '\f': '\\f',
  19.200 -            '\r': '\\r',
  19.201 -            '"' : '\\"',
  19.202 -            '\\': '\\\\'
  19.203 -        },
  19.204 -        rep;
  19.205 -
  19.206 -
  19.207 -    function quote(string) {
  19.208 -
  19.209 -// If the string contains no control characters, no quote characters, and no
  19.210 -// backslash characters, then we can safely slap some quotes around it.
  19.211 -// Otherwise we must also replace the offending characters with safe escape
  19.212 -// sequences.
  19.213 -
  19.214 -        escapable.lastIndex = 0;
  19.215 -        return escapable.test(string) ?
  19.216 -            '"' + string.replace(escapable, function (a) {
  19.217 -                var c = meta[a];
  19.218 -                return typeof c === 'string' ? c :
  19.219 -                    '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  19.220 -            }) + '"' :
  19.221 -            '"' + string + '"';
  19.222 -    }
  19.223 -
  19.224 -
  19.225 -    function str(key, holder) {
  19.226 -
  19.227 -// Produce a string from holder[key].
  19.228 -
  19.229 -        var i,          // The loop counter.
  19.230 -            k,          // The member key.
  19.231 -            v,          // The member value.
  19.232 -            length,
  19.233 -            mind = gap,
  19.234 -            partial,
  19.235 -            value = holder[key];
  19.236 -
  19.237 -// If the value has a toJSON method, call it to obtain a replacement value.
  19.238 -
  19.239 -        if (value && typeof value === 'object' &&
  19.240 -                typeof value.toJSON === 'function') {
  19.241 -            value = value.toJSON(key);
  19.242 -        }
  19.243 -
  19.244 -// If we were called with a replacer function, then call the replacer to
  19.245 -// obtain a replacement value.
  19.246 -
  19.247 -        if (typeof rep === 'function') {
  19.248 -            value = rep.call(holder, key, value);
  19.249 -        }
  19.250 -
  19.251 -// What happens next depends on the value's type.
  19.252 -
  19.253 -        switch (typeof value) {
  19.254 -        case 'string':
  19.255 -            return quote(value);
  19.256 -
  19.257 -        case 'number':
  19.258 -
  19.259 -// JSON numbers must be finite. Encode non-finite numbers as null.
  19.260 -
  19.261 -            return isFinite(value) ? String(value) : 'null';
  19.262 -
  19.263 -        case 'boolean':
  19.264 -        case 'null':
  19.265 -
  19.266 -// If the value is a boolean or null, convert it to a string. Note:
  19.267 -// typeof null does not produce 'null'. The case is included here in
  19.268 -// the remote chance that this gets fixed someday.
  19.269 -
  19.270 -            return String(value);
  19.271 -
  19.272 -// If the type is 'object', we might be dealing with an object or an array or
  19.273 -// null.
  19.274 -
  19.275 -        case 'object':
  19.276 -
  19.277 -// Due to a specification blunder in ECMAScript, typeof null is 'object',
  19.278 -// so watch out for that case.
  19.279 -
  19.280 -            if (!value) {
  19.281 -                return 'null';
  19.282 -            }
  19.283 -
  19.284 -// Make an array to hold the partial results of stringifying this object value.
  19.285 -
  19.286 -            gap += indent;
  19.287 -            partial = [];
  19.288 -
  19.289 -// Is the value an array?
  19.290 -
  19.291 -            if (Object.prototype.toString.apply(value) === '[object Array]') {
  19.292 -
  19.293 -// The value is an array. Stringify every element. Use null as a placeholder
  19.294 -// for non-JSON values.
  19.295 -
  19.296 -                length = value.length;
  19.297 -                for (i = 0; i < length; i += 1) {
  19.298 -                    partial[i] = str(i, value) || 'null';
  19.299 -                }
  19.300 -
  19.301 -// Join all of the elements together, separated with commas, and wrap them in
  19.302 -// brackets.
  19.303 -
  19.304 -                v = partial.length === 0 ? '[]' :
  19.305 -                    gap ? '[\n' + gap +
  19.306 -                            partial.join(',\n' + gap) + '\n' +
  19.307 -                                mind + ']' :
  19.308 -                          '[' + partial.join(',') + ']';
  19.309 -                gap = mind;
  19.310 -                return v;
  19.311 -            }
  19.312 -
  19.313 -// If the replacer is an array, use it to select the members to be stringified.
  19.314 -
  19.315 -            if (rep && typeof rep === 'object') {
  19.316 -                length = rep.length;
  19.317 -                for (i = 0; i < length; i += 1) {
  19.318 -                    k = rep[i];
  19.319 -                    if (typeof k === 'string') {
  19.320 -                        v = str(k, value);
  19.321 -                        if (v) {
  19.322 -                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
  19.323 -                        }
  19.324 -                    }
  19.325 -                }
  19.326 -            } else {
  19.327 -
  19.328 -// Otherwise, iterate through all of the keys in the object.
  19.329 -
  19.330 -                for (k in value) {
  19.331 -                    if (Object.hasOwnProperty.call(value, k)) {
  19.332 -                        v = str(k, value);
  19.333 -                        if (v) {
  19.334 -                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
  19.335 -                        }
  19.336 -                    }
  19.337 -                }
  19.338 -            }
  19.339 -
  19.340 -// Join all of the member texts together, separated with commas,
  19.341 -// and wrap them in braces.
  19.342 -
  19.343 -            v = partial.length === 0 ? '{}' :
  19.344 -                gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
  19.345 -                        mind + '}' : '{' + partial.join(',') + '}';
  19.346 -            gap = mind;
  19.347 -            return v;
  19.348 -        }
  19.349 -    }
  19.350 -
  19.351 -// If the JSON object does not yet have a stringify method, give it one.
  19.352 -
  19.353 -    if (typeof JSON.stringify !== 'function') {
  19.354 -        JSON.stringify = function (value, replacer, space) {
  19.355 -
  19.356 -// The stringify method takes a value and an optional replacer, and an optional
  19.357 -// space parameter, and returns a JSON text. The replacer can be a function
  19.358 -// that can replace values, or an array of strings that will select the keys.
  19.359 -// A default replacer method can be provided. Use of the space parameter can
  19.360 -// produce text that is more easily readable.
  19.361 -
  19.362 -            var i;
  19.363 -            gap = '';
  19.364 -            indent = '';
  19.365 -
  19.366 -// If the space parameter is a number, make an indent string containing that
  19.367 -// many spaces.
  19.368 -
  19.369 -            if (typeof space === 'number') {
  19.370 -                for (i = 0; i < space; i += 1) {
  19.371 -                    indent += ' ';
  19.372 -                }
  19.373 -
  19.374 -// If the space parameter is a string, it will be used as the indent string.
  19.375 -
  19.376 -            } else if (typeof space === 'string') {
  19.377 -                indent = space;
  19.378 -            }
  19.379 -
  19.380 -// If there is a replacer, it must be a function or an array.
  19.381 -// Otherwise, throw an error.
  19.382 -
  19.383 -            rep = replacer;
  19.384 -            if (replacer && typeof replacer !== 'function' &&
  19.385 -                    (typeof replacer !== 'object' ||
  19.386 -                     typeof replacer.length !== 'number')) {
  19.387 -                throw new Error('JSON.stringify');
  19.388 -            }
  19.389 -
  19.390 -// Make a fake root object containing our value under the key of ''.
  19.391 -// Return the result of stringifying the value.
  19.392 -
  19.393 -            return str('', {'': value});
  19.394 -        };
  19.395 -    }
  19.396 -
  19.397 -
  19.398 -// If the JSON object does not yet have a parse method, give it one.
  19.399 -
  19.400 -    if (typeof JSON.parse !== 'function') {
  19.401 -        JSON.parse = function (text, reviver) {
  19.402 -
  19.403 -// The parse method takes a text and an optional reviver function, and returns
  19.404 -// a JavaScript value if the text is a valid JSON text.
  19.405 -
  19.406 -            var j;
  19.407 -
  19.408 -            function walk(holder, key) {
  19.409 -
  19.410 -// The walk method is used to recursively walk the resulting structure so
  19.411 -// that modifications can be made.
  19.412 -
  19.413 -                var k, v, value = holder[key];
  19.414 -                if (value && typeof value === 'object') {
  19.415 -                    for (k in value) {
  19.416 -                        if (Object.hasOwnProperty.call(value, k)) {
  19.417 -                            v = walk(value, k);
  19.418 -                            if (v !== undefined) {
  19.419 -                                value[k] = v;
  19.420 -                            } else {
  19.421 -                                delete value[k];
  19.422 -                            }
  19.423 -                        }
  19.424 -                    }
  19.425 -                }
  19.426 -                return reviver.call(holder, key, value);
  19.427 -            }
  19.428 -
  19.429 -
  19.430 -// Parsing happens in four stages. In the first stage, we replace certain
  19.431 -// Unicode characters with escape sequences. JavaScript handles many characters
  19.432 -// incorrectly, either silently deleting them, or treating them as line endings.
  19.433 -
  19.434 -            cx.lastIndex = 0;
  19.435 -            if (cx.test(text)) {
  19.436 -                text = text.replace(cx, function (a) {
  19.437 -                    return '\\u' +
  19.438 -                        ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  19.439 -                });
  19.440 -            }
  19.441 -
  19.442 -// In the second stage, we run the text against regular expressions that look
  19.443 -// for non-JSON patterns. We are especially concerned with '()' and 'new'
  19.444 -// because they can cause invocation, and '=' because it can cause mutation.
  19.445 -// But just to be safe, we want to reject all unexpected forms.
  19.446 -
  19.447 -// We split the second stage into 4 regexp operations in order to work around
  19.448 -// crippling inefficiencies in IE's and Safari's regexp engines. First we
  19.449 -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
  19.450 -// replace all simple value tokens with ']' characters. Third, we delete all
  19.451 -// open brackets that follow a colon or comma or that begin the text. Finally,
  19.452 -// we look to see that the remaining characters are only whitespace or ']' or
  19.453 -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
  19.454 -
  19.455 -            if (/^[\],:{}\s]*$/.
  19.456 -test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
  19.457 -replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
  19.458 -replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
  19.459 -
  19.460 -// In the third stage we use the eval function to compile the text into a
  19.461 -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
  19.462 -// in JavaScript: it can begin a block or an object literal. We wrap the text
  19.463 -// in parens to eliminate the ambiguity.
  19.464 -
  19.465 -                j = eval('(' + text + ')');
  19.466 -
  19.467 -// In the optional fourth stage, we recursively walk the new structure, passing
  19.468 -// each name/value pair to a reviver function for possible transformation.
  19.469 -
  19.470 -                return typeof reviver === 'function' ?
  19.471 -                    walk({'': j}, '') : j;
  19.472 -            }
  19.473 -
  19.474 -// If the text is not JSON parseable, then a SyntaxError is thrown.
  19.475 -
  19.476 -            throw new SyntaxError('JSON.parse');
  19.477 -        };
  19.478 -    }
  19.479 -}());
  19.480 -
  19.481 -
  19.482 -
  19.483 -
  19.484 -// JSON
  19.485 -function json(obj7)
  19.486 -{
  19.487 -    if (typeof(obj7) == 'string')
  19.488 -    {
  19.489 -        // раскодируем
  19.490 -        
  19.491 -        return JSON.parse(obj7);
  19.492 -    }
  19.493 -    else
  19.494 -    {
  19.495 -        // кодируем
  19.496 -        return JSON.stringify(obj7);
  19.497 -    }
  19.498 -}
  19.499 -
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/blocks3d/www/macros.py	Mon Feb 21 00:02:27 2011 +0300
    20.3 @@ -0,0 +1,13 @@
    20.4 +import os
    20.5 +from tempfile import NamedTemporaryFile
    20.6 +
    20.7 +def include_minified(filename):
    20.8 +    if filename[0] != '/':
    20.9 +        filename = 'input/%s' % filename
   20.10 +    tmp = NamedTemporaryFile(delete=False)
   20.11 +    os.system("yui-compressor -o %(tmp)s %(filename)s" %\
   20.12 +        {'tmp': tmp.name, 'filename': filename})
   20.13 +    result = tmp.read()
   20.14 +    os.unlink(tmp.name)
   20.15 +    return result
   20.16 +
    21.1 --- a/blocks3d/www/mainpanel.js	Sun Feb 20 22:19:16 2011 +0300
    21.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.3 @@ -1,52 +0,0 @@
    21.4 -
    21.5 -/////////////////////////////////////////
    21.6 -// ??????? ???????? ??????? ? mainpanel
    21.7 -/////////////////////////////////////////
    21.8 -
    21.9 -
   21.10 -
   21.11 -
   21.12 -
   21.13 -/////////////////////////////////
   21.14 -// ???????? ????? ? mainpanel
   21.15 -/////////////////////////////////
   21.16 -
   21.17 -function mp_add(str)
   21.18 -{
   21.19 -    $('mainpanel').innerHTML += str;
   21.20 -}
   21.21 -
   21.22 -
   21.23 -
   21.24 -
   21.25 -////////////////////////////////////
   21.26 -// ????????????? ????? ? mainpanel
   21.27 -////////////////////////////////////
   21.28 -
   21.29 -function mp_set(str)
   21.30 -{
   21.31 -    $('mainpanel').innerHTML = str;
   21.32 -}
   21.33 -
   21.34 -
   21.35 -
   21.36 -
   21.37 -////////////////////////////////////
   21.38 -// ????? ????? ? status line
   21.39 -////////////////////////////////////
   21.40 -
   21.41 -function sl_set(str)
   21.42 -{
   21.43 -    $('statusline').innerHTML = str;
   21.44 -}
   21.45 -
   21.46 -
   21.47 -
   21.48 -///////////////////////////////////////
   21.49 -// ?????????? document.getElementById
   21.50 -///////////////////////////////////////
   21.51 -
   21.52 -function $(str)
   21.53 -{
   21.54 -    return document.getElementById(str);
   21.55 -}
   21.56 \ No newline at end of file
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/blocks3d/www/r2w.ini	Mon Feb 21 00:02:27 2011 +0300
    22.3 @@ -0,0 +1,10 @@
    22.4 +psyco = False
    22.5 +pause = False
    22.6 +log_file = '/tmp/blocks3d-www-build.log'
    22.7 +DEBUG = False
    22.8 +compare_directory = ''
    22.9 +
   22.10 +# these values we have edited for our site
   22.11 +start_directory = 'input'
   22.12 +target_directory = 'output'
   22.13 +macros = 'macros.py'
    23.1 --- a/blocks3d/www/screen.js	Sun Feb 20 22:19:16 2011 +0300
    23.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.3 @@ -1,45 +0,0 @@
    23.4 -
    23.5 -///////////////////////
    23.6 -// ?????? ?????? ????
    23.7 -///////////////////////
    23.8 -
    23.9 -function get_ww()
   23.10 -{
   23.11 -    var frameWidth = 800;
   23.12 -    
   23.13 -    if (self.innerWidth)
   23.14 -    {
   23.15 -        frameWidth = self.innerWidth;
   23.16 -    }
   23.17 -    else if (document.documentElement && document.documentElement.clientWidth)
   23.18 -    {
   23.19 -        frameWidth = document.documentElement.clientWidth;
   23.20 -    }
   23.21 -    else if (document.body)
   23.22 -    {
   23.23 -        frameWidth = document.body.clientWidth;
   23.24 -    }
   23.25 -    
   23.26 -    return frameWidth;
   23.27 -}
   23.28 -
   23.29 -
   23.30 -function get_wh()
   23.31 -{
   23.32 -    var frameHeight = 640;
   23.33 -    
   23.34 -    if (self.innerHeight)
   23.35 -    {
   23.36 -        frameHeight = self.innerHeight;
   23.37 -    }
   23.38 -    else if (document.documentElement && document.documentElement.clientHeight)
   23.39 -    {
   23.40 -        frameHeight = document.documentElement.clientHeight;
   23.41 -    }
   23.42 -    else if (document.body)
   23.43 -    {
   23.44 -        frameHeight = document.body.clientHeight;
   23.45 -    }
   23.46 -    
   23.47 -    return frameHeight;
   23.48 -} 
   23.49 \ No newline at end of file
    24.1 --- a/blocks3d/www/top.php	Sun Feb 20 22:19:16 2011 +0300
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,64 +0,0 @@
    24.4 -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    24.5 -<html>
    24.6 -<head>
    24.7 -
    24.8 -<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    24.9 -
   24.10 -<title>Blocks</title>
   24.11 -
   24.12 -<style type="text/css"> 
   24.13 -<!--
   24.14 -
   24.15 -
   24.16 -[inc_css]css.css
   24.17 -
   24.18 --->
   24.19 -</style>
   24.20 -
   24.21 -
   24.22 -
   24.23 -</head>
   24.24 -
   24.25 - 
   24.26 -<body onload=blocks_init()>
   24.27 -
   24.28 -
   24.29 -    
   24.30 -<table width=100% cellpadding=0 cellspacing=0>
   24.31 -    
   24.32 -
   24.33 -
   24.34 -    <tr align=left valign=top>
   24.35 -        
   24.36 -        <td colspan=2>
   24.37 -            <div id="h1_header"><h1>Reliable blocks finding</h1></div>
   24.38 -        </td>
   24.39 -
   24.40 -
   24.41 -    
   24.42 -    <tr align=left valign=top>
   24.43 -        
   24.44 -        <td colspan=2>
   24.45 -            <div id="mainpanel"> Enable Javascript!</div>
   24.46 -        </td>
   24.47 -
   24.48 -    <tr align=left valign=top>
   24.49 -        
   24.50 -        <td>
   24.51 -        </td>
   24.52 -        
   24.53 -        <td>
   24.54 -            <div id="legend"></div>
   24.55 -        </td>
   24.56 -        
   24.57 -    <tr align=left valign=top>
   24.58 -        
   24.59 -        <td>
   24.60 -            <div id="IDs"></div>
   24.61 -        </td>
   24.62 -        
   24.63 -        <td>
   24.64 -            <div id="alignment" onscroll="alignment_onscroll()"></div>
   24.65 -        </td>
   24.66 -    
   24.67 -</table>