diff --git a/_js/character/character-select.js b/_js/character/character-select.js index 143d5315f..ca4d9c464 100644 --- a/_js/character/character-select.js +++ b/_js/character/character-select.js @@ -34,7 +34,7 @@ function initializeCharacterSelect(numChars){ }); //adding from the bottom - /*$(".add_on").click(function(){ + $(".add_on").click(function(){ var currUrl = $(this).next().attr("href"); //secondary are set to 2 or 3 @@ -43,7 +43,7 @@ function initializeCharacterSelect(numChars){ currUrl = currUrl.replace("n=","n"+(charsSelected+1)+"="); updateCharIcons(getCollectedCharUrls() + currUrl); - });*/ + }); } //get the urls of the primary and secondary chars @@ -89,7 +89,7 @@ function getCollectedCharUrls(){ //send ajax request to update characters and reload page function updateCharIcons(charUrls){ - /* + $.ajax({ type: "GET", url: 'character-select-submit.xml?' + charUrls, @@ -101,14 +101,134 @@ function updateCharIcons(charUrls){ error: function(msg){ window.location.reload(); //refresh page } - });*/ + }); +} + +char_arr = new Array(); +realm_arr = new Array(); +var lastfield, ajaxinit, default_realm +function add_rss_char(somefield) +{ var char_req = ochar_req = $("#character"+somefield).val() + + if(char_req == '') { if(char_arr[somefield-1] && char_arr[somefield-1].length > 0) + { addchar_error(str_removed+" "+char_req,somefield); + char_arr[somefield-1] = realm_arr[somefield-1] = null; + refresh_rss_url() + //$(".ajax_error:eq("+(somefield-1)+")").html('') + } + else addchar_error(str_err_char,somefield); + return; + } + if(char_req.indexOf("@") < 0 && (!default_realm || default_realm=='')) { addchar_error(str_err_realm,somefield); return } + + char_req = char_req.split("@") + if(!char_req[1] && default_realm) char_req[1] = default_realm + char_req[0] = jQuery.trim(char_req[0]) + char_req[1] = jQuery.trim(char_req[1]).replace(/\s/g,"+") + var char_req_url = "character-feed.xml?r="+char_req[1]+"&cn="+char_req[0]+"&skipCache" + + lastfield = somefield; + + $.get(char_req_url, {}, + function(data,textStatus){ + //alert("Data Loaded: " + data + "\nStatus:"+textStatus); + if(textStatus=="success") + { char_arr[somefield-1] = char_req[0] + realm_arr[somefield-1] = char_req[1] + refresh_rss_url() + $(".ajax_error:eq("+(somefield-1)+")").html('') + $(".character_row:eq("+(somefield-1)+") > a").hide(); + $(".character_row:eq("+(somefield-1)+")").addClass("ok"); + if(somefield<6) $(".character_row:eq("+(somefield)+")").fadeIn("fast",function(){ $("#character"+(Number(somefield)+1)).focus();}) + var charattr = {} + var charInfo = data.getElementsByTagName("character")[0] + var charLvl = Number(charInfo.getAttribute("level")) + var charLvlRg = (charLvl < 60)?"-default":(charLvl < 70)?"":(charLvl < 80)?"-70":"-80" + var charimg = '' + $(".character_row:eq("+(somefield-1)+") > .rss_port").html(charimg) + bindToolTips() + } + }); + if(!ajaxinit) { bind_ajax_error(); ajaxinit = true } + +} + +function rss_remove(somefield) +{ $("#character"+somefield).val('') + add_rss_char(somefield) + } + +function bind_ajax_error() +{ + $(".custom_rss_container").ajaxError(function(event, request, settings){ + if(ochar_req.indexOf("@")==-1){ ochar_req += " on " + default_realm} + addchar_error(str_cantfind.replace('XXX'," " + ochar_req + ""),lastfield); + }); } +function addchar_error(some_err,somefield) +{ var err_field = $(".ajax_error:eq("+(somefield-1)+")") + err_field.parent().removeClass("ok"); + err_field.html(some_err); + err_field.stop(); + err_field.animate({color:"red"},"fast").animate({color:"black"},3000) + +} + +var focusval +function char_check(targ,option) +{ if(!option) + { focusval = targ.value + } + else + { if(targ.value != focusval){ add_rss_char(targ.id.slice(-1)) } + } + +} + +function check_action() +{ $(this).toggleClass('checked'); + if($(this).parent().hasClass('sub')){ $(this).parent().toggleClass('deselected'); } + refresh_rss_url() +} + +var base_rss_url = location.href.split("custom-rss.xml")[0]+ "character-feed.atom" +function refresh_rss_url() +{ var opt_arr = new Array() + var achieve_arr = new Array() + var opt = $(".check_box.checked").each(function(){ if($(this).parent().hasClass("sub")) achieve_arr.push(this.id); + else opt_arr.push(this.id.toUpperCase()); + }) + var feed_url = base_rss_url + "?r="+realm_arr.join(",").replace(/(,+$)+|(^,+)+/g,'')+"&cn="+char_arr.join(",").replace(/(,+$)+|(^,+)/g,'') + if(opt_arr.length > 0 && opt_arr.length != $(".top_level > .check_box").length) feed_url += "&filters="+opt_arr.join(",") + if(achieve_arr.length > 0 && $('#achievement').hasClass('checked') && achieve_arr.length != $(".sub > .check_box").length) + feed_url += "&achCategories="+achieve_arr.join(",") + if(achieve_arr.length == 0 && $('#achievement').hasClass('checked')) $('#achievement').removeClass('checked') + if($('#loot').hasClass('checked')){ + item_qual = $('#loot_rarity').val(); if(item_qual!='') feed_url += "&itemQuality="+ item_qual.toUpperCase(); + item_level = $('#loot_ilvl').val(); if(item_level!='') feed_url += "&itemLevel="+ item_level + } + feed_url = feed_url.replace(/(,+)/g,',')+"&locale="+lang; + if(char_arr.length > 0 && char_arr.join('') != '') $("#customfeed_url").val(feed_url) + if(char_arr.join('') == '') $("#customfeed_url").val('') + //$("#rss_link_copy").attr("href",feed_url) +} + + +function check_default_char() +{ + if((armory_query.n || armory_query.cn) && armory_query.r){ + def_chr = armory_query.n||armory_query.cn + def_rlm = armory_query.r.replace(/\+/g," ") + $("#character1").val(def_chr+"@"+def_rlm); + $(".character_row:first > a").click() + + $("#feed_return").html(backhtml.replace("default_chr",def_chr)).attr('href',"character-sheet.xml?r="+armory_query.r+"&cn="+def_chr); + } +} -//boolean for displaying dual tooltips or not -function setDualTooltipCookie() { - if (document.getElementById('checkboxDualTooltip').checked) - setcookie("armory.cookieDualTooltip", 1); - else - setcookie("armory.cookieDualTooltip", 0); +function toggle_subfilter(which, targ) +{ $(targ).toggleClass('less') + $('#'+which).toggle(); } +//Moved setDualTooltipCookie to common.js diff --git a/cache/_debug/index.php b/cache/_debug/index.php new file mode 100644 index 000000000..8da41334f --- /dev/null +++ b/cache/_debug/index.php @@ -0,0 +1,32 @@ +