NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name PwndKill // @description PwndKill - Ajout de fonctionnalités à Respawn // @author HappyDestroy // @include http://*.jeuxvideo.com/* // @include http://*.forumjv.com/* // @exclude http://www.jeuxvideo.com/profil/* // @include https://*.jeuxvideo.com/* // @include https://*.forumjv.com/* // @exclude https://www.jeuxvideo.com/profil/* // @version 4.4.0 // @grant none // @license MIT // ==/UserScript== /******************* * AJOUT DE JQUERY * *******************/ function addJQuery(callback) { var script = document.createElement("script"); script.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"); script.addEventListener('load', function() { var script = document.createElement("script"); script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();"; document.body.appendChild(script); }, false); document.body.appendChild(script); } function main() { //Titre des topics jQ('.topic-subject').css('display', 'block'); jQ('.topic-list .topic-title').css('overflow', 'visible'); jQ('.topic-list .topic-title').css('white-space', 'initial'); //Divers jQ('#page-topics, #page-messages-forum').prev('.container').remove(); jQ('#bloc-formulaire-forum > .form-post-topic').css('margin', '0').css('padding-bottom', '1.875rem'); //Suppression de trucs inutiles (Pubs / video / ...) jQ('#forum-right-col > :nth-child(3)').remove(); jQ('#forum-right-col > :nth-child(7)').remove(); jQ('#forum-right-col > :nth-child(8)').remove(); jQ('.layout__row.layout__videoFooter').remove(); jQ('#jv-footer > .external-links').remove(); /**************************************** * VARIABLE SAUVEGARDÉES DEPUIS LE MENU * ****************************************/ var mySavedLargeMode = localStorage.getItem("largeMode"); var mySavedWidth = localStorage.getItem("forumWidth"); var mySavedFontSize = localStorage.getItem("fontSize"); var mySavedMargin = localStorage.getItem("margin"); var mySavedBackground = localStorage.getItem("background"); var mySavedShowSubMenu = localStorage.getItem("showSubMenu"); if(mySavedFontSize === undefined || mySavedFontSize === null) { mySavedFontSize = 11; } if(mySavedMargin === undefined || mySavedMargin === null) { mySavedMargin = 0; } if(mySavedBackground === undefined || mySavedBackground === null) { mySavedBackground = 'd4d4d4'; } if(mySavedWidth === undefined || mySavedWidth === null) { mySavedWidth = ''; } else { jQ('#page-topics, #page-messages-forum').css('width', mySavedWidth + '%'); } //Taille des titres des topics jQ('.topic-title').css('font-size', mySavedFontSize + 'px'); jQ('.topic-subject').css('margin-top', mySavedMargin + 'px'); //Couleur de fond de la page jQ('body').css('background', '#' + mySavedBackground); //Changement de la largeur de la page jQ('#page-topics, #page-messages-forum').css('display', 'block'); jQ('#page-topics, #page-messages-forum').css('margin', '5.875rem auto 0 auto'); jQ('.layout__row.layout__breadcrumb .bloc-fil-ariane-crumb-forum').css('margin', '0'); /**************************************** * BLOC HTML DES NOUVEAUX INPUT DU MENU * ****************************************/ var myLargeMode = '<li>\ <span class="pull-left">Cacher le bloc "Info"</span>\ <input type="checkbox" class="input-on-off" id="mode-large">\ <label for="mode-large" class="btn-on-off"></label>\ </li>'; var myExtraLargeMode = '<li>\ <span class="pull-left">Largeur</span>\ <span><input type="text" id="forumWidth" value="' + mySavedWidth + '" style="width:100px;"/>%</span> \ </li>'; var myFontSize = '<li>\ <span class="pull-left">Taille des titres</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>'; var myBackgroundColor = '<li>\ <span class="pull-left">Couleur du fond </span>\ #<span><input type="text" id="backgroundColor" value="' + mySavedBackground + '" /></span> \ </li>'; jQ('ul.dropdown-menu.pull-right.menu-user-forum').append(myLargeMode); jQ('ul.dropdown-menu.pull-right.menu-user-forum').append(myExtraLargeMode); jQ('ul.dropdown-menu.pull-right.menu-user-forum').append(myFontSize); jQ('ul.dropdown-menu.pull-right.menu-user-forum').append(mySpace); jQ('ul.dropdown-menu.pull-right.menu-user-forum').append(myBackgroundColor); jQ('#topicFontSize, #topicSpace, #backgroundColor, #forumWidth').on('click', function(event) { event.stopPropagation(); }); if(mySavedLargeMode !== undefined && mySavedLargeMode !== null && mySavedLargeMode == 'true') { jQ('#forum-right-col').hide(); jQ('#mode-large').prop('checked', true); } jQ('#mode-large').on('change', function() { if(jQ('#mode-large').prop('checked')) { jQ('#forum-right-col').hide(); localStorage.setItem('largeMode', 'true'); } else { jQ('#forum-right-col').show(); localStorage.setItem('largeMode', 'false'); } }); jQ('#topicFontSize').on('change paste keyup', function(event) { jQ('.topic-title').css('font-size', jQ(this).val() + 'px'); localStorage.setItem('fontSize', jQ(this).val()); }); jQ('#backgroundColor').on('change paste keyup', function(event) { jQ('body').css('background', '#' + jQ(this).val()); localStorage.setItem('background', jQ(this).val()); }); jQ('#topicSpace').on('change paste keyup', function(event) { jQ('.topic-subject').css('margin-top', jQ(this).val() + 'px'); jQ('.topic-subject').css('margin-bottom', jQ(this).val() + 'px'); localStorage.setItem('margin', jQ(this).val()); }); jQ('#forumWidth').on('change paste keyup', function(event) { jQ('#page-topics, #page-messages-forum').css('width', jQ(this).val() + '%'); localStorage.setItem('forumWidth', jQ(this).val()); }); jQ('ul.dropdown-menu.pull-right.menu-user-forum input[type="checkbox"]').hide(); /************************************ * GESTION DU CLICK SUR LES AVATARS * ************************************/ jQ('.back-img-msg div a').removeAttr('href').removeClass('JvCare').removeAttr('target').css('cursor', 'pointer'); jQ('.back-img-msg div a').on('click', function(e) { e.preventDefault() var myIMG = jQ(this).children('img').attr('src'); myIMG = myIMG.replace('avatar-md', 'avatar'); myIMG = myIMG.replace('avatars-md', 'avatars'); myIMG = myIMG.replace('avatar-sm', 'avatar'); myIMG = myIMG.replace('avatars-sm', 'avatars'); jQ('body').append('<div class="overlay-avatar"></div>'); jQ('body').append('<div class="popup-avatar"><img src="' + myIMG + '" /></div>'); jQ('.overlay-avatar').css('height', jQ(document).height()) .css('width', '100%') .css('background-color', 'rgba(0, 0, 0, 0.6)') .css('z-index', '9990') .css('position', 'absolute') .css('top', '0') .css('left', '0'); jQ('.popup-avatar').css('padding', '20px') .css('background-color', 'white') .css('z-index', '9999') .css('position', 'absolute') .css('top', 'calc(' + jQ(document).scrollTop() + 'px + 50%)') .css('left', '50%') .css('transform', 'translate(-50%,-50%)'); jQ('.popup-avatar, .overlay-avatar').on('click', function() { jQ('.popup-avatar, .overlay-avatar').remove(); }); }); if(mySavedShowSubMenu !== undefined && mySavedShowSubMenu !== null && mySavedShowSubMenu == 'false') { jQ('.header-bottom').hide(); jQ('#content').css('margin-top', '54px'); jQ('#show-subMenu').prop('checked', true); } jQ('#show-subMenu').on('change', function() { if(jQ('#show-subMenu').prop('checked')) { jQ('.header-bottom').hide(); jQ('#content').css('margin-top', '54px'); localStorage.setItem('showSubMenu', 'false'); } else { jQ('.header-bottom').show(); jQ('#content').css('margin-top', '94px'); localStorage.setItem('showSubMenu', 'true'); } }); } addJQuery(main);