Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Pimp My Site! > Could use some help on my new "gem finder" code.
Jizmak-Rebirth (New Admin) 8/8/2008 1:35 AM EST : Add a gem finder to your page Alpha Version 1
Jizmak-Rebirth
Posts: 1157
Zomgawsh Poster

Gang,

This is my next project... Although i'm having a bit of problem with this one.  The script below generates a list of gems.  I have broken down the code to make it give me what I'm looking for.  The major issue is I can't find a way to dynamically change and update the script unless i use the () method, which in turn clears the page but does supply me with my results.

<script type="text/javascript" src="http://www.wowgemfinder.com/cut_gems/widget_list/matches-blue-socket matches-red-socket agility?width=MY_WIDTH&height=MY_HEIGHT"></script>

I have tried using the dom to create a new script each time i send results to it... but nothing shows up, I'm not sure if this is a limitation of guild portal or becasue I'm trying to access it across domain?

Any help out there would be appreciated.

<script>
function loadgem(){
var oBody = document.getElementsByTagName('body').item(0);
var oScript= document.createElement("script");
oScript.type = "text/javascript";
oScript.src="http://www.wowgemfinder.com/cut_gems/widget_list/matches-blue-socket matches-red-socket agility?width=150&height=350";
oBody.appendChild( oScript);
}
</script>

TopBottom

Mottie (MVP) 8/8/2008 3:56 AM EST : RE: Could use some help on my new "gem finder" code.
GuildPortal MVP
Mottie
Posts: 3883
Zomgawsh Poster

Hiya... this will be a nice addition!

Try using a <div> instead of the <body>, that way you're changing the contents of the <div> without reloading the page.

I also took out the "item(0)" because it didn't make a difference

*Note: The <div> needs to be BEFORE the script, or it won't be able to identify it*
<div id="gems"></div>
<script>
function loadgem() {
 var oBody = document.getElementById("gems");
 var oScript = document.createElement("script");
 oScript.type = "text/javascript";
 oScript.src = "http://www.wowgemfinder.com/cut_gems/widget_list/matches-blue-socket matches-red-socket agility?width=150&height=350";
 oBody.appendChild(oScript);
}
</script>

TopBottom

Jizmak-Rebirth (New Admin) 8/8/2008 4:11 AM EST : RE: Could use some help on my new "gem finder" code.
Jizmak-Rebirth
Posts: 1157
Zomgawsh Poster

I think i'm going to go to the option of using an Iframe and then use the iframe.() method to push the script to the iframe upon reload.  I have that model working. 

I tried the code above, but it still does nothing. Its like it doesn't call it once its changed.
TopBottom

Jizmak-Rebirth (New Admin) 8/8/2008 8:06 AM EST : RE: Could use some help on my new "gem finder" code.
Jizmak-Rebirth
Posts: 1157
Zomgawsh Poster

OK.. Here is my changes... This will work 2 ways, and in the Alpha phase here this only seperates blue, red, and yellow gems.  Check it out and please leave some feedback.

Does this work better with the Iframe or the Popout?

<select id=color name=color> <option value=matches-blue-socket selected>Blue</option> <option value=matches-red-socket>Red</option> <option value=matches-yellow-socket>Yellow</option></select> <a onclick="getgem(); return false;" href="">-=Pop Out=- </a><a onclick="getgem2(); return false;" href="">-=Iframe=- </a><br><iframe id=gemframe name=gemframe src="about:blank" width=175 height=340 allowTransparency></iframe>
<div id=gems></div>
<script type=text/javascript>
hold=0
hold2=0
hold3=0
if(navigator.appName == "Microsoft Internet Explorer"){
hold3 = 1
}


function getgem(){
if(hold==0){
hold=1;
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + "?width=150&height=300'><\/script>";
ExforsysWindow=window.open('','','width=175,height=330');
ExforsysWindow.document.open
ExforsysWindow.(gemurl);
if(hold3==0){
ExforsysWindow.document.close()
}
}else{
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + "?width=150&height=300'><\/script>";
ExforsysWindow.document.location.href="about:blank";
ExforsysWindow.document.open
ExforsysWindow.(gemurl);
if(hold3==0){
ExforsysWindow.document.close()
}
}
}

function getgem2(){
if(hold2==0){
hold2=1
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + "?width=150&height=300'><\/script>";
gemframe.document.open()
gemframe.(gemurl);
if(hold3==0){
gemframe.document.close()
}
}else{
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + "?width=150&height=300'><\/script>";
gemframe.document.open()
gemframe.(gemurl);
if(hold3==0){
gemframe.document.close()
}
}
}
</script>

Steps to inserting code...

1. Create new page with a single free/HTML form.
2. Go to page and edit.
3. Click <> for code
4. Copy and paste the code above.

TopBottom

Jizmak-Rebirth (New Admin) 8/8/2008 10:06 AM EST : RE: Could use some help on my new "gem finder" code.
Jizmak-Rebirth
Posts: 1157
Zomgawsh Poster

Ok.. This is my latest code.. it will allow color selection and 2 different attributes.  I have fixed the transparency issues in both FF & IE.  Enjoy....

<select id=color name=color> <option selected>All</option> <option value=matches-blue-socket>Blue</option> <option value=matches-red-socket>Red</option> <option value=matches-yellow-socket>Yellow</option> <option value=matches-meta-socket>Meta</option></select> <select id=extra name=extra> <option value="" selected>None</option> <option value=" agility">Agility</option> <option value=" attack-power">Attack Power</option> <option value=" chance-to-increase-attack-speed">Attack Speed</option> <option value=" chance-to-stun">Stun Target</option> <option value=" chance-restore-health">Restore Health</option> <option value=" chance-restore-mana">Restore Mana</option> <option value=" crit-damage">Critical Damage</option> <option value=" crit-rating">Critical Rating</option> <option value=" dodge-rating">Dodge Rating</option> <option value=" healing">Healing</option> <option value=" hit-rating">Hit Rating</option> <option value=" intellect">Intellect</option> <option value=" mana-regen">Mana Regeneration</option> <option value=" melee-damage">Melee Damage</option> <option value=" parry-rating">Parry Rating</option> <option value=" reduced-spellcast-time">Reduced Spellcast Time</option> <option value=" reduced-threat">Reduced Threat</option> <option value=" resilience">Resilience</option> <option value=" resist-all">Resist All</option> <option value=" run-speed">Run Speed</option> <option value=" shield-block-value">Shield Block Value</option> <option value=" spell-crit-rating">Spell Critical Rating</option> <option value=" spell-damage">Spell Damage</option> <option value=" spell-haste-rating">Spell Haste</option> <option value=" spell-hit-rating">Spell Hit Rating</option> <option value=" spell-penetration">Spell Penetration</option> <option value=" spell-reflect">Spell Reflect</option> <option value=" spirit">Spirit</option> <option value=" stamina">Stamina</option> <option value=" strength">Strength</option> <option value=" stun-resist">Stun Resist</option></select><select id=extra1 name=extra1> <option value="" selected>None</option> <option value=" agility">Agility</option> <option value=" attack-power">Attack Power</option> <option value=" chance-to-increase-attack-speed">Attack Speed</option> <option value=" chance-to-stun">Stun Target</option> <option value=" chance-restore-health">Restore Health</option> <option value=" chance-restore-mana">Restore Mana</option> <option value=" crit-damage">Critical Damage</option> <option value=" crit-rating">Critical Rating</option> <option value=" dodge-rating">Dodge Rating</option> <option value=" healing">Healing</option> <option value=" hit-rating">Hit Rating</option> <option value=" intellect">Intellect</option> <option value=" mana-regen">Mana Regeneration</option> <option value=" melee-damage">Melee Damage</option> <option value=" parry-rating">Parry Rating</option> <option value=" reduced-spellcast-time">Reduced Spellcast Time</option> <option value=" reduced-threat">Reduced Threat</option> <option value=" resilience">Resilience</option> <option value=" resist-all">Resist All</option> <option value=" run-speed">Run Speed</option> <option value=" shield-block-value">Shield Block Value</option> <option value=" spell-crit-rating">Spell Critical Rating</option> <option value=" spell-damage">Spell Damage</option> <option value=" spell-haste-rating">Spell Haste</option> <option value=" spell-hit-rating">Spell Hit Rating</option> <option value=" spell-penetration">Spell Penetration</option> <option value=" spell-reflect">Spell Reflect</option> <option value=" spirit">Spirit</option> <option value=" stamina">Stamina</option> <option value=" strength">Strength</option> <option value=" stun-resist">Stun Resist</option></select> <br><a onclick="getgem(); return false;" href="">-=Fetch &amp; Pop Out=- </a><a onclick="getgem2(); return false;" href="">-=Fetch=- </a><br><iframe id=gemframe name=gemframe frameBorder=0 width=250 height=0 allowTransparency></iframe>
<script type=text/javascript>
hold=0
hold2=0
hold3=0
if(navigator.appName == "Microsoft Internet Explorer"){
hold3 = 1
}


function getgem(){
if(hold==0){
hold=1;
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + parent.document.getElementById("extra").value + parent.document.getElementById("extra1").value + "?width=225&height=300'><\/script>";
ExforsysWindow=window.open('','','width=250,height=330');
ExforsysWindow.document.open
ExforsysWindow.(gemurl);
if(hold3==0){
ExforsysWindow.document.close()
}
}else{
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + parent.document.getElementById("extra").value + parent.document.getElementById("extra1").value + "?width=225&height=300'><\/script>";
ExforsysWindow.document.location.href="about:blank";
ExforsysWindow.document.open
ExforsysWindow.(gemurl);
if(hold3==0){
ExforsysWindow.document.close()
}
}
}

function getgem2(){
document.getElementById("gemframe").height = 340;
if(hold2==0){
hold2=1
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + parent.document.getElementById("extra").value + parent.document.getElementById("extra1").value + "?width=225&height=300'><\/script>";
gemframe.document.open()
if(hold3==1){
gemframe.('<body bgcolor="transparent">')
}
gemframe.(gemurl);
if(hold3==0){
gemframe.document.close()
}
}else{
gemurl = "<script type='text/javascript' src='http://www.wowgemfinder.com/cut_gems/widget_list/" + parent.document.getElementById("color").value + parent.document.getElementById("extra").value + parent.document.getElementById("extra1").value + "?width=225&height=300'><\/script>";
gemframe.document.open()
if(hold3==1){
gemframe.('<body bgcolor="transparent">')
}
gemframe.(gemurl);
if(hold3==0){
gemframe.document.close()
}
}
}
function gemcolor(){
}
</script>
</option></select>

TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%