can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r21568: LJSUP-11456: Add link Collapse to Video ...

Committer: dpetrov
LJSUP-11456: Add link Collapse to Video block on cyr home page
U   trunk/htdocs/js/journal.js
Modified: trunk/htdocs/js/journal.js
===================================================================
--- trunk/htdocs/js/journal.js	2012-03-28 08:05:24 UTC (rev 21567)
+++ trunk/htdocs/js/journal.js	2012-03-28 08:37:23 UTC (rev 21568)
@@ -361,9 +361,25 @@
 			handler: function() {
 				jQuery(document).on('click', '.appwidget-prop-collapsable', function(ev) {
 					if (ev.target.className.indexOf('w-head-status-switch') !== -1) {
-						var videoCollapes = ev.target.className.indexOf('collapse') !== -1
+						var videoCollapes = ev.target.className.indexOf('collapse') !== -1,
+							id = this.id.replace('LJWidget_', ''),
+							cookie = Cookie('clpsd') || '',
+							id_idx = -1;
+
+						cookie_ids = cookie ? cookie.split(':') : [];
+						id_idx = jQuery.inArray(id, cookie_ids);
 						jQuery(this).toggleClass('appwidget-prop-collapsed', videoCollapes);
-						Cookie('video_collapsed', videoCollapes ? 1 : null, { domain: location.host, expires: 14 });
+						if (videoCollapes) {
+							if (id_idx === -1) {
+								cookie_ids.push(id);
+							}
+						} else {
+							if (id_idx !== -1) {
+								cookie_ids.splice(id_idx, 1);
+							}
+						}
+
+						Cookie('clpsd', cookie_ids.length > 0 ? cookie_ids.join(':') : null, { domain: location.host, expires: 30 });
 					}
 				});
 			}

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