
another_mage |
1 person marked this as a favorite. |

At the request of JReyst, I have created another Greasemonkey script to auto-link topics from the messageboards.
For example, if somebody writes Magic Missile in their forum post, the script will automatically create a link to Magic Missile.
Installation
In order to make use of this you need three things, and you are recommended to install them in this order:
1. Firefox
http://www.mozilla.com/en-US/firefox/upgrade.html
2. Greasemonkey
https://addons.mozilla.org/en-US/firefox/addon/748/
3. another_mage's topic_autolink script
http://pages.cs.wisc.edu/~meade/greasemonkey/topic_autolink.user.js
Usage
Browse a thread on the messageboards. When you see words in green with an underline, you'll know the script has auto-linked to an article on that topic. Links always open in a new window/tab.
Notes
- The topic map (what words link to what articles) is loaded dynamically over the web.
THE SCRIPT MAY NOT WORK ON THE FIRST PAGE LOAD!
Until the topic map can be downloaded in the background, the forums will continue to look normal. After the topic map is downloaded, it will do the markup work without further intervention. It will also attempt to update the topic map on every page load on the messageboards.
- This is a Greasemonkey script running in the user's browser on their own computer. If you are not running the script, there will be absolutely no difference in your online experience. (The script runs locally for those who install it, not on Paizo's computers.)
- I've given the script quite a workout while creating it, however, it may contain bugs. If it starts to adversely affect your online experience, click the Greasemonkey icon in the lower right-hand corner of your browser window. It should turn gray, thereby disabling Greasemonkey and the script.
- The script is licensed under the GNU General Public License v3+. Generally, this means you are free to modify and share, as long as you share-alike. If you have any questions about the license terms, contact me or check the GNU website.
Security & Privacy
- The topic map is downloaded over the web. In theory, this would allow the host of the topic map (currently another_mage) to track your messageboard usage. At present, I am not doing this and have no plans to do so; however, it is technically possible. I feel it would be unethical not to disclose these facts.

jreyst |

I see... stars..

another_mage |

So you can find every sm***? Ever?
Thankfully, the sm*** word does not link anywhere on the site :)
I was thinking about having it link to here.
:shrug: :-)

Maugan22 |

O....
My.....
Goodness....
First off today's my birthday, and Another Mage, I've gotta say, this is one of the best birthday presents I got this year, right up there with the vintage bearded devils from 6d6fireball.com, Friggin inspired!
Jreyst and I were discussing something like this a while back and it's awesome to see someone actually making it a reality.
Quick question, is there a simple way to make the script work for all message boards or sites? Like say I'm off browsing enworld or our local PFSRD message boards (www.freeyabb.com) this would be very sweet to implement more globaly.
Wonder if it could be made into a bookmarklet somehow, that would be very sweet.
Just thoughts, keep up the good work!

another_mage |

First off today's my birthday, and Another Mage, I've gotta say, this is one of the best birthday presents I got this year, right up there with the vintage bearded devils from 6d6fireball.com, Friggin inspired!
Happy Birthday! I hope it's a good one! :-)
Quick question, is there a simple way to make the script work for all message boards or sites? Like say I'm off browsing enworld or our local PFSRD message boards (www.freeyabb.com) this would be very sweet to implement more globaly.
Quick answer: Probably.
Longer answer:
The script is basically three components:
1. Load and process a topic map
2. Find posts so we know which text to mark up
3. Break posts down and convert words to links
There is no reason components #1 and #3 can't be reused, the real trick is rewriting component #2 to be a little more global.
For example, you'll notice that even if you use the script on Paizo's messageboards, there is a big block of legal text at the very bottom of the page. None of the words in that blurb are auto-linked, despite containing a keyword like "dragon".
Currently, the script is careful to only mark up post text. A more general purpose multi-site script would probably need to be less careful about what text gets marked up.
Wonder if it could be made into a bookmarklet somehow, that would be very sweet.
The bookmarklet idea is an interesting one. Right now, there are some places where I used the Greasemonkey functions in the script, so those dependencies would have to be rewritten into plain old JavaScript. Assuming that, I don't see any reason it couldn't be a bookmarklet, except maybe browser limitations on the length of such. :-)
I'll check into these things in the next week.

jreyst |

I was also thinking of creating a much more limited list for the topic map that another-mage used for generating the link lists. Right now it links a lot of words like "will" and things that probably don't need linking on this board. I'm wondering what others thing.
Right now it (I believe) uses the very same Google Spreadsheet of link terms we use for the Perl script we use for auto-linking new pages etc. I have a feeling this Greasemonkey script may not need to have all of the same terms, though now that I think about it, maybe its better to leave it this way so that as we add more terms to the spreadsheet it will be dynamically updated.

another_mage |

I need to find a similar app for Chrome.
Did you try Greasemetal?
If it's everything it's touted to be, my Greasemonkey script should run in it as well. :-)

another_mage |

I was also thinking of creating a much more limited list for the topic map that another-mage used for generating the link lists. Right now it links a lot of words like "will" and things that probably don't need linking on this board. I'm wondering what others thing.
Right now it (I believe) uses the very same Google Spreadsheet of link terms we use for the Perl script we use for auto-linking new pages etc. I have a feeling this Greasemonkey script may not need to have all of the same terms, though now that I think about it, maybe its better to leave it this way so that as we add more terms to the spreadsheet it will be dynamically updated.
I took the spreadsheet and ran it through a little program I wrote in Java. The resulting output is the topic map now provided at:
http://pages.cs.wisc.edu/~meade/greasemonkey/topicmap.json
My original intent was that you would host the topic map on d20pfsrd.com, so that you could always keep it up to date. I'm still very much in favor of that idea, but I didn't want to force you to write any code. I'd write it myself, but my Perl-fu is very weak. :-(
So, I'll keep hosting and updating the topic map until/unless you give me a new URL to use.

Blazej |

jreyst wrote:Ok, now that's funny. Any chance of a GM script that automatically collapses/deletes a post with a sm*** avatar or that includes the word in the text?I'd work on this one today, but I've got a game to run at Noon CST. Maybe some time next week. :-)
Could I also get a GM script that automatically collapses/deletes posts by a poster that uses the previous GM script? :P

another_mage |

another_mage wrote:Could I also get a GM script that automatically collapses/deletes posts by a poster that uses the previous GM script? :Pjreyst wrote:Ok, now that's funny. Any chance of a GM script that automatically collapses/deletes a post with a sm*** avatar or that includes the word in the text?I'd work on this one today, but I've got a game to run at Noon CST. Maybe some time next week. :-)
Ironically, I've already made that script. Click here.

jreyst |

My original intent was that you would host the topic map on d20pfsrd.com, so that you could always keep it up to date. I'm still very much in favor of that idea, but I didn't want to force you to write any code. I'd write it myself, but my Perl-fu is very weak. :-(
So, I'll keep hosting and updating the topic map until/unless you give me a new URL to use.
Just so we're clear, I don't mind hosting it on d20pfsrd.com at all. I was wondering/hoping though that there might be some manner in which the topic map could be auto-updated by our Google spreadsheet? Meaning, we update the spreadsheet and the Greasemonkey script accesses the spreadsheet via the html link to that very same spreadsheet?
Unless it doesn't work like that at all lol
I was hoping to avoid managing a separate list of links etc and hoping to tie it into our existing process. If that's not possible, or extremely difficult to implement though I'd be happy to host the file. We'd just have to be creative in how we do it since we can't just add an html file to the site, we have to incorporate the html either into an existing Google Sites page, embed it within an iframe from an external host, or... well I dunno, we'd have to play around with it.
Let me know how you'd like to handle it. Believe you me brother I'm not going to look a gift horse in the mouth. If all you say is "here it is, you figure it out" that's even fine by me :)

another_mage |

another_mage wrote:My original intent was that you would host the topic map on d20pfsrd.com, so that you could always keep it up to date. I'm still very much in favor of that idea, but I didn't want to force you to write any code. I'd write it myself, but my Perl-fu is very weak. :-(
So, I'll keep hosting and updating the topic map until/unless you give me a new URL to use.
Just so we're clear, I don't mind hosting it on d20pfsrd.com at all. I was wondering/hoping though that there might be some manner in which the topic map could be auto-updated by our Google spreadsheet? Meaning, we update the spreadsheet and the Greasemonkey script accesses the spreadsheet via the html link to that very same spreadsheet?
Unless it doesn't work like that at all lol
I was hoping to avoid managing a separate list of links etc and hoping to tie it into our existing process. If that's not possible, or extremely difficult to implement though I'd be happy to host the file. We'd just have to be creative in how we do it since we can't just add an html file to the site, we have to incorporate the html either into an existing Google Sites page, embed it within an iframe from an external host, or... well I dunno, we'd have to play around with it.
Let me know how you'd like to handle it. Believe you me brother I'm not going to look a gift horse in the mouth. If all you say is "here it is, you figure it out" that's even fine by me :)
:headslap: Now I understand!
Sorry, my mind was locked into a server-side solution to the topic map. Pretty sure I could update the script to obtain and post-process the spreadsheet client side in the GM script itself.
Thanks. :-)

jreyst |

:headslap: Now I understand!
Sorry, my mind was locked into a server-side solution to the topic map. Pretty sure I could update the script to obtain and post-process the spreadsheet client side in the GM script itself.
Thanks. :-)
Double-extra groovy baby :)

Laithoron |

I thought Greasemonkey worked on Chrome?
As of February 2010, Chrome has "native support" for Greasemonkey scripts.[9] They are internally converted to extensions, and are managed as such. Chrome ignores @exclude metadata within the scripts, so the scripts are executed for all domains/pages. On the other hand, Chromium honors the @include directives and executes the scripts only for the domains/pages specified. In Chrome, scripts that use one of the GM_setValue or GM_getValue initiatives will break, and scripts that use the popular E4X standard will not run.
I've tried installing the script directly, and also by using two different javascript interpreters but still no change. The GM_get/setValue functions are unrecognized.

another_mage |

jreyst wrote:I thought Greasemonkey worked on Chrome?Wikipedia wrote:As of February 2010, Chrome has "native support" for Greasemonkey scripts.[9] They are internally converted to extensions, and are managed as such. Chrome ignores @exclude metadata within the scripts, so the scripts are executed for all domains/pages. On the other hand, Chromium honors the @include directives and executes the scripts only for the domains/pages specified. In Chrome, scripts that use one of the GM_setValue or GM_getValue initiatives will break, and scripts that use the popular E4X standard will not run.I've tried installing the script directly, and also by using two different javascript interpreters but still no change. The GM_get/setValue functions are unrecognized.
Good to know. The auto-linking script makes use of GM_get/setValue functions, but they aren't strictly necessary. I'll look into eliminating them in the next version.

jreyst |

Testing...
Orc. orc. Orc orc
In my test it successfully linked both instances of "orc." and "orc" so I see that it is a case of umm "case" in the lookup spreadsheet.
@another-mage: Does the Greasemonkey script dynamically reference the spreadsheet now, ie, if I add rows to the spreadsheet will people using this automatically be updated or do you need to do anything to see the updates?
I suppose I can just test by adding to the spreadsheet then reloading this page lol

another_mage |

jreyst wrote:Testing...
Orc. orc. Orc orc
In my test it successfully linked both instances of "orc." and "orc" so I see that it is a case of umm "case" in the lookup spreadsheet.
@another-mage: Does the Greasemonkey script dynamically reference the spreadsheet now, ie, if I add rows to the spreadsheet will people using this automatically be updated or do you need to do anything to see the updates?
I suppose I can just test by adding to the spreadsheet then reloading this page lol
It does not dynamically update from the spreadsheet yet; haven't had a chance to sit down and write that.
The matching routine is case-insensitive, so elf ELF Elf ElF eLF should all link to the same thing. When the spreadsheet provided two different cases with two different links, my topic map generator program chose the shorter of the two links.
I'd write more, but I have to go back to work now. :-)

another_mage |

I have released an updated version of my Greasemonkey script to auto-link topics from the messageboards.
Installation
If you've never installed the script before, you can follow the directions in the first post on this thread. It will install the newest version.
Upgrading
In order to upgrade, do this:
1. Right click the Greasemonkey icon in the lower right-hand corner of your browser window.
2. Select "Manage User Scripts..." from the context menu.
3. Select "topic_autolink" on the left hand side of the dialog box.
4. Click the "Uninstall" button at the bottom of the dialog box.
5. Click the "Close" button in the lower right-hand corner of the dialog box.
6. Click the following link to install the new version:
http://pages.cs.wisc.edu/~meade/greasemonkey/topic_autolink.user.js
Release Notes (New Features)
- This version will wait for the topic map to be loaded before marking up the page. It should work starting with the first page load.
- This version downloads the spreadsheet that JReyst uses for topic linking on d20pfsrd.com. This means any time he updates the spreadsheet, the script will make use of the new topics and links automagically.
Other Notes
- If you were a fan of the old version, you can choose not to upgrade. Do nothing, the script you have will keep working just fine.
- If you try out the new version, and decide you would like to go back, follow the upgrade instructions, but substitute this link instead:
http://pages.cs.wisc.edu/~meade/greasemonkey/archive/topic_autolink_v1.user .js
- This new version of the script will download the spreadsheet from Google. In theory, this means Google can track your Paizo messageboard usage. Most of us probably don't care, but I want to provide full disclosure in good faith.
Happy Auto-Linking! :-)