Advertisement
terorama

JQuery / single_digest.php

Apr 12th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 12.07 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Singular Template
  4.  *
  5.  * This is the default singular template.  It is used when a more specific template can't be found to display
  6.  * singular views of posts (any post type).
  7.  *
  8.  * @package Oxygen
  9.  * @subpackage Template
  10.  */
  11.  
  12.  /*function print_filters_for( $hook = '' ) {
  13.     global $wp_filter;
  14.  
  15.     print '<pre>';
  16.     //print_r( $wp_filter );
  17.     foreach ($wp_filter as $flt=>$val) {
  18.        echo $flt."\r\n";
  19.     }
  20.     print '</pre>';
  21. }*/
  22.  
  23.  
  24.   /*remove_all_filters('the_content');
  25.   remove_all_filters('single_template');*/
  26.  
  27. ?>
  28. <!doctype html>
  29. <html <?php language_attributes(); ?>>
  30. <head>
  31.     <meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=win-1251" />
  32.     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  33.        
  34.     <!-- Mobile viewport optimized -->
  35.     <meta name="viewport" content="width=device-width,initial-scale=1">
  36.    
  37.             <!-- Favicon -->
  38.         <?php if ( hybrid_get_setting( 'oxygen_favicon_url' ) ) { ?>
  39.         <!-- Favicon -->
  40.         <link rel="shortcut icon" href="<?php echo hybrid_get_setting( 'oxygen_favicon_url' ); ?>" />
  41.        <?php } ?>
  42.        
  43.     <!-- Title -->
  44.     <title><?php hybrid_document_title(); ?></title>
  45.    
  46.  
  47. <script type='text/javascript' src='<?php echo get_template_directory_uri(); ?>/jquery.min.js'></script>
  48.  
  49. <script type="text/javascript">
  50.  
  51.    var gl_trig = false;
  52.    var gl_moved;
  53.  
  54.    function zz(s) {
  55.       console.log(s);
  56.    }
  57.  
  58.    $(document).ready (init);
  59.    
  60.    //----------------------------------
  61.    function repl_fifpix() {
  62.    
  63.       var alt_container = $('<div/>', {'id':'feed-alt-container'}).css('display','none');
  64.       $(document.body).append(alt_container);
  65.       //zz(alt_container.get(0).id);
  66.      
  67.       $('.fifpx-container').appendTo(alt_container);
  68.      
  69.       $('#feed-alt-container>div>div img').each(
  70.          function(i, el) {
  71.             var src = el.src;
  72.             el.src = 'http://freedomplace.ru/diff/php_dbg/loader.php?thumb='+src;
  73.             $(el).attr('width', '300px');
  74.          }
  75.       );
  76.      
  77.       $('#feed-alt-container>div>div').each(
  78.          function(i, el) {     
  79.             $(el).css('width', '300px').css('height','150px');
  80.          }
  81.       );
  82.      
  83.       $('#feed-alt-container>div').each (
  84.          function(i, el) {
  85.          
  86.             var img_cnt = $('img',$(el)).length;       
  87.             var tabb = $('#bigtabbs').children().filter(filt($(el)));
  88.            
  89.             var intabs = $('<div/>',{'class':'intabbs'}).data('clicked',false);
  90.             var bigintabs = $('<div/>',{'class':'bigintabbs'});
  91.      
  92.             tabb.prepend(intabs);
  93.             intabs.after(bigintabs);
  94.            
  95.             for (j=0; j<Math.ceil(img_cnt/12); j++) {
  96.            
  97.                var intab = $('<div/>',{'class':'tabb'}).data('pg',j).text(j+1);
  98.                var bigintab = $('<div/>',{'class':'bigtabb'}).data('pg',j);
  99.                
  100.                intabs.append(intab);  
  101.                bigintabs.append(bigintab);
  102.                
  103.                $('div',$(el)).slice(0,12).appendTo(bigintab);
  104.                
  105.                var waituu = mk_defer (bigintab);
  106.                $.when(waituu).done(
  107.                  defCallback(intab)
  108.                );
  109.              
  110.                
  111.                intab.click(intabclick( bigintabs, bigintab));  
  112.             }
  113.             //--------------
  114.             act4($(el));
  115.             $('#tabbs').children().filter(filt($(el))).addClass('loaded');
  116.            
  117.          })
  118.      
  119.    }
  120.    //----------------------------------
  121.    function defCallback(intab) {
  122.       return function() {
  123.          intab.addClass('loaded');
  124.          
  125.          if (intab.parent().data('clicked')===false) {
  126.             intab.parent().data('clicked',true);
  127.             intab.trigger('click');
  128.          }
  129.       }
  130.    }
  131.    //----------------------------------
  132.    function intabclick( bigintabs, bigintab) {
  133.       return function() {
  134.                      $('div.bigtabb', bigintabs).fadeOut('slow');
  135.                      bigintab.fadeIn('slow');
  136.                      zz('pg='+bigintab.data('pg'));
  137.                   }
  138.    }
  139.    //----------------------------------
  140.    function init() {
  141.        
  142.       var tabs = $('<div/>',{'id':'tabbs'});
  143.       var bigtabs = $('<div/>',{'id':'bigtabbs'});
  144.      
  145.       $(document.body).prepend(tabs);
  146.       tabs.after(bigtabs);
  147.      
  148.       $(document.body).prepend($('<h3/>').html(document.title));
  149.       $(document.body).append('<div id="lbox"><div id="shade"></div> <div id="inpic"><img /></div></div>');
  150.      
  151.        //------------------------
  152.        $('#lbox').click(function() {
  153.                      showlb(false);
  154.                  });            
  155.              
  156.       //------------------------
  157.      
  158.       $('#inpic').click( function(event) {
  159.                        
  160.                    event = event || window.event;
  161.                    if (event.stopPropagation) {
  162.                        event.stopPropagation();
  163.                    } else {
  164.                        event.cancelBubble=true;
  165.                    };})
  166.      
  167.       //------------------------
  168.       $('#inpic').bind('mousedown',mouseDown);
  169.      
  170.      
  171.      
  172.       $.each ($('#feed-container>h3'), function (i, el) {
  173.      
  174.          var uu = el.innerHTML.split(' ');
  175.          var uuu = uu.indexOf('for');
  176.          var zzstr = uu.slice(0,uuu).join(' ');
  177.          
  178.          tabs.append($('<div/>',{'class':'tabb'}).data('inf',i).text(zzstr));
  179.          bigtabs.append($('<div/>',{'class':'bigtabb'}).data('inf',i));
  180.          $(el).next().data('inf',i);
  181.       });
  182.      
  183.       repl_fifpix();
  184.      
  185.       var els = $('#feed-container>div').filter(
  186.           function() {
  187.              return !$(this).hasClass('clr');
  188.          });
  189.       $.each (els, function(i, el) {
  190.          var waitzz = mk_defer($(el));
  191.          
  192.          act4($(el));
  193.          
  194.          $.when(waitzz).done (
  195.             function() {
  196.                act($(el));
  197.              }
  198.          )
  199.       })
  200.    }
  201.    
  202.    //----------------------------------
  203.    function filt(inel) {
  204.      
  205.       return function()
  206.          
  207.           {
  208.           return $(this).data('inf')===inel.data('inf')};
  209.    }
  210.    
  211.    //----------------------------------
  212.    function filt4(inel) {    
  213.       return function()  {
  214.           return $(this).data('pg')===inel.data('pg')};
  215.    }
  216.    //----------------------------------
  217.    function act4(inel) {
  218.    
  219.       $('#bigtabbs').children().filter(filt(inel)).append(inel.find('div'));
  220.    
  221.       var uuu = $('#tabbs').children().filter(filt(inel));
  222.      
  223.       uuu.click (function() {
  224.          $('#bigtabbs>div.bigtabb').fadeOut('slow');
  225.          $('#bigtabbs>div.bigtabb').filter(filt(inel)).fadeIn('slow');
  226.       });      
  227.    }
  228.     //----------------------------------
  229.    function act(inel) {
  230.    
  231.       var uuu = $('#tabbs').children().filter(filt(inel));
  232.       uuu.addClass('loaded');
  233.      
  234.       if (!gl_trig) {
  235.          gl_trig = true;
  236.          uuu.trigger('click');
  237.       }
  238.        
  239.    }
  240.    
  241.    //----------------------------------
  242.    function showlb(on) {
  243.              if (on) {
  244.                     $('#lbox').css('width',screen.width+'px');
  245.                         $('#lbox').css('height',screen.height+'px');
  246.                        
  247.                         $('#lbox').fadeIn('slow');
  248.                  }
  249.                  else {
  250.                     $('#lbox').fadeOut('slow');
  251.                  }
  252.                  
  253.           }
  254.    //----------------------------------
  255.    function lb_go(el) {
  256.    
  257.       /*var imz = new Image();
  258.          imz.src = el.src;
  259.          
  260.          $(imz).load (function () {   */  
  261.             var uuu = $(el).clone().attr('width','');
  262.             $('#inpic').empty().append(uuu);    
  263.            
  264.             //zz($(el).data('wd'));        
  265.            
  266.             $('#inpic').css('left', Math.floor(screen.width/2-$(el).data('wd')/2)+'px');  
  267.             $('#inpic').css('top', Math.floor(screen.height/2-$(el).data('ht')/2)+'px');
  268.             showlb(true);
  269.          //});  
  270.          
  271.    }
  272.    //----------------------------------
  273.    function mk_defer(inel) {
  274.       var els = $('>div img', inel);
  275.      
  276.       var cnt = els.length;
  277.      
  278.       var waitzz = $.Deferred (
  279.      
  280.       function(dfd) {
  281.      
  282.       var n_els=0;
  283.      
  284.       $.each(els, function(i, el) {
  285.          $(el).load(function() {
  286.              
  287.             var _im = $(this);
  288.            
  289.             imz = new Image();
  290.             $(imz).load( function() {
  291.                _im.data('wd', this.width);
  292.                _im.data('ht',this.height);
  293.             });
  294.             imz.src=this.src;
  295.            
  296.             $(this).click(function() {
  297.                lb_go(this);
  298.                return false;
  299.             });
  300.             n_els++;
  301.             if (n_els>=cnt-5)
  302.                 dfd.resolve();
  303.                
  304.          });
  305.          $(el).error(function() {
  306.             n_els++;
  307.             if (n_els>=cnt-5)
  308.                 dfd.resolve();
  309.          })      
  310.       });
  311.      
  312.       }).promise();
  313.      
  314.       return waitzz;
  315.      
  316.    };
  317.    
  318.    //-------------------------------------------------
  319.      
  320.           function mouseDown(e) {
  321.          
  322.              e= e || event;
  323.                  
  324.                  prevX=e.clientX;
  325.                  prevY=e.clientY;
  326.                  
  327.                  $('#inpic').bind('mousemove',mouseMove);
  328.                  $('#inpic').bind('mouseup',mouseUp);
  329.                  
  330.                  gl_moved=false;
  331.                  return false;
  332.           }
  333.           //----------------------------------
  334.           function mouseMove(e) {
  335.              
  336.                  e = e || event;
  337.                  var diffX = e.clientX-prevX;
  338.                  var diffY = e.clientY-prevY;
  339.                  
  340.                  prevX=e.clientX;
  341.                  prevY=e.clientY;
  342.                  
  343.                  $(this).css('left', (this.offsetLeft+diffX)+'px');
  344.                  $(this).css('top', (this.offsetTop+diffY)+'px');
  345.                  
  346.                  gl_moved=true;
  347.           }
  348.           //----------------------------------
  349.           function mouseUp(e) {
  350.              $(this).unbind('mouseup',mouseUp);
  351.                  $(this).unbind('mousemove',mouseMove);
  352.                  
  353.                  if (!gl_moved) {
  354.                     showlb(false);
  355.                  }
  356.           }
  357.          
  358.    //-------------------------------------------------
  359.    
  360. </script>
  361.  
  362. <!-- Style settings -->
  363. <style type="text/css" media="all">
  364.  
  365.  
  366.     h3 {
  367.      font-family: helvetica, sans-serif;
  368.      font-weight: normal;
  369.      font-size: 18px;
  370.      color: #555;
  371.   }
  372.  
  373.     #lbox {
  374.       position:fixed;
  375.       top:0;
  376.       left:0;
  377.          
  378.    }
  379.    
  380.    #shade {
  381.       position:absolute;
  382.       background-color:black;
  383.           opacity:0.8;
  384.           filter:alpha(opacity=80);
  385.           top:0;
  386.           left:0;
  387.           width:100%;
  388.           height:100%;
  389.           z-index:100;
  390.    }
  391.    
  392.    #inpic {
  393.       position:absolute;
  394.           z-index:200;
  395.           cursor:pointer;
  396.          
  397.    }
  398.  
  399.   #tabbs, .intabbs {
  400.      font-family: verdana, sans-serif;   
  401.      font-weight: bold;
  402.      font-size: 12px;
  403.      color: #aaa;
  404.      
  405.      margin:10px 0 0 0;
  406.   }
  407.    
  408.   #bigtabbs, .bigintabbs {
  409.      clear: left;
  410.      float: left;
  411.      margin: 30px 0 0 0;
  412.      position: relative;
  413.      min-height: 200px;
  414.      width: 100%;
  415.      
  416.   }
  417.  
  418.   .tabb {
  419.      float: left;
  420.      margin: 4px 4px 0 0;
  421.      padding: 4px 8px;
  422.      background: #eee;
  423.      border-radius:5px;
  424.      -moz-border-radius:5px;
  425.      -webkit-border-radius:5px;
  426.      cursor: pointer;
  427.   }
  428.  
  429.   .loaded {
  430.       color: #555;
  431.   }
  432.  
  433.   .loaded:hover {
  434.      color: white;
  435.      background: #555;
  436.   }
  437.  
  438.   .bigtabb {
  439.      position: absolute;
  440.      top: 0;
  441.      left: 0;
  442.      width: 100%;
  443.      display: none;
  444.   }
  445.  
  446.   /*-----------------------------------*/
  447.  
  448.   #feed-container h3 {
  449.      font-family: helvetica, sans-serif;
  450.      font-weight: normal;
  451.      font-size: 18px;
  452.      color: #555;
  453.      padding: 8px 0 4px 30px;
  454.      background: #eee;
  455.      margin: 10px 0 0 0;
  456.      display: none;
  457.   }
  458.  
  459.   #feed-container div {
  460.      display: none;
  461.   }
  462.  
  463.  
  464.   div.devimg {
  465.       float:left;
  466.       width:100px;
  467.       height:100px;
  468.       padding: 5px;
  469.       overflow:hidden;
  470.       border-right: solid 1px #999;
  471.       border-top: solid 1px #999;
  472.    }
  473.  
  474.   div.bigpic, div.ellf, div.kult, div.demotiv, div.fifpx,
  475.    div.afisha, div.concerts, div.yapl, div.acid, div.liart  {
  476.  
  477.       float:left;
  478.       width:100px;
  479.       height:100px;
  480.       padding: 5px;
  481.       margin: 0 4px 4px 0;
  482.       overflow:hidden;
  483.       border: solid 1px #999;
  484.       //border-top: solid 1px #999;
  485.    }
  486.  
  487.    div.clr {
  488.       clear:left;
  489.    }
  490. </style>
  491.  
  492. </head>
  493.  
  494. <body>
  495.  <?php //print_filters_for( 'the_content' ); ?>
  496.  <div id="feed-container">
  497.                 <?php if ( have_posts() ) : ?>
  498.                     <?php while ( have_posts() ) : the_post(); ?>
  499.    
  500.                            
  501.    
  502.                                 <?php the_content(); ?>
  503.                    
  504.    
  505.                     <?php endwhile; ?>
  506.    
  507.                 <?php endif; ?>
  508.     </div>
  509.  
  510. </body>
  511. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement