mirror of
				https://github.com/flynx/PortableMag.git
				synced 2025-10-31 12:00:11 +00:00 
			
		
		
		
	filled in some blanks and minor refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									0dbf94195b
								
							
						
					
					
						commit
						5f18f87e74
					
				
							
								
								
									
										28
									
								
								magazine.js
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								magazine.js
									
									
									
									
									
								
							| @ -1192,6 +1192,7 @@ var MagazineTemplates = { | |||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	// magazine index...
 | 	// magazine index...
 | ||||||
|  | 	// XXX ugly code, revise...
 | ||||||
| 	'.article-index': function(elem){ | 	'.article-index': function(elem){ | ||||||
| 		var list = $('<ul/>') | 		var list = $('<ul/>') | ||||||
| 		var mag = $('.magazine') | 		var mag = $('.magazine') | ||||||
| @ -1225,7 +1226,6 @@ var MagazineTemplates = { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // XXX call this on page edits...
 |  | ||||||
| function runMagazineTemplates(){ | function runMagazineTemplates(){ | ||||||
| 	for(var tpl in MagazineTemplates){ | 	for(var tpl in MagazineTemplates){ | ||||||
| 		MagazineTemplates[tpl]($(tpl)) | 		MagazineTemplates[tpl]($(tpl)) | ||||||
| @ -1233,6 +1233,7 @@ function runMagazineTemplates(){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| /************************************************ editor: magazine ***/ | /************************************************ editor: magazine ***/ | ||||||
| 
 | 
 | ||||||
| // load the data...
 | // load the data...
 | ||||||
| @ -1265,6 +1266,8 @@ function loadMagazine(mag, position, bookmarks){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | // NOTE: this will, in addition to the magazine itself, will populate with
 | ||||||
|  | // 		the basic content (cover, article, article cover)
 | ||||||
| function createBaseMagazine(title, cover, article){ | function createBaseMagazine(title, cover, article){ | ||||||
| 	removeMagazine() | 	removeMagazine() | ||||||
| 	var mag = loadMagazine(createMagazine(title, cover, article)) | 	var mag = loadMagazine(createMagazine(title, cover, article)) | ||||||
| @ -1286,7 +1289,6 @@ function removeMagazine(){ | |||||||
| 
 | 
 | ||||||
| /************************************************* editor: article ***/ | /************************************************* editor: article ***/ | ||||||
| 
 | 
 | ||||||
| // XXX create article...
 |  | ||||||
| function createArticleBefore(article, title){ | function createArticleBefore(article, title){ | ||||||
| 	if(article == null){ | 	if(article == null){ | ||||||
| 		article = $('.current.page').parents('.article') | 		article = $('.current.page').parents('.article') | ||||||
| @ -1309,14 +1311,32 @@ function createArticleAfter(article, title){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | // XXX TEST!
 | ||||||
| function shiftArticleLeft(article){ | function shiftArticleLeft(article){ | ||||||
| 	// XXX
 | 	var articles = $('.article') | ||||||
|  | 	var i = articles.index(article) | ||||||
|  | 	if(i <= 0){ | ||||||
|  | 		return article | ||||||
|  | 	} | ||||||
|  | 	var target = $(articles[i-1]) | ||||||
|  | 	article | ||||||
|  | 		.detach() | ||||||
|  | 		.insertBefore(target) | ||||||
| 	setCurrentPage() | 	setCurrentPage() | ||||||
| 	$('.viewer').trigger('articleMoved', res) | 	$('.viewer').trigger('articleMoved', res) | ||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
|  | // XXX TEST!
 | ||||||
| function shiftArticleRight(article){ | function shiftArticleRight(article){ | ||||||
| 	// XXX
 | 	var articles = $('.article') | ||||||
|  | 	var i = articles.index(article) | ||||||
|  | 	if(i >= articles.length){ | ||||||
|  | 		return article | ||||||
|  | 	} | ||||||
|  | 	var target = $(articles[i+1]) | ||||||
|  | 	article | ||||||
|  | 		.detach() | ||||||
|  | 		.insertAfter(target) | ||||||
| 	setCurrentPage() | 	setCurrentPage() | ||||||
| 	$('.viewer').trigger('articleMoved', res) | 	$('.viewer').trigger('articleMoved', res) | ||||||
| 	return res | 	return res | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user