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');
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();
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("-");
14 jQuery(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
17 jQuery(this).after(' <a href="#" class="remove_url" commentid="'+ thisCommentId[1] +'" title="Remove this URL">x</a>');
20 jQuery('.remove_url').live('click', function () {
21 var thisId = jQuery(this).attr('commentid');
23 action: 'comment_author_deurl',
24 _wpnonce: WPAkismet.comment_author_url_nonce,
31 beforeSend: function () {
33 jQuery("a[commentid='"+ thisId +"']").hide();
35 jQuery("#author_comment_url_"+ thisId).html('<span>Removing...</span>');
37 success: function (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>');
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://", "");
51 action: 'comment_author_reurl',
52 _wpnonce: WPAkismet.comment_author_url_nonce,
60 beforeSend: function () {
62 jQuery("#author_comment_url_"+ thisId).html('<span>Re-adding…</span>');
64 success: function (response) {
67 jQuery("a[commentid='"+ thisId +"']").show();
69 jQuery("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').html(thisUrl);
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');
90 setTimeout(function () {
91 jQuery('.mshot-image_'+thisId).attr('src', 'http://s.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3');
94 jQuery(this).find('.mShot').css('left', thisParentWidth).show();
96 }).mouseout(function () {
97 jQuery(this).find('.mShot').hide();
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;}
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');