can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[ljcom] r12044: LJSUP-11909: Fast Repost feature. Add co...

Committer: dpetrov
LJSUP-11909: Fast Repost feature. Add confirmation bubble.
U   trunk/bin/upgrading/s2layers/sup/layout.s2
U   trunk/htdocs/js/s2.js
Modified: trunk/bin/upgrading/s2layers/sup/layout.s2
===================================================================
--- trunk/bin/upgrading/s2layers/sup/layout.s2	2012-05-31 13:36:03 UTC (rev 12043)
+++ trunk/bin/upgrading/s2layers/sup/layout.s2	2012-05-31 14:18:43 UTC (rev 12044)
@@ -797,7 +797,7 @@
 
     _print_CSS();
     
-    $p->need_res(["js/jquery/jquery.lj.inlineCalendar.js", "js/jquery/jquery.calendarEvents.js", "js/s2.js", "templates/Widgets/popupcontent.tmpl"]);
+    $p->need_res(["js/jquery/jquery.lj.inlineCalendar.js", "js/jquery/jquery.calendarEvents.js", "js/s2.js", "templates/Widgets/popupcontent.tmpl", "js/jquery/jquery.lj.confirmbubble.js"]);
     $p->init_appviews();
 
     $p->print_head();

Modified: trunk/htdocs/js/s2.js
===================================================================
--- trunk/htdocs/js/s2.js	2012-05-31 13:36:03 UTC (rev 12043)
+++ trunk/htdocs/js/s2.js	2012-05-31 14:18:43 UTC (rev 12044)
@@ -1,5 +1,5 @@
-jQuery( function( $ ) {
-	$( '.sidebar-cal' ).inlineCalendar( {
+LiveJournal.register_hook('page_load', function() {
+	jQuery( '.sidebar-cal' ).inlineCalendar( {
 		selectors: {
 			month: '.sbar-cal-nav-month',
 			year:  '.sbar-cal-nav-year',
@@ -26,3 +26,28 @@
 		event.preventDefault();
 	} ).calendarEvents( { calendarType: "inlineCalendar" } );
 });
+
+(function() {
+	var urls_cache  = {};
+
+	function removeRepost(url) {
+		LJ.Api.call('repost.delete', { url: url }, function(answer) {
+			if (answer.error) {
+				LiveJournal.ajaxError(answer.error.message);
+			} else {
+				location.reload();
+			}
+		});
+	}
+
+	function initPopup(node, onconfirm) {
+		jQuery(node).confirmbubble({
+			confirmText: LJ.ml('repost.confirm.delete'),
+			confirm: onconfirm || jQuery.noop
+		});
+	}
+
+	LiveJournal.register_hook('repost.requestRemove', function(node, url) {
+		initPopup(node, removeRepost.bind(null, url));
+	});
+}());

Tags: can3p, dpetrov, js, ljcom, s2
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