MediaWiki:Result Code Details.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 86: | Line 86: | ||
});*/ | });*/ | ||
console.log(cleanedHashTarget); | console.log(cleanedHashTarget); | ||
var resultcodesTarget = resultcodes_ + cleanedHashTarget; | var resultcodesTarget = "resultcodes_" + cleanedHashTarget; | ||
console.log(resultcodesTarget); | |||
console.log(resultcodesTarget[]); | |||
for (var i=0; i<resultcodesTarget.length; i++){ | for (var i=0; i<resultcodesTarget.length; i++){ | ||
console.log(resultcodesTarget[i]); | console.log(resultcodesTarget[i]); |
Revision as of 01:07, 22 January 2015
//Result Code - Product Association Arrays //===================================================================== var resultcodes_AddressObject = ["AS01", "AS02", "AS03", "AS09", "AS10", "AS12", "AS13", "AS14", "AS15", "AS16", "AS17", "AS18", "AS20", "AS22", "AS23", "AE01", "AE02", "AE03", "AE04", "AE05", "AE06", "AE07", "AE08", "AE09", "AE10", "AE11", "AE12", "AE13", "AE14", "AE15", "AE16", "AE17", "AE19", "AE20", "AC01", "AC02", "AC03", "AC04", "AC05", "AC06", "AC07", "AC08", "AC09", "AC10", "AC11", "AC12", "AC13", "AC14"]; var resultcodes_EmailObject = ["ES01", "ES02", "ES03", "ES04", "ES05", "ES06", "ES10", "ES11", "ES12", "ES13", "EE01", "EE02", "EE03", "EE04", "EE05"]; var resultcodes_NameObject = ["NS01", "NS02", "NS03", "NS04", "NS05", "NS06", "NS07", "NS08", "NE01", "NE02", "NE03", "NE04", "NE05", "NE06"]; var resultcodes_PhoneObject = ["PS01", "PS02", "PS03", "PS04", "PS05", "PS06", "PS07", "PS08", "PS09", "PS10", "PS11", "PS12", "PS13", "PS14", "PC01", "PE01", "PE02", "PE03", "PE04", "PE05", "PE06", "PE08", "PE09", "PE10"]; var resultcodes_GeoCoderObject = ["GS01", "GS02", "GS03", "GS05", "GS06", "GE01", "GE02", "GE03", "GE04"]; var resultcodes_GlobalAddressObject = ["AC01", "AC02", "AC03", "AC09", "AC10", "AC11", "AC12", "AC13", "AC14", "AC15", "AC16", "AC17", "AC18", "AC19", "AC21", "AE01", "AE02", "AE03", "AE05", "AE08", "AE09", "AE10", "AE11", "AE12", "AE13", "AE14", "AE17", "AV11", "AV12", "AV13", "AV14", "AV15", "AV21", "AV22", "AV23", "AV24", "AV25", "DF00", "DF21", "DF22", "DF23", "DF24", "DF25", "DF26", "DF27", "DF28", "DF51", "DF52", "DF53", "DF54", "DF55", "DF99", "DI00", "DI70", "DI80", "DI99", "DM00", "DM99", "DO00", "DO80", "DO99", "DT00", "DT80", "DT99", "F1", "F2", "F3", "MTE1", "MTE2", "MTE3", "MTE4", "MTE5", "MTE6", "MTE7", "MTE8", "MTE9", "MTE10", "MTE11", "MTE12", "MTE13", "MTE14", "MTE15", "MTE16", "MTS1", "MTS2", "MTS3", "MTS4", "MTS5", "MTS6", "MTS7", "MTS8", "MTS9", "MTS10", "MTS11", "MTS12", "MTS13", "MTS14", "MTS15", "MTS16", "RMAA", "RMLC", "RMSN", "RMFS", "RMHN", "RMPC", "TX??"]; var resultcodes_IPLocatorObject = ["IS01", "IS02", "IE01", "IE02"]; var resultcodes_MatchUpObject = ["MS01", "MS02", "MS03", "MS04", "MS05", "MS06", "MS07", "MS08", "MS09", "MS10", "MS11", "MS12", "MS13", "MS14", "MS15", "MS16", "MS17", "MS18", "MS19", "MS20", "MS21", "MS30", "MS31"]; var resultcodes_PresortObject = []; var resultcodes_ProfilerObject = ["QS01", "QS03", "QS04", "QS05", "QS06", "QS07", "QS08", "QS09", "QS10", "QS11", "QS12", "QS13", "QS14", "QS15", "QS16", "QS17", "QS18", "QS19", "QS20", "QS21", "QS22", "QS30", "QS40", "QS50", "QS60", "QS61", "QS62", "QE01", "QE03", "QE04", "QE05", "QE06", "QE07", "QE08", "QE09", "QE10", "QE11", "QE12", "QE13", "QE14", "QE30", "QE40", "QE41", "QE42", "QE43", "QE50", "QE60", "QE61", "QE70"]; var resultcodes_RightFielderObject = ["RS01", "RS02", "RE01", "RE02", "RE03"]; var resultcodes_StyleListObject = ["Deprecated"]; //===================================================================== //Changes the Header to act like a button $(".TileLayoutHead p").css({"cursor":"pointer"});//Cursor change $(".TileLayoutHead p").hover(function(){$(this).parent().css({"background-color":"#ffffff"});},function(){$(this).parent().css({"background-color":"#f6f6f6"});});//Hover change //Fixes Result Code Header padding $(".ResultTileLayoutHead h3").css({"padding-left":"30px"}); //Slide-out Effect $(".TileLayoutHead p").click(function(){ $(this).siblings(".TileLayoutBody").toggle(500, tileResetCheck($(this)));//Category Rollout $(this).parent().siblings(".TileLayoutHead").toggle(500);//Other Category Hide $(".ResultTileLayoutHead").slideUp(500);//Ensures the Result Code table holder is hidden. setTimeout(function(){ $(".ResultTileLayoutHead").css({"background-color":"#f6f6f6"});//Resets Result Head back color. //$(".ResultTileLayoutHeat").children("p").first().text("Result Codes");//Resets Result Head text to default. $(".ResultTileLayoutHeat p").first().text("Result Codes");//Resets Result Head text to default. }, 500); //$(".ResultTileLayoutHead").animate().css({"display":"none","background-color":"#f6f6f6"});//Ensures the Result Code table holder is hidden. //$(this).siblings(".TileLayoutBody").children().css({"display":"inline-block"});//Ensure Tiles are reset. // tileResetCheck(); }); //Ensure Tiles Are Reset function tileResetCheck(that){ if (that.siblings().css("display") === "block"){//Checks state of Category Rollout. setTimeout(function(){//Ensures tiles don't appear till after the cateogry hide rollout is done. that.siblings(".TileLayoutBody").children().css({"display":"inline-block"}); }, 500); }; } //Click handler on tiles. $(".TileLayoutBody a").click(function (){ //Matches the hash with a class to know what to hide. Class is set by the TileLayoutTile template. console.log(resultcodes_AddressObject); var hashTarget = $(this).attr("href"); var trimmedHashTarget = hashTarget.slice(hashTarget.indexOf("#") + 1,(hashTarget.length)); cleanedHashTarget = trimmedHashTarget.replace(/[_:]|\.2B|\.2A/g, ""); //Removes spaces, colons, pluses, and asterisks. spacedHashTarget = trimmedHashTarget.replace(/_/g, " ");//Readies the hash to be a header with spaces. spacedHashTarget = spacedHashTarget.replace(/.2A/g, "*");//Readies the hash to be a header with asterisks. spacedHashTarget = spacedHashTarget.replace(/.2B/g, "+");//Readies the hash to be a header with pluses. $(".TLT_" + cleanedHashTarget).siblings().toggle(250);//Hides the other tiles. $(".ResultTileLayoutHead").toggle(500);//Shows the Result Code table holder. var resultBackColor; //Sets the color variable for the Result Head according to the product selected. switch ($(this).closest(".TileLayoutHead").children("p").first().text()){ case "APIs": resultBackColor = "#005cbe"; break; case "Enterprise Solutions": resultBackColor = "#009245"; break; case "Web Services": resultBackColor = "#ff9000"; break; case "Legacy Services": resultBackColor = "#a31616"; break; case "Software": resultBackColor = "#c02040"; break; case "Reference Data": resultBackColor = "#6f1ba5"; break; default: resultBackColor = "#f6f6f6"; } $(".ResultTileLayoutHead").css({"background-color":resultBackColor});//Sets the Result Head back color to the product. $(".ResultTileLayoutHead").children("p").first().text(spacedHashTarget + " Result Codes");//Sets the Result Head text to the selected tile. selectedResultCodeDisplayer($(this), cleanedHashTarget); }); //Handles the result codes to be displayed, depending on the selected product. function selectedResultCodeDisplayer(that, cleanedHashTarget) { /*$(".ResultTileLayoutHead").children(".TileLayoutBody").children("h3").children("span").each(function(){ console.log("Each: " + $(this).text()); if ($(this).text() !== "AS"){ console.log($(this).text()); $(this).parent("h3").css({"display":"none"}); $(this).parent("h3").next("table").css({"display":"none"}); console.log("hiding this"); } });*/ console.log(cleanedHashTarget); var resultcodesTarget = "resultcodes_" + cleanedHashTarget; console.log(resultcodesTarget); console.log(resultcodesTarget[]); for (var i=0; i<resultcodesTarget.length; i++){ console.log(resultcodesTarget[i]); } for (var i=0; i<resultcodes_AddressObject.length; i++){ console.log(resultcodes_AddressObject[i]); } $(".ResultTileLayoutHead .TileLayoutBody table tbody tr").children("td:first-child").each(function(){ if ($(this) === resultcodesTarget){ console.log("True, " + $(this).text()); } }); } //Check On Page Load //$(window).on('hashchange', TileLayoutTileHider);//Check on hashchange /* $(window).on('hashchange', TileLayoutTileHider);//Check on hashchange function TileLayoutTileHider(){ var pageHash = window.location.hash var trimmedHash = pageHash.slice(pageHash.indexOf("#") + 1,(pageHash.length)); console.log("pageHash: " + pageHash); console.log("trimmedHash: " + trimmedHash); }*/