Last active
August 22, 2019 20:30
-
-
Save inertia186/fd4b744d20300627b2a90f65ddc91da0 to your computer and use it in GitHub Desktop.
Adds links to players' blogs on Steem Monsters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name sm-blog-link | |
// @namespace https://gist.github.com/inertia186/fd4b744d20300627b2a90f65ddc91da0 | |
// @updateURL https://gist.github.com/inertia186/fd4b744d20300627b2a90f65ddc91da0/raw/cd086681c9c4c9318e625536777a41452b489a94/sm-blog-link.user.js | |
// @version 0.3 | |
// @description Adds links to players' blogs on Splinterlands. | |
// @author inertia | |
// @include https://steemmonsters.com/* | |
// @include https://splinterlands.io/* | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var sm_host = 'www.splintertalk.io'; | |
var steem_span = '<span style="float: right; padding-top: 6px;"> <img src="https://' + sm_host + '/favicon.ico" style="width:24px; height:24px;" />'; | |
var execute = function() { | |
var current_player_name = $('#log_in_text > a > b').text(); | |
var players = $('.player-cell'); | |
players.each(function() { | |
if ( !!this.innerText ) { | |
var player_text = this.innerText; | |
var player_name = player_text.split(' ')[0]; | |
if ( player_name.length > 0 && player_name != current_player_name ) { | |
var td = this.closest('td'); | |
var player_html = td.innerHTML | |
if ( !!player_html && player_html.indexOf(sm_host) == -1 ) { | |
td.innerHTML = ' <a href="https://' + sm_host +'/@' + player_name + '" target="blog">' + steem_span + '</a></span>' + player_html; | |
} | |
} | |
} | |
}); | |
}; | |
var timer_id = setInterval(execute, 3000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment