From 2c796d930dfeb2da1ea163b8bf4910f021a30856 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 2 Feb 2013 01:51:08 +0400 Subject: [PATCH] json version... Signed-off-by: Alex A. Naanou --- magazine.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/magazine.js b/magazine.js index 9387063..9a7380b 100755 --- a/magazine.js +++ b/magazine.js @@ -1000,6 +1000,8 @@ function writeMetadata(elem, res, metadata){ return elem } +var JSON_VERSION = 0.1 + function buildJSON(export_bookmarks, export_position){ function _getContent(_, elem){ elem = $(elem) @@ -1040,6 +1042,8 @@ function buildJSON(export_bookmarks, export_position){ res.pages = $('.magazine > .page, .magazine > .article').map(_getContent).toArray(), res.bookmarks = export_bookmarks ? buildBookmarkList() : [] + res['format-version'] = JSON_VERSION + if(export_position){ res.position = getPageNumber() } @@ -1085,6 +1089,12 @@ function loadJSON(data, ignore_chrome){ writeMetadata(elem, res) } + // XXX check version... + var version = data['json-version'] + if(version != JSON_VERSION){ + console.warn('WARNING: JSON Format Version Mismatch.') + } + // create an empty magazine... var mag = createEmptyMagazine(data.title) writeMetadata(mag, data)