Author Topic: Cyan's Sploder Tampermonkey Scripts [3] - [Easier Featuring] (01/Apr/2019)  (Read 1032 times)

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
Install Tampermonkey on Chrome: https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en

How to use tampermonkey
Once you have tampermonkey installed on your browser, you'll find the icon to the right of your search bar. Click the icon and select [create new script]. Once you have the script editor open, simply copy and paste the code from this thread and you'll be able to start using the forum addons.



Addons

➤ User Online List - last updated 09/Jan/2019 - v0.1.2
example: https://i.imgur.com/FOfkdcO.png
Code: [Select]
// ==UserScript==
// @name         Cyan's Sploder Forum Addons - [User Online List]
// @require      http://code.jquery.com/jquery-3.3.1.min.js
// @namespace    http://tampermonkey.net/
// @version      0.1.2 - 09/Jan/2019
// @author       Cyan
// @match        http://*.sploder.com/*
// ==/UserScript==


if($("tbody#category_1_boards").length){
    var leftside = "<div class=information><span class=topslice><span></span></span><div class=sp_block style=overflow:hidden;width:150px;padding-top:25px;padding-right:10px;padding-bottom:20px;padding-left:10px><a href=http://forums.sploder.com/index.php?action=who>Users Online</a>:<br><div></div>";
    var usersOnline = [];

    $("div#main_content_section").before("<table><td valign=top class=leftside_td></td><td class=boardindex_td></td></table>");
    $("td.boardindex_td").append($("div#main_content_section"));
    $("td.leftside_td").append(leftside);

    $("#upshrinkHeaderIC p.smalltext a").each(function(){
        usersOnline[usersOnline.length] = $(this).clone();
        $("div.information div.sp_block br:eq(0)").after(usersOnline[usersOnline.length-1]);
    });
    $("div.information div.sp_block br:first").after("<br><span class=listtop>");

    var Guests = $("p.stats a").text().split(" Guests, ");
    var UsersOn = Guests[1].split(" Users");
    UsersOn = UsersOn[0];
    Guests = Guests[0];
    $("div.information div.sp_block:first").prepend("<br>");
    $("div.information div.sp_block div").empty();
    $("div.information div.sp_block div").append("<br><br><span class=OnlineMembers>Members: "+(usersOnline.length)+"</span><br>");
    $("div.information div.sp_block div").append("<span class=OnlineMembers>Guests: "+Guests+"</span><br>");
    $("div.information div.sp_block div").append("<span class=OnlineMembers>Hidden: "+((UsersOn)-(usersOnline.length))+"</span><br><br>");

    var userarray = [];
    $("div.information div.sp_block a").each(function(){
        userarray[parseInt($(this).attr("href").split("=").pop())] = $(this);
    });
    var i = 0;
    for(i=0;i<userarray.length;i++){
        if (userarray[i] != null){
            console.log(userarray[i]);
            $("div.information div.sp_block span.listtop").before("<br>").before("<img style=padding:2px;padding-left:10px; width=24px class=userO src= />").before(userarray[i].attr("class","userlista"));
            $("img.userO:last").attr("src","http://avatars.sploder.com/a/"+userarray[i].text().charAt(0)+"/"+userarray[i].text().charAt(1)+"/"+userarray[i].text()+"_24.png").css("vertical-align","middle").css("margin","2px");
        }
    }




    var avatarlist = {};
    avatarlist = JSON.parse(localStorage.getItem("avatars"));

    if($.isEmptyObject(avatarlist)){
        avatarlist = {};
    }

    if(!$.isEmptyObject(avatarlist)){
        $("div.sp_block a.userlista").each(function(index){
            var boardavatar = $(this).attr("href");
            if(avatarlist[boardavatar] != "blank"){
                $(this).prev().attr("src",avatarlist[boardavatar]).attr("width","24px").attr("height","24px");
            }
        });
    }

    setTimeout(function(){
        $("div.sp_block a.userlista").each(function(index){
            var boardavatar = $(this).attr("href");
            var thisL = $(this).prev();
            console.log(thisL.attr("src"));
            if(!$.isEmptyObject(avatarlist)){
                if(!(boardavatar in avatarlist) || Math.floor(Math.random() * 10) == 9) {
                    $.ajax({
                        url:boardavatar,
                        type:"GET",
                        success: function(data){
                            console.log("random deletion online-list");
                            var new_av = $(data).find("div#basicinfo img.avatar").attr("src");
                            thisL.attr("src",new_av);
                            if (new_av == null){new_av="blank";}
                            avatarlist[boardavatar] = new_av;
                            localStorage.avatars = JSON.stringify(avatarlist);
                        }
                    });
                }
            }else{
                $.ajax({
                    url:boardavatar,
                    type:"GET",
                    success: function(data){
                        var new_av = $(data).find("div#basicinfo img.avatar").attr("src");
                        thisL.attr("src",new_av);
                        if (new_av == null){new_av="blank";}
                        avatarlist[boardavatar] = new_av;
                        localStorage.avatars = JSON.stringify(avatarlist);
                    }
                });
            }
        });
    },500);
}


➤ Topics on Boardindex - last updated 10/Jan/2019 - v0.1.1
example: https://i.imgur.com/Ve600Di.png
Code: [Select]
// ==UserScript==
// @name         Cyan's Sploder Forum Addons - [Topis on Boardindex]
// @require      http://code.jquery.com/jquery-3.3.1.min.js
// @namespace    http://tampermonkey.net/
// @version      0.1.1 - 10/Jan/2019
// @author       Cyan
// @match        http://*.sploder.com/*
// ==/UserScript==


var avatarlist = {};
avatarlist = JSON.parse(localStorage.getItem("avatars"));

if($.isEmptyObject(avatarlist)){
    avatarlist = {};
}

if(!$.isEmptyObject(avatarlist)){
    $("div.sp_block a.userlista").each(function(index){
        var boardavatar = $(this).attr("href");
        if(avatarlist[boardavatar] != "blank"){
            $(this).prev().attr("src",avatarlist[boardavatar]).attr("width","24px").attr("height","24px");
        }
    });
}

function loadavs(){
    if(!$.isEmptyObject(avatarlist)){
        $("table tbody tr td.icon2").each(function(index){
            var boardavatar = $(this).parent().find("td.subject p a").attr("href");
            if(avatarlist[boardavatar] != "blank"){
                $(this).find("img").attr("src",avatarlist[boardavatar]).attr("width","24px").attr("height","24px");
            }
        });
    }
}
loadavs();

function showbody() {
    $("table.subtopics tr").each(function(){
        var username = $(this).find("td.subject div p a:not(.navPages):first");
        var usernameAvatar = "http://avatars.sploder.com/a/" + username.text().substr(0,1) + "/" + username.text().substr(1,1) + "/" + username.text() + "_24.png"
        $(this).find("td.icon2 img").attr("src", usernameAvatar.toLowerCase());
    });

    $("table.subtopics tr").each(function(){
        $(this).find("td.icon2 img").attr("width","24px").attr("height","24px")
        if ( $(this).find("td.subject div a img").length ) {
            if ( $(this).find("td.icon1 img[src*=my]").length ) {
                $(this).find("td").addClass("topicnew");
            }else{
                $(this).find("td").addClass("topicunread");
            }
            $(this).find("td img[alt*=New]").hide();
            var newlinktopic = $(this).find("td.subject div a img[alt=New]").parent().attr("href");
            $(this).find("td.subject div span a").attr("href",newlinktopic);
        }
    });
}


if($("tbody#category_1_boards").length){
    var i = 0;
    $("div.cat_bar").each(function(){
        $(this).addClass("cat_bar_boardindex");
    });
    $("tr[id*=board_].windowbg2").each(function(){
        $(this).addClass("boardheader");
        var boardId = $(this).attr("id").split("_")[1];
        $("body").after("<tr style=display:none; id=placeholder_subtopic_"+boardId+"></tr>");
    });

    $("tr[id*=placeholder_subtopic_]").each(function(){
        var ex_board = {"93":5,"8":5,"239":0,"137":0};
        var thisboard = $(this).attr("id").split("_")[2];
        var Tcount = 10;
        console.log(ex_board["93"]);
        if(ex_board[thisboard]  != undefined){ Tcount = ex_board[thisboard]; }
        if(Tcount > 0){
            $.ajax({
                url:"//forums.sploder.com/index.php?board="+thisboard+".0",
                type:"GET",
                success: function(data){
                    $("#placeholder_subtopic_"+thisboard+":first").html($(data).find("div#messageindex tbody").html());

                    if( $("#placeholder_subtopic_"+thisboard+"").length ) {
                        $( "#placeholder_subtopic_"+thisboard+" tr td:nth-child(1)" ).each(function() {
                            $(this).attr("width", "5%");
                        });
                        $( "#placeholder_subtopic_"+thisboard+" tr td:nth-child(2)" ).each(function() {
                            $(this).attr("width", "5%");
                        });

                        if($("tr#board_"+thisboard+"_children").length){ $("tr#board_"+thisboard+"_children").after("<tr id=subtopic_"+thisboard+"_ class=mainboard><td colspan=4 class=subtopics><div class=topic_table><table class=subtopics cellspacing=0><tbody><tr></tr></tbody></table></div></td></tr>"); }else{
                            $("tr#board_"+thisboard+"").after("<tr id=subtopic_"+thisboard+"_ class=mainboard><td colspan=4 class=subtopics><div class=topic_table><table class=subtopics cellspacing=0><tbody><tr></tr></tbody></table></div></td></tr>");
                        }
                        var content = $("#placeholder_subtopic_"+thisboard+":eq(0):first").html();
                        $("#subtopic_"+thisboard+"_ div table tbody tr").replaceWith(content);

                        $("#placeholder_subtopic_"+thisboard+":first").remove();
                        for (i = 0; i < 40-Tcount; i++) {
                            $("#subtopic_"+thisboard+"_ td div table tbody tr:eq("+Tcount+"):not(.windowbg2):not(.spacer)").remove();
                        }
                        showbody();
                        loadavs();
                    }
                }
            });
        }
    });
}


➤ Easier Featuring - last updated 01/Apr/2019 - v0.1.1
example: https://i.imgur.com/sVoPztW.png
Code: [Select]
// ==UserScript==
// @name         Cyan's Sploder Addons - [Easier Featuring]
// @require      http://code.jquery.com/jquery-3.3.1.min.js
// @namespace    http://tampermonkey.net/
// @version      0.1.1 - 01/Apr/2019
// @author       Cyan
// @match        http://www.sploder.com/games/*
// ==/UserScript==

if (window.location.href.indexOf(".com/games/members/") > -1) {
    localStorage.CEF_Feature = -1;
    $('body').append('<iframe onload="frameLoaded();" id="adminPage" frameBorder="0" width="0" height="0" src="http://www.sploder.com/games/admin/0/"></iframe>');
    $('div.sharebar').after('<input onclick="localStorage.CEF_Feature=1;setTimeout(function(){location.reload();},150);" type=button value=" Feature this game " style="margin-right:10px"></input> • <input onclick="localStorage.CEF_Feature=0;setTimeout(function(){location.reload();},150);" type=button value=" Unfeature this game " style="margin-left:10px"></input><br><br>');
    localStorage.CEF_gameId = $('param[name=flashvars]').val().split("=")[1];
    localStorage.CEF_gameName = $('div#content > h3:first').text();
    localStorage.CEF_gameUser = $('div#content > h4:first > a').text();
}

if (window.location.href.indexOf(".com/games/admin/") > -1) {
    if (localStorage.CEF_gameId != 0) {
        $('body').find('input[type=checkbox]:first').attr("checked","checked");
        $('body').find('input[name*=game_]:first').attr("name","game_"+localStorage.CEF_gameId);
        $('body').find('input[name*=game_score_]:first').attr("name","game_score_"+localStorage.CEF_gameId);
        $('body').find('input[name*=game_name_]:first').attr("name","game_name_"+localStorage.CEF_gameId).attr("value",localStorage.CEF_gameName);
        $('body').find('input[name*=game_author_]:first').attr("name","game_author_"+localStorage.CEF_gameId).attr("value",localStorage.CEF_gameUser);
        $('body').find('input[name*=game_oldfeatured_]:first').attr("name","game_oldfeatured_"+localStorage.CEF_gameId);
        $('body').find('input[name*=game_oldscore_]:first').attr("name","game_oldscore_"+localStorage.CEF_gameId);
        $('body').find('input[type=checkbox]:first').attr("name","game_"+localStorage.CEF_gameId);
    }
    window.setInterval(function(){
        if(localStorage.CEF_Feature==1){
            $('body').find('input[name*=game_oldfeatured_]:first').attr("value",0);
            $('body').find('input[name*=game_score_]:first').attr("value",1);
            $('input[value*=Feature]').click();
        }
        if(localStorage.CEF_Feature==0){
            $('body').find('input[name*=game_oldfeatured_]:first').attr("value",1);
            $('body').find('input[name*=game_score_]:first').attr("value",0);
            $('input[value*=Feature]').click();
        }
    }, 100);
    localStorage.CEF_gameId = 0;
    localStorage.CEF_gameName = 0;
    localStorage.CEF_gameUser = 0;
    localStorage.CEF_Feature = -1;
}
« Last Edit: April 01, 2019, 12:43 pm by Cyan »
 

Offline sticki

  • General
  • Cruiser
  • *****
  • Posts: 337
  • Karma: +7/-0
  • ztk|stk|ztki|stki
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #1 on: January 07, 2019, 05:08 pm »
TYVM
 

Offline Benno MKII

  • RIP in peace
  • Soldier
  • Cruiser
  • ****
  • Posts: 487
  • Karma: +5/-0
  • Goodbye
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #2 on: January 07, 2019, 05:11 pm »
That's amazing, now if only you could make a script for thanking ;)
 

Offline Master

  • Everyone’s Favorite
  • Soldier
  • Mortar
  • ****
  • Posts: 2,892
  • Karma: +105/-0
  • :8-/
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #3 on: January 07, 2019, 10:20 pm »
My phone won’t let me copy it. :8-/

MOTY:
Weirdest Member 2014 and 2018
4th-Place Nice Member 2016

Soldier Promo - Apr 15, 2015
M Rank - May 7, 2015
R Rank - Oct 4, 2015
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #4 on: January 08, 2019, 04:11 pm »
That's amazing, now if only you could make a script for thanking ;)
unfortunately, anything of that nature isn't possible with client side scripts.
I'm not sure why thanking isn't enabled on the forums though, since it comes with smf by default.
 

Offline Benno MKII

  • RIP in peace
  • Soldier
  • Cruiser
  • ****
  • Posts: 487
  • Karma: +5/-0
  • Goodbye
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #5 on: January 08, 2019, 05:55 pm »
unfortunately, anything of that nature isn't possible with client side scripts.
I'm not sure why thanking isn't enabled on the forums though, since it comes with smf by default.
Liam must've removed it or something.
 

Offline alon

  • General
  • Bugmeister
  • *****
  • Posts: 25,428
  • Karma: +1612/-0
    • View Profile
    • Sploder
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #6 on: January 09, 2019, 12:03 am »
Thanking is enabled, at least for me. I don't think displaying the thanks has ever been a default feature of SMF though.
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #7 on: January 09, 2019, 12:57 pm »
Thanking is enabled, at least for me. I don't think displaying the thanks has ever been a default feature of SMF though.
its probably only available at a certain post count or rank
 

Offline pepperedSteak

  • J0ji was here
  • Soldier
  • Turret
  • ****
  • Posts: 93
  • Karma: +1/-0
  • Apod was here
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #8 on: January 09, 2019, 01:20 pm »
request: similar to the pre-august 2018 forums, could we possibly have the first 10-ish threads be displayed under the board itself on the home screen? of course this wouldnt include child boards


You can call me Pollyanna,
Say I'm crazy as a loon,
I believe in silver linings
And t
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
Re: Cyan's Sploder Tampermonkey Scripts [1] - [Online List]
« Reply #9 on: January 09, 2019, 02:01 pm »
request: similar to the pre-august 2018 forums, could we possibly have the first 10-ish threads be displayed under the board itself on the home screen? of course this wouldnt include child boards
yup, i'll start working on that now! might be the next script I post here.

was thinking I'll probably remake the home page, since everything should be available to do so
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
➤ Topics on Boardindex - last updated 09/Jan/2019
example: https://i.imgur.com/Ve600Di.png

[GO TO OP FOR UPDATED SCRIPT]

Displays recent topics on boardindex, may take a second to load.
« Last Edit: January 10, 2019, 03:08 pm by Cyan »
 

Offline Megaman4540

  • (Megaman)
  • Soldier
  • Turret
  • ****
  • Posts: 21
  • Karma: +1/-0
    • View Profile
the forum is starting to look like home now, cant wait until geoff implements these
please click this
Most improved member 2018: really shows itself if you were here in 2017
 

Offline Benno MKII

  • RIP in peace
  • Soldier
  • Cruiser
  • ****
  • Posts: 487
  • Karma: +5/-0
  • Goodbye
    • View Profile
I would give you 100 thanks if I could :)
 

Offline Bricc

  • ├┬┴┬┴┬┴┬┴┤
  • Mainsite Employee
  • Guard
  • *
  • Posts: 894
  • Karma: +0/-0
    • View Profile
    • Nem-Creator
I assume you'd be able to make a script to take you to the newest unseen post in a topic when you click on it? I'd really appreciate that because it's always been a thing that I'm used to and it's convenient.


Moderator, Reviewer, Reviewer Recruiter
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
yup! fixed a few bugs with the boardindex script, now avatars should all appear to be 24x24 and topics will now send you to oldest unseen post
 

Offline Bricc

  • ├┬┴┬┴┬┴┬┴┤
  • Mainsite Employee
  • Guard
  • *
  • Posts: 894
  • Karma: +0/-0
    • View Profile
    • Nem-Creator
yup! fixed a few bugs with the boardindex script, now avatars should all appear to be 24x24 and topics will now send you to oldest unseen post

Appreciated, makes the forum much easier to navigate. :)


Moderator, Reviewer, Reviewer Recruiter
 

Offline Plam3n

  • Cruiser
  • *
  • Posts: 470
  • Karma: +0/-0
    • View Profile
Looks amazing, wish I could give you a thank!
 

Offline Rich3001k

  • Soldier
  • Speeder
  • ****
  • Posts: 174
  • Karma: +0/-0
  • epic
    • View Profile
    • YT
bravo
 

Offline wordigirl

  • Soldier
  • Speeder
  • ****
  • Posts: 173
  • Karma: +1/-0
  • God bless you friend. Always praying for you.
    • View Profile
won't work on mobile, will it?
Sorry, Epico. :'(
God bless you all.
 

Offline Benno MKII

  • RIP in peace
  • Soldier
  • Cruiser
  • ****
  • Posts: 487
  • Karma: +5/-0
  • Goodbye
    • View Profile
won't work on mobile, will it?
Mobile browsers don't support extensions.
 

Offline wordigirl

  • Soldier
  • Speeder
  • ****
  • Posts: 173
  • Karma: +1/-0
  • God bless you friend. Always praying for you.
    • View Profile
Mobile browsers don't support extensions.
didn't think so.
Sorry, Epico. :'(
God bless you all.
 

Offline Boombleeb

  • Hello there
  • Soldier
  • Cruiser
  • ****
  • Posts: 356
  • Karma: +0/-0
  • quackquackquackquackquackquackquackquackquackquack
    • View Profile
hey cyan, do you remember the sidebar above the online list that showed your stats?



 

Offline Bricc

  • ├┬┴┬┴┬┴┬┴┤
  • Mainsite Employee
  • Guard
  • *
  • Posts: 894
  • Karma: +0/-0
    • View Profile
    • Nem-Creator
hey cyan, do you remember the sidebar above the online list that showed your stats?

I thought about this yesterday. I'd really like to see it too.


Moderator, Reviewer, Reviewer Recruiter
 

Online star34

  • Soldier
  • Cruiser
  • ****
  • Posts: 290
  • Karma: +0/-0
    • View Profile
    • Youtube Channel
Can you make it so we could thank? Also, can you make us have custom backgrounds on our profiles?

 

Offline Plam3n

  • Cruiser
  • *
  • Posts: 470
  • Karma: +0/-0
    • View Profile
Can you make it so we could thank? Also, can you make us have custom backgrounds on our profiles?

unfortunately, anything of that nature isn't possible with client side scripts.
I'm not sure why thanking isn't enabled on the forums though, since it comes with smf by default.
 

Offline william2001

  • Puppet Master
  • Soldier
  • Launcher
  • ****
  • Posts: 1,463
  • Karma: +1/-0
  • "There is no fiction." -Neville Goddard
    • View Profile
Cyan shouldnt shut up after all  :)

 

Offline Sephei

  • Emperor Sephei II of Holland
  • Soldier
  • Speeder
  • ****
  • Posts: 190
  • Karma: +0/-0
  • I am NOT Arab, I repeat: I am NOT Arab.
    • View Profile
    • My dead YT channel
Damn this is amazing! Thanks so much cyan!
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
added script for easier featuring for editors
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
let me know if you find this useful, or tell me if you find any issues/bugs with it
 

Offline Cyan

  • Lieutenant
  • Mortar
  • *****
  • Posts: 4,877
  • Karma: +182/-0
  • Cyan
    • View Profile
oops, made a mistake in the code where you can see a glitch at the bottom of the page, this has been corrected in the newest version.
(script updated)