» »

Slo-Tech userscripts

Slo-Tech userscripts

hruske ::

Ok, pokažite svojo CSS spretnost in spravite skup najbolj bizarne, odštekane, uporabne, subverzivne Slo-Tech userscripte. :)
Kalkulator nove omrežnine 2024 - https://omreznina.karlas.si/Kalkulator

hruske ::

Moj prvi so pobarvani nicki v stilu XChata


// ==UserScript==
// @name           Slo-Tech XChat colored nicks
// @namespace      slo-tech
// @include        https://slo-tech.com/forum*
// @include        http://slo-tech.com/forum*
// ==/UserScript==

var rcolors = ["#2a8c2a", "#fa0505", "#9c109c", "#f6fb09", "#3dcc3d", "#369090", "#05f2fe", "#6290c9", "#f705da"];
	
function colorize() {
	if (n) {
		var summa = 0, p = 0, n = $(this).find('a').html();
		for (var i=0; i<n.length; i++) {
			summa = summa + n.charCodeAt(p);
			p++;
		}
		summa = summa % rcolors.length;
		color = rcolors[summa];
		
		$(this).find('a').css("color", color);
}
$("h4").each(colorize);

Kalkulator nove omrežnine 2024 - https://omreznina.karlas.si/Kalkulator

jype ::

// ==UserScript==
// @name           killfile
// @namespace      killfile
// @description    slo-tech killfile
// @include        http://slo-tech.com/forum*
// ==/UserScript==
var users = ['Thomas', 'mtosev'];
window.addEventListener(
	'load', 
	function () {
		var usersRe = '^(' + users.join('|') + ')';
		var posts, thisPost;
		posts = document.evaluate(
		"//div[@class='post even' or @class='post odd']",
		document,
		null,
		XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
		null);
		for (var i = 0; i < posts.snapshotLength; i++) {
			thisPost = posts.snapshotItem(i);
			if (thisPost.childNodes[0].title.match(usersRe)) {
				thisPost.style.display="none";
			}
		}
	},
	'true'
);

terryww ::

:D
It is the night. My body's weak.
I'm on the run. No time to sleep.

netanyahu ::

// ==UserScript==
// @name No fresh news (slotech.com)
// @description Removes fresh news box.
// @include http://slo-tech.com/*
// ==/UserScript==

GM_addStyle("#fresh_news_title, #fresh_news, #fresh_news_all { display: none; }");

preem ::

in kam daš to? greasemonkey?

hruske ::

Jp, greasemonkey.
Kalkulator nove omrežnine 2024 - https://omreznina.karlas.si/Kalkulator

ender ::

Pri Operi pa v UserJS mapo.
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

ender ::

Ni userskripta, je pa CSS, ki naredi kodo bolj prijazno črni temi:
@charset "UTF-8";
/*
Name: Slo-Tech koda
Version: 1.0
Author: ender
Description: Slo-Tech koda

*/

/**
 * SyntaxHighlighter
 * http://alexgorbatchev.com/
 *
 * SyntaxHighlighter is donationware. If you are using it, please donate.
 * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
 *
 * @version
 * 2.0.320 (May 03 2009)
 * 
 * @copyright
 * Copyright (C) 2004-2009 Alex Gorbatchev.
 *
 * @license
 * This file is part of SyntaxHighlighter.
 * 
 * SyntaxHighlighter is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * SyntaxHighlighter is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with SyntaxHighlighter.  If not, see <http://www.gnu.org/copyleft/lesser.html>.
 */
/************************************
 * Default Syntax Highlighter theme.
 * 
 * Interface elements.
 ************************************/

.syntaxhighlighter
{
	background-color: #000080 !important;
}

/* Highlighed line number */
.syntaxhighlighter .line.highlighted .number
{
	background-color: #1f9a1e !important;
	color: black !important;
}

/* Highlighed line */
.syntaxhighlighter .line.highlighted.alt1 .content,
.syntaxhighlighter .line.highlighted.alt2 .content
{
	background-color: #156b15 !important;
}

/* Gutter line numbers */
.syntaxhighlighter .line .number
{
	color: #b8b8b8 !important;
}

/* Add border to the lines */
.syntaxhighlighter .line .content
{
	border-left: 3px solid #1c8c1c !important;
	color: #ccc !important;
}

.syntaxhighlighter.printing .line .content 
{
	border: 0 !important;
}

/* First line */
.syntaxhighlighter .line.alt1 .content
{
	background-color: #000080 !important;
}

/* Second line */
.syntaxhighlighter .line.alt2 .content
{
	background-color: #000088 !important;
}

.syntaxhighlighter .line .content .block
{
	background: url(wrapping.png) 0 1.1em no-repeat !important;
}

.syntaxhighlighter .ruler
{
	color: silver !important;
	background-color: #000088 !important;
	border-left: 3px solid #1b8b1b !important;
}

.syntaxhighlighter.nogutter .ruler
{
	border: 0 !important;
}

.syntaxhighlighter .toolbar
{
	background-color: #000088 !important;
	border: #3b3829 solid 1px !important;
}

.syntaxhighlighter .toolbar a
{
	color: #a0a0a0 !important;
}

.syntaxhighlighter .toolbar a:hover
{
	color: red !important;
}

/************************************
 * Actual syntax highlighter colors.
 ************************************/
.syntaxhighlighter .plain,
.syntaxhighlighter .plain a
{ 
	color: #fff !important;
}

.syntaxhighlighter .comments,
.syntaxhighlighter .comments a
{ 
	color: #009491 !important;
}

.syntaxhighlighter .string,
.syntaxhighlighter .string a
{
	color: #ff0 !important; 
}

.syntaxhighlighter .keyword
{ 
	color: #0ff !important; 
	font-weight: bold !important; 
}

.syntaxhighlighter .preprocessor 
{ 
	color: gray !important; 
}

.syntaxhighlighter .variable 
{ 
	color: #fff !important; 
}

.syntaxhighlighter .value
{ 
	color: #ff0 !important; 
}

.syntaxhighlighter .functions
{ 
	color: #fff !important; 
}

.syntaxhighlighter .constants
{ 
	color: #0066CC !important; 
}

.syntaxhighlighter .script
{ 
	background-color: #440 !important;
}

.syntaxhighlighter .color1,
.syntaxhighlighter .color1 a
{ 
	color: #808080 !important; 
}

.syntaxhighlighter .color2,
.syntaxhighlighter .color2 a
{ 
	color: #ff1493 !important; 
}

.syntaxhighlighter .color3,
.syntaxhighlighter .color3 a
{ 
	color: red !important; 
}
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

terryww ::

a ni bolj enostavno rečt FF oz karkoli že uporabljaš, da za slo-tech* uporablja določene barve?
It is the night. My body's weak.
I'm on the run. No time to sleep.

ender ::

Niti ne, ker potem izgubim vse označevanje z barvami.
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

jype ::

Stari, moj:

// ==UserScript==
// @name           quoter
// @namespace      slo-tech
// @description    simple quotation helper
// @include        http://slo-tech.com/forum/*
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js
// ==/UserScript==


$("div.content").mouseup(function (e) {
  
	var getSelText = function () {
		var txt = '';
		if (window.getSelection) {
			txt = window.getSelection();
		} else if (document.getSelection) {
			txt = document.getSelection();
		} else if (document.selection) {
			txt = document.selection.createRange().text;
		} else {
			return "";
		}
		return txt.toString();
	}
  
	var timer;
	window.clearTimeout(timer);
	var delayCall = function (e) {
		return (function(){
			// copy text
			var txt = getSelText();
			if (txt.length > 0) {
				var handle = $(e.target).siblings("h4").children("a").text();
				unsafeWindow.edit.insertContent(
					  $("#content_field").get(0),
					  txt.replace(/\n+/g, "\n"+handle+"> ")
					    .replace(/^/, handle + "> ") + '\n\n');
			} // if txt.length
		}); // returning setTimeout function
	}; // closure
	quoteText = delayCall(e);
	timer = window.setTimeout(quoteText, 500);
});


Nov, "native":
// ==UserScript==
// @name           citator
// @namespace      slo-tech
// @description    Pomoč pri citiranju
// @include        http://slo-tech.com/forum/*
// @require       http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js
// ==/UserScript==


$("div.content").mouseup(function (e) {
  
	var getSelText = function () {
		var txt = '';
		if (window.getSelection) {
			txt = window.getSelection();
		} else if (document.getSelection) {
			txt = document.getSelection();
		} else if (document.selection) {
			txt = document.selection.createRange().text;
		} else {
			return "";
		}
		return txt.toString();
	}
  
	var timer;
	window.clearTimeout(timer);
	var delayCall = function (e) {
		return (function(){
			// copy text
			var txt = getSelText();
			if (txt.length > 0) {
				var handle = $(e.target).siblings("h4").children("a").text();
				unsafeWindow.edit.insertContent(
					  $("#content_field").get(0),
					  '<p class="user-quoted">' + handle + ' naj bi izjavil:</p><blockquote>\n' + txt + '\n </blockquote>\n\n');
			} // if txt.length
		}); // returning setTimeout function
	}; // closure
	quoteText = delayCall(e);
	timer = window.setTimeout(quoteText, 500);
});

Zgodovina sprememb…

  • spremenilo: jype ()

jype ::

Citator za nove čase, ki sem ga obljubil, pa potem pozabil objaviti. Eventuelno ga morda začnem tudi uporabljati:

// ==UserScript==
// @name           citator
// @namespace      slo-tech
// @description    Pomoč pri citiranju
// @include        https://slo-tech.com/*
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js
// @grant          none
// ==/UserScript==
 
 
$("div.content").mouseup(function (e) {
   
    var getSelText = function () {
        var txt = '';
        if (window.getSelection) {
            txt = window.getSelection();
        } else if (document.getSelection) {
            txt = document.getSelection();
        } else if (document.selection) {
            txt = document.selection.createRange().text;
        } else {
            return "";
        }
        return txt.toString();
    }
   
    var timer;
    window.clearTimeout(timer);
    var delayCall = function (e) {
        return (function(){
            // copy text
            var txt = getSelText();
            if (txt.length > 0) {
                var handle = $(e.target).siblings("div.controls").children("a.cite").attr("href").match(/\/forum\/[^\/]+\/([^\/]+)\/citiraj/)[1];
                unsafeWindow.edit.insertContent(
                      $("#content_field").get(0),
                      '#st.citat ' + handle + ']' + txt + '#/st.citat]');
            } // if txt.length
        }); // returning setTimeout function
    }; // closure
    quoteText = delayCall(e);
    timer = window.setTimeout(quoteText, 500);
});


Znak "#" pred nizom "st.citat" oziroma "/st.citat" je treba zamenjati z znakom "[" - če to pošljem forumu, kodo obupno izmaliči.

Zgodovina sprememb…

  • spremenilo: jype ()

jype ::

// ==UserScript==
// @name           pngfilter
// @namespace      slo-tech
// @description    Odstranjevalec fekalij
// @include        https://slo-tech.com/*
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js
// @grant          none
// ==/UserScript==
$('img[src$="non_grata.png"]').parent().parent().css("display", "none");


Za silo bo.

Mesar ::

A nimaš to napake? Bi moglo bit nekak tak...

$('img[src$="avatar_gray.gif"]').parent().parent().css("display", "none");

pa kak to pol zgleda? A maš v vsaki temi samo 2 posta na stran? :))
Your turn to burn!

zee ::

@jype: Hvala. Prebiranje slo-techa je bistveno manj stresno brez fekalij.
zee
Linux: Be Root, Windows: Re Boot
Giant Amazon and Google Compute Cloud in the Sky.

ender ::

Na to temo sem pa čisto pozabil. Skripta, ki povrne linearni prikaz novic:
// ==UserScript==
// @name          Popravi Slo-Tech
// @description   Popravi stran z novicami na Slo-Techu
// @include       https://*.slo-tech.com/*
// @include       https://slo-tech.com/*
// ==/UserScript==

window.addEventListener('load',function ()
{
	function __click(where) {
		if (where.fireEvent) {
			(where.fireEvent('onclick'));
		} else {
			var evObj = document.createEvent('Events');
			evObj.initEvent('click', true, false);
			where.dispatchEvent(evObj);
		}
	}

	var inputs = document.getElementsByTagName('input');
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].value == "Prika\u017ei starej\u0161e novice") {
			__click(inputs[i]);
			break;
		}
	}

	window.setTimeout(function() //pusti ostalim skriptam dobro sekundo, da naložijo preostanek novic
	{
		var divs = document.getElementsByTagName('div');
		for (var i = 0; i < divs.length; i++) {
			if (divs[i].className == 'news_item short') {
				divs[i].className = 'news_item exposed';
			}
		}

    	var ps = document.getElementsByTagName('p');
	
		for (var i = 0; i < ps.length; i++) {
			if (ps[i].className == 'read_more' && ps[i].getElementsByTagName('a')) {
				if (ps[i].getElementsByTagName('a')[0].textContent.substring(0,10) == "Preberi ve") {
					ps[i].getElementsByTagName('a')[0].href = '#'; //firefox workaround
					//ps[i].getElementsByTagName('a')[0].click();
					__click(ps[i].getElementsByTagName('a')[0]);
				}
			}
		}
	},1111);
}
,false);
Zadnja verzija je vedno tu.
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

jype ::

Popravil skripto za citiranje, da deluje tudi pri kopiranju podelementov besedila (strong in podobni tagi - previdno pri klikanju na večnivojsko citiranje) ter za prvo sporočilo v temi (zopet je treba # pri #st.citat in #/st.citat popraviti v [):

// ==UserScript==
// @name           quoter
// @namespace      slo-tech
// @description    simple quotation helper
// @include        https://slo-tech.com/*
// @require        http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js
// ==/UserScript==


window.setInterval(function () {
	$("div.content").mouseup(function (e) {
	  
		var getSelText = function () {
			var txt = '';
			if (window.getSelection) {
				txt = window.getSelection();
			} else if (document.getSelection) {
				txt = document.getSelection();
			} else if (document.selection) {
				txt = document.selection.createRange().text;
			} else {
				return "";
			}
			return txt.toString();
		}
	  
		var timer;
		window.clearTimeout(timer);
		var delayCall = function (e) {
			return (function(){
				// copy text
				var txt = getSelText();
				if (txt.length > 0) {
					var handle = $(e.target).siblings("h4").children("a").text();
					//var threadid = window.location.pathname.match(/(t\d+)/)[0];
					var postid = $(e.target).closest("div.post").children("a.avatar").attr("name");
          if (postid == "p0") { // title post
            re_topic = /^\/forum\/(t[0-9]+)\/citiraj$/;
            postid = $(e.target).closest("div.post").find("a.cite").attr("href").match(re_topic)[1];
          }
					unsafeWindow.edit.insertContent(
						  $("#content_field").get(0),
						  "#st.citat " + postid + "]" + $.trim(txt) + "#/st.citat]"
					);
				} // if txt.length
			}); // returning setTimeout function
		}; // closure
		quoteText = delayCall(e);
		timer = window.setTimeout(quoteText, 500);
	});
}, 500);

Zgodovina sprememb…

  • spremenilo: jype ()


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

getElementsByTagName ne dela v Chromu

Oddelek: Programiranje
141657 (1395) win64
»

[JavaScript] Spreminjanje ozadja

Oddelek: Programiranje
7835 (779) Cvenemir
»

Izpis XML-ja z JS

Oddelek: Izdelava spletišč
81612 (1555) gnomee
»

Slo-Tech v Operi 10.60

Oddelek: Slo-Tech
61047 (794) neres
»

Google odšteva

Oddelek: Novice / Omrežja / internet
295588 (3978) MrStein

Več podobnih tem