NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Previsualizer // @namespace JVScript // @include http://www.jeuxvideo.com/* // @version 5.2 // @require http://code.jquery.com/jquery-2.1.3.min.js // @grant GM_addStyle // @copyright MIT // @description Permet de prévisualiser un topic. // ==/UserScript== "use strict"; (function() { function Link(node) { this.$message = $('<div></div>'); this.$message.attr('class', 'prev_content bloc-message-forum'); this.$topic = node; this.initialize(); } Link.prototype = { initialize: function() { var url = this.$topic.find('a.topic-title').attr('href'); this.$topic.append(this.$message); this.$topic.find('.topic-img').on('mouseenter', (function() { $.get(url).done((function(response) { var success = $($.parseHTML(response)).find('.bloc-message-forum'); this.$message.html($(success[0]).html()); }).bind(this)); }).bind(this)); } } function addPreload() { $('.topic-list li:not(.topic-head)').each(function() { new Link($(this)); }); } addPreload(); addEventListener('instantclick:newpage', addPreload); GM_addStyle( '.prev_content {' + 'position: absolute;' + 'z-index: 1000;' + 'width: 595px;' + 'max-height: 500px;' + 'overflow-y: scroll;' + 'display: none;' + 'margin-left: 18px;' + 'font-weight: 200;' + '} \n' + '.topic-list li:hover .prev_content { display: block; }\n' ); })();