mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-10-31 03:50:16 +00:00 
			
		
		
		
	json version...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									0bd08709a1
								
							
						
					
					
						commit
						2c796d930d
					
				
							
								
								
									
										10
									
								
								magazine.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user