Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (28 sloc) 1.309 kb
42eaa4d @kucrut History.js, phase #1
authored
1 <?php
2
3 /**
4 * @package KC_Essentials
5 * @version 0.1
6 */
7
8
9 class kcEssentials_history_js {
10 public static function init() {
59c4393 @kucrut Big cleanups
authored
11 $script_dir_uri = kcEssentials::get_data('paths', 'scripts');
12 wp_register_script( 'jquery-scrollto', "{$script_dir_uri}/jquery.scrollto.min.js", array('jquery'), '1.0.1', true );
04e9787 @kucrut Cleanups
authored
13 wp_register_script( 'jquery-history', "{$script_dir_uri}/jquery.history.js", array('jquery'), '1.7.1', true );
14 wp_enqueue_script( 'kc-ajaxify', "{$script_dir_uri}/ajaxify.js", array('jquery', 'jquery-scrollto', 'jquery-history'), '0.1', true );
42eaa4d @kucrut History.js, phase #1
authored
15
a8c3bc2 @kucrut Cleanups
authored
16 $vars = wp_parse_args( kc_array_remove_empty(kc_get_option('kc_essentials', 'enhc_history_js')), kc_get_default('plugin', 'kc_essentials', 'enhc_history_js') );
42eaa4d @kucrut History.js, phase #1
authored
17
b5435b2 @kucrut Refined kcAjaxify keys
authored
18 $must = array(
04e9787 @kucrut Cleanups
authored
19 'el_excludes' => array('#comment-popup-link', '.no-ajaxy'),
20 'url_excludes' => array('/wp-admin/', '/feed/')
b5435b2 @kucrut Refined kcAjaxify keys
authored
21 );
22 foreach ( $must as $key => $values ) {
23 $glue = ( $key == 'class_active_menu' ) ? ' ' : ',';
24 if ( !isset($vars[$key]) )
25 $vars[$key] = array();
26 else
27 $vars[$key] = explode( $glue, $vars[$key] );
28
29 $vars[$key] = implode( $glue, array_unique( array_merge($vars[$key], $values) ) );
30 }
72d7b43 @kucrut History.js: excluded URLs
authored
31
bd4f823 @kucrut Update active menu classes
authored
32 wp_localize_script( 'kc-ajaxify', 'kcAjaxify', $vars );
42eaa4d @kucrut History.js, phase #1
authored
33 }
34 }
35
59c4393 @kucrut Big cleanups
authored
36 add_action( 'wp_enqueue_scripts', array('kcEssentials_history_js', 'init') );
Something went wrong with that request. Please try again.