Mint Refresh Alpha

By Tylian Last update Sep 25, 2012 — Installed 8,412 times.

Add your review

1 review


4 stars
Ponydude Here , Jan 24, 2012
Review written by thelixFeeth - see all my reviews (1)
EDIT: Almost forgot, if you do use RDN Refresh as a starter, you'll want to change SUC_script_num to match your script number on userscripts.org otherwise your script will be updated whenever the main RDN Refresh gets updated and it'll overwrite all your clients' scripts.
Hiya! I just wanted to say I'm impressed at how far along you've come already, and I just wanted to point out a few things (I'm guessing that you probably already know most of it, but I just wanted to make sure):
  • Delete buttons on posts that don't belong to the user
  • On any page that's not home, the timeline gets destroyed. This part could get complicated as the API URL doesn't always relate directly to the page URL. It might help to pluck the URL from the RSS2.0 or Atom links on the side of the page and then change the extension to JSON.
  • The reply button sticks the @whoever at the end of the post instead of the beginning
  • You forgot Spanish. And German. And French. And Japanese. xD Obviously I'm being ridiculous, but localization is one of the things that you lose when you hard code strings into the program. Just keep that in mind for the future. Here it might not matter as much.
  • Adding BBCode: Please consult with me before doing this, and do not add the following features unless you can come up with a good way to keep them from taking obnoxious amounts of space (For example, line breaks would be glorious, but there needs to be a way to limit the user to only four or five max. This means stripping out extra ones on submit. Submit is not even something the current Refresh even handles):
    • Text size modifications
    • Tables
    • Lists
    • Another other block elements
    • Line breaks
    • Images (even if resized, because the user could attach a wickedly large image and slow down the browser
  • RDN Refresh works on StatusNet 1.0 sites as well as 0.9, which means it works pretty much anywhere. The 1.0 support is somewhat flaky, but it does work. If you need a place to test this, you'll have to go to equestriacoffeehouse.com (Note this site is #NSFW. I only recommend it for testing. Prolonged exposure will melt your brain.) and log in with Username: vungrguvfcynpr Password: stupidpass or stupidpassword (Can't remember)
  • It's 'p.entry-content', because you're telling it that the p is classed entry-content. 'p .entry-content' selects an element classed entry-content which is a child of a paragraph.
    p.entry-content
    --> <p class="entry-content">
        blah
        </p>
    p .entry-content
        <p class="whatever">
    --> <span class="entry-content">
        blah
        </span>
        </p>
    
  • Rather than repeat text.replace over and over, you might consider doing something like below. I'll admit the main loop is slightly less straightforward, but the tags are slightly easier to maintain. There is also theoretically a slight speed increase.
            var substitutions = {
                '\\[b\\s*\\]' : '<b>',
                '\\[/\\s*b\\s*\\]' : '</b>',
                '\\[u\\s*\\]' : '<u>',
                '\\[/\\s*u\\s*\\]' : '</u>',
                '\\[i\\s*\\]' : '<i>',
                '\\[/\\s*i\\s*\\]' : '</i>',
                '\\[s\\s*\\]' : '<span style="text-decoration: line-through;">',
                '\\[/\\s*s\\s*\\]' : '</span>',
                '\\[c\\s*=\\s*([#0-9a-z]*)\\s*\\]': '<span style="color: $1;">',
                '\\[/\\s*c\\s*\\]': '',
                '\\[h\\s*=\\s*([#0-9a-z]*)\\s*\\]': '',
                '\\[/\\s*h\\s*\\]': '</span>',
            };
            jQ(newPosts).find('p.entry-content').each(function() {
                if(jQ(this).html().search(/\[/) != -1) { // An advantage to using consistent tags
                    for(each in substitutions) {
                        substitution = new RegExp(each, 'gi');
                        jQ(this).html(jQ(this).html().replace(substitution, substitutions[each]));
                        }
                }
            });
    
  • Don't forget the ROT13 functions. They're important around episode time because spoilers.
  • If you're using Firebug (and this is a little OCD, but bear with me, because it does help with load times :) you can get timings for the various parts of your script. Just use unsafeWindow.console.time('timestampname') and unsafeWindow.console.timeEnd('timestampname') where you want to start and stop your timer. Make sure Firebug panel is open when you have these functions in your script, otherwise the script won't run. And VERY IMPORTANT: Remember to remove these functions before distributing the script, or it won't work.
  • If possible, you might want to incorporate your post reconstruction stuff into the existing RDN Refresh so that way you don't have to rewrite it all from scratch. It's your decision though.
Good luck!

0 comments |