Vlad Kurkin (b_vladi) wrote in changelog,
Vlad Kurkin
b_vladi
changelog

[livejournal] r21500: LJSUP-11421: Cliend-side development for...

Committer: vkurkin
LJSUP-11421: Cliend-side development for Trava.ru
U   trunk/htdocs/js/jquery/jquery.lj.modalWindow.js
U   trunk/htdocs/js/settings.js
U   trunk/htdocs/manage/settings/index.bml
Modified: trunk/htdocs/js/jquery/jquery.lj.modalWindow.js
===================================================================
--- trunk/htdocs/js/jquery/jquery.lj.modalWindow.js	2012-03-22 06:02:37 UTC (rev 21499)
+++ trunk/htdocs/js/jquery/jquery.lj.modalWindow.js	2012-03-22 08:27:47 UTC (rev 21500)
@@ -12,7 +12,7 @@
 			templates: {
 				popup: '<div class="b-popup">' +
 					'<div class="b-popup-outer">' +
-						'<div class="b-popup-inner b-popup-search-music">' +
+						'<div class="b-popup-inner">' +
 							'<div class="popup-inner">' +
 								'<div class="b-popup-content"></div>' +
 								'<i class="i-popup-close"></i>' +
@@ -103,11 +103,14 @@
 			$(document.body)
 				.append(this._faderNode)
 				.append(this._popupNode);
+			
+			this._trigger('show');
 		},
 
 		hide: function () {
 			this._faderNode.detach();
 			this._popupNode.detach();
+			this._trigger('hide');
 		}
 	};
 

Modified: trunk/htdocs/js/settings.js
===================================================================
--- trunk/htdocs/js/settings.js	2012-03-22 06:02:37 UTC (rev 21499)
+++ trunk/htdocs/js/settings.js	2012-03-22 08:27:47 UTC (rev 21500)
@@ -51,19 +51,31 @@
 
 	function onLogin(evt, data) {
 		if (data) {
+			var isLogin = data.uid !== 1;
+
 			travaElement
 				.removeClass(options.classNames.loading)
 				.removeClass(options.classNames.error)
 				.removeClass(options.classNames.disconnect)
-				.addClass(data.uid === 1 ? options.classNames.disconnect : options.classNames.login);
+				.addClass(isLogin ? options.classNames.login : options.classNames.disconnect);
 
 			hiddenField.val(data.uid);
+
+			if (isLogin) {
+				travaElement.trava('getUserInfo');
+			}
 		} else {
 			travaElement.addClass(options.classNames.error);
 			travaElement.removeClass(options.classNames.loading);
 		}
 	}
 
+	function onGetInfo(evt, data) {
+		if (data) {
+			console.log(data);
+		}
+	}
+
 	$('select[name="music_select"]').bind('change', function () {
 		var currentID = '#' + $(this).val();
 		var oldID = currentID == options.selectors.Trava ? options.selectors.LastFM : options.selectors.Trava;
@@ -73,6 +85,7 @@
 	}).trigger('change');
 
 	travaElement.trava().bind('travalogin', onLogin);
+	travaElement.trava().bind('travauserinfo', onGetInfo);
 
 	travaElement.delegate(options.selectors.connectLink, 'click', function (evt) {
 		evt.preventDefault();

Modified: trunk/htdocs/manage/settings/index.bml
===================================================================
--- trunk/htdocs/manage/settings/index.bml	2012-03-22 06:02:37 UTC (rev 21499)
+++ trunk/htdocs/manage/settings/index.bml	2012-03-22 08:27:47 UTC (rev 21500)
@@ -9,7 +9,10 @@
 
     BML::set_language_scope('/manage/settings/index.bml');
 
-    LJ::need_res("stc/settings.css", "js/settings.js");
+    LJ::need_res("stc/settings.css",
+     "js/settings.js",
+      "js/jquery/jquery.lj.trava.js");
+
     LJ::set_active_crumb('manage');
 
     my $remote = LJ::get_remote();

Tags: b_vladi, bml, js, livejournal, vkurkin
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