terorama

slider / maket3.tpl.php

Aug 21st, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. <?php
  3.    if (@$_GET["action"]==1) {
  4.    
  5.       session_start();
  6.       session_destroy();
  7.       session_commit();
  8.      
  9.       session_start();
  10.       $_SESSION["startpic"]=1;
  11.      
  12.       //header("Expires: Wed, 01 July 2009 00:00:00");
  13.       //header("Cache-Control: no-store, no-cache, must-revalidate, private");
  14.       //header("Pragma: no-cache");
  15.       }
  16. ?>
  17.  
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  19. <html xmlns="http://www.w3.org/1999/xhtml">
  20. <head>
  21.    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  22.    <meta http-equiv="Cache-Control" content="no-cache" />
  23.    
  24.    <meta name="description" content="Упражнение по PHP, галлерея изображений" />
  25.    <meta name="keywords" content="html,css,javascript,jquery" />
  26.    
  27.    <title>Упражнение по PHP, галлерея изображений FTG</title>
  28.    
  29.    <script type="text/javascript" src="js/jquery-1.7.2.js"></script>
  30.    
  31. </head>
  32.  
  33. <style type="text/css">
  34.    * {
  35.       margin:0;
  36.       padding:0;
  37.       font-family: verdana, sans-serif;
  38.       font-size:10pt;
  39.    }
  40.    
  41.    body {
  42.       background-color: #eee;
  43.       background-image: url(data:image/gif;base64,R0lGODlhCAAIAJEAAMzMzP///////wAAACH5BAEHAAIALAAAAAAIAAgAAAINhG4nudroGJBRsYcxKAA7);
  44.    }
  45.    
  46.    #allcontent {
  47.       margin:20px;
  48.       background:#f0f0f0;
  49.    }
  50.    /*----------------------------------*/
  51.    #addpic {
  52.       display:none;
  53.       position:absolute;
  54.       height:100px;
  55.       width:500px;
  56.       background:#eee;
  57.       z-index:5;
  58.       padding:10px;
  59.       /*border:solid 1px black;*/
  60.    }
  61.    
  62.    #addpic label {
  63.       width:8em;
  64.       float:left;
  65.       text-align:right;
  66.       margin-right:1em;
  67.       display:block;
  68.    }
  69.    
  70.    #addpic .submit input {
  71.       margin-left:8.5em;
  72.       margin-top:4px;
  73.       color:#000;
  74.       background:#ffefaf;
  75.       border: 1px outset #d7b9c9;
  76.       cursor:pointer;
  77.      
  78.       padding:2px 5px;   
  79.    }
  80.    
  81.    #addpic fieldset {
  82.       border:1px solid #781351;
  83.       width:35em;
  84.       padding:1em;
  85.    }
  86.    
  87.    #addpic legend {
  88.       color:#fff;
  89.       background:#ffa20c;
  90.       border:1px solid #781351;
  91.       padding: 2px 6px;
  92.    }
  93.    
  94.    /*----------------------------------*/
  95.    #header {
  96.       height:100px;
  97.       background:#444;
  98.       -moz-border-radius: 30px;
  99.       -webkit-border-radius: 30px;
  100.       bordre-radius: 30px;
  101.    }
  102.    
  103.    #headerlinks {
  104.       position:relative;
  105.       left:40%;
  106.       bottom:50px;
  107.       width:150px;
  108.       height:14px;
  109.       padding:2px 5px 5px 20px;
  110.       line-height:1.5;
  111.      
  112.       background:#999;
  113.       border:solid 1px white;
  114.       z-index:10;
  115.       overflow:hidden;
  116.    }
  117.    #headerlinks a {
  118.       text-decoration:none;
  119.       color:white;
  120.       display:block;
  121.    }
  122.    /*----------------------------------*/
  123.    #pics {      
  124.       /*min-height:400px;*/
  125.      
  126.    }
  127.    
  128.    #wideblock {
  129.       overflow:hidden;
  130.    }
  131.    
  132.    #traceblock {
  133.       position:absolute;
  134.       width:300px;
  135.       height:400px;
  136.       background:#333;
  137.       border:solid 1px yellow;
  138.       color:#9f9;
  139.       font-size:10px;
  140.       z-index:10;
  141.       opacity:0.8;
  142.       filter:alpha(opacity=80);
  143.      
  144.       left:50px;
  145.       top:50px;
  146.    }
  147.    
  148.    .frameblock {
  149.  
  150.       border-right:dotted 1px red;
  151.       float:left;
  152.    }
  153.    
  154.    .picsin  {
  155.       float:left;
  156.       border-right:dotted 1px black;
  157.       border-bottom:dotted 1px black;
  158.       padding:10px;
  159.       height:200px;
  160.       overflow:hidden;
  161.       cursor:pointer;
  162.    }
  163.    
  164.    #bigpic {
  165.       position:absolute;
  166.       background-color:black;
  167.       opacity:0;
  168.       padding:auto;
  169.       overflow:hidden;
  170.       display:none;
  171.       border:ridge 2px white;
  172.       z-index:100;   
  173.    }
  174.    
  175.    #bigpicin {
  176.       margin:10px;
  177.       overflow:hidden;
  178.    }
  179.    /*----------------------------------*/
  180.    #footer {
  181.  
  182.       height:100px;
  183.       color:white;
  184.       clear:both;
  185.  
  186.       background:#888;
  187.    }
  188.    #statusdiv {
  189.       float:left;
  190.       width:500px;
  191.    }
  192.    #statusdiv3 {
  193.       margin-left:510px;
  194.    }
  195.    /*----------------------------------*/
  196.    .button {
  197.       background:#f90;
  198.       color:white;
  199.       font: italic bold 1em/20px 'tebuchet MS', Arial, helvetica;
  200.       opacity: .8;
  201.       filter: alpha(opacity=80);
  202.      
  203.       -moz-border-radius: 20px;
  204.       -webkit-border-radius: 20px;
  205.       border-radius:20px;
  206.      
  207.       height:20px;   
  208.       width: 70px;
  209.       padding:10px;
  210.       text-align:center;
  211.       position:relative;
  212.       left:50px;
  213.       top: 20px;
  214.      
  215.       cursor:pointer;    
  216.    }
  217.    
  218.    /*----------------------------------*/
  219.    #winout {
  220.       position:absolute;
  221.       width:0;
  222.       height:0;
  223.       top:0;
  224.       left:0;
  225.       opacity:0;
  226.       filter:alpha(opacity=0);
  227.      
  228.       overflow:scroll;
  229.       background:#666;
  230.       color:#ff6;
  231.       padding:15px;
  232.       border:solid 1px black;
  233.      
  234.      
  235.       display:none;
  236.      
  237.    }
  238.    
  239.    /*----------------------------------*/
  240.    #hiddregs {
  241.       display:none;
  242.    }
  243.    #cont2 {
  244.  
  245.       background:#ffd;
  246.       float:left;
  247.       width:100%;
  248.  
  249.    }
  250.    #cont1 {
  251.  
  252.       background:#ffe;
  253.       position:relative;
  254.       width:68%;
  255.       left:400px;
  256.       float:left;
  257.       padding-top:10px;
  258.       padding-bottom:10px;
  259.    }
  260.    
  261.    /*----------------------------------*/
  262.    #regslist {
  263.       float:left;
  264.       position:relative;
  265.       border:dotted 1px red;
  266.       right:400px;
  267.       width:380px;
  268.  
  269.       padding:10px;
  270.    }
  271.    
  272.    #regslist ul {
  273.       list-style-type:none;
  274.       list-style-position:outside;
  275.       line-height:25px;
  276.       white-space: nowrap;
  277.       text-indent:15px;
  278.       width:70%;
  279.       margin-left:20px;
  280.      
  281.      
  282.    }
  283.    
  284.    #regslist li {
  285.       border-bottom: dotted 1px #eee;
  286.       font-size:medium;
  287.    }
  288.    #regslist li.active {
  289.       background:#800;
  290.       color:white;
  291.       font-weight:bold;
  292.    }
  293.    
  294.    #regslist li:hover {
  295.       cursor:pointer;
  296.    }
  297.    /*----------------------------------*/
  298.    #parseres {    
  299.       position:relative;
  300.       margin-left:15px;
  301.       right:400px;
  302.       padding:10px;
  303.       width:300px;
  304.  
  305.       border:dotted 1px green;
  306.       float:left;
  307.    }
  308.    
  309.    #parseres ul {
  310.       list-style-type:none;
  311.       list-style-position:outside;   
  312.       line-height:20px;
  313.       padding-left:30px;
  314.      
  315.      
  316.    }
  317.    
  318.    #parseres li {
  319.    }
  320.    
  321.    #parseres li.active {
  322.       background:#800;
  323.  
  324.    }
  325.    
  326.    #parseres li.active a {
  327.       color:white;
  328.       font-weight:bold;  
  329.    }
  330.    
  331.    
  332.    #parseres a {
  333.       color:#944;
  334.    }
  335.    /*----------------------------------*/
  336.    #statframe {
  337.       margin-left:350px;
  338.       border:dotted 1px #f90;
  339.       margin-right:5px;
  340.       padding:30px;
  341.       height:350px;
  342.       width:400px;
  343.       position:relative;
  344.      
  345.    }
  346.    
  347.    #statframe iframe {
  348.       position:absolute;
  349.       top:10px;
  350.       left:10px;
  351.       width:95%;
  352.       border:solid 1px black;
  353.       height:350px;
  354.    }
  355.    /*----------------------------------*/
  356.    #conmenid {
  357.       position:absolute;
  358.       width:200px;
  359.       height:50px;
  360.       border:solid 1px black;
  361.       background:#f5f5f5;
  362.       padding:10px;
  363.       display:none;
  364.    }
  365.    #conmenid a {
  366.       color:#b00;
  367.       font-weight:bold;
  368.       text-decoration:none;
  369.    }
  370.    /*----------------------------------*/
  371.    .hidden_block {
  372.       display:none;
  373.    }
  374.    /*----------------------------------*/
  375. </style>
  376.  
  377. <?php if(@$_GET["action"]==1):?>
  378.    <script type="text/javascript">G_Action=1;</script>
  379. <?php else:?>
  380.    <script type="text/javascript">G_Action=2;</script>
  381. <?php endif?>
  382. <!------------------------------------------------------------------------------>
  383. <script type="text/javascript">
  384. //---------------------------------------------------------------------------
  385. //                               Slider Object
  386. //---------------------------------------------------------------------------
  387. (function ($) {
  388.  
  389.   RSlider= function (options) {
  390.  
  391.    var my=this;
  392.    //--------------------------
  393.    this.defaults= {
  394.    
  395.       targetId: 'pics',
  396.       ajax_url: 'req4.php'
  397.    }
  398.  
  399.    //--------------------------------initialization
  400.    this.init = function (options) {
  401.    
  402.       my.options= $.extend(true,{},my.defaults,options);
  403.      
  404.       my.currentFrame=1;
  405.       my.nFrames=0;
  406.  
  407.       //my.frameWidth=600;
  408.       this.targetDiv=$('#'+this.options.targetId);
  409.       this.targetDiv.css({'overflow':'hidden','position':'relative'});    
  410.       my.frameWidth=this.targetDiv.width();
  411.      
  412.       this.Tracer.init();    
  413.       my.wr=this.Tracer.wr;
  414.          
  415.       this.drawblocks();
  416.      
  417.       this.wideBlock=this.targetDiv.find('#wideblock');
  418.       this.drawFrame();
  419.       this.drawFrame();
  420.      
  421.       this.mouseDrag.init();
  422.  
  423.    }
  424.    
  425.    //------------------------------draw main structure
  426.    this.drawblocks = function () {
  427.       var wideBlock = $ ('<div>', {id:"wideblock",
  428.                                    css:{position:'relative'}});
  429.                                    
  430.                                    
  431.       wideBlock.css('width',my.frameWidth+'px');
  432.  
  433.       this.targetDiv.append(wideBlock);
  434.      
  435.      
  436.    }
  437.    
  438.    //------------------------------ajax request
  439.    this.ajax_request=function (param, f3) {
  440.      
  441.       $.ajax ( {
  442.          type: "POST",
  443.          url: this.options.ajax_url,
  444.          data: param} ).done(
  445.             function(html) {f3.targetEl.ajax_result=f3.show(html);});
  446.            
  447.     }
  448.    
  449.    
  450.    //------------------------------append new frame
  451.    this.drawFrame = function () {
  452.    
  453.          
  454.       var frameBlock = $('<div>', {"class":"frameblock",
  455.                                    css:{width:my.frameWidth+'px'}});
  456.      
  457.       var tmpBlock=frameBlock.clone();
  458.       if (my.testB)
  459.          my.testB++;
  460.       else
  461.          my.testB=100;   
  462.          
  463.       tmpBlock.ajax_result=0;
  464.       tmpBlock.waitcount=10;
  465.       tmpBlock.testB=my.testB;
  466.      
  467.       this.load_pics(tmpBlock);
  468.      
  469.       //-------------------------
  470.       setTimeout(function() {
  471.          rrr(tmpBlock);      
  472.          } ,100);    
  473.       //-------------------------        
  474.       function rrr(inblock) {
  475.          inblock.waitcount--;
  476.          my.wr('wait load '+inblock.testB+':'+inblock.waitcount);
  477.          
  478.          if (inblock.waitcount==0) {
  479.             my.wr('timeout '+inblock.testB);
  480.             return;
  481.             }
  482.            
  483.          if (inblock.ajax_result==0)  {
  484.             setTimeout(function() {rrr(inblock);},1000);
  485.             return;
  486.             }
  487.          //alert(inblock.testB+' - '+inblock.ajax_result);     
  488.          if (inblock.ajax_result==4) {
  489.             my.nFrames++;
  490.             my.wideBlock.css('width',my.wideBlock.width()+my.frameWidth+'px');
  491.             my.wideBlock.append(inblock);
  492.            
  493.             my.wr('success '+inblock.testB);
  494.             //alert(my.nFrames);
  495.          } else {
  496.             my.wr('empty '+inblock.testB);
  497.          }
  498.       }
  499.       //-------------------------        
  500.  
  501.    }
  502.    
  503.    //------------------------------load pictures
  504.    this.load_pics = function (el) {
  505.    
  506.       var zShow_pics = new this.show_pics(el);
  507.       my.wr('load page '+el.testB);
  508.  
  509.      
  510.       this.ajax_request({req:"showparsed"},zShow_pics);
  511.    }
  512.    
  513.    //------------------------------show pictires FTG object
  514.    this.show_pics = function (el) {
  515.    
  516.       this.targetEl = el;
  517.       //---------------------------
  518.       this.show = function (html) {
  519.          if  (html=='[]')
  520.             return 3;
  521.          
  522.          var json_resp=eval("("+html+")");
  523.          var picdiv = $('<div>', {'class':'picsin'});
  524.          
  525.          var img= $('<img>',{});
  526.              
  527.          for (var i=0; i<json_resp.length; i++) {        
  528.             var npd=picdiv.clone();
  529.             var nimg=img.clone();
  530.             //nimg.attr('height',200);
  531.             nimg.attr('src',json_resp[i]["small"]);    
  532.             nimg.data('lgpath',json_resp[i]["big"]);
  533.            
  534.             var imBig = new Image();
  535.             imBig.ss=nimg.data('lgpath');
  536.             imBig.onload=function() {
  537.                my.wr('loaded image: '+this.ss);
  538.             }
  539.             imBig.src=imBig.ss;
  540.             nimg.get(0).imBig=imBig;
  541.             //nimg.click(big_pic);       
  542.          //---------------------------
  543.          npd.append(nimg);       
  544.          $(this.targetEl).append(npd);       
  545.          }
  546.          return 4;
  547.      }
  548.      //---------------------------
  549.    }
  550.    
  551.    //------------------------------move slider
  552.    this.slide_to= function(direction) {
  553.      
  554.       if (((direction=='left') && (my.currentFrame==1)) ||
  555.          ((direction=='right') && (my.currentFrame==my.nFrames))) {
  556.             my.animating=false;
  557.             return;
  558.          }
  559.      
  560.       switch (direction) {
  561.          case 'left': my.currentFrame--;break;
  562.          case 'right':my.currentFrame++;break;
  563.       }
  564.       var c_left=-(my.currentFrame-1)*my.frameWidth;
  565.      
  566.       my.wr('slide: frame='+my.currentFrame);
  567.  
  568.       $.when(my.wideBlock.animate({left: c_left},"slow")).done(function(){my.animating=false});
  569.      
  570.       if (my.currentFrame==my.nFrames) {
  571.          my.drawFrame();
  572.          }
  573.    }
  574.    
  575.    
  576.    //------------------------------mouse dragging
  577.    this.mouseDrag = {
  578.       init: function () {
  579.          my.targetDiv.bind('mousedown',this.mouseDown);
  580.       },
  581.       //----------------------------------
  582.       getRect: function () {
  583.      
  584.          var z=my.targetDiv;
  585.          return {left: z.position().left,
  586.                  top: z.position().top,
  587.                  right: z.position().left+z.width(),
  588.                  bottom: z.position().top+z.height()
  589.          }
  590.  
  591.       },
  592.       //----------------------------------
  593.       mouseDown: function (e) {
  594.      
  595.          e = e || event;
  596.  
  597.          my.tRect=my.mouseDrag.getRect();
  598.          my.diffX=0;
  599.          my.moved=false;
  600.          my.inside=true;
  601.          my.prevX=e.clientX;
  602.          
  603.          
  604.         $(document).bind('mouseup',my.mouseDrag.mouseUp);
  605.         $(document).bind('mousemove',my.mouseDrag.mouseMove);
  606.          
  607.          return false;
  608.  
  609.       },
  610.       //----------------------------------
  611.       mouseMove: function(e) {
  612.      
  613.          e = e || event;
  614.          
  615.          if (!my.animating) {
  616.            
  617.             my.diffX+=e.clientX-my.prevX;
  618.          
  619.             if (Math.abs(my.diffX)>30) {
  620.          
  621.                   my.moved=true;
  622.                   my.animating=true;
  623.                   var diffX=my.diffX;
  624.                   my.diffX=0;
  625.                   if (diffX<0) {                 
  626.                      my.slide_to('right');
  627.                   } else {
  628.                      my.slide_to('left');
  629.                   }
  630.                  
  631.                }
  632.             }
  633.            
  634.            
  635.          my.prevX=e.clientX;
  636.          
  637.          my.inside=true;
  638.          if ((e.clientX <= my.tRect.left) || (e.clientX >= my.tRect.right) ||
  639.              (e.clientY <= my.tRect.top) || (e.clientY >= my.tRect.bottom)) {
  640.              my.inside=false;
  641.              $(this).mouseup();
  642.              }
  643.         return false;    
  644.          
  645.       },
  646.       //----------------------------------
  647.       mouseUp: function (e) {
  648.      
  649.          e = e || event;
  650.          
  651.          $(document).unbind('mouseup',my.mouseDrag.mouseUp);
  652.          $(document).unbind('mousemove',my.mouseDrag.mouseMove);
  653.          
  654.          if ((my.inside) && (!my.moved)) { 
  655.          
  656.             var target = e.target || e.srcElement;
  657.            
  658.             var bigIm=target.imBig;
  659.             //alert(target.imBig);
  660.            
  661.             var zzblock=$('#bigpicin');
  662.             zzblock.empty();
  663.             zzblock.append(bigIm);
  664.                        
  665.             $('#bigpic').css('display','block');
  666.             $('#bigpic').animate({opacity:1},"slow");  
  667.          }
  668.        
  669.  
  670.       }
  671.      
  672.    }
  673.    //----------------------------------------------Tracer
  674.    this.Tracer = {
  675.       traceBlock: {},
  676.       //----------------------------
  677.       init : function() {
  678.          var traceBlock = $('<div>', {'id':'traceblock'});
  679.                  
  680.        
  681.          my.targetDiv.append(traceBlock);
  682.          this.traceBlock=$('#traceblock');
  683.          this.wr('start');
  684.          
  685.       },
  686.       //----------------------------
  687.       wr :function(instr) {
  688.          ht=my.Tracer.traceBlock.html();
  689.          my.Tracer.traceBlock.html(instr+'<br />'+ht);
  690.       }
  691.    }
  692.    
  693.    //-------------------------------------------------
  694.    this.init(options);}
  695.  
  696. }) (jQuery);
  697.  
  698.  
  699. </script>
  700. <!------------------------------------------------------------------------------>
  701.  
  702. <script type="text/javascript">
  703.  
  704.    var G_Sending=false;
  705.    //var G_Start=1;
  706.    
  707.  
  708.    //------------------------------------------
  709.    function addHandler(object,event,handler,useCapture) {
  710.    
  711.       if (object.addEventListener) {
  712.          object.addEventListener(event,handler, useCapture ? useCapture : false)
  713.       }
  714.       else if (object.attachEvent) {
  715.          object.attachEvent('on'+event,handler);
  716.       }
  717.    }
  718.    //------------------------------------------define context menu position
  719.    function defPosition(event) {
  720.       var x=y=0;
  721.      
  722.       if (document.attachEvent!=null) {
  723.          x = window.event.clientX +
  724.             (document.documentElement.scrollLeft ?
  725.                document.documentElement.scrollLeft : document.body.scrollLeft);
  726.                
  727.          y = window.event.clientY +
  728.             (document.documentElement.scrollTop ?
  729.                document.documentElement.scrollTop : document.body.scrollTop);                      
  730.       }
  731.      
  732.       else if (!document.attachEvent && document.addEventListener) {
  733.          x = event.clientX + window.scrollX;
  734.          y = event.clientY + window.scrollY;
  735.       }
  736.      
  737.       //---ftg
  738.        
  739.       return([x,y]);
  740.    }
  741.    
  742.    //------------------------------------------popup context menu  
  743.    function conmenu(evt,el) {
  744.       evt = evt || window.event;
  745.       evt.cancelBubble=true;
  746.      
  747.      
  748.       var menu=document.getElementById('conmenid');
  749.       menu.innerHTML=
  750.          '<a href="#">выделить элемент</a><br />'+
  751.          '<a href="#">открыть страницу</a><br />';
  752.          
  753.          
  754.       menu.style.left=defPosition(evt)[0]+'px';
  755.       menu.style.top=defPosition(evt)[1]+'px';
  756.       menu.style.display="block"
  757.      
  758.       menu.onclick=function() {
  759.          this.style.display='none';
  760.       }
  761.      
  762.       $(menu).find('a').eq(1).click( function() {
  763.          
  764.          popupwin = open($(el).attr('href'),'speciment','width=1000,height=500,top=50,left=50');
  765.          
  766.       });
  767.       $(menu).find('a:first').click( function() {
  768.          
  769.          $(el).parent().parent().find('li').removeClass('active');
  770.          $(el).parent().addClass('active');
  771.          
  772.          
  773.       });
  774.      
  775.    }
  776.    
  777.    //------------------------------------------
  778.       var Helper= {words:['treuber','zonner','annus','crane','et','us','alarm','between','then','you','found','round',
  779.         'like','any','other','flower','music','on','great','intro','step','trek','listening','of','hot','jar']};
  780.  
  781.         Helper.fillin=function(num,el) {
  782.            var st='';
  783.            for(var i=0;i<num;i++) {
  784.               st+=this.words[Math.floor(Math.random()*25)]+' ';          
  785.            }
  786.            el.innerHTML=st;
  787.         }
  788.  
  789.    //------------------------------------------
  790.    function createHTTP() {
  791.       var r;
  792.       try {
  793.          r = new XMLHttpRequest();
  794.       } catch(e) {
  795.          try {
  796.             r = new ActiveXObject('Msxml2.XMLHTTP');
  797.          } catch (e) {
  798.             r = new ActiveXObject('Microsoft.XMLHTTP');
  799.          }
  800.       }
  801.       return r;
  802.    }
  803.    //------------------------------------------
  804.    function ajax_request(param, f3) {
  805.    
  806.       XHR = createHTTP();
  807.       XHR.stat=0;
  808.       XHR.resp='';
  809.       XHR.f3=f3;
  810.      
  811.       XHR.onreadystatechange=function() {
  812.          if (this.readyState==4) {
  813.             this.resp=this.responseText;
  814.             this.stat=this.readyState;
  815.            
  816.             this.f3(this.resp);
  817.             G_Sending=false;
  818.            
  819.          }
  820.          else if (this.readyState==3) {
  821.             this.stat=this.readyState;
  822.          }               
  823.       }
  824.      
  825.       XHR.open('POST','req4.php',true);
  826.       XHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  827.       XHR.send(param);           
  828.    }
  829.    //------------------------------------------
  830.    function send_form(f) {
  831.       var params= 'picaddr='+encodeURIComponent(f.picaddr.value)+'&req=postform';
  832.      
  833.       G_Sending=true;
  834.       f.subm.disabled=true;
  835.       ajax_request(params, function (x) {$('#statusdiv').text(x);});
  836.      
  837.       setTimeout('wait_rez();',100);
  838.      
  839.    }
  840.    //------------------------------------------
  841.    function wait_rez() {
  842.       if (G_Sending)
  843.          setTimeout('wait_rez();',500)
  844.       else {
  845.          document.forms["goo"].subm.disabled=false;
  846.          $('#addpic').fadeOut("slow");
  847.          load_pics();
  848.       }
  849.          
  850.    }  
  851.    //------------------------------------------
  852.    function big_pic() {
  853.    
  854.        var lgpath=$(this).data('lgpath');
  855.        var zimg=$('#bigpic img');
  856.        
  857.        zimg.attr('src',lgpath);
  858.        
  859.        //$('#bigpic').css('height',(screen.height-400)+'px');
  860.        //$('#bigpic').css('width',(screen.width-400)+'px');
  861.        setTimeout(  function() {
  862.        $('#bigpic').css('display','block');
  863.        $('#bigpic').animate({opacity:1},"slow");},300);  
  864.        
  865.    }
  866.    //------------------------------------------
  867.    function fade(el) {
  868.       $.when($(el).animate({opacity:0},"slow")).done(
  869.          function() {
  870.             $(el).css('display','none');
  871.          }
  872.       )
  873.    }
  874.    //------------------------------------------Show Pictures
  875.    function show_pics(resp) {
  876.       if  (resp=='')
  877.          return;
  878.          
  879.       var json_resp=eval("("+resp+")");
  880.       var picdiv = $('<div>', {'class':'picsin'});
  881.       var img= $('<img>',{});
  882.      
  883.      
  884.      
  885.       for (var i=0; i<json_resp.length; i++) {
  886.          //alert(json_resp[i]["big"]);
  887.          var npd=picdiv.clone();
  888.          var nimg=img.clone();
  889.          
  890.          //var img8= new Image();
  891.          //img8.src=json_resp[i]["small"];
  892.              
  893.          //---------------------------
  894.          //var dv=Math.sqrt(img8.width*img8.height/50000);
  895.         // if (dv!=0)
  896.         //    nimg.attr('height',Math.floor(img8.height/dv));
  897.         // else
  898.             nimg.attr('height',200);
  899.            
  900.          nimg.attr('src',json_resp[i]["small"]);
  901.        
  902.          nimg.data('lgpath',json_resp[i]["big"]);
  903.          nimg.click(big_pic);
  904.          
  905.          
  906.          //---------------------------
  907.          npd.append(nimg);
  908.          
  909.          $('#pics').append(npd);
  910.          
  911.          }
  912.    }
  913.    //------------------------------------------LoadPictures
  914.    function load_pics() {
  915.    
  916.       //alert('req=showpics&start='+G_Start);
  917.      
  918.       ajax_request('req=showpics',show_pics);
  919.       //G_Start+=10;
  920.    }
  921.    //-------------------------------------------RegExps
  922.    function show_regs() {
  923.       var el=$('#hiddregs>div').remove();
  924.       el.appendTo('#info88');
  925.      
  926.        // Перемещаем параграф из #myDiv1 в #myDiv2
  927.        //$('#myDiv2').append( $('#myDiv1>p') );
  928.      
  929.        //-------------------------------------list of RegExps    
  930.        
  931.        ajax_request('req=showreg', function (resp) {
  932.           //alert(resp);
  933.           if (resp=='') {
  934.              $('#regslist').html('empty');
  935.              return;
  936.           }
  937.           var json_resp=eval('('+resp+')');
  938.          
  939.           var inhtml='<ul>';
  940.           for (var i=0;i<json_resp.length;i++) {
  941.              inhtml+='<li>'+json_resp[i]["reg_name"]+'</li>';
  942.           }
  943.           inhtml+='</ul>';
  944.           $('#regslist').html(inhtml);
  945.          
  946.           $('#regslist li').click(function() {
  947.              //alert($(this).html());
  948.              $('#regslist li').removeClass("active");
  949.              $(this).addClass("active");
  950.           })
  951.        })
  952.        
  953.        //----------------------directory of speciments
  954.        
  955.        ajax_request('req=showdir&inpath=../forparse/', function(resp) {
  956.          
  957.           var json_resp=eval("("+resp+")");
  958.           //alert(json_resp.length);
  959.           var inhtml='<ul>';
  960.           for (var i=0;i<json_resp.length;i++) {
  961.              inhtml+='<li><a href="'+json_resp[i]["full"]+'" target="_blank"'+
  962.              ' title="size: '+json_resp[i]["filesize"]+'\r\n'+
  963.                      'access: '+json_resp[i]["fileatime"]+'\r\n'+
  964.                      'modified: '+json_resp[i]["filemtime"]+'">'+
  965.                 json_resp[i]["name"]+'</a></li>';              
  966.           }
  967.           inhtml+='</ul>';
  968.          
  969.           $('#parseres').html(inhtml);
  970.          
  971.           $('#parseres a').on('contextmenu', function(event) {
  972.              conmenu(event,this);
  973.              return false;
  974.           });
  975.        })          
  976.    }
  977.    
  978.    //----------------------------------delete RegExps
  979.    function delRegs() {
  980.       ajax_request('req=delregs',function(resp) {
  981.          $('#statusdiv').text(resp);
  982.          show_regs();
  983.       })
  984.    }
  985.    
  986.    //-------------------------------------------Init
  987.    $(document).ready(function() {
  988.      
  989.       //--------------------------------Buttons
  990.      
  991.       $('#appbutton').click(function() {
  992.          if ($('#addpic').css('display')=='none' ) {
  993.             var x_pos=Math.floor(screen.width/2-$('#addpic').width()/2);
  994.             var y_pos=Math.floor(screen.height/2-$('#addpic').height()/2);
  995.             $('#addpic').fadeIn("slow").animate({left: x_pos, top: y_pos},"slow");
  996.             //$('#addpic').css('display','block');
  997.             }
  998.          else {
  999.             $('#addpic').fadeOut("slow");
  1000.             //$('#addpic').css('display','none');
  1001.          }
  1002.          
  1003.       })
  1004.       //------------------------
  1005.       //$('#fuckthegod').offset().left=200;
  1006.       $('#fuckthegod').css('left',(70+$('#appbutton').offset().left)+'px')
  1007.          .css('top','-'+$('#fuckthegod').height()+'px')
  1008.          .css('background','#ff4000');
  1009.          
  1010.       //------------------------
  1011.       show_xml=function(resp) {
  1012.          var windiv = $('<div>',{id:"winout"});
  1013.          //resp.replace(/</g,'&lt;').replace(/>/g,'&gt;')
  1014.          windiv.text(resp);
  1015.    
  1016.          if (!document.getElementById('winout'))
  1017.             $('body').append(windiv);
  1018.          else
  1019.             windiv=$('#winout');
  1020.          
  1021.          var x_pos=Math.floor(screen.width/2-200);
  1022.          var y_pos=Math.floor(screen.height/2-250);
  1023.          windiv.css('display','block');
  1024.          windiv.click(function() {
  1025.             $.when($(this).animate({opacity:0},"slow")).done(
  1026.                function() {$(this).css('display','none')});
  1027.          });
  1028.          windiv.animate({left:x_pos,top:y_pos,width:400,height:500, opacity:1},"slow");
  1029.          
  1030.          
  1031.       }
  1032.       //------------------------         
  1033.       $('#fuckthegod').click(function() {
  1034.          //ajax_request('req=showpicxml&start=1', show_xml);
  1035.          ajax_request('req=showpics', show_xml);
  1036.       })
  1037.          
  1038.       //--------------------------------------------------
  1039.       //           show pics
  1040.       //--------------------------------------------------
  1041.       if (G_Action==1) {
  1042.      
  1043.          var bp= $('#bigpic');
  1044.          bp.css('height',(screen.height-200)+'px');
  1045.          bp.css('width',(screen.width-250)+'px');
  1046.          bp.css('left','100px');
  1047.          bp.css('top','100px');
  1048.          
  1049.          var rSl = new RSlider({targetId:'pics'});
  1050.         //load_pics();
  1051.         //load_pics();
  1052.         }
  1053.       //--------------------------------------------------
  1054.       //           show info
  1055.       //--------------------------------------------------
  1056.       else {
  1057.              
  1058.          //------------------------------change submit form behavior
  1059.          
  1060.          var fzz=document.forms["goo"];
  1061.          if (!fzz)
  1062.             fzz=documents.forms[0];
  1063.            
  1064.          fzz.onsubmit=null;
  1065.          
  1066.          $('#addpic form[name=goo]').on('submit',{mode:555},
  1067.          function(event)
  1068.             { //alert(this.name);
  1069.               //alert(event.data.mode);
  1070.               var inval=$(this).find('input[name=picaddr]').val();
  1071.              
  1072.               var params='req=postreg&regval='+encodeURIComponent(inval);
  1073.               G_Sending=true;
  1074.               //var inpuu=$(this).find('input[type=submit').get(0);
  1075.               //inpuu.disabled=true;             
  1076.               document.forms["goo"].subm.disabled=true;
  1077.              
  1078.               ajax_request(params, function(x) {$('#statusdiv').text(x);});
  1079.              
  1080.               //---------------------------------
  1081.               wtobj=  {
  1082.               counterr: 0,
  1083.               inval:'xx',
  1084.               fwait: function() {
  1085.                  if (G_Sending) {
  1086.                    
  1087.                     $('#statusdiv').text('waiting...'+this.counterr);
  1088.                     this.counterr++;
  1089.                     setTimeout(function() {wtobj.fwait()},500);
  1090.                     } else {
  1091.                        document.forms["goo"].subm.disabled=false;
  1092.                        $('#addpic').fadeOut("slow");
  1093.                        
  1094.                        var x=frames['statifr'];
  1095.                        x.location.replace('req4.php?reqg=sesssave&arrn=regexps&value='+inval);
  1096.                        show_regs();
  1097.                     }
  1098.                    
  1099.               }}
  1100.               //----------------------------------
  1101.               wtobj.inval=inval;
  1102.               setTimeout(function() {wtobj.fwait()},100);            
  1103.              
  1104.               return false;
  1105.             });
  1106.          
  1107.          
  1108.          $('#addpic form[name=goo] legend').html('Input regular expression here');
  1109.          $('#addpic form[name=goo] label[for=picaddr]').html('RegExp');
  1110.          //--------------------------------------------------
  1111.          
  1112.          var popupmenu=$('<div>',{id:'conmenid'});
  1113.          $('body').append(popupmenu);
  1114.          //--------------------------------------------------
  1115.          show_regs();
  1116.          //--------------------------------------------------
  1117.          $('#statframe').html('<iframe src="req4.php" name="statifr"></iframe>');
  1118.          
  1119.          x=frames["statifr"];
  1120.          x.location.replace('req4.php?reqg=sessstat');
  1121.          
  1122.          $('#statusdiv3').html(document.cookie.replace(/;/g,'<br>'));
  1123.       }
  1124.    });
  1125.    
  1126.    
  1127. </script>
  1128.  
  1129. <body>
  1130.  
  1131.    <!------------------------------------------>
  1132.    <div id="hiddregs">
  1133.       <div id="cont2">
  1134.          <div id="cont1">
  1135.             <div id="regslist"></div>
  1136.             <div id="parseres"></div>          
  1137.            
  1138.             <div id="statframe">               
  1139.             </div>         
  1140.  
  1141.  
  1142.          </div>
  1143.       </div>   
  1144.    </div>
  1145.  
  1146.    <!------------------------------------------>
  1147.    <div id="addpic">
  1148.       <form name="goo" onsubmit="send_form(this);return false;" method="post" enctype="application/x-www-form-urlencoded">
  1149.          <fieldset>
  1150.             <legend>Input picture address here</legend>
  1151.             <p><label for="picaddr">Picture address </label><input type="text" name="picaddr" size="40" /></p>
  1152.             <p class="submit"><input type="submit"  name="subm" value="Сохранить" /></p>
  1153.            
  1154.          </fieldset>
  1155.       </form>
  1156.    </div>
  1157.    <!----------------------------------------->
  1158.    <div id="bigpic" onclick="fade(this);">
  1159.       <div id="bigpicin">
  1160.          
  1161.        </div>
  1162.    </div>
  1163.    <div id="allcontent">
  1164.       <div id="header">
  1165.          <div class="button" id="appbutton">добавить</div>
  1166.          <div class="button" id="fuckthegod">xml</div>
  1167.          
  1168.          <div id="headerlinks">
  1169.             <a href="#" onclick="
  1170.             if ($(this).parent().height()==14)
  1171.                $(this).parent().animate({height:200},'slow');
  1172.             else
  1173.                $(this).parent().animate({height:14},'slow');                           
  1174.             return false;"         
  1175.             style="margin-bottom:15px;font-weight:bold;">          
  1176.             Extra</a>
  1177.            
  1178.             <a href="req4.php?reqg=testplain" target="_blank">test plain</a>
  1179.             <a href="#"
  1180.                onclick="frames['statifr'].location.replace
  1181.                ('req4.php?reqg=autosubmit');return false;">
  1182.                auto submit</a>
  1183.            
  1184.             <a href="#"
  1185.                onclick="frames['statifr'].location.replace('req4.php?reqg=sessclear');return false;">
  1186.                clear session
  1187.                </a>
  1188.             <a href="#" onclick="delRegs();return false;">Delete RegExps</a>
  1189.            
  1190.             <a href="#"
  1191.                onclick="frames['statifr'].location.replace('req4.php?reqg=encodes');return false;">
  1192.                encoding examples
  1193.             </a>
  1194.            
  1195.             <a href="#"
  1196.                onclick="frames['statifr'].location.replace('req4.php?reqg=showlog');return false;">
  1197.                show logfile
  1198.             </a>
  1199.            
  1200.             <a href="#"
  1201.                onclick="frames['statifr'].location.replace('req4.php?reqg=checkstr');return false;">
  1202.                check string
  1203.             </a>
  1204.           </div>
  1205.       </div>
  1206.      
  1207.       <div id="pics">    
  1208.       </div>
  1209.      
  1210.       <div id="info88">
  1211.       </div>
  1212.      
  1213.       <div id="footer">
  1214.          <div id="statusdiv"></div>
  1215.          <div id="statusdiv3"></div>
  1216.          <div class="hidden_block">
  1217.          <?php
  1218.              //------------------------total renew cache
  1219.              $dir=opendir('small');
  1220.    
  1221.              while ($name=readdir($dir)) {
  1222.                 if (($name!='.') && ($name!='..')) {
  1223.      
  1224.                    if (is_file('small/'.$name)) {
  1225.                       echo '<img src="small/'.$name.'" />';
  1226.                    }
  1227.                 }
  1228.              }
  1229.        closedir($dir);
  1230.          ?>
  1231.          </div>
  1232.       </div>
  1233.    
  1234.    </div>
  1235.  
  1236. </body>
  1237. </html>
Add Comment
Please, Sign In to add comment