summaryrefslogtreecommitdiff
path: root/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm')
-rw-r--r--lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm78
1 files changed, 74 insertions, 4 deletions
diff --git a/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm b/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm
index bec266f..e81d116 100644
--- a/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm
+++ b/lib/gcstar/GCPlugins/GCgames/GCJeuxVideoFr.pm
@@ -2,7 +2,7 @@ package GCPlugins::GCgames::GCJeuxVideoFr;
###################################################
#
-# Copyright 2005-2011 Tian
+# Copyright 2005-2014 Tian
#
# This file is part of GCstar.
#
@@ -69,6 +69,18 @@ use GCPlugins::GCgames::GCgamesCommon;
}
elsif ($self->{parsingTips})
{
+ if ($tagname eq 'tpfdebuttpf')
+ {
+ $self->{isTip} = 1;
+ }
+ elsif (($tagname eq 'p') && ($self->{isTip} ne 0 ))
+ {
+ $self->{isTip} = 2;
+ }
+ elsif ($tagname eq 'tpffintpf')
+ {
+ $self->{isTip} = 0;
+ }
}
else
{
@@ -235,6 +247,26 @@ use GCPlugins::GCgames::GCgamesCommon;
}
elsif ($self->{parsingTips})
{
+ # Enleve les blancs en debut de chaine
+ $origtext =~ s/^\s+//;
+ # Enleve les blancs en fin de chaine
+ $origtext =~ s/\s+$//;
+ if ($self->{isTip} eq 2)
+ {
+ chomp($origtext);
+ $self->{curInfo}->{secrets} .= "\n" if $self->{curInfo}->{secrets};
+ $self->{curInfo}->{secrets} .= $origtext;
+ $self->{isTip} = 1;
+ }
+ elsif ($self->{isTip} eq 1)
+ {
+ chomp($origtext);
+ if ( ($self->{curInfo}->{secrets}) && ($origtext ne "") )
+ {
+ $self->{curInfo}->{secrets} .= ""
+ }
+ $self->{curInfo}->{secrets} .= $origtext;
+ }
}
else
{
@@ -358,6 +390,8 @@ use GCPlugins::GCgames::GCgamesCommon;
}
elsif ($self->{parsingTips})
{
+ $html =~ s|<option value="(.+)">|$self->RecupSolution($1)|e;
+ $html =~ s|<br />|<p>|gi;
}
else
{
@@ -369,6 +403,41 @@ use GCPlugins::GCgames::GCgamesCommon;
return $html;
}
+ sub RecupSolution
+ {
+ my ($self, $url) = @_;
+
+ my $html = $self->loadPage('http://www.jeuxvideo.fr'.$url);
+ my $savenexturl = '';
+
+ my $found = index($html,"<a class=\"pull-right\" href=\"");
+ if ( $found >= 0 )
+ {
+ $savenexturl = substr($html, $found +length('<a class="pull-right" href="'),length($html)- $found -length('<a class="pull-right" href="'));
+ $savenexturl = substr($savenexturl, 0, index($savenexturl, "\""));
+ }
+
+ $found = index($html,"<ul class=\"walkthrough-breadcrumb\">");
+ if ( $found >= 0 )
+ {
+ $html = substr($html, $found +length('<ul class="walkthrough-breadcrumb">'),length($html)- $found -length('<ul class="walkthrough-breadcrumb">'));
+ $html = substr($html, 0, index($html, "<div class=\"select-toc pull-right\">"));
+ if ( $savenexturl ne "" )
+ {
+ $html .= $self->RecupSolution($savenexturl);
+ }
+ }
+ else
+ {
+ $html = '';
+ if ( $savenexturl ne "" )
+ {
+ $html .= $self->RecupSolution($savenexturl);
+ }
+ }
+ return "<tpfdebuttpf>" . $html . "<tpffintpf>";
+ }
+
sub getSearchUrl
{
my ($self, $word) = @_;
@@ -387,10 +456,11 @@ use GCPlugins::GCgames::GCgamesCommon;
$url = substr($url, 0,$found);
}
- $self->{url_screenshot} = 'http://www.jeuxvideo.fr' . $url . 'image-photo/';
- $self->{url_tips} = 'http://www.jeuxvideo.fr' . $url . 'astuce-code/';
+ $self->{url_screenshot} = $url . 'image-photo/';
+ $self->{url_tips} = $url . 'astuce-code/';
+ $self->{url_tips} = $url . 'soluce/';
- return 'http://www.jeuxvideo.fr' . $url;
+ return $url;
}
sub getName