Previsualizer

Permet de prévisualiser un topic.

اعتبارا من 02-04-2015. شاهد أحدث إصدار.

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name        Previsualizer
// @namespace   JVScript
// @include     http://www.jeuxvideo.com/forums/0
// @version     1
// @description Permet de prévisualiser un topic. 
// @require		http://code.jquery.com/jquery-2.1.3.min.js
// @grant       GM_addStyle
// ==/UserScript==

"use strict";

(function() {

	function Link(node) {
		this.__content = document.createElement('div');
		this.__url = node.getElementsByTagName('a')[0].href;
		this.__node = node;
		this.initialize();
	}

	Link.prototype = {
		initialize: function() {
			var this_ = this;
			var container = $(this.__node).parent().parent().find('.info-img')[0];

			$(container).on('mouseenter', function() {
				$(this_.__content).html('<img  style="margin: auto; display: block !important; width: 25%;" src="http://s3.noelshack.com/uploads/images/20188032684831_loading.gif" alt="Loading" />')
				$.get(this_.__url)
					.done(function(response) {
						var success =  $($.parseHTML(response)).find(".bloc-message-forum");
						$(this_.__content).html($(success[0]).html());										
					})
			});
			$(this.__content).attr({
				'class': 'prev_content bloc-message-forum'
			})
			$(container).find('img:first-child').wrap('<a href="' + this.__url + '"></a>');
			$(container).append(this.__content);
		}
	}

	$('#sortable div.titre-topic').each(function() {
		new Link(this);
	})

	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'
		+ '.info-img:hover .prev_content {display: block;}\n'
		+ '.sujet-topic {overflow: visible !important;}\n'
		+ '.prev_content img {position: relative !important; display: inline !important;}\n'
		+ 'prev_content:before {content: url("http://s3.noelshack.com/uploads/images/2575252458999_arrow.png"); z-index: 1001;}'
	);

})();