What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » General » Forum & Website » Post your greasemonkey scripts

Pages: (2): « First [ 1 ] 2 » Last »
Post your greasemonkey scripts
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. Post your greasemonkey scripts
Just as the thread title says.

This will add Inivisible mode options to the header:

[Image: attachment.php?pid=975323]

js code:
// ==UserScript==
// @name           Plus! Forum
// @namespace      http://shoutbox.menthix.net/*
// @include        http://shoutbox.menthix.net/
// ==/UserScript==

var vsubmit = '3a794272e7ed125a'; // needs to be changed to your validsubmit id from the usercp.php page.
var option_on = 'invisible=yes';
var option_off = 'invisible=no';

var url = 'http://shoutbox.menthix.net/usercp.php';

addInvisibleMode ( );

// Functions

function addInvisibleMode () {
    with ( getId ( 'contentheaderright' ) )
    {
        innerHTML += '<br />Invisible Mode <a href="#" OnClick="javascript:ajax ( \''+url+'\' , \'action=do_options&validsubmit='+vsubmit+'&'+option_off+'\' );">on</a> / <a href="#" OnClick="javascript:ajax ( \''+url+'\' , \'action=do_options&validsubmit='+vsubmit+'&'+option_off+'\' );">off</a></form>';
    }
}

function getId ( id ) { return document.getElementById ( id ); }

unsafeWindow.ajax = function ( url , params ) {
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.open('POST', url, true);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlhttp.onreadystatechange=function() {
        if ( xmlhttp.readyState === 4 && xmlhttp.status === 200 ) {
            window.location.reload();
        }
    }
    xmlhttp.send( params );
}

First time making a GM script

.png File Attachment: contentheaderright.png (5.13 KB)
This file has been downloaded 525 time(s).

This post was edited on 09-22-2009 at 07:44 PM by matty.
09-22-2009 07:40 PM
Profile E-Mail PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Post your greasemonkey scripts
You shouldn't just submit one option and not the rest... any values that aren't specified will be reset to default. :/
09-22-2009 08:17 PM
Profile PM Web Find Quote Report
Mnjul
forum super mod
******

Avatar
plz wub me

Posts: 5396
Reputation: 58
– / Other / Flag
Joined: Nov 2002
Status: Away
RE: Post your greasemonkey scripts
quote:
Originally posted by WDZ
You shouldn't just submit one option and not the rest... any values that aren't specified will be reset to default. :/
Impose isset() checking on incoming variables then :blah!: :chrongue:
09-22-2009 08:24 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. RE: Post your greasemonkey scripts
quote:
Originally posted by WDZ
You shouldn't just submit one option and not the rest... any values that aren't specified will be reset to default. :/
I happened to notice this; all options were set to what they are by default... stupid design.
09-22-2009 08:28 PM
Profile E-Mail PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Post your greasemonkey scripts
quote:
Originally posted by Mnjul
Impose isset() checking on incoming variables then :blah!: :chrongue:
I do, and when a variable isn't set, or it's invalid, it gets set to default. :p

quote:
Originally posted by matty
stupid design
I disagree, as that code was never meant to be used for anything other than handling the form at usercp.php?action=options. I'll see if I can fix it, but it's going to take a major rewrite.

This post was edited on 09-22-2009 at 08:38 PM by WDZ.
09-22-2009 08:32 PM
Profile PM Web Find Quote Report
andrey
elite shoutboxer
****

Avatar

Posts: 795
Reputation: 48
– / Male / Flag
Joined: Aug 2004
RE: Post your greasemonkey scripts
This script replaces the thread icons ([Image: newhotfolder.gif], [Image: dot_folder.gif], [Image: folder.gif], etc.) with the coloured dot icons I posted some time ago. (thread: improved thread icons..)
I think those and the other icons still are somewhere on msghelp.net/files/..

.txt File Attachment: msghelp-colour-thread-icons.js.txt (10.6 KB)
This file has been downloaded 230 time(s).
[Image: w2kzw8qp-sq2_dz_b_xmas.png]
09-22-2009 09:07 PM
Profile PM Find Quote Report
toddy
Veteran Member
*****

Avatar
kcus uoy

Posts: 2573
Reputation: 49
– / Male / Flag
Joined: Jun 2004
RE: Post your greasemonkey scripts
is it just me that matty's script doesn't work for? and before u ask, yes i changed the submit ID
09-22-2009 10:49 PM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Post your greasemonkey scripts
Alright, I rewrote some code in usercp.php so it will only update database fields for which the user specified a value. =p

I also hacked matty's script to fix some bugs, make it compatible with Opera as well as Firefox, and make it dynamically grab the security token, which shouldn't be hard-coded because it's subject to change. (a)

http://shoutbox.menthix.net/files/invisiblemode.user.js

This post was edited on 09-30-2009 at 12:18 AM by WDZ.
09-23-2009 12:14 AM
Profile PM Web Find Quote Report
Chris4
Elite Member
*****

Avatar

Posts: 4461
Reputation: 84
33 / Male / Flag
Joined: Dec 2004
RE: Post your greasemonkey scripts
Andrey, can't get your script to work?

Downloaded it, renamed it to file.user.js and installed it, yet doesn't change anything?
Twitter: @ChrisLozeau
09-23-2009 01:47 AM
Profile PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: Post your greasemonkey scripts
quote:
Originally posted by Chris4
Andrey, can't get your script to work?

Downloaded it, renamed it to file.user.js and installed it, yet doesn't change anything?
Are you using http://www.msghelp.net/? It looks like the script only works without a subdomain.
09-23-2009 01:54 AM
Profile PM Web Find Quote Report
Pages: (2): « First [ 1 ] 2 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On