Changeset 6285
- Timestamp:
- 12/18/2017 06:36:37 PM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/readme/class-parser.php
r5841 r6285 401 401 $this->sections['faq'] .= "\n<dl>\n"; 402 402 foreach ( $this->faq as $question => $answer ) { 403 $this->sections['faq'] .= "<dt>{$question}</dt>\n<dd>{$answer}</dd>\n"; 403 $question_slug = sanitize_title_with_dashes( $question ); 404 $this->sections['faq'] .= "<dt id='{$question_slug}'>{$question}</dt>\n<dd>{$answer}</dd>\n"; 404 405 } 405 406 $this->sections['faq'] .= "\n</dl>\n"; -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/section-faq.js
r5244 r6285 1 1 ( function( $ ) { 2 $( 'dt', '#faq' ) 2 var questions = $( 'dt', '#faq' ); 3 var hash = window.location.hash.replace( /[^a-z0-9-#]/gi, '' ); 4 5 questions 3 6 .each( function( index, question ) { 4 7 var $question = $( question ), 5 $button = $( '<button type="button" class="button-link" aria-expanded="false" />' ); 8 $button = $( '<a href="#" />' ), 9 id = $question.attr( 'id' ); 10 11 // If there is no ID, create our own. 12 if ( ! id ) { 13 id = '#' + $question.text().toLowerCase().replace( /[^\w\s]/gi, '' ).replace( /\s/gi, '-' ); 14 $question.attr( 'id', id ); 15 } 16 17 $button.attr( 'href', id ).on( 'click', function( event ) { 18 event.preventDefault(); 19 } ); 6 20 7 21 $question.html( $button.text( $question.text() ) ); … … 21 35 return 'true' !== attribute; 22 36 } ).next( 'dd' ).slideToggle( 200 ); 37 38 if ( hash ) { 39 window.scrollTo( 0, $question.offset().top ); 40 } 23 41 } ); 42 43 if ( hash ) { 44 questions.find( '[href="' + hash + '"]' ).trigger( 'click' ); 45 } 24 46 } )( jQuery );
Note: See TracChangeset
for help on using the changeset viewer.