Valerii Vasin (valerii) wrote in changelog,
Valerii Vasin
valerii
changelog

[livejournal] r23386: LJSUP-14180: Replace lj-like buttons wit...

Committer: vvasin
LJSUP-14180: Replace lj-like buttons with preloader. Revert commit.
U   trunk/htdocs/js/jquery_fn.js
Modified: trunk/htdocs/js/jquery_fn.js
===================================================================
--- trunk/htdocs/js/jquery_fn.js	2012-11-28 16:09:17 UTC (rev 23385)
+++ trunk/htdocs/js/jquery_fn.js	2012-11-29 08:30:15 UTC (rev 23386)
@@ -468,14 +468,8 @@
 		 * Empty collection that will contain not parsed lj-like elements
 		 * that are currently on the page
 		 */
-		_likes = $(),
+		_likes = $();
 
-		/**
-		 * Placeholder that will be prepended before .lj-like
-		 * Notice: listener for click on it will be on document.body
-		 */
-		_placeholderTemplate = '<div style="height: 25px; background-color: red;" class="lj-likes-placeholder"></div>';
-
 	/**
 	 * Remove comments inside node and parse likes
 	 * @param  {Object} node jQuery node
@@ -538,22 +532,12 @@
 
 	// after document ready, cuz LiveJournal namespace is not defined yet
 	$(function () {
-		// handle scroll event, for mobile devices we don't threshold lazyLoad
-		// because it fires only at the end of scrolling (iOS)
-		$(window).on('scroll', LJ.Support.touch ? lazyLoad : LJ.threshold(lazyLoad, 1000));
-
 		/**
-		 * Handle likes placeholder clicks
-		 * @todo Provide setup of click handler only when first
-		 * lj-like with placeholder option found
+		 * Handle scroll event.
+		 * Notice: for mobile devices we don't threshold lazyLoad
+		 * because it fires only at the end of scrolling (iOS)
 		 */
-		$(document.body).on('click', '.lj-likes-placeholder', function () {
-			var placeholder = $(this),
-				likes = placeholder.next();
-
-			placeholder.remove();
-			parse(likes);
-		});
+		$(window).on('scroll', LJ.Support.touch ? lazyLoad : LJ.threshold(lazyLoad, 1000));
 	});
 
 	$.fn.ljLikes = function (opts) {
@@ -582,21 +566,6 @@
 			this.used = true;
 		});
 
-		// handle likes with placeholder option
-		likes.each(function () {
-			if ( $(this).data('placeholder') ) {
-				$(this).before(_placeholderTemplate);
-
-				// attribute for quick access
-				this.placeholder = true;
-			}
-		});
-
-		likes = likes.filter(function () {
-			return !this.placeholder;
-		});
-
-
 		if ( !opts.lazy ) {
 			// not lazy: immediately parsing
 			likes.each(function () {
@@ -623,4 +592,4 @@
 		// if false - we will parse likes at the moment
 		lazy: true
 	};
-}(jQuery));
\ No newline at end of file
+}(jQuery));

Tags: invis89, js, livejournal, vvasin
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