Jelajahi Sumber

Add: custom post type - faculty

Mozahidur Rahman 1 tahun lalu
induk
melakukan
5b8e121163

+ 18 - 0
functions.php

@@ -203,3 +203,21 @@ include_once(get_template_directory() . '/inc/acf/acf.php');
 
 // ACF Settings
 include_once(get_template_directory() . '/inc/acf-settings.php');
+
+// Custom post type
+include_once(get_stylesheet_directory() . '/inc/custom-post-type.php');
+
+// Typeahead Settings
+// include_once( get_stylesheet_directory() . '/inc/wp-typeahead.php');
+
+// Widgets
+// include_once( get_stylesheet_directory() . '/inc/widgets.php' );
+
+// Menus
+// include_once( get_stylesheet_directory() . '/inc/menus.php' );
+
+// Theme Settings
+// include_once( get_stylesheet_directory() . '/inc/theme-settings.php' );
+
+// Shortcodes
+// include_once( get_stylesheet_directory() . '/inc/shortcodes.php' );

+ 8 - 46
inc/acf-json/group_642aa09ae85e7.json

@@ -2,24 +2,6 @@
     "key": "group_642aa09ae85e7",
     "title": "Faculty Profiles",
     "fields": [
-        {
-            "key": "field_642ab5e4d9da0",
-            "label": "Faculty Information",
-            "name": "",
-            "aria-label": "",
-            "type": "message",
-            "instructions": "",
-            "required": 0,
-            "conditional_logic": 0,
-            "wrapper": {
-                "width": "",
-                "class": "",
-                "id": ""
-            },
-            "message": "Input fields are all about faculty of the department of CSE",
-            "new_lines": "wpautop",
-            "esc_html": 0
-        },
         {
             "key": "field_642b5d933dba3",
             "label": "Profile Photo",
@@ -45,26 +27,6 @@
             "mime_types": "",
             "preview_size": "medium"
         },
-        {
-            "key": "field_642aa09bc163e",
-            "label": "Name",
-            "name": "name",
-            "aria-label": "",
-            "type": "text",
-            "instructions": "",
-            "required": 0,
-            "conditional_logic": 0,
-            "wrapper": {
-                "width": "",
-                "class": "",
-                "id": ""
-            },
-            "default_value": "",
-            "maxlength": "",
-            "placeholder": "",
-            "prepend": "",
-            "append": ""
-        },
         {
             "key": "field_642ab30fc50c5",
             "label": "Designation",
@@ -81,7 +43,7 @@
             },
             "default_value": "",
             "maxlength": "",
-            "placeholder": "",
+            "placeholder": "Professor & Director",
             "prepend": "",
             "append": ""
         },
@@ -121,9 +83,9 @@
                         "class": "",
                         "id": ""
                     },
-                    "default_value": "Mobile, email, website etc",
+                    "default_value": "",
                     "maxlength": "",
-                    "placeholder": "",
+                    "placeholder": "Mobile, email, website etc.",
                     "prepend": "",
                     "append": "",
                     "parent_repeater": "field_642ab412c50cc"
@@ -196,7 +158,7 @@
                         "id": ""
                     },
                     "default_value": "",
-                    "placeholder": "",
+                    "placeholder": "https:\/\/facebook.com\/rousnay",
                     "parent_repeater": "field_642ab4bdc50ce"
                 }
             ]
@@ -239,7 +201,7 @@
                     },
                     "default_value": "",
                     "maxlength": "",
-                    "placeholder": "",
+                    "placeholder": "Biography",
                     "prepend": "",
                     "append": "",
                     "parent_repeater": "field_642ab387c50c9"
@@ -271,9 +233,9 @@
     "location": [
         [
             {
-                "param": "options_page",
+                "param": "post_type",
                 "operator": "==",
-                "value": "uiu-cse-general-settings"
+                "value": "faculty"
             }
         ]
     ],
@@ -286,5 +248,5 @@
     "active": true,
     "description": "",
     "show_in_rest": 0,
-    "modified": 1680563662
+    "modified": 1680608285
 }

+ 4 - 0
inc/custom-fileds.php

@@ -0,0 +1,4 @@
+<?php 
+
+
+ ?>

+ 60 - 0
inc/custom-post-type.php

@@ -0,0 +1,60 @@
+<?php
+
+// Register Faculty Post Type
+function cpt_uiu_faculty()
+{
+
+    $labels = array(
+        'name'                  => 'Faculties',
+        'singular_name'         => 'Faculty',
+        'menu_name'             => 'Faculties',
+        'name_admin_bar'        => 'Post Type',
+        'archives'              => 'Faculty Archives',
+        'attributes'            => 'Faculty Attributes',
+        'parent_item_colon'     => 'Parent Faculty:',
+        'all_items'             => 'All Faculties',
+        'add_new_item'          => 'Add New Faculty',
+        'add_new'               => 'Add New',
+        'new_item'              => 'New Faculty',
+        'edit_item'             => 'Edit Faculty',
+        'update_item'           => 'Update Faculty',
+        'view_item'             => 'View Faculty',
+        'view_items'            => 'View Faculties',
+        'search_items'          => 'Search Faculty',
+        'insert_into_item'      => 'Insert into faculty',
+        'uploaded_to_this_item' => 'Uploaded to this faculty',
+        'items_list'            => 'Faculties list',
+        'items_list_navigation' => 'Faculties list navigation',
+        'filter_items_list'     => 'Filter faculties list',
+    );
+    $rewrite = array(
+        'slug'                  => 'faculty',
+        'with_front'            => true,
+        'pages'                 => true,
+        'feeds'                 => true,
+    );
+    $args = array(
+        'label'                 => 'Faculty',
+        'description'           => 'Faculty of Department of CSE',
+        'labels'                => $labels,
+        'supports'              => array('title', 'thumbnail', 'revisions'),
+        // 'taxonomies'            => array('category', 'post_tag'),
+        'hierarchical'          => false,
+        'public'                => true,
+        'show_ui'               => true,
+        'show_in_menu'          => true,
+        'menu_position'         => 5,
+        'menu_icon'             => 'dashicons-businessperson',
+        'show_in_admin_bar'     => true,
+        'show_in_nav_menus'     => true,
+        'can_export'            => true,
+        'has_archive'           => true,
+        'exclude_from_search'   => false,
+        'publicly_queryable'    => true,
+        'rewrite'               => $rewrite,
+        'capability_type'       => 'post',
+        'show_in_rest'          => true,
+    );
+    register_post_type('faculty', $args);
+}
+add_action('init', 'cpt_uiu_faculty', 0);

+ 74 - 0
inc/menus.php

@@ -0,0 +1,74 @@
+<?php 
+
+/*
+ * Register All Menus
+ *
+ */
+function luceo_menus() {
+    register_nav_menus(
+        array(
+            'header-menu' => __( 'Header menu' , 'nav menu location', 'luceo'),
+            'footer-menu' => __( 'Footer menu' , 'nav menu location', 'luceo')
+            )
+        );
+}
+
+add_action( 'init', 'luceo_menus' );
+
+
+/*
+ * Menus Settings
+ *
+ */
+
+//Header menu
+function luceo_header_menu() {
+    if ( has_nav_menu( 'header-menu' ) ) {
+    wp_nav_menu(
+        array(
+            'theme_location'  => 'header-menu',
+            'menu'            => '',
+            'container'       => 'div',
+            'container_id'    => 'header-menu-con-id',
+            'container_class' => 'header-menu-con-cl',
+            'menu_id'         => 'header-menu-id',
+            'menu_class'      => 'header-menu-cl',
+            'echo'            => true,
+            'fallback_cb'     => '',
+            'before'          => '',
+            'after'           => '',
+            'link_before'     => '<span>',
+            'link_after'      => '</span>',
+            'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
+            'depth'           => 0,
+            'walker'          => ''
+        )
+    );
+    }
+}
+
+//Fotter menu
+function luceo_footer_menu() {
+    if ( has_nav_menu( 'footer-menu' ) ) {
+    wp_nav_menu(
+        array(
+            'theme_location'  => 'footer-menu',
+            'menu'            => '',
+            'container'       => 'div',
+            'container_id'    => 'footer-menu-id',
+            'container_class' => 'footer-menu-cl',
+            'menu_id'         => 'footer-menu-id',
+            'menu_class'      => 'footer-menu-cl',
+            'echo'            => true,
+            'fallback_cb'     => '',
+            'before'          => '',
+            'after'           => '',
+            'link_before'     => '',
+            'link_after'      => '',
+            'items_wrap'      => '<ul id="%1$s" class="%2$s">%3$s</ul>',
+            'depth'           => 0,
+            'walker'          => ''
+        )
+    );
+    }
+}

+ 130 - 0
inc/shortcodes.php

@@ -0,0 +1,130 @@
+<?php 
+
+/**
+ * Shortcode: Display a List of Child Pages For a Parent Page
+ *
+ * Code: [wpb_childpages]
+ *
+ * or <?php wittyplex_list_child_pages(); ?>
+ *
+ **/
+function wittyplex_list_child_pages() { 
+
+	global $post; 
+
+	if ( is_page() && $post->post_parent )
+
+		$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->post_parent . '&echo=0' );
+	else
+		$childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' );
+
+	if ( $childpages ) {
+
+		$string = '<ul class="child-page-menu">' . $childpages . '</ul>';
+	}
+	return $string;
+}
+add_shortcode('list_childpages', 'wittyplex_list_child_pages');
+
+
+
+/**
+ * Shortcode: Display Buttons
+ *
+ * Code: [button style="large yellow" icon="fa-file-text-o" width="200px" link="http://www.google.com" title="Link Title"]
+ *
+ * or <?php wittyplex_adding_custom_button(); ?>
+ *
+ **/
+function wittyplex_adding_custom_button($atts, $content = null) {
+	extract(shortcode_atts(array(
+		'title' => 'Button Title',
+		'link' => '#',
+		'style' => 'normal yallow',
+		'width' => 'inherit',
+		'icon' => ' ',
+		), $atts));
+
+	return '<div style="width: '.$width.' " class="buttons '.$style.'"> 
+	<i class="'.$icon.'"></i> <a href="'.$link.'">'.$title.'</a></div>';
+}
+add_shortcode('button', 'wittyplex_adding_custom_button');
+
+
+
+/**
+ * Shortcode: Display Texts
+ *
+ * Code: [content style="normal gray" size="12px" font="Raleway" text="Text here"]
+ *
+ * or <?php wittyplex_adding_custom_text_style(); ?>
+ *
+ **/
+function wittyplex_adding_custom_text_style($atts, $content = null) {
+	extract(shortcode_atts(array(
+		'text' => 'Button Title',
+		'style' => 'gray',
+		'size' => 'inherit',
+		'font' => 'inherit',
+		), $atts));
+
+	return '<div style="font-size: '.$size.'; font-family: '.$font.'" class="contents '.$style.'">'.$text.' </div>';
+}
+add_shortcode('content', 'wittyplex_adding_custom_text_style');
+
+
+
+
+
+
+
+/**
+ * Shortcode: Display SVG Buttons
+ *
+ * Code: [svg_button text1="Click to" text2="Contact Us" text1_size="14px" text2_size="23px" text1_style="gray" text2_style="yellow" link="http://www.google.com" target="_blank"]
+ *
+ * or <?php wittyplex_adding_custom_svg_button(); ?>
+ *
+ **/
+function wittyplex_adding_custom_svg_button($atts, $content = null) {
+	extract(shortcode_atts(array(
+		'text1' => 'Click to',
+		'text2' => 'Contact Us',
+		'text1_size' => '16px',
+		'text2_size' => '23px',
+		'text1_style' => 'gray',
+		'text2_style' => 'yellow',
+		'link' => '#',
+		'target' => '_self',
+		), $atts));
+	return '<div class="svg-button">
+
+	<div class="svg-inner">
+		<a href="'.$link.'" target="'.$target.'">
+			<div class="svg-text">
+				<p style="font-size:'.$text1_size.'" class="'.$text1_style.'">'.$text1.'</h6>
+				<p style="font-size:'.$text2_size.'" class="'.$text2_style.'">'.$text2.'</h2>
+			</div>
+		</a>
+	</div>
+
+	<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 220 220" xml:space="preserve">
+		<g class="svg-crl">
+			<path d="M191.149,84.762c2.522,7.978,3.895,16.462,3.921,25.26c0.137,46.757-37.794,84.909-84.551,85.045
+			c-46.757,0.137-84.909-37.792-85.045-84.55C25.36,72.148,50.89,39.592,85.889,29.064l-1.4-4.752
+			c-37.057,11.134-64.09,45.598-63.972,86.22c0.145,49.49,40.524,89.634,90.014,89.49s89.636-40.524,89.491-90.014
+			c-0.027-9.321-1.485-18.31-4.159-26.762L191.149,84.762z"/>
+			<path d="M162.626,32.8c24.754,16.782,41.091,45.1,41.184,77.197c0.151,51.579-41.688,93.663-93.267,93.814
+			c-51.579,0.151-93.663-41.688-93.814-93.267c-0.064-22.071,7.577-42.389,20.363-58.441l-3.868-3.091
+			c-13.468,16.904-21.517,38.302-21.449,61.546c0.159,54.31,44.473,98.366,98.783,98.207c54.31-0.159,98.366-44.473,98.207-98.783
+			c-0.099-33.793-17.298-63.608-43.357-81.28L162.626,32.8z"/>
+			<path d="M108.855,7.987c0.373-0.005,0.742-0.031,1.116-0.032c56.417-0.165,102.451,45.599,102.616,102.016
+			s-45.601,102.451-102.018,102.616C54.152,212.752,8.12,166.986,7.955,110.569c-0.044-15.218,3.278-29.667,9.224-42.677
+			l-4.512-2.044C6.435,79.486,2.954,94.632,3,110.584c0.173,59.15,48.433,107.131,107.583,106.958
+			c59.15-0.173,107.131-48.435,106.958-107.585S169.106,2.828,109.957,3c-0.388,0.001-0.77,0.027-1.156,0.033L108.855,7.987z"/>
+		</g>
+	</svg>
+
+</div>';
+}
+add_shortcode('svg_button', 'wittyplex_adding_custom_svg_button');

+ 100 - 0
inc/theme-settings.php

@@ -0,0 +1,100 @@
+<?php
+
+/**
+ * Read More button in excerpt
+ */
+function new_excerpt_more($more)
+{
+	return '... <a class="readmore" href="' . get_permalink() . ' ">Read more <i class="fa fa-external-link"></i></a>';
+}
+
+add_filter('excerpt_more', 'new_excerpt_more');
+
+/**
+ * Custome Lenght of excerpt
+ */
+// function custom_excerpt_length( $length ) {
+//     return 50;
+// }
+// add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
+
+
+/**
+ * Numbered Pagination
+ */
+function pagination($pages = '', $range = 4)
+{
+	$showitems = ($range * 2) + 1;
+
+	global $paged;
+	if (empty($paged)) $paged = 1;
+
+	if ($pages == '') {
+		global $wp_query;
+		$pages = $wp_query->max_num_pages;
+		if (!$pages) {
+			$pages = 1;
+		}
+	}
+
+	if (1 != $pages) {
+		echo "<div class=\"pagination\"><span>Page " . $paged . " of " . $pages . "</span>";
+		if ($paged > 2 && $paged > $range + 1 && $showitems < $pages) echo "<a href='" . get_pagenum_link(1) . "'>&laquo; First</a>";
+		if ($paged > 1 && $showitems < $pages) echo "<a href='" . get_pagenum_link($paged - 1) . "'>&lsaquo; Previous</a>";
+
+		for ($i = 1; $i <= $pages; $i++) {
+			if (1 != $pages && (!($i >= $paged + $range + 1 || $i <= $paged - $range - 1) || $pages <= $showitems)) {
+				echo ($paged == $i) ? "<span class=\"current\">" . $i . "</span>" : "<a href='" . get_pagenum_link($i) . "' class=\"inactive\">" . $i . "</a>";
+			}
+		}
+
+		if ($paged < $pages && $showitems < $pages) echo "<a href=\"" . get_pagenum_link($paged + 1) . "\">Next &rsaquo;</a>";
+		if ($paged < $pages - 1 &&  $paged + $range - 1 < $pages && $showitems < $pages) echo "<a href='" . get_pagenum_link($pages) . "'>Last &raquo;</a>";
+		echo "</div>\n";
+	}
+}
+
+
+/**
+ * stop wp removing div tags
+ */
+function tinymce_settings($settings)
+{
+
+	// html elements being stripped
+	$settings['extended_valid_elements'] = 'div[*],article[*]';
+
+	// only html elements to keep
+	//$settings['valid_elements'] = 'a,strong/b,div,h1,h2,h3,section';
+
+	// paste elements to keep
+	//$opts = '*[*]';
+	//$settings['paste_word_valid_elements'] = $opts;
+
+	// don't remove line breaks
+	//$settings['remove_linebreaks'] = false;
+
+	$settings['allow_html_in_named_anchor'] = true;
+
+	// convert newline characters to BR
+	//$settings['convert_newlines_to_brs'] = true;
+
+	// don't remove redundant BR
+	//$settings['remove_redundant_brs'] = false;
+
+	// only html elements to keep
+	//$settings['wpautop'] = false;
+
+	// pass back to wordpress
+
+	return $settings;
+}
+
+// add_filter( 'tiny_mce_before_init', 'tinymce_settings' );
+
+
+
+// Removing the Editor from a WordPress Post Type
+add_action('init', function () {
+	remove_post_type_support('faculty', 'editor');
+}, 99);

+ 111 - 0
inc/widgets.php

@@ -0,0 +1,111 @@
+<?php 
+/**
+ Sidebar widget area (theme default).
+**/
+// function luceo_widgets_init() {
+// 	register_sidebar( array(
+// 		'name'          => esc_html__( 'Sidebar', 'luceo' ),
+// 		'id'            => 'sidebar-1',
+// 		'description'   => '',
+// 		'before_widget' => '<section id="%1$s" class="widget %2$s">',
+// 		'after_widget'  => '</section>',
+// 		'before_title'  => '<h2 class="widget-title">',
+// 		'after_title'   => '</h2>',
+// 		) );
+// }
+
+// add_action( 'widgets_init', 'luceo_widgets_init' );
+
+//Push/Pull sidebar widgets
+function push_sidebar_widgets_init() {
+
+		register_sidebar( array(
+		'name' => 'Push/Pull Sidebar',
+		'description'   => __( 'Widgets displayed at push/pull sidebar.', 'luceo' ),
+		'id' => 'push_sidebar_widgets',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget' => '</div>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+}
+
+add_action( 'widgets_init', 'push_sidebar_widgets_init' );
+
+
+//Philosophy sidebar widgets
+function philosophy_widgets_init() {
+
+		register_sidebar( array(
+		'name' => 'Philosophy Sidebar',
+		'description'   => __( 'Widgets displayed at Philosophy page.', 'luceo' ),
+		'id' => 'philosophy_widgets',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget' => '</div>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+}
+
+add_action( 'widgets_init', 'philosophy_widgets_init' );
+
+//Blog sidebar widgets
+function blog_widgets_init() {
+
+		register_sidebar( array(
+		'name' => 'Blog/News Sidebar',
+		'description'   => __( 'Widgets displayed at blog/news page.', 'luceo' ),
+		'id' => 'blog_widgets',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget' => '</div>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+}
+
+add_action( 'widgets_init', 'blog_widgets_init' );
+
+
+
+//Footer widgets
+function footer_widgets_init() {
+
+	register_sidebar( array(
+		'name' => 'Footer Widgets #1',
+		'description'   => __( 'Widgets displayed at footer.', 'luceo' ),
+		'id' => 'footer_widgets_1',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget' => '</div>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+		register_sidebar( array(
+		'name' => 'Footer Widgets #2',
+		'description'   => __( 'Widgets displayed at footer.', 'luceo' ),
+		'id' => 'footer_widgets_2',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget' => '</div>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+		register_sidebar( array(
+		'name' => 'Footer Widgets #3',
+		'description'   => __( 'Widgets displayed at footer.', 'luceo' ),
+		'id' => 'footer_widgets_3',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget' => '</div>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+		register_sidebar( array(
+		'name' => 'Footer Widgets #4',
+		'description'   => __( 'Widgets displayed at footer.', 'luceo' ),
+		'id' => 'footer_widgets_4',
+		'before_widget' => '<div id="%1$s" class="widget %2$s">',
+		'after_widget' => '</div>',
+		'before_title' => '<h3 class="widget-title">',
+		'after_title' => '</h3>',
+	) );
+}
+
+add_action( 'widgets_init', 'footer_widgets_init' );

+ 76 - 0
inc/wp-typeahead.php

@@ -0,0 +1,76 @@
+<?php
+/*
+Plugin Name: WP Typeahead
+Description: Add autocomplete search functionality to default WordPress search form
+Author: c.bavota, Michal Bluma
+Version: 1.0.0
+Author URI: http://www.bavotasan.com/
+*/
+class Bavotasan_WP_Typeahead {
+	public $plugin_url;
+
+	public function __construct() {
+		$this->plugin_url = get_template_directory_uri() . '/includes/wp-typeahead/';
+
+		add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
+
+		add_action( 'wp_ajax_nopriv_ajax_search', array( $this, 'ajax_search' ) );
+		add_action( 'wp_ajax_ajax_search', array( $this, 'ajax_search' ) );
+	}
+
+	/**
+	 * Enqueue Typeahead.js and the stylesheet
+	 *
+	 * @since 1.0.0
+	 */
+	public function wp_enqueue_scripts() {
+		wp_enqueue_script( 'wp_typeahead_js', $this->plugin_url . 'js/typeahead.min.js', array( 'jquery' ), '', true );
+		wp_enqueue_script( 'wp_hogan_js' , $this->plugin_url . 'js/hogan.min.js', array( 'wp_typeahead_js' ), '', true );
+		wp_enqueue_script( 'typeahead_wp_plugin' , $this->plugin_url . 'js/wp-typeahead.js', array( 'wp_typeahead_js', 'wp_hogan_js' ), '', true );
+
+		$wp_typeahead_vars = array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) );
+		wp_localize_script( 'typeahead_wp_plugin', 'wp_typeahead', $wp_typeahead_vars );
+
+		wp_enqueue_style( 'wp_typeahead_css', $this->plugin_url . 'css/typeahead.css' );
+	}
+
+	/**
+	 * Ajax query for the search
+	 *
+	 * @since 1.0.0
+	 */
+	public function ajax_search() {
+		if ( isset( $_REQUEST['fn'] ) && 'get_ajax_search' == $_REQUEST['fn'] ) {
+			$search_query = new WP_Query( array(
+				's' => $_REQUEST['terms'],
+				'posts_per_page' => 10,
+				'no_found_rows' => true,
+			) );
+
+			$results = array( );
+			if ( $search_query->get_posts() ) {
+				foreach ( $search_query->get_posts() as $the_post ) {
+					$title = html_entity_decode( get_the_title($the_post->ID), ENT_QUOTES, 'UTF-8' );
+					$content = get_post_field('post_content', $the_post->ID);
+					$post_content = wp_trim_words( $content , '38', '...' );
+					$image_url = wp_get_attachment_url( get_post_thumbnail_id($the_post->ID) );
+
+					$results[] = array(
+						'value' => $title,
+						'postContent' => $post_content,
+						'img_url' => $image_url,
+						'url' => get_permalink( $the_post->ID ),
+						'tokens' => explode( ' ', $title ),
+					);
+				}
+			} else {
+				$results[] = __( 'Sorry. No results match your search.', 'wp-typeahead' );
+			}
+
+			wp_reset_postdata();
+			echo json_encode( $results );
+		}
+		die();
+	}
+}
+$bavotasan_wp_typeahead = new Bavotasan_WP_Typeahead;

+ 87 - 0
inc/wp-typeahead/css/typeahead.css

@@ -0,0 +1,87 @@
+#searchform input[type="submit"] {
+	width: 25%;
+	}
+
+.twitter-typeahead {
+	width: 73% !important;
+	}
+
+.twitter-typeahead * {
+	-moz-box-sizing: border-box;
+	-webkit-box-sizing: border-box;
+	box-sizing: border-box;
+	}
+
+.tt-query,
+.tt-hint {
+	padding: 6px;
+	outline: none;
+	width: 100% !important;
+	vertical-align: inherit !important;
+	}
+
+.tt-hint {
+	color: #999
+	}
+
+.tt-dropdown-menu {
+	width: 100%;
+	margin-top: 12px;
+	padding: 8px 0;
+	background-color: #fff;
+	border: 1px solid #ccc;
+	border: 1px solid rgba(0, 0, 0, 0.2);
+	-webkit-border-radius: 8px;
+	-moz-border-radius: 8px;
+	border-radius: 8px;
+	-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
+	-moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
+	box-shadow: 0 5px 10px rgba(0,0,0,.2);
+	text-shadow: none;
+	}
+
+	.tt-dropdown-menu h5 {
+		color: #444 !important;
+		border: 0 !important;
+		display: block;
+		text-decoration: none !important;
+		font-weight: 700;
+		}
+
+	.tt-dropdown-menu p {
+	    font-size: 14px;
+	    margin: 0 0 5px!important;
+		line-height: 1.4 !important;
+	    color: #444;
+	    font-weight: 400;
+		}
+
+.tt-suggestion {
+	padding: 3px 10px;
+	font-size: 14px;
+	line-height: 18px;
+	}
+
+.tt-suggestion.tt-is-under-cursor {
+	color: #fff;
+	background-color: #0097cf;
+	}
+
+	.tt-suggestion.tt-is-under-cursor h5, .tt-suggestion.tt-is-under-cursor p {
+		color: #fff !important;
+		}
+
+
+.tt-suggestion p {
+	margin: 0;
+	}
+
+/* rtl support */
+.twitter-typeahead.tt-rtl {
+	direction: rtl;
+	}
+
+.twitter-typeahead.tt-rtl .tt-dropdown-menu {
+	left: auto;
+	right: 0;
+	}

+ 572 - 0
inc/wp-typeahead/js/hogan.js

@@ -0,0 +1,572 @@
+/*
+ *  Copyright 2011 Twitter, Inc.
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+var Hogan = {};
+
+(function (Hogan, useArrayBuffer) {
+  Hogan.Template = function (renderFunc, text, compiler, options) {
+    this.r = renderFunc || this.r;
+    this.c = compiler;
+    this.options = options;
+    this.text = text || '';
+    this.buf = (useArrayBuffer) ? [] : '';
+  }
+
+  Hogan.Template.prototype = {
+    // render: replaced by generated code.
+    r: function (context, partials, indent) { return ''; },
+
+    // variable escaping
+    v: hoganEscape,
+
+    // triple stache
+    t: coerceToString,
+
+    render: function render(context, partials, indent) {
+      return this.ri([context], partials || {}, indent);
+    },
+
+    // render internal -- a hook for overrides that catches partials too
+    ri: function (context, partials, indent) {
+      return this.r(context, partials, indent);
+    },
+
+    // tries to find a partial in the curent scope and render it
+    rp: function(name, context, partials, indent) {
+      var partial = partials[name];
+
+      if (!partial) {
+        return '';
+      }
+
+      if (this.c && typeof partial == 'string') {
+        partial = this.c.compile(partial, this.options);
+      }
+
+      return partial.ri(context, partials, indent);
+    },
+
+    // render a section
+    rs: function(context, partials, section) {
+      var tail = context[context.length - 1];
+
+      if (!isArray(tail)) {
+        section(context, partials, this);
+        return;
+      }
+
+      for (var i = 0; i < tail.length; i++) {
+        context.push(tail[i]);
+        section(context, partials, this);
+        context.pop();
+      }
+    },
+
+    // maybe start a section
+    s: function(val, ctx, partials, inverted, start, end, tags) {
+      var pass;
+
+      if (isArray(val) && val.length === 0) {
+        return false;
+      }
+
+      if (typeof val == 'function') {
+        val = this.ls(val, ctx, partials, inverted, start, end, tags);
+      }
+
+      pass = (val === '') || !!val;
+
+      if (!inverted && pass && ctx) {
+        ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
+      }
+
+      return pass;
+    },
+
+    // find values with dotted names
+    d: function(key, ctx, partials, returnFound) {
+      var names = key.split('.'),
+          val = this.f(names[0], ctx, partials, returnFound),
+          cx = null;
+
+      if (key === '.' && isArray(ctx[ctx.length - 2])) {
+        return ctx[ctx.length - 1];
+      }
+
+      for (var i = 1; i < names.length; i++) {
+        if (val && typeof val == 'object' && names[i] in val) {
+          cx = val;
+          val = val[names[i]];
+        } else {
+          val = '';
+        }
+      }
+
+      if (returnFound && !val) {
+        return false;
+      }
+
+      if (!returnFound && typeof val == 'function') {
+        ctx.push(cx);
+        val = this.lv(val, ctx, partials);
+        ctx.pop();
+      }
+
+      return val;
+    },
+
+    // find values with normal names
+    f: function(key, ctx, partials, returnFound) {
+      var val = false,
+          v = null,
+          found = false;
+
+      for (var i = ctx.length - 1; i >= 0; i--) {
+        v = ctx[i];
+        if (v && typeof v == 'object' && key in v) {
+          val = v[key];
+          found = true;
+          break;
+        }
+      }
+
+      if (!found) {
+        return (returnFound) ? false : "";
+      }
+
+      if (!returnFound && typeof val == 'function') {
+        val = this.lv(val, ctx, partials);
+      }
+
+      return val;
+    },
+
+    // higher order templates
+    ho: function(val, cx, partials, text, tags) {
+      var compiler = this.c;
+      var options = this.options;
+      options.delimiters = tags;
+      var text = val.call(cx, text);
+      text = (text == null) ? String(text) : text.toString();
+      this.b(compiler.compile(text, options).render(cx, partials));
+      return false;
+    },
+
+    // template result buffering
+    b: (useArrayBuffer) ? function(s) { this.buf.push(s); } :
+                          function(s) { this.buf += s; },
+    fl: (useArrayBuffer) ? function() { var r = this.buf.join(''); this.buf = []; return r; } :
+                           function() { var r = this.buf; this.buf = ''; return r; },
+
+    // lambda replace section
+    ls: function(val, ctx, partials, inverted, start, end, tags) {
+      var cx = ctx[ctx.length - 1],
+          t = null;
+
+      if (!inverted && this.c && val.length > 0) {
+        return this.ho(val, cx, partials, this.text.substring(start, end), tags);
+      }
+
+      t = val.call(cx);
+
+      if (typeof t == 'function') {
+        if (inverted) {
+          return true;
+        } else if (this.c) {
+          return this.ho(t, cx, partials, this.text.substring(start, end), tags);
+        }
+      }
+
+      return t;
+    },
+
+    // lambda replace variable
+    lv: function(val, ctx, partials) {
+      var cx = ctx[ctx.length - 1];
+      var result = val.call(cx);
+
+      if (typeof result == 'function') {
+        result = coerceToString(result.call(cx));
+        if (this.c && ~result.indexOf("{\u007B")) {
+          return this.c.compile(result, this.options).render(cx, partials);
+        }
+      }
+
+      return coerceToString(result);
+    }
+
+  };
+
+  var rAmp = /&/g,
+      rLt = /</g,
+      rGt = />/g,
+      rApos =/\'/g,
+      rQuot = /\"/g,
+      hChars =/[&<>\"\']/;
+
+
+  function coerceToString(val) {
+    return String((val === null || val === undefined) ? '' : val);
+  }
+
+  function hoganEscape(str) {
+    str = coerceToString(str);
+    return hChars.test(str) ?
+      str
+        .replace(rAmp,'&amp;')
+        .replace(rLt,'&lt;')
+        .replace(rGt,'&gt;')
+        .replace(rApos,'&#39;')
+        .replace(rQuot, '&quot;') :
+      str;
+  }
+
+  var isArray = Array.isArray || function(a) {
+    return Object.prototype.toString.call(a) === '[object Array]';
+  };
+
+})(typeof exports !== 'undefined' ? exports : Hogan);
+
+
+
+
+(function (Hogan) {
+  // Setup regex  assignments
+  // remove whitespace according to Mustache spec
+  var rIsWhitespace = /\S/,
+      rQuot = /\"/g,
+      rNewline =  /\n/g,
+      rCr = /\r/g,
+      rSlash = /\\/g,
+      tagTypes = {
+        '#': 1, '^': 2, '/': 3,  '!': 4, '>': 5,
+        '<': 6, '=': 7, '_v': 8, '{': 9, '&': 10
+      };
+
+  Hogan.scan = function scan(text, delimiters) {
+    var len = text.length,
+        IN_TEXT = 0,
+        IN_TAG_TYPE = 1,
+        IN_TAG = 2,
+        state = IN_TEXT,
+        tagType = null,
+        tag = null,
+        buf = '',
+        tokens = [],
+        seenTag = false,
+        i = 0,
+        lineStart = 0,
+        otag = '{{',
+        ctag = '}}';
+
+    function addBuf() {
+      if (buf.length > 0) {
+        tokens.push(new String(buf));
+        buf = '';
+      }
+    }
+
+    function lineIsWhitespace() {
+      var isAllWhitespace = true;
+      for (var j = lineStart; j < tokens.length; j++) {
+        isAllWhitespace =
+          (tokens[j].tag && tagTypes[tokens[j].tag] < tagTypes['_v']) ||
+          (!tokens[j].tag && tokens[j].match(rIsWhitespace) === null);
+        if (!isAllWhitespace) {
+          return false;
+        }
+      }
+
+      return isAllWhitespace;
+    }
+
+    function filterLine(haveSeenTag, noNewLine) {
+      addBuf();
+
+      if (haveSeenTag && lineIsWhitespace()) {
+        for (var j = lineStart, next; j < tokens.length; j++) {
+          if (!tokens[j].tag) {
+            if ((next = tokens[j+1]) && next.tag == '>') {
+              // set indent to token value
+              next.indent = tokens[j].toString()
+            }
+            tokens.splice(j, 1);
+          }
+        }
+      } else if (!noNewLine) {
+        tokens.push({tag:'\n'});
+      }
+
+      seenTag = false;
+      lineStart = tokens.length;
+    }
+
+    function changeDelimiters(text, index) {
+      var close = '=' + ctag,
+          closeIndex = text.indexOf(close, index),
+          delimiters = trim(
+            text.substring(text.indexOf('=', index) + 1, closeIndex)
+          ).split(' ');
+
+      otag = delimiters[0];
+      ctag = delimiters[1];
+
+      return closeIndex + close.length - 1;
+    }
+
+    if (delimiters) {
+      delimiters = delimiters.split(' ');
+      otag = delimiters[0];
+      ctag = delimiters[1];
+    }
+
+    for (i = 0; i < len; i++) {
+      if (state == IN_TEXT) {
+        if (tagChange(otag, text, i)) {
+          --i;
+          addBuf();
+          state = IN_TAG_TYPE;
+        } else {
+          if (text.charAt(i) == '\n') {
+            filterLine(seenTag);
+          } else {
+            buf += text.charAt(i);
+          }
+        }
+      } else if (state == IN_TAG_TYPE) {
+        i += otag.length - 1;
+        tag = tagTypes[text.charAt(i + 1)];
+        tagType = tag ? text.charAt(i + 1) : '_v';
+        if (tagType == '=') {
+          i = changeDelimiters(text, i);
+          state = IN_TEXT;
+        } else {
+          if (tag) {
+            i++;
+          }
+          state = IN_TAG;
+        }
+        seenTag = i;
+      } else {
+        if (tagChange(ctag, text, i)) {
+          tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
+                       i: (tagType == '/') ? seenTag - ctag.length : i + otag.length});
+          buf = '';
+          i += ctag.length - 1;
+          state = IN_TEXT;
+          if (tagType == '{') {
+            if (ctag == '}}') {
+              i++;
+            } else {
+              cleanTripleStache(tokens[tokens.length - 1]);
+            }
+          }
+        } else {
+          buf += text.charAt(i);
+        }
+      }
+    }
+
+    filterLine(seenTag, true);
+
+    return tokens;
+  }
+
+  function cleanTripleStache(token) {
+    if (token.n.substr(token.n.length - 1) === '}') {
+      token.n = token.n.substring(0, token.n.length - 1);
+    }
+  }
+
+  function trim(s) {
+    if (s.trim) {
+      return s.trim();
+    }
+
+    return s.replace(/^\s*|\s*$/g, '');
+  }
+
+  function tagChange(tag, text, index) {
+    if (text.charAt(index) != tag.charAt(0)) {
+      return false;
+    }
+
+    for (var i = 1, l = tag.length; i < l; i++) {
+      if (text.charAt(index + i) != tag.charAt(i)) {
+        return false;
+      }
+    }
+
+    return true;
+  }
+
+  function buildTree(tokens, kind, stack, customTags) {
+    var instructions = [],
+        opener = null,
+        token = null;
+
+    while (tokens.length > 0) {
+      token = tokens.shift();
+      if (token.tag == '#' || token.tag == '^' || isOpener(token, customTags)) {
+        stack.push(token);
+        token.nodes = buildTree(tokens, token.tag, stack, customTags);
+        instructions.push(token);
+      } else if (token.tag == '/') {
+        if (stack.length === 0) {
+          throw new Error('Closing tag without opener: /' + token.n);
+        }
+        opener = stack.pop();
+        if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
+          throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
+        }
+        opener.end = token.i;
+        return instructions;
+      } else {
+        instructions.push(token);
+      }
+    }
+
+    if (stack.length > 0) {
+      throw new Error('missing closing tag: ' + stack.pop().n);
+    }
+
+    return instructions;
+  }
+
+  function isOpener(token, tags) {
+    for (var i = 0, l = tags.length; i < l; i++) {
+      if (tags[i].o == token.n) {
+        token.tag = '#';
+        return true;
+      }
+    }
+  }
+
+  function isCloser(close, open, tags) {
+    for (var i = 0, l = tags.length; i < l; i++) {
+      if (tags[i].c == close && tags[i].o == open) {
+        return true;
+      }
+    }
+  }
+
+  Hogan.generate = function (tree, text, options) {
+    var code = 'var _=this;_.b(i=i||"");' + walk(tree) + 'return _.fl();';
+    if (options.asString) {
+      return 'function(c,p,i){' + code + ';}';
+    }
+
+    return new Hogan.Template(new Function('c', 'p', 'i', code), text, Hogan, options);
+  }
+
+  function esc(s) {
+    return s.replace(rSlash, '\\\\')
+            .replace(rQuot, '\\\"')
+            .replace(rNewline, '\\n')
+            .replace(rCr, '\\r');
+  }
+
+  function chooseMethod(s) {
+    return (~s.indexOf('.')) ? 'd' : 'f';
+  }
+
+  function walk(tree) {
+    var code = '';
+    for (var i = 0, l = tree.length; i < l; i++) {
+      var tag = tree[i].tag;
+      if (tag == '#') {
+        code += section(tree[i].nodes, tree[i].n, chooseMethod(tree[i].n),
+                        tree[i].i, tree[i].end, tree[i].otag + " " + tree[i].ctag);
+      } else if (tag == '^') {
+        code += invertedSection(tree[i].nodes, tree[i].n,
+                                chooseMethod(tree[i].n));
+      } else if (tag == '<' || tag == '>') {
+        code += partial(tree[i]);
+      } else if (tag == '{' || tag == '&') {
+        code += tripleStache(tree[i].n, chooseMethod(tree[i].n));
+      } else if (tag == '\n') {
+        code += text('"\\n"' + (tree.length-1 == i ? '' : ' + i'));
+      } else if (tag == '_v') {
+        code += variable(tree[i].n, chooseMethod(tree[i].n));
+      } else if (tag === undefined) {
+        code += text('"' + esc(tree[i]) + '"');
+      }
+    }
+    return code;
+  }
+
+  function section(nodes, id, method, start, end, tags) {
+    return 'if(_.s(_.' + method + '("' + esc(id) + '",c,p,1),' +
+           'c,p,0,' + start + ',' + end + ',"' + tags + '")){' +
+           '_.rs(c,p,' +
+           'function(c,p,_){' +
+           walk(nodes) +
+           '});c.pop();}';
+  }
+
+  function invertedSection(nodes, id, method) {
+    return 'if(!_.s(_.' + method + '("' + esc(id) + '",c,p,1),c,p,1,0,0,"")){' +
+           walk(nodes) +
+           '};';
+  }
+
+  function partial(tok) {
+    return '_.b(_.rp("' +  esc(tok.n) + '",c,p,"' + (tok.indent || '') + '"));';
+  }
+
+  function tripleStache(id, method) {
+    return '_.b(_.t(_.' + method + '("' + esc(id) + '",c,p,0)));';
+  }
+
+  function variable(id, method) {
+    return '_.b(_.v(_.' + method + '("' + esc(id) + '",c,p,0)));';
+  }
+
+  function text(id) {
+    return '_.b(' + id + ');';
+  }
+
+  Hogan.parse = function(tokens, text, options) {
+    options = options || {};
+    return buildTree(tokens, '', [], options.sectionTags || []);
+  },
+
+  Hogan.cache = {};
+
+  Hogan.compile = function(text, options) {
+    // options
+    //
+    // asString: false (default)
+    //
+    // sectionTags: [{o: '_foo', c: 'foo'}]
+    // An array of object with o and c fields that indicate names for custom
+    // section tags. The example above allows parsing of {{_foo}}{{/foo}}.
+    //
+    // delimiters: A string that overrides the default delimiters.
+    // Example: "<% %>"
+    //
+    options = options || {};
+
+    var key = text + '||' + !!options.asString;
+
+    var t = this.cache[key];
+
+    if (t) {
+      return t;
+    }
+
+    t = this.generate(this.parse(this.scan(text, options.delimiters), text, options), text, options);
+    return this.cache[key] = t;
+  };
+})(typeof exports !== 'undefined' ? exports : Hogan);

File diff ditekan karena terlalu besar
+ 0 - 0
inc/wp-typeahead/js/hogan.min.js


+ 1081 - 0
inc/wp-typeahead/js/typeahead.js

@@ -0,0 +1,1081 @@
+/*!
+ * typeahead.js 0.9.0
+ * https://github.com/twitter/typeahead
+ * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT
+ */
+
+(function($) {
+    var VERSION = "0.9.0";
+    var utils = {
+        isMsie: function() {
+            var match = /(msie) ([\w.]+)/i.exec(navigator.userAgent);
+            return match ? parseInt(match[2], 10) : false;
+        },
+        isBlankString: function(str) {
+            return !str || /^\s*$/.test(str);
+        },
+        escapeRegExChars: function(str) {
+            return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
+        },
+        isString: function(obj) {
+            return typeof obj === "string";
+        },
+        isNumber: function(obj) {
+            return typeof obj === "number";
+        },
+        isArray: $.isArray,
+        isFunction: $.isFunction,
+        isObject: $.isPlainObject,
+        isUndefined: function(obj) {
+            return typeof obj === "undefined";
+        },
+        bind: $.proxy,
+        bindAll: function(obj) {
+            var val;
+            for (var key in obj) {
+                $.isFunction(val = obj[key]) && (obj[key] = $.proxy(val, obj));
+            }
+        },
+        indexOf: function(haystack, needle) {
+            for (var i = 0; i < haystack.length; i++) {
+                if (haystack[i] === needle) {
+                    return i;
+                }
+            }
+            return -1;
+        },
+        each: $.each,
+        map: $.map,
+        filter: $.grep,
+        every: function(obj, test) {
+            var result = true;
+            if (!obj) {
+                return result;
+            }
+            $.each(obj, function(key, val) {
+                if (!(result = test.call(null, val, key, obj))) {
+                    return false;
+                }
+            });
+            return !!result;
+        },
+        some: function(obj, test) {
+            var result = false;
+            if (!obj) {
+                return result;
+            }
+            $.each(obj, function(key, val) {
+                if (result = test.call(null, val, key, obj)) {
+                    return false;
+                }
+            });
+            return !!result;
+        },
+        mixin: $.extend,
+        getUniqueId: function() {
+            var counter = 0;
+            return function() {
+                return counter++;
+            };
+        }(),
+        defer: function(fn) {
+            setTimeout(fn, 0);
+        },
+        debounce: function(func, wait, immediate) {
+            var timeout, result;
+            return function() {
+                var context = this, args = arguments, later, callNow;
+                later = function() {
+                    timeout = null;
+                    if (!immediate) {
+                        result = func.apply(context, args);
+                    }
+                };
+                callNow = immediate && !timeout;
+                clearTimeout(timeout);
+                timeout = setTimeout(later, wait);
+                if (callNow) {
+                    result = func.apply(context, args);
+                }
+                return result;
+            };
+        },
+        throttle: function(func, wait) {
+            var context, args, timeout, result, previous, later;
+            previous = 0;
+            later = function() {
+                previous = new Date();
+                timeout = null;
+                result = func.apply(context, args);
+            };
+            return function() {
+                var now = new Date(), remaining = wait - (now - previous);
+                context = this;
+                args = arguments;
+                if (remaining <= 0) {
+                    clearTimeout(timeout);
+                    timeout = null;
+                    previous = now;
+                    result = func.apply(context, args);
+                } else if (!timeout) {
+                    timeout = setTimeout(later, remaining);
+                }
+                return result;
+            };
+        },
+        tokenizeQuery: function(str) {
+            return $.trim(str).toLowerCase().split(/[\s]+/);
+        },
+        tokenizeText: function(str) {
+            return $.trim(str).toLowerCase().split(/[\s\-_]+/);
+        },
+        getProtocol: function() {
+            return location.protocol;
+        },
+        noop: function() {}
+    };
+    var EventTarget = function() {
+        var eventSplitter = /\s+/;
+        return {
+            on: function(events, callback) {
+                var event;
+                if (!callback) {
+                    return this;
+                }
+                this._callbacks = this._callbacks || {};
+                events = events.split(eventSplitter);
+                while (event = events.shift()) {
+                    this._callbacks[event] = this._callbacks[event] || [];
+                    this._callbacks[event].push(callback);
+                }
+                return this;
+            },
+            trigger: function(events, data) {
+                var event, callbacks;
+                if (!this._callbacks) {
+                    return this;
+                }
+                events = events.split(eventSplitter);
+                while (event = events.shift()) {
+                    if (callbacks = this._callbacks[event]) {
+                        for (var i = 0; i < callbacks.length; i += 1) {
+                            callbacks[i].call(this, {
+                                type: event,
+                                data: data
+                            });
+                        }
+                    }
+                }
+                return this;
+            }
+        };
+    }();
+    var EventBus = function() {
+        var namespace = "typeahead:";
+        function EventBus(o) {
+            if (!o || !o.el) {
+                $.error("EventBus initialized without el");
+            }
+            this.$el = $(o.el);
+        }
+        utils.mixin(EventBus.prototype, {
+            trigger: function(type) {
+                var args = [].slice.call(arguments, 1);
+                this.$el.trigger(namespace + type, args);
+            }
+        });
+        return EventBus;
+    }();
+    var PersistentStorage = function() {
+        var ls = window.localStorage, methods;
+        function PersistentStorage(namespace) {
+            this.prefix = [ "__", namespace, "__" ].join("");
+            this.ttlKey = "__ttl__";
+            this.keyMatcher = new RegExp("^" + this.prefix);
+        }
+        if (window.localStorage && window.JSON) {
+            methods = {
+                _prefix: function(key) {
+                    return this.prefix + key;
+                },
+                _ttlKey: function(key) {
+                    return this._prefix(key) + this.ttlKey;
+                },
+                get: function(key) {
+                    if (this.isExpired(key)) {
+                        this.remove(key);
+                    }
+                    return decode(ls.getItem(this._prefix(key)));
+                },
+                set: function(key, val, ttl) {
+                    if (utils.isNumber(ttl)) {
+                        ls.setItem(this._ttlKey(key), encode(now() + ttl));
+                    } else {
+                        ls.removeItem(this._ttlKey(key));
+                    }
+                    return ls.setItem(this._prefix(key), encode(val));
+                },
+                remove: function(key) {
+                    ls.removeItem(this._ttlKey(key));
+                    ls.removeItem(this._prefix(key));
+                    return this;
+                },
+                clear: function() {
+                    var i, key, keys = [], len = ls.length;
+                    for (i = 0; i < len; i++) {
+                        if ((key = ls.key(i)).match(this.keyMatcher)) {
+                            keys.push(key.replace(this.keyMatcher, ""));
+                        }
+                    }
+                    for (i = keys.length; i--; ) {
+                        this.remove(keys[i]);
+                    }
+                    return this;
+                },
+                isExpired: function(key) {
+                    var ttl = decode(ls.getItem(this._ttlKey(key)));
+                    return utils.isNumber(ttl) && now() > ttl ? true : false;
+                }
+            };
+        } else {
+            methods = {
+                get: utils.noop,
+                set: utils.noop,
+                remove: utils.noop,
+                clear: utils.noop,
+                isExpired: utils.noop
+            };
+        }
+        utils.mixin(PersistentStorage.prototype, methods);
+        return PersistentStorage;
+        function now() {
+            return new Date().getTime();
+        }
+        function encode(val) {
+            return JSON.stringify(utils.isUndefined(val) ? null : val);
+        }
+        function decode(val) {
+            return JSON.parse(val);
+        }
+    }();
+    var RequestCache = function() {
+        function RequestCache(o) {
+            utils.bindAll(this);
+            o = o || {};
+            this.sizeLimit = o.sizeLimit || 10;
+            this.cache = {};
+            this.cachedKeysByAge = [];
+        }
+        utils.mixin(RequestCache.prototype, {
+            get: function(url) {
+                return this.cache[url];
+            },
+            set: function(url, resp) {
+                var requestToEvict;
+                if (this.cachedKeysByAge.length === this.sizeLimit) {
+                    requestToEvict = this.cachedKeysByAge.shift();
+                    delete this.cache[requestToEvict];
+                }
+                this.cache[url] = resp;
+                this.cachedKeysByAge.push(url);
+            }
+        });
+        return RequestCache;
+    }();
+    var Transport = function() {
+        var pendingRequests = 0, maxParallelRequests, requestCache;
+        function Transport(o) {
+            utils.bindAll(this);
+            o = utils.isString(o) ? {
+                url: o
+            } : o;
+            requestCache = requestCache || new RequestCache();
+            maxParallelRequests = utils.isNumber(o.maxParallelRequests) ? o.maxParallelRequests : maxParallelRequests || 6;
+            this.url = o.url;
+            this.wildcard = o.wildcard || "%QUERY";
+            this.filter = o.filter;
+            this.replace = o.replace;
+            this.ajaxSettings = {
+                type: "get",
+                cache: o.cache,
+                timeout: o.timeout,
+                dataType: o.dataType || "json",
+                beforeSend: o.beforeSend
+            };
+            this.get = (/^throttle$/i.test(o.rateLimitFn) ? utils.throttle : utils.debounce)(this.get, o.rateLimitWait || 300);
+        }
+        utils.mixin(Transport.prototype, {
+            get: function(query, cb) {
+                var that = this, encodedQuery = encodeURIComponent(query || ""), url, resp;
+                url = this.replace ? this.replace(this.url, encodedQuery) : this.url.replace(this.wildcard, encodedQuery);
+                if (resp = requestCache.get(url)) {
+                    cb && cb(resp);
+                } else if (belowPendingRequestsThreshold()) {
+                    incrementPendingRequests();
+                    $.ajax(url, this.ajaxSettings).done(done).always(always);
+                } else {
+                    this.onDeckRequestArgs = [].slice.call(arguments, 0);
+                }
+                function done(resp) {
+                    resp = that.filter ? that.filter(resp) : resp;
+                    cb && cb(resp);
+                    requestCache.set(url, resp);
+                }
+                function always() {
+                    decrementPendingRequests();
+                    if (that.onDeckRequestArgs) {
+                        that.get.apply(that, that.onDeckRequestArgs);
+                        that.onDeckRequestArgs = null;
+                    }
+                }
+            }
+        });
+        return Transport;
+        function incrementPendingRequests() {
+            pendingRequests++;
+        }
+        function decrementPendingRequests() {
+            pendingRequests--;
+        }
+        function belowPendingRequestsThreshold() {
+            return pendingRequests < maxParallelRequests;
+        }
+    }();
+    var Dataset = function() {
+        function Dataset(o) {
+            utils.bindAll(this);
+            if (o.template && !o.engine) {
+                $.error("no template engine specified");
+            }
+            if (!o.local && !o.prefetch && !o.remote) {
+                $.error("one of local, prefetch, or remote is requried");
+            }
+            this.name = o.name || utils.getUniqueId();
+            this.limit = o.limit || 5;
+            this.header = o.header;
+            this.footer = o.footer;
+            this.valueKey = o.valueKey || "value";
+            this.template = compileTemplate(o.template, o.engine, this.valueKey);
+            this.local = o.local;
+            this.prefetch = o.prefetch;
+            this.remote = o.remote;
+            this.keys = {
+                version: "version",
+                protocol: "protocol",
+                itemHash: "itemHash",
+                adjacencyList: "adjacencyList"
+            };
+            this.itemHash = {};
+            this.adjacencyList = {};
+            this.storage = o.name ? new PersistentStorage(o.name) : null;
+        }
+        utils.mixin(Dataset.prototype, {
+            _processLocalData: function(data) {
+                this._mergeProcessedData(this._processData(data));
+            },
+            _loadPrefetchData: function(o) {
+                var that = this, deferred, version, protocol, itemHash, adjacencyList, isExpired;
+                if (this.storage) {
+                    version = this.storage.get(this.keys.version);
+                    protocol = this.storage.get(this.keys.protocol);
+                    itemHash = this.storage.get(this.keys.itemHash);
+                    adjacencyList = this.storage.get(this.keys.adjacencyList);
+                    isExpired = version !== VERSION || protocol !== utils.getProtocol();
+                }
+                o = utils.isString(o) ? {
+                    url: o
+                } : o;
+                o.ttl = utils.isNumber(o.ttl) ? o.ttl : 24 * 60 * 60 * 1e3;
+                if (itemHash && adjacencyList && !isExpired) {
+                    this._mergeProcessedData({
+                        itemHash: itemHash,
+                        adjacencyList: adjacencyList
+                    });
+                    deferred = $.Deferred().resolve();
+                } else {
+                    deferred = $.getJSON(o.url).done(processPrefetchData);
+                }
+                return deferred;
+                function processPrefetchData(data) {
+                    var filteredData = o.filter ? o.filter(data) : data, processedData = that._processData(filteredData), itemHash = processedData.itemHash, adjacencyList = processedData.adjacencyList;
+                    if (that.storage) {
+                        that.storage.set(that.keys.itemHash, itemHash, o.ttl);
+                        that.storage.set(that.keys.adjacencyList, adjacencyList, o.ttl);
+                        that.storage.set(that.keys.version, VERSION, o.ttl);
+                        that.storage.set(that.keys.protocol, utils.getProtocol(), o.ttl);
+                    }
+                    that._mergeProcessedData(processedData);
+                }
+            },
+            _transformDatum: function(datum) {
+                var value = utils.isString(datum) ? datum : datum[this.valueKey], tokens = datum.tokens || utils.tokenizeText(value), item = {
+                    value: value,
+                    tokens: tokens
+                };
+                if (utils.isString(datum)) {
+                    item.datum = {};
+                    item.datum[this.valueKey] = datum;
+                } else {
+                    item.datum = datum;
+                }
+                item.tokens = utils.filter(item.tokens, function(token) {
+                    return !utils.isBlankString(token);
+                });
+                item.tokens = utils.map(item.tokens, function(token) {
+                    return token.toLowerCase();
+                });
+                return item;
+            },
+            _processData: function(data) {
+                var that = this, itemHash = {}, adjacencyList = {};
+                utils.each(data, function(i, datum) {
+                    var item = that._transformDatum(datum), id = utils.getUniqueId(item.value);
+                    itemHash[id] = item;
+                    utils.each(item.tokens, function(i, token) {
+                        var character = token.charAt(0), adjacency = adjacencyList[character] || (adjacencyList[character] = [ id ]);
+                        !~utils.indexOf(adjacency, id) && adjacency.push(id);
+                    });
+                });
+                return {
+                    itemHash: itemHash,
+                    adjacencyList: adjacencyList
+                };
+            },
+            _mergeProcessedData: function(processedData) {
+                var that = this;
+                utils.mixin(this.itemHash, processedData.itemHash);
+                utils.each(processedData.adjacencyList, function(character, adjacency) {
+                    var masterAdjacency = that.adjacencyList[character];
+                    that.adjacencyList[character] = masterAdjacency ? masterAdjacency.concat(adjacency) : adjacency;
+                });
+            },
+            _getLocalSuggestions: function(terms) {
+                var that = this, firstChars = [], lists = [], shortestList, suggestions = [];
+                utils.each(terms, function(i, term) {
+                    var firstChar = term.charAt(0);
+                    !~utils.indexOf(firstChars, firstChar) && firstChars.push(firstChar);
+                });
+                utils.each(firstChars, function(i, firstChar) {
+                    var list = that.adjacencyList[firstChar];
+                    if (!list) {
+                        return false;
+                    }
+                    lists.push(list);
+                    if (!shortestList || list.length < shortestList.length) {
+                        shortestList = list;
+                    }
+                });
+                if (lists.length < firstChars.length) {
+                    return [];
+                }
+                utils.each(shortestList, function(i, id) {
+                    var item = that.itemHash[id], isCandidate, isMatch;
+                    isCandidate = utils.every(lists, function(list) {
+                        return ~utils.indexOf(list, id);
+                    });
+                    isMatch = isCandidate && utils.every(terms, function(term) {
+                        return utils.some(item.tokens, function(token) {
+                            return token.indexOf(term) === 0;
+                        });
+                    });
+                    isMatch && suggestions.push(item);
+                });
+                return suggestions;
+            },
+            initialize: function() {
+                var deferred;
+                this.local && this._processLocalData(this.local);
+                this.transport = this.remote ? new Transport(this.remote) : null;
+                deferred = this.prefetch ? this._loadPrefetchData(this.prefetch) : $.Deferred().resolve();
+                this.local = this.prefetch = this.remote = null;
+                this.initialize = function() {
+                    return deferred;
+                };
+                return deferred;
+            },
+            getSuggestions: function(query, cb) {
+                var that = this, terms = utils.tokenizeQuery(query), suggestions = this._getLocalSuggestions(terms).slice(0, this.limit);
+                cb && cb(suggestions);
+                if (suggestions.length < this.limit && this.transport) {
+                    this.transport.get(query, processRemoteData);
+                }
+                function processRemoteData(data) {
+                    suggestions = suggestions.slice(0);
+                    utils.each(data, function(i, datum) {
+                        var item = that._transformDatum(datum), isDuplicate;
+                        isDuplicate = utils.some(suggestions, function(suggestion) {
+                            return item.value === suggestion.value;
+                        });
+                        !isDuplicate && suggestions.push(item);
+                        return suggestions.length < that.limit;
+                    });
+                    cb && cb(suggestions);
+                }
+            }
+        });
+        return Dataset;
+        function compileTemplate(template, engine, valueKey) {
+            var wrapper = '<div class="tt-suggestion">%body</div>', compiledTemplate;
+            if (template) {
+                compiledTemplate = engine.compile(wrapper.replace("%body", template));
+            } else {
+                compiledTemplate = {
+                    render: function(context) {
+                        return wrapper.replace("%body", "<p>" + context[valueKey] + "</p>");
+                    }
+                };
+            }
+            return compiledTemplate;
+        }
+    }();
+    var InputView = function() {
+        function InputView(o) {
+            var that = this;
+            utils.bindAll(this);
+            this.specialKeyCodeMap = {
+                9: "tab",
+                27: "esc",
+                37: "left",
+                39: "right",
+                13: "enter",
+                38: "up",
+                40: "down"
+            };
+            this.$hint = $(o.hint);
+            this.$input = $(o.input).on("blur.tt", this._handleBlur).on("focus.tt", this._handleFocus).on("keydown.tt", this._handleSpecialKeyEvent);
+            if (!utils.isMsie()) {
+                this.$input.on("input.tt", this._compareQueryToInputValue);
+            } else {
+                this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function($e) {
+                    if (that.specialKeyCodeMap[$e.which || $e.keyCode]) {
+                        return;
+                    }
+                    utils.defer(that._compareQueryToInputValue);
+                });
+            }
+            this.query = this.$input.val();
+            this.$overflowHelper = buildOverflowHelper(this.$input);
+        }
+        utils.mixin(InputView.prototype, EventTarget, {
+            _handleFocus: function() {
+                this.trigger("focused");
+            },
+            _handleBlur: function() {
+                this.trigger("blured");
+            },
+            _handleSpecialKeyEvent: function($e) {
+                var keyName = this.specialKeyCodeMap[$e.which || $e.keyCode];
+                keyName && this.trigger(keyName + "Keyed", $e);
+            },
+            _compareQueryToInputValue: function() {
+                var inputValue = this.getInputValue(), isSameQuery = compareQueries(this.query, inputValue), isSameQueryExceptWhitespace = isSameQuery ? this.query.length !== inputValue.length : false;
+                if (isSameQueryExceptWhitespace) {
+                    this.trigger("whitespaceChanged", {
+                        value: this.query
+                    });
+                } else if (!isSameQuery) {
+                    this.trigger("queryChanged", {
+                        value: this.query = inputValue
+                    });
+                }
+            },
+            destroy: function() {
+                this.$hint.off(".tt");
+                this.$input.off(".tt");
+                this.$hint = this.$input = this.$overflowHelper = null;
+            },
+            focus: function() {
+                this.$input.focus();
+            },
+            blur: function() {
+                this.$input.blur();
+            },
+            getQuery: function() {
+                return this.query;
+            },
+            getInputValue: function() {
+                return this.$input.val();
+            },
+            setInputValue: function(value, silent) {
+                this.$input.val(value);
+                if (silent !== true) {
+                    this._compareQueryToInputValue();
+                }
+            },
+            getHintValue: function() {
+                return this.$hint.val();
+            },
+            setHintValue: function(value) {
+                this.$hint.val(value);
+            },
+            getLanguageDirection: function() {
+                return (this.$input.css("direction") || "ltr").toLowerCase();
+            },
+            isOverflow: function() {
+                this.$overflowHelper.text(this.getInputValue());
+                return this.$overflowHelper.width() > this.$input.width();
+            },
+            isCursorAtEnd: function() {
+                var valueLength = this.$input.val().length, selectionStart = this.$input[0].selectionStart, range;
+                if (utils.isNumber(selectionStart)) {
+                    return selectionStart === valueLength;
+                } else if (document.selection) {
+                    range = document.selection.createRange();
+                    range.moveStart("character", -valueLength);
+                    return valueLength === range.text.length;
+                }
+                return true;
+            }
+        });
+        return InputView;
+        function buildOverflowHelper($input) {
+            return $("<span></span>").css({
+                position: "absolute",
+                left: "-9999px",
+                visibility: "hidden",
+                whiteSpace: "nowrap",
+                fontFamily: $input.css("font-family"),
+                fontSize: $input.css("font-size"),
+                fontStyle: $input.css("font-style"),
+                fontVariant: $input.css("font-variant"),
+                fontWeight: $input.css("font-weight"),
+                wordSpacing: $input.css("word-spacing"),
+                letterSpacing: $input.css("letter-spacing"),
+                textIndent: $input.css("text-indent"),
+                textRendering: $input.css("text-rendering"),
+                textTransform: $input.css("text-transform")
+            }).insertAfter($input);
+        }
+        function compareQueries(a, b) {
+            a = (a || "").replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
+            b = (b || "").replace(/^\s*/g, "").replace(/\s{2,}/g, " ");
+            return a === b;
+        }
+    }();
+    var DropdownView = function() {
+        var html = {
+            suggestionsList: '<span class="tt-suggestions"></span>'
+        }, css = {
+            suggestionsList: {
+                display: "block"
+            },
+            suggestion: {
+                whiteSpace: "nowrap",
+                cursor: "pointer"
+            },
+            suggestionChild: {
+                whiteSpace: "normal"
+            }
+        };
+        function DropdownView(o) {
+            utils.bindAll(this);
+            this.isOpen = false;
+            this.isEmpty = true;
+            this.isMouseOverDropdown = false;
+            this.$menu = $(o.menu).on("mouseenter.tt", this._handleMouseenter).on("mouseleave.tt", this._handleMouseleave).on("click.tt", ".tt-suggestion", this._handleSelection).on("mouseover.tt", ".tt-suggestion", this._handleMouseover);
+        }
+        utils.mixin(DropdownView.prototype, EventTarget, {
+            _handleMouseenter: function() {
+                this.isMouseOverDropdown = true;
+            },
+            _handleMouseleave: function() {
+                this.isMouseOverDropdown = false;
+            },
+            _handleMouseover: function($e) {
+                var $suggestion = $($e.currentTarget);
+                this._getSuggestions().removeClass("tt-is-under-cursor");
+                $suggestion.addClass("tt-is-under-cursor");
+            },
+            _handleSelection: function($e) {
+                var $suggestion = $($e.currentTarget);
+                this.trigger("suggestionSelected", extractSuggestion($suggestion));
+            },
+            _show: function() {
+                this.$menu.css("display", "block");
+            },
+            _hide: function() {
+                this.$menu.hide();
+            },
+            _moveCursor: function(increment) {
+                var $suggestions, $cur, nextIndex, $underCursor;
+                if (!this.isVisible()) {
+                    return;
+                }
+                $suggestions = this._getSuggestions();
+                $cur = $suggestions.filter(".tt-is-under-cursor");
+                $cur.removeClass("tt-is-under-cursor");
+                nextIndex = $suggestions.index($cur) + increment;
+                nextIndex = (nextIndex + 1) % ($suggestions.length + 1) - 1;
+                if (nextIndex === -1) {
+                    this.trigger("cursorRemoved");
+                    return;
+                } else if (nextIndex < -1) {
+                    nextIndex = $suggestions.length - 1;
+                }
+                $underCursor = $suggestions.eq(nextIndex).addClass("tt-is-under-cursor");
+                this.trigger("cursorMoved", extractSuggestion($underCursor));
+            },
+            _getSuggestions: function() {
+                return this.$menu.find(".tt-suggestions > .tt-suggestion");
+            },
+            destroy: function() {
+                this.$menu.off(".tt");
+                this.$menu = null;
+            },
+            isVisible: function() {
+                return this.isOpen && !this.isEmpty;
+            },
+            closeUnlessMouseIsOverDropdown: function() {
+                if (!this.isMouseOverDropdown) {
+                    this.close();
+                }
+            },
+            close: function() {
+                if (this.isOpen) {
+                    this.isOpen = false;
+                    this._hide();
+                    this.$menu.find(".tt-suggestions > .tt-suggestion").removeClass("tt-is-under-cursor");
+                    this.trigger("closed");
+                }
+            },
+            open: function() {
+                if (!this.isOpen) {
+                    this.isOpen = true;
+                    !this.isEmpty && this._show();
+                    this.trigger("opened");
+                }
+            },
+            setLanguageDirection: function(dir) {
+                var ltrCss = {
+                    left: "0",
+                    right: "auto"
+                }, rtlCss = {
+                    left: "auto",
+                    right: " 0"
+                };
+                dir === "ltr" ? this.$menu.css(ltrCss) : this.$menu.css(rtlCss);
+            },
+            moveCursorUp: function() {
+                this._moveCursor(-1);
+            },
+            moveCursorDown: function() {
+                this._moveCursor(+1);
+            },
+            getSuggestionUnderCursor: function() {
+                var $suggestion = this._getSuggestions().filter(".tt-is-under-cursor").first();
+                return $suggestion.length > 0 ? extractSuggestion($suggestion) : null;
+            },
+            getFirstSuggestion: function() {
+                var $suggestion = this._getSuggestions().first();
+                return $suggestion.length > 0 ? extractSuggestion($suggestion) : null;
+            },
+            renderSuggestions: function(dataset, suggestions) {
+                var datasetClassName = "tt-dataset-" + dataset.name, $suggestionsList, $dataset = this.$menu.find("." + datasetClassName), elBuilder, fragment, $el;
+                if ($dataset.length === 0) {
+                    $suggestionsList = $(html.suggestionsList).css(css.suggestionsList);
+                    $dataset = $("<div></div>").addClass(datasetClassName).append(dataset.header).append($suggestionsList).append(dataset.footer).appendTo(this.$menu);
+                }
+                if (suggestions.length > 0) {
+                    this.isEmpty = false;
+                    this.isOpen && this._show();
+                    elBuilder = document.createElement("div");
+                    fragment = document.createDocumentFragment();
+                    utils.each(suggestions, function(i, suggestion) {
+                        elBuilder.innerHTML = dataset.template.render(suggestion.datum);
+                        $el = $(elBuilder.firstChild).css(css.suggestion).data("suggestion", suggestion);
+                        $el.children().each(function() {
+                            $(this).css(css.suggestionChild);
+                        });
+                        fragment.appendChild($el[0]);
+                    });
+                    $dataset.show().find(".tt-suggestions").html(fragment);
+                } else {
+                    this.clearSuggestions(dataset.name);
+                }
+                this.trigger("suggestionsRendered");
+            },
+            clearSuggestions: function(datasetName) {
+                var $datasets = datasetName ? this.$menu.find(".tt-dataset-" + datasetName) : this.$menu.find('[class^="tt-dataset-"]'), $suggestions = $datasets.find(".tt-suggestions");
+                $datasets.hide();
+                $suggestions.empty();
+                if (this._getSuggestions().length === 0) {
+                    this.isEmpty = true;
+                    this._hide();
+                }
+            }
+        });
+        return DropdownView;
+        function extractSuggestion($el) {
+            return $el.data("suggestion");
+        }
+    }();
+    var TypeaheadView = function() {
+        var html = {
+            wrapper: '<span class="twitter-typeahead"></span>',
+            hint: '<input class="tt-hint" type="text" autocomplete="off" spellcheck="off" disabled>',
+            dropdown: '<span class="tt-dropdown-menu"></span>'
+        }, css = {
+            wrapper: {
+                position: "relative",
+                display: "inline-block"
+            },
+            hint: {
+                position: "absolute",
+                top: "0",
+                left: "0",
+                borderColor: "transparent",
+                boxShadow: "none"
+            },
+            query: {
+                position: "relative",
+                verticalAlign: "top",
+                backgroundColor: "transparent"
+            },
+            dropdown: {
+                position: "absolute",
+                top: "100%",
+                left: "0",
+                zIndex: "100",
+                display: "none"
+            }
+        };
+        if (utils.isMsie()) {
+            utils.mixin(css.query, {
+                backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"
+            });
+        }
+        if (utils.isMsie() && utils.isMsie() <= 7) {
+            utils.mixin(css.wrapper, {
+                display: "inline",
+                zoom: "1"
+            });
+            utils.mixin(css.query, {
+                marginTop: "-1px"
+            });
+        }
+        function TypeaheadView(o) {
+            var $menu, $input, $hint;
+            utils.bindAll(this);
+            this.$node = buildDomStructure(o.input);
+            this.datasets = o.datasets;
+            this.dir = null;
+            this.eventBus = o.eventBus;
+            $menu = this.$node.find(".tt-dropdown-menu");
+            $input = this.$node.find(".tt-query");
+            $hint = this.$node.find(".tt-hint");
+            this.dropdownView = new DropdownView({
+                menu: $menu
+            }).on("suggestionSelected", this._handleSelection).on("cursorMoved", this._clearHint).on("cursorMoved", this._setInputValueToSuggestionUnderCursor).on("cursorRemoved", this._setInputValueToQuery).on("cursorRemoved", this._updateHint).on("suggestionsRendered", this._updateHint).on("opened", this._updateHint).on("closed", this._clearHint).on("opened closed", this._propagateEvent);
+            this.inputView = new InputView({
+                input: $input,
+                hint: $hint
+            }).on("focused", this._openDropdown).on("blured", this._closeDropdown).on("blured", this._setInputValueToQuery).on("enterKeyed", this._handleSelection).on("queryChanged", this._clearHint).on("queryChanged", this._clearSuggestions).on("queryChanged", this._getSuggestions).on("whitespaceChanged", this._updateHint).on("queryChanged whitespaceChanged", this._openDropdown).on("queryChanged whitespaceChanged", this._setLanguageDirection).on("escKeyed", this._closeDropdown).on("escKeyed", this._setInputValueToQuery).on("tabKeyed upKeyed downKeyed", this._managePreventDefault).on("upKeyed downKeyed", this._moveDropdownCursor).on("upKeyed downKeyed", this._openDropdown).on("tabKeyed leftKeyed rightKeyed", this._autocomplete);
+        }
+        utils.mixin(TypeaheadView.prototype, EventTarget, {
+            _managePreventDefault: function(e) {
+                var $e = e.data, hint, inputValue, preventDefault = false;
+                switch (e.type) {
+                  case "tabKeyed":
+                    hint = this.inputView.getHintValue();
+                    inputValue = this.inputView.getInputValue();
+                    preventDefault = hint && hint !== inputValue;
+                    break;
+
+                  case "upKeyed":
+                  case "downKeyed":
+                    preventDefault = !$e.shiftKey && !$e.ctrlKey && !$e.metaKey;
+                    break;
+                }
+                preventDefault && $e.preventDefault();
+            },
+            _setLanguageDirection: function() {
+                var dir = this.inputView.getLanguageDirection();
+                if (dir !== this.dir) {
+                    this.dir = dir;
+                    this.$node.css("direction", dir);
+                    this.dropdownView.setLanguageDirection(dir);
+                }
+            },
+            _updateHint: function() {
+                var suggestion = this.dropdownView.getFirstSuggestion(), hint = suggestion ? suggestion.value : null, dropdownIsVisible = this.dropdownView.isVisible(), inputHasOverflow = this.inputView.isOverflow(), inputValue, query, escapedQuery, beginsWithQuery, match;
+                if (hint && dropdownIsVisible && !inputHasOverflow) {
+                    inputValue = this.inputView.getInputValue();
+                    query = inputValue.replace(/\s{2,}/g, " ").replace(/^\s+/g, "");
+                    escapedQuery = utils.escapeRegExChars(query);
+                    beginsWithQuery = new RegExp("^(?:" + escapedQuery + ")(.*$)", "i");
+                    match = beginsWithQuery.exec(hint);
+                    this.inputView.setHintValue(inputValue + (match ? match[1] : ""));
+                }
+            },
+            _clearHint: function() {
+                this.inputView.setHintValue("");
+            },
+            _clearSuggestions: function() {
+                this.dropdownView.clearSuggestions();
+            },
+            _setInputValueToQuery: function() {
+                this.inputView.setInputValue(this.inputView.getQuery());
+            },
+            _setInputValueToSuggestionUnderCursor: function(e) {
+                var suggestion = e.data;
+                this.inputView.setInputValue(suggestion.value, true);
+            },
+            _openDropdown: function() {
+                this.dropdownView.open();
+            },
+            _closeDropdown: function(e) {
+                this.dropdownView[e.type === "blured" ? "closeUnlessMouseIsOverDropdown" : "close"]();
+            },
+            _moveDropdownCursor: function(e) {
+                var $e = e.data;
+                if (!$e.shiftKey && !$e.ctrlKey && !$e.metaKey) {
+                    this.dropdownView[e.type === "upKeyed" ? "moveCursorUp" : "moveCursorDown"]();
+                }
+            },
+            _handleSelection: function(e) {
+                var byClick = e.type === "suggestionSelected", suggestion = byClick ? e.data : this.dropdownView.getSuggestionUnderCursor();
+                if (suggestion) {
+                    this.inputView.setInputValue(suggestion.value);
+                    byClick ? this.inputView.focus() : e.data.preventDefault();
+                    byClick && utils.isMsie() ? utils.defer(this.dropdownView.close) : this.dropdownView.close();
+                    this.eventBus.trigger("selected", suggestion.datum);
+                }
+            },
+            _getSuggestions: function() {
+                var that = this, query = this.inputView.getQuery();
+                if (utils.isBlankString(query)) {
+                    return;
+                }
+                utils.each(this.datasets, function(i, dataset) {
+                    dataset.getSuggestions(query, function(suggestions) {
+                        if (query === that.inputView.getQuery()) {
+                            that.dropdownView.renderSuggestions(dataset, suggestions);
+                        }
+                    });
+                });
+            },
+            _autocomplete: function(e) {
+                var isCursorAtEnd, ignoreEvent, query, hint, suggestion;
+                if (e.type === "rightKeyed" || e.type === "leftKeyed") {
+                    isCursorAtEnd = this.inputView.isCursorAtEnd();
+                    ignoreEvent = this.inputView.getLanguageDirection() === "ltr" ? e.type === "leftKeyed" : e.type === "rightKeyed";
+                    if (!isCursorAtEnd || ignoreEvent) {
+                        return;
+                    }
+                }
+                query = this.inputView.getQuery();
+                hint = this.inputView.getHintValue();
+                if (hint !== "" && query !== hint) {
+                    suggestion = this.dropdownView.getFirstSuggestion();
+                    this.inputView.setInputValue(suggestion.value);
+                }
+            },
+            _propagateEvent: function(e) {
+                this.eventBus.trigger(e.type);
+            },
+            destroy: function() {
+                this.inputView.destroy();
+                this.dropdownView.destroy();
+                destroyDomStructure(this.$node);
+                this.$node = null;
+            }
+        });
+        return TypeaheadView;
+        function buildDomStructure(input) {
+            var $wrapper = $(html.wrapper), $dropdown = $(html.dropdown), $input = $(input), $hint = $(html.hint);
+            $wrapper = $wrapper.css(css.wrapper);
+            $dropdown = $dropdown.css(css.dropdown);
+            $hint.css(css.hint).css({
+                backgroundAttachment: $input.css("background-attachment"),
+                backgroundClip: $input.css("background-clip"),
+                backgroundColor: $input.css("background-color"),
+                backgroundImage: $input.css("background-image"),
+                backgroundOrigin: $input.css("background-origin"),
+                backgroundPosition: $input.css("background-position"),
+                backgroundRepeat: $input.css("background-repeat"),
+                backgroundSize: $input.css("background-size")
+            });
+            $input.data("ttAttrs", {
+                dir: $input.attr("dir"),
+                autocomplete: $input.attr("autocomplete"),
+                spellcheck: $input.attr("spellcheck"),
+                style: $input.attr("style")
+            });
+            $input.addClass("tt-query").attr({
+                autocomplete: "off",
+                spellcheck: false
+            }).css(css.query);
+            try {
+                !$input.attr("dir") && $input.attr("dir", "auto");
+            } catch (e) {}
+            return $input.wrap($wrapper).parent().prepend($hint).append($dropdown);
+        }
+        function destroyDomStructure($node) {
+            var $input = $node.find(".tt-query");
+            utils.each($input.data("ttAttrs"), function(key, val) {
+                utils.isUndefined(val) ? $input.removeAttr(key) : $input.attr(key, val);
+            });
+            $input.detach().removeData("ttAttrs").removeClass("tt-query").insertAfter($node);
+            $node.remove();
+        }
+    }();
+    (function() {
+        var cache = {}, viewKey = "ttView", methods;
+        methods = {
+            initialize: function(datasetDefs) {
+                var datasets;
+                datasetDefs = utils.isArray(datasetDefs) ? datasetDefs : [ datasetDefs ];
+                if (this.length === 0) {
+                    $.error("typeahead initialized without DOM element");
+                }
+                if (datasetDefs.length === 0) {
+                    $.error("no datasets provided");
+                }
+                datasets = utils.map(datasetDefs, function(o) {
+                    var dataset = cache[o.name] ? cache[o.name] : new Dataset(o);
+                    if (o.name) {
+                        cache[o.name] = dataset;
+                    }
+                    return dataset;
+                });
+                return this.each(initialize);
+                function initialize() {
+                    var $input = $(this), deferreds, eventBus = new EventBus({
+                        el: $input
+                    });
+                    deferreds = utils.map(datasets, function(dataset) {
+                        return dataset.initialize();
+                    });
+                    $input.data(viewKey, new TypeaheadView({
+                        input: $input,
+                        eventBus: eventBus = new EventBus({
+                            el: $input
+                        }),
+                        datasets: datasets
+                    }));
+                    $.when.apply($, deferreds).always(function() {
+                        utils.defer(function() {
+                            eventBus.trigger("initialized");
+                        });
+                    });
+                }
+            },
+            destroy: function() {
+                this.each(function() {
+                    var $this = $(this), view = $this.data(viewKey);
+                    if (view) {
+                        view.destroy();
+                        $this.removeData(viewKey);
+                    }
+                });
+            }
+        };
+        jQuery.fn.typeahead = function(method) {
+            if (methods[method]) {
+                return methods[method].apply(this, [].slice.call(arguments, 1));
+            } else {
+                return methods.initialize.apply(this, arguments);
+            }
+        };
+    })();
+})(window.jQuery);

File diff ditekan karena terlalu besar
+ 6 - 0
inc/wp-typeahead/js/typeahead.min.js


+ 18 - 0
inc/wp-typeahead/js/wp-typeahead.js

@@ -0,0 +1,18 @@
+( function($) {
+	$( 'input[name="s"]' )
+		.typeahead( {
+			name: 'search',
+			remote: wp_typeahead.ajaxurl + '?action=ajax_search&fn=get_ajax_search&terms=%QUERY',
+			template: [
+				'<div class=""><a href="{{url}}"><h5>{{value}}</h5><p>{{postContent}}</p></div></a>',
+			].join(''),
+			engine: Hogan
+		} )
+		.keypress( function(e) {
+			if ( 13 == e.which ) {
+				$(this).parents( 'form' ).submit();
+				return false;
+			}
+		}
+	);
+} )(jQuery);

+ 23 - 0
page-template/page-event.php

@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * Template Name: Event
+ *
+ * @package UIU_CSE
+ */
+get_header(); ?>
+
+<div class="container full-width">
+    <div class="row">
+        <main id="main" class="site-main" role="main">
+            <?php while (have_posts()) : the_post(); ?>
+                <div class="sections">
+                    <?php the_content(); ?>
+                </div><!-- .sections -->
+            <?php endwhile; // end of the loop.
+            ?>
+        </main><!-- #main -->
+    </div><!-- .row -->
+</div><!-- .container -->
+
+<?php get_footer(); ?>

+ 1 - 1
page-template/page-home-hcoded.php

@@ -3,7 +3,7 @@
 /**
  * Template Name: Home - Hard Coded
  *
- * @package Luceo
+ * @package UIU_CSE
  */
 get_header(); ?>
 

+ 1 - 1
page-template/page-home.php

@@ -3,7 +3,7 @@
 /**
  * Template Name: Home
  *
- * @package Luceo
+ * @package UIU_CSE
  */
 get_header(); ?>
 

+ 25 - 0
single-faculty.php

@@ -0,0 +1,25 @@
+<?php
+/**
+ * Template Name: Single Project
+ *
+ * @package 502MEDIA
+ */
+get_header(); ?>
+
+<div id="content" class="site-content full-width">
+	<main id="main" class="site-main" role="main">
+
+		<section class="container page-contents">
+			<div class="row content-holder">
+				<div class="col-xs-12">
+					<?php while ( have_posts() ) : the_post(); 
+					the_content(); 
+					endwhile; ?>
+				</div>
+			</div>
+		</section><!-- .page-contents -->
+
+	</main><!-- #main -->
+</div><!-- .container -->
+
+<?php get_footer(); ?>

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini