DevNetworks useful Greasemonkey Scripts

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Firefox users know that using emoticons buttons on the posting.php page will add the required emoticon to the end of the textarea. This script fixes this annoying behavior (emoticons will be inserted in the current caret position)

Code: Select all

 /*Copyright (c) 2006, Bruce WeirdanAll rights reserved. Redistribution and use in source and binary forms,with or without modification, are permitted providedthat the following conditions are met:     * Redistributions of source code must retain theabove copyright notice, this list of conditions andthe following disclaimer.    * Redistributions in binary form must reproducethe above copyright notice, this list of conditionsand the following disclaimer in the documentationand/or other materials provided with the distribution.    * The name of the copyright holder may NOT be usedto endorse or promote products derived from thissoftware without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ANDCONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIEDWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR APARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALLTHE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OFUSE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDINGNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THEUSE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE.*/ // ==UserScript==// @name           PHPBB Fix Smilies// @namespace      tag:weirdan@gmail.com,2005:greasemonkey#phpbb.fixsmilies// @description    fix smilies for phpbb in Fx// @include        *posting.php?mode=*// @exclude        *posting.php?mode=topicreview*// ==/UserScript== function storeGMCaret() {    textarea.setAttribute('GM_caretPos', textarea.selectionStart);};var textarea = document.getElementsByName('message')[0]; textarea.addEventListener('click', storeGMCaret, false); textarea.addEventListener('keyup', storeGMCaret, false); textarea.addEventListener('select', storeGMCaret, false);  unsafeWindow.emoticon = function(text) {    textarea.value = textarea.value.substr(0, textarea.getAttribute('GM_caretPos')) + text + textarea.value.substr(textarea.getAttribute('GM_caretPos'));    textarea.selectionStart = textarea.selectionEnd = (parseInt(textarea.getAttribute('GM_caretPos')) + text.length);    storeGMCaret();    textarea.focus();} 
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

There's an annoying little bug with Quick Reply: it doesn't set automatic notification on when you post a topic even if it's set in your preference: i.e. it's missing an input field. Not sure how to fix: I tried manually injecting the field but it just broke the button. Alas alas.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

I tried manually injecting the field but it just broke the button. Alas alas.
I'll try to hack something around to make that possible.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Is it possible to have RTM-ize for quick reply :P or is that asking too much?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Show/hide forums/sections

Post by VladSun »

My ugly coded Greasemonkey script (but still useful for me):
http://ipclassify.relef.net/scripts/fil ... rk.user.js

It permits you to hide particular sections of this forum. After installing the script, a "Forum filter" link will appear on the center/top of the main page.
Click on it, then check/uncheck the forums you want to be visible/invisible, then click the link again. Voila! :)

Status: It work's for me (c)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

One single download?!? ... :( I thought it would be useful

PS: Thank you "Waldorf Maryland, US" ;)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

VladSun wrote:One single download?!? ... :( I thought it would be useful

PS: Thank you "Waldorf Maryland, US" ;)
Considering each script is large in its own right and they each tackle different things, I doubt we'll combine them.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: DevNetworks useful Greasemonkey Scripts

Post by McInfo »

Since the problem with the Expand/Contract links (which I commented on in another post) still bothers me, I thought I would try my hand at a Greasemonkey script to make a temporary fix.

The script removes the max-height style for all codeholder divs and adds the max-height style to each of the codeholder divs' children. In simpler terms, this script makes the Expand/Contract links work.

https://snydev.com/greasemonkey/dnneclf.user.js

Edit 1: I appear to have released this prematurely. It doesn't work on all code blocks, but it does work on the one posted above by Weirdan. I need to track down the problem.

Edit 2: I found the problem, but not a solution. The script affects only the first codeholder on a page. Related topic: 102481

Edit 3: I have fixed the script. Thanks for the help, Weirdan.

Edit 4: Fixed broken link.

Edit: This post was recovered from search engine cache.

Edit 5: This patch is obsolete.
Last edited by McInfo on Fri Nov 05, 2010 4:58 pm, edited 2 times in total.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: DevNetworks useful Greasemonkey Scripts

Post by McInfo »

I decided to tackle another issue with the forum. For those who would prefer a monospaced font for the textarea on the posting page, I wrote a new Greasemonkey script.

https://snydev.com/greasemonkey/dnnpbff.user.js

You can find all (both) of my Greasemonkey scripts at https://snydev.com/greasemonkey/.

Edit: This post was recovered from search engine cache.
Last edited by McInfo on Mon Jun 14, 2010 11:10 am, edited 1 time in total.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: DevNetworks useful Greasemonkey Scripts

Post by Jonah Bron »

Here's something I whipped up real quick. Nothing fancy, just quick and dirty. It puts in a dropdown menu on the posting page that inserts often-quoted forum rules into the post.

http://userscripts.org/scripts/show/66794

Enjoy!

Edit: Updated, works with (not so) new forum.
Last edited by Jonah Bron on Wed Nov 03, 2010 7:52 pm, edited 1 time in total.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: DevNetworks useful Greasemonkey Scripts

Post by McInfo »

Jonah Bron wrote:Here's something...
You need to change

Code: Select all

// @include        forums.devnetwork.net/posting.php
to

Code: Select all

// @include        http://forums.devnetwork.net/posting.php*
Also, I think the menu looks better with no <br> before it, but I can just change that on my copy.

Edit: This post was recovered from search engine cache.
Last edited by McInfo on Mon Jun 14, 2010 11:11 am, edited 1 time in total.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

A menu to replace the Code button on the posting page

Post by McInfo »

This is my third Greasemonkey-powered improvement for this site. It replaces the Code button on the posting page with a menu that allows you to choose what language to insert. This saves some keystrokes and I hope it will encourage people to use the

Code: Select all

lang[/b]]
syntax (although the people most likely to install the script are those least in need of encouragement).

I'm not going to link to the script directly because I spent more time than I should have on creating a customization page for it and I would appreciate if that page got some traffic:

https://snydev.com/greasemonkey/dnnmrcb.php

As always, my other Greasemonkey scripts can be found on the index page in the same directory.

Related topic: 111832 (image included)

Edit: This post was recovered from search engine cache.
Last edited by McInfo on Mon Jun 14, 2010 11:12 am, edited 1 time in total.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: DevNetworks useful Greasemonkey Scripts

Post by Jonah Bron »

Very nice, McInfo. I made the changes you suggested to the rule insert-er.
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Highlight Rows in Topic Listings

Post by McInfo »

This Greasemonkey script adds a style to change the background color of rows in topic listings to white when you mouse over them.

dnnhr.user.js

Edit: This post was recovered from search engine cache.
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: DevNetworks useful Greasemonkey Scripts

Post by Jonah Bron »

Another Userscript. This one creates a button labeled "WDW?". When pressed, it appends the text "What doesn't work? Do you get an error message?" to the post message. I find myself typing this a lot.

http://userscripts.org/scripts/show/87712

Edit: Updated, actually works now :mrgreen:
Last edited by Jonah Bron on Wed Nov 03, 2010 7:41 pm, edited 1 time in total.
Post Reply