Commit: ca5a90c70cc30086088ce8c299562dbdeb4b0cc3 Author: Hannes Magnusson <bj...@mongodb.com> Mon, 28 Oct 2013 16:38:27 -0700 Parents: a162e3019e896bc0903e311f8d5116875f6db75e Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=ca5a90c70cc30086088ce8c299562dbdeb4b0cc3 Log: This file is still in used by the old-web. This is a partial revert of 613a15b4954034a65072cd78d007072221779998 Changed paths: A js/usernotes.js Diff: diff --git a/js/usernotes.js b/js/usernotes.js new file mode 100644 index 0000000..83804ea --- /dev/null +++ b/js/usernotes.js @@ -0,0 +1,49 @@ +$(document).ready(function() { + $("a").each( + function () { + if ($(this).is("a:.usernotes-voteu") || $(this).is("a:.usernotes-voted")) $(this).click( + function (event) { + event.preventDefault(); + var url = $(this).attr("href"); + var id = url.match(/\?id=(\d+)/)[1]; + var request = $.ajax({ + type: "POST", + url: url, + dataType: "json", + headers: {"X-Json": "On" }, + beforeSend: function() { + $("#Vu"+id).hide(); + $("#Vd"+id).hide(); + $("#V"+id).html("<img src=\"/images/working.gif\" alt=\"Working...\" border=\"0\" title=\"Working...\" />"); + } + }); + request.done(function(data) { + if(data.success != null && data.success == true) { + $("#V"+id).html("<div style=\"float: left; width: 16px; height: 16px; background-image: url(/images/notes-features.png); background-position:-32px 16px; margin-right: 8px; overflow: hidden;\" border=\"0\" alt=\"success\" title=\"Thank you for voting!\"></div>" + data.update); + } + else { + var responsedata = "Error :("; + if (data.msg != null) { + responsedata = data.msg; + } + $("#V"+id).html("<div style=\"float: left; width: 16px; height: 16px; background-image: url(/images/notes-features.png); background-position:-32px 0px; margin-right: 8px; overflow: hidden;\" border=\"0\" alt=\"fail\" title=\"" + responsedata + "\"></div>"); + } + }); + request.fail(function(jqXHR, textStatus) { + $("#Vu"+id).show(); + $("#Vd"+id).show(); + $("#V"+id).html("<div style=\"float: left; width: 16px; height: 16px; background-image: url(/images/notes-features.png); background-position:-32px 0px; margin-right: 8px; overflow: hidden;\" border=\"0\" alt=\"fail\" title=\"Error :(\"></div>"); + }); + request.always(function(data) { + $("#V"+id).fadeIn(500, "linear"); + }); + } + ); + } + ); + if (window.location.href.match(/#\d+$/)) { + var highlightId = window.location.href.match(/#(\d+)$/); + highlightId = highlightId[1]; + $("#Hcom"+highlightId).effect("highlight", {}, 3000); + } +}); -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php