Shacknews.com chat

Forums » General Opera topics » Open the Web

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

24. May 2010, 03:19:59

MamiyaOtaru

Posts: 161

Shacknews.com chat

shacknews.com comments threads have been broken in Opera since 10.5. Go to any of them (like http://www.shacknews.com/laryn.x?story=63931 ). Click on any of the replies. It should look like the first part of the attached image, but looks like the seconds. Hit refresh thread. Should again look like the first part of the image (but with any new comments) but instead it looks like the third part. Is there any sort of user javascript or anything to alleviate this? Or a browser fix? Works in all other browsers I've tried, including old versions of Opera

17. June 2010, 15:05:51

splondike

Posts: 528

The original problem is caused by an apparent Opera bug where an element tree duplicated using "importNode" doesn't use class based rules. That is if <div class="blah">Test</div> were imported and inserted then it wouldn't be affected by the rule .blah{color:green}. Parent based CSS rules are applied. This bug is reported as DSK-302591. I've sent Opera a test case as well, not reproduced here.

I tried to fix the problem with a user javascript but ran into another, different, bug! I couldn't work around it either, and can't be bothered defining it now. If the page formatting is really annoying you, use the following as a bookmarklet to cause a page reflow after you've encountered the problem:
javascript:document.body.innerHTML+='';void(null);

12. July 2010, 13:03:49 (edited)

MamiyaOtaru

Posts: 161

was working on a crappy kludge to make it usable until Opera fixes something. Probably a better way to do this but I don't know userscript too well yet

window.opera.addEventListener("beforeEvent.click" etc. doesn't seem to do anything at all?

// ==UserScript==
// @name           ShackLayoutFix
// @include http://*.shacknews.com/laryn.x?*
// @include http://shacknews.com/laryn.x?*
// @include http://*.shacknews.com/frame_laryn.x?*
// @include http://shacknews.com/frame_laryn.x?*
// ==/UserScript==

window.addEventListener('click', function (e)  {  setTimeout("redraw()", 1000);  }, true);

function redraw(e)
{
	document.body.innerHTML+='';void(null);
}


Anyway, this makes *posting* comments not work too well. Will probably put your stuff in a button or something sad cmon Opera please fix

17. December 2010, 07:52:17

MamiyaOtaru

Posts: 161

this has been broken (regressed) for 10 months and multiple major revisions now. As it is a site I visit multiple times a day, I must kiss Opera goodbye.

18. December 2010, 01:11:53

splondike

Posts: 528

Well, it took a bit of work, but this script seems to fix it:

/ ==UserScript==
// @name Shacknews fix fox Opera
// @description Works around an Opera bug to make JS inserted comments
// get styled
// @include http://www.shacknews.com/*
// ==/UserScript==

document.addEventListener("DOMContentLoaded", function(){
	//Patch the site style so the teaser is hidden when the full post shows
	var style = document.createElement("style");
	style.textContent = "div.fullpost + div.oneline{display:none;}";
	document.getElementsByTagName("head")[0].appendChild(style);

	//defineMagicFunction didn't work, e.target.innerHTML += '' didn't work.
	//This did work.
	document.addEventListener("DOMNodeInserted", function(e){
		var elm_class = e.target.className;
		if(elm_class.indexOf("fullpost") == 0 || elm_class.indexOf("root") == 0){
			//If I don't do the remove/add thing the reflow causes an
			//infinite loop
			document.removeEventListener("DOMNodeInserted", arguments.callee, false);
			document.body.innerHTML += '';
			document.addEventListener("DOMNodeInserted", arguments.callee, false);
		}
	}, false);
}, false);


I found another bug (or maybe the same, I can't remember) while working on it!

Forums » General Opera topics » Open the Web