Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-----------------------------------------------------
- var Helper= {words:['treuber','zonner','annus','crane','et','us','alarm','between','then','you','found','round',
- 'like','any','other','flower','music','on','great','intro','step','trek','listening','of','hot','jar']};
- Helper.fillin=function(num,el) {
- var st='';
- for(var i=0;i<num;i++) {
- st+=this.words[Math.floor(Math.random()*25)]+' ';
- }
- el.innerHTML=st;
- }
- //-----------------------------------------------------
- function mkTabs(el) {
- el.get(0).id="content8";
- var ftgDiv= $('<div>', {});
- var ftgH2= $('<h2>',{});
- var ftgP= $('<p>',{});
- var ftgTabs= $('<ul>',{id:"tabs"});
- el.parent().prepend(ftgTabs);
- var ftgA=$('<a>',{href:'#'});
- var ftgLI=$('<li>',{});
- for (var i=0;i<4;i++) {
- var tmpDiv=ftgDiv.clone();
- tmpDiv.attr('id','tab'+(i+1));
- var tmpH2=ftgH2.clone();
- Helper.fillin(20,tmpH2.get(0));
- var tmpP=ftgP.clone();
- Helper.fillin(200,tmpP.get(0));
- tmpDiv.append(tmpH2).append(tmpP);
- el.append(tmpDiv);
- ftgTabs.append(ftgLI.clone().append(ftgA.clone().attr('name','#tab'+(i+1)).html('block '+(i+1))));
- //Helper.fillin(20,tmpDiv.add('h2').get(0));
- //Helper.fillin(200,tmpDiv.add('p').get(0));
- }
- }
- //-----------------------------------------------------
- function resetTabs() {
- $('#content8 div').hide();
- $('#tabs a').attr("id","");
- }
- //-----------------------------------------------------
- $(document).ready(function() {
- for (var i=1; i<4; i++) {
- $('#col'+i).html('<div class="inside"></div>');
- }
- Helper.fillin(170,$('#col1 .inside').get(0));
- //Helper.fillin(370,$('#col2 .inside').get(0));
- Helper.fillin(170,$('#col3 .inside').get(0));
- mkTabs($('#col2 .inside'));
- //----------------------------
- var myUrl=window.location.href;
- var myUrlTab=myUrl.substring(myUrl.indexOf('#'));
- var myUrlTabName=myUrlTab.substring(0,4);
- $("#content8 div").hide();
- $("#tabs li:first a").attr("id","current");
- $("#content8 div:first").fadeIn();
- //--------------------------
- $("#tabs a").on("click", function(e) {
- e.preventDefault();
- if ($(this).attr("id")=="current") {
- return;
- } else {
- resetTabs();
- $(this).attr("id","current");
- $($(this).attr('name')).fadeIn();
- }
- });
- //--------------------------
- for (i=1;i<=$('#tabs li').length;i++) {
- if (myUrlTab==myUrlTab+i) {
- resetTabs();
- $("a[name='"+myUrlTab+"']").attr("id","current");
- $(myUrlTab).fadeIn();
- }
- }
- });
- ----------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------
- //-------------------------------------------
- var vy=0, cnt=100, z_int, isint=false;
- gl_loading=false;
- gl_pages=[
- {p1:'mabout', p2:'mbabout', t:''},
- {p1:'', p2:'mbservices', t:'arenda'},
- {p1:'mservices', p2:'', t:'gallery/65/'},
- {p1:'mdances', p2:'mbdirections', t:'rotations/'},
- {p1:'mschedule', p2:'', t:'prices/'},
- {p1:'mteachers', p2:'mbteachers', t:'teachers/'},
- {p1:'mmaterials', p2:'mbmaterials', t:'gallerynew/'},
- {p1:'mevents', p2:'mbpromo', t:'news/'},
- {p1:'mcontacts', p2:'mbcontacts', t:'contacts/'}
- ];
- //---------------------------------------------
- //---------------------------------------------
- function ajax_request(param, f3) {
- if (gl_loading)
- return;
- gl_loading=true;
- showLoading(true);
- //----------------------------
- function showLoading(on) {
- if (on) {
- $('#ajax_wait').css('width',screen.width+'px');
- $('#ajax_wait').css('height',screen.height+'px');
- $('#ajax_wait').css('display','block');
- }
- else {
- $('#ajax_wait').css('display','none');
- }
- }
- //----------------------------
- function onSuccess(html) {
- f3(html);
- showLoading(false);
- gl_loading=false;
- }
- //----------------------------
- function onAjaxError(xhr,status) {
- showLoading(false);
- gl_loading=false;
- var errinfo = {errcode: status};
- if (xhr.status!=200) {
- errinfo.message=xhr.statusText;
- }
- else {
- errinfo.message='incorrect data';
- }
- onLoadError(errinfo);
- }
- //----------------------------
- function onLoadError(errinfo) {
- var mag = 'error '+errinfo.errcode;
- if (errinfo.message)
- msg+=' :'+errinfo.message;
- alert(msg);
- }
- //----------------------------
- if (location.hostname=='localhost')
- req_url='../learn/picport/req4.php';
- else
- if (location.hostname.indexOf('dmkim1.bget.ru')!=-1)
- req_url='/learn/picport/req4.php';
- else
- if (location.hostname.indexOf('ubezhishche.ru')!=-1)
- req_url='reqajax.php';
- else
- req_url='../phpnew/picport/req4.php';
- $.ajax( {
- type: 'GET',
- url: req_url,
- data: param,
- success: onSuccess,
- error: onAjaxError,
- cache: false
- });
- }
- //---------------------------------------------
- function frame() {
- //cnt++;
- window.scrollBy(0,vy);
- vy*=.9;
- if (Math.abs(vy)<3) {
- vy=0;
- clearInterval(z_int);
- isint=false;
- }
- //$('#scrolltop').html(cnt);
- //alert('test');
- }
- //---------------------------------------------
- $(document).ready(function() {
- //---------------
- $('#scrolltop').click(function() {
- if ($('#menub').css('display')=='block')
- $('#menub').fadeOut('slow');
- else
- $('#menub').fadeIn('slow');
- return false;
- });
- //------------------------------------------
- var sw=$('#bgswitch');
- sw.data('go','light');
- sw.click(function() {
- var cnt4=$('#main_content');
- if ($(this).data('go')=='light') {
- cnt4.css('background-image', 'url(images/bg_light.jpg)');
- $('#fixed_header_bg').css('background-image', 'url(images/bg_light.jpg)');
- $(this).data('go','dark');
- } else {
- cnt4.css('background-image','url(images/bg.jpg)');
- $('#fixed_header_bg').css('background-image', 'url(images/bg.jpg)');
- $(this).data('go','light');
- };
- $('#bgswtext').html($(this).data('go'));
- });
- //$('#content4').on('mousewheel', slick);
- //if ($.browser.msie)
- // return false;
- //------------------------------------------
- for (var i=0; i<gl_pages.length; i++) {
- //--------------------------
- if (gl_pages[i].p1!='') {
- $('#'+gl_pages[i].p1).click({a:gl_pages[i].t},
- function(evObj) {req_page(evObj.data.a)});
- }
- //--------------------------
- if (gl_pages[i].p2!='') {
- $('#'+gl_pages[i].p2).click({a:gl_pages[i].t},
- function(evObj) {req_page(evObj.data.a)})
- }
- }
- //--------------------------------------
- function req_page(inPage) {
- ajax_request('reqg=getzsite&pgn='+encodeURIComponent(inPage),
- show_page);
- }
- //--------------------------------------
- function show_page(html) {
- $('#ajax_container').html(html);
- $('.ajaxlink').click(
- function() {
- req_page($(this).attr('rel'));
- })
- }
- //------------------------------------------
- if (document.addEventListener) {
- document.addEventListener('mousewheel',slick, false);
- }
- else if (document.attachEvent) {
- document.attachEvent('onmousewheel',slick);
- }
- //---------------------------
- function slick(event) {
- if (!event)
- event=window.event;
- vy+= event.wheelDelta>0 ? -20 : 20;
- if (!isint) {
- isint=true;
- z_int=setInterval("frame()",10);
- }
- sdoo(event);
- return false;
- }
- //---------------------------
- function sdoo(e) {
- if (e.preventDefault) {
- e.preventDefault()
- }
- else {
- e.returnValue=false;
- }
- return false;
- }
- //-----------------------------
- $('#'+gl_pages[0].p1).click();
- });
- ----------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------
- var gl_scroll=0;
- var scrTop=0;
- var prevX, prevY;
- var gl_moved;
- //--------------------------------------toggle lightbox
- function showlb(on) {
- if (on) {
- $('#lbox').css('width',screen.width+'px');
- $('#lbox').css('height',screen.height+'px');
- $('#lbox').fadeIn('slow');
- }
- else {
- $('#lbox').fadeOut('slow');
- }
- }
- //--------------------------------scroll event handler
- function scrollEv() {
- scrolled = window.pageYOffset || document.documentElement.scrollTop;
- if (scrolled<scrTop) {
- scrTop=scrolled;
- return;
- }
- scrTop=scrolled;
- if (gl_scroll!=0) {
- return;
- }
- load_pics();
- }
- //------------------------------load pictures
- function load_pics() {
- var pageHeight = document.documentElement.clientHeight;
- var scrolled = window.pageYOffset || document.documentElement.scrollTop;
- var contentHeight = $('#allpics').height()+$('#allpics').position().top;
- if ((pageHeight+scrolled)>(contentHeight-1000)) {
- //alert('go');
- if ($('#allpics .img_div').length>200) {
- $('#allpics .img_div').slice(0,32).remove();
- }
- gl_scroll=1;
- //----------------------------------------------------------------
- $.ajax ( {
- type: 'POST',
- url: '/examples/phpnew/picport/showpics.php',
- dataType: 'json',
- data: {step:''}
- }
- //-----------------------------------
- ).done(
- function(infj) {
- //--------------------------------
- $.each(infj, function(i,valu) {
- var zDiv=$('<div>',{'class':'img_div'});
- var zImg=$('<img>',{'src':valu['small'],'rel':valu['big']});
- //--------------------------------
- /*zImg.load(function() {
- var imgf= new Image();
- imgf.src=$(this).attr('rel');
- });*/
- //--------------------------------
- zImg.click(function() {
- var imgz= new Image();
- imgz.src=$(this).attr('rel');
- save_result(
- $(this).attr('rel')+'|ABC|'+
- $(this).attr('src'));
- $(imgz).load (function() {
- $('#inpic img').attr('src',this.src);
- $('#inpic').css('left',
- Math.floor(screen.width/2-this.width/2)+'px');
- $('#inpic').css('top',
- Math.floor(screen.height/2-this.height/2)+'px');
- showlb(true);
- });
- }
- )
- //--------------------------------
- zDiv.append(zImg);
- $('#allpics').find('#zclose').before(zDiv);
- });
- gl_scroll=0;
- });
- }
- }
- //----------------------------------------------------------
- function save_result(inpic) {
- $.ajax ( {
- type: 'POST',
- url: '/examples/phpnew/picport/showpics.php',
- data: {step:'', favpic:inpic}
- }).done(
- function(html) {
- //alert(html);
- });
- }
- //----------------------------------------------------------
- function mouseDown(e) {
- e= e || event;
- prevX=e.clientX;
- prevY=e.clientY;
- $('#inpic').bind('mousemove',mouseMove);
- $('#inpic').bind('mouseup',mouseUp);
- gl_moved=false;
- return false;
- }
- //----------------------------------
- function mouseMove(e) {
- e = e || event;
- var diffX = e.clientX-prevX;
- var diffY = e.clientY-prevY;
- prevX=e.clientX;
- prevY=e.clientY;
- $(this).css('left', (this.offsetLeft+diffX)+'px');
- $(this).css('top', (this.offsetTop+diffY)+'px');
- gl_moved=true;
- }
- //----------------------------------
- function mouseUp(e) {
- $(this).unbind('mouseup',mouseUp);
- $(this).unbind('mousemove',mouseMove);
- if (!gl_moved) {
- showlb(false);
- }
- //e = e || event;
- //e.stopPropagation();
- }
- //----------------------------------------------------------
- $(document).ready(
- function() {
- //-----------------------------------------------------
- $(window).scroll(scrollEv);
- $(window).on('resize',scrollEv);
- //-----------------------------------------------------
- $('#lbox').click( function() {
- showlb(false);
- });
- //------------------------
- $('#inpic').click( function(event) {
- event = event || window.event;
- if (event.stopPropagation) {
- event.stopPropagation();
- } else {
- event.cancelBubble=true;
- };
- })
- $('#inpic').bind('mousedown',mouseDown);
- //-----------------------------
- scrollEv();
- //setTimeout(scrollEv,2000);
- //setTimeout(scrollEv,4000);
- }
- )
- ----------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- // Slider Object
- //---------------------------------------------------------------------------
- (function ($) {
- RSlider= function (options) {
- var my=this;
- //--------------------------
- this.defaults= {
- targetId: 'pics',
- ajax_url: 'req4.php'
- }
- //--------------------------------initialization
- this.init = function (options) {
- my.options= $.extend(true,{},my.defaults,options);
- my.currentFrame=1;
- my.nFrames=0;
- //my.frameWidth=600;
- this.targetDiv=$('#'+this.options.targetId);
- this.targetDiv.css({'overflow':'hidden','position':'relative'});
- my.frameWidth=this.targetDiv.width();
- this.Tracer.init();
- my.wr=this.Tracer.wr;
- this.drawblocks();
- this.wideBlock=this.targetDiv.find('#wideblock');
- this.drawFrame();
- this.drawFrame();
- this.mouseDrag.init();
- }
- //------------------------------draw main structure
- this.drawblocks = function () {
- var wideBlock = $ ('<div>', {id:"wideblock",
- css:{position:'relative'}});
- wideBlock.css('width',my.frameWidth+'px');
- this.targetDiv.append(wideBlock);
- }
- //------------------------------ajax request
- this.ajax_request=function (param, f3) {
- $.ajax ( {
- type: "POST",
- url: this.options.ajax_url,
- data: param} ).done(
- function(html) {f3.targetEl.ajax_result=f3.show(html);});
- }
- //------------------------------append new frame
- this.drawFrame = function () {
- var frameBlock = $('<div>', {"class":"frameblock",
- css:{width:my.frameWidth+'px'}});
- var tmpBlock=frameBlock.clone();
- if (my.testB)
- my.testB++;
- else
- my.testB=100;
- tmpBlock.ajax_result=0;
- tmpBlock.waitcount=10;
- tmpBlock.testB=my.testB;
- this.load_pics(tmpBlock);
- //-------------------------
- setTimeout(function() {
- rrr(tmpBlock);
- } ,100);
- //-------------------------
- function rrr(inblock) {
- inblock.waitcount--;
- my.wr('wait load '+inblock.testB+':'+inblock.waitcount);
- if (inblock.waitcount==0) {
- my.wr('timeout '+inblock.testB);
- return;
- }
- if (inblock.ajax_result==0) {
- setTimeout(function() {rrr(inblock);},1000);
- return;
- }
- //alert(inblock.testB+' - '+inblock.ajax_result);
- if (inblock.ajax_result==4) {
- my.nFrames++;
- my.wideBlock.css('width',my.wideBlock.width()+my.frameWidth+'px');
- my.wideBlock.append(inblock);
- my.wr('success '+inblock.testB);
- //alert(my.nFrames);
- } else {
- my.wr('empty '+inblock.testB);
- }
- }
- //-------------------------
- }
- //------------------------------load pictures
- this.load_pics = function (el) {
- var zShow_pics = new this.show_pics(el);
- my.wr('load page '+el.testB);
- this.ajax_request({req:"showparsed"},zShow_pics);
- }
- //------------------------------show pictires FTG object
- this.show_pics = function (el) {
- this.targetEl = el;
- //---------------------------
- this.show = function (html) {
- if (html=='[]')
- return 3;
- var json_resp=eval("("+html+")");
- var picdiv = $('<div>', {'class':'picsin'});
- var img= $('<img>',{});
- for (var i=0; i<json_resp.length; i++) {
- var npd=picdiv.clone();
- var nimg=img.clone();
- //nimg.attr('height',200);
- nimg.attr('src',json_resp[i]["small"]);
- nimg.data('lgpath',json_resp[i]["big"]);
- var imBig = new Image();
- imBig.ss=nimg.data('lgpath');
- imBig.onload=function() {
- my.wr('loaded image: '+this.ss);
- }
- imBig.src=imBig.ss;
- nimg.get(0).imBig=imBig;
- //nimg.click(big_pic);
- //---------------------------
- npd.append(nimg);
- $(this.targetEl).append(npd);
- }
- return 4;
- }
- //---------------------------
- }
- //------------------------------move slider
- this.slide_to= function(direction) {
- if (((direction=='left') && (my.currentFrame==1)) ||
- ((direction=='right') && (my.currentFrame==my.nFrames))) {
- my.animating=false;
- return;
- }
- switch (direction) {
- case 'left': my.currentFrame--;break;
- case 'right':my.currentFrame++;break;
- }
- var c_left=-(my.currentFrame-1)*my.frameWidth;
- my.wr('slide: frame='+my.currentFrame);
- $.when(my.wideBlock.animate({left: c_left},"slow")).done(function(){my.animating=false});
- if (my.currentFrame==my.nFrames) {
- my.drawFrame();
- }
- }
- //------------------------------mouse dragging
- this.mouseDrag = {
- init: function () {
- my.targetDiv.bind('mousedown',this.mouseDown);
- },
- //----------------------------------
- getRect: function () {
- var z=my.targetDiv;
- return {left: z.position().left,
- top: z.position().top,
- right: z.position().left+z.width(),
- bottom: z.position().top+z.height()
- }
- },
- //----------------------------------
- mouseDown: function (e) {
- e = e || event;
- my.tRect=my.mouseDrag.getRect();
- my.diffX=0;
- my.moved=false;
- my.inside=true;
- my.prevX=e.clientX;
- $(document).bind('mouseup',my.mouseDrag.mouseUp);
- $(document).bind('mousemove',my.mouseDrag.mouseMove);
- return false;
- },
- //----------------------------------
- mouseMove: function(e) {
- e = e || event;
- if (!my.animating) {
- my.diffX+=e.clientX-my.prevX;
- if (Math.abs(my.diffX)>30) {
- my.moved=true;
- my.animating=true;
- var diffX=my.diffX;
- my.diffX=0;
- if (diffX<0) {
- my.slide_to('right');
- } else {
- my.slide_to('left');
- }
- }
- }
- my.prevX=e.clientX;
- my.inside=true;
- if ((e.clientX <= my.tRect.left) || (e.clientX >= my.tRect.right) ||
- (e.clientY <= my.tRect.top) || (e.clientY >= my.tRect.bottom)) {
- my.inside=false;
- $(this).mouseup();
- }
- return false;
- },
- //----------------------------------
- mouseUp: function (e) {
- e = e || event;
- $(document).unbind('mouseup',my.mouseDrag.mouseUp);
- $(document).unbind('mousemove',my.mouseDrag.mouseMove);
- if ((my.inside) && (!my.moved)) {
- var target = e.target || e.srcElement;
- var bigIm=target.imBig;
- //alert(target.imBig);
- var zzblock=$('#bigpicin');
- zzblock.empty();
- zzblock.append(bigIm);
- $('#bigpic').css('display','block');
- $('#bigpic').animate({opacity:1},"slow");
- }
- }
- }
- //----------------------------------------------Tracer
- this.Tracer = {
- traceBlock: {},
- //----------------------------
- init : function() {
- var traceBlock = $('<div>', {'id':'traceblock'});
- my.targetDiv.append(traceBlock);
- this.traceBlock=$('#traceblock');
- this.wr('start');
- },
- //----------------------------
- wr :function(instr) {
- ht=my.Tracer.traceBlock.html();
- my.Tracer.traceBlock.html(instr+'<br />'+ht);
- }
- }
- //-------------------------------------------------
- this.init(options);}
- }) (jQuery);
- ----------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------
- var G_Sending=false;
- //var G_Start=1;
- //------------------------------------------
- function addHandler(object,event,handler,useCapture) {
- if (object.addEventListener) {
- object.addEventListener(event,handler, useCapture ? useCapture : false)
- }
- else if (object.attachEvent) {
- object.attachEvent('on'+event,handler);
- }
- }
- //------------------------------------------define context menu position
- function defPosition(event) {
- var x=y=0;
- if (document.attachEvent!=null) {
- x = window.event.clientX +
- (document.documentElement.scrollLeft ?
- document.documentElement.scrollLeft : document.body.scrollLeft);
- y = window.event.clientY +
- (document.documentElement.scrollTop ?
- document.documentElement.scrollTop : document.body.scrollTop);
- }
- else if (!document.attachEvent && document.addEventListener) {
- x = event.clientX + window.scrollX;
- y = event.clientY + window.scrollY;
- }
- //---ftg
- return([x,y]);
- }
- //------------------------------------------popup context menu
- function conmenu(evt,el) {
- evt = evt || window.event;
- evt.cancelBubble=true;
- var menu=document.getElementById('conmenid');
- menu.innerHTML=
- '<a href="#">выделить элемент</a><br />'+
- '<a href="#">открыть страницу</a><br />';
- menu.style.left=defPosition(evt)[0]+'px';
- menu.style.top=defPosition(evt)[1]+'px';
- menu.style.display="block"
- menu.onclick=function() {
- this.style.display='none';
- }
- $(menu).find('a').eq(1).click( function() {
- popupwin = open($(el).attr('href'),'speciment','width=1000,height=500,top=50,left=50');
- });
- $(menu).find('a:first').click( function() {
- $(el).parent().parent().find('li').removeClass('active');
- $(el).parent().addClass('active');
- });
- }
- //------------------------------------------
- var Helper= {words:['treuber','zonner','annus','crane','et','us','alarm','between','then','you','found','round',
- 'like','any','other','flower','music','on','great','intro','step','trek','listening','of','hot','jar']};
- Helper.fillin=function(num,el) {
- var st='';
- for(var i=0;i<num;i++) {
- st+=this.words[Math.floor(Math.random()*25)]+' ';
- }
- el.innerHTML=st;
- }
- //------------------------------------------
- function createHTTP() {
- var r;
- try {
- r = new XMLHttpRequest();
- } catch(e) {
- try {
- r = new ActiveXObject('Msxml2.XMLHTTP');
- } catch (e) {
- r = new ActiveXObject('Microsoft.XMLHTTP');
- }
- }
- return r;
- }
- //------------------------------------------
- function ajax_request(param, f3) {
- XHR = createHTTP();
- XHR.stat=0;
- XHR.resp='';
- XHR.f3=f3;
- XHR.onreadystatechange=function() {
- if (this.readyState==4) {
- this.resp=this.responseText;
- this.stat=this.readyState;
- this.f3(this.resp);
- G_Sending=false;
- }
- else if (this.readyState==3) {
- this.stat=this.readyState;
- }
- }
- XHR.open('POST','req4.php',true);
- XHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
- XHR.send(param);
- }
- //------------------------------------------
- function send_form(f) {
- var params= 'picaddr='+encodeURIComponent(f.picaddr.value)+'&req=postform';
- G_Sending=true;
- f.subm.disabled=true;
- ajax_request(params, function (x) {$('#statusdiv').text(x);});
- setTimeout('wait_rez();',100);
- }
- //------------------------------------------
- function wait_rez() {
- if (G_Sending)
- setTimeout('wait_rez();',500)
- else {
- document.forms["goo"].subm.disabled=false;
- $('#addpic').fadeOut("slow");
- load_pics();
- }
- }
- //------------------------------------------
- function big_pic() {
- var lgpath=$(this).data('lgpath');
- var zimg=$('#bigpic img');
- zimg.attr('src',lgpath);
- //$('#bigpic').css('height',(screen.height-400)+'px');
- //$('#bigpic').css('width',(screen.width-400)+'px');
- setTimeout( function() {
- $('#bigpic').css('display','block');
- $('#bigpic').animate({opacity:1},"slow");},300);
- }
- //------------------------------------------
- function fade(el) {
- $.when($(el).animate({opacity:0},"slow")).done(
- function() {
- $(el).css('display','none');
- }
- )
- }
- //------------------------------------------Show Pictures
- function show_pics(resp) {
- if (resp=='')
- return;
- var json_resp=eval("("+resp+")");
- var picdiv = $('<div>', {'class':'picsin'});
- var img= $('<img>',{});
- for (var i=0; i<json_resp.length; i++) {
- //alert(json_resp[i]["big"]);
- var npd=picdiv.clone();
- var nimg=img.clone();
- //var img8= new Image();
- //img8.src=json_resp[i]["small"];
- //---------------------------
- //var dv=Math.sqrt(img8.width*img8.height/50000);
- // if (dv!=0)
- // nimg.attr('height',Math.floor(img8.height/dv));
- // else
- nimg.attr('height',200);
- nimg.attr('src',json_resp[i]["small"]);
- nimg.data('lgpath',json_resp[i]["big"]);
- nimg.click(big_pic);
- //---------------------------
- npd.append(nimg);
- $('#pics').append(npd);
- }
- }
- //------------------------------------------LoadPictures
- function load_pics() {
- //alert('req=showpics&start='+G_Start);
- ajax_request('req=showpics',show_pics);
- //G_Start+=10;
- }
- //-------------------------------------------RegExps
- function show_regs() {
- var el=$('#hiddregs>div').remove();
- el.appendTo('#info88');
- // Перемещаем параграф из #myDiv1 в #myDiv2
- //$('#myDiv2').append( $('#myDiv1>p') );
- //-------------------------------------list of RegExps
- ajax_request('req=showreg', function (resp) {
- //alert(resp);
- if (resp=='') {
- $('#regslist').html('empty');
- return;
- }
- var json_resp=eval('('+resp+')');
- var inhtml='<ul>';
- for (var i=0;i<json_resp.length;i++) {
- inhtml+='<li>'+json_resp[i]["reg_name"]+'</li>';
- }
- inhtml+='</ul>';
- $('#regslist').html(inhtml);
- $('#regslist li').click(function() {
- //alert($(this).html());
- $('#regslist li').removeClass("active");
- $(this).addClass("active");
- })
- })
- //----------------------directory of speciments
- ajax_request('req=showdir&inpath=../forparse/', function(resp) {
- var json_resp=eval("("+resp+")");
- //alert(json_resp.length);
- var inhtml='<ul>';
- for (var i=0;i<json_resp.length;i++) {
- inhtml+='<li><a href="'+json_resp[i]["full"]+'" target="_blank"'+
- ' title="size: '+json_resp[i]["filesize"]+'\r\n'+
- 'access: '+json_resp[i]["fileatime"]+'\r\n'+
- 'modified: '+json_resp[i]["filemtime"]+'">'+
- json_resp[i]["name"]+'</a></li>';
- }
- inhtml+='</ul>';
- $('#parseres').html(inhtml);
- $('#parseres a').on('contextmenu', function(event) {
- conmenu(event,this);
- return false;
- });
- })
- }
- //----------------------------------delete RegExps
- function delRegs() {
- ajax_request('req=delregs',function(resp) {
- $('#statusdiv').text(resp);
- show_regs();
- })
- }
- //-------------------------------------------Init
- $(document).ready(function() {
- //--------------------------------Buttons
- $('#appbutton').click(function() {
- if ($('#addpic').css('display')=='none' ) {
- var x_pos=Math.floor(screen.width/2-$('#addpic').width()/2);
- var y_pos=Math.floor(screen.height/2-$('#addpic').height()/2);
- $('#addpic').fadeIn("slow").animate({left: x_pos, top: y_pos},"slow");
- //$('#addpic').css('display','block');
- }
- else {
- $('#addpic').fadeOut("slow");
- //$('#addpic').css('display','none');
- }
- })
- //------------------------
- //$('#fuckthegod').offset().left=200;
- $('#fuckthegod').css('left',(70+$('#appbutton').offset().left)+'px')
- .css('top','-'+$('#fuckthegod').height()+'px')
- .css('background','#ff4000');
- //------------------------
- show_xml=function(resp) {
- var windiv = $('<div>',{id:"winout"});
- //resp.replace(/</g,'<').replace(/>/g,'>')
- windiv.text(resp);
- if (!document.getElementById('winout'))
- $('body').append(windiv);
- else
- windiv=$('#winout');
- var x_pos=Math.floor(screen.width/2-200);
- var y_pos=Math.floor(screen.height/2-250);
- windiv.css('display','block');
- windiv.click(function() {
- $.when($(this).animate({opacity:0},"slow")).done(
- function() {$(this).css('display','none')});
- });
- windiv.animate({left:x_pos,top:y_pos,width:400,height:500, opacity:1},"slow");
- }
- //------------------------
- $('#fuckthegod').click(function() {
- //ajax_request('req=showpicxml&start=1', show_xml);
- ajax_request('req=showpics', show_xml);
- })
- //--------------------------------------------------
- // show pics
- //--------------------------------------------------
- if (G_Action==1) {
- var bp= $('#bigpic');
- bp.css('height',(screen.height-200)+'px');
- bp.css('width',(screen.width-250)+'px');
- bp.css('left','100px');
- bp.css('top','100px');
- var rSl = new RSlider({targetId:'pics'});
- //load_pics();
- //load_pics();
- }
- //--------------------------------------------------
- // show info
- //--------------------------------------------------
- else {
- //------------------------------change submit form behavior
- var fzz=document.forms["goo"];
- if (!fzz)
- fzz=documents.forms[0];
- fzz.onsubmit=null;
- $('#addpic form[name=goo]').on('submit',{mode:555},
- function(event)
- { //alert(this.name);
- //alert(event.data.mode);
- var inval=$(this).find('input[name=picaddr]').val();
- var params='req=postreg®val='+encodeURIComponent(inval);
- G_Sending=true;
- //var inpuu=$(this).find('input[type=submit').get(0);
- //inpuu.disabled=true;
- document.forms["goo"].subm.disabled=true;
- ajax_request(params, function(x) {$('#statusdiv').text(x);});
- //---------------------------------
- wtobj= {
- counterr: 0,
- inval:'xx',
- fwait: function() {
- if (G_Sending) {
- $('#statusdiv').text('waiting...'+this.counterr);
- this.counterr++;
- setTimeout(function() {wtobj.fwait()},500);
- } else {
- document.forms["goo"].subm.disabled=false;
- $('#addpic').fadeOut("slow");
- var x=frames['statifr'];
- x.location.replace('req4.php?reqg=sesssave&arrn=regexps&value='+inval);
- show_regs();
- }
- }}
- //----------------------------------
- wtobj.inval=inval;
- setTimeout(function() {wtobj.fwait()},100);
- return false;
- });
- $('#addpic form[name=goo] legend').html('Input regular expression here');
- $('#addpic form[name=goo] label[for=picaddr]').html('RegExp');
- //--------------------------------------------------
- var popupmenu=$('<div>',{id:'conmenid'});
- $('body').append(popupmenu);
- //--------------------------------------------------
- show_regs();
- //--------------------------------------------------
- $('#statframe').html('<iframe src="req4.php" name="statifr"></iframe>');
- x=frames["statifr"];
- x.location.replace('req4.php?reqg=sessstat');
- $('#statusdiv3').html(document.cookie.replace(/;/g,'<br>'));
- }
- });
- ----------------------------------------------------------------------------------------------
- ----------------------------------------------------------------------------------------------
- var Helper= {
- words:['treuber','zonner','annus','crane','et','us','alarm','between','then','you','found','round',
- 'like','any','other','flower','music','on','great','intro','step','trek','listening','of','hot','jar'],
- //------------------------------------------
- fillin: function(num) {
- var st='';
- for (var i=0;i<num;i++) {
- if (st!='')
- st+=' ';
- st+=this.words[Math.floor(Math.random()*25)];
- }
- return (st);
- },
- //-------------------------------------------
- toggleTabs: function() {
- isact=$(this).hasClass('active');
- //-------------------------close column
- $(this).parent().parent().find('.hiddcontent:visible').slideUp('fast');
- $(this).parent().parent().find('h3').removeClass('active');
- //----------------close horz
- $('.horz').find('.acco').find('.hiddcontent:visible').slideUp('fast');
- $('.horz').find('.acco').find('h3').removeClass('active');
- if (!isact) {
- $(this).parent().find('.hiddcontent').slideDown('fast');
- $(this).addClass('active');
- }
- },
- //-------------------------------------------
- menuClick: function() {
- var i=$(this).data('num');
- $('.panel').fadeOut('slow');
- $('#panel'+i).slideToggle('slow');
- return false;
- }
- }
- //--------------------------------------------create accordion blocks
- function mkacco(elName,num) {
- var el=document.getElementById(elName);
- accoEl=document.createElement('DIV');
- $(accoEl).addClass('acco');
- el.appendChild(accoEl);
- for( var i=0;i<num;i++) {
- var tmpDiv=document.createElement('DIV');
- tmpDiv.id=el.id+'ac'+i;
- var tmp=document.createElement('H3');
- tmp.appendChild(document.createTextNode('Element '+i));
- tmpDiv.appendChild(tmp);
- tmp=document.createElement('P');
- tmp.appendChild(document.createTextNode(Helper.fillin(20)));
- tmpDiv.appendChild(tmp);
- tmp=document.createElement('P');
- $(tmp).addClass('hiddcontent');
- tmp.appendChild(document.createTextNode(Helper.fillin(150)));
- tmpDiv.appendChild(tmp);
- accoEl.appendChild(tmpDiv);
- }
- }
- //------------------------------------------create menu
- function mkmenu(el) {
- for (var i=0; i<5; i++) {
- var tmpP=document.createElement('P');
- $(tmpP).addClass('slide');
- $(tmpP).html('<a href="#" class="btn-slide" id="slide'+i+'">menu item '+i+' </a>');
- el.append(tmpP);
- var pane=document.createElement('DIV');
- $(pane).addClass('panel');
- pane.id='panel'+i;
- var rectM=tmpP.getBoundingClientRect();
- pane.style.left=rectM.left+'px';
- pane.style.top=rectM.bottom+'px';
- $(pane).append(document.createTextNode(Helper.fillin(200)));
- document.body.appendChild(pane);
- $('#slide'+i).data('num',i);
- $('#slide'+i).click(Helper.menuClick);
- }
- }
- //---------------------------------------------pager object
- var pager;
- var Imtech={};
- Imtech.Pager=function() {
- this.paragraphsPerPage=3;
- this.currentPage=1;
- this.pagingControlsContainer='';
- this.pagingContainerPath='';
- this.pagingContainer=null;
- //----------------------------------
- this.numPages=function() {
- var numPages=0;
- if ((this.paragraphs!=null) && (this.paragraphsPerPage!=null)) {
- numPages=Math.ceil(this.paragraphs.length / this.paragraphsPerPage);
- }
- return numPages;
- }
- //----------------------------------
- this.showPage=function(page) {
- this.currentPage=page;
- this.pagingContainer.empty();
- for (var i=(page-1)*this.paragraphsPerPage;
- i<((page)*this.paragraphsPerPage);i++) {
- if (i<this.paragraphs.length) {
- var elem=this.paragraphs.get(i);
- this.pagingContainer.append(elem);
- }
- }
- //$(this.pagingContainerPath).html(html);
- //$('.acco h3').click(Helper.toggleTabs);
- renderControls(this.pagingControlsContainer,this.currentPage,this.numPages());
- }
- //----------------------------------
- var renderControls=function(container,currentPage,numPages) {
- var pagingControls='<div style="float:left;margin-right:20px;">Page:</div> <ul>';
- for (var i=1; i<=numPages;i++) {
- if (i!=currentPage) {
- pagingControls+='<li><a href="#" onclick="pager.showPage('+i+');return false;">'+
- i+'</a></li>';
- }
- else {
- pagingControls+='<li class="current">'+i+'</li>';
- }
- }
- pagingControls+='</ul>';
- $(container).html(pagingControls);
- $('#pagingcontrols li').click(function() {
- $(this).find('a').click();
- return false;
- })
- }
- }
- //--------------------------------------make paging control
- function mkpagingcontrol() {
- pager.paragraphsPerPage=5;
- pager.pagingContainer=$('#pagingcontent');
- pager.pagingContainer.addClass('acco');
- pager.pagingControlsContainer='#pagingcontrols';
- pager.pagingContainerPath='#centerhiddenpart';
- pager.paragraphs=$('div.acco>div',$(pager.pagingContainerPath));
- pager.showPage(1);
- }
- //---------------------------------------
- $(document).ready(function() {
- //-------------------fill central blocks with content
- mkacco('leftpart',5);
- mkacco('rightpart',5);
- mkacco('centerhiddenpart',55);
- mkacco ('header',5);
- tmpDiv=document.createElement('DIV');
- tmpDiv.style['clear']='both';
- $('#header').append(tmpDiv);
- mkacco('footer',5);
- $('#footer').append(tmpDiv.cloneNode(true));
- $('.acco h3').click(Helper.toggleTabs);
- //---------------------create menu
- mkmenu($('#menublock'));
- //----------------------create paging control
- pager= new Imtech.Pager();
- mkpagingcontrol();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement