| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | <!--
 | 
					
						
							|  |  |  | TODO: | 
					
						
							|  |  |  | - basic structure | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	ribbons					DONE | 
					
						
							|  |  |  | 	images					DONE | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	indicators | 
					
						
							|  |  |  | - basic control elements | 
					
						
							|  |  |  | 	touch zones / buttons | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 		next				DONE | 
					
						
							|  |  |  | 		prev				DONE | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 		shift up			DONE | 
					
						
							|  |  |  | 		shift down			DONE | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 		promote				DONE | 
					
						
							|  |  |  | 		demote				DONE | 
					
						
							|  |  |  | 		zoom in				~		need real zooming... | 
					
						
							|  |  |  | 		zoom out			~		need real zooming... | 
					
						
							|  |  |  | 		toggle single image	DONE | 
					
						
							|  |  |  | - image sorting | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 	- will affect: | 
					
						
							|  |  |  | 		- promote | 
					
						
							|  |  |  | 		- demote | 
					
						
							|  |  |  | 		- shift up | 
					
						
							|  |  |  | 		- shift down | 
					
						
							|  |  |  | 		- ribbon merging | 
					
						
							| 
									
										
										
										
											2012-06-07 01:59:34 +04:00
										 |  |  | - add promote/demote events (to attach structure editors)... | 
					
						
							|  |  |  | - add real images... | 
					
						
							|  |  |  | - make all the code relative to the current selection (multiple instances on a page support) | 
					
						
							|  |  |  | - make this into a jquery plugin... | 
					
						
							|  |  |  | - add dynamic loading and unloading for very large sets... | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | - first stage refactoring: | 
					
						
							|  |  |  | 	- merge almost identical functions... | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | ISSUES: | 
					
						
							|  |  |  | 	- jumping... | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | --> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script src="jquery.js"></script> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $(document).ready(function() { | 
					
						
							| 
									
										
										
										
											2012-06-07 03:20:39 +04:00
										 |  |  | 	// current state... | 
					
						
							|  |  |  | 	if($('.current-ribbon').length == 0){ | 
					
						
							|  |  |  | 		$('.ribbon').first().addClass('current-ribbon') | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	if($('.current-image').length == 0){ | 
					
						
							|  |  |  | 		$('.current-ribbon').children('.image').first().addClass('current-image') | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	// setup event handlers... | 
					
						
							|  |  |  | 	$(document).keydown(handleKeys) | 
					
						
							| 
									
										
										
										
											2012-06-07 02:23:38 +04:00
										 |  |  | 	$(".image").click(handleClick) | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 03:20:39 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	// set the default position... | 
					
						
							|  |  |  | 	$('.current-image').click() | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2012-06-05 17:35:13 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 03:20:39 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:23:38 +04:00
										 |  |  | function handleClick(e) { | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	var cur = $(this) | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	// switch classes... | 
					
						
							|  |  |  | 	cur.parents().siblings().children(".image").removeClass("current-image") | 
					
						
							|  |  |  | 	cur.siblings(".image").removeClass("current-image") | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	cur.siblings().children(".image").removeClass("current-image") | 
					
						
							|  |  |  | 	cur.parents().siblings(".ribbon").removeClass("current-ribbon") | 
					
						
							| 
									
										
										
										
											2012-06-06 16:59:32 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	cur.addClass("current-image") | 
					
						
							|  |  |  | 	cur.parents(".ribbon").addClass("current-ribbon") | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	var container = cur.parents('.container') | 
					
						
							|  |  |  | 	var field = cur.parents(".field") | 
					
						
							| 
									
										
										
										
											2012-06-05 17:28:50 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	var image_offset = cur.offset() | 
					
						
							|  |  |  | 	var field_offset = field.offset() | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	// center the current image... | 
					
						
							|  |  |  | 	field.css({ | 
					
						
							|  |  |  | 			left: field_offset.left - image_offset.left + (container.innerWidth() - cur.innerWidth())/2,  | 
					
						
							|  |  |  | 			top: field_offset.top - image_offset.top + (container.innerHeight() - cur.innerHeight())/2  | 
					
						
							|  |  |  | 		}) | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// XXX do I need this??? | 
					
						
							|  |  |  | 	e.preventDefault(); | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | var keys = { | 
					
						
							|  |  |  | 	toggleHelpKeys: [72], | 
					
						
							|  |  |  | 	toggleRibbonView: [32], | 
					
						
							|  |  |  | 	closeKeys: [27, 88, 67], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 	firstKeys: [36], | 
					
						
							|  |  |  | 	lastKeys: [35], | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | 	previousKeys: [37, 80], | 
					
						
							|  |  |  | 	nextKeys: [39, 78], | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 	promoteKeys: [40], | 
					
						
							|  |  |  | 	demoteKeys: [38], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 	ignoreKeys: [16, 17, 18], | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	helpShowOnUnknownKey: true | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function handleKeys(event){ | 
					
						
							|  |  |  | 	var code = event.keyCode, fn = $.inArray; | 
					
						
							|  |  |  | 	var _ = (fn(code, keys.closeKeys) >= 0) ? function(){}() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 		: (fn(code, keys.firstKeys) >= 0) ? firstImage() | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | 		: (fn(code, keys.nextKeys) >= 0) ? nextImage() | 
					
						
							|  |  |  | 		: (fn(code, keys.previousKeys) >= 0) ? prevImage() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 		: (fn(code, keys.lastKeys) >= 0) ? lastImage() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 		: (fn(code, keys.promoteKeys) >= 0) ? function(){ | 
					
						
							|  |  |  | 			if(event.shiftKey){ | 
					
						
							| 
									
										
										
										
											2012-06-07 03:12:39 +04:00
										 |  |  | 				if(event.ctrlKey){ | 
					
						
							|  |  |  | 					createRibbonBelow() | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 				promoteImage() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2012-06-07 03:12:39 +04:00
										 |  |  | 				focusBelowRibbon() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		}() | 
					
						
							|  |  |  | 		: (fn(code, keys.demoteKeys) >= 0) ? function(){ | 
					
						
							|  |  |  | 			if(event.shiftKey){ | 
					
						
							| 
									
										
										
										
											2012-06-07 03:12:39 +04:00
										 |  |  | 				if(event.ctrlKey){ | 
					
						
							|  |  |  | 					createRibbonAbove() | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 				demoteImage() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2012-06-07 03:12:39 +04:00
										 |  |  | 				focusAboveRibbon() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		}() | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | 		: (fn(code, keys.toggleRibbonView) >= 0) ? toggleRibbonView() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 		: (fn(code, keys.ignoreKeys) >= 0) ? false | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | 		// XXX | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 		: (keys.helpShowOnUnknownKey) ? function(){alert(code)}() | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | 		: false; | 
					
						
							|  |  |  | 	return false; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | // modes... | 
					
						
							|  |  |  | function showRibbon(){ | 
					
						
							| 
									
										
										
										
											2012-06-06 16:53:06 +04:00
										 |  |  | 	$('.single-image-mode').removeClass('single-image-mode') | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | } | 
					
						
							|  |  |  | function showSingle(){ | 
					
						
							| 
									
										
										
										
											2012-06-06 16:53:06 +04:00
										 |  |  | 	$('.field').not('.single-image-mode').addClass('single-image-mode') | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-06 22:06:10 +04:00
										 |  |  | function toggleRibbonView(){ | 
					
						
							|  |  |  | 	if($('.single-image-mode').length > 0){ | 
					
						
							|  |  |  | 		showRibbon() | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		showSingle() | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | // XXX need to reposition the whole thing correctly... | 
					
						
							|  |  |  | function toggleWideView(){ | 
					
						
							|  |  |  | 	if($('.wide-view-mode').length > 0){ | 
					
						
							|  |  |  | 		$('.wide-view-mode') | 
					
						
							|  |  |  | 			.removeClass('wide-view-mode') | 
					
						
							|  |  |  | 			.one("webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend", function(){ | 
					
						
							|  |  |  | 				$('.current-image').click() | 
					
						
							|  |  |  | 				return true | 
					
						
							|  |  |  | 			}); | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		showRibbon() | 
					
						
							|  |  |  | 		//$('.container') | 
					
						
							|  |  |  | 		$('.field') | 
					
						
							|  |  |  | 			.not('.wide-view-mode') | 
					
						
							|  |  |  | 				.addClass('wide-view-mode') | 
					
						
							|  |  |  | 				.one("webkitTransitionEnd oTransitionEnd msTransitionEnd transitionend", function(){ | 
					
						
							|  |  |  | 					$('.current-image').click() | 
					
						
							|  |  |  | 					return true | 
					
						
							|  |  |  | 				}); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 17:50:58 +04:00
										 |  |  | // basic navigation... | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | function firstImage(){ | 
					
						
							|  |  |  | 	$('.current-ribbon').children('.image').first().click() | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | function prevImage(){ | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	$('.current-image') | 
					
						
							|  |  |  | 		.prev('.image') | 
					
						
							|  |  |  | 			.click() | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-05 17:50:58 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | function nextImage(){ | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	$('.current-image') | 
					
						
							|  |  |  | 		.next('.image') | 
					
						
							|  |  |  | 			.click() | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | function lastImage(){ | 
					
						
							|  |  |  | 	$('.current-ribbon').children('.image').last().click() | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // XXX select appropriate image... | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | function focusAboveRibbon(){ | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 	$('.current-ribbon').prev('.ribbon').children('.image').first().click() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-05 17:50:58 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | // XXX select appropriate image... | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | function focusBelowRibbon(){ | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 	$('.current-ribbon').next('.ribbon').children('.image').first().click() | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-05 17:50:58 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // create ribbon above/below helpers... | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | function createRibbonAbove(){ | 
					
						
							|  |  |  | 	return $('<div class="new-ribbon"></div>') | 
					
						
							|  |  |  | 		.insertBefore('.current-ribbon') | 
					
						
							|  |  |  | 		// HACK: without this, the class change below will not animate... | 
					
						
							|  |  |  | 		.show() | 
					
						
							|  |  |  | 		.addClass('ribbon') | 
					
						
							|  |  |  | 		.removeClass('new-ribbon') | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function createRibbonBelow(){ | 
					
						
							|  |  |  | 	return $('<div class="new-ribbon"></div>') | 
					
						
							|  |  |  | 		.insertAfter('.current-ribbon') | 
					
						
							|  |  |  | 		// HACK: without this, the class change below will not animate... | 
					
						
							|  |  |  | 		.show() | 
					
						
							|  |  |  | 		.addClass('ribbon') | 
					
						
							|  |  |  | 		.removeClass('new-ribbon') | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | // Modifiers... | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | // XXX sort elements correctly... | 
					
						
							|  |  |  | function mergeRibbonsUp(){ | 
					
						
							|  |  |  | 	$('.current-ribbon') | 
					
						
							|  |  |  | 		.prev('.ribbon') | 
					
						
							|  |  |  | 			.children() | 
					
						
							|  |  |  | 				.detach() | 
					
						
							|  |  |  | 				.insertAfter('.current-image') | 
					
						
							|  |  |  | 	$('.current-ribbon') | 
					
						
							|  |  |  | 		.prev('.ribbon') | 
					
						
							|  |  |  | 			.slideUp(function(){ | 
					
						
							|  |  |  | 				$(this).remove() | 
					
						
							|  |  |  | 				$('.current-image').click() | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // XXX sort elements correctly... | 
					
						
							|  |  |  | function mergeRibbonsDown(){ | 
					
						
							|  |  |  | 	$('.current-ribbon') | 
					
						
							|  |  |  | 		.next('.ribbon') | 
					
						
							|  |  |  | 			.children() | 
					
						
							|  |  |  | 				.detach() | 
					
						
							|  |  |  | 				.insertAfter('.current-image') | 
					
						
							|  |  |  | 	$('.current-ribbon') | 
					
						
							|  |  |  | 		.next('.ribbon') | 
					
						
							|  |  |  | 			.slideUp(function(){ | 
					
						
							|  |  |  | 				$(this).remove() | 
					
						
							|  |  |  | 				$('.current-image').click() | 
					
						
							|  |  |  | 			}) | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-05 17:50:58 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | // XXX sort elements correctly... | 
					
						
							|  |  |  | // XXX do animations... | 
					
						
							|  |  |  | function promoteImage(){ | 
					
						
							|  |  |  | 	if($('.current-ribbon').next('.ribbon').length == 0){ | 
					
						
							|  |  |  | 		createRibbonBelow() | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	// XXX sort elements correctly... | 
					
						
							|  |  |  | 	if($('.current-ribbon').children('.image').length == 1){ | 
					
						
							| 
									
										
										
										
											2012-06-07 02:27:26 +04:00
										 |  |  | 		// XXX this adds image to the head while the below portion adds it to the tail... | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 		mergeRibbonsDown() | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		img = $('.current-image') | 
					
						
							|  |  |  | 		if(img.next('.image').length == 0){ | 
					
						
							|  |  |  | 			prevImage() | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			nextImage() | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		img | 
					
						
							|  |  |  | 			.detach() | 
					
						
							|  |  |  | 			.appendTo($('.current-ribbon').next('.ribbon')) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-06-07 01:55:51 +04:00
										 |  |  | 	$('.current-image').click() | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-05 17:50:58 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | // XXX sort elements correctly... | 
					
						
							|  |  |  | // XXX do animations... | 
					
						
							|  |  |  | function demoteImage(){ | 
					
						
							|  |  |  | 	if($('.current-ribbon').prev('.ribbon').length == 0){ | 
					
						
							|  |  |  | 		createRibbonAbove() | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	// XXX sort elements correctly... | 
					
						
							|  |  |  | 	if($('.current-ribbon').children('.image').length == 1){ | 
					
						
							|  |  |  | 		// XXX this adds image to the head while thebelow portion adds it to the tail... | 
					
						
							|  |  |  | 		mergeRibbonsUp() | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		img = $('.current-image') | 
					
						
							|  |  |  | 		if(img.next('.image').length == 0){ | 
					
						
							|  |  |  | 			prevImage() | 
					
						
							|  |  |  | 		} else { | 
					
						
							|  |  |  | 			nextImage() | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		img | 
					
						
							|  |  |  | 			.detach() | 
					
						
							|  |  |  | 			.appendTo($('.current-ribbon').prev('.ribbon')) | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-06-07 01:55:51 +04:00
										 |  |  | 	$('.current-image').click() | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-06-05 17:50:58 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style> | 
					
						
							| 
									
										
										
										
											2012-06-05 17:44:42 +04:00
										 |  |  | 	.image { | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		position: relative; | 
					
						
							|  |  |  | 		display: inline-block; | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 17:44:42 +04:00
										 |  |  | 		opacity: 0.3; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							| 
									
										
										
										
											2012-06-05 17:44:42 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		cursor: hand; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.mock-image { | 
					
						
							| 
									
										
										
										
											2012-06-06 16:16:13 +04:00
										 |  |  | 		width: 350px; | 
					
						
							|  |  |  | 		height: 350px; | 
					
						
							| 
									
										
										
										
											2012-06-05 17:44:42 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		background: blue; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.container { | 
					
						
							|  |  |  | 		overflow: hidden; | 
					
						
							| 
									
										
										
										
											2012-06-06 16:16:13 +04:00
										 |  |  | 		width: 800px; | 
					
						
							|  |  |  | 		height: 500px; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.field { | 
					
						
							|  |  |  | 		position: relative; | 
					
						
							|  |  |  | 		overflow: visible; | 
					
						
							|  |  |  | 		top: 0px; | 
					
						
							|  |  |  | 		left: -100px; | 
					
						
							| 
									
										
										
										
											2012-06-05 17:35:13 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.ribbon { | 
					
						
							| 
									
										
										
										
											2012-06-06 16:16:13 +04:00
										 |  |  | 		height: 360px; | 
					
						
							| 
									
										
										
										
											2012-06-07 02:27:26 +04:00
										 |  |  | 		/* XXX make this expand dynamically */ | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | 		width: 10000px; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		overflow: visible; | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		padding-top: 2px; | 
					
						
							|  |  |  | 		padding-bottom: 2px; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		text-align: center; | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 		opacity: 0.2; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	.new-ribbon { | 
					
						
							|  |  |  | 		height: 0px; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	.current-image { | 
					
						
							| 
									
										
										
										
											2012-06-05 17:44:42 +04:00
										 |  |  | 		opacity: 1.0; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.current-ribbon { | 
					
						
							| 
									
										
										
										
											2012-06-06 16:16:13 +04:00
										 |  |  | 		padding-top: 20px; | 
					
						
							|  |  |  | 		padding-bottom: 20px; | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		opacity: 1.0; | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		-webkit-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-moz-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-o-transition: all 0.5s ease; | 
					
						
							|  |  |  | 		-ms-transition: all 0.5s ease;	 | 
					
						
							|  |  |  | 		transition: all 0.5s ease; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.current-ribbon .image { | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 16:59:32 +04:00
										 |  |  | 	/* single image theme (start everything with .single-image-mode)  | 
					
						
							|  |  |  | 	 * | 
					
						
							|  |  |  | 	 * XXX need to make this touch friendly... | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2012-06-06 16:53:06 +04:00
										 |  |  | 	.single-image-mode .image { | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | 		opacity: 0.0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 16:53:06 +04:00
										 |  |  | 	.single-image-mode .image:hover { | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | 		opacity: 0.5; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 16:53:06 +04:00
										 |  |  | 	.single-image-mode .current-image:hover, .single-image-mode .current-image { | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | 		opacity: 1.0; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:27:26 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 	/* wide view mode */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* XXX not yet working correctly... | 
					
						
							|  |  |  | 	.wide-view-mode { | 
					
						
							|  |  |  | 		transform: scale(0.2,0.2); | 
					
						
							|  |  |  | 		-ms-transform: scale(0.2,0.2); | 
					
						
							|  |  |  | 		-webkit-transform: scale(0.2,0.2); | 
					
						
							|  |  |  | 		-o-transform: scale(0.2,0.2); | 
					
						
							|  |  |  | 		-moz-transform: scale(0.2,0.2); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	*/ | 
					
						
							|  |  |  | 	.wide-view-mode .mock-image { | 
					
						
							|  |  |  | 		width: 50px; | 
					
						
							|  |  |  | 		height: 50px; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	.wide-view-mode .ribbon { | 
					
						
							|  |  |  | 		height: 60px; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | </style> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div class="container"> | 
					
						
							|  |  |  | 	<div class="field"> | 
					
						
							| 
									
										
										
										
											2012-06-07 03:20:39 +04:00
										 |  |  | 		<div class="ribbon"> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							| 
									
										
										
										
											2012-06-07 02:20:14 +04:00
										 |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 			<div class="image mock-image"></div> | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							|  |  |  | 			<div class="image mock-image"></div> | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 			<div class="image mock-image"></div> | 
					
						
							| 
									
										
										
										
											2012-06-05 15:26:41 +04:00
										 |  |  | 		</div> | 
					
						
							|  |  |  | 	</div> | 
					
						
							|  |  |  | </div> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | <button onclick="firstImage()">first (home)</button> | 
					
						
							| 
									
										
										
										
											2012-06-07 01:55:51 +04:00
										 |  |  | <button onclick="prevImage()">prev (left)</button> | 
					
						
							|  |  |  | <button onclick="nextImage()">next (right)</button> | 
					
						
							| 
									
										
										
										
											2012-06-07 02:54:13 +04:00
										 |  |  | <button onclick="lastImage()">last (end)</button> | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | <br><br> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <button onclick="showSingle()">single</button> | 
					
						
							|  |  |  | <button onclick="showRibbon()">ribbon</button> | 
					
						
							| 
									
										
										
										
											2012-06-07 01:55:51 +04:00
										 |  |  | <button onclick="toggleRibbonView()">toggle ribbon view (space)</button> | 
					
						
							| 
									
										
										
										
											2012-06-06 16:47:53 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | <br><br> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <button onclick="toggleWideView()">toggle wide view</button> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <br><br> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <button onclick="createRibbonAbove()">create ribbon above</button><br> | 
					
						
							|  |  |  | <button onclick="createRibbonBelow()">create ribbon below</button> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <br><br> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <button onclick="mergeRibbonsUp()">merge ribbons up</button><br> | 
					
						
							|  |  |  | <button onclick="mergeRibbonsDown()">merge ribbons down</button> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <br><br> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 03:12:39 +04:00
										 |  |  | <button onclick="demoteImage()">demote image (shift-up)</button><br> | 
					
						
							|  |  |  | <button onclick="promoteImage()">promote image (shift-down)</button><br> | 
					
						
							|  |  |  | NOTE: ctrl-shift-up / ctrl-shift-down will demote / promote an image to a new empty ribbon (the default if no ribbon exists) | 
					
						
							| 
									
										
										
										
											2012-06-07 02:14:17 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | <br><br> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 03:12:39 +04:00
										 |  |  | <button onclick="focusAboveRibbon()">focus above ribbon (up)</button><br> | 
					
						
							|  |  |  | <button onclick="focusBelowRibbon()">focus below ribbon (down)</button> | 
					
						
							| 
									
										
										
										
											2012-06-07 01:50:44 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 16:59:32 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-05 16:28:47 +04:00
										 |  |  | <!-- vim:set ts=4 sw=4 nowrap : --> |