MediaWiki:Common.js
From Card Hunter Wiki
(Difference between revisions)
(GA tracking code (GA script was last change)) |
|||
(82 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
+ | |||
+ | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | ||
+ | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | ||
+ | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | ||
+ | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | ||
+ | |||
+ | ga('create', 'UA-146162733-1', 'auto'); | ||
+ | ga('send', 'pageview'); | ||
article = ""; | article = ""; | ||
var tooltipsOn = true; | var tooltipsOn = true; | ||
var $tfb; | var $tfb; | ||
+ | var $token; | ||
var activeHoverLink = null; | var activeHoverLink = null; | ||
var tipCache = new Object(); | var tipCache = new Object(); | ||
Line 10: | Line 19: | ||
function twoprocess(list){ | function twoprocess(list){ | ||
− | var chance2 = ['16.67%', '30.95%', '43.14%', '53.48%', '62.2%', '69.52%', '75.61%', '80.66%', '84.8%', '88.18%', '90.91%', '93.09%', '94.82%', '96.17%', '97.21%', '98.01%', '98.61%', '99.05%', '99.36%', '99.59%']; | + | var chance2 = ['16.67%', '30.95%', '43.14%', '53.48%', '62.2%', '69.52%', '75.61%', '80.66%', '84.8%', '88.18%', '90.91%', '93.09%', '94.82%', '96.17%', '97.21%', '98.01%', '98.61%', '99.05%', '99.36%', '99.59%', '99.74%', '99.85%', '99.91%', '99.95%', '99.98%', '99.99%', '100%', '100%', '100%', '100%']; |
var list2=list.clone(); | var list2=list.clone(); | ||
list2.find('li').each(function(){ | list2.find('li').each(function(){ | ||
Line 23: | Line 32: | ||
function process(list){ | function process(list){ | ||
− | var chance = ['11.11%', '21.27%', '30.53%', '38.95%', '46.58%', '53.48%', '59.68%', '65.24%', '70.21%', '74.62%', '78.52%', '81.96%', '84.97%', '87.58%', '89.84%', '91.77%', '93.42%', '94.81%', '95.96%', '96.91%']; | + | var chance = ['11.11%', '21.27%', '30.53%', '38.95%', '46.58%', '53.48%', '59.68%', '65.24%', '70.21%', '74.62%', '78.52%', '81.96%', '84.97%', '87.58%', '89.84%', '91.77%', '93.42%', '94.81%', '95.96%', '96.91%', '97.68%', '98.3%', '98.79%', '99.16%', '99.44%', '99.64%', '99.79%', '99.88%', '99.94%', '99.97%']; |
list.find('li').each(function(){ | list.find('li').each(function(){ | ||
var li = $('<li/>').attr('id', 'drawchance').css({'font-weight':'bold','color':'rgb(0,255,0)'}); | var li = $('<li/>').attr('id', 'drawchance').css({'font-weight':'bold','color':'rgb(0,255,0)'}); | ||
Line 205: | Line 214: | ||
$t.removeAttr("title"); | $t.removeAttr("title"); | ||
$p.removeAttr("title"); | $p.removeAttr("title"); | ||
− | var url=$p.attr("href")+" . | + | var url=$p.attr("href")+" .cardimage"; |
//var url="/wiki/Template:Spotlight .image"; //Remember: changing the image in the template will change the 'Coming Soon' image!!! | //var url="/wiki/Template:Spotlight .image"; //Remember: changing the image in the template will change the 'Coming Soon' image!!! | ||
if (tipCache[url] != null) { | if (tipCache[url] != null) { | ||
Line 250: | Line 259: | ||
$tfb = $("#tfb"); | $tfb = $("#tfb"); | ||
} | } | ||
− | $(article + " a[href*='wiki/Cards/']:not(:has(span.ajaxttlink))").each(addTT); | + | $(article + " a[href*='wiki/Cards/']:not(:has(span.ajaxttlink))" + " div:not(:has(span.fcimage))" ).each(addTT); |
$(article + " span.ajaxttlink:not(:has(span.disablett))").each(bindTT); | $(article + " span.ajaxttlink:not(:has(span.disablett))").each(bindTT); | ||
+ | } | ||
+ | |||
+ | function showImages() { | ||
+ | $(this).each(function(){ | ||
+ | if ($(this).val().indexOf("1 C")>0){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); | ||
+ | $('<img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val().indexOf("1 S")>0){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); | ||
+ | $('<img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val().indexOf("1 T")>0){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); | ||
+ | $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val().indexOf("1 P")>0){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); | ||
+ | $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="CC"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="SC"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="TC"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="PC"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="SS"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" /><img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="TS"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" /><img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="PS"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="TT"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" /><img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="PT"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="PP"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); | ||
+ | $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // show token images in Item Search Form radiobuttons | ||
+ | function showTokenImages() { | ||
+ | $(article + " #mw-content-text" + " table span.radioButtonSpan label.radioButtonItem input").each(showImages); | ||
+ | } | ||
+ | |||
+ | function showExpIcons() { | ||
+ | $(this).each(function(){ | ||
+ | if ($(this).val()=="Attack of the Artifacts"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | $('<img width="21" height="21" alt="AotA icon.png" src="/images/9/99/AotA_icon.png" />').insertBefore(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="Expedition to the Sky Citadel"){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | $('<img width="21" height="21" alt="EttSC icon.png" src="/images/6/6a/EttSC_icon.png" />').insertBefore(label_conts); | ||
+ | } | ||
+ | |||
+ | }); | ||
+ | } | ||
+ | |||
+ | // show expansion icons in Card Search Form radiobuttons | ||
+ | function showExpImages() { | ||
+ | $(article + " #mw-content-text" + " table span.radioButtonSpan label.radioButtonItem input").each(showExpIcons); | ||
+ | } | ||
+ | |||
+ | function showSmallIcons() { | ||
+ | $(this).each(function(){ | ||
+ | var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; | ||
+ | label_conts.nodeValue=label_conts.nodeValue.slice(0,-label_conts.length); | ||
+ | if ($(this).val()=="DwarfWarriorM07A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWarriorM07A_thumb.png" src="/images/3/39/DwarfWarriorM07A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWarriorM05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWarriorM05A_thumb.png" src="/images/1/11/DwarfWarriorM05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWarriorM04A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWarriorM04A_thumb.png" src="/images/4/45/ElfWarriorM04A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWarriorM06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWarriorM06A_thumb.png" src="/images/0/05/ElfWarriorM06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWarriorM04A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWarriorM04A_thumb.png" src="/images/e/e0/HumanWarriorM04A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWarriorM08A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWarriorM08A_thumb.png" src="/images/9/98/HumanWarriorM08A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWizardF05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWizardF05A_thumb.png" src="/images/b/b6/DwarfWizardF05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWizardM03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWizardM03A_thumb.png" src="/images/3/3c/DwarfWizardM03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWizardM06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWizardM06A_thumb.png" src="/images/1/1c/DwarfWizardM06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWizardF05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWizardF05A_thumb.png" src="/images/b/ba/ElfWizardF05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWizardF05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWizardF05A_thumb.png" src="/images/0/05/HumanWizardF05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWizardM06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt=HumanWizardM06A_thumb.png" src="/images/3/3a/HumanWizardM06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWizardM05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWizardM05A_thumb.png" src="/images/d/d8/HumanWizardM05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfPriestM04A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfPriestM04A_thumb.png" src="/images/5/58/ElfPriestM04A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfPriestF04A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfPriestF04A_thumb.png" src="/images/b/b5/ElfPriestF04A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanPriestF03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanPriestF03A_thumb.png" src="/images/9/91/HumanPriestF03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanPriestF06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanPriestF06A_thumb.png" src="/images/6/6f/HumanPriestF06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanPriestM06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanPriestM06A_thumb.png" src="/images/7/7b/HumanPriestM06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfPriestF03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfPriestF03A_thumb.png" src="/images/9/95/DwarfPriestF03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfPriestF03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfPriestF03A_thumb.png" src="/images/7/77/ElfPriestF03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanPriestM03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanPriestM03A_thumb.png" src="/images/5/55/HumanPriestM03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWarriorM03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWarriorM03A_thumb.png" src="/images/1/1c/DwarfWarriorM03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWarriorM03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWarriorM03A_thumb.png" src="/images/d/df/ElfWarriorM03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWarriorF03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWarriorF03A_thumb.png" src="/images/1/1b/HumanWarriorF03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWizardF03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWizardF03A_thumb.png" src="/images/0/08/ElfWizardF03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWizardM03A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWizardM03A_thumb.png" src="/images/8/88/HumanWizardM03A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfPriestM05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfPriestM05A_thumb.png" src="/images/8/8f/DwarfPriestM05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWarriorF04A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWarriorF04A_thumb.png" src="/images/e/e1/ElfWarriorF04A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfPriestM07A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfPriestM07A_thumb.png" src="/images/c/c0/DwarfPriestM07A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWarriorF05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWarriorF05A_thumb.png" src="/images/7/70/DwarfWarriorF05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWarriorF06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWarriorF06A_thumb.png" src="/images/7/75/DwarfWarriorF06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="DwarfWizardM07A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="DwarfWizardM07A_thumb.png" src="/images/8/85/DwarfWizardM07A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfPriestF06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfPriestF06A_thumb.png" src="/images/0/0a/ElfPriestF06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfPriestF07A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfPriestF07A_thumb.png" src="/images/b/b1/ElfPriestF07A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWarriorF05A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWarriorF05A_thumb.png" src="/images/4/4a/ElfWarriorF05A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="ElfWizardM06A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="ElfWizardM06A_thumb.png" src="/images/e/ed/ElfWizardM06A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanPriestF07A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanPriestF07A_thumb.png" src="/images/6/65/HumanPriestF07A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWarriorM09A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWarriorM09A_thumb.png" src="/images/a/a3/HumanWarriorM09A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWizardM07A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWizardM07A_thumb.png" src="/images/3/39/HumanWizardM07A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | if ($(this).val()=="HumanWizardM08A_thumb.png"){ | ||
+ | $('<img width="45" height="45" alt="HumanWizardM08A_thumb.png" src="/images/2/28/HumanWizardM08A_thumb.png" />').insertAfter(label_conts); | ||
+ | } | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | // show small portrait icons in test check boxes | ||
+ | function showSmallPortraits() { | ||
+ | $(article + " #mw-content-text" + " table span.checkboxesSpan label.checkboxLabel input").each(showSmallIcons); | ||
} | } | ||
Line 313: | Line 553: | ||
} else { | } else { | ||
$tfb.find(".keywordtt").css({"display": ""}); | $tfb.find(".keywordtt").css({"display": ""}); | ||
− | $tfb.css({"background-color":"rgb(0,21,27)","max-width":"15em","padding":"7px 15px","border-radius":"0.5em","font-weight":"bold","font-size":"85%","height":"auto","text-align":"justify"}); | + | $tfb.css({"background-color":"rgb(0,21,27)","max-width":"15em","padding":"7px 15px","border-radius":"0.5em","font-weight":"bold","font-size":"85%","height":"auto","text-align":"justify","border":"1px solid rgb(0,80,104)"}); |
tipCache[url] = $tfb.html(); | tipCache[url] = $tfb.html(); | ||
} | } | ||
Line 355: | Line 595: | ||
$(article + " #builddeck" + " table.smwtable").each(binddeck); | $(article + " #builddeck" + " table.smwtable").each(binddeck); | ||
− | |||
var headerstr=$("#firstHeading").html(); | var headerstr=$("#firstHeading").html(); | ||
/*js to remove ugly header in Main page.*/ | /*js to remove ugly header in Main page.*/ | ||
Line 363: | Line 602: | ||
if ((headerstr.indexOf("Cards/")>0) || (headerstr.indexOf("Items/")>0)){ | if ((headerstr.indexOf("Cards/")>0) || (headerstr.indexOf("Items/")>0)){ | ||
modifyHeader(); | modifyHeader(); | ||
+ | Initkeywordtips(); | ||
+ | } | ||
+ | else if (headerstr.indexOf("Item Search Form")>0) { | ||
+ | showTokenImages(); | ||
+ | showExpImages(); | ||
} | } | ||
− | else if (headerstr.indexOf(" | + | else if (headerstr.indexOf("Card Search Form")>0) showExpImages(); |
+ | else if (headerstr.indexOf("My Collection")>0) showSmallPortraits(); | ||
else if (tooltipsOn) Inittooltips(); | else if (tooltipsOn) Inittooltips(); | ||
}); | }); |
Latest revision as of 00:30, 21 August 2019
/* Any JavaScript here will be loaded for all users on every page load. */ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-146162733-1', 'auto'); ga('send', 'pageview'); article = ""; var tooltipsOn = true; var $tfb; var $token; var activeHoverLink = null; var tipCache = new Object(); var LOADING = '<div class="tooltip-loader" style="visibility: visible;">Loading...</div>'; var LOADERROR = '<div class="tooltip-loader"><b>Error</b><br />This target either has no tooltip or was not intended to have one.</div>'; function twoprocess(list){ var chance2 = ['16.67%', '30.95%', '43.14%', '53.48%', '62.2%', '69.52%', '75.61%', '80.66%', '84.8%', '88.18%', '90.91%', '93.09%', '94.82%', '96.17%', '97.21%', '98.01%', '98.61%', '99.05%', '99.36%', '99.59%', '99.74%', '99.85%', '99.91%', '99.95%', '99.98%', '99.99%', '100%', '100%', '100%', '100%']; var list2=list.clone(); list2.find('li').each(function(){ var li2 = $('<li/>').attr('id', 'drawchance').css({'font-weight':'bold','color':'rgb(255,213,23)'}); var count2 = parseInt($(this).find('#cardtypenum').text()); li2.text(chance2[count2-1]); $(this).find('#cardtypenum').remove(); $(this).after(li2); }); return list2; } function process(list){ var chance = ['11.11%', '21.27%', '30.53%', '38.95%', '46.58%', '53.48%', '59.68%', '65.24%', '70.21%', '74.62%', '78.52%', '81.96%', '84.97%', '87.58%', '89.84%', '91.77%', '93.42%', '94.81%', '95.96%', '96.91%', '97.68%', '98.3%', '98.79%', '99.16%', '99.44%', '99.64%', '99.79%', '99.88%', '99.94%', '99.97%']; list.find('li').each(function(){ var li = $('<li/>').attr('id', 'drawchance').css({'font-weight':'bold','color':'rgb(0,255,0)'}); var count = parseInt($(this).find('#cardtypenum').text()); li.text(chance[count-1]); $(this).find('#cardtypenum').remove(); $(this).after(li); }); } function finalDeck(Inlist){ var cardtypes = ['Armor\n', 'Assist\n', 'Attack\n', 'Block\n', 'Boost\n', 'Handicap\n', 'Movement\n', 'Utility\n', 'Hybrid\n', 'No card type\n']; var flist = $("<ul/>") $.each(cardtypes, function(i){ var li = $('<li/>') .attr('id', 'ctypeheader') .css('font-weight','bold') .text(cardtypes[i]) .appendTo(flist); }); Inlist.find('li').each(function(){ for (var m=0;m<flist.find('li#ctypeheader').length;m++){ if ($(this).find('span#ctype').text()==flist.find('li#ctypeheader').eq(m).text()){ $(this).find('span#ctype').remove(); var entry=$(this); flist.find('li#ctypeheader').eq(m).after(entry); } } }); var statlist=$("<ul/>").attr('id','stats'); flist.find('li#ctypeheader').each(function(){ var sum=0; var statli=$("<li/>").attr('id','cardtype'); var statspan=$("<span/>").attr('id','cardtypenum'); if ($(this).next().is('li#ctypeheader')||($(this).next().length==0)) $(this).hide(); else{ $(this).nextUntil('li#ctypeheader').each(function(){ sum+=parseInt($(this).find('span#cqty').text()); }); statli.text($(this).text()).append(statspan.text(sum)); statli.appendTo(statlist); } }); var chancetwo=twoprocess(statlist); process(statlist); var tablelength=Math.ceil((flist.find('li').length)/3); var onelist = $("<ul/>").attr('id','chdeck').append(flist.find('li').slice(0, tablelength)); var twolist = $("<ul/>").attr('id','chdeck').append(flist.find('li').slice(0, tablelength)); var threelist = $("<ul/>").attr('id','chdeck').append(flist.find('li').slice(0, tablelength)); var statlistlength=Math.ceil((statlist.find('li#cardtype').length)); if (statlistlength % 2 != 0 ) statlistlength+=1; var fourlist = $("<ul/>").attr('id','chdeck').append(statlist.find('li').slice(0, statlistlength)); var fivelist = $("<ul/>").attr('id','chdeck').append(statlist.find('li').slice(0, statlistlength)); var sixlist = $("<ul/>").attr('id','chdeck').append(chancetwo.find('li').slice(0, statlistlength)); var sevenlist = $("<ul/>").attr('id','chdeck').append(chancetwo.find('li').slice(0, statlistlength)); if (onelist.find('li').last().is('li#ctypeheader')) { var crossover=onelist.find('li').last(); onelist.find('li').last().remove(); twolist.prepend(crossover); crossover=twolist.find('li').last(); twolist.find('li').last().remove(); threelist.prepend(crossover); } if (twolist.find('li').last().is('li#ctypeheader')) { var crossover=twolist.find('li').last(); twolist.find('li').last().remove(); threelist.prepend(crossover); } var deck = $("<table/>").attr('id','decklist').addClass('chtable_r'); deck.each(function(){ $(this).append('<tbody><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></tbody>'); $(this).find('td:eq(0)').text("Deck List").css({'text-align':'left','padding-left':'20px','font-weight':'bold','font-size':'125%'}).attr('colspan','3'); $(this).find('td:eq(1)').text("Opening hand, at least 1").css({'text-align':'left','padding-left':'20px','font-weight':'bold'}).attr('colspan','2'); $(this).find('td:eq(2)').text("Second turn, at least 1").css({'text-align':'left','padding-left':'20px','font-weight':'bold'}).attr('colspan','2'); $(this).find('td:eq(3)').html(onelist).css('vertical-align','top'); $(this).find('td:eq(4)').html(twolist).css('vertical-align','top'); $(this).find('td:eq(5)').html(threelist).css('vertical-align','top'); $(this).find('td:eq(6)').html(fourlist).css('vertical-align','top'); $(this).find('td:eq(7)').html(fivelist).css('vertical-align','top'); $(this).find('td:eq(8)').html(sixlist).css('vertical-align','top'); $(this).find('td:eq(9)').html(sevenlist).css('vertical-align','top'); }); return deck; } // takes a character build and consolidate all its cards into a deck list function binddeck(){ $(this).each(function () { var list = $("<ul/>"); var typelist = $("<ul/>").attr('id','chtypes'); var rowCount=$(this).find('tr').length; var colCount=12; $(this).find('tr').each(function() { $(this).find('td').each (function() { if ($(this).children().is('a')) { var valThis = $(this).text(); var valThiscount = parseInt($(this).prev().text()); var myRow = $(this).closest('tr').index(); for (var i = myRow+1; i < rowCount; i++) { for (var j = 0; j < colCount; j++) { var listSel = $(this).closest('table').find('tr').eq(i).find('td').eq(j); if ($(listSel).children().is('a')){ var listVal = $(listSel).text(); if (listVal === valThis){ var listValCount = parseInt($(listSel).prev().text()); valThiscount+=listValCount; $(listSel).html(""); } } } } var p = $(this).map(function () { if ($(this).html()!=null){ var thiscolCount = $(this).closest('tr').find('td').length; for (var y = 12; y < thiscolCount; y+=2) { var ctype = $(this).closest('tr').find('td').eq(y); if (ctype.text()===$(this).text()){ var type=$("<span/>").attr('id','ctype'); if (ctype.next().text().trim()!=""){ type.text(ctype.next().text()); } else { type.text("No card type\n"); } } } $(this).append(type); var cqty=$("<span/>").attr('id','cqty').text(valThiscount+" "); $(this).prepend(cqty); return "<li>" + $(this).html() + "</li>"; } }); $(this).html(""); list.append($.makeArray(p).join("")); } }); }); $(this).parent().replaceWith(finalDeck(list)); }); } // hides the tooltip function hideTip() { $tfb.html("").removeClass("tooltip-ready").addClass("hidden").css("visibility","hidden"); activeHoverLink = null; } // displays the tooltip function displayTip(e) { $tfb.not(":empty").removeClass("hidden").addClass("tooltip-ready"); moveTip(e); $tfb.not(":empty").css("visibility","visible"); moveTip(e); } // moves the tooltip function moveTip(e) { $ct = $tfb.not(":empty"); var newTop = e.clientY + ((e.clientY > ($(window).height()/2)) ? -($ct.innerHeight()+20):20); var newLeft = e.clientX + ((e.clientX > ($(window).width()/2)) ? -($ct.innerWidth()+20):20); $ct.css({"position":"fixed","top":newTop + "px","left":newLeft + "px"}); } //This function removes a cached "Loading" entry. function clearCache(url) { if (tipCache[url] != null) { //Cache is not empty, let's see if we are still loading. if (tipCache[url].indexOf("Loading") != -1) { tipCache[url] = null; } } } // AJAX tooltips function showTip(e) { var $t=$(this); activeHoverLink = $t; $p=$t.parent(); if ($p.hasClass("selflink")==false) { $t.removeAttr("title"); $p.removeAttr("title"); var url=$p.attr("href")+" .cardimage"; //var url="/wiki/Template:Spotlight .image"; //Remember: changing the image in the template will change the 'Coming Soon' image!!! if (tipCache[url] != null) { $tfb.html(tipCache[url]); displayTip(e); }else { $tfb.html(LOADING); //We put the "Loading..." into the cache, to avoid multiple fetchings tipCache[url] = $tfb.html(); $tfb.load(url, function(responseText, textStatus, XMLHttpRequest) { if (textStatus == "timeout") { //Fetching has timed out, so we remove the cached "Loading..." entry (hence enable another try) clearCache(url); } else if ($tfb.html() == "" || textStatus != "success") { $tfb.html('<div class="tooltip-content"><b>Error</b><br />This target either has no tooltip<br />or was not intended to have one.</div>'); } else { $tfb.find(".image").css("display", ""); tipCache[url] = $tfb.html(); } if ($t == activeHoverLink) { $tfb.html(tipCache[url]); displayTip(e); } }); } } } function bindTT() { $t=$(this); $p=$t.parent(); if ($p.hasClass("selflink") == false) { $t.data("tt", $p.attr("title")).hover(showTip,hideTip).mousemove(moveTip); } } function addTT() { $(this).wrapInner('<span class="ajaxttlink" />'); } function Inittooltips() { if ($tfb == null) { $(article).append('<div id="tfb" class="htt"></div><div id="templatetfb" class="htt"></div>'); $tfb = $("#tfb"); } $(article + " a[href*='wiki/Cards/']:not(:has(span.ajaxttlink))" + " div:not(:has(span.fcimage))" ).each(addTT); $(article + " span.ajaxttlink:not(:has(span.disablett))").each(bindTT); } function showImages() { $(this).each(function(){ if ($(this).val().indexOf("1 C")>0){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); $('<img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); } if ($(this).val().indexOf("1 S")>0){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); $('<img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); } if ($(this).val().indexOf("1 T")>0){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" />').insertAfter(label_conts); } if ($(this).val().indexOf("1 P")>0){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-1); $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="CC"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="SC"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="TC"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="PC"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentNormalFlat.png" src="/images/f/fb/TalentNormalFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="SS"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" /><img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="TS"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" /><img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="PS"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentBronzeFlat.png" src="/images/9/9c/TalentBronzeFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="TT"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" /><img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="PT"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentSilverFlat.png" src="/images/2/2c/TalentSilverFlat.png" />').insertAfter(label_conts); } if ($(this).val()=="PP"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-2); $('<img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" /><img width="21" height="21" alt="TalentGoldFlat.png" src="/images/4/4f/TalentGoldFlat.png" />').insertAfter(label_conts); } }); } // show token images in Item Search Form radiobuttons function showTokenImages() { $(article + " #mw-content-text" + " table span.radioButtonSpan label.radioButtonItem input").each(showImages); } function showExpIcons() { $(this).each(function(){ if ($(this).val()=="Attack of the Artifacts"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; $('<img width="21" height="21" alt="AotA icon.png" src="/images/9/99/AotA_icon.png" />').insertBefore(label_conts); } if ($(this).val()=="Expedition to the Sky Citadel"){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; $('<img width="21" height="21" alt="EttSC icon.png" src="/images/6/6a/EttSC_icon.png" />').insertBefore(label_conts); } }); } // show expansion icons in Card Search Form radiobuttons function showExpImages() { $(article + " #mw-content-text" + " table span.radioButtonSpan label.radioButtonItem input").each(showExpIcons); } function showSmallIcons() { $(this).each(function(){ var label_conts=$(this).parent().contents()[$(this).parent().contents().length-1]; label_conts.nodeValue=label_conts.nodeValue.slice(0,-label_conts.length); if ($(this).val()=="DwarfWarriorM07A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWarriorM07A_thumb.png" src="/images/3/39/DwarfWarriorM07A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWarriorM05A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWarriorM05A_thumb.png" src="/images/1/11/DwarfWarriorM05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWarriorM04A_thumb.png"){ $('<img width="45" height="45" alt="ElfWarriorM04A_thumb.png" src="/images/4/45/ElfWarriorM04A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWarriorM06A_thumb.png"){ $('<img width="45" height="45" alt="ElfWarriorM06A_thumb.png" src="/images/0/05/ElfWarriorM06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWarriorM04A_thumb.png"){ $('<img width="45" height="45" alt="HumanWarriorM04A_thumb.png" src="/images/e/e0/HumanWarriorM04A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWarriorM08A_thumb.png"){ $('<img width="45" height="45" alt="HumanWarriorM08A_thumb.png" src="/images/9/98/HumanWarriorM08A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWizardF05A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWizardF05A_thumb.png" src="/images/b/b6/DwarfWizardF05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWizardM03A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWizardM03A_thumb.png" src="/images/3/3c/DwarfWizardM03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWizardM06A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWizardM06A_thumb.png" src="/images/1/1c/DwarfWizardM06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWizardF05A_thumb.png"){ $('<img width="45" height="45" alt="ElfWizardF05A_thumb.png" src="/images/b/ba/ElfWizardF05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWizardF05A_thumb.png"){ $('<img width="45" height="45" alt="HumanWizardF05A_thumb.png" src="/images/0/05/HumanWizardF05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWizardM06A_thumb.png"){ $('<img width="45" height="45" alt=HumanWizardM06A_thumb.png" src="/images/3/3a/HumanWizardM06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWizardM05A_thumb.png"){ $('<img width="45" height="45" alt="HumanWizardM05A_thumb.png" src="/images/d/d8/HumanWizardM05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfPriestM04A_thumb.png"){ $('<img width="45" height="45" alt="ElfPriestM04A_thumb.png" src="/images/5/58/ElfPriestM04A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfPriestF04A_thumb.png"){ $('<img width="45" height="45" alt="ElfPriestF04A_thumb.png" src="/images/b/b5/ElfPriestF04A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanPriestF03A_thumb.png"){ $('<img width="45" height="45" alt="HumanPriestF03A_thumb.png" src="/images/9/91/HumanPriestF03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanPriestF06A_thumb.png"){ $('<img width="45" height="45" alt="HumanPriestF06A_thumb.png" src="/images/6/6f/HumanPriestF06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanPriestM06A_thumb.png"){ $('<img width="45" height="45" alt="HumanPriestM06A_thumb.png" src="/images/7/7b/HumanPriestM06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfPriestF03A_thumb.png"){ $('<img width="45" height="45" alt="DwarfPriestF03A_thumb.png" src="/images/9/95/DwarfPriestF03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfPriestF03A_thumb.png"){ $('<img width="45" height="45" alt="ElfPriestF03A_thumb.png" src="/images/7/77/ElfPriestF03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanPriestM03A_thumb.png"){ $('<img width="45" height="45" alt="HumanPriestM03A_thumb.png" src="/images/5/55/HumanPriestM03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWarriorM03A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWarriorM03A_thumb.png" src="/images/1/1c/DwarfWarriorM03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWarriorM03A_thumb.png"){ $('<img width="45" height="45" alt="ElfWarriorM03A_thumb.png" src="/images/d/df/ElfWarriorM03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWarriorF03A_thumb.png"){ $('<img width="45" height="45" alt="HumanWarriorF03A_thumb.png" src="/images/1/1b/HumanWarriorF03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWizardF03A_thumb.png"){ $('<img width="45" height="45" alt="ElfWizardF03A_thumb.png" src="/images/0/08/ElfWizardF03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWizardM03A_thumb.png"){ $('<img width="45" height="45" alt="HumanWizardM03A_thumb.png" src="/images/8/88/HumanWizardM03A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfPriestM05A_thumb.png"){ $('<img width="45" height="45" alt="DwarfPriestM05A_thumb.png" src="/images/8/8f/DwarfPriestM05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWarriorF04A_thumb.png"){ $('<img width="45" height="45" alt="ElfWarriorF04A_thumb.png" src="/images/e/e1/ElfWarriorF04A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfPriestM07A_thumb.png"){ $('<img width="45" height="45" alt="DwarfPriestM07A_thumb.png" src="/images/c/c0/DwarfPriestM07A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWarriorF05A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWarriorF05A_thumb.png" src="/images/7/70/DwarfWarriorF05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWarriorF06A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWarriorF06A_thumb.png" src="/images/7/75/DwarfWarriorF06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="DwarfWizardM07A_thumb.png"){ $('<img width="45" height="45" alt="DwarfWizardM07A_thumb.png" src="/images/8/85/DwarfWizardM07A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfPriestF06A_thumb.png"){ $('<img width="45" height="45" alt="ElfPriestF06A_thumb.png" src="/images/0/0a/ElfPriestF06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfPriestF07A_thumb.png"){ $('<img width="45" height="45" alt="ElfPriestF07A_thumb.png" src="/images/b/b1/ElfPriestF07A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWarriorF05A_thumb.png"){ $('<img width="45" height="45" alt="ElfWarriorF05A_thumb.png" src="/images/4/4a/ElfWarriorF05A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="ElfWizardM06A_thumb.png"){ $('<img width="45" height="45" alt="ElfWizardM06A_thumb.png" src="/images/e/ed/ElfWizardM06A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanPriestF07A_thumb.png"){ $('<img width="45" height="45" alt="HumanPriestF07A_thumb.png" src="/images/6/65/HumanPriestF07A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWarriorM09A_thumb.png"){ $('<img width="45" height="45" alt="HumanWarriorM09A_thumb.png" src="/images/a/a3/HumanWarriorM09A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWizardM07A_thumb.png"){ $('<img width="45" height="45" alt="HumanWizardM07A_thumb.png" src="/images/3/39/HumanWizardM07A_thumb.png" />').insertAfter(label_conts); } if ($(this).val()=="HumanWizardM08A_thumb.png"){ $('<img width="45" height="45" alt="HumanWizardM08A_thumb.png" src="/images/2/28/HumanWizardM08A_thumb.png" />').insertAfter(label_conts); } }); } // show small portrait icons in test check boxes function showSmallPortraits() { $(article + " #mw-content-text" + " table span.checkboxesSpan label.checkboxLabel input").each(showSmallIcons); } // hides the keyword tooltip function hidekeywordTip() { $tfb.html("").removeClass("tooltip-ready").addClass("hidden").css("visibility","hidden"); activeHoverLink = null; } // displays the keyword tooltip function displaykeywordTip(e) { $tfb.not(":empty").removeClass("hidden").addClass("tooltip-ready"); movekeywordTip(e); $tfb.not(":empty").css("visibility","visible"); movekeywordTip(e); } // moves the tooltip function movekeywordTip(e) { $ct = $tfb.not(":empty"); var newTop = e.clientY + ((e.clientY > ($(window).height()/2)) ? -($ct.innerHeight()+20):20); var newLeft = e.clientX + ((e.clientX > ($(window).width()/2)) ? -($ct.innerWidth()+20):20); $ct.css({"position":"fixed","top":newTop + "px","left":newLeft + "px"}); } //This function removes a cached "Loading" entry. function clearkeywordCache(url) { if (tipCache[url] != null) { //Cache is not empty, let's see if we are still loading. if (tipCache[url].indexOf("Loading") != -1) { tipCache[url] = null; } } } // AJAX tooltips function showkeywordTip(e) { var $t=$(this); activeHoverLink = $t; $p=$t.parent(); if ($p.hasClass("selflink")==false) { $t.removeAttr("title"); $p.removeAttr("title"); var url=$p.attr("href").replace("Keywords#","")+" .keywordtt"; //var url="/wiki/Template:Spotlight .image"; //Remember: changing the image in the template will change the 'Coming Soon' image!!! if (tipCache[url] != null) { $tfb.html(tipCache[url]); displaykeywordTip(e); }else { $tfb.html(LOADING); //We put the "Loading..." into the cache, to avoid multiple fetchings tipCache[url] = $tfb.html(); $tfb.load(url, function(responseText, textStatus, XMLHttpRequest) { if (textStatus == "timeout") { //Fetching has timed out, so we remove the cached "Loading..." entry (hence enable another try) clearkeywordCache(url); } else if ($tfb.html() == "" || textStatus != "success") { //$tfb.html('<div class="tooltip-content"><b>Error</b><br />This target either has no tooltip<br />or was not intended to have one.</div>'); $tfb.html(LOADERROR); tipCache[url] = $tfb.html() } else { $tfb.find(".keywordtt").css({"display": ""}); $tfb.css({"background-color":"rgb(0,21,27)","max-width":"15em","padding":"7px 15px","border-radius":"0.5em","font-weight":"bold","font-size":"85%","height":"auto","text-align":"justify","border":"1px solid rgb(0,80,104)"}); tipCache[url] = $tfb.html(); } if ($t == activeHoverLink) { $tfb.html(tipCache[url]); displaykeywordTip(e); } }); } } } function bindkeywordTT() { $t=$(this); $p=$t.parent(); if ($p.hasClass("selflink") == false) { $t.data("tt", $p.attr("title")).hover(showkeywordTip,hidekeywordTip).mousemove(movekeywordTip); } } function addkeywordTT() { $(this).wrapInner('<span class="ajaxttlink" />'); } function Initkeywordtips() { if ($tfb == null) { $(article).append('<div id="tfb" class="htt"></div>'); $tfb = $("#tfb"); } $(article + " a[href*='wiki/Keywords#']:not(:has(span.ajaxttlink))").each(addkeywordTT); $(article + " span.ajaxttlink:not(:has(span.disablekeywordtt))").each(bindkeywordTT); } function modifyHeader() { var str=$("#firstHeading").html(); if (str.indexOf("Cards/")==17||str.indexOf("Items/")==17) $("#firstHeading").html(str.slice(23)); } $(function() { article = "#bodyContent"; $(article + " #builddeck" + " table.smwtable").each(binddeck); var headerstr=$("#firstHeading").html(); /*js to remove ugly header in Main page.*/ if (headerstr.indexOf("Cardhuntria:Community portal")>0) $("#firstHeading").remove(); /*js to strip "Cards/" and "Items/" from headers belonging to card and item pages.*/ if ((headerstr.indexOf("Cards/")>0) || (headerstr.indexOf("Items/")>0)){ modifyHeader(); Initkeywordtips(); } else if (headerstr.indexOf("Item Search Form")>0) { showTokenImages(); showExpImages(); } else if (headerstr.indexOf("Card Search Form")>0) showExpImages(); else if (headerstr.indexOf("My Collection")>0) showSmallPortraits(); else if (tooltipsOn) Inittooltips(); });