Instantly share code, notes, and snippets.

What would you like to do? Support Forums Post Analyzer
// ==UserScript==
// @name Support Forums Post Analyzer
// @namespace
// @version 0.3.3
// @description Displays number of member posts,auto-checks the subscribe button, checks for new posts, tag buttons, added Google Forum Search
// @author Terry Brownell aka joerepublic
// @match*
// @grant none
// @require
// ==/UserScript==
var buttontags = ['modlook', 'duplicate', 'mapping', 'billing','css', '', 'themes', 'wordads', 'spam', 'delete account', 'delete site', 'domain', 'transfer'];
var intervaltime = 5000;
var timeout = 420000; //420000 = 7 minutes
(function() {
'use strict';
$(document).ready(function() {
//Check subscription box
$('#subscription_checkbox').prop('checked', true);
//Add tag buttons
$.each(buttontags, function(i, thetag){
var newnode = document.createElement ('div');
newnode.setAttribute("id", "tagbuttons");
newnode.innerHTML = '<button id="'+thetag+'" type="button" style="float: right;margin: 20px 0px 20px 10px; border-radius: 11px;font-size: 11px; line-height: 21px; padding: 0 10px;">'+thetag+'</button>';
document.getElementById (thetag).addEventListener (
"click", clickyclicky, false
function clickyclicky (nodeevent) {
//Total thread count of OP, display by membername
var profileurl = $('.authortitle:first a');
var href = $(profileurl).attr('href');
$.get(href, function(data){
var postcount = $(data).find('ol li').length;
$('.threadauthor:first strong').append("<span style='margin-left: 10px;'>"+postcount+"</span>");
//Checks for updates to this post, edits button if new response, displays last post.
var origcount = $("body").find('ol li').length;
var intervalfunk = setInterval(function () {
$.get(window.location.href, function(data){
var newcount = $(data).find('ol li').length;
if(origcount < newcount){
$('#postformsub').prop('value', 'Submit *NEW*');
$('#postformsub').css('color', 'red');
origcount = newcount;
var thelastpost = $(data).find('ol li').last();
//Timeout the response updater.
function clearit(){
$('#tagbuttons').before("<b style='float:right;color:red'>No longer checking for updated responses!</b>");
setTimeout(clearit, timeout);
//Add a google support forum search box
$('.tags').after('<form action="" method="get" name="searchform" target="_blank" style="margin-top:25px;"><input name="sitesearch" type="hidden" value=""><input autocomplete="on" name="q" placeholder="Google Forum Search" required="required" type="text"><button style="border-radius: 11px;font-size: 11px; line-height: 21px; padding: 0 10px;" type="submit">Go Google Go!</button></form>');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment