Welcome to the Invelos forums. Please read the forum rules before posting.

Read access to our public forums is open to everyone. To post messages, a free registration is required.

If you have an Invelos account, sign in to post.

    Invelos Forums->DVD Profiler: Layouts and Reports Page: 1 2  Previous   Next
HTML Window -> Wikipedia
Author Message
DVD Profiler Unlimited RegistrantRossRoy
Registered: March 13, 2007
Posts: 793
Posted:
PM this userDirect link to this postReply with quote
While editing some profile and trying to get more confirmation for some data, I found myself visiting Wikipedia more and more. Also, I found the articles on movies and TV series to be quite interesting, so I thought, why not load it right into Profiler! So I did. Here's the code:

Quote:

see further down for the code


Installation (same as other HTML Windows):
- On the menu:  HTML Windows -> Edit...
- Right-click left pane -> New... and give it a name (I called mine: Wikipedia)
- Replace the code that's already there with the one in the blockquote above.
- Click OK. Then go to menu: HTML Windows -> Wikipedia to show it.

Usage:
You need to add a tag to your notes, and add the part that comes after the "/wiki/" part on the Wikipedia page. For example, Voltron.

The link to the Voltron page on Wikipedia is: http://en.wikipedia.org/wiki/Voltron

So, you'll want to add <wiki>Voltron</wiki> to your notes.

Giving credit where credit is due:
Thank you to the original creator of the IMDb page loader, which I have HEAVILY used for this 

Feel free to modify it any way you wish, but it'd be nice if you posted your changes back here 
 Last edited: by RossRoy
DVD Profiler Unlimited RegistrantRossRoy
Registered: March 13, 2007
Posts: 793
Posted:
PM this userDirect link to this postReply with quote
I've already changed it. Now, instead of requiring the <wiki> tag to be set, it checks if it's present. If it's not, it tries loading the Wikipedia page using the title (haven't worked out how to make it use the original title field, instead of the title when set). If the tag is present, it'll load using whatever you set as the tag.

Here's the new version.

Quote:

Keep going, it's still a little further down...


You'll know whether it loads the right page or not on Wikipedia if the pages says there's no article with the exact title, or, if you get a page on a different subject. For example, "Déjà Vu" brings up the page explaining what a Déjà Vu is, instead of the movie profile. In that case, you'd have to set the <wiki> tag to "Déjà Vu (film)" to make it go to the right page.
 Last edited: by RossRoy
DVD Profiler Desktop and Mobile RegistrantMarcCastermans
Registered: March 15, 2007
Posts: 116
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Nice, will give it a try
Greetz,
Marc Castermans

DVD Profiler Unlimited Registrantomueller
Registered: March 14, 2007
Germany Posts: 85
Posted:
PM this userDirect link to this postReply with quote
Added this to my layout - great feature !
DVD Profiler Unlimited Registrantzefeer
Registered: 10.02.2004
Registered: March 19, 2007
Portugal Posts: 93
Posted:
PM this userEmail this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Another great feature of the endless possibilities of DVDProfiler- 
Brilliant!
Beauty is in the eye of the beholder!
DVD Profiler Unlimited Registrantzefeer
Registered: 10.02.2004
Registered: March 19, 2007
Portugal Posts: 93
Posted:
PM this userEmail this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Quoting RossRoy:
Quote:
I've already changed it. Now, instead of requiring the <wiki> tag to be set, it checks if it's present. If it's not, it tries loading the Wikipedia page using the title (haven't worked out how to make it use the original title field, instead of the title when set). If the tag is present, it'll load using whatever you set as the tag.


Do you think you can make it work using the original title?
That would be great.
Thanks.
Beauty is in the eye of the beholder!
DVD Profiler Unlimited Registrantnuoyaxin
prev. known as ya_shin
Registered: March 13, 2007
Reputation: High Rating
Taiwan, Province of China Posts: 3,436
Posted:
PM this userEmail this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
I guess there would only have to be another IF statement, checking whether DP_OriginalTitle is empty ("") or not. IF empty, then use Original Title, ELSE


Could look something like this(...?):
Quote:
if (wikiEnd > 1) {
  var wikiCode = DP_Notes.slice(wikiStart, wikiEnd);
  var wikiLink = ("http://en.wikipedia.org/wiki/" + wikiCode);
  window.location.href = wikiLink;
  }
  else {
      if (DP_OriginalTtile == "") {
        wikiLink = ("http://en.wikipedia.org/wiki/" + DP_Title);
        window.location.href = wikiLink;
      }
      else {
      wikiLink = ("http://en.wikipedia.org/wiki/" + DP_OriginalTitle);
      window.location.href = wikiLink;
      }
  }


I haven't tested this, so maybe someone who knows might have to take a look at it first...

Also, I think the line window.location.href = wikiLink; could be moved to the end somehow, so it doesn't get repeated several times and is instead used universally for all cases...
Achim [諾亞信; Ya-Shin//Nuo], a German in Taiwan.
Registered: May 29, 2000 (at InterVocative)
DVD Profiler Unlimited RegistrantRossRoy
Registered: March 13, 2007
Posts: 793
Posted:
PM this userDirect link to this postReply with quote
Thanks for that ya_shin!

Here's the updated code, with Ya_Shin's typo fixed (You misspelled DP_OriginalTitle in your IF statement), and only 1 window.location.href statement.

Quote:

<HTML>
<HEAD>
<SCRIPT TYPE="text/javascript">
<!--
<DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="False" IncludeCrew="False">
/**************************************************/
// Open Wikipedia page for the profile
function wiki() {
var wikiLink = "";
var wikiCode = "";

var wikiStart = DP_Notes.toLowerCase().search("\<wiki\>") + 6;
var wikiEnd = DP_Notes.toLowerCase().search("\</wiki\>");
if (wikiEnd > 1) {
wikiCode = DP_Notes.slice(wikiStart, wikiEnd);
wikiLink = ("http://en.wikipedia.org/wiki/" + wikiCode);
} else {
if (DP_OriginalTitle == "") {
wikiLink = ("http://en.wikipedia.org/wiki/" + DP_Title);
} else {
wikiLink = ("http://en.wikipedia.org/wiki/" + DP_OriginalTitle);
}
}
window.location.href = wikiLink;
}

//-->
</SCRIPT>
</HEAD>
<BODY onload="wiki();" scroll="auto">
</BODY>
</HTML>
 Last edited: by RossRoy
DVD Profiler Unlimited RegistrantStar Contributormikl
Mark it zero!
Registered: March 14, 2007
Denmark Posts: 235
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Is there a way to define the size of the window that opens? Every time I open DVD Profiler, the HTML windows are small so I have to resize them. It would be nice if they either remembered their size or you could define it in the code.

/Mikkel
DVD Profiler på Dansk
DVD Profiler Unlimited Registrantnuoyaxin
prev. known as ya_shin
Registered: March 13, 2007
Reputation: High Rating
Taiwan, Province of China Posts: 3,436
Posted:
PM this userEmail this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Quoting RossRoy:
Quote:
Thanks for that ya_shin!

No problem, always trying to help.

Quote:
Here's the updated code, with Ya_Shin's typo fixed (You misspelled DP_OriginalTitle in your IF statement), and only 1 window.location.href statement.

I think a typo at 2:00am is acceptable.

...and I asked for someone who actually knows what they are doing to proof read it...


Looks really nice and clean now, Ross.
Achim [諾亞信; Ya-Shin//Nuo], a German in Taiwan.
Registered: May 29, 2000 (at InterVocative)
DVD Profiler Unlimited Registrantxyrano
41215.reg 70320.urk
Registered: March 13, 2007
Sweden Posts: 646
Posted:
PM this userView this user's DVD collectionDirect link to this postReply with quote
Quoting mikl:
Quote:
Is there a way to define the size of the window that opens? Every time I open DVD Profiler, the HTML windows are small so I have to resize them. It would be nice if they either remembered their size or you could define it in the code.

/Mikkel

Yes there is. A link in the HTML window could do that. But that may not be what you want!?
As for resizing a HTML window in the layout from javascript, no I don't think it's possible.

This is a nice little add-on to our HTML window ballpark
DVD Profiler Desktop and Mobile Registrantpauls42
Reg: 31/01/2003
Registered: March 13, 2007
United Kingdom Posts: 2,692
Posted:
PM this userEmail this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Quoting mikl:
Quote:
Is there a way to define the size of the window that opens? Every time I open DVD Profiler, the HTML windows are small so I have to resize them. It would be nice if they either remembered their size or you could define it in the code.

/Mikkel


what window?

I just have this as al extra tab on an existing set of windows so when I select the wiki set then it opens in the existing space used by covers/gallery/cast..
Paul
DVD Profiler Unlimited Registrantxyrano
41215.reg 70320.urk
Registered: March 13, 2007
Sweden Posts: 646
Posted:
PM this userView this user's DVD collectionDirect link to this postReply with quote
Oh crap, I couldn't keep my claws from this one either... sorry bout that RossRoy

Quote:
<HTML>
<HEAD>
<style type="text/css">
<!--
* { color: white; font-family: verdana; font-size: 10pt; }
html, body { background-color: rgb(0, 0, 83); }
body { background-repeat: repeat-x; background-image:url($DPIMAGES.bgimage.jpg); }
h1 { text-align: center; }
a { font-size: 12pt; }
-->
</style>
<SCRIPT TYPE="text/javascript">
<!--
<DP NAME="HEADER_VARS" Language="JavaScript" Comments="True" IncludeCast="False" IncludeCrew="False">
// -------- Configuration block - Start --------
var wikiURL = "http://en.wikipedia.org/wiki/";
var asLink = false; // Load wiki page? var asLink = false;. Display title with link? var asLink = true;.
// -------- Configuration block - End --------
// Open Wikipedia page or add a link for the profile
var wikiCode = "";
var wikiLink = "";
var wikiStart = DP_Notes.toLowerCase().search("\<wiki\>") + 6;
var wikiEnd = DP_Notes.toLowerCase().search("\</wiki\>");
function wiki() {

  if (wikiEnd > 1) {
    wikiCode = DP_Notes.slice(wikiStart, wikiEnd);
    wikiLink = wikiURL + wikiCode;
  } else {
    wikiCode = (DP_OriginalTitle == "") ? DP_Title: DP_OriginalTitle;
    wikiLink = wikiURL + wikiCode;
  }
  if (asLink == true) {
    var lnk = '<a href="' + wikiLink + '" target="_new" onFocus="blur(this);">' + wikiCode + '</a>';
    document.getElementsByTagName('h1')[0].innerHTML = lnk;
  } else {
    window.location.href = wikiLink;
  }
}
//-->
</SCRIPT>
</HEAD>
<BODY onload="wiki();" scroll="auto">
<h1></h1>
</BODY>
</HTML>
DVD Profiler Unlimited RegistrantStar Contributormikl
Mark it zero!
Registered: March 14, 2007
Denmark Posts: 235
Posted:
PM this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Quoting pauls42:
Quote:
Quoting mikl:
Quote:
Is there a way to define the size of the window that opens? Every time I open DVD Profiler, the HTML windows are small so I have to resize them. It would be nice if they either remembered their size or you could define it in the code.

/Mikkel


what window?

I just have this as al extra tab on an existing set of windows so when I select the wiki set then it opens in the existing space used by covers/gallery/cast..


Good idea! 
Now, is there a way to hack it so it removes the menu strip on the left, to save some space?
DVD Profiler på Dansk
DVD Profiler Unlimited RegistrantRossRoy
Registered: March 13, 2007
Posts: 793
Posted:
PM this userDirect link to this postReply with quote
Quoting xyrano:
Quote:
Oh crap, I couldn't keep my claws from this one either... sorry bout that RossRoy

Nah! Helps me actually, seeing a master of JavaScript at work. 



Quote:

html, body { background-color: rgb(0, 0, 83); }
body { background-repeat: repeat-x; background-image:url($DPIMAGES.bgimage.jpg); }

You seem to like my little gradient, I've seen you add it to a few of your Windows 


Quote:

wikiCode = (DP_OriginalTitle == "") ? DP_Title: DP_OriginalTitle;

So that's how to do it! I want to avoid the extra if statement, but I couldn't get this shorthand version to work when I tried it. Time to change my script too!

Thanks for again improving upon it!
DVD Profiler Desktop and Mobile Registrantpauls42
Reg: 31/01/2003
Registered: March 13, 2007
United Kingdom Posts: 2,692
Posted:
PM this userEmail this userVisit this user's homepageView this user's DVD collectionDirect link to this postReply with quote
Another nice change.. (not sure what's actually changed) but I'm sure it must have been nice.. 
Paul
    Invelos Forums->DVD Profiler: Layouts and Reports Page: 1 2  Previous   Next