HeartOfTheOak / PwndKill

// ==UserScript==
// @name        PwndKill
// @description PwndKill
// @author      HappyDestroy
// @namespace   http://*.jeuxvideo.com/*
// @include     http://*.jeuxvideo.com/*
// @include     http://*.forumjv.com/*
// @version     2.0
// ==/UserScript==

$(document).ready(function() {
	
	$('#prospect').remove();
	$('#outbrain').remove();
	
	var mySavedLargeMode = localStorage.getItem("largeMode");
	var mySavedExtraLargeMode = localStorage.getItem("extraLargeMode");
	var mySavedFontSize = localStorage.getItem("fontSize");
	var mySavedMargin = localStorage.getItem("margin");
	
	if(mySavedFontSize == undefined || mySavedFontSize == null) {
		mySavedFontSize = 11;
	}
	
	if(mySavedMargin == undefined || mySavedMargin == null) {
		mySavedMargin = 0;
	}
	
	$('.titre-topic').css('font-size', mySavedFontSize + 'px');
	$('.titre-topic > a').css('margin-top', mySavedMargin + 'px');
	$('.titre-topic > a').css('margin-bottom', mySavedMargin + 'px');
	
    var myLargeMode = '<li>\
						<span class="pull-left">Cacher le bloc "Info"</span>\
						<span data-action="on" class="interrupteur-inline simpleLargeMode">OUI</span>\
						<span data-action="off" class="interrupteur-inline actif pointer simpleLargeMode">NON</span>\
					  </li>';
    
	
    var myExtraLargeMode = '<li>\
						<span class="pull-left">Mode super large</span>\
						<span data-action="on" class="interrupteur-inline superLargeMode">OUI</span>\
						<span data-action="off" class="interrupteur-inline actif pointer superLargeMode">NON</span>\
					  </li>';
    
	var myFontSize = '<li>\
						<span class="pull-left">Taille des titre</span>\
						<span><input type="text" id="topicFontSize" value="' + mySavedFontSize + '" style="width:100px;"/>px</span> \
					  </li>';
	
	var mySpace = '<li>\
					<span class="pull-left">Espacement des topics </span>\
					<span><input type="text" id="topicSpace" value="' + mySavedMargin + '" style="width:100px;"/>px</span> \
				  </li>';
	
    $('ul.dropdown-menu.pull-right.menu-user-forum').append(myLargeMode);
    $('ul.dropdown-menu.pull-right.menu-user-forum').append(myExtraLargeMode);
    $('ul.dropdown-menu.pull-right.menu-user-forum').append(myFontSize);
    $('ul.dropdown-menu.pull-right.menu-user-forum').append(mySpace);
	
	
	if(mySavedLargeMode != undefined && mySavedLargeMode != null && mySavedLargeMode == 'true') {
		$('#forum-right-col').hide();
		$('#forum-main-col').css('width', '100%');
		
		$('.simpleLargeMode[data-action="on"').addClass('actif');
		$('.simpleLargeMode[data-action="off"').removeClass('actif');
		
		var checkLargeMode = true;
	}
	
	
	if(mySavedExtraLargeMode != undefined && mySavedExtraLargeMode != null && mySavedExtraLargeMode == 'true') {
		$('div.container.container-content').css('width', '100%');
		
		$('.superLargeMode[data-action="on"').addClass('actif');
		$('.superLargeMode[data-action="off"').removeClass('actif');
		
		var checkExtraLargeMode = true;
	}
	
	
	
	$('.simpleLargeMode').on('click', function() {
		if($(this).data('action') == 'on') {
			$('#forum-right-col').hide();
			$('#forum-main-col').css('width', '100%');
			
			$('.simpleLargeMode[data-action="on"').addClass('actif');
			$('.simpleLargeMode[data-action="off"').removeClass('actif');
			
			localStorage.setItem('largeMode', true);
		} else {
			$('#forum-right-col').show();
			$('#forum-main-col').css('width', '66%');
			
			$('.simpleLargeMode[data-action="off"').addClass('actif');
			$('.simpleLargeMode[data-action="on"').removeClass('actif');
			
			localStorage.setItem('largeMode', false);
		}
	});
	
	
	
	
	$('.superLargeMode').on('click', function() {
		if($(this).data('action') == 'on') {
			$('div.container.container-content').css('width', '100%');
			
			$('.superLargeMode[data-action="on"').addClass('actif');
			$('.superLargeMode[data-action="off"').removeClass('actif');
			
			localStorage.setItem('extraLargeMode', true);
		} else {
			$('div.container.container-content').css('width', '980px');
			
			$('.superLargeMode[data-action="off"').addClass('actif');
			$('.superLargeMode[data-action="on"').removeClass('actif');
			
			localStorage.setItem('extraLargeMode', false);
		}
	});
	
	$('#topicFontSize, #topicSpace').on('click', function(event) {
		event.stopPropagation();
	});
	
	$('#topicFontSize').on('change paste keyup', function(event) {
		$('.titre-topic').css('font-size', $(this).val() + 'px');
			
		localStorage.setItem('fontSize', $(this).val());
	});
	
	
	$('#topicSpace').on('change paste keyup', function(event) {
		$('.titre-topic > a').css('margin-top', $(this).val() + 'px');
		$('.titre-topic > a').css('margin-bottom', $(this).val() + 'px');
		
		localStorage.setItem('margin', $(this).val());
	});
});