namespacing widgets, IE9 hotfix
This commit is contained in:
		
							parent
							
								
									3afb36c788
								
							
						
					
					
						commit
						4263c3fb8d
					
				@ -5,7 +5,12 @@
 | 
				
			|||||||
 * Coded by Piero VDFN <vogliadifarniente@gmail.com>
 | 
					 * Coded by Piero VDFN <vogliadifarniente@gmail.com>
 | 
				
			||||||
 * Released under GNU GPL v2
 | 
					 * Released under GNU GPL v2
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
function wclass() {
 | 
					
 | 
				
			||||||
 | 
					// HOTFIX: We can't upgrade to jQuery UI 1.8.6 (yet)
 | 
				
			||||||
 | 
					// This hotfix makes older versions of jQuery UI drag-and-drop work in IE9
 | 
				
			||||||
 | 
					(function($){var a=$.ui.mouse.prototype._mouseMove;$.ui.mouse.prototype._mouseMove=function(b){if($.browser.msie&&document.documentMode>=9){b.button=1};a.apply(this,[b]);}}(jQuery));
 | 
				
			||||||
 | 
					var FlatPress = {
 | 
				
			||||||
 | 
					wclass: function() {
 | 
				
			||||||
	$('.widget-class').draggable({
 | 
						$('.widget-class').draggable({
 | 
				
			||||||
		'scroll' : true,
 | 
							'scroll' : true,
 | 
				
			||||||
		'helper':function(event) {
 | 
							'helper':function(event) {
 | 
				
			||||||
@ -20,8 +25,9 @@ function wclass() {
 | 
				
			|||||||
			}).addClass('widget-dragger');
 | 
								}).addClass('widget-dragger');
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					},
 | 
				
			||||||
function winstancedrag() {
 | 
					
 | 
				
			||||||
 | 
					winstancedrag: function() {
 | 
				
			||||||
	$('.widget-instance').draggable({
 | 
						$('.widget-instance').draggable({
 | 
				
			||||||
		'scroll' : true,
 | 
							'scroll' : true,
 | 
				
			||||||
		'helper':function(event) {
 | 
							'helper':function(event) {
 | 
				
			||||||
@ -34,8 +40,8 @@ function winstancedrag() {
 | 
				
			|||||||
			}).addClass('widget-dragger');
 | 
								}).addClass('widget-dragger');
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					},
 | 
				
			||||||
function wplaceholder() {
 | 
					wplaceholder: function() {
 | 
				
			||||||
	$('.widget-placeholder').droppable({
 | 
						$('.widget-placeholder').droppable({
 | 
				
			||||||
		'accept' : '.widget-class, .widget-dragger, .widget-instance',
 | 
							'accept' : '.widget-class, .widget-dragger, .widget-instance',
 | 
				
			||||||
		'over' : function(event, ui) {
 | 
							'over' : function(event, ui) {
 | 
				
			||||||
@ -59,11 +65,11 @@ function wplaceholder() {
 | 
				
			|||||||
			if(parent.children().length<1) {
 | 
								if(parent.children().length<1) {
 | 
				
			||||||
				parent.append('<li class="widget-placeholder">Drop here</li>');
 | 
									parent.append('<li class="widget-placeholder">Drop here</li>');
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			wreload();
 | 
								FlatPress.wreload();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					},
 | 
				
			||||||
function winstancedrop() {
 | 
					winstancedrop: function() {
 | 
				
			||||||
	$('.widget-instance').droppable({	
 | 
						$('.widget-instance').droppable({	
 | 
				
			||||||
		'accept' : '.widget-class, .widget-dragger, .widget-instance',
 | 
							'accept' : '.widget-class, .widget-dragger, .widget-instance',
 | 
				
			||||||
		'over' : function(event, ui) {
 | 
							'over' : function(event, ui) {
 | 
				
			||||||
@ -88,11 +94,11 @@ function winstancedrop() {
 | 
				
			|||||||
			if(parent.children().length<1) {
 | 
								if(parent.children().length<1) {
 | 
				
			||||||
				parent.append('<li class="widget-placeholder">Drop here</li>');
 | 
									parent.append('<li class="widget-placeholder">Drop here</li>');
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			wreload();
 | 
								FlatPress.wreload();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					},
 | 
				
			||||||
function wtrash() {
 | 
					wtrash: function() {
 | 
				
			||||||
	$('#widget-trashcan').droppable({
 | 
						$('#widget-trashcan').droppable({
 | 
				
			||||||
		'accept' : '.widget-instance',
 | 
							'accept' : '.widget-instance',
 | 
				
			||||||
		'over' : function(event, ui) {
 | 
							'over' : function(event, ui) {
 | 
				
			||||||
@ -123,16 +129,18 @@ function wtrash() {
 | 
				
			|||||||
				draggable.remove();
 | 
									draggable.remove();
 | 
				
			||||||
			});
 | 
								});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			wreload();
 | 
								FlatPress.wreload();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					},
 | 
				
			||||||
function wreload(){
 | 
					wreload: function(){
 | 
				
			||||||
	wclass();
 | 
						this.wclass();
 | 
				
			||||||
	winstancedrag();
 | 
						this.winstancedrag();
 | 
				
			||||||
	wplaceholder();
 | 
						this.wplaceholder();
 | 
				
			||||||
	winstancedrop();
 | 
						this.winstancedrop();
 | 
				
			||||||
	//wtrash();
 | 
						//wtrash();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
//$(document).ready(wreload);
 | 
					//$(document).ready(wreload);
 | 
				
			||||||
wreload();wtrash();
 | 
					FlatPress.wreload();FlatPress.wtrash();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user