Advertisement
terorama

Bkms

Dec 13th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 19.41 KB | None | 0 0
  1.  
  2.  
  3.  
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  6.  
  7. <head>
  8. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  9. <title>Bookmarks</title>
  10.    <script type="text/javascript" src="jquery.min.js"></script>
  11.    
  12.    
  13.    <script type="text/javascript">
  14.  
  15.    var gl_moved;
  16.    var gl_moved4;
  17.   //--------------------------------------toggle lightbox
  18.       function showlb(on) {
  19.              if (on) {
  20.                     $('#lbox').css('width',screen.width+'px');
  21.                         $('#lbox').css('height',screen.height+'px');
  22.                        
  23.                         $('#lbox').fadeIn('slow');
  24.                         $('#arrows').css('display','none');
  25.                  }
  26.                  else {
  27.                     $('#lbox').fadeOut('slow');
  28.                     $('#arrows').css('display','block');
  29.                  }
  30.                  
  31.           }
  32.  
  33.    //------------------------------------------
  34.    function mouseDown(e) {
  35.          
  36.              e= e || event;
  37.                  
  38.                  prevX=e.clientX;
  39.                  prevY=e.clientY;
  40.                  
  41.                  $('#inpic').bind('mousemove',mouseMove);
  42.                  $('#inpic').bind('mouseup',mouseUp);
  43.                  
  44.                  gl_moved=false;
  45.                  
  46.                  return false;
  47.           }
  48.           //----------------------------------
  49.           function mouseMove(e) {
  50.              
  51.                  e = e || event;
  52.                  var diffX = e.clientX-prevX;
  53.                  var diffY = e.clientY-prevY;
  54.                  
  55.                  prevX=e.clientX;
  56.                  prevY=e.clientY;
  57.                  
  58.                  $(this).css('left', (this.offsetLeft+diffX)+'px');
  59.                  $(this).css('top', (this.offsetTop+diffY)+'px');
  60.                  
  61.                  gl_moved=true;
  62.           }
  63.           //----------------------------------
  64.           function mouseUp(e) {
  65.              $(this).unbind('mouseup',mouseUp);
  66.                  $(this).unbind('mousemove',mouseMove);
  67.      
  68.                  
  69.                  if (!gl_moved) {
  70.                     showlb(false);
  71.                  }
  72.                  
  73.                  //e = e || event;
  74.                  //e.stopPropagation();
  75.                  
  76.           }
  77.    //-------------------------------------------
  78.    ddrop = function() {
  79.    
  80.       _self = this;
  81.          
  82.       this.hook = function (el) {
  83.              el.onmousedown = this.mouseDown;
  84.              el.onmousemove = this.mouseMove;
  85.              el.onmouseup = this.mouseUp;  
  86.              el.onmouseout = this.mouseOut;            
  87.           }  
  88.           //--------------------------
  89.           this.mouseDown = function(ev) {
  90.          
  91.                  ev = ev || event;
  92.                  var target = this;  
  93.                  target.pressed=true;      
  94.                  gl_moved4 = false;
  95.  
  96.                  //console.log('down_id='+target.id);
  97.  
  98.                  var scrolled = window.pageYOffset || document.documentElement.scrollTop;
  99.  
  100.                  target.yBase=-ev.clientY-scrolled;  
  101.                  target.yStart = ev.clientY;
  102.              
  103.                  target.style.cursor='pointer';
  104.  
  105.                 try {
  106.                     ev.preventDefault()
  107.                  } catch (ex) {
  108.                     ev.returnValue=false;
  109.                  }
  110.  
  111.           }
  112.           //--------------------------
  113.           this.mouseMove = function(ev) {
  114.          
  115.              ev = ev || event;  
  116.              var target =  this;
  117.  
  118.              //console.log('move_id='+target.id);
  119.                  
  120.              if (target.pressed) {
  121.                  window.scrollTo(0, -ev.clientY - target.yBase);
  122.  
  123.                  if (Math.abs(ev.clientY - target.yStart)>8)
  124.                     gl_moved4=true;
  125.  
  126.                  ev.stopPropagation();
  127.                  }
  128.           }
  129.           //--------------------------
  130.           this.mouseUp = function(ev) {  
  131.  
  132.              ev = ev || event;
  133.              var target = this;
  134.  
  135.              //console.log('up_id='+target.id);
  136.  
  137.              target.pressed=false;
  138.  
  139.           }  
  140.  
  141.         //--------------------------
  142.           this.mouseOut = function(ev) {  
  143.  
  144.              ev = ev || event;
  145.              var target = this;
  146.              if (!target.pressed)
  147.                 return;
  148.  
  149.  
  150.              if (!ev.relatedTarget && ev.fromElement)
  151.                     var relatedTarget = (ev.fromElement==ev.target)
  152.                         ? ev.toElement : ev.fromElement;
  153.                  else
  154.                     var relatedTarget = ev.relatedTarget;
  155.              
  156.              if (relatedTarget.id=='ajaxblock')
  157.                    return;
  158.  
  159.                 if ($(relatedTarget).parents('#ajaxblock').length!=0)
  160.                    return;  
  161.  
  162.              target.pressed=false;
  163.  
  164.           }  
  165.       }
  166.  
  167.       //-------------------------------------------
  168.       function slick() {
  169.  
  170.           window.scrollBy(0,vy);
  171.           vy *=ay;
  172.           if (Math.abs(vy)<3) {
  173.              vy=0;
  174.              clearInterval(z_int);
  175.           }
  176.       }
  177.  
  178.    //-------------------------------------------
  179.       $(document).ready(init);
  180.      
  181.        ajax_get='';
  182.        ajax_post='';
  183.  
  184.       //------------------------------------------
  185.       function init() {
  186.  
  187.                $('#toptop a').click (
  188.                   function() {
  189.                      //$('body').animate({'scrollTop':0}, 'slow');
  190.  
  191.                      window.scrollTo(0,0);
  192.                      return false;
  193.                   }
  194.                );
  195.  
  196.                $('#artop a').click(
  197.                  function() {
  198.                     return false;
  199.                  }
  200.                );
  201.                $('#arbottom a').click(
  202.                  function() {
  203.                     return false;
  204.                  }
  205.                );
  206.  
  207.                $('#artop a').mousedown(
  208.                 function() {
  209.                     if (window.z_int)
  210.                        clearInterval(z_int);
  211.  
  212.                     window.vy = -8;
  213.                     window.ay = 1.05;
  214.                     window.z_int = setInterval(function() {slick();}, 10);
  215.                     return false;
  216.                 }
  217.                );
  218.                $('#artop a').mouseup(
  219.                 function() {    
  220.                     window.ay = 0.9;  
  221.                     return false;  
  222.                 }
  223.                );
  224.               $('#artop a').mouseout(
  225.                 function() {    
  226.                     window.ay = 0.9;  
  227.                     return false;  
  228.                 }
  229.                );
  230.  
  231.                $('#arbottom a').mousedown(
  232.                 function() {
  233.                     if (window.z_int)
  234.                        clearInterval(z_int);
  235.  
  236.                     window.vy = 8;
  237.                     window.ay = 1.05;
  238.                     window.z_int = setInterval(function() {slick();}, 10);
  239.                     return false;
  240.                 }
  241.                );
  242.                $('#arbottom a').mouseup(
  243.                 function() {    
  244.                     window.ay = 0.9;
  245.                     return false;    
  246.                 }
  247.                );
  248.               $('#arbottom a').mouseout(
  249.                 function() {    
  250.                     window.ay = 0.9;  
  251.                     return false;  
  252.                 }
  253.                );
  254.              
  255.              
  256.  
  257.                //----------------------------------
  258.                var Ddrop = new ddrop();
  259.  
  260.                Ddrop.hook($('#ajaxblock').get(0));
  261.  
  262.                //----------------------------------
  263.                $('#lbox').click( function() {
  264.                            
  265.                             if (!gl_moved) {
  266.                                showlb(false);
  267.                              }
  268.                         });
  269.  
  270.               $('#inpic').bind('mousedown',mouseDown);
  271.      
  272.          $('.twitfeed img').each(
  273.                  
  274.                   function(index) {
  275.                      $(this).unbind('click').click(function() {    
  276.                                            
  277.                      if (gl_moved4)
  278.                         return;
  279.          
  280.                   var imgz= new Image();
  281.                   imgz.src=$(this).attr('rel');
  282.                   //console.log(imgz.src);
  283.                                                            
  284.                                  
  285.                   $(imgz).load (function() {    
  286.                                                
  287.                          $('#inpic').empty().append($(this));  
  288.                                                
  289.                          $('#inpic').css('left',
  290.                          Math.floor(screen.width/2-this.width/2)+'px');
  291.                      
  292.                          $('#inpic').css('top',
  293.                          Math.floor(screen.height/2-this.height/2)+'px');                                                                                        
  294.                          showlb(true);
  295.                  
  296.            });
  297.                  });
  298.  
  299.               });
  300.  
  301.        
  302.          //-------------------
  303.          $('a[rel^="_"], input:button[rel^="_"]').unbind('click').click ( function(ev) {
  304.            
  305.             var ev = ev || event;
  306.            
  307.        
  308.             //--------------------------------
  309.             if (this.hasAttribute('pg'))
  310.                var page_id = this.getAttribute('pg');
  311.             else
  312.                var page_id = 'z';
  313.                
  314.             //--------------------------------
  315.             if (!ajax_get)
  316.                ajax_get = new Ajax_get();
  317.        
  318.             ajax_get.query($(this).attr('rel').slice(1), page_id);
  319.            
  320.             if (ev.preventDefault)
  321.                ev.preventDefault();
  322.             else
  323.                ev.returnValue = false;
  324.              
  325.          });
  326.          //-------------------
  327.          $('form').filter(
  328.             function(index) {
  329.                return (this.hasAttribute('rel')) && ($(this).attr('rel').substr(0,1)=='_');})
  330.                .unbind('submit')
  331.                .submit( function(ev) {
  332.                  
  333.                   var ev = ev || event;
  334.                  
  335.                   if (!ajax_post)
  336.                      ajax_post = new Ajax_post();
  337.                    
  338.                   var data8 = {};
  339.                   $(this).find('input[name]').each (
  340.                      function(i) {
  341.                         data8[this.name]=this.value;
  342.                      }
  343.                   );
  344.                  
  345.                   $.when (ajax_post.query($(this).attr('rel').slice(1), data8))
  346.                   .done(function(){updateState();});
  347.                    
  348.                   if (ev.preventDefault)
  349.                      ev.preventDefault();
  350.                   else
  351.                      ev.returnValue = false;
  352.                      
  353.                });
  354.                
  355.  
  356.          //----------------------------------
  357.          $('#contentheader').unbind().ajaxStart(
  358.             function() {
  359.                $(this).html('ajax request started...');
  360.             }
  361.          );
  362.          //----------------------------------
  363.          $('#contentheader').unbind().ajaxStop(
  364.             function() {
  365.                $(this).html('ajax request finished');
  366.             }
  367.          );
  368.          //----------------------------------
  369.                  
  370.       };
  371.  
  372.       //------------------------------------------
  373.       Ajax_get = function () {
  374.      
  375.          var _self = this;
  376.          
  377.          //----------------------
  378.          this.onSuccess = function(inf, status, xhr) {
  379.            
  380.             $('#ajaxblock').empty().html(inf);
  381.                         //window.scrollTo(0,10000);
  382.                         //window.scrollTo(0,0);
  383.  
  384.                     /*window.vy = 100;
  385.                     window.ay = 0.99;
  386.                     window.z_int = setInterval(function() {slick();}, 10);*/
  387.  
  388.             init();
  389.          }
  390.      
  391.          //----------------------
  392.          this.onError = function(xhr, status, exception) {
  393.            
  394.             var inf = [];
  395.             inf.push ('ajaxResponse: <pre>'+xhr.responseText+'</pre>');
  396.             inf.push ('status: '+xhr.status);
  397.             inf.push ('ready state: '+xhr.readyState);
  398.             inf.push ('text status: '+status);
  399.             inf.push ('exception: '+exception);
  400.            
  401.             s = inf.join('<br/>');
  402.            
  403.             $('#ajaxblock').empty().html(s);
  404.          }
  405.          
  406.          //----------------------
  407.          this.query = function (action,  page_id) {
  408.          
  409.             var data = {
  410.                   action: action
  411.                };
  412.    
  413.             if (!isNaN(page_id)) {
  414.            
  415.                data['page'] = page_id
  416.             }
  417.              
  418.  
  419.             return $.ajax ( {        
  420.                type: 'GET',
  421.                url: location.protocol + '//' +
  422.                     location.hostname + location.pathname,
  423.                    
  424.                data: data,
  425.                success: _self.onSuccess,
  426.                error: _self.onError
  427.             })
  428.          }
  429.       };
  430.      
  431.       //------------------------------------------
  432.       Ajax_post = function () {
  433.      
  434.          var _self = this;
  435.          
  436.          //----------------------
  437.          this.onSuccess = function (inf, status, xhr) {
  438.          
  439.             $('#ajaxblock').empty().html(inf);
  440.  
  441.                     ajax_get.query('show_bookmarks', 'z');
  442.          }
  443.          
  444.          //----------------------
  445.          this.onError = function (xhr, status, exception) {
  446.          
  447.             var inf = [];
  448.             inf.push ('ajaxResponse: <pre>'+xhr.responseText+'</pre>');
  449.             inf.push ('exception: '+exception);
  450.            
  451.             s = inf.join('<br/>');
  452.            
  453.             $('#ajaxblock').empty().html(s);
  454.            
  455.          }
  456.          
  457.          //----------------------
  458.          this.query = function (action, data) {
  459.          
  460.             return $.ajax ( {
  461.                type: 'POST',
  462.                
  463.                url: location.protocol+'//'+ location.hostname +
  464.                location.pathname +'?action='+action,
  465.                
  466.                data : data,
  467.                success: _self.onSuccess,
  468.                error: _self.onError
  469.             });
  470.          }
  471.          
  472.       }
  473.      
  474.       //-------------------------------------------------
  475.       function updateState() {
  476.      
  477.          var addr = location.protocol+'//'+location.hostname+location.pathname;
  478.          
  479.          $.when ($.get( addr, {action: 'loginstatus'})).done(
  480.             function(tx) {
  481.                $('#loginblock').empty().html(tx);  
  482.                init();             
  483.             }
  484.          );    
  485.       }
  486.  
  487.           //-------------------------------------------------
  488.  
  489.    </script>
  490.    
  491.    
  492.    <style type="text/css">
  493.       * {
  494.          margin: 0;
  495.          padding: 0;
  496.          font-size: inherit;
  497.       }
  498.      
  499.       ul {
  500.          list-style-type: none;
  501.       }
  502.      
  503.       a {
  504.          color:inherit;      
  505.       }
  506.      
  507.       body {
  508.          font-family: verdana, helvetica, sans-serif;
  509.          font-size: 1em;
  510.       }
  511.      
  512.       #container {
  513.          width: 90%;
  514.        
  515.          margin: 0 auto;
  516.       }
  517.      
  518.       #header {
  519.          height: 100px;
  520.          background: #800;
  521.          color: white;
  522.          position:relative;
  523.       }
  524.      
  525.       #loginblock {
  526.          position: absolute;
  527.          left:50px;
  528.          top: 20px;
  529.          border: solid 1px #eee;
  530.          padding: 20px 50px 15px 50px;
  531.       }
  532.        
  533.      
  534.       #sidebar {
  535.              position: absolute;
  536.                  top:0px;
  537.                  left:400px;
  538.          width: 300px;
  539.          padding: 20px 0 0 0;
  540.       }
  541.      
  542.      
  543.      
  544.       #twitlines li {
  545.          height: 1.5em;
  546.          line-height:1.5em;
  547.          border-bottom: dotted 1px;
  548.       }
  549.      
  550.       #twitlines input[type=radio] {
  551.          width:50px;
  552.       }
  553.      
  554.       #twitlines li a {
  555.          text-decoration: none;
  556.       }
  557.      
  558.       .controls {
  559.          overflow: auto;
  560.          margin: 10px 0 0 0;
  561.          padding: 0 0 20px 0;
  562.  
  563.       }
  564.      
  565.       .controls li {
  566.          float:left;
  567.          margin-top: 5px;
  568.          margin-right:10px;
  569.          border: solid 1px #500;
  570.          border-radius: 10px;
  571.          background: #ffe;
  572.          padding: 5px 10px;
  573.          font-size: 0.75em;
  574.       }
  575.      
  576.       .controls li a {
  577.      
  578.          text-decoration: none;
  579.       }
  580.      
  581.       .controls li a:hover {
  582.      
  583.          text-decoration: underline;
  584.       }
  585.      
  586.       #content {
  587.        
  588.          
  589.       }
  590.      
  591.       #contentheader {
  592.          height: 30px;
  593.          background: #400;
  594.          color: white;
  595.       }
  596.      
  597.       #ajaxblock {
  598.  
  599.          border: dotted 1px #888;
  600.       }
  601.      
  602.       #footer {
  603.      
  604.          height: 50px;
  605.          background: #444;
  606.          clear:left;
  607.       }
  608.      
  609.       /*-------------------------*/
  610.       .twitfeed {
  611.          font-size: 0.75em;
  612.       }  
  613.      
  614.       .twitfeed li {
  615.          position: relative;
  616.  
  617.             cursor:pointer;
  618.             width:350px;
  619.             height:300px;
  620.             overflow:hidden;
  621.          
  622.             border-right:dotted 1px black;
  623.             border-bottom:dotted 1px black;
  624.             float:left;
  625.          
  626.            
  627.            
  628.              
  629.       }
  630.      
  631.       .twitid {
  632.          display:none;
  633.       }
  634.       .twittitle {
  635.          line-height:1.5;
  636.              display:none;
  637.       }
  638.       .twitdesc {
  639.          display:none;
  640.       }
  641.       .twitlink {
  642.        
  643.       }
  644.       .twitpubdate {
  645.        
  646.         position:absolute; 
  647.         right:0;
  648.         bottom:0;
  649.         background: #ffe;
  650.         border: solid 1px #f5f5f5;
  651.         color: #555;   
  652.         padding: 0 10px;
  653.         width: 130px;
  654.        
  655.         border-radius: 5px;
  656.         -moz-border-radius: 5px;
  657.         -webkit-border-radius: 5px;
  658.       }
  659.      
  660.       .pager {
  661.          overflow: auto;
  662.          padding: 10px 0 15px 0;
  663.       }
  664.       .pager li {
  665.          
  666.          float:left;
  667.          margin: 0 5px 4px 0;
  668.          border: solid 1px #500;
  669.          
  670.          border-radius: 10px;
  671.          -moz-border-radius: 10px;
  672.          -webkit-border-radius: 10px;
  673.          
  674.          background: #ffe;
  675.          font-size:0.75em;
  676.          overflow:hidden;
  677.          
  678.       }
  679.       .pager li a {
  680.          
  681.          display:block;
  682.        
  683.          height: 100%;
  684.          padding: 0.5em 10px;
  685.          text-decoration: none;
  686.          
  687.       }
  688.       .pager li a:hover {
  689.      
  690.          background: #444;
  691.          color: white;
  692.       }
  693.       /*-------------------------*/
  694.       form {
  695.          overflow: auto;
  696.          padding: 5px;
  697.          margin:5px;
  698.          
  699.       }
  700.      
  701.       form p {
  702.        
  703.       }
  704.      
  705.       form input[type=text] {
  706.          margin-left:20px;
  707.       }
  708.      
  709.       form input[type=button],
  710.       form input[type=submit],
  711.       form input[type=reset] {
  712.      
  713.          display:block;
  714.          float: left;
  715.          margin: 5px 5px 0 0;
  716.          padding: 5px 8px;
  717.          background: #f0f0f0;
  718.          cursor:pointer;
  719.          border: solid 1px #444;
  720.          
  721.          border-radius: 10px;
  722.          -moz-border-radius: 10px;
  723.          -webkit-border-radius: 10px;
  724.       }
  725.      
  726.       form input[type=submit] {
  727.          clear: left;
  728.       }
  729.  
  730.   #lbox {
  731.       position:fixed;
  732.       top:0;
  733.       left:0;
  734.       width:100%;
  735.       height:100%;
  736.       display: none;    
  737.    }
  738.    
  739.    #shade {
  740.       position:absolute;
  741.       background-color:black;
  742.           opacity:0.8;
  743.           filter:alpha(opacity=80);
  744.           width:100%;
  745.           height:100%;
  746.           z-index:100;
  747.    }
  748.    
  749.    #inpic {
  750.       position:absolute;
  751.           z-index:200;
  752.           cursor:pointer;
  753.          
  754.    }
  755.      
  756.  
  757.    #arrows {
  758.       position:fixed;
  759.       left:70%;
  760.       top: 60%;
  761.       margin-left:-100px;
  762.       margin-top: -200px;
  763.       z-index: 300;
  764.    }
  765.      
  766.    #arrows div {
  767.       width: 128px;
  768.       height: 128px;
  769.    }
  770.    #arrows div a {
  771.       display: block;
  772.       width: 100%;
  773.       height:100%;
  774.       opacity: 0.4;
  775.       filter: alpha(opacity=40);
  776.    }
  777.  
  778.    #arrows div a:hover {
  779.       opacity: 0.8;
  780.       filter: alpha(opacity=80);
  781.    }
  782.  
  783.    #toptop a {
  784.       background-image: url('img/media-eject.png');
  785.    }
  786.    #artop a {
  787.       background: url('img/arrow-alt-up.png');
  788.    }
  789.    #arbottom a {
  790.       background: url('img/arrow-alt-down.png');
  791.    }
  792.    </style>
  793. </head>
  794.  
  795. <body>
  796.  
  797. <div id="arrows">
  798.    
  799.    <div id="artop"><a href="#"></a></div>
  800.    <div id="arbottom"><a href="#"></a></div>
  801.    <div id="toptop"><a href="#"></a></div>
  802. </div>
  803.  
  804. <div id="container">
  805.    <div id="header">
  806.       <div id="loginblock">
  807.          logged out<br/><a href="#" rel="_show_loginout_form">log in</a>      </div>
  808.    </div>
  809.  
  810.    <div id="sidebar">      
  811.       <div id="twitlines">
  812.               </div>
  813.       <div id="controls">
  814.          <ul class="controls">
  815.            <li><a href="#" rel="_show_bookmarks">show bookmarks</a></li>
  816.        <li><a href="#" rel="_add_bookmark">add bookmark</a></li>
  817.  
  818.        </ul>      </div>
  819.    </div>
  820.    
  821.    <div id="content">
  822.       <div id="contentheader">
  823.       </div>
  824.      
  825.       <div id="ajaxblock">
  826.       </div>
  827.    </div>
  828.    
  829.    <div id="footer">
  830.    </div>
  831.  
  832.  
  833.  
  834. </div>
  835.  
  836. <div id="lbox">
  837.   <div id="shade"></div>
  838.   <div id="inpic"><img /></div>
  839. </div>
  840.  
  841. </body>
  842. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement