5 Replies - 355 Views - Last Post: 27 August 2013 - 11:49 AM

#1 thedrooling  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-August 13

Importing tooltips from another website

Posted 27 August 2013 - 11:33 AM

Hey everyone,

So I have very little experience working with Java so this have been a bit of a headache for me. I think I'm getting close to solving the problem I'm having, but I just haven't been able to figure it out yet.

Basically what I'm trying to do is create tooltips for the items seen here on the League of Legends website -

http://gameinfo.na.l...ame-info/items/

I'd like it so that if someone writes one of the item names it creates the image and then also the tooltip hover.

Here is where I have been messing around with the code -

http://www.leaguegee...uetipstest.html


$(document).ready(function(){
	var lolitems = '';

	$.get("http://na.leagueoflegends.com/items", function(r){
		lolitems = $(r).find(".item_detail_tooltip");
	});

	var itemtooltip = $("<div class='itemtooltip'><div class='itemtipbody' style='position:relative; min-width:400px; max-width:500px;'></div></div>")
		.appendTo(document.body)
		.css({
			zIndex: 100,
			position: "absolute",
			background: "#111",
			padding:12,
			border:"4px solid #DAA520"
		})
	;

	itemtooltip
		.hide()
		.bind('mouseleave', function(){
			//itemtooltip.fadeOut(200);
		})
        ;


	var openItem = function(link){
		var item = lolitems.filter(":contains('"+ link.rel +"')");
		var itemhtml = item.length > 0 ? item.html() : "<h1 class='item_detail_name'>No item found (check for upper case names)</h1>";
		var $link = $(link);
		itemtooltip.find('.itemtipbody').html(itemhtml);
		itemtooltip
		.stop(true, true)
		.css({
			top: $link.offset().top + 20,
			left: $link.offset().left + 5
		})
		;
          
		if( $(window).width() < $link.offset().left + itemtooltip.outerWidth() ){
			itemtooltip.css({
				left: ($link.offset().left + $link.width()) - itemtooltip.outerWidth()
			});
		}
		itemtooltip.fadeIn(200);
	};

	$(".lol_itemlink")
		.live("click", function(){
			openItem(this);
			return false;
		})
	;

	$('<link href="http://na.leagueoflegends.com/sites/all/themes/community_v2/css/items.css" rel="stylesheet" type="text/css" />').appendTo('head');
});


As you can see there is some javascript there, and from what I understand it should be getting info from the League of Legends page, but it isn't working for some reason.

I've done a few google searches and I've tried to emulate other tooltip codes from other game sites that have it fully implemented (such as WoWHead) but have had no luck.

Any help would be greatly appreciated!!!

(PS im eventually looking to embed the feature as a vBulletin bbcode as well so it would be something along the lines of [item]Itemnamehere[/item] to show as well.)

Is This A Good Question/Topic? 0
  • +

Replies To: Importing tooltips from another website

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8364
  • View blog
  • Posts: 31,073
  • Joined: 12-June 08

Re: Importing tooltips from another website

Posted 27 August 2013 - 11:36 AM

So.. this is javascript and not java? Moving..
Was This Post Helpful? 0
  • +
  • -

#3 thedrooling  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-August 13

Re: Importing tooltips from another website

Posted 27 August 2013 - 11:38 AM

View Postmodi123_1, on 27 August 2013 - 11:36 AM, said:

So.. this is javascript and not java? Moving..

Woops! Sorry about that. tHanks!
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8364
  • View blog
  • Posts: 31,073
  • Joined: 12-June 08

Re: Importing tooltips from another website

Posted 27 August 2013 - 11:42 AM

Hmmm.. so you are looking to directly scrape the information from this game's site?
Was This Post Helpful? 0
  • +
  • -

#5 thedrooling  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 27-August 13

Re: Importing tooltips from another website

Posted 27 August 2013 - 11:46 AM

View Postmodi123_1, on 27 August 2013 - 11:42 AM, said:

Hmmm.. so you are looking to directly scrape the information from this game's site?


I believe that would be our best bet as they are constantly updating their items. There are a few other sites that implement the same tooltip idea, and I tried to contact them to ask for their code, but they don't want to share it (which is understandable)

Heres a few other examples of sites that do what I'm looking to create.

http://www.probuilds.net/

http://www.lolpro.co...-duo-bot-by-cop
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8364
  • View blog
  • Posts: 31,073
  • Joined: 12-June 08

Re: Importing tooltips from another website

Posted 27 August 2013 - 11:49 AM

Hmm. This game's rules indicate scraping of data is not condoned by them. This means we cannot help you in violating their terms of use and would ask you do not persist in asking foll up questions that would do so. If you have questions on the 'why' of this closing shoot me a PM. In the meantime I will be closing this thread.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1