Changeset 580449
- Timestamp:
- 08/01/2012 08:55:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
jquery-expandable-comments/trunk/jQuery-comments.php
r580441 r580449 5 5 Description: Makes comment replies expandable with jQuery, and creates "valid" code. 6 6 Author: Shelly Cole 7 Version: 0. 27 Version: 0.3 8 8 Author URI: http://brassblogs.com 9 9 … … 38 38 switch ( $args['style'] ) { 39 39 case 'div': 40 echo "<div class='replylink'>Show /HideReplies</div>\n";40 echo "<div class='replylink'>Show Replies</div>\n"; 41 41 echo "<div class='children'>\n"; 42 42 break; 43 43 case 'ol': 44 echo "<span class='replylink'>Show /HideReplies</span>\n";44 echo "<span class='replylink'>Show Replies</span>\n"; 45 45 echo "<ol class='children'>\n"; 46 46 break; 47 47 default: 48 48 case 'ul': 49 echo "<span class='replylink'>Show /HideReplies</span>\n";49 echo "<span class='replylink'>Show Replies</span>\n"; 50 50 echo "<ul class='children'>\n"; 51 51 break; … … 254 254 ----------------------------------------------------------------------------------------*/ 255 255 256 add_action('init', 'bb_start_jquery'); 256 if(wp_script_is('jquery', 'registered') !== TRUE) { // we don't want to add jquery if it's already added 257 add_action('init', 'bb_start_jquery'); 258 function bb_start_jquery() { 259 wp_deregister_script('jquery'); // just to bypass any possible weirdness 260 wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'); 261 wp_enqueue_script('jquery'); //get that jQuery started up 262 } 263 } 264 257 265 add_action('wp_head', 'bb_add_jQuery'); 258 259 function bb_start_jquery() {260 wp_enqueue_script('jquery'); //get that jQuery started up261 }262 263 266 function bb_add_jQuery() { 264 if( is_single() || is_paged () || get_query_var ('cpage')) { ?>267 if(comments_open()) { ?> 265 268 <!--/start jQuery Expandable Comments --> 266 269 <script type="text/javascript"> … … 270 273 $(this).css('cursor','pointer'); }, function (){ 271 274 $(this).css('cursor','auto'); } ).click(function() { 275 $(this).text( $(this).text() == 'Show Replies' ? 'Hide Replies' : 'Show Replies'); 272 276 var $nextDiv = $(this).next(); 273 277 var $visibleSiblings = $nextDiv.siblings('div:visible');
Note: See TracChangeset
for help on using the changeset viewer.