Changeset 5172
- Timestamp:
- 11/23/2013 11:38:03 AM (11 years ago)
- Location:
- trunk/templates/default
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/templates/default/bbpress-functions.php
r5166 r5172 88 88 add_action( 'bbp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue theme JS 89 89 add_filter( 'bbp_enqueue_scripts', array( $this, 'localize_topic_script' ) ); // Enqueue theme script localization 90 add_action( 'bbp_head', array( $this, 'head_scripts' ) ); // Output some extra JS in the <head>91 90 add_action( 'bbp_ajax_favorite', array( $this, 'ajax_favorite' ) ); // Handles the topic ajax favorite/unfavorite 92 91 add_action( 'bbp_ajax_subscription', array( $this, 'ajax_subscription' ) ); // Handles the topic ajax subscribe/unsubscribe … … 183 182 if ( bbp_use_wp_editor() ) { 184 183 wp_enqueue_script( 'jquery' ); 184 wp_enqueue_script( 'bbpress-editor', $this->url . 'js/editor.js', array( 'jquery' ), $this->version ); 185 185 } 186 186 … … 207 207 if ( bbp_is_single_user_edit() ) { 208 208 wp_enqueue_script( 'user-profile' ); 209 } 210 } 211 212 /** 213 * Put some scripts in the header, like AJAX url for wp-lists 214 * 215 * @since bbPress (r3732) 216 * 217 * @uses bbp_is_single_topic() To check if it's the topic page 218 * @uses admin_url() To get the admin url 219 * @uses bbp_is_single_user_edit() To check if it's the profile edit page 220 */ 221 public function head_scripts() { 222 223 // Bail if no extra JS is needed 224 if ( ! bbp_is_single_user_edit() && ! bbp_use_wp_editor() ) 225 return; ?> 226 227 <script type="text/javascript"> 228 /* <![CDATA[ */ 229 <?php if ( bbp_is_single_user_edit() ) : ?> 230 if ( window.location.hash === '#password' ) { 231 document.getElementById('pass1').focus(); 232 } 233 <?php endif; ?> 234 235 <?php if ( bbp_use_wp_editor() ) : ?> 236 jQuery(document).ready( function() { 237 238 /* Use backticks instead of <code> for the Code button in the editor */ 239 if ( typeof( edButtons ) !== 'undefined' ) { 240 edButtons[110] = new QTags.TagButton( 'code', 'code', '`', '`', 'c' ); 241 QTags._buttonsInit(); 242 } 243 244 /* Tab from topic title */ 245 jQuery( '#bbp_topic_title' ).bind( 'keydown.editor-focus', function(e) { 246 if ( e.which !== 9 ) 247 return; 248 249 if ( !e.ctrlKey && !e.altKey && !e.shiftKey ) { 250 if ( typeof( tinymce ) !== 'undefined' ) { 251 if ( ! tinymce.activeEditor.isHidden() ) { 252 var editor = tinymce.activeEditor.editorContainer; 253 jQuery( '#' + editor + ' td.mceToolbar > a' ).focus(); 254 } else { 255 jQuery( 'textarea.bbp-the-content' ).focus(); 256 } 257 } else { 258 jQuery( 'textarea.bbp-the-content' ).focus(); 259 } 260 261 e.preventDefault(); 262 } 263 }); 264 265 /* Shift + tab from topic tags */ 266 jQuery( '#bbp_topic_tags' ).bind( 'keydown.editor-focus', function(e) { 267 if ( e.which !== 9 ) 268 return; 269 270 if ( e.shiftKey && !e.ctrlKey && !e.altKey ) { 271 if ( typeof( tinymce ) !== 'undefined' ) { 272 if ( ! tinymce.activeEditor.isHidden() ) { 273 var editor = tinymce.activeEditor.editorContainer; 274 jQuery( '#' + editor + ' td.mceToolbar > a' ).focus(); 275 } else { 276 jQuery( 'textarea.bbp-the-content' ).focus(); 277 } 278 } else { 279 jQuery( 'textarea.bbp-the-content' ).focus(); 280 } 281 282 e.preventDefault(); 283 } 284 }); 285 }); 286 <?php endif; ?> 287 /* ]]> */ 288 </script> 289 290 <?php 209 wp_enqueue_script( 'bbpress-user', $this->url . 'js/user.js', array(), $this->version ); 210 } 291 211 } 292 212
Note: See TracChangeset
for help on using the changeset viewer.