1 jQuery( function ( $ ) {
2 $( '.switch-have-key' ).click( function() {
3 var no_key = $( this ).parents().find('div.no-key');
4 var have_key = $( this ).parents().find('div.have-key');
6 no_key.addClass( 'hidden' );
7 have_key.removeClass( 'hidden' );
11 $( 'p.need-key a' ).click( function(){
12 document.akismet_activate.submit();
14 $('.akismet-status').each(function () {
15 var thisId = $(this).attr('commentid');
16 $(this).prependTo('#comment-' + thisId + ' .column-comment div:first-child');
18 $('.akismet-user-comment-count').each(function () {
19 var thisId = $(this).attr('commentid');
20 $(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
22 $('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title ^= "http://"]').each(function () {
23 var thisTitle = $(this).attr('title');
24 thisCommentId = $(this).parents('tr:first').attr('id').split("-");
26 $(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
30 $( '<a href="#" class="remove_url">x</a>' )
31 .attr( 'commentid', thisCommentId[1] )
32 .attr( 'title', WPAkismet.strings['Remove this URL'] )
36 $('.remove_url').live('click', function () {
37 var thisId = $(this).attr('commentid');
39 action: 'comment_author_deurl',
40 _wpnonce: WPAkismet.comment_author_url_nonce,
47 beforeSend: function () {
49 $("a[commentid='"+ thisId +"']").hide();
51 $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) );
53 success: function (response) {
55 // Show status/undo link
56 $("#author_comment_url_"+ thisId)
58 .addClass('akismet_undo_link_removal')
60 $( '<span/>' ).text( WPAkismet.strings['URL removed'] )
65 .text( WPAkismet.strings['(undo)'] )
66 .addClass( 'akismet-span-link' )
74 $('.akismet_undo_link_removal').live('click', function () {
75 var thisId = $(this).attr('cid');
76 var thisUrl = $(this).attr('href').replace("http://www.", "").replace("http://", "");
78 action: 'comment_author_reurl',
79 _wpnonce: WPAkismet.comment_author_url_nonce,
87 beforeSend: function () {
89 $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) );
91 success: function (response) {
94 $("a[commentid='"+ thisId +"']").show();
96 $("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').html(thisUrl);
103 $('a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type').mouseover(function () {
104 var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://';
105 // Need to determine size of author column
106 var thisParentWidth = $(this).parent().width();
107 // It changes based on if there is a gravatar present
108 thisParentWidth = ($(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px';
109 if ($(this).find('.mShot').length == 0 && !$(this).hasClass('akismet_undo_link_removal')) {
110 var self = $( this );
111 $('.widefat td').css('overflow', 'visible');
112 $(this).css('position', 'relative');
113 var thisHref = $.URLEncode( $(this).attr('href') );
114 $(this).append('<div class="mShot mshot-container" style="left: '+thisParentWidth+'"><div class="mshot-arrow"></div><img src="//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450" width="450" class="mshot-image" style="margin: 0;" /></div>');
115 setTimeout(function () {
116 self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2');
118 setTimeout(function () {
119 self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3');
122 $(this).find('.mShot').css('left', thisParentWidth).show();
124 }).mouseout(function () {
125 $(this).find('.mShot').hide();
127 $('.checkforspam:not(.button-disabled)').click( function(e) {
128 $('.checkforspam:not(.button-disabled)').addClass('button-disabled');
129 $('.checkforspam-spinner').show();
130 akismet_check_for_spam(0, 100);
134 function akismet_check_for_spam(offset, limit) {
138 'action': 'akismet_recheck_queue',
143 if (result.processed < limit) {
144 window.location.reload();
147 akismet_check_for_spam(offset + limit, limit);
154 jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
155 while(x<c.length){var m=r.exec(c.substr(x));
156 if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
157 }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
158 o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}