// ==UserScript==
// @name JVC Prévisualiser
// @description Prévisualisation des topics JVC grace à un petit bouton
// @include http://www.jeuxvideo.com/forums/*
// @version 1.0
// @namespace https://greasyfork.org/users/11572
// @downloadURL none
// ==/UserScript==
(function() {
"use strict";
function ajax()
{
var xhr = new XMLHttpRequest()
xhr.open('get', this.url, true)
var _this = this
xhr.send()
xhr.onreadystatechange = function() {
if(xhr.readyState == 4)
_this.run(xhr.responseText)
}
}
function Icon(node)
{
this.a = document.createElement('a')
this.div = document.createElement('div')
this.img = document.createElement('img')
this.url = node.getElementsByTagName('a')[0].href
this.text = ''
this.initialize()
node.getElementsByTagName('a')[0].setAttribute('style', 'float: left; max-width: 272px')
node.setAttribute('style', 'text-align: left');
node.appendChild(this.a)
}
Icon.prototype = {
initialize: function()
{
this.a.setAttribute('class', 'prnode')
this.div.setAttribute('class', 'conteneur-message prediv bloc-message-forum')
this.img.src = 'http://s3.noelshack.com/uploads/images/12431829412728_topicpreview.png'
this.img.alt = 'P'
this.img.setAttribute('width', '80%')
var _this = this
this.img.addEventListener('mouseover', function()
{
_this.div.innerHTML = ''
ajax.call(_this)
},
false)
this.a.appendChild(this.img)
this.a.appendChild(this.div)
},
run: function(data)
{
var prems = data
//prems = prems.replace(/rel="nofollow" target="_blank"/gi,'')
prems = prems.split(/