← All posts tagged JavaScript

hot-gay

Зацените, пацаны, я запилил автообновляку тредов в веб-интерфейсе.
// ==UserScript==
// @name        juick thread update
// @namespace   juick
// @include     /^http://juick.com/.*/[0-9]+$/
// @version     1
// ==/UserScript==

function update_thread() {
	request = new XMLHttpRequest();
	request.open("GET", document.URL, false);
	request.send();
	parser = new DOMParser();
	thread = parser.parseFromString(request.responseText, "text/html");
	replies = document.getElementById("replies");
	replies.parentNode.replaceChild(thread.getElementById("replies"), replies);
}

intervalID = setInterval(update_thread, 1000);

hot-gay

Хоть я и не силён в JS, но раз уж такое дело, то вот скриптик.
// ==UserScript==
// @name        juick
// @namespace   juick
// @description juick
// @include     http://juick.com/*
// @version     1
// ==/UserScript==

var pigs = ["@cool", "@2nya", "@bia2admin", "@pesarak-2010", "@khalkhali", "@arbon", "@markazi2", "@persia", "@Mostafa0111", "@bandariha", "@day2day", "@angle", "@sense1star@jabber.org", "@mile", "@iranians", "@Parsi", "@roya4197", "@fench", "@persian-juick", "@Persian-Gulf", "@HOBAB", "@javane", "@Faz-", "@hamoon@talkonaut.com", "@hamoon@talkonaut.com", "@azade", "@ma", "@tak", "@kamyab", "@datis", "@FIGHTER", "@zahedanian", "@tamana", "@hAji", "@zoom1", "@mahdisjon", "@tannaz", "@paryaa", "@azra", "@botic0111", "@hami", "@azadi", "@chete...@xmpp.ru", "@sarab", "@hormoz", "@.shiva.@xmpp.ru", "@sami", "@parand", "@safacity", "@irc", "@ahora", "@paria", "@kaveh", "@Asia", "@nazi", "@love2love", "@Taha", "@whisky", "@nymoniouzz", "@AKARII", "@feri", "@APPLE"];

var sheet = document.createElement("style");
sheet.innerHTML = ".pig{opacity: 0.2;}";
document.body.appendChild(sheet);

var messages = document.getElementsByClassName("msg");
for (var message in messages) {
	var name = messages[message].firstChild.firstChild.firstChild.nodeValue;
	if (pigs.indexOf(name) != -1) {
		messages[message].setAttribute("class", "msg pig");
	}		
}