1 jQuery( function ( $ ) {
2 $( 'a.activate-option' ).click( function(){
4 if ( link.hasClass( 'clicked' ) ) {
5 link.removeClass( 'clicked' );
8 link.addClass( 'clicked' );
10 $( '.toggle-have-key' ).slideToggle( 'slow', function() {});
13 $('.akismet-status').each(function () {
14 var thisId = $(this).attr('commentid');
15 $(this).prependTo('#comment-' + thisId + ' .column-comment');
17 $('.akismet-user-comment-count').each(function () {
18 var thisId = $(this).attr('commentid');
19 $(this).insertAfter('#comment-' + thisId + ' .author strong:first').show();
21 $('#the-comment-list').find('tr.comment, tr[id ^= "comment-"]').find('.column-author a[title]').each(function () {
22 // Comment author URLs are the only URL with a title attribute in the author column.
23 var thisTitle = $(this).attr('title');
25 var thisCommentId = $(this).parents('tr:first').attr('id').split("-");
27 $(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
31 $( '<a href="#" class="remove_url">x</a>' )
32 .attr( 'commentid', thisCommentId[1] )
33 .attr( 'title', WPAkismet.strings['Remove this URL'] )
37 $('.remove_url').live('click', function () {
38 var thisId = $(this).attr('commentid');
40 action: 'comment_author_deurl',
41 _wpnonce: WPAkismet.comment_author_url_nonce,
48 beforeSend: function () {
50 $("a[commentid='"+ thisId +"']").hide();
52 $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) );
54 success: function (response) {
56 // Show status/undo link
57 $("#author_comment_url_"+ thisId)
59 .addClass('akismet_undo_link_removal')
61 $( '<span/>' ).text( WPAkismet.strings['URL removed'] )
66 .text( WPAkismet.strings['(undo)'] )
67 .addClass( 'akismet-span-link' )
75 $('.akismet_undo_link_removal').live('click', function () {
76 var thisId = $(this).attr('cid');
77 var thisUrl = $(this).attr('href');
79 action: 'comment_author_reurl',
80 _wpnonce: WPAkismet.comment_author_url_nonce,
88 beforeSend: function () {
90 $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) );
92 success: function (response) {
95 $("a[commentid='"+ thisId +"']").show();
96 // Show link. Core strips leading http://, so let's do that too.
97 $("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) );
104 $('a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type').mouseover(function () {
105 var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://';
106 // Need to determine size of author column
107 var thisParentWidth = $(this).parent().width();
108 // It changes based on if there is a gravatar present
109 thisParentWidth = ($(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px';
110 if ($(this).find('.mShot').length == 0 && !$(this).hasClass('akismet_undo_link_removal')) {
111 var self = $( this );
112 $('.widefat td').css('overflow', 'visible');
113 $(this).css('position', 'relative');
114 var thisHref = $.URLEncode( $(this).attr('href') );
115 $(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>');
116 setTimeout(function () {
117 self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2');
119 setTimeout(function () {
120 self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3');
123 $(this).find('.mShot').css('left', thisParentWidth).show();
125 }).mouseout(function () {
126 $(this).find('.mShot').hide();
128 $('.checkforspam:not(.button-disabled)').click( function(e) {
129 $('.checkforspam:not(.button-disabled)').addClass('button-disabled');
130 $('.checkforspam-spinner').addClass( 'spinner' );
131 akismet_check_for_spam(0, 100);
135 function akismet_check_for_spam(offset, limit) {
139 'action': 'akismet_recheck_queue',
144 if (result.processed < limit) {
145 window.location.reload();
148 akismet_check_for_spam(offset + limit, limit);
155 jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
156 while(x<c.length){var m=r.exec(c.substr(x));
157 if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
158 }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
159 o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}