Skip to content

Instantly share code, notes, and snippets.

@inertia186
Created September 12, 2020 17:41
Show Gist options
  • Save inertia186/484e3d55b41d47c73cff303f36d1d32c to your computer and use it in GitHub Desktop.
Save inertia186/484e3d55b41d47c73cff303f36d1d32c to your computer and use it in GitHub Desktop.
hive-together
// ==UserScript==
// @name hive-together
// @namespace https://gist.github.com/inertia186/484e3d55b41d47c73cff303f36d1d32c
// @updateURL https://gist.github.com/inertia186/484e3d55b41d47c73cff303f36d1d32c
// @version 0.1
// @description Quickly hive-together.
// @author inertia
// @match https://hive.blog/*
// @grant none
// @require http://code.jquery.com/jquery-3.4.0.min.js
// ==/UserScript==
(function() {
'use strict';
var hive_together_span = '<span class="Icon hivepower" style="display: inline-block; width: 1.12rem; height: 1.12rem; fill: #4691f6;"><svg class="svg-icon" viewBox="0 0 20 20"><path d="M17.657,2.982H2.342c-0.234,0-0.425,0.191-0.425,0.426v10.21c0,0.234,0.191,0.426,0.425,0.426h3.404v2.553c0,0.397,0.48,0.547,0.725,0.302l2.889-2.854h8.298c0.234,0,0.426-0.191,0.426-0.426V3.408C18.083,3.174,17.892,2.982,17.657,2.982M17.232,13.192H9.185c-0.113,0-0.219,0.045-0.3,0.124l-2.289,2.262v-1.96c0-0.233-0.191-0.426-0.425-0.426H2.767V3.833h14.465V13.192z M10,7.237c-0.821,0-1.489,0.668-1.489,1.489c0,0.821,0.668,1.489,1.489,1.489c0.821,0,1.488-0.668,1.488-1.489C11.488,7.905,10.821,7.237,10,7.237 M10,9.364c-0.352,0-0.638-0.288-0.638-0.638c0-0.351,0.287-0.638,0.638-0.638c0.351,0,0.638,0.287,0.638,0.638C10.638,9.077,10.351,9.364,10,9.364 M14.254,7.237c-0.821,0-1.489,0.668-1.489,1.489c0,0.821,0.668,1.489,1.489,1.489s1.489-0.668,1.489-1.489C15.743,7.905,15.075,7.237,14.254,7.237 M14.254,9.364c-0.351,0-0.638-0.288-0.638-0.638c0-0.351,0.287-0.638,0.638-0.638c0.352,0,0.639,0.287,0.639,0.638C14.893,9.077,14.605,9.364,14.254,9.364 M5.746,7.237c-0.821,0-1.489,0.668-1.489,1.489c0,0.821,0.668,1.489,1.489,1.489c0.821,0,1.489-0.668,1.489-1.489C7.234,7.905,6.566,7.237,5.746,7.237 M5.746,9.364c-0.351,0-0.638-0.288-0.638-0.638c0-0.351,0.287-0.638,0.638-0.638c0.351,0,0.638,0.287,0.638,0.638C6.384,9.077,6.096,9.364,5.746,9.364"></path></svg></span>';
var execute = function() {
var current_account_name = $('span.DropdownMenu.Header__usermenu > ul > li.title').text();
var authors = $('.author');
authors.each(function() {
if ( !!this.innerText ) {
var author_text = this.innerText;
var author_name = author_text.split(' ')[0];
if ( author_name.length > 0 && author_name != current_account_name ) {
var author_html = this.innerHTML;
if ( !!author_html && author_html.indexOf('hive-together.herokuapp.com') == -1 ) {
this.innerHTML = author_html + ' <a href="https://hive-together.herokuapp.com/intersections?utf8=%E2%9C%93&only_replies=&start=-1&limit=5000&accounts%5B%5D=' + current_account_name + '&accounts%5B%5D=' + author_name + '&only_replies=true&commit=query" target="hive_together">' + hive_together_span + '</a></span>';
}
}
}
});
};
$(document).ready(function() {
execute();
var timer_id = setInterval(execute, 3000);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment