Aralot (aralot) wrote in changelog,
Aralot
aralot
changelog

[livejournal] r19768: LJSUP-8714: New Photo-hosting (User Inte...

Committer: szhirkov
LJSUP-8714: New Photo-hosting (User Interface) - Client Side
move supplant to basic.js and new code style
U   trunk/htdocs/js/basic.js
U   trunk/htdocs/js/livejournal.js
Modified: trunk/htdocs/js/basic.js
===================================================================
--- trunk/htdocs/js/basic.js	2011-08-18 06:44:08 UTC (rev 19767)
+++ trunk/htdocs/js/basic.js	2011-08-18 06:58:09 UTC (rev 19768)
@@ -254,7 +254,17 @@
 	trim: function()
 	{
 		return this.replace(/^\s+|\s+$/g, '');
-	}
+	},
+	
+
+	supplant: function(o)
+	{
+		return this.replace(/{([^{}]*)}/g,
+			function (a, b) {
+				var r = o[b];
+				return typeof r === 'string' || typeof r === 'number' ? r : a;
+			});		
+	}	
 });
 
 
@@ -367,8 +377,6 @@
 	}
 });
 
-
-
 /* ajax */
 var XMLHttpRequest = XMLHttpRequest || window.ActiveXObject && function(){
 	return new ActiveXObject('Msxml2.XMLHTTP');

Modified: trunk/htdocs/js/livejournal.js
===================================================================
--- trunk/htdocs/js/livejournal.js	2011-08-18 06:44:08 UTC (rev 19767)
+++ trunk/htdocs/js/livejournal.js	2011-08-18 06:58:09 UTC (rev 19768)
@@ -464,34 +464,4 @@
 			return false;
 		}
 	};
-}();	
-
-LiveJournal.String = {
-	supplant: function(s, o) {
-		return s.replace(/{([^{}]*)}/g,
-			function (a, b) {
-				var r = o[b];
-				return typeof r === 'string' || typeof r === 'number' ? r : a;
-			});		
-	}
-}
-
-LiveJournal.Object = {
-	supplant: function(destObj, dataObj) {
-		var obj = {};;
-		
-		for (var key in destObj) {
-			if (!destObj.hasOwnProperty(key)) {
-				continue;
-			}
-
-			if (typeof destObj[key] == 'string') {
-				obj[key] = LiveJournal.String.supplant(destObj[key], dataObj);
-			} else {
-				obj[key] = destObj[key];
-			}
-		}
-		
-		return obj;
-	}
-}
+}();

Tags: aralot, 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