b2evolution PHP Cross Reference Blogging Systems

Source: /skins/touch/js/core.js - 216 lines - 6743 bytes - Summary - Text - Print

   1  /*
   2   * WPtouch 1.9.x -The WPtouch Core JS File
   3   */
   4  
   5  var $wpt = jQuery.noConflict();
   6  
   7  if ( ( navigator.platform == 'iPhone' || navigator.platform == 'iPod' ) && typeof orientation != 'undefined' ) { 
   8      var touchStartOrClick = 'touchstart'; 
   9  } else {
  10      var touchStartOrClick = 'click'; 
  11  };
  12  
  13  /* Try to get out of frames! */
  14  if ( window.top != window.self ) { 
  15      window.top.location = self.location.href
  16  }
  17  
  18  $wpt.fn.wptouchFadeToggle = function( speed, easing, callback ) { 
  19      return this.animate( {opacity: 'toggle'}, speed, easing, callback ); 
  20  };
  21  
  22  function wptouch_switch_confirmation( e ) {
  23      if ( document.cookie && document.cookie.indexOf( 'wptouch_switch_toggle' ) > -1 ) {
  24      // just switch
  25          $wpt( '#switch span' ).removeClass( 'active' );
  26          $wpt( '.off' ).addClass( 'active' );
  27          //setTimeout('switch_delayer()', 500 ); 
  28      } else {
  29      // ask first
  30          if ( confirm( "Switch to regular view? \n \n You can switch back again in the footer." ) ) {
  31          $wpt( '#switch span' ).removeClass( 'active' );
  32          $wpt( '.off' ).addClass( 'active' );
  33              //setTimeout( 'switch_delayer()', 500 );
  34              
  35          } else {
  36              e.preventDefault();
  37              e.stopImmediatePropagation();
  38          }
  39      }
  40  }
  41  
  42  if ( $wpt( '#prowl-success' ).length ) {
  43      setTimeout( function() { $wpt( '#prowl-success' ).fadeOut( 350 ); }, 5250 );
  44  }
  45  if ( $wpt( '#prowl-fail' ).length ) {
  46      setTimeout( function() { $wpt( '#prowl-fail' ).fadeOut( 350 ); }, 5250 );
  47  }
  48  
  49  $wpt(function() {
  50      var tabContainers = $wpt( '#menu-head > ul' );   
  51      $wpt( '#tabnav a' ).bind(touchStartOrClick, function () {
  52          tabContainers.hide().filter( this.hash ).show();
  53      $wpt( '#tabnav a' ).removeClass( 'selected' );
  54      $wpt( this ).addClass( 'selected' );
  55          return false;
  56      }).filter( ':first' ).trigger( touchStartOrClick );
  57  });
  58  
  59  function bnc_showhide_coms_toggle() {
  60      $wpt( '#commentlist' ).wptouchFadeToggle( 350 );
  61      $wpt( 'img#com-arrow' ).toggleClass( 'com-arrow-down' );
  62      $wpt( 'h3#com-head' ).toggleClass( 'comhead-open' );
  63  }
  64      
  65  function doWPtouchReady() {
  66  
  67      $wpt( '#headerbar-menu a' ).bind( touchStartOrClick, function( e ){
  68          $wpt( '#wptouch-menu' ).wptouchFadeToggle( 350 );
  69          $wpt( '#headerbar-menu a' ).toggleClass( 'open' );
  70      });
  71  
  72      $wpt( 'a#searchopen, #wptouch-search-inner a' ).click( function(){    
  73          $wpt( '#wptouch-search' ).wptouchFadeToggle( 350 );
  74          $wpt( '#s' ).focus();        
  75      });
  76      
  77      $wpt( 'a#prowlopen' ).bind( touchStartOrClick, function( e ){    
  78          $wpt( '#prowl-message' ).wptouchFadeToggle( 350 );
  79      });
  80      
  81      $wpt( 'a#wordtwitopen' ).bind( touchStartOrClick, function( e ){    
  82          $wpt( '#wptouch-wordtwit' ).wptouchFadeToggle( 350 );
  83      });
  84  
  85      $wpt( 'a#gigpressopen' ).bind( touchStartOrClick, function( e ){    
  86          $wpt( '#wptouch-gigpress' ).wptouchFadeToggle( 350 );
  87      });
  88  
  89      $wpt( 'a#loginopen, #wptouch-login-inner a' ).bind( touchStartOrClick, function( e ){    
  90          $wpt( '#wptouch-login' ).wptouchFadeToggle(350);
  91      });
  92      
  93      $wpt( 'a#obook' ).bind( touchStartOrClick, function() {
  94          $wpt( '#bookmark-box' ).wptouchFadeToggle(350);
  95      });
  96      
  97      $wpt( '.singlentry img, .singlentry .wp-caption' ).each( function() {
  98          if ( $wpt( this ).width() <= 250 ) {
  99              $wpt( this ).addClass( 'aligncenter' );
 100          }
 101      });
 102      
 103      if ( $wpt( '#FollowMeTabLeftSm' ).length ) {
 104          $wpt( '#FollowMeTabLeftSm' ).remove();
 105      }
 106      
 107      /* add dynamic automatic video resizing via fitVids */
 108  
 109      var videoSelectors = [
 110          "iframe[src^='http://player.vimeo.com']",
 111          "iframe[src^='http://www.youtube.com']",
 112          "iframe[src^='http://www.kickstarter.com']",
 113          "object",
 114          "embed",
 115          "video"
 116      ];
 117      
 118      var allVideos = $wpt( '.post' ).find( videoSelectors.join(',') );
 119      
 120      $wpt( allVideos ).each( function(){ 
 121          $wpt( this ).unwrap().addClass( 'wptouch-videos' ).parentsUntil( '.content', 'div:not(.fluid-width-video-wrapper), span' ).removeAttr( 'width' ).removeAttr( 'height' ).removeAttr( 'style' );
 122      });
 123  
 124      $wpt( '.post' ).fitVids();
 125      
 126      $wpt( document ).on( touchStartOrClick, '.post-arrow', function( e ){
 127          $wpt( this ).toggleClass( 'post-arrow-down' );
 128          $wpt( this ).parents( '.post' ).find( '.mainentry' ).wptouchFadeToggle(500);
 129      });
 130  
 131      $wpt( 'span.off' ).bind( 'click', function(){
 132          wptouch_switch_confirmation();
 133      });
 134      
 135  }
 136  
 137  $wpt( document ).ready( function() { doWPtouchReady(); } );
 138  
 139  
 140  /*global jQuery */
 141  /*! 
 142  * FitVids 1.0
 143  *
 144  * Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
 145  * Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
 146  * Released under the WTFPL license - http://sam.zoy.org/wtfpl/
 147  *
 148  * Date: Thu Sept 01 18:00:00 2011 -0500
 149  *
 150  * Modified by BraveNewCode for WPtouch Pro
 151  */
 152  
 153  (function( $ ){
 154  
 155    $.fn.fitVids = function( options ) {
 156      var settings = {
 157        customSelector: null
 158      }
 159      
 160      var div = document.createElement('div'),
 161          ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0];
 162          
 163        div.className = 'fit-vids-style';
 164      div.innerHTML = '&shy;<style>         \
 165        .fluid-width-video-wrapper {        \
 166           width: 100%;                     \
 167           position: relative;              \
 168           padding: 0;                      \
 169        }                                   \
 170                                            \
 171        .fluid-width-video-wrapper *{  \
 172           position: absolute;              \
 173           top: 0;                          \
 174           left: 0;                         \
 175           width: 100%;                     \
 176           height: 100%;                    \
 177        }                                   \
 178      </style>';
 179                        
 180      ref.parentNode.insertBefore(div,ref);
 181      
 182      if ( options ) { 
 183        $.extend( settings, options );
 184      }
 185      
 186      return this.each(function(){
 187        var selectors = [
 188          "iframe[src^='http://player.vimeo']", 
 189          "iframe[src^='http://www.youtube']", 
 190          "iframe[src^='http://www.kickstarter']",
 191  //     "iframe[src^='http://maps.google']",
 192          "object", 
 193          "embed",
 194          "video"
 195        ];
 196        
 197        if (settings.customSelector) {
 198          selectors.push(settings.customSelector);
 199        }
 200        
 201        var $allVideos = $(this).find(selectors.join(','));
 202  
 203        $allVideos.each(function(){
 204          var $this = $(this);
 205  
 206          if (this.tagName.toLowerCase() == 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; } 
 207          var height = $this.height(), aspectRatio = height / $this.width();
 208  //        var height = this.tagName.toLowerCase() == 'object' ? $this.attr('height') : $this.height(),
 209  
 210          $this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+"%");
 211          $this.removeAttr('height').removeAttr('width');
 212        });
 213      });
 214    
 215    }
 216  })( jQuery );

title

Description

title

Description

title

Description

title

title

Body