Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Lobbylink Linker for Unityhacks.com Shoutbox
- // @namespace https://www.unityhacks.com/members/sirbard.28069/
- // @version 0.1
- // @description Replaces plain text lobby links with clickable lobby links
- // @author SirBard
- // @match https://www.unityhacks.com/
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- var config = {
- speed: 1000,
- link_css: "color:red;text-decoration:underline",
- container: "#taigachat_box",
- message: ".taigachat_messagetext",
- };
- var mod = {
- init: function(){
- var _ = this;
- setInterval(function(){
- _.render();
- },config.speed);
- },
- render: function(){
- var _ = this;
- $(config.container).find(config.message).each(function(){
- var lineHTML = $(this).html();
- if( lineHTML.indexOf("<a href") === -1 && lineHTML.indexOf("steam://") !== -1 ){
- $(this).html(_.replace(lineHTML));
- }
- });
- },
- replace: function(text){
- return text.replace(/(\b(steam):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i,"<a href='$1' style='"+config.link_css+"'>$1</a>");
- }
- };
- mod.init();
- })();
Add Comment
Please, Sign In to add comment