-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathwindow.php
More file actions
executable file
·122 lines (103 loc) · 3.19 KB
/
window.php
File metadata and controls
executable file
·122 lines (103 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
echo file_get_contents($_GET['url']);
if(strpos($_GET['url'], "npc"))
$type = "npc";
else
$type = "object";
// extracting id of the NPC/GO
$Id = str_replace("http://www.wowhead.com/".$type."=", "", $_GET['url']);
$Id = str_replace("#starts", "", $Id);
//echo '<script>alert("'.$id.'");</script>';
?>
<style>/** { display: none; }*/</style>
<p id="text"></p>
<script>
// passing the NPC/GO ID an d type from PHP to javascript
var Id = '<?= $Id ?>', type = '<?= $type ?>';
// window.onload =
function load() {
if (type == "npc")
var Name = document.getElementsByTagName("title")[0].innerHTML.replace(" - NPC - World of Warcraft", "");
else
var Name = document.getElementsByTagName("title")[0].innerHTML.replace(" - Object - World of Warcraft", "");
// initialize variables
var a,ids = [],s, starts = false, ends = false;
ids[0] = "";
ids[1] = "";
ids[2] = Id;
// Insert into element "#text" the HTML inside the tab "starts"
for (var i = 0; i < tabsRelated.tabs.length; i++)
{
if (tabsRelated.tabs[i].id == "starts")
{
document.getElementById("text").innerHTML = tabsRelated.tabs[i].owner.currentTabContents.innerHTML;
starts = true;
break;
}
}
if (starts)
{
// select all element "a" (<a>) and extract the link href, removing "/quest=" to href, to obtain only the id of the quest
a = document.getElementById("text").getElementsByTagName("a");
for (var i = 0; i < a.length; i++)
{
s = a[i].getAttribute("href");
if (s != null)
{
if (s.indexOf("/quest=") > -1)
{
s = s.replace("http://www.wowhead.com/quest=", "");
s = s.replace("/quest=", "");
ids[0] += "\n(" + Id + ", " + s + "), -- " + Name + ", "+ a[i].innerHTML;
}
}
}
}
else
ids[0] = "empty";
// click to "ends" tab, to load all the quests ends
var a = document.getElementsByTagName("a");
for (var i = 0; i < a.length; i++)
{
if(a[i].getAttribute("href") == "#ends")
{
a[i].click();
break;
}
}
// Insert into element "#text" the HTML inside the tab "ends"
for (var i = 0; i < tabsRelated.tabs.length; i++)
{
if (tabsRelated.tabs[i].id == "ends")
{
document.getElementById("text").innerHTML = tabsRelated.tabs[i].owner.currentTabContents.innerHTML;
ends = true;
break;
}
}
if (ends)
{
// select all element "a" (<a>) and extract the link href, removing "/quest=" to href, to obtain only the id of the quest
a = document.getElementById("text").getElementsByTagName("a");
for (var i = 0; i < a.length; i++)
{
s = a[i].getAttribute("href");
if (s != null)
{
if (s.indexOf("/quest=") > -1)
{
s = s.replace("http://www.wowhead.com/quest=", "");
s = s.replace("/quest=", "");
ids[1] += "\n(" + Id + ", " + s + "), -- "+ Name + ", "+ a[i].innerHTML;;
}
}
}
}
else
ids[1] = "empty";
ids[3] = starts;
ids[4] = ends;
window.opener.genSql(ids);
}
load();
</script>