| [ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 jQuery(document).ready(function () { 2 jQuery('.akismet-status').each(function () { 3 var thisId = jQuery(this).attr('commentid'); 4 jQuery(this).prependTo('#comment-' + thisId + ' .column-comment div:first-child'); 5 }); 6 jQuery('.akismet-user-comment-count').each(function () { 7 var thisId = jQuery(this).attr('commentid'); 8 jQuery(this).insertAfter('#comment-' + thisId + ' .author strong:first').show(); 9 }); 10 jQuery('#the-comment-list tr.comment .column-author a[title ^= "http://"]').each(function () { 11 var thisTitle = jQuery(this).attr('title'); 12 thisCommentId = jQuery(this).parents('tr:first').attr('id').split("-"); 13 14 jQuery(this).attr("id", "author_comment_url_"+ thisCommentId[1]); 15 16 if (thisTitle) { 17 jQuery(this).after(' <a href="#" class="remove_url" commentid="'+ thisCommentId[1] +'" title="Remove this URL">x</a>'); 18 } 19 }); 20 jQuery('.remove_url').live('click', function () { 21 var thisId = jQuery(this).attr('commentid'); 22 var data = { 23 action: 'comment_author_deurl', 24 _wpnonce: WPAkismet.comment_author_url_nonce, 25 id: thisId 26 }; 27 jQuery.ajax({ 28 url: ajaxurl, 29 type: 'POST', 30 data: data, 31 beforeSend: function () { 32 // Removes "x" link 33 jQuery("a[commentid='"+ thisId +"']").hide(); 34 // Show temp status 35 jQuery("#author_comment_url_"+ thisId).html('<span>Removing...</span>'); 36 }, 37 success: function (response) { 38 if (response) { 39 // Show status/undo link 40 jQuery("#author_comment_url_"+ thisId).attr('cid', thisId).addClass('akismet_undo_link_removal').html('<span>URL removed (</span>undo<span>)</span>'); 41 } 42 } 43 }); 44 45 return false; 46 }); 47 jQuery('.akismet_undo_link_removal').live('click', function () { 48 var thisId = jQuery(this).attr('cid'); 49 var thisUrl = jQuery(this).attr('href').replace("http://www.", "").replace("http://", ""); 50 var data = { 51 action: 'comment_author_reurl', 52 _wpnonce: WPAkismet.comment_author_url_nonce, 53 id: thisId, 54 url: thisUrl 55 }; 56 jQuery.ajax({ 57 url: ajaxurl, 58 type: 'POST', 59 data: data, 60 beforeSend: function () { 61 // Show temp status 62 jQuery("#author_comment_url_"+ thisId).html('<span>Re-adding…</span>'); 63 }, 64 success: function (response) { 65 if (response) { 66 // Add "x" link 67 jQuery("a[commentid='"+ thisId +"']").show(); 68 // Show link 69 jQuery("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').html(thisUrl); 70 } 71 } 72 }); 73 74 return false; 75 }); 76 jQuery('a[id^="author_comment_url"]').mouseover(function () { 77 // Need to determine size of author column 78 var thisParentWidth = jQuery(this).parent().width(); 79 // It changes based on if there is a gravatar present 80 thisParentWidth = (jQuery(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px'; 81 if (jQuery(this).find('.mShot').length == 0 && !jQuery(this).hasClass('akismet_undo_link_removal')) { 82 var thisId = jQuery(this).attr('id').replace('author_comment_url_', ''); 83 jQuery('.widefat td').css('overflow', 'visible'); 84 jQuery(this).css('position', 'relative'); 85 var thisHref = jQuery.URLEncode(jQuery(this).attr('href')); 86 jQuery(this).append('<div class="mShot mshot-container" style="left: '+thisParentWidth+'"><div class="mshot-arrow"></div><img src="http://s.wordpress.com/mshots/v1/'+thisHref+'?w=450" width="450" class="mshot-image_'+thisId+'" style="margin: 0;" /></div>'); 87 setTimeout(function () { 88 jQuery('.mshot-image_'+thisId).attr('src', 'http://s.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2'); 89 }, 6000); 90 setTimeout(function () { 91 jQuery('.mshot-image_'+thisId).attr('src', 'http://s.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3'); 92 }, 12000); 93 } else { 94 jQuery(this).find('.mShot').css('left', thisParentWidth).show(); 95 } 96 }).mouseout(function () { 97 jQuery(this).find('.mShot').hide(); 98 }); 99 }); 100 // URL encode plugin 101 jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/; 102 while(x<c.length){var m=r.exec(c.substr(x)); 103 if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length; 104 }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16); 105 o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;} 106 }); 107 // Preload mshot images after everything else has loaded 108 jQuery(window).load(function() { 109 jQuery('a[id^="author_comment_url"]').each(function () { 110 jQuery.get('http://s.wordpress.com/mshots/v1/'+jQuery.URLEncode(jQuery(this).attr('href'))+'?w=450'); 111 }); 112 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Fri May 25 03:56:23 2012 | Hosted by follow the white rabbit. |