• Faceraper 2011 for Greasemonkey
    389 replies, posted
[QUOTE=Onyx3172;27621123]It does it on mouseover but when I move the mouse elsewhere, it doesn't change back to the ban avatar.[/QUOTE] I didn't code that part.
Oh, okay. I think I misunderstood Rilez's post then.
Thank you Faceraper 2011 for telling me what posts I want to read, because I am too stupid to decide for myself :v:
Would it be possible to automatically block threads if the Original Poster has x number of bad ratings/low smartness?
[QUOTE=jaybuz;27621116]Morph, please fix this script: [url]http://userscripts.org/scripts/show/79249[/url][/QUOTE] I'll add it to my todo list, it's a fairly simple fix. Getting it to work with faceraper will be the tricky part. [editline]24th January 2011[/editline] [QUOTE=Noth;27621573]Thank you Faceraper 2011 for telling me what posts I want to read, because I am too stupid to decide for myself :v:[/QUOTE] Configure the filters, and decide for yourself what deems a post terrible. [QUOTE=ROFLBURGER;27621651]Would it be possible to automatically block threads if the Original Poster has x number of bad ratings/low smartness?[/QUOTE] Smartness: Not going to happen. Ratings: I might implement something if a rating is displayed on a thread. Don't count on it though.
[QUOTE=not_Morph53;27621686]Configure the filters, and decide for yourself what deems a post terrible.[/QUOTE] I like it the way it is, it's pretty accurate
[QUOTE=Noth;27621850]I like it the way it is, it's pretty accurate[/QUOTE] Oh, my bad. I thought you were being sarcastic.
Oh, I thought the green thing at the top right of someone's post was "smartness" Sorry, I didn't mean smartness. Also does that have a name?
[QUOTE=ROFLBURGER;27622398]Oh, I thought the green thing at the top right of someone's post was "smartness" Sorry, I didn't mean smartness. Also does that have a name?[/QUOTE] It is, but it's calculated for posts, not threads. Otherwise I'd have to load posts when browsing the threadlist.
Emote list is back in Chrome after the latest update.
[QUOTE=not_Morph53;27621686]I'll add it to my todo list, it's a fairly simple fix. Getting it to work with faceraper will be the tricky part.[/QUOTE] If you tell me what needs fixing in it, I might be able to do it myself. thanks
[QUOTE=jaybuz;27629183]If you tell me what needs fixing in it, I might be able to do it myself. thanks[/QUOTE] Off the top of my head (didn't test it, i can't be arsed) replace [code] function reallyAddPost(post) { var post_url = 'http://www.facepunch.com/showpost.php?p=' + post.postid; var post_content = ''; var begin_string = '<!-- post #' + post.postid + ' -->'; var end_string = '<!-- / post #' + post.postid + ' -->'; var spacer_div = '<div id="edit' + post.postid + '" class="spacer">\n'; var after_spacer = '<div class="postbitold"'; var req = new XMLHttpRequest(); req.open('GET', post_url, true); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { if(req.status == 200) { post_content = req.responseText; post_content = post_content.substring(post_content.indexOf(begin_string), post_content.indexOf(end_string)); post_content = post_content.substr(post_content.indexOf(begin_string), begin_string.length) + spacer_div + post_content.substr(after_spacer); console.log('POST CONTENT:\n' + post_content); $("#lastpost").before(post_content); } else dump("Error loading page\n"); } }; req.send(null); } [/code] with [code] function reallyAddPost(post) { var post_url = 'http://www.facepunch.com/showpost.php?p='+post; var post_params = "&ajax=1&postid="+post+"&securitytoken="+SECURITYTOKEN; var post_content = ''; var req = new XMLHttpRequest(); req.open('POST', post_url, true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); req.setRequestHeader("Content-length", post_params.length); req.setRequestHeader("Connection", "keep-alive"); req.onreadystatechange = function (aEvt) { if (req.readyState == 4) { if(req.status == 200) { post_content = req.responseXML.documentElement.getElementsByTagName('postbit')[0].textContent; var newpst = document.createElement('li'); newpst.id = "post_" + post; newpst.classname = "postbitlegacy postbitim postcontainer postbitold" newpst.innerHTML = post_content; console.log('POST CONTENT:\n' + post_content); $("#lastpost").before(newpst); } else dump("Error loading page\n"); } }; req.send(post_params); } [/code] This is the main problem, the view single post feature of VB requests the entire thread for GET, and only the post in question in response to a POST. I probably overlooked something in here too, but who knows. [editline]24th January 2011[/editline] oh wait, that won't work. it returns xml. give me a moment Ok, now it "should" work.
I'll check it out when I get home.
It probably won't, mm3guy is much better at jQuery type stuff then me. [editline]24th January 2011[/editline] *cough* I see you
Do I need an api token?
[QUOTE=jaybuz;27632902]Do I need an api token?[/QUOTE] Nope. Also, I tested my fix for the Live threads, it still doesn't work. I'll worry about it later.
What's the SECURITYTOKEN then?
[QUOTE=jaybuz;27632957]What's the SECURITYTOKEN then?[/QUOTE] It's a global variable on FP.
Everything works fine so far except this. [img]http://img80.imageshack.us/img80/4472/ss201101242353564842912.png[/img] It won't let me add anything in to them, unless I delete something beforehand. It one of them, and I'm not really sure what I did to do so. I tried changing the style from in the script itself, and it doesn't seem to work. I'm not sure if it's something on my end, or not though. I reinstalled the script, and it still does it, so I'm awfully confused.
[QUOTE=not_Morph53;27629618]It probably won't, mm3guy is much better at jQuery type stuff then me. [editline]24th January 2011[/editline] *cough* I see you[/QUOTE] heh I'll give it a go ;)
Are the settings stored in cookies? I keep losing my configurations when I go into private browsing.
[QUOTE=Anti Christ;27645018]Everything works fine so far except this. [img_thumb]http://img80.imageshack.us/img80/4472/ss201101242353564842912.png[/img_thumb] It won't let me add anything in to them, unless I delete something beforehand. It one of them, and I'm not really sure what I did to do so. I tried changing the style from in the script itself, and it doesn't seem to work. I'm not sure if it's something on my end, or not though. I reinstalled the script, and it still does it, so I'm awfully confused.[/QUOTE] Ah I see. Update, it's now fixed. [editline]25th January 2011[/editline] [QUOTE=C0linSSX;27645452]Are the settings stored in cookies? I keep losing my configurations when I go into private browsing.[/QUOTE] LocalStorage, which private browsing blocks too.
Here, instead of that one here's one I made: [code]// ==UserScript== // @name FP Ticker post loader thing // @namespace whooaaaa // @include http://www.facepunch.com/* // ==/UserScript== (function($){ // Ticker post thing! if(String(location).indexOf('http://www.facepunch.com/threads/') === 0){ var thing = $(".popupctrl:first"); if(thing.length == 1){ thing = thing.eq(0).text().match(/Page ([0-9]+) of ([0-9]+)/); if((thing[2]) != (thing[1])) { return; } } var lastpost = $("#posts > li:last"); lastnum = Number(lastpost.find(".nodecontrols a[name^=post]").text().match(/Post \#([0-9]+)/)[1]) + 1; var LastPost = Number(lastpost.attr("id").match(/post_([0-9]+)/)[1]); var RequestNum = 0; var TickerLimit = 100; var LastPost = 0; var ticker_ajax = null; var attributes_list = ['lastread', 'you', 'yourthread', 'mentioned', 'lastread', 'newthread', 'forumtitle', 'forumlink', 'username', 'userlink', 'threadlink', 'date', 'threadname', 'postid', 'threadid']; function AddTickerPost(post) { var attributes = {}; for (x in attributes_list) { attributes[attributes_list[x]] = post.attributes.getNamedItem(attributes_list[x]).value; } if (Number(attributes['threadid']) === Number($("input[name=t]:first").val())){ $('#posts').append('<li class="postbitignored postbitim postbitlegacy" style="display: none;" id="post_' + attributes['postid'] + '">' + ' <div class="posthead">' + ' <div id="time_image">' + ' <img src="fp/time.png"/>' + ' </div>' + ' <span class="postdate">' + ' <span class="date">' + attributes['date'] + '</span>' + ' </span>' + ' <span class="nodecontrols">' + ' <a name="post' + attributes['postid'] + '" href="' + attributes['threadlink'] + '" class="postcounter"><img src="http://static.facepunch.com/fp/link.png" /> Post #' + lastnum + '</a>' + ' </span>' + ' </div>' + ' <div class="postdetails">' + ' <div class="userinfo">' + ' <a class="username online" href="' + attributes['userlink'] + '" title="' + attributes['username'] + ' is online now">' + attributes['username'] + '</a>' + ' </div>' + ' <div class="postbody">' + ' <div class="postrow">' + ' <h2 class="title">' + ' <label>' + ' Loading...' + ' </label>' + ' </h2>' + ' <div class="content">' + ' <blockquote class="postcontent messageignored">' + ' <div class="smallfont remove_ignore">Fetching posttext.</div>' + ' </blockquote>' + ' </div>' + ' </div>' + ' <div class="nodecontrols">' + ' </div>' + ' </div>' + ' </div>' + ' <hr />' + '</li>'); $('#post_' + attributes['postid']).slideDown(); unsafeWindow.display_post(attributes['postid']); lastnum = lastnum + 1; } } function OnTickerRequestComplete(data, delay) { var newposts = data.getElementsByTagName('post'); for (i = 0; i < newposts.length; i++) { AddTickerPost(newposts[i]); LastPost = Math.max(newposts[i].attributes.getNamedItem('postid').value, LastPost); } if (newposts.length == 0) { delay = delay + 1000; } else { delay = 5000; $('.ticker_item:hidden').slideDown(1000); } setTimeout(function(){ DoRequest(delay);}, delay); } function DoRequest( delay ) { $.get('fp_ticker.php', {aj: 1, startpost: LastPost}, function(data){ OnTickerRequestComplete(data, delay); }, 'xml'); } DoRequest(5000); } })(unsafeWindow.jQuery);[/code] Bug: If you quickreply, you may end up seeing some posts made since the page was loaded twice. I need to figure out how to stop that.
[QUOTE=mm3guy;27645465]Here, instead of that one here's one I made: snip code tag Bug: If you quickreply, you may end up seeing some posts made since the page was loaded twice. I need to figure out how to stop that.[/QUOTE] Ah, I see what you did. That's quite clever. Add [code] if(typeof(unsafeWindow)=='undefined') { unsafeWindow=window; } [/code] to the beginning for Opera and Chrome support. [editline]25th January 2011[/editline] Oh, and as far as that bug you mentioned, you'd have to hook into the 'qr_do_ajax_post' function, I'm looking into a way to cleanly hook page javascript myself.
[QUOTE=not_Morph53;27645603]Oh, and as far as that bug you mentioned, you'd have to hook into the 'qr_do_ajax_post' function, I'm looking into a way to cleanly hook page javascript myself.[/QUOTE] Or one could use the [url=http://help.dottoro.com/ljmcxjla.php]DOMNodeInserted[/url] event cleverly (although whenever I use it the browser crashes :( )
Smartness doesn't seem to be working for me. If it is, it's not having any noticeable effect.
[QUOTE=mm3guy;27645731]Or one could use the [url=http://help.dottoro.com/ljmcxjla.php]DOMNodeInserted[/url] event cleverly (although whenever I use it the browser crashes :( )[/QUOTE] lol, yes. Perhaps this thread now belongs in webdev. [editline]25th January 2011[/editline] [QUOTE=Doomish;27645742]Smartness doesn't seem to be working for me. If it is, it's not having any noticeable effect.[/QUOTE] Is the auto filter turned on? That has to be enabled for smartness to do anything.
Just noticed something else. It's not really a bug though. [img]http://img825.imageshack.us/img825/2985/ss201101251651025885400.png[/img] When you open the post, and then close it again. [img]http://img197.imageshack.us/img197/9463/ss201101251651175882364.png[/img] You can still see that extra part on the post. Is it meant to do that?
Yes.
[QUOTE=not_Morph53;27617846]Disable the AVG Safe Search and or Linkscanner extension in firefox, then restart firefox.[/QUOTE] Thank you. :v:
Sorry, you need to Log In to post a reply to this thread.