Alexander Nazarov (nfokz) wrote in changelog,
Alexander Nazarov
nfokz
changelog

[livejournal] r22299: LJSUP-12631: Implement widget initializa...

Committer: anazarov
LJSUP-12631: Implement widget initialization framework.
U   trunk/htdocs/js/basic.js
Modified: trunk/htdocs/js/basic.js
===================================================================
--- trunk/htdocs/js/basic.js	2012-06-21 09:00:43 UTC (rev 22298)
+++ trunk/htdocs/js/basic.js	2012-06-21 12:05:18 UTC (rev 22299)
@@ -719,6 +719,27 @@
 	LJ.UI._widgets = widgets;
 
 	/**
+	 * Init widget node
+	 *
+	 * @param {jQuery} node Node
+	 * @param {String} widget Widget name
+	 * @param {String} entryPoint Leave empty to init when page is ready
+	 */
+	LJ.UI.initWidgetNode = function (node, widget, entryPoint) {
+		if (node.hasClass(baseClass)) {
+			LJ.console.warn('Node already has class ' + baseClass);
+			return;
+		}
+
+		node.addClass(baseClass);
+		node.attr('data-widget', widget);
+
+		if (entryPoint) {
+			node.attr('data-bootstrap', entryPoint);
+		}
+	};
+
+	/**
 	 * Init widget on node
 	 *
 	 * @param {jQuery} node Node

Tags: anazarov, js, livejournal, nfokz
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