Палсеич— (lusever) wrote in changelog,
Палсеич—
lusever
changelog

[livejournal] r19061: LJSUP-8689: Donate button

Committer: pkornilov
LJSUP-8689: Donate button
U   trunk/htdocs/js/journal.js
Modified: trunk/htdocs/js/journal.js
===================================================================
--- trunk/htdocs/js/journal.js	2011-05-16 08:33:37 UTC (rev 19060)
+++ trunk/htdocs/js/journal.js	2011-05-17 03:12:36 UTC (rev 19061)
@@ -129,6 +129,30 @@
 	}
 }
 
+DonateButton = {
+	ml_confirm_message: null,
+	have_tokens: null,
+	lj_form_auth: null,
+
+	donate: function(node, journal, id) {
+		if (confirm(DonateButton.ml_confirm_message)) {
+			jQuery.post(LiveJournal.getAjaxUrl('give_tokens') + '?journal=' + journal + '&id=' + id, {
+				confirm: 1
+			}, function(data) {
+				jQuery(node).find('lj-button-c').text(data.donated_text);
+			});
+		}
+	}
+};
+
+jQuery(document).delegate('a', 'click', function(e) {
+	if (this.href && this.href.indexOf(Site.siteroot + '/give_tokens.bml?journal=') === 0) {
+		var parsed_url = LiveJournal.parseGetArgs(this.href);
+		DonateButton.donate(this, parsed_url.journal, parsed_url.id);
+		e.preventDefault();
+	}
+});
+
 FriendsTimes = {
 	prev_page_start: null,
 

Tags: js, livejournal, lusever
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments