jQ('a.report-abuse:not(.no-abuse-popup)').live('click', function(ev) {
ev.preventDefault();
loading_box.dialog({
title: "Abuse report",
draggable: false,
modal: true,
width: 400,
minHeight: 320,
resizable: false,
beforeclose: function(event, ui) {
var readOnly = jQ('.report-abuse-ajax-readonly').length;
if(readOnly == 1) return true;
var reason = jQ('.report-abuse-ajax-form textarea#id_reason').val();
var thanksPage = jQ('.report-form-loading p[data-abuse-report-accepted-for-comment]').length;
if (thanksPage == 0) {
thanksPage = jQ('.report-form-loading p[data-abuse-report-accepted-for-profile]').length;
}
if(thanksPage == 0) {
if(reason == 0) {
return true;
} else {
return confirm("Closing this window without pressing \"Report\" will result in your words being lost. Are you sure?");
}
}
else {
return true;
}
},
close: function(ev, ui) { loading_box.remove(); }
});
abuse_report_url = this.href.replace('report-abuse', 'report-abuse-ajax');
abuse_report_url = fix_domain_for_careers(abuse_report_url);
jQ.ajax({
url: abuse_report_url,
success: function(data){
loading_box.html(data);
}
});
});
jQ('body').delegate('.report-abuse-ajax-form form', 'submit', function(ev) {
ev.preventDefault();
var form = jQ(this);
var url = fix_domain_for_careers(form.attr('action'));
jQ.post(url, form.serialize(), function(html) {
form.parents('.ui-dialog-content').html(html);
// Has the abuse report been accepted?
var el = jQ(html);
var comment_id = el.attr('data-abuse-report-accepted-for-comment');
var profile_id = el.attr('data-abuse-report-accepted-for-profile');
if (comment_id) {
jQ('ul#comment-' + comment_id).find('li.abuse-report').remove();
} else if (profile_id) {
jQ('p.report-abuse').remove();
}
var is_successful_submission = (comment_id || profile_id);
if (is_successful_submission) {
if(guardian.r2.omniture.isAvailable()) {
// track with omniture
s.linkTrackVars = 'events,eVar37';
s.linkTrackEvents = 'event37';
s.eVar37 = 'Comment:Report Abuse';
s.events = 'event37';
s.tl(true, 'o', 'Comment report abuse');
}
window.setTimeout(function() {
loading_box.dialog("close");
}, 3000);
}
});
});
// make sure submit button is enabled onReady.
jQ('#newcommenting-form input[type=submit]').removeAttr('disabled');
var newFormURL = window.location.protocol + '//' + window.location.host + window.location.pathname + '?#post-area';
jQ('div#login-container form.post-your-comments').attr('action', newFormURL);
jQ('div#signup-container input').click(function(){
urlStack.clearUrlStack();
urlStack.pushUrlOntoStack(newFormURL);
document.location = 'http://users.guardian.co.uk/signup/tr/1,,-720,00.html';
});
jQ('.recomended').show();
jQ('#newcommenting-form').submit(function(){
jQ('input[type=submit]', this).attr('disabled', 'disabled');
});
}); //end jQ ready
function openAbuseBox(commentId) {
jQ("#abuse-report-comment-id").val(commentId);
var loading_box = jQ('
Loading
'); loading_box.dialog({ title:"Abuse report", draggable: false, modal:true, width:400, minHeight:320, resizable: false, beforeclose: function(event, ui) { var reason = jQ('textarea#id_reason').val(); if (reason != "") { return confirm("Closing this window without pressing \"Report\" will result in your words being lost. Are you sure?"); } else { return true; } } }); } function recommendComment(commentId) { var guardian_domain_thing = 'foo'; var post_url = "http://www.guardian.co.uk/discussion/handlers/recommendComment"; post_url = fix_domain_for_careers(post_url); jQ.post(post_url, { comment_id: commentId }, function(data) { if (data == "OK") { var span = jQ("#recommended-count-" + commentId); span.prev('a').contents().unwrap(); span.text(parseInt(span.text(), 10)+1); } else { var span = jQ("#recommended-count-" + commentId); span.prev('a').contents().unwrap(); } }); }wiz khalifa and amber rose oh the places you ll go blunt amendment justin bieber birthday read across america vikings stadium breitbart dead
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.