draggable_DC

Make DC's windows draggable

As of 03. 06. 2014. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name		draggable_DC
// @author		Ladoria
// @version		0.8
// @description	Make DC's windows draggable
// @match		http://www.dreadcast.net/Main
// @copyright	2012+, Ladoria
// @namespace GTFO
// ==/UserScript==

// DEBUG DOn't touch those things!
var global_debug = false;
// /DEBUG

$(document).ready( function() {
	zone_gauche_initiale_offset = $('#zone_gauche').offset();
	zone_droite_initiale_offset = $('#zone_droite').offset();
	//zone_centre_initiale_offset = $('#zone_centre').offset();
	
	zone_gauche_initiale_zIndex = $('#zone_gauche').zIndex();
	zone_droite_initiale_zIndex = $('#zone_droite').zIndex();
	//zone_centre_initiale_zIndex = $('#zone_centre').zIndex();

	$('#zone_gauche').draggable();
	$('#zone_droite').draggable();
	//$('#zone_centre').draggable();
	$('#zone_informations_lieu').draggable();
    
    $('#zone_gauche').css('cursor','move');
    $('#zone_droite').css('cursor','move');
    //$('#zone_centre').css('cursor','move');
    $('#zone_informations_lieu').css('cursor','move');
});

var newDragged = true;
var zIndex = 310000;

$('#zone_gauche').dblclick( function() {
	$('#zone_gauche').offset(zone_gauche_initiale_offset);
	$('#zone_gauche').zIndex(zone_gauche_initiale_zIndex);
});
$('#zone_droite').dblclick( function() {
	$('#zone_droite').offset(zone_droite_initiale_offset);
	$('#zone_droite').zIndex(zone_droite_initiale_zIndex);
});
/*$('#zone_centre').dblclick( function() {
	$('#zone_centre').offset(zone_centre_initiale_offset);
	$('#zone_centre').zIndex(zone_centre_initiale_zIndex);
});*/
$('#zone_informations_lieu').dblclick( function() {
	$('#zone_informations_lieu').css('top','auto');
	$('#zone_informations_lieu').css('bottom','10px');
	$('#zone_informations_lieu').css('left','10px');
	$('#zone_centre').zIndex(zone_centre_initiale_zIndex);
});

$('#zone_gauche').click( function() {
	zIndex++;
	$('#zone_gauche').zIndex(zIndex);
});
$('#zone_droite').click( function() {
	zIndex++;
	$('#zone_droite').zIndex(zIndex);
});
/*$('#zone_centre').click( function() {
	zIndex++;
	$('#zone_centre').zIndex(zIndex);
});*/

$('#zone_gauche').bind('drag', function(event) {
	$('#zone_gauche').zIndex(zIndex);
	newDragged = true;
});
$('#zone_droite').bind('drag', function(event) {
	$('#zone_droite').zIndex(zIndex);
	newDragged = true;
});
/*$('#zone_centre').bind('drag', function(event) {
	$('#zone_centre').zIndex(zIndex);
	newDragged = true;
});*/
$('#zone_informations_lieu').bind('drag', function(event) {
	$('#zone_informations_lieu').css('position','absolute');
	$('#zone_informations_lieu').css('bottom','auto');
	$('#zone_informations_lieu').zIndex(zIndex);
	if(global_debug) console.log($('#zone_informations_lieu').zIndex());
});


$('#zone_gauche').mouseup( function() {
	if(newDragged) {
		if(global_debug) console.log("undrag, zIndex:" + zone_gauche_initiale_zIndex);
		zIndex++;
	}
});
$('#zone_droite').mouseup( function() {
	if(newDragged) {
		if(global_debug) console.log("undrag, zIndex:" + zone_droite_initiale_zIndex);
		zIndex++;
	}
});
/*$('#zone_centre').mouseup( function() {
	if(newDragged) {
		if(global_debug) console.log("undrag, zIndex:" + zone_gauche_initiale_zIndex);
		zIndex++;
	}
});*/