[ Index ]

PHP Cross Reference of phpwcms V1.4.7 _r403 (01.11.10)

title

Body

[close]

/include/inc_front/lib/ -> js.jquery-1.4.inc.php (source)

   1  <?php
   2  /*************************************************************************************
   3     Copyright notice
   4     
   5     (c) 2002-2010 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
   6   
   7     This script is part of PHPWCMS. The PHPWCMS web content management system is
   8     free software; you can redistribute it and/or modify it under the terms of
   9     the GNU General Public License as published by the Free Software Foundation;
  10     either version 2 of the License, or (at your option) any later version.
  11    
  12     The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
  13     A copy is found in the textfile GPL.txt and important notices to the license 
  14     from the author is found in LICENSE.txt distributed with these scripts.
  15    
  16     This script is distributed in the hope that it will be useful, but WITHOUT ANY 
  17     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  18     PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  19   
  20     This copyright notice MUST APPEAR in all copies of the script!
  21  *************************************************************************************/
  22  
  23  define('PHPWCMS_JSLIB', 'jquery-1.4');
  24  
  25  
  26  /**
  27   * Init jQuery 1.4.x Library
  28   */
  29  function initJSLib() {
  30      if(empty($GLOBALS['block']['custom_htmlhead']['jquery.js'])) {
  31          if(!USE_GOOGLE_AJAX_LIB) {
  32              $GLOBALS['block']['custom_htmlhead']['jquery.js'] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/jquery/jquery-1.4.min.js');
  33          } else {
  34              $GLOBALS['block']['custom_htmlhead']['jquery.js'] = getJavaScriptSourceLink(USE_GOOGLE_AJAX_LIB.'jquery/1.4/jquery.min.js');
  35          }
  36      }
  37      return TRUE;
  38  }
  39  
  40  /**
  41   * Initialize Slimbox CSS and JavaScript for jQuery
  42   */
  43  function initSlimbox() {
  44      initJSLib();
  45      $GLOBALS['block']['custom_htmlhead']['lightbox.css'] = '  <link href="'.TEMPLATE_PATH.'lib/slimbox/slimbox.css" rel="stylesheet" type="text/css" media="screen" />';
  46      $GLOBALS['block']['custom_htmlhead']['slimbox.js'] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/slimbox/slimbox.jquery.js');
  47  }
  48  
  49  /**
  50   * Initialize Frontend Edit DomReady JavaScript
  51   */
  52  function init_frontend_edit_js() {
  53      
  54      initJSPlugin('switchClass');    
  55      // based on work and idea by markus@localhorst (http://forum.phpwcms.org/viewtopic.php?f=8&t=19551)
  56      $GLOBALS['block']['js_ondomready'][] = '        $("a.fe-link").toggle();$("#fe-link").click(function(){$(this).switchClass("enabled","disabled");$("a.fe-link").toggle();});';
  57      
  58  }
  59  
  60  /**
  61   * Create JavaScript Domready Section
  62   */
  63  function jsOnDomReady($js='', $return=false, $prefix='  ') {
  64      
  65      if($js) {
  66          
  67          initJSLib();
  68          
  69          $_js  = $prefix . '<script type="text/javascript">'.LF.SCRIPT_CDATA_START.LF;
  70          $_js .= '    jQuery(document).ready(function() {' . LF . $js . LF . '    });';
  71          $_js .= LF.SCRIPT_CDATA_END.LF.$prefix.'</script>';
  72  
  73          if($return) {
  74              return $_js;
  75          }
  76          
  77          $GLOBALS['block']['custom_htmlhead'][] = $_js;
  78      }
  79  }
  80  
  81  /**
  82   * Create JavaScript UnLoad Section
  83   */
  84  function jsOnUnLoad($js='', $return=false, $prefix='  ') {
  85  
  86      if($js) {
  87          
  88          initJSLib();
  89          
  90          $_js  = $prefix . '<script type="text/javascript">'.LF.SCRIPT_CDATA_START.LF;
  91          $_js .= '    jQuery(window).unload(function() {' . LF . $js . LF . '    });';
  92          $_js .= LF.SCRIPT_CDATA_END.LF.$prefix.'</script>';
  93          
  94          if($return) {
  95              return $_js;
  96          }
  97          
  98          $GLOBALS['block']['custom_htmlhead'][] = $_js;
  99      }
 100  }
 101  
 102  /**
 103   * Simple jQuery Plugin Loader
 104   */
 105  function initJSPlugin($plugin='') {
 106      $plugin = 'jquery.'.$plugin.'.js';
 107      if(empty($GLOBALS['block']['custom_htmlhead'][$plugin])) {
 108          initJSLib();
 109          $GLOBALS['block']['custom_htmlhead'][$plugin] = getJavaScriptSourceLink(TEMPLATE_PATH.'lib/jquery/plugin/'.$plugin);
 110      }
 111      return TRUE;
 112  }
 113  
 114  
 115  ?>


Generated: Tue Nov 16 22:51:00 2010 Cross-referenced by PHPXref 0.7