Aralot (aralot) wrote in changelog,
Aralot
aralot
changelog

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

Committer: szhirkov
LJSUP-8714: New Photo-hosting (User Interface) - Client Side
U   trunk/bin/upgrading/en.dat
U   trunk/htdocs/editjournal.bml
U   trunk/htdocs/js/livejournal.js
U   trunk/htdocs/update.bml
Modified: trunk/bin/upgrading/en.dat
===================================================================
--- trunk/bin/upgrading/en.dat	2011-08-15 10:25:35 UTC (rev 19727)
+++ trunk/bin/upgrading/en.dat	2011-08-15 10:27:20 UTC (rev 19728)
@@ -2774,6 +2774,8 @@
 
 fotki.album.btn.upload=Upload
 
+fotki.album.image.loading=Image loading...
+
 fotki.album.upload.unknown.error=Unknown error
 
 fotki.album.stop.upload.confirm=Do you really want to stop upload and close without saving?
@@ -2822,6 +2824,8 @@
 
 fotki.album.link.click.to.upload=Click to upload <br> new images
 
+fotki.album.uploading.message=Uploading...
+
 fotki.album.link.edit=Edit
 
 fotki.album.link.edit_album=Edit album

Modified: trunk/htdocs/editjournal.bml
===================================================================
--- trunk/htdocs/editjournal.bml	2011-08-15 10:25:35 UTC (rev 19727)
+++ trunk/htdocs/editjournal.bml	2011-08-15 10:27:20 UTC (rev 19728)
@@ -494,27 +494,28 @@
 JS
                     $ret .= "'fotki.album.add.images': '".BML::ml('fotki.album.albums')."',"
                     ."'fotki.album.link.click.to.upload': '".BML::ml('fotki.album.link.click.to.upload')."',"
-                    ."'fotki.album.add.photos': '".BML::ml('fotki.album.add.photos')."',"
-                    ."'fotki.album.upgrade': '".BML::ml('fotki.album.upgrade')."',"
-                    ."'fotki.album.add.image.name': '".BML::ml('fotki.album.add.image.name')."',"
-                    ."'fotki.album.description': '".BML::ml('fotki.album.description')."',"
-                    ."'fotki.album.album_cover': '".BML::ml('fotki.album.album_cover')."',"
-                    ."'fotki.album.remove.this.image': '".BML::ml('fotki.album.remove.this.image')."',"
-                    ."'fotki.album.select_album': '".BML::ml('fotki.album.select_album')."',"
-                    ."'fotki.album.new.album.name': '".BML::ml('fotki.album.new.album.name')."',"
-                    ."'fotki.album.post.images': '".BML::ml('fotki.album.post.images')."',"
-                    ."'fotki.album.save.images': '".BML::ml('fotki.album.save.images')."',"
-                    ."'fotki.privacy': '".BML::ml('fotki.privacy')."',"
-                    ."'fotki.album.resize.to.post': '".BML::ml('fotki.album.resize.to.post')."',"
-                    ."'fotki.album.stop.upload.confirm': '".BML::ml('fotki.album.stop.upload.confirm')."',"
-                    ."'fotki.album.close.without.saving.confirm': '".BML::ml('fotki.album.close.without.saving.confirm')."',"
-                    ."'fotki.album.upload.unknown.error': '".BML::ml('fotki.album.upload.unknown.error')."',"
-                	."'fotki.album.upload.io.error': '".BML::ml('fotki.album.upload.io.error')."',"
-                    ."'fotki.album.uploading.image': '".BML::ml('fotki.album.uploading.image')."',"
-                    ."'fotki.album.available.now': '".BML::ml('fotki.album.available.now')."',"
-        			."'fotki.album.click.image': '".BML::ml('fotki.album.click.image')."',"
-        			."'fotki.album.remove.image': '".BML::ml('fotki.album.remove.image')."',"
-                    ."'fotki.album.create.new': '".BML::ml('fotki.album.create.new')."'";
+	                ."'fotki.album.add.photos': '".BML::ml('fotki.album.add.photos')."',"
+	                ."'fotki.album.upgrade': '".BML::ml('fotki.album.upgrade')."',"
+	                ."'fotki.album.add.image.name': '".BML::ml('fotki.album.add.image.name')."',"
+	                ."'fotki.album.description': '".BML::ml('fotki.album.description')."',"
+	                ."'fotki.album.album_cover': '".BML::ml('fotki.album.album_cover')."',"
+	                ."'fotki.album.remove.this.image': '".BML::ml('fotki.album.remove.this.image')."',"
+	                ."'fotki.album.select_album': '".BML::ml('fotki.album.select_album')."',"
+	                ."'fotki.album.new.album.name': '".BML::ml('fotki.album.new.album.name')."',"
+	                ."'fotki.album.post.images': '".BML::ml('fotki.album.post.images')."',"
+	                ."'fotki.album.save.images': '".BML::ml('fotki.album.save.images')."',"
+	                ."'fotki.privacy': '".BML::ml('fotki.privacy')."',"
+	                ."'fotki.album.resize.to.post': '".BML::ml('fotki.album.resize.to.post')."',"
+	                ."'fotki.album.stop.upload.confirm': '".BML::ml('fotki.album.stop.upload.confirm')."',"
+	                ."'fotki.album.close.without.saving.confirm': '".BML::ml('fotki.album.close.without.saving.confirm')."',"
+	                ."'fotki.album.upload.unknown.error': '".BML::ml('fotki.album.upload.unknown.error')."',"
+	                ."'fotki.album.upload.io.error': '".BML::ml('fotki.album.upload.io.error')."',"
+	                ."'fotki.album.uploading.image': '".BML::ml('fotki.album.uploading.image')."',"
+	                ."'fotki.album.available.now': '".BML::ml('fotki.album.available.now')."',"
+	    			."'fotki.album.click.image': '".BML::ml('fotki.album.click.image')."',"
+					."'fotki.album.uploading.message': '".BML::ml('fotki.album.uploading.message')."',"
+	    			."'fotki.album.remove.image': '".BML::ml('fotki.album.remove.image')."',"
+	                ."'fotki.album.create.new': '".BML::ml('fotki.album.create.new')."'";
                 $ret .= <<JS;
                 }
             });

Modified: trunk/htdocs/js/livejournal.js
===================================================================
--- trunk/htdocs/js/livejournal.js	2011-08-15 10:25:35 UTC (rev 19727)
+++ trunk/htdocs/js/livejournal.js	2011-08-15 10:27:20 UTC (rev 19728)
@@ -330,16 +330,6 @@
 	return str;
 }
 
-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;
-			});		
-	}
-}
-
 if (window.JSON && window.JSON.parse && window.JSON.stringify) {
 	LiveJournal.JSON = (function() {
 		var endsWith___ = /___$/;
@@ -512,165 +502,22 @@
 	}
 }
 
-if (window.JSON && window.JSON.parse && window.JSON.stringify) {
-	LiveJournal.JSON = (function() {
-		var endsWith___ = /___$/;
-		return {
-			/* documented below */
-			'parse': function(str) {
-				try {
-					return window.JSON.parse(str);
-				} catch (e) {
-					return false;
-				}
-			},
-			/* documented below */
-			'stringify': function(obj) {
-				try {
-					return window.JSON.stringify(obj, function(k,v) {
-						return !endsWith___.test(k) ? v : null;
-					});
-				} catch (e) {
-					return null;
-				}
+LiveJournal.Object = {
+	supplant: function(destObj, dataObj) {
+		var obj = {};;
+		
+		for (var key in destObj) {
+			if (!destObj.hasOwnProperty(key)) {
+				continue;
 			}
-		};
-	})();
-} else {
-	LiveJournal.JSON = function() {
-		/**
-		 * Formats integers to 2 digits.
-		 * @param {number} n
-		 * @private
-		 */
-		function f(n) {
-			return n < 10 ? '0' + n : n;
-		}
 
-		Date.prototype.toJSON = function() {
-			return [this.getUTCFullYear(), '-',
-				f(this.getUTCMonth() + 1), '-',
-				f(this.getUTCDate()), 'T',
-				f(this.getUTCHours()), ':',
-				f(this.getUTCMinutes()), ':',
-				f(this.getUTCSeconds()), 'Z'].join('');
-		};
-
-		// table of character substitutions
-		/**
-		 * @const
-		 * @enum {string}
-		 */
-		var m = {
-			'\b': '\\b',
-			'\t': '\\t',
-			'\n': '\\n',
-			'\f': '\\f',
-			'\r': '\\r',
-			'"' : '\\"',
-			'\\': '\\\\'
-		};
-
-		/**
-		 * Converts a json object into a string.
-		 * @param {*} value
-		 * @return {string}
-		 * @member gadgets.json
-		 */
-		function stringify(value) {
-			var 	a,					// The array holding the partial texts.
-					i,					// The loop counter.
-					k,					// The member key.
-					l,					// Length.
-					r = /["\\\x00-\x1f\x7f-\x9f]/g,
-					v;					// The member value.
-
-			switch (typeof value) {
-				case 'string':
-					// If the string contains no control characters, no quote characters, and no
-					// backslash characters, then we can safely slap some quotes around it.
-					// Otherwise we must also replace the offending characters with safe ones.
-					return r.test(value) ?
-							'"' + value.replace(r, function(a) {
-								var c = m[a];
-								if (c) {
-									return c;
-								}
-								c = a.charCodeAt();
-								return '\\u00' + Math.floor(c / 16).toString(16) +
-									 (c % 16).toString(16);
-							}) + '"' : '"' + value + '"';
-				case 'number':
-					// JSON numbers must be finite. Encode non-finite numbers as null.
-					return isFinite(value) ? String(value) : 'null';
-				case 'boolean':
-				case 'null':
-					return String(value);
-				case 'object':
-					// Due to a specification blunder in ECMAScript,
-					// typeof null is 'object', so watch out for that case.
-					if (!value) {
-						return 'null';
-					}
-					// toJSON check removed; re-implement when it doesn't break other libs.
-					a = [];
-					if (typeof value.length === 'number' &&
-							!value.propertyIsEnumerable('length')) {
-						// The object is an array. Stringify every element. Use null as a
-						// placeholder for non-JSON values.
-						l = value.length;
-						for (i = 0; i < l; i += 1) {
-							a.push(stringify(value[i]) || 'null');
-						}
-						// Join all of the elements together and wrap them in brackets.
-						return '[' + a.join(',') + ']';
-					}
-					// Otherwise, iterate through all of the keys in the object.
-					for (k in value) {
-						if (k.match('___$'))
-							continue;
-						if (value.hasOwnProperty(k)) {
-							if (typeof k === 'string') {
-								v = stringify(value[k]);
-								if (v) {
-									a.push(stringify(k) + ':' + v);
-								}
-							}
-						}
-					}
-					// Join all of the member texts together and wrap them in braces.
-					return '{' + a.join(',') + '}';
+			if (typeof destObj[key] == 'string') {
+				obj[key] = LiveJournal.String.supplant(destObj[key], dataObj);
+			} else {
+				obj[key] = destObj[key];
 			}
-			return '';
 		}
-
-		return {
-			'stringify': stringify,
-			'parse': function(text) {
-				// Parsing happens in three stages. In the first stage, we run the text against
-				// regular expressions that look for non-JSON patterns. We are especially
-				// concerned with '()' and 'new' because they can cause invocation, and '='
-				// because it can cause mutation. But just to be safe, we want to reject all
-				// unexpected forms.
-
-				// We split the first stage into 4 regexp operations in order to work around
-				// crippling inefficiencies in IE's and Safari's regexp engines. First we
-				// replace all backslash pairs with '@' (a non-JSON character). Second, we
-				// replace all simple value tokens with ']' characters. Third, we delete all
-				// open brackets that follow a colon or comma or that begin the text. Finally,
-				// we look to see that the remaining characters are only whitespace or ']' or
-				// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
-				if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/b-u]/g, '@').
-						replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
-						replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-					return eval('(' + text + ')');
-				}
-				// If the text is not JSON parseable, then return false.
-
-				return false;
-			}
-		};
-	}();	
+		
+		return obj;
+	}
 }
-

Modified: trunk/htdocs/update.bml
===================================================================
--- trunk/htdocs/update.bml	2011-08-15 10:25:35 UTC (rev 19727)
+++ trunk/htdocs/update.bml	2011-08-15 10:27:20 UTC (rev 19728)
@@ -466,6 +466,7 @@
                 ."'fotki.album.uploading.image': '".BML::ml('fotki.album.uploading.image')."',"
                 ."'fotki.album.available.now': '".BML::ml('fotki.album.available.now')."',"
     			."'fotki.album.click.image': '".BML::ml('fotki.album.click.image')."',"
+				."'fotki.album.uploading.message': '".BML::ml('fotki.album.uploading.message')."',"
     			."'fotki.album.remove.image': '".BML::ml('fotki.album.remove.image')."',"
                 ."'fotki.album.create.new': '".BML::ml('fotki.album.create.new')."'";
             $$body .= <<JS;

Tags: aralot, bml, dat, js, livejournal
  • 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