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 ^= "http://"], .column-author a[title ^= "https://"]').each(function () {
22 var thisTitle = $(this).attr('title');
23 thisCommentId = $(this).parents('tr:first').attr('id').split("-");
25 $(this).attr("id", "author_comment_url_"+ thisCommentId[1]);
29 $( '<a href="#" class="remove_url">x</a>' )
30 .attr( 'commentid', thisCommentId[1] )
31 .attr( 'title', WPAkismet.strings['Remove this URL'] )
35 $('.remove_url').live('click', function () {
36 var thisId = $(this).attr('commentid');
38 action: 'comment_author_deurl',
39 _wpnonce: WPAkismet.comment_author_url_nonce,
46 beforeSend: function () {
48 $("a[commentid='"+ thisId +"']").hide();
50 $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Removing...'] ) );
52 success: function (response) {
54 // Show status/undo link
55 $("#author_comment_url_"+ thisId)
57 .addClass('akismet_undo_link_removal')
59 $( '<span/>' ).text( WPAkismet.strings['URL removed'] )
64 .text( WPAkismet.strings['(undo)'] )
65 .addClass( 'akismet-span-link' )
73 $('.akismet_undo_link_removal').live('click', function () {
74 var thisId = $(this).attr('cid');
75 var thisUrl = $(this).attr('href');
77 action: 'comment_author_reurl',
78 _wpnonce: WPAkismet.comment_author_url_nonce,
86 beforeSend: function () {
88 $("#author_comment_url_"+ thisId).html( $( '<span/>' ).text( WPAkismet.strings['Re-adding...'] ) );
90 success: function (response) {
93 $("a[commentid='"+ thisId +"']").show();
94 // Show link. Core strips leading http://, so let's do that too.
95 $("#author_comment_url_"+ thisId).removeClass('akismet_undo_link_removal').text( thisUrl.replace( /^http:\/\/(www\.)?/ig, '' ) );
102 $('a[id^="author_comment_url"], tr.pingback td.column-author a:first-of-type').mouseover(function () {
103 var wpcomProtocol = ( 'https:' === location.protocol ) ? 'https://' : 'http://';
104 // Need to determine size of author column
105 var thisParentWidth = $(this).parent().width();
106 // It changes based on if there is a gravatar present
107 thisParentWidth = ($(this).parent().find('.grav-hijack').length) ? thisParentWidth - 42 + 'px' : thisParentWidth + 'px';
108 if ($(this).find('.mShot').length == 0 && !$(this).hasClass('akismet_undo_link_removal')) {
109 var self = $( this );
110 $('.widefat td').css('overflow', 'visible');
111 $(this).css('position', 'relative');
112 var thisHref = $.URLEncode( $(this).attr('href') );
113 $(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>');
114 setTimeout(function () {
115 self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=2');
117 setTimeout(function () {
118 self.find( '.mshot-image' ).attr('src', '//s0.wordpress.com/mshots/v1/'+thisHref+'?w=450&r=3');
121 $(this).find('.mShot').css('left', thisParentWidth).show();
123 }).mouseout(function () {
124 $(this).find('.mShot').hide();
126 $('.checkforspam:not(.button-disabled)').click( function(e) {
127 $('.checkforspam:not(.button-disabled)').addClass('button-disabled');
128 $('.checkforspam-spinner').addClass( 'spinner' );
129 akismet_check_for_spam(0, 100);
133 function akismet_check_for_spam(offset, limit) {
137 'action': 'akismet_recheck_queue',
142 if (result.processed < limit) {
143 window.location.reload();
146 akismet_check_for_spam(offset + limit, limit);
153 jQuery.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
154 while(x<c.length){var m=r.exec(c.substr(x));
155 if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
156 }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
157 o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}