• Hey Guest. Check out your NeoGAF Wrapped 2025 results here!

Live Thread - A browser extension

Status
Not open for further replies.
For those interested: The reason why the script stopped working is because of security considerations. The core function in all of this, XMLHttpRequest, was deemed too unsafe by the powers that be - specifically when accessing sites outsides a very small scope, and that means that a script on your PC must not interact with the page hosted on neogaf servers. If the unmodified script still works then your Browser is either old or misconfigured/compromised.

There are ways to re-enable the old functionality, but I'm not quite sure EviLore would be willing to futz around with the servers just so we can have our spinny reload thingamabops.



Anyway. I've gotten it to work without that thanks to some unholy Frankenhack. I'm adding what I did and why so someone with actual javascript expertise can code something worthwhile.

Again: This terrifying monster works on the one PC I need it to work on. On one specific revision of the ancient v12 Opera Browser.

Also: Yes, hack. This is not my proudest work. Very far from it, actually. Use at your own risk. I'd rather you just used this hack as a guideline on what needs to be fixed, dear reader.



Since XMLHttpRequest won't work (really shitty of them to just return null and not throw an exception or otherwise indicate failure):

GM_xmlhttpRequest is deliberately pretending the (local) XMLHttpRequest is executed on the page from the server. Also, as an added Bonus: It's GreaseMonkey exclusive. Also, it doesn't support the required request type ("document"), so you get a string with HTML text back instead of what the rest of the scripts are expecting.

At this point in time, you have a couple of possible ways to go about that:
  1. Use the dedicated functions to parse the HTML, namely DOMParser(); - Problem: it's not widely supported yet.
  2. Use jQuery to benefit from the hard work of your peers
  3. Write your own code
  4. Google a premade solution that throws a couple of exceptions depending on Browser, but generally works.
....

So, yeah.

With that addition the script resumes its work.

I'm just leaving this here as a general idea what needs to be done.

Code:
function str2Dom(html) {

	//SOURCE: http://krasimirtsonev.com/blog/article/Convert-HTML-string-to-DOM-element
		////DOMParser would be better, but doesn't work with text/html on Opera v12
		////Alternative: jQuery
	
    var frame = document.createElement('iframe');
    frame.style.display = 'none';
    document.body.appendChild(frame);             
    frame.contentDocument.open();
    frame.contentDocument.write(html);
    frame.contentDocument.close();
    var el = frame.contentDocument;
    document.body.removeChild(frame);
    return el;
	
}

function updateRequest() {

    clearInterval(STATE_TIMER);
    STATE_TIMER = null;
    STATE_PENDING = true;

    UI_actionStart.textContent = TEXT_PENDING;

    UI_message.textContent = TEXT_WAIT;

    try {

		////THIS IS A HACK, USE AT YOUR OWN RISK
		
		GM_xmlhttpRequest({
		method: "GET",
		url: STATE_URL,
		responseType: "document",
		onload: function(response) {
			checkReponse(str2Dom(response.responseText));
			updateComplete();
			},
		onerror: function(response) {
			STATE_FAIL_COUNT += 1;
    			updateComplete();
			}
		});
	
	} catch (e) {
        STATE_FAIL_COUNT += 1;
        updateComplete();
    }
}


I... I'm sorry. I just needed my spinny loady thing back. And I hate Javascript like I hate jabbing needles in my eyes. Desperate times call for desperate measures.
 
Might I suggest adding the number of new posts to the tab title as long as the tab is inactive? Like Twitter does:

bildschirmfoto2014-08c6sjs.png


If the unmodified script still works then your Browser is either old or misconfigured/compromised.

Mine is still working. I'm using the latest versions of Chrome, the script and OS X. I can't recall changing any security settings, and I'm very sure my browser isn't compromised.


edit: Another idea. How about an option to automatically scroll down to the newest post?
 
the chrome extension should be fine but the firefox one just needed some new permissions added to the header. It should work now.

Firefox v2.1.2 - download here (if anyone wants to rehost it that's fine)

only change is at the top

Code:
// @include https://www.neogaf.com/forum/showthread*
// @include https://neogaf.com/forum/showthread*
// @include https://www.neogaf.net/forum/showthread*
// @include https://neogaf.net/forum/showthread*

edit: also this thread is really old so probably just PM me if you have any more problems
 
Would anyone be awesome enough to convert this extension to be compatible with Safari, if that's even possible?
 
edit: v3.0.2 should hopefully fix the update bug.

well I'll be honest I forgot all about this and it got deleted from my dropbox.

I was sitting on a newer version anyway that I've just spent the last hour or so polishing and you can use that if you want

v3.0.1

changes

* added a dropdown to change how quickly it updates

* added an option to automatically start for selected threads.

* removed the spinning icon and replaced it with a static one.

The animation was forcing Chrome to redraw the whole page in some situations and it was making text blurry.​

* added browser updates when scrolling

So let's say you start on page 1 and load 5 pages. As you scroll this will update your browser URL to properly show what page you're actually on. So if you scroll to Page 3 and refresh it will put you on Page 3 not Page 1. This should make it a bit less confusing to use.​

* added a marker to the title when the page is updated but the tab is in the background

this just adds a little * to the start of the tab text so you can see it's been updated. Also if the tab is pinned the browser will show a little blob like this

UMp6om6.png

---------------------

Chrome

https://chrome.google.com/webstore/detail/neogaf-live-thread/blbfgndoggabppkoehpipfadjelcofmp

Firefox

https://addons.mozilla.org/firefox/addon/neogaf-live-thread/

Greasemonkey

use live.user.js

Edge

Edge users can use it but the extensions are still in preview so I can't publish it. if you want to do it you have to do it yourself for now.


  1. Open Edge and go to about:config
  2. Tick "Enable extension developer features"
  3. Restart Edge
  4. download this zip file and put the "src" folder somewhere on your computer
  5. In Edge click "..." and then Extensions
  6. click 'Load Extension' and select the "src" folder you just downloaded above

source on github

any questions or problems you can PM me or post here I guess. I'm not sure what the policy is as this thread is nearly seven years old :|
 
well I'll be honest I forgot all about this and it got deleted from my dropbox.

I was sitting on a newer version anyway that I've just spent the last hour or so polishing and you can use that if you want

v3.0.1

changes

* added a dropdown to change how quickly it updates

* added an option to automatically start for selected threads.

* removed the spinning icon and replaced it with a static one.

The animation was forcing Chrome to redraw the whole page in some situations and it was making text blurry.​

* added browser updates when scrolling

So let's say you start on page 1 and load 5 pages. As you scroll this will update your browser URL to properly show what page you're actually on. So if you scroll to Page 3 and refresh it will put you on Page 3 not Page 1. This should make it a bit less confusing to use.​

* added a marker to the title when the page is updated but the tab is in the background

this just adds a little * to the start of the tab text so you can see it's been updated. Also if the tab is pinned the browser will show a little blob like this

UMp6om6.png

---------------------

Chrome

If you've got it installed on Chrome you should get the update any time now

https://chrome.google.com/webstore/detail/neogaf-live-thread/blbfgndoggabppkoehpipfadjelcofmp

Firefox

I've published it to the firefox addon store but it's in a queue waiting to be approved so you might see a warning

https://addons.mozilla.org/firefox/addon/neogaf-live-thread/

Greasemonkey

use live.user.js

Edge

Edge users can use it but the extensions are still in preview so I can't publish it. if you want to do it you have to do it yourself for now.

downloads these files


  1. Open Edge and go to about:config
  2. Tick "Enable extension developer features"
  3. Restart Edge
  4. Save all the above files to a folder on your computer somewhere
  5. In Edge click "..." and then Extensions
  6. click 'Load Extension' and select the folder you just made

source on github

any questions or problems you can PM me or post here I guess. I'm not sure what the policy is as this thread is nearly seven years old :|

Whoa I was suprised to see an update show up this morning. Great stuff dude!

I can't use Gaf without the addon anymore and I really like the new features, especially the tab marker to tell you when there's something new to see.

Good job!
 
Actually, now that I've been using it for the day it looks like it stops working from time to time.

I'm running it on multiple tabs and twice today I realized that some threads that would normally be quite active had not updated in quite a while (in this case the Giant Bomb community thread and the STEAM thread).

In both cases I manually refreshed and saw 1-2 new pages on the thread.
 
Am I crazy or the addon used to look for edits in the current page?

Like if it loads the next message after my latest one and then that person edits to reply to my post the edit will show up on the next addon refresh?

I thought it was doing that since the last 3.0 update but it's not doing it anymore?
 
Am I crazy or the addon used to look for edits in the current page?

Like if it loads the next message after my latest one and then that person edits to reply to my post the edit will show up on the next addon refresh?

I thought it was doing that since the last 3.0 update but it's not doing it anymore?

It did. I forgot to put it back and then forgot about it entirely. I will do that when I get a chance

-----

Also PM in future with stuff like this. Saves bumping a really old thread.
 
Can I suggest one feature? It could be a checkbox or something, but it would be cool if the live thread scrolls down with new comments, which would be really useful during event threads like E3 when everyone is just spamming reactions and it's hard to keep up. I guess that would make it like a twitch chat? Not ideal but could be useful for readers.
 
Can I suggest one feature? It could be a checkbox or something, but it would be cool if the live thread scrolls down with new comments, which would be really useful during event threads like E3 when everyone is just spamming reactions and it's hard to keep up. I guess that would make it like a twitch chat? Not ideal but could be useful for readers.

I use the Auto Scroll addon for doing that but sure having it built-in live thread would be sweet

https://chrome.google.com/webstore/detail/auto-scroll/eochlhpceohhhfogfeladaifggikcjhk?hl=en
 
Status
Not open for further replies.
Top Bottom