can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[livejournal] r21832: LJSUP-11969: Add an api to insert transl...

Committer: dpetrov
LJSUP-11969: Add an api to insert translated template into page
U   trunk/htdocs/js/basic.js
Modified: trunk/htdocs/js/basic.js
===================================================================
--- trunk/htdocs/js/basic.js	2012-04-27 12:40:49 UTC (rev 21831)
+++ trunk/htdocs/js/basic.js	2012-04-27 12:42:35 UTC (rev 21832)
@@ -327,13 +327,22 @@
 	cssNode.href = fileName;
 	
 	head.appendChild(cssNode);
-
-	//console.log(fileName + ' injected from ' + w.location.href);
 };
 
 LJ.UI = LJ.UI || {};
+
+/**
+ * Private namespace to hold information about templates.
+ */
 LJ.UI._templates = {};
 
+/**
+ * Register new template in system.
+ *
+ * @param {string} name The name of the template.
+ * @param {string} id Id of the script tag containing the templates or the template text.
+ * @param {string=JQuery} type Type of the template. Default is jquery templates.
+ */
 LJ.UI.registerTemplate = function(name, id, type) {
 	var node = jQuery('#' + id),
 		template;
@@ -360,6 +369,15 @@
 
 };
 
+/**
+ * Render the template with the data. Current version returns jQuery object
+ *    but surely should be able to return rendered strings.
+ *
+ *  @param {string} name The name of the template. Template should be registered.
+ *  @param {Object} data Data object to inset into template
+ *
+ *  @return {jQuery} jQuery object containing new markup.
+ */
 LJ.UI.template = function(name, data) {
 	var tmplObj = LJ.UI._templates[name],
 		html;

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