![]() ![]() |
I prefer the reference view, but new style has some nice ideas, like: - placing important info after (or below)the movie title, so no need for scrolling. Here's the pic: http://simplest-image-hosting.net/jpg-0-3300 So basically, I just want to move something from one place to another. Is this hard to do? |
![]() ![]() |
IMDB looks completely different for me + it has all that info at the top of the page. are you already using a script to get that look? which one? |
![]() ![]() |
No, you need to register on imdb to get that layout, then go to https://secure.imdb.com/register-imdb/siteprefs and check "Show previous title and name page design (reference view)". The green color is just the css I use. |
![]() ![]() |
It's a little fiddly to reference the bits of data as they don't have unique ID tags, but this approach works in Firefox+GM:
// get array of all the 'info-content' divs within the 'tn15content' div
pageContent = document.getElementById('tn15content').getElementsByClassName('info-content');
// select the one that contains the release date
releaseDate = pageContent[5];
// clone the div
releaseDate2 = releaseDate.cloneNode(true);
// insert clone after the title div
title = document.getElementById('tn15title');
title.parentNode.insertBefore(releaseDate2, title.nextSibling);
|
![]() ![]() |
Thanks Mike, but unfortunately it works random, probably because of
I've found a script which maybe holds the key. It finds stuff by name and removes them.
For example:
I've tried replacing "pageContent[5];" in your script with:
releaseDate = ('id("tn15content")/div[starts-with(h5, "Release Date")]');
but it didn't work. |
![]() ![]() |
Ah silly me for not checking IMDB used a fixed order, yep we'll need to be more clever than saying 'choose the fifth one' What you've tried there won't work because the string is designed for use in an Xpath search. See how it's passed onto the rm and xp functions in the script you've taken it from. Xpath would be one way to do it but is kinda overkill for referencing single elements, looping through the data DIVs until we see 'Release Date' would accomplish this fine + is more interesting to code :-) I'll have another look in a bit. |
![]() ![]() |
If you don't have anything against using unsafeWindow, then you can use jQuery from imdb.com website: (function() {
if (top != self) return; // to avoid running script in frames
$ = unsafeWindow.$; // jQuery on imdb.com website
console.log($("*.info:contains('Release Date') > div"));
})();
|
![]() ![]() |
Give this a try:
var insertTarget = document.getElementById('tn15title');
var dataHeadings = document.getElementById('tn15content').getElementsByTagName('h5');
for ( i=0; i < dataHeadings.length; i++ ) {
text = dataHeadings[i].textContent;
if (text.indexOf("Release Date:") != -1 || text.indexOf("Runtime:") != -1) {
cloneItem(dataHeadings[i].parentNode); // clone the parent node of the heading
}
}
function cloneItem(item) {
// clone the div
item2 = item.cloneNode(true);
// insert clone
insertTarget.parentNode.insertBefore(item2, insertTarget.nextSibling);
}
|
![]() ![]() |
Thank you Mike it works and looks great, plus I've learned something. |
![]() ![]() |
You're welcome, I'm still trying to remember the exact command names for all this stuff instead of looking them up each time - every bit of scripting helps! |



