Beruflich Dokumente
Kultur Dokumente
(function(){
i$.merge({
"NO_ITEMS_0":"No hay elementos que visualizar.",
"ERROR_LOADING_0":"Se ha producido un error al cargar el menú."
},i$.fromPath("wptheme.contextMenu.nls",true));
})();
(function(){
if(!i$.isIE){
i$.addOnLoad(function(){
var _1=document.getElementsByTagName("SECTION");
for(var i=0;i<_1.length;i++){
if(i$.hasClass(_1[i],"a11yRegionTarget")){
var _2=_1[i];
var _3=null;
var _4=_2.getElementsByTagName("SPAN");
for(var j=0;j<_4.length;j++){
if(i$.hasClass(_4[j],"a11yRegionLabel")){
_3=_4[j];
}
}
if(_3){
var _5=_3;
var _6=_2;
var _7=null;
while((_6=_6.parentNode)!=null){
if(i$.hasClass(_6,"component-control")){
var m=_6&&(_6.className||"").match(/id-([\S]+)/);
_7=m&&m[1];
break;
}
}
if(_7){
var _8="wpRegionId"+_7;
_5.setAttribute("id",_8);
_2.setAttribute("aria-labelledby",_8);
}
}
}
}
});
}
})();
jQuery("document").ready(function() {
if ( $( "#showContent" ).length ) {
var objappVersion = navigator.appVersion;
var objAgent = navigator.userAgent;
var objbrowserName = navigator.appName;
var objfullVersion = ''+parseFloat(navigator.appVersion);
var objBrMajorVersion = parseInt(navigator.appVersion,10);
var objOffsetName,objOffsetVersion,ix;
// In Chrome
if ((objOffsetVersion=objAgent.indexOf("Chrome"))!=-1) {
objbrowserName = "Chrome";
objfullVersion = objAgent.substring(objOffsetVersion+7);
document.getElementById("showContent").innerHTML="<ul><li> "+$
('#ID_pps_lbl_DetectMyDevice_ChromeStep1').val()+"</li><li>"+$
('#ID_pps_lbl_DetectMyDevice_ChromeStep2').val()+"</li><li>"+$
('#ID_pps_lbl_DetectMyDevice_ChromeStep3').val()+"</li></ul>";
}
// In Microsoft internet explorer
else if (!!(navigator.userAgent.match(/Trident/))||
(objOffsetVersion=objAgent.indexOf("MSIE"))!=-1) {
objbrowserName = "Microsoft Internet Explorer";
objfullVersion = objAgent.substring(objOffsetVersion+5);
if (document.all && document.querySelector && !
document.addEventListener) {
document.getElementById("showContent").innerHTML="<ul><li> "+$
('#ID_pps_lbl_DetectMyDevice_IE8Step1').val()+"</li><li>"+$
('#ID_pps_lbl_DetectMyDevice_IE8Step2').val()+"</li><li>"+$
('#ID_pps_lbl_DetectMyDevice_IE8Step3').val()+"</li></ul>";
}
else{
document.getElementById("showContent").innerHTML="<ul><li> "+$
('#ID_pps_lbl_DetectMyDevice_IEStep1').val()+"</li><li>"+$
('#ID_pps_lbl_DetectMyDevice_IEStep2').val()+"</li></ul>";
}
}
// In Firefox
else if ((objOffsetVersion=objAgent.indexOf("Firefox"))!=-1) {
objbrowserName = "Firefox";
document.getElementById("showContent").innerHTML="<ul><li>"+$
('#ID_pps_lbl_DetectMyDevice_FirefoxStep1').val()+"</li><li>"+$
('#ID_pps_lbl_DetectMyDevice_FirefoxStep2').val()+" <p><img
src=\"https://h20614.www2.hp.com/ediags/gmd/Content/images/firefox-download-
instruction-step.png\" width=\"84\" height=\"58\"></p></li><li>"+$
('#ID_pps_lbl_DetectMyDevice_FirefoxStep3').val()+"</li><li>"+$
('#ID_pps_lbl_DetectMyDevice_FirefoxStep4').val()+"</li></ul>";
}
// In Safari
else if ((objOffsetVersion=objAgent.indexOf("Safari"))!=-1) {
objbrowserName = "Safari";
objfullVersion = objAgent.substring(objOffsetVersion+7);
if ((objOffsetVersion=objAgent.indexOf("Version"))!=-1)
objfullVersion = objAgent.substring(objOffsetVersion+8);
}
// For other browser "name/version" is at the end of userAgent
else if ( (objOffsetName=objAgent.lastIndexOf(' ')+1) <
(objOffsetVersion=objAgent.lastIndexOf('/')) )
{
objbrowserName = objAgent.substring(objOffsetName,objOffsetVersion);
objfullVersion = objAgent.substring(objOffsetVersion+1);
if (objbrowserName.toLowerCase()==objbrowserName.toUpperCase()) {
objbrowserName = navigator.appName;
}
}
// trimming the fullVersion string at semicolon/space if present
if ((ix=objfullVersion.indexOf(";"))!=-1)
objfullVersion=objfullVersion.substring(0,ix);
if ((ix=objfullVersion.indexOf(" "))!=-1)
objfullVersion=objfullVersion.substring(0,ix);
objBrMajorVersion = parseInt(''+objfullVersion,10);
if (isNaN(objBrMajorVersion)) {
objfullVersion = ''+parseFloat(navigator.appVersion);
objBrMajorVersion = parseInt(navigator.appVersion,10);
}
});
/* Global variable declaration*/
var typeAheadTimeout; // to clear Timeout
var currentValue;
var ajaxParam = { // to hold paramaters to send to ajax
url1 : '', //for 1st IDOL call
url2 : '', // for second IDOL call
url : '',
paramData : {}
};
var countEachBind = 0;
var KEY = {
UP : 38,
DOWN : 40,
TAB : 9,
ENTER : 27
};
var comingFromPFinder = false;
var urlCreationFilteredData;
$(document).ready(function() {
typeAheadInit();
});
function checkValidity(val) {
if (typeof val !== "undefined" && val != null) {
return true;
}
return false;
}
$("input[type='text']").each(function() {
if ($(this).hasClass("reqTypeAhead")) {
var typeAheadObjClass = $(this).data("predectivecontainer");
handleEvents(typeAheadObjClass, $(this));
}
});
event.preventDefault();
(reqTypeaheadBox).val("");
$("." + typeAheadObjClass).remove();
}
});
isHidePrediction(typeAheadObjClass, reqTypeaheadBox);
});
if(pageIdentifier == "swdselfservice" ||
urlIdentifier.indexOf("drivers") != -1){
url += "drivers/selfservice" + separator; // has to come from
SSC - TBD
}
console.log(urlCreationFilteredData);
if(urlCreationFilteredData) {
var title;
if(urlCreationFilteredData.length >= 1) {
$.each(urlCreationFilteredData, function(index, obj) {
var data = urlCreationFilteredData[index];
if(data.id == prodIdSelectedTypeahead) {
// looping each prod id from response json to match
with prod id of clicked typeahead selection
// url for series
/*6594 - url creation using seofriendlyname*/
if(data.seoFriendlyName!=undefined) {
title = data.seoFriendlyName;
} else {
title = data.seriesName;
title = title.replace(/ /g,"-");
}
if(data.classType == 3 || data.classType == 4) {
url += "model" + separator;
url += data.productId;
productIDContact = data.productId;
}
if(data.classType == 4) {
url += "?sku=";
url += data.skuId;
skuIDContact = data.skuId;
}
return false;
}
});
} else {
/*6594 - url creation using seofriendlyname*/
if(urlCreationFilteredData.seoFriendlyName!=undefined) {
title = urlCreationFilteredData.seoFriendlyName;
} else {
title = urlCreationFilteredData.seriesName;
title = title.replace(/ /g,"-");
}
if(urlCreationFilteredData.classType == 3 ||
urlCreationFilteredData.classType == 4) {
url += "model" + separator;
url += urlCreationFilteredData.productId;
productIDContact = urlCreationFilteredData.productId;
}
if(urlCreationFilteredData.classType == 4) {
url += "&sku=";
url += urlCreationFilteredData.skuId;
skuIDContact = urlCreationFilteredData.skuId;
}
}
//adding url creation code for contact-hp
//var pageIdentifier = $
('#pageIdentifier').val().toLowerCase();
//var redirectHubUrl = '<hp:configuration
name="HUB_NAV_URL" typeEnum="${'PROPERTY'}" />';
//var redirectHubUrl =
"http://g9t0144.houston.hp.com/apps/Nav?h_client=s-a-r11839-1" ;
var redirectHubUrl = hubNavigationBaseUrl ;
if(productIDContact != undefined){ //no product oid is
returned by Idol
redirectHubUrl += "&h_product=" +
productIDContact;
}
else{
redirectHubUrl += "&h_product=" + seriesIDContact;
}
//Checking for special cc lc conditions
if(cCode == "gb" && lCode == "en"){
cCode = "uk" ;
}
else{
lCode = localeConversion(cCode,lCode);
}
redirectHubUrl += "&h_lang=" + lCode +"&h_cc=" + cCode ;
});
// keyboard events on the predictive results
$(document).on("keydown","." + typeAheadObjClass + " li a",function(event) {
event.stopPropagation();
event.preventDefault();
if ((event.which == KEY.DOWN)) {
if (!($(document.activeElement).parents("li")
.is(':last-child'))) {
/*3244 start: stop all handlers from being executed
in DOM tree*/
event.stopImmediatePropagation();
/*3244 end*/
$
(document.activeElement).parents("li").find("a").removeClass("hover");
$
(document.activeElement).parents("li").next().children("a").addClass("hover");
$
(document.activeElement).parents("li").next().children("a").focus();
/*For d-3589 */
$
(document.activeElement).closest(".hasTypeahead").find("input.search-input").val($
(document.activeElement).text());
// $(".typeAheadBox").val($
(document.activeElement).text());
//(reqTypeaheadBox).val($
(document.activeElement).text());
} else {
$("." + typeAheadObjClass + " li
a").removeClass("hover");
(reqTypeaheadBox).focus();
(reqTypeaheadBox).val(currentValue);
// autocomplete(reqTypeaheadBox,
// typeAheadObjClass);
}
}
else if(event.which == KEY.TAB){
var clearIcon = (reqTypeaheadBox).parents(".search-
bg").find(".clear-search");
if($(clearIcon).length > 0 ){
$(clearIcon).focus();
}
$("." + typeAheadObjClass).remove();
}
else if ((event.which == KEY.UP)) {
if (!($(document.activeElement).parents("li")
.is(':first-child'))) {
/*3244 start: stop all handlers from being executed
in DOM tree*/
event.stopImmediatePropagation();
/*3244 end*/
$
(document.activeElement).parents("li").find("a").removeClass("hover");
$
(document.activeElement).parents("li").prev().children("a").addClass("hover");
$
(document.activeElement).parents("li").prev().children("a").focus();
/*For d-3589 */
$
(document.activeElement).closest(".hasTypeahead").find("input.search-input").val($
(document.activeElement).text());
// $(".typeAheadBox").val($
(document.activeElement).text());
//(reqTypeaheadBox).val($
(document.activeElement).text());
} else {
$("." + typeAheadObjClass + " li
a").removeClass("hover");
(reqTypeaheadBox).focus();
(reqTypeaheadBox).val(currentValue);
// autocomplete(reqTypeaheadBox,
// typeAheadObjClass);
}
} else if (event.which == 13) {
$(document.activeElement).trigger("click");
}
});
}
function createQueryParams(val){
val = $.trim(val);
//cn, hk, tw
var cc = getCCLC('cc');
var lc = getCCLC('lc');
var addFieldTextData = false;
if(addFieldTextData){
fieldText = addFieldText+'+AND+'+fieldText;
}
words[lengthOfWordList-1] = '';
ajaxParam.paramData['text'] = text;
ajaxParam.paramData['fieldText'] = fieldText;
}
else{
text = val+'*';
if(addFieldTextData){
//CR13588ALM
fieldText = addFieldText;
ajaxParam.paramData['fieldText'] = fieldText;
}
else{
// if we have a filter ID and haven't already added it
if(filterId){
ajaxParam.url1 = addFieldTextConditionToURL(ajaxParam.url1,
"+AND+STRING{"+filterId+"}:NAVIGATIONPATH", filterId);
}else{
ajaxParam.paramData['fieldText'] = '';
ajaxParam.paramData['text'] = text;
console.log('Text --->'+ text)
}
};
}
var successHandlerParams = {
'currentValue':modifiedCurrentValue,
'currentInput':currentInput,
'typeAheadObjClass':typeAheadObjClass
};
//callAjaxUtil('typeahead',ajaxParam.url,'POST',getMatch,'JSON',requestJson,success
HandlerParams,ajaxFailureHandler);
if(ajaxParam.paramData['text']!=null){
ajaxParam.url += '&text='+ajaxParam.paramData['text'];
}
callAjaxUtil('typeahead',ajaxParam.url,'POST',recallIdol,'JSON',null,successHandler
Params,ajaxFailureHandler);
//callAjaxUtil('typeahead',ajaxParam.url,'GET',nonIdolTypeAhead,'JSON',null,success
HandlerParams,ajaxFailureHandler);
$(currentInput).parent(".hasTypeahead").find(".searching").show();
}
/*This function takes the IDOL JSON response and makes sense out of it.*/
var RELEVANCE_DIFF = 10; //to be externalized
var TYPEAHEAD_MAX_LIMIT = 8; //to be externalized
/**
* This method is used when hp-core-service is utilized
* for type ahead in search.
* This method populates type ahead.
*
* @since R3.0
* @author arka.sinha@hp.com
*/
var nonIdolTypeAhead = function(data,successHandlerParams){
extractedData.push(data[i].matchResut);
}
if(extractedData.length > 0){
createList(extractedData, extractedData.length,
successHandlerParams.currentInput, successHandlerParams.currentValue,
successHandlerParams.typeAheadObjClass);
}
}
if(typeof(responseDataJSON)=='object'){
responseDataJSON = responseDataJSON.join();
}
responseDataJSON = $.parseJSON(responseDataJSON);
/* responseDataJSON = data; */
if(!(responseDataJSON.autnresponse.responsedata["autn:numhits"] == undefined)){
// if IDOL response is not error
totalResults = responseDataJSON.autnresponse.responsedata["autn:numhits"].$;
}
else{
totalResults = 0;
}
var modifiedCurrentValue = successHandlerParams.currentValue;
//createQueryParams
var fieldtext = "";
var addFieldText = 'MATCH{'+cc+',NoValue}:COUNTRY_CODE';
ajaxParam.url = ajaxParam.url1+'&text='+modifiedCurrentValue+fieldtext;
//commenting to cancel the second call to IDOL
//callAjaxUtil('typeahead',ajaxParam.url,'POST',callTypeAheadResultConstructor,'JSO
N',null,successHandlerParams,ajaxFailureHandler);
} else {
callTypeAheadResultConstructor(data,successHandlerParams);
}
}
var callTypeAheadResultConstructor = function(rawData, successHandlerParams){
new typeAheadResultConstructor(rawData,successHandlerParams).filter();
}
var totalResults;
var responseDataJSON = rawData.autnresponse.responsedata.$;
if(typeof(responseDataJSON)=='object'){
responseDataJSON = responseDataJSON.join();
}
responseDataJSON = $.parseJSON(responseDataJSON);
/* responseDataJSON = rawData; */
if(!(responseDataJSON.autnresponse.responsedata["autn:numhits"] == undefined)){
// if IDOL response is not error
totalResults = responseDataJSON.autnresponse.responsedata["autn:numhits"].$;
}
else{
totalResults = 0;
}
var lowestNodeDepth = 0;
var lowestNodeDepthCount = 0;
var maxWeightage = 0.0;
var typeaheadResultCounter = 0;
this.filter = function() {
//initialise array to store child node paths (array or arrays) us-6523
var childNodeParentArray=[];
var elemNavPathValue =
((this["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$).split('|').length) -
2; //having a -2 as an empty string is created after the last '|'
var elemClazzType = this["autn:content"].DOCUMENT.CLASS.$;
var shortestNavPathLength = calcNodeDepth(elemClazzType,
elemNavPathValue);
//if(this["autn:content"].DOCUMENT.CHILDNODES.hasOwnProperty("$"))
//{
// var childArray=this["autn:content"].DOCUMENT.CHILDNODES.
$.split('|');
// childNodeParentArray.push(childArray);
// }
var weightage = this["autn:weight"].$;
var nodeDepth = shortestNavPathLength;
tempData["title"] = this["autn:content"].DOCUMENT.DRETITLE.$;
tempData["nodeDepth"] = nodeDepth;
tempData["weightage"] = weightage;
tempData["product"] =
(checkValidity(this["autn:content"].DOCUMENT.PRODUCTID.$)) ?
this["autn:content"].DOCUMENT.PRODUCTID.$ : "";
if (maxWeightage == 0.0) {
maxWeightage = weightage;
relevantDataIntrim.push(tempData);
lowestNodeDepth = nodeDepth;
if(this["autn:content"].DOCUMENT.CHILDNODES.hasOwnProperty("$"))
{
var childArray=this["autn:content"].DOCUMENT.CHILDNODES.
$.split('|');
childNodeParentArray.push(childArray);
}
if(this["autn:content"].DOCUMENT.CHILDNODES.hasOwnProperty("$"))
{
var
childArray=this["autn:content"].DOCUMENT.CHILDNODES.$.split('|');
childNodeParentArray.push(childArray);
}
if(shortestNavPathLength == 2) {
tempDataforURL["seriesId"] = tempData["product"];
tempDataforURL["id"] = tempData["product"];
} else if(shortestNavPathLength == 3) {
tempDataforURL["productId"] = tempData["product"];
tempDataforURL["id"] = tempDataforURL["productId"];
var seriesId =
this["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$;
seriesId = (checkValidity(seriesId)) ?
seriesId.split("|") : "";
seriesId == "" ? "" : (seriesId = seriesId[seriesId.length-
3]);
tempDataforURL["seriesId"] = seriesId;
}
else if(shortestNavPathLength == 4) {
tempDataforURL["skuId"] = tempData["title"];
tempDataforURL["productId"] = tempData["product"];
tempDataforURL["id"] = tempDataforURL["productId"];
var seriesId =
this["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$;
seriesId = (checkValidity(seriesId)) ?
seriesId.split("|") : "";
seriesId == "" ? "" : (seriesId = seriesId[seriesId.length-
4]);
tempDataforURL["seriesId"] = seriesId;
var productId =
this["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$;
productId = (checkValidity(seriesId)) ?
productId.split("|") : "";
productId == "" ? "" : (productId =
productId[productId.length-3]);
tempDataforURL["productId"] = productId;
}
urlCreationTempData.push(tempDataforURL);
/* 6523 - in case of pfinder, storing results for forming URL
of drivers page (on click
of typeahead results - End */
});
} else {
var tempData = {};
var tempDataforURL = {};
var elemNavPathValue =
((rawData.autnresponse.responsedata["autn:hit"]
["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$).split('|').length) - 2;
//having a -2 as an empty string is created after the last '|'
var elemClazzType = rawData.autnresponse.responsedata["autn:hit"]
["autn:content"].DOCUMENT.CLASS.$;
var shortestNavPathLength = calcNodeDepth(elemClazzType,
elemNavPathValue)
var weightage = rawData.autnresponse.responsedata["autn:hit"]
["autn:weight"].$;
tempData["title"] = rawData.autnresponse.responsedata["autn:hit"]
["autn:content"].DOCUMENT.DRETITLE.$;
tempData["nodeDepth"] = shortestNavPathLength;
tempData["weightage"] = weightage;
tempData["product"]=
(checkValidity(rawData.autnresponse.responsedata["autn:hit"]
["autn:content"].DOCUMENT.PRODUCTID.$)) ?
rawData.autnresponse.responsedata["autn:hit"]["autn:content"].DOCUMENT.PRODUCTID.
$ : "" ;
lowestNodeDepth = shortestNavPathLength;
relevantDataIntrim.push(tempData);
tempDataforURL["seriesName"] = tempData["title"];
tempDataforURL["classType"] = shortestNavPathLength;
if(shortestNavPathLength == 2) {
tempDataforURL["seriesId"] = tempData["product"];
} else if(shortestNavPathLength == 3) {
tempDataforURL["productId"] = tempData["product"];
var seriesId = rawData.autnresponse.responsedata["autn:hit"]
["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$;
seriesId = (checkValidity(seriesId)) ? seriesId.split("|") :
"";
seriesId == "" ? "" : (seriesId = seriesId[seriesId.length-3]);
tempDataforURL["seriesId"] = seriesId;
tempDataforURL["id"] = tempDataforURL["productId"];
}
else if(shortestNavPathLength == 4) {
tempDataforURL["skuId"] = tempData["title"];
tempDataforURL["productId"] = tempData["product"];
tempDataforURL["id"] = tempDataforURL["productId"];
var seriesId =
rawData.autnresponse.responsedata["autn:hit"]
["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$;
seriesId = (checkValidity(seriesId)) ?
seriesId.split("|") : "";
seriesId == "" ? "" : (seriesId = seriesId[seriesId.length-
4]);
tempDataforURL["seriesId"] = seriesId;
var productId =
rawData.autnresponse.responsedata["autn:hit"]
["autn:content"].DOCUMENT.SHORTESTNAVIGATIONPATH.$;
productId = (checkValidity(seriesId)) ?
productId.split("|") : "";
productId == "" ? "" : (productId =
productId[productId.length-3]);
tempDataforURL["productId"] = productId;
}
urlCreationTempData.push(tempDataforURL);
}
urlCreationFilteredData = urlCreationTempData;
if(this["nodeDepth"] == lowestNodeDepth){
lowestNodeDepthCount++;
typeaheadResultCounter++;
var tempData = {};
tempData["label"] = this["title"];
tempData["productId"] = this["product"];
relevantData.product.suggestions.push(tempData);
}
else if( this["nodeDepth"]== lowestNodeDepth+1 &&
lowestNodeDepthCount==1){
typeaheadResultCounter++;
var tempData = {};
tempData["label"] = this["title"];
tempData["productId"] = this["product"];
relevantData.product.suggestions.push(tempData);
}
else{
//do nothing
}
} else {
return false;
}
});
getMatch(relevantData,successHandlerParams);
}
}
}
/*End*/
// Failure handler for ajax call
function ajaxFailureHandler(){
$(".hasTypeahead .searching").hide();
$(".hasTypeahead .searching").hide();
var jsonProdLen = jsonData.product.suggestions.length;
var jsonTopicLen = jsonData.topic.suggestions.length;
var jsonTotalLength = jsonProdLen + jsonTopicLen;
// This creates the DOM for the predictive results and append it
function createList(jsonObj, jsonProdLen, currentInput,
currentValue,typeAheadObjClass) {
(currentInput).siblings("ul").remove();
/*
* type head highlighting - creating array with each word in user query for
* search box
*/
var userQuery = (currentInput).val();
var userQueryWord;
var userQueryWordLen = 0;
if (userQuery != undefined && userQuery != "") {
userQueryWord = userQuery.split(" ");
}
/*
* type head highlighting - creating array with each word in user query for
* search box - end
*/
var jsonLen = jsonObj.length;
var typeaheadLeftHook = (currentInput).siblings(".typeaheadHook").val() + "px";
if($("html").attr("dir")=="ltr"){
var stringList = "<ul class=\"predictive-results " + typeAheadObjClass
+ " \" style=\"left:"+typeaheadLeftHook+"\">";
}
else{
var stringList = "<ul class=\"predictive-results " + typeAheadObjClass
+ " \" style=\"right:"+typeaheadLeftHook+"\">";
}
for (var i = 0; i < jsonLen; i++) {
/*
* type head highlighting - using array to highlight type ahead
* suggestions
*/
for (var count = 0; count < userQueryWord.length; count++) {
var toBeHighlighted = userQueryWord[count];
var suggestedStr = jsonObj[i].label;
if (toBeHighlighted != "") {
suggestedStr =
highlightSuggestion(suggestedStr,toBeHighlighted);
jsonObj[i].label = suggestedStr;
}
}
/*
* type head highlighting - using array to highlight type ahead
* suggestions - end
*/
if (i == jsonProdLen) {
stringList += " <li><a href=\"javascript:void(0);\"
class=\"firstTopic\" \">"
+ jsonObj[i] + "</a></li> ";
} else {
stringList += " <li><a href=\"javascript:void(0);\" data-
productid=\""+jsonObj[i].productId+"\" >" + jsonObj[i].label
+ "</a></li> ";
}
}
stringList += "</ul>"
if ((currentValue != "") && (jsonLen != 0)) {
if ((currentValue.toLowerCase() != jsonObj[0].label.toLowerCase())) {
(currentInput).parents(".hasTypeahead").append(stringList);
if( (currentInput).hasClass("pfinder-search") ){
comingFromPFinder=true;
}
else{
comingFromPFinder=false;
}
}
}
// $(".autoCompleteList").css("top", (currentInput).css("height"));
// $(".typeAheadBox").val(jsonObj[0]);
}
//This function calls the typeahead function after an interval of 100ms after user
inputs
function callTypeAhead(reqTypeaheadBox, typeAheadObjClass) {
// this is to get the typeAheadLimit i.e. beyond this count no typeahead call,
#arka
var typeAheadLimit = reqTypeaheadBox.data("typeaheadlimit");
// Don't call IDOL for type ahead if the lenght of text is less than 2 or
greater than the configured limit #arka
if ((reqTypeaheadBox).val().length > 1 && (reqTypeaheadBox).val().length <
typeAheadLimit) {
clearTimeout(typeAheadTimeout);
typeAheadTimeout = setTimeout(function() {
autocomplete(reqTypeaheadBox, typeAheadObjClass)
}, 100);
// autocomplete(reqTypeaheadBox, typeAheadObjClass);
} else {
clearTimeout(typeAheadTimeout);
$("." + typeAheadObjClass + "").remove();
$(".hasTypeahead .searching").hide();
}
while(strongFirstIndex!=-1) {
if (strongFirstIndex == 0){
var endTagLastIndex = strongLastIndex + strongLastTagL;
suggestedArr[arrCounter] =
remainingSuggestedStr.substring(0,endTagLastIndex);
remainingSuggestedStr =
remainingSuggestedStr.substring(endTagLastIndex);
} else {
suggestedArr[arrCounter] =
remainingSuggestedStr.substring(0,strongFirstIndex);
remainingSuggestedStr =
remainingSuggestedStr.substring(strongFirstIndex);
}
arrCounter++;
strongFirstIndex = remainingSuggestedStr.indexOf(startTag);
strongLastIndex = remainingSuggestedStr.indexOf(lastTag);
}
return suggestedArr;
}
if (suggestedStr.indexOf("<strong>")==-1) {
suggestedStr = createHiglightedStr(suggestedStr, toBeHighlighted);
}
/*
* from the second match onwards, add <strong></strong> to the keyword
* based on its "keyword+</strong>" occurrence
*/
else {
var index = suggestedStr.lastIndexOf(toBeHighlighted+'</strong>');
if (index != -1) {
firstPartStr = suggestedStr.substring(0, index);
lastPartStr = suggestedStr.substring(index);
suggestedStr = firstPartStr
+ createHiglightedStr(lastPartStr, toBeHighlighted);
}
}
}
return finalSuggestedStr;
}
setTimeout(function() {
if($("." + typeAheadObjClass + " li a").is(":focus") || $
(".clearQuestionText").is(":focus") ||(reqTypeaheadBox).is(":focus") ){
}
else{
$("." + typeAheadObjClass).remove();
}
}, 200);
}
/**
* @returns
*/
function getFilterIdForDriversPage(){
id = printerId;
}else if(url.indexOf('drivers/laptop') > 0){
id = laptopId;
}else if(url.indexOf('drivers/desktop') > 0){
id = desktopId;
}
return id;
}
/**
* This method will find the parameter named fieldText and
* append additionalFieldText to it and modify the original
* URL with the new overall fieldText
*
* @param url
* @param additionalFieldText
* @returns
*/
function addFieldTextConditionToURL(url, additionalFieldText, filterId){
if(url.indexOf('}:NAVIGATIONPATH') == -1){
}
}
return finalUrl;
}
/**
* Remove fieldText param of navigation
* path. For any search other than
* SWD Type Ahead
* @param url
* @returns
*/
function removeFieldTextCondition(url){
var i = url.indexOf(fieldTextParamString);
var j = url.indexOf(fieldTextParamNavigation);
j = j + fieldTextParamNavigation.length;
/******************************************************************************
* NAME
* assetConversionIntegration.js
*
* DESCRIPTION
* Has functions which can convert a potential Samsung product's
* product or serial number into equivalent HP product number
* or serial number, and vice-versa.
*
*
*****************************************************************************/
/**
* Converts HP product number to Samsung
* and vice-versa using CAL
*
* @author arka.sinha@hp.com
*
*/
function convertProductNumber(productNumberRequest, callback){
// Check if it is an HP asset
if(productNumberRequest.productNumber == data.hpProductNumber){
// Not an HP asset
responseData.isHPAsset = false;
}
// no match found
responseData.isMatchFound = false;
}
console.log(responseData);
populateSSID();
callback(productNumberRequest,responseData);
},
error : function(e) {
function getSSIDForAssetConv(type){
var secureTokenVal = $('#secureTokenField').val(); //retrieve string in which
key is stored
var tokenId;
if(type == "product"){
tokenId = $('#samsungProductBtn').attr("token");
if(tokenId == null){
tokenId = $('#hpProductBtn').attr("token");
}
}
if(type == "serial"){
tokenId = $('#samsungSerialBtn').attr("token");
if(tokenId == null){
tokenId = $('#hpSerialBtn').attr("token");
}
}
var ssidValue = "";
if(secureTokenVal.indexOf(tokenId)!=-1){ //check if the token key is present
in the string of tokens
ssidValue = JSON.parse($("#secureFieldJson").val());
}
return ssidValue[tokenId];
}
/**
* Converts HP serial number to Samsung
* and vice-versa using an external service
*
* @author badal.sharma@hp.com
*
*/
function convertSerialNumber(serialNumberRequest, callback){
// no match found
responseData.isMatchFound = false;
}
console.log(responseData);
populateSSID();
callback(serialNumberRequest,responseData);
},
error : function(e) {
$(".localResults").append(categoryString);
$(".localResultsHolder").text("("+localLength+")");
$(".localResults").css("display","block");
if(isSWDPage()){
//open the first dropdown if length = 1
if(localCategories.length==1){
var panelAnchor = $('.pFinderResults .hp-section-md .panel-
title a')[0];
var panelTitle = $('.pFinderResults .hp-section-md .panel-
title')[0];
var panelCollapse = $('.pFinderResults .hp-section-md .panel-
collapse')[0];
$(panelAnchor).addClass('toggled');
$(panelAnchor).attr("aria-expanded","true");
$(panelTitle).addClass('open');
$(panelCollapse).addClass('in').removeAttr('style');
}
}
if (!(jsonData.pfinder.worldwide.categories[0] == undefined)) {
var globalCategories = jsonData.pfinder.worldwide.categories;
var categoryString = "";
categoriesLength = jsonData.pfinder.worldwide.categories.length +
jsonData.pfinder.local.categories.length ;
if(categoriesLength == 1){
setTimeout(function() {
$(".hp-expand-colapse").trigger("click");
},100);
}
createCategoryListWithSplit = function(categories,categorylistheading) {
var builtString;
var productsLength = getResultCountWithSplit(categories);
builtString = "<div class=\"pFinderCategory\"><div class=\"hp-expandable-
wrapper\">\
<a class=\"hp-expand-colapse rtlTextWrapper\"><span class=\"linkText \"><span
class=\" rtlAlignText \">"
+ categories.category.name + "</span><span class=\"rtlAlignText\"> ("+
productsLength +")\
</span></span><span class=\"expandIcon\"></span></a>\
<div class=\"hp-expandable-section\"><ul class=\" list-wrapper\">";
};
};
getResultCountWithSplit = function(categories){
var len= categories.category.hpiProducts.length +
categories.category.hpeProducts.length;
return len;
};
otherProducts = function(accrodianstring,val,productType,categorylistheading){
if(productType=="hpiProducts")
{
accrodianstring += "<li><h4
class='h4font'>"+categorylistheading.hpiProducts+"</h4></li>";
}
else if(productType=="hpeProducts") {
accrodianstring += "<li><h4
class='h4font'>"+categorylistheading.hpeProducts+"</h4></li>";
}
$.each(val, function(index, obj) {
accrodianstring += "<li><a href='" + obj.product.url + "'>" +
obj.product.productName + "</a></li>"
});
return accrodianstring;
};
paintPFinderResults = function(jsonData) {
var totalResCount = 0;
var globalLength=0;
var localLength=0;
var categoriesLength = 0;
if (!(jsonData.pfinder.local.categories[0] == undefined)) {
$(".localResults").append(categoryString);
$(".localResultsHolder").text("("+localLength+")");
$(".localResults").css("display","block");
$(panelAnchor).addClass('toggled');
$(panelAnchor).attr('aria-expanded',"true");
$(panelTitle).addClass('open');
$(panelCollapse).addClass('in').removeAttr('style');
}
}
if (!(jsonData.pfinder.worldwide.categories[0] == undefined)) {
var globalCategories = jsonData.pfinder.worldwide.categories;
var categoryString = "";
categoriesLength = jsonData.pfinder.worldwide.categories.length +
jsonData.pfinder.local.categories.length ;
if(categoriesLength == 1){
setTimeout(function() {
$(".hp-expand-colapse").trigger("click");
},100);
}
function createCategoryList(categories) {
var builtString;
var productsLength = getResultCount(categories);
builtString = "<div class=\"pFinderCategory\"><div class=\"hp-expandable-
wrapper\">\
<a class=\"hp-expand-colapse rtlTextWrapper\"><span class=\"linkText \"><span
class=\" rtlAlignText \">"
+ categories.category.name + "</span><span class=\"rtlAlignText\"> ("+
productsLength +")\
</span></span><span class=\"expandIcon\"></span></a>\
<div class=\"hp-expandable-section\"><ul class=\" list-wrapper\">";
var productsInCategory = categories.category.products;
$.each(productsInCategory, function(index, obj) {
builtString += "<li><a href='" + obj.product.url + "'>" +
obj.product.productName + "</a></li>"
});
builtString += "</ul></div></div></div>"
return builtString;
}
var builtString;
var productsLength = getResultCount(categories);
function getResultCount(categories){
return categories.category.products.length;
}
pFinderResultClick = function(pOid){
//on click of certain pfinder results populate the value in a form and submit it
instead of redirecting directly
if($('#pFinderClickForm').length>0){
$('#pFinderClickPOid').attr('value',pOid);
$('#pFinderClickForm').submit();
function isSWDPage(){
return true;
/* var pageName = $('#pageIdentifier').val()
if(pageName.indexOf('SWD')==0){
return true;
}
else{
return false;
}*/
}/*
$(document).ready(function() {
autocompleteSR();
});
function autocompleteSR() {
$.ajax({
type: 'POST',
url: "js/searchResult.json",
dataType: 'JSON',
success: function(results) {
paintSearchResults(results);
},
error: function(xml, status, error) {
//$(".hasTypeahead .searching").hide();
}
});
}*/
function paintSearchResults(jsonData) {
JsonData2 = jsonData;
if (!(jsonData.searchResultObjArr == undefined)) {
// searchResultMarkupString = searchResultMarkupString +
createSearchResultMarkup(obj);
});
if(promoIdsArr.length != 0){
globalDataLayer.Search.PromotionIds = promoIdsArr;
}
searchResultMarkupString = "<div
class='promotionResultsContainer'>"+searchResultsPromotion+"</div><div
class='organicResultsContainer'>"+searchResultsOrganic+"</div>";
//console.log("search String: "+searchResultMarkupString);
$("#searchResultsWrapper").append(searchResultMarkupString);
$(".search-result:not(:last)").after("<hr class=\"results-hr\" />");
/*Pagination - Richa */
function parsePaginationJson(pageJson) {
var pageJson2 = pageJson;
var current = pageJson.pagination.current;
var total = pageJson.pagination.total;
var first = pageJson.pagination.first;
var last = pageJson.pagination.last;
var totalCount = pageJson.totalCount;
var searchQueryForDisplay = pageJson.searchQueryForDisplay;
var searchQuery = pageJson.searchQuery;
var actualQuery = pageJson.actualQuery;
var searchResultLink = pageJson.searchResultLink;
var resultsFor = pageJson.foundResultFor;
var facets = pageJson.facets;
var productFacets = pageJson.ProductFacets;
var osFacets = pageJson.OSFacets;
var topicFacets = pageJson.TopicFacets;
var promotionList = pageJson.promotionList;
$("#promotionList").val(JSON.stringify(promotionList));
$("#searchResultsWrapper").html("");
var seoFriendlyName = pageJson.searchResults.seoFriendlyName;
$("#seoFriendlyName").val(seoFriendlyName);
paintPaginationSection(first,last,current,total);
paintSearchResults(pageJson.searchResults);
paintCountQuery(totalCount,searchQueryForDisplay,actualQuery,searchResultLink,searc
hQuery,resultsFor);
$(".searchSectionWrapper").show();
function nonEnglishLocale(){
$(".englishResults").on("click tap",function (event){
searchlc = "en";
var count = $($(".resultsCount2")[0]).text();
$("#storeResultCount").val(count);
englishResultsAjax(searchlc);
});
$(".localeResults").on("click tap",function (event){
searchlc = getCCLC(lc);
$("#storeResultCount").val("");
localResultsAjax(searchlc);
});
}
//$("#resultsInLc").addClass("hide");
if(pageJson.totalCount>0){
parsePaginationJson(pageJson);
resultsEnglishJson();
}
else{
noResultsEnglishJson();
}
}
function parsePaginationJsonLocale(pageJson) {
parsePaginationJson(pageJson);
//$("#resultsInLc").removeClass("hide");
$(".optionsResultsInLc").removeClass("hide");
$(".englishResults").removeClass("hide");
$(".localeResults").addClass("hide");
$(".resultsInEng").addClass("hide");
$(".englishLocale").addClass("hide");
$("#resultCurrentLocale").removeClass("hide");
$(".resultsInLocal").removeClass("locale-results");
$("#nonUSLocaleSecondView").html("");
$(".searchForNonENLocale").clone().appendTo("#nonUSLocaleSecondView");
$(".resultsColor").addClass("color-black");
$("#searchProdInfo").removeClass("hide");
nonEnglishLocale();
}
function resultsEnglishJson()
{
$(".optionsResultsInLc").addClass("hide");
$(".englishResults").addClass("hide");
$(".localeResults").removeClass("hide");
$(".resultsInEng").removeClass("hide");
$(".englishLocale").removeClass("hide");
$("#resultCurrentLocale").addClass("hide");
$("#nonUSLocaleSecondView").html("");
$(".searchForNonENLocale").clone().appendTo("#nonUSLocaleSecondView");
$(".resultsInLocal").addClass("locale-results");
$(".resultsColor").removeClass("color-black");
$("#searchProdInfo").addClass("hide");
nonEnglishLocale();
function noResultsEnglishJson()
{
$(".noEnglishResults").removeClass("hide");
$(".optionsResultsInLc").addClass("hide");
$(".englishResults").addClass("hide");
$("#nonUSLocaleSecondView").html("");
$(".searchForNonENLocale").clone().appendTo("#nonUSLocaleSecondView");
nonEnglishLocale();
function
paintCountQuery(totalCount,searchQueryForDisplay,actualQuery,searchResultLink,searc
hQuery,resultsFor) {
// populate 1.total count, 2,search query - user enters and 3.actual query -
search query if search query is misspelled.
globalDataLayer.Search.setValue('Count',totalCount);
$(window).trigger('SearchCount',{ SearchCount : totalCount });
$('.resultsCount1').html(totalCount);
var totalCountLocal = $("#storeResultCount").val();
if(totalCountLocal!= undefined && totalCountLocal!=totalCount &&
totalCountLocal!=""){
$('.resultsCount2').html(totalCountLocal);
}
else{
$('.resultsCount2').html(totalCount);
}
$('.resultsCount3').html(totalCount);
function paintPaginationSection(first,last,current,total) {
// clear the existing pages and remove disabled class from button.
$('.pagination-container ul.pagination-pages').html('');
enableDisablePageButton('enable');
$('ul.pagination-pages li').on('click',function() {
if(!($(this).find('a').hasClass('active'))) {
var current = $(this).find('a .pageCount').html();
var currentNum = parseInt(current);
pagination(currentNum);
}
});
}
function pagination(pageNum) {
var ajaxParam = facetsPaginationParams(pageNum);
var requestJson = JSON.stringify(ajaxParam.paramData);
var pageURL = $('#paginationURL').val();
callAjaxUtil("pagination",pageURL,"POST",parsePaginationJson,"JSON",
requestJson,
null,null,null,true,handleLoadingResult,true,handleLoadingResult,false);
}
function pageButtonHandle(buttonVal) {
var current = $('ul.pagination-pages li a.active .pageCount').html();
var currentNum = parseInt(current);
if(buttonVal == "less") {
pagination(currentNum-1);
}else if(buttonVal == "more") {
pagination(currentNum+1);
}
}
//this function is called on beforesend and complete of ajax call for pagination
function handleLoadingResult(showOrHide) {
// showOrHide will be true for beforesend and false for complete
if(showOrHide == true) {
$('.hp-loading-results').show();
} else {
$('.hp-loading-results').hide();
$(window).scrollTop(0);
$("#searchResultsWrapper").find("a")[0].focus(); // This is to take the
focus to the first result.
}
}
function enableDisablePageButton(enableDisable,buttonName) {
if(enableDisable == 'disable') {
if(buttonName == 'less') {
$('.pagination-button.pagination-
less').attr('disabled','disabled');
$('.pagination-button.pagination-less').css('background-
color','#DDD');
} else {
$('.pagination-button.pagination-
more').attr('disabled','disabled');
$('.pagination-button.pagination-more').css('background-
color','#DDD');
}
} else {
// enable less
$('.pagination-button.pagination-less').removeAttr('disabled');
$('.pagination-button.pagination-less').css('background-
color','#FFF');
// enable more
$('.pagination-button.pagination-more').removeAttr('disabled');
$('.pagination-button.pagination-more').css('background-
color','#FFF');
}
function handlePaginationRtl() {
// RTL for pagination buttons - Richa
if($('html').attr('dir') == 'rtl') {
$('.pagination-button.pagination-less i').removeClass('fa fa-chevron-
left').addClass('fa fa-chevron-right');
$('.pagination-button.pagination-more i').removeClass('fa fa-chevron-
right').addClass('fa fa-chevron-left');
}
// RTL for pagination buttons - Richa - end
}
$(document).ready(function() {
hpExpandableInit();
});
function hpExpandableInit() {
$(document).on("click", ".hp-expand-colapse", function() {
$(this).addClass("opened");
$(this).siblings(".hp-expandable-section").slideDown().addClass("opened");
});
$(document).on("click", ".hp-expand-colapse.opened", function() {
$(this).removeClass("opened");
$(this).siblings(".hp-expandable-section").removeClass("opened").slideUp();
});
}
/**
* Protect window.console method calls, e.g. console is not defined on IE
* unless dev tools are open, and IE doesn't define console.debug
*/
(function() {
if (!window.console) {
window.console = {};
}
// union of Chrome, FF, IE, and Safari console methods
var m = [
"log", "info", "warn", "error", "debug", "trace", "dir", "group",
"groupCollapsed", "groupEnd", "time", "timeEnd", "profile", "profileEnd",
"dirxml", "assert", "count", "markTimeline", "timeStamp", "clear"
];
// define undefined methods as noops to prevent errors
for (var i = 0; i < m.length; i++) {
if (!window.console[m[i]]) {
window.console[m[i]] = function() {};
}
}
})();// This plugin is based on the Bootstrap collapse component, with some
extended functionality
// This plugin looks for an element with a data-toggle="collapse"
// The href attr of the toggle will determine which accordion to collapse/expand
// If the toggle element also has a data-group attr, any accordion inside that #id
will collapse, allowing only one to be visiblea at a time
// Also you can pass in a data-scroll boolean on the toggle element, to determine
wether the page will scrollTo the now visible accordion content
//
// This will control any expandable component, including Accordions, Sortable
Table, and Instruction Panels
Accordion = (function(){
var init = function(){
if($('[data-toggle="collapse"]').length){
addHandlers();
}
};
var addHandlers = function(){
$('[data-toggle="collapse"]').on('tap click', checkState);
$('[data-toggle="collapse"]').on('slideDown', slideDown);
$('[data-toggle="collapse"]').on('slideUp', slideUp);
$('.acc-ex-all').on('tap click', expandAll);
$('.acc-coll-all').on('tap click', collapseAll);
};
};
// // ---------------------------------------------- FILTERS-DESKTOP
// // ---------------------------------------------- FILTERS-TRIGGER
// $('.filters').on('scroll', function(e) {
// e.stopPropagation();
// });
// // ---------------------------------------------- FILTERS-MOBILE
// $(this).next('.filter-options-nested').toggleClass('open');
// });
// This component mimics the basic functionality of the bootstrap dropdown
component
Dropdown = (function(){
$('.customDropdown').on('dClose', dClose);
$('.customDropdown').on('dOpen', dOpen);
$(document).on('tap click', clearDropdowns);
$('.customDropdown').on('tap click', function(e){
e.stopPropagation();
});
};
$dropdowns = $('.customDropdown');
if($dropdown.hasClass('open')){
$dropdown.trigger('dClose');
} else {
$dropdowns.not($dropdown).trigger('dClose');
$dropdown.trigger('dOpen');
}
};
var dClose = function(e){
e.stopPropagation();
$this = $(this);
$this.removeClass('open');
};
return {
init: init
};
}());// This is placeholder code to demonstrate filter functionality
// It basically adds a bunch of handlers to fire mock-AJAX calls and update the
filter breadcrumbs
// This has a dependency on iCheck
Filters = (function(){
var filterTitles = {};
var init = function(){
var $inputs = $('.filter-options input[type="checkbox"]');
if($inputs.length){
addHandlers($inputs);
}
};
} else {
$('.'+group).hide();
text = $expander.text();
$expander.text($expander.data('text')).addClass('in');
$expander.data('text',text);
}
};
$filters.removeClass('open');
$('body').removeClass('hp-filter-open');
} else {
$filters.addClass('open');
$('body').addClass('hp-filter-open');
}
};
var $pagContainer,
$contentSelector,
$controls,
controlTriggers,
maxResults,
totalResults;
return {
init: init
};
}());// This is to demonstrate functionality of the dependent select boxes
// whenever a change is made in a parent select box, an ajax call needs to fire
// to pull in the next set of options available
// this is dependant on the fancy select plugin
ajaxSelect = (function(){
//
var init = function(){
// grab all our instances
var $ajaxSelects = $('[data-class="ajax-select"]');
var $fancySelects = $('.fancy-select');
if($ajaxSelects.length){
// add handlers
addHandlers($ajaxSelects, $fancySelects);
// }
// This is a dummy call to hide all the results on one of the tabs in PDP, as
well as hide all the
// dependant select would otherwise not be visible/returned by ther server
yet
var fakeIt = function(){
$('.troubleshoot-results').hide();
// Hide all the selects except the first
$('.dependant-select').each(function(){
$(this).find('.fancy-select.ajax-select').slice(1).hide();
});
// Make it so the first dropdown is expanded by default. omg this is so
ugly why. much bad ux.
$('.dependant-select.open').each(function(){
$(this).find('.fancy-select.ajax-
select').first().children().addClass('open');
});
};
return {
init: init
};
}());
narrowModal = (function(){
var $resultsModal,
$narrowForm;
return {
init: init
};
}());// This is placeholder code for predicitve results in the search bar
// You can see this in action on search.php
// As of current, this functionality will happen if there is a #predictive-results
element
Search = (function(){
// Modukle variables
var $searchInput,
$predictiveList;
// Check if we need to initialize
var init = function(){
$searchInput = $('#search-input.predictive');
$predictiveList = $('#predictive-results');
if($searchInput.length){
addHandlers();
}
};
// add our handlers
var addHandlers = function(){
$searchInput.on('keydown', switchToList);
$searchInput.on('focus', showList);
$predictiveList.on('keydown','a', checkKeymap);
$predictiveList.on('click tap','a', changeValue);
};
// This code will change focus to the list when the user hits the down arrow
var switchToList = function(e){
// Check for down arrow event
if(e.keyCode == 40 && $predictiveList.length){
e.preventDefault();
// Find first li in the list and focus it and add a hover class
// in some browsers, simply focusing an element does not add a hover
state
// so we need to do this manully
$predictiveList.find('li:first a').trigger('focus').addClass('hover');
}
};
var showList = function(e){
// Simple call to show the list
$predictiveList.show();
};
}
// if it is, nothing should happen
return false;
//UP
// Check if parent li is the first element
case 38:
if($(this).parent().is(':first-child')){
$(this).removeClass('hover');
//if it is, focus on the search
$searchInput.focus();
} else {
// if it isnt, then simply iterate up the list
$
(this).removeClass('hover').parent().prev().find('a').focus().addClass('hover');
}
return false;
// Check if 'enter' key is pressed
case 13:
// trigger a click event to select this value
$(this).removeClass('hover');
$(this).trigger('click');
break;
}
};
// this is the function that swaps the value from the list to search bar
var changeValue = function(e){
$searchInput.val($(this).text());
$predictiveList.hide();
};
return {
init: init
};
}());Tooltips = (function(){
});
};
var addTouchHandlers = function(){
$('.badge-tooltip').on('tap click', buildModal);
};
return {
init: init
};
}());CLC = (function(){
return {
init: init
};
}());PSF = (function(){
var $window;
var $footer;
var $psf;
var psfHeight;
function viewport() {
var e = window, a = 'inner';
if (!('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
}
countNotifications();
var psfWidgetVisible=false;
return {
init: init
};
}());// This component handles stickyness in the responsive footer
// Note, the desktop and mobile header use the same markup
Header = function(){
//this limits a function from firing too many times unecessarily, good for
optimization
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function() {
timeout = null;
if (!immediate) func.apply(context, args);
}, wait);
if (immediate && !timeout) func.apply(context, args);
};
};
// This function check our scroll position and positions the header correctly
// Start HP 453
// This function check our scroll position and positions the header correctly
// Depricated: caused buggy input focus when keyboard triggered scroll event on
search.
// var checkPos = debounce(function () {
// if (isMobile()) {
// var windowScroll = $window.scrollTop();
// // if we are past 80 pixels, sticky nav
// if (windowScroll > 80) {
// $header.css({'position': 'fixed', 'top': '0', 'z-index': '999'});
// } else {
// // other wise, make it not sticky
// $header.css({'position': 'absolute'});
// }
// // once we scroll past 80, we want the search bar to pop up, but we
dont want it to happen every time we
// // scroll, so we limit this functionality between 80 and 120px
// // Note: There is a better way to do this, perhaps making use of a
libraries .once() function
// if (windowScroll > 80 && windowScroll < 120) {
// $('.mobile-nav-toggle').removeClass('out');
// $header.find('.mobile-search-toggle').trigger('slideUp'); Leave
the search box open and not attached to scroll for keyboards on mobile that trigger
scroll event.
// }
// } else {
// // if we are not in mobile, ensure header is not sticky
// $header.css({'position': 'relative'});
// }
// }, 10);
$window.scroll(function() {
var st = scrollY(),
changeHeaderAt = 120,
$header = $('.hp-header');
} else {
//pageTitle.show();
$header.removeClass('sticky');
}
});
function scrollY() {
return window.pageYOffset || document.documentElement.scrollTop;
}
// End HP 453
// this function fires on window resize, and makes sure all functionality is
cleared out between layouts
// Not sure why this isnt handled by css classes, surely I had a good reason
var reset = debounce(function(){
// if not in mobile, clear out all applied inline styles and change
placeholder content
//Do not remove - Varun
var typeaheadLeftHookDesktop = "0";
var isDesktop = true;
if(!isMobile()){
$('#hp-search').hasClass('in') && $('.hp-header .hp-
search').css({'display': 'block'});
typeaheadLeftHookDesktop = $(this).parents(".search-
bg").find("#search-dropdown").innerWidth() + 15;
$(this).siblings(".typeaheadHook").val(typeaheadLeftHookDesktop);
$(this).css("padding-left",typeaheadLeftHookDesktop);
$(this).parents(".search-bg").find("#search-dropdown").innerWidth() +
15;
isDesktop=true;
$(this).unbind("blur");
handleGhostScript(jQuery(this));
$(this).on("blur",function(){
$(this).trigger("blurTypeahead");
})
});
$('#psf').appendTo('.fixedWidgets');
typeaheadLeftHookDesktop = $
(this).siblings(".typeaheadHook").val();
$(this).siblings(".typeaheadHook").val("0")
isDesktop = false;
$(this).unbind("blur");
handleGhostScript(jQuery(this));
$(this).on("blur",function(){
$(this).trigger("blurTypeahead");
})
}
});
return {
init: init,
isMobile:isMobile,
viewport:viewport,
debounce:debounce
};
}();/*
Modified by Pavan Kamath
Do not merge
Modified By AA to add accessibility for the page
*/
Tabs = (function(){
var $toggles;
if(modelDetails!=""){
currentURL = currentURL + "/model/" + modelDetails;
}
}
if(identifier == "caseCreation"){
currentURL = window.location.href;
}
window.setTimeout(function () {
window.addEventListener("popstate", function (e) {
checkState();
}, false);
}, 1);
if(tabString.indexOf(urllocation[0])>0){
currentTab = $("#"+urllocation[0]);
if(!currentTab.is(':visible')){
currentTab = $('[data-toggle=tab]:visible').first();
currentTab.attr({"tabindex" : "0"});
}
}
else{
currentTab = $('[data-toggle=tab]:visible').first();
currentTab.attr({"tabindex" : "0"});
}
/*if(urllocation.indexOf('?')>0){
}
else{
currentTab = $("#findSolutions");
}*/
return currentTab;
}
return {
init: init
}
}());
/*$(document).ready(function(){
handleAccessibility();
function handleAccessibility(){
var indexValue = $(".nav.nav-tabs.hp-nav-tabs li").filter(".active").index();
$(".hp-nav-tabs a[data-toggle='tab']").each(function(){
});
$(".tab-pane").on("focusout",function(e){
$(this).attr("tabindex", "-1");
var nextElement = $(".hp-nav-tabs li.active").next();
while($(nextElement).find("a[data-toggle='tab']").css("display")
== "none"){
nextElement = $(nextElement).next();
}
$(nextElement).find("a[data-toggle='tab']").attr("tabindex","0");
$(nextElement).find("a[data-toggle='tab']").focus();
$(".tab-pane").find("a").attr("tabindex","-1");
});
$(".hp-nav-tabs a[data-toggle='tab']").on("focusout",function(e){
if($(this).parent().hasClass("active")){
return;
}
$(this).parent().next().find("a[data-
toggle='tab']").attr("tabindex","0");
$(this).parent().next().find("a[data-toggle='tab']").focus();
});
}
if (keyCode == 9) {
var nextElement = $(".hp-nav-tabs li.active").next();
while($(nextElement).find("a[data-toggle='tab']").css("display")
== "none"){
nextElement = $(nextElement).next();
}
$(nextElement).find("a[data-toggle='tab']").attr("tabindex","0");
}
});
});
*/ //Do not remove the comment //Pratisha
/* $("body").on('keydown keypress keyup', ".nav.nav-tabs.hp-nav-tabs .active",
function(e) {
if (keyCode == 9) {
if($(".tab-pane.hp-row.fade.active").length > 0){
/*e.preventDefault();
// call custom function here
$(".tab-pane.hp-row.fade.active").attr({"tabindex":"0","aria-expanded":true});
}
else{
return false;
}
}
});*/Guided = (function(){
var step = 1;
var step11state = 1;
var timeout;
var init = function(){
if($('#guided').length){
addHandlers();
}
stepsLabel();
};
changeTitle1();
return {
init : init
};
})();DownloadTable = (function(){
var init = function(){
if ($('.download-table').length){
addHandlers();
}
};
var addHandlers = function() {
$('#download-table .swd-dropdown').on('click', swdDropdown);
$('a.accordionTitle').on('click', featuredDriverShow); /*VV*/
};
};
}());$(document).ready(function(){
var set_tab = function(tab_container_id, tab_id){
$('#' + tab_container_id + ' ul li').removeClass('active');
// Remove the #
var current_hash = url.substring(1);
// Split the IDs with comma
var current_hashes = current_hash.split(",");
$.each(current_hashes, function(i, v){
set_tab($('a[rel="'+v+'"]').parent().parent().parent().attr('id'), v);
});
}
}
if (this.options.remote) this.$element.load(this.options.remote)
}
Modal.DEFAULTS = {
backdrop: true
, keyboard: true
, show: true
}
this.$element.trigger(e)
this.isShown = true
this.escape()
this.$element.on('click.dismiss.modal', '[data-dismiss="modal"]',
$.proxy(this.hide, this))
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(document.body) // don't move modals dom position
}
that.$element.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in
.one($.support.transition.end, function () {
that.$element.focus().trigger(e)
})
.emulateTransitionEnd(300) :
that.$element.focus().trigger(e)
})
}
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
this.isShown = false
this.escape()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
.off('click.dismiss.modal')
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.focus()
}
}, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.bs.modal')
}
}
Modal.prototype.hideModal = function () {
var that = this
this.$element.hide()
this.backdrop(function () {
that.removeBackdrop()
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove()
this.$backdrop = null
}
Modal.prototype.backdrop = function (callback) {
this.options.backdrop = 'static'
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
this.$backdrop.addClass('in')
if (!callback) return
doAnimate ?
this.$backdrop
.one($.support.transition.end, callback)
.emulateTransitionEnd(150) :
callback()
} else if (callback) {
callback()
}
}
$.fn.modal.Constructor = Modal
// MODAL NO CONFLICT
// =================
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
// MODAL DATA-API
// ==============
e.preventDefault()
$target
.modal(option, this)
.one('hide', function () {
$this.is(':visible') && $this.focus()
})
})
$(document)
.on('show.bs.modal', '.modal', function () { $(document.body).addClass('modal-
open') })
.on('hidden.bs.modal', '.modal', function () { $
(document.body).removeClass('modal-open') })
}(jQuery);
/* ========================================================================
* Bootstrap: transition.js v3.0.2
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd'
, 'MozTransition' : 'transitionend'
, 'OTransition' : 'oTransitionEnd otransitionend'
, 'transition' : 'transitionend'
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false, $el = this
$(this).one($.support.transition.end, function () { called = true })
var callback = function () { if (!called) $
($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
})
}(jQuery);
// Generated by CoffeeScript 1.4.0
(function() {
$.fn.fancySelect = function(opts) {
var isiOS, settings;
if (opts == null) {
opts = {};
}
settings = $.extend({
forceiOS: false,
includeBlank: false,
optionTemplate: function(optionEl) {
return optionEl.text();
},
triggerTemplate: function(optionEl) {
return optionEl.text();
}
}, opts);
isiOS = !!navigator.userAgent.match(/iP(hone|od|ad)/i);
return this.each(function() {
var copyOptionsToList, disabled, options, sel, trigger, updateTriggerText,
wrapper;
sel = $(this);
if (sel.hasClass('fancified') || sel[0].tagName !== 'SELECT') {
return;
}
/*
* @author TYPOWORX <info@typoworx.de>
* Add close on body-click
*/
$('body').on('click', function(e) {
if($('.fancy-select > .trigger').is('.open')) {
if(!$(e.target).is('.trigger') && $(e.target).closest('.fancy-select >
.trigger').length == 0) {
trigger.trigger('close.fs');
}
}
});
sel.addClass('fancified');
sel.css({
width: 1,
height: 1,
display: 'block',
position: 'absolute',
top: 0,
left: 0,
opacity: 0
});
sel.wrap('<div class="fancy-select">');
wrapper = sel.parent();
if (sel.data('class')) {
wrapper.addClass(sel.data('class'));
}
wrapper.append('<div class="trigger">');
if (!(isiOS && !settings.forceiOS)) {
wrapper.append('<ul class="options">');
}
trigger = wrapper.find('.trigger');
options = wrapper.find('.options');
disabled = sel.prop('disabled');
if (disabled) {
wrapper.addClass('disabled');
}
updateTriggerText = function() {
var triggerHtml;
triggerHtml = settings.triggerTemplate(sel.find(':selected'));
return trigger.html(triggerHtml);
};
sel.on('blur.fs', function() {
if (trigger.hasClass('open')) {
return setTimeout(function() {
return trigger.trigger('close.fs');
}, 120);
}
});
trigger.on('close.fs', function() {
trigger.removeClass('open');
return options.removeClass('open');
});
trigger.on('click.fs', function() {
var offParent, parent;
if (!disabled) {
trigger.toggleClass('open');
if (isiOS && !settings.forceiOS) {
if (trigger.hasClass('open')) {
return sel.focus();
}
} else {
if (trigger.hasClass('open')) {
parent = trigger.parent();
offParent = parent.offsetParent();
if ((parent.offset().top + parent.outerHeight() +
options.outerHeight() + 20) > $(window).height() + $(window).scrollTop()) {
options.addClass('overflowing');
} else {
options.removeClass('overflowing');
}
}
options.toggleClass('open');
/*
* @author TYPOWORX <info@typoworx.de>
* Bugfix, don't use will close on scroll!
*/
//if (!isiOS) {
// return sel.focus();
//}
}
}
});
sel.on('enable', function() {
sel.prop('disabled', false);
wrapper.removeClass('disabled');
disabled = false;
return copyOptionsToList();
});
sel.on('disable', function() {
sel.prop('disabled', true);
wrapper.addClass('disabled');
return disabled = true;
});
sel.on('change.fs', function(e) {
if (e.originalEvent && e.originalEvent.isTrusted) {
return e.stopPropagation();
} else {
return updateTriggerText();
}
});
sel.on('keydown', function(e) {
var hovered, newHovered, w;
w = e.which;
hovered = options.find('.hover');
hovered.removeClass('hover');
if (!options.hasClass('open')) {
if (w === 13 || w === 32 || w === 38 || w === 40) {
e.preventDefault();
return trigger.trigger('click.fs');
}
} else {
if (w === 38) {
e.preventDefault();
if (hovered.length && hovered.index() > 0) {
hovered.prev().addClass('hover');
} else {
options.find('li:last-child').addClass('hover');
}
} else if (w === 40) {
e.preventDefault();
if (hovered.length && hovered.index() < options.find('li').length - 1)
{
hovered.next().addClass('hover');
} else {
options.find('li:first-child').addClass('hover');
}
} else if (w === 27) {
e.preventDefault();
trigger.trigger('click.fs');
} else if (w === 13 || w === 32) {
e.preventDefault();
hovered.trigger('click.fs');
} else if (w === 9) {
if (trigger.hasClass('open')) {
trigger.trigger('close.fs');
}
}
newHovered = options.find('.hover');
if (newHovered.length) {
options.scrollTop(0);
return options.scrollTop(newHovered.position().top - 12);
}
}
});
options.on('click.fs', 'li', function(e) {
var clicked;
clicked = $(this);
sel.val(clicked.data('raw-value'));
if (!isiOS) {
sel.trigger('blur.fs').trigger('focus.fs');
}
options.find('.selected').removeClass('selected');
clicked.addClass('selected');
return sel.val(clicked.data('raw-
value')).trigger('change.fs').trigger('blur.fs').trigger('focus.fs');
});
options.on('mouseenter.fs', 'li', function() {
var hovered, nowHovered;
nowHovered = $(this);
hovered = options.find('.hover');
hovered.removeClass('hover');
return nowHovered.addClass('hover');
});
options.on('mouseleave.fs', 'li', function() {
return options.find('.hover').removeClass('hover');
});
copyOptionsToList = function() {
var selOpts;
updateTriggerText();
if (isiOS && !settings.forceiOS) {
return;
}
selOpts = sel.find('option');
return sel.find('option').each(function(i, opt) {
var optHtml;
opt = $(opt);
if (!opt.prop('disabled') && (opt.val() || settings.includeBlank)) {
optHtml = settings.optionTemplate(opt);
if (opt.prop('selected')) {
return options.append("<li data-raw-value=\"" + (opt.val()) + "\"
class=\"selected\">" + optHtml + "</li>");
} else {
return options.append("<li data-raw-value=\"" + (opt.val()) + "\">" +
optHtml + "</li>");
}
}
});
};
sel.on('update.fs', function() {
wrapper.find('.options').empty();
return copyOptionsToList();
});
return copyOptionsToList();
});
};
}).call(this);/**
*
* Version: 0.0.8
* Author: Gianluca Guarini
* Contact: gianluca.guarini@gmail.com
* Website: http://www.gianlucaguarini.com/
* Twitter: @gianlucaguarini
*
* Copyright (c) 2013 Gianluca Guarini
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
**/
(function(doc, win) {
'use strict';
if (typeof doc.createEvent !== 'function') return false; // no touch events
here
// helpers
var useJquery = typeof jQuery !== 'undefined',
isTouch = !!('ontouchstart' in window) &&
navigator.userAgent.indexOf('PhantomJS') < 0,
setListener = function(elm, events, callback) {
var eventsArray = events.split(' '),
i = eventsArray.length;
while (i--) {
elm.addEventListener(eventsArray[i], callback, false);
}
},
getPointerEvent = function(event) {
return event.targetTouches ? event.targetTouches[0] : event;
},
sendEvent = function(elm, eventName, originalEvent, data) {
var customEvent = doc.createEvent('Event');
});
setListener(doc, isTouch ? 'touchend' : 'mouseup', function(e) {
var eventsArr = [],
deltaY = cachedY - currY,
deltaX = cachedX - currX;
touchStarted = false;
if (deltaX <= -swipeTreshold)
eventsArr.push('swiperight');
Tooltip.DEFAULTS = {
animation: true
, placement: 'top'
, selector: false
, template: '<div class="tooltip"><div class="tooltip-arrow"></div><div
class="tooltip-inner"></div></div>'
, trigger: 'hover focus'
, title: ''
, delay: 0
, html: false
, container: false
}
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector,
$.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focus'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'blur'
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: ''
})) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
return options
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
clearTimeout(self.timeout)
self.hoverState = 'out'
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.'+ this.type)
if (e.isDefaultPrevented()) return
this.setContent()
if (this.options.animation) $tip.addClass('fade')
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
this.options.container ? $tip.appendTo(this.options.container) :
$tip.insertAfter(this.$element)
if (autoPlace) {
var $parent = this.$element.parent()
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
this.applyPlacement(calculatedOffset, placement)
this.$element.trigger('shown.bs.' + this.type)
}
}
$tip
.offset(offset)
.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
replace = true
offset.top = offset.top + height - actualHeight
}
if (/bottom|top/.test(placement)) {
var delta = 0
if (offset.left < 0) {
delta = offset.left * -2
offset.left = 0
$tip.offset(offset)
actualWidth = $tip[0].offsetWidth
actualHeight = $tip[0].offsetHeight
}
if (replace) $tip.offset(offset)
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
Tooltip.prototype.hide = function () {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
function complete() {
if (that.hoverState != 'in') $tip.detach()
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function () {
var el = this.$element[0]
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ?
el.getBoundingClientRect() : {
width: el.offsetWidth
, height: el.offsetHeight
}, this.$element.offset())
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.tip = function () {
return this.$tip = this.$tip || $(this.options.template)
}
Tooltip.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')
}
Tooltip.prototype.validate = function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.destroy = function () {
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
}
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);
/**
* jquery.matchHeight.js v0.5.2
* http://brm.io/jquery-match-height/
* License: MIT
*/
(function($) {
$.fn.matchHeight = function(byRow) {
// handle matchHeight('remove')
if (byRow === 'remove') {
var that = this;
return this;
}
if (this.length <= 1)
return this;
// keep track of this group so we can re-apply later on load and resize
events
$.fn.matchHeight._groups.push({
elements: this,
byRow: byRow
});
return this;
};
$that.css({
'display': display,
'padding-top': '0',
'padding-bottom': '0',
'border-top-width': '0',
'border-bottom-width': '0',
'height': '100px'
});
});
return this;
};
/*
* _applyDataApi will apply matchHeight to all elements with a data-match-
height attribute
*/
$.fn.matchHeight._applyDataApi = function() {
var groups = {};
/*
* _update function will re-apply matchHeight to all groups with the correct
options
*/
$.fn.matchHeight._groups = [];
$.fn.matchHeight._throttle = 80;
$.fn.matchHeight._maintainScroll = false;
$.fn.matchHeight._update = function(event) {
// prevent update if fired from a resize event
// where the viewport width hasn't actually changed
// fixes an event looping bug in IE8
if (event && event.type === 'resize') {
var windowWidth = $(window).width();
if (windowWidth === previousResizeWidth)
return;
previousResizeWidth = windowWidth;
}
// throttle updates
if (updateTimeout === -1) {
updateTimeout = setTimeout(function() {
$.each($.fn.matchHeight._groups, function() {
$.fn.matchHeight._apply(this.elements, this.byRow);
});
updateTimeout = -1;
}, $.fn.matchHeight._throttle);
}
};
/*
* bind events
*/
/*
* rows utility function
* returns array of jQuery selections representing each row
* (as displayed after float wrapping applied by browser)
*/
return rows;
};
})(jQuery);/*!
* jQuery Cookie Plugin v1.4.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2006, 2014 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// CommonJS
factory(require('jquery'));
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
function encode(s) {
return config.raw ? s : encodeURIComponent(s);
}
function decode(s) {
return config.raw ? s : decodeURIComponent(s);
}
function stringifyCookieValue(value) {
return encode(config.json ? JSON.stringify(value) : String(value));
}
function parseCookieValue(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape...
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
// Replace server-side written pluses with spaces.
// If we can't decode the cookie, ignore it, it's unusable.
// If we can't parse the cookie, ignore it, it's unusable.
s = decodeURIComponent(s.replace(pluses, ' '));
return config.json ? JSON.parse(s) : s;
} catch(e) {}
}
// Write
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' +
options.expires.toUTCString() : '', // use expires attribute, max-age is not
supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// Read
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling $.cookie().
var cookies = document.cookie ? document.cookie.split('; ') : [];
return result;
};
config.defaults = {};
}));/*!
* jQuery.scrollTo
* Copyright (c) 2007-2014 Ariel Flesler - aflesler<a>gmail<d>com |
http://flesler.blogspot.com
* Licensed under MIT
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* @projectDescription Easy element scrolling using jQuery.
* @author Ariel Flesler
* @version 1.4.13
*/
;(function (define) {
'use strict';
$scrollTo.defaults = {
axis:'xy',
duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1,
limit:true
};
if (!isWin)
return elem;
return /webkit/i.test(navigator.userAgent) ||
doc.compatMode == 'BackCompat' ?
doc.body :
doc.documentElement;
});
};
if (target == 'max')
target = 9e9;
if (settings.queue)
// Let's keep the overall duration
duration /= 2;
settings.offset = both( settings.offset );
settings.over = both( settings.over );
return this._scrollable().each(function() {
// Null target yields nothing, just like jQuery does
if (target == null) return;
attr[key] += offset[pos] || 0;
if(settings.over[pos])
// Scroll to a fraction of its
width/height
attr[key] +=
targ[axis=='x'?'width':'height']() * settings.over[pos];
} else {
var val = targ[pos];
// Handle percentage values
attr[key] = val.slice && val.slice(-1) == '%' ?
parseFloat(val) / 100 * max
: val;
}
// Number or 'number'
if (settings.limit && /^\d+$/.test(attr[key]))
// Check the limits
attr[key] = attr[key] <= 0 ? 0 :
Math.min( attr[key], max );
// Queueing axes
if (!i && settings.queue) {
// Don't waste time animating, if there's no
need.
if (old != attr[key])
// Intermediate animation
animate( settings.onAfterFirst );
// Don't animate this axis again in the next
iteration.
delete attr[key];
}
});
animate( settings.onAfter );
if (!$(elem).is('html,body'))
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
// AMD requirement
return $scrollTo;
})
}(typeof define === 'function' && define.amd ? define : function (deps, factory) {
if (typeof module !== 'undefined' && module.exports) {
// Node
module.exports = factory(require('jquery'));
} else {
factory(jQuery);
}
}));
/* ========================================================================
* Bootstrap: popover.js v3.0.2
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2013 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return this.$arrow = this.$arrow || this.tip().find('.arrow')
}
Popover.prototype.tip = function () {
if (!this.$tip) this.$tip = $(this.options.template)
return this.$tip
}
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);
/*!
*/
!function(e,t,r){t[e]=r}("onDomReady",this,function(e){"use strict";function t(e)
{if(!b){if(!a.body)return i(t);for(b=!0;e=S.shift();)i(e)}}function r(e){(y||
e.type===s||a[c]===u)&&(n(),t())}function n(){y?(a[x](m,r,d),e[x](s,r,d)):(a[g]
(v,r),e[g](h,r))}function i(e,t){setTimeout(e,+t>=0?t:1)}function o(e){b?
i(e):S.push(e)}null==document.readyState&&document.addEventListener&&(document.addE
ventListener("DOMContentLoaded",function E()
{document.removeEventListener("DOMContentLoaded",E,!
1),document.readyState="complete"},!1),document.readyState="loading");var
a=e.document,l=a.documentElement,s="load",d=!
1,h="on"+s,u="complete",c="readyState",f="attachEvent",g="detachEvent",p="addEventL
istener",m="DOMContentLoaded",v="onreadystatechange",x="removeEventListener",y=p in
a,w=d,b=d,S=[];if(a[c]===u)i(t);else if(y)a[p](m,r,d),e[p](s,r,d);else{a[f]
(v,r),e[f](h,r);try{w=null==e.frameElement&&l}catch(C){}w&&w.doScroll&&!function
k(){if(!b){try{w.doScroll("left")}catch(e){return i(k,50)}n(),t()}}()}return
o.version="1.4.0",o.isReady=function(){return b},o}
(this)),document.querySelectorAll||(document.querySelectorAll=function(e){var
t,r=document.createElement("style"),n=[];for(document.documentElement.firstChild.ap
pendChild(r),document._qsa=[],r.styleSheet.cssText=e+"{x-
qsa:expression(document._qsa &&
document._qsa.push(this))}",window.scrollBy(0,0),r.parentNode.removeChild(r);docume
nt._qsa.length;)t=document._qsa.shift(),t.style.removeAttribute("x-
qsa"),n.push(t);return document._qsa=null,n}),document.querySelector||
(document.querySelector=function(e){var t=document.querySelectorAll(e);return
t.length?t[0]:null}),document.getElementsByClassName||
(document.getElementsByClassName=function(e){return
e=String(e).replace(/^|\s+/g,"."),document.querySelectorAll(e)}),Object.keys||
(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on
non-object");var t,r=[];for(t in
e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r}),function(e){var
t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.atob=e.atob
||function(e){e=String(e);var r,n=0,i=[],o=0,a=0;if(e=e.replace(/\s/g,""),e.length
%4===0&&(e=e.replace(/=+$/,"")),e.length%4===1)throw
Error("InvalidCharacterError");if(/[^+/0-9A-Za-z]/.test(e))throw
Error("InvalidCharacterError");for(;n<e.length;)r=t.indexOf(e.charAt(n)),o=o<<6|
r,a+=6,24===a&&(i.push(String.fromCharCode(o>>16&255)),i.push(String.fromCharCode(o
>>8&255)),i.push(String.fromCharCode(255&o)),a=0,o=0),n+=1;return 12===a?
(o>>=4,i.push(String.fromCharCode(255&o))):18===a&&(o>>=2,i.push(String.fromCharCod
e(o>>8&255)),i.push(String.fromCharCode(255&o))),i.join("")},e.btoa=e.btoa||
function(e){e=String(e);var r,n,i,o,a,l,s,d=0,h=[];if(/[^\x00-\xFF]/.test(e))throw
Error("InvalidCharacterError");for(;d<e.length;)r=e.charCodeAt(d+
+),n=e.charCodeAt(d++),i=e.charCodeAt(d++),o=r>>2,a=(3&r)<<4|n>>4,l=(15&n)<<2|
i>>6,s=63&i,d===e.length+2?
(l=64,s=64):d===e.length+1&&(s=64),h.push(t.charAt(o),t.charAt(a),t.charAt(l),t.cha
rAt(s));return h.join("")}}(this),function(){function e(t,r,n){t.document;var
i,o=t.currentStyle[r].match(/([\d\.]+)(%|cm|em|in|mm|pc|pt|)/)||
[0,0,""],a=o[1],l=o[2];return n=n?/%|em/.test(l)&&t.parentElement?
e(t.parentElement,"fontSize",null):16:n,i="fontSize"==r?n:/width/i.test(r)?
t.clientWidth:t.clientHeight,"%"==l?a/100*i:"cm"==l?.3937*a*96:"em"==l?a*n:"in"==l?
96*a:"mm"==l?.3937*a*96/10:"pc"==l?12*a*96/72:"pt"==l?96*a/72:a}function t(e,t){var
r="border"==t?"Width":"",n=t+"Top"+r,i=t+"Right"+r,o=t+"Bottom"+r,a=t+"Left"+r;e[t]
=(e[n]==e[i]&&e[n]==e[o]&&e[n]==e[a]?[e[n]]:e[n]==e[o]&&e[a]==e[i]?
[e[n],e[i]]:e[a]==e[i]?[e[n],e[i],e[o]]:[e[n],e[i],e[o],e[a]]).join(" ")}function
r(r){var n,i=this,o=r.currentStyle,a=e(r,"fontSize"),l=function(e)
{return"-"+e.toLowerCase()};for(n in
o)if(Array.prototype.push.call(i,"styleFloat"==n?"float":n.replace(/[A-
Z]/,l)),"width"==n)i[n]=r.offsetWidth+"px";else
if("height"==n)i[n]=r.offsetHeight+"px";else if("styleFloat"==n)i.float=o[n];else
if(/margin.|padding.|border.+W/.test(n)&&"auto"!=i[n])i[n]=Math.round(e(r,n,a))
+"px";else if(/^outline/.test(n))try{i[n]=o[n]}catch(s)
{i.outlineColor=o.color,i.outlineStyle=i.outlineStyle||"none",i.outlineWidth=i.outl
ineWidth||"0px",i.outline=[i.outlineColor,i.outlineWidth,i.outlineStyle].join("
")}else
i[n]=o[n];t(i,"margin"),t(i,"padding"),t(i,"border"),i.fontSize=Math.round(a)
+"px"}window.getComputedStyle||
(r.prototype={constructor:r,getPropertyPriority:function(){throw new
Error("NotSupportedError: DOM Exception 9")},getPropertyValue:function(e){return
this[e.replace(/-\w/g,function(e){return e[1].toUpperCase()})]},item:function(e)
{return this[e]},removeProperty:function(){throw new
Error("NoModificationAllowedError: DOM Exception 7")},setProperty:function(){throw
new Error("NoModificationAllowedError: DOM Exception
7")},getPropertyCSSValue:function(){throw new Error("NotSupportedError: DOM
Exception
9")}},window.getComputedStyle=Window.prototype.getComputedStyle=function(e){return
new r(e)})}(),Object.prototype.hasOwnProperty||
(Object.prototype.hasOwnProperty=function(e){var t=this.__proto__||
this.constructor.prototype;return e in this&&(!(e in t)||t[e]!
==this[e])}),function(e,t){e.augment=t()}(this,function(){"use strict";var
e=function(){},t=Array.prototype.slice,r=function(r,n){var
i=e.prototype="function"==typeof r?r.prototype:r,o=new
e,a=n.apply(o,t.call(arguments,2).concat(i));if("object"==typeof a)for(var l in
a)o[l]=a[l];if(!o.hasOwnProperty("constructor"))return o;var s=o.constructor;return
s.prototype=o,s};return r.defclass=function(e){var t=e.constructor;return
t.prototype=e,t},r.extend=function(e,t){return r(e,function(e){return
this.uber=e,t})},r}),function(e,t){function r(e,t,r,o){var
a=n(r.substr(r.lastIndexOf(e.domain)),e);a&&i(null,o,a,t)}function n(e,t){for(var
r={theme:p(A.settings.themes.gray,null),stylesheets:t.stylesheets,holderURL:[]},n=!
1,i=String.fromCharCode(11),o=e.replace(/([^\\])\//g,"$1"+i).split(i),a=/%[0-9a-f]
{2}/gi,l=o.length,s=0;l>s;s++){var
d=o[s];if(d.match(a))try{d=decodeURIComponent(d)}catch(h){d=o[s]}var u=!
1;if(A.flags.dimensions.match(d))n=!0,r.dimensions=A.flags.dimensions.output(d),u=!
0;else if(A.flags.fluid.match(d))n=!
0,r.dimensions=A.flags.fluid.output(d),r.fluid=!0,u=!0;else
if(A.flags.textmode.match(d))r.textmode=A.flags.textmode.output(d),u=!0;else
if(A.flags.colors.match(d)){var c=A.flags.colors.output(d);r.theme=p(r.theme,c),u=!
0}else if(t.themes[d])t.themes.hasOwnProperty(d)&&(r.theme=p(t.themes[d],null)),u=!
0;else if(A.flags.font.match(d))r.font=A.flags.font.output(d),u=!0;else
if(A.flags.auto.match(d))r.auto=!0,u=!0;else
if(A.flags.text.match(d))r.text=A.flags.text.output(d),u=!0;else
if(A.flags.random.match(d))
{null==A.vars.cache.themeKeys&&(A.vars.cache.themeKeys=Object.keys(t.themes));var
f=A.vars.cache.themeKeys[0|
Math.random()*A.vars.cache.themeKeys.length];r.theme=p(t.themes[f],null),u=!
0}u&&r.holderURL.push(d)}return
r.holderURL.unshift(t.domain),r.holderURL=r.holderURL.join("/"),n?r:!1}function
i(e,t,r,n){var i=r.dimensions,a=r.theme,l=i.width+"x"+i.height;if(e=null==e?
r.fluid?"fluid":"image":e,null!
=r.text&&(a.text=r.text,"object"===t.nodeName.toLowerCase())){for(var
d=a.text.split("\\n"),u=0;u<d.length;u++)d[u]=b(d[u]);a.text=d.join("\\n")}var
f=r.holderURL,g=p(n,null);r.font&&(a.font=r.font,!
g.noFontFallback&&"img"===t.nodeName.toLowerCase()&&A.setup.supportsCanvas&&"svg"==
=g.renderer&&(g=p(g,
{renderer:"canvas"}))),r.font&&"canvas"==g.renderer&&(g.reRender=!
0),"background"==e?null==t.getAttribute("data-background-src")&&c(t,{"data-
background-src":f}):c(t,{"data-
src":f}),r.theme=a,t.holderData={flags:r,renderSettings:g},
("image"==e||"fluid"==e)&&c(t,{alt:a.text?(a.text.length>16?
a.text.substring(0,16)+"…":a.text)+" ["+l+"]":l}),"image"==e?("html"!
=g.renderer&&r.auto||
(t.style.width=i.width+"px",t.style.height=i.height+"px"),"html"==g.renderer?
t.style.backgroundColor=a.background:(o(e,
{dimensions:i,theme:a,flags:r},t,g),r.textmode&&"exact"==r.textmode&&(A.vars.resiza
bleImages.push(t),s(t)))):"background"==e&&"html"!=g.renderer?o(e,
{dimensions:i,theme:a,flags:r},t,g):"fluid"==e&&("%"==i.height.slice(-1)?
t.style.height=i.height:null!=r.auto&&r.auto||
(t.style.height=i.height+"px"),"%"==i.width.slice(-1)?t.style.width=i.width:null!
=r.auto&&r.auto||(t.style.width=i.width+"px"),
("inline"==t.style.display||""===t.style.display||"none"==t.style.display)&&(t.styl
e.display="block"),h(t),"html"==g.renderer?t.style.backgroundColor=a.background:
(A.vars.resizableImages.push(t),s(t)))}function o(e,t,r,n){function i(){var
e=null;switch(n.renderer)
{case"canvas":e=L(s);break;case"svg":e=O(s,n);break;default:throw"Holder: invalid
renderer: "+n.renderer}return e}var o=null;switch(n.renderer){case"svg":if(!
A.setup.supportsSVG)return;break;case"canvas":if(!
A.setup.supportsCanvas)return;break;default:return}{var
l={width:t.dimensions.width,height:t.dimensions.height,theme:t.theme,flags:t.flags}
,s=a(l);
({text:l.text,width:l.width,height:l.height,textHeight:l.font.size,font:l.font.fami
ly,fontWeight:l.font.weight,template:l.theme})}if(o=i(),null==o)throw"Holder:
couldn't render placeholder";"background"==e?
(r.style.backgroundImage="url("+o+")",r.style.backgroundSize=l.width+"px
"+l.height+"px"):("img"===r.nodeName.toLowerCase()?c(r,
{src:o}):"object"===r.nodeName.toLowerCase()&&(c(r,{data:o}),c(r,
{type:"image/svg+xml"})),n.reRender&&setTimeout(function(){var
e=i();if(null==e)throw"Holder: couldn't render
placeholder";"img"===r.nodeName.toLowerCase()?c(r,
{src:e}):"object"===r.nodeName.toLowerCase()&&(c(r,{data:e}),c(r,
{type:"image/svg+xml"}))},100)),c(r,{"data-holder-rendered":!0})}function a(e)
{function t(e,t,r,n)
{t.width=r,t.height=n,e.width=Math.max(e.width,t.width),e.height+=t.height,e.add(t)
}switch(e.font={family:e.theme.font?e.theme.font:"Arial, Helvetica, Open Sans,
sans-serif",size:l(e.width,e.height,e.theme.size?
e.theme.size:12),weight:e.theme.fontweight?
e.theme.fontweight:"bold"},e.text=e.theme.text?e.theme.text:Math.floor(e.width)
+"x"+Math.floor(e.h
eight),e.flags.textmode)
{case"literal":e.text=e.flags.dimensions.width+"x"+e.flags.dimensions.height;break;
case"exact":if(!
e.flags.exactDimensions)break;e.text=Math.floor(e.flags.exactDimensions.width)
+"x"+Math.floor(e.flags.exactDimensions.height)}var r=new
F({width:e.width,height:e.height}),n=r.Shape,i=new n.Rect("holderBg",
{fill:e.theme.background});i.resize(e.width,e.height),r.root.add(i);var o=new
n.Group("holderTextGroup",
{text:e.text,align:"center",font:e.font,fill:e.theme.foreground});o.moveTo(null,nul
l,1),r.root.add(o);var a=o.textPositionData=T(r);if(!a)throw"Holder: staging
fallback not supported yet.";o.properties.leading=a.boundingBox.height;var
s=null,d=null;if(a.lineCount>1){var
h=0,u=0,c=e.width*A.setup.lineWrapRatio,f=0;d=new n.Group("line"+f);for(var
g=0;g<a.words.length;g++){var p=a.words[g];s=new n.Text(p.text);var
m="\\n"==p.text;(h+p.width>=c||m===!
0)&&(t(o,d,h,o.properties.leading),h=0,u+=o.properties.leading,f+=1,d=new
n.Group("line"+f),d.y=u),m!==!
0&&(s.moveTo(h,0),h+=a.spaceWidth+p.width,d.add(s))}t(o,d,h,o.properties.leading);f
or(var v in o.children)d=o.children[v],d.moveTo((o.width-
d.width)/2,null,null);o.moveTo((e.width-o.width)/2,(e.height-o.height)/2,null),
(e.height-o.height)/2<0&&o.moveTo(null,0,null)}else s=new n.Text(e.text),d=new
n.Group("line0"),d.add(s),o.add(d),o.moveTo((e.width-a.boundingBox.width)/2,
(e.height-a.boundingBox.height)/2,null);return r}function l(e,t,r)
{t=parseInt(t,10),e=parseInt(e,10);var
n=Math.max(t,e),i=Math.min(t,e),o=1/12,a=Math.min(.75*i,.75*n*o);return
Math.round(Math.max(r,a))}function s(e){var t;t=null==e||null==e.nodeType?
A.vars.resizableImages:[e];for(var r in t)if(t.hasOwnProperty(r)){var
n=t[r];if(n.holderData){var i=n.holderData.flags,a=d(n,k.invisibleErrorFn(s));if(a)
{if(i.fluid&&i.auto){var l=n.holderData.fluidConfig;switch(l.mode)
{case"width":a.height=a.width/l.ratio;break;case"height":a.width=a.height*l.ratio}}
var
h={dimensions:a,theme:i.theme,flags:i};i.textmode&&"exact"==i.textmode&&(i.exactDim
ensions=a,h.dimensions=i.dimensions),o("image",h,n,n.holderData.renderSettings)}}}}
function d(e,t){var r={height:e.clientHeight,width:e.clientWidth};return r.height||
r.width?(e.removeAttribute("data-holder-invisible"),r):(c(e,{"data-holder-
invisible":!0}),void t.call(this,e))}function h(e){if(e.holderData){var
t=d(e,k.invisibleErrorFn(h));if(t){var
r=e.holderData.flags,n={fluidHeight:"%"==r.dimensions.height.slice(-
1),fluidWidth:"%"==r.dimensions.width.slice(-
1),mode:null,initialDimensions:t};n.fluidWidth&&!n.fluidHeight?
(n.mode="width",n.ratio=n.initialDimensions.width/parseFloat(r.dimensions.height)):
!
n.fluidWidth&&n.fluidHeight&&(n.mode="height",n.ratio=parseFloat(r.dimensions.width
)/n.initialDimensions.height),e.holderData.fluidConfig=n}}}function u(e,t){return
null==t?E.createElement(e):E.createElementNS(t,e)}function c(e,t){for(var r in
t)e.setAttribute(r,t[r])}function f(e,t,r){if(null==e){e=u("svg",C);var
n=u("defs",C);e.appendChild(n)}return
e.webkitMatchesSelector&&e.setAttribute("xmlns",C),c(e,{width:t,height:r,viewBox:"0
0 "+t+" "+r,preserveAspectRatio:"none"}),e}function g(e,r){if(t.XMLSerializer){{var
n=new
XMLSerializer,i="",o=r.stylesheets;e.querySelector("defs")}if(r.svgXMLStylesheet)
{for(var a=(new DOMParser).parseFromString("<xml />","application/xml"),l=o.length-
1;l>=0;l--){var s=a.createProcessingInstruction("xml-stylesheet",'href="'+o[l]+'"
rel="stylesheet"');a.insertBefore(s,a.firstChild)}var
d=a.createProcessingInstruction("xml",'version="1.0" encoding="UTF-8"
standalone="yes"');a.insertBefore(d,a.firstChild),a.removeChild(a.documentElement),
i=n.serializeToString(a)}var h=n.serializeToString(e);return h=h.replace(/\&
(\#[0-9]{2,}\;)/g,"&$1"),i+h}}function p(e,t){var r={};for(var n in
e)e.hasOwnProperty(n)&&(r[n]=e[n]);if(null!=t)for(var i in
t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r}function m(e){var t=[];for(var r in
e)e.hasOwnProperty(r)&&t.push(r+":"+e[r]);return t.join(";")}function v(e)
{A.vars.debounceTimer||
e.call(this),A.vars.debounceTimer&&clearTimeout(A.vars.debounceTimer),A.vars.deboun
ceTimer=setTimeout(function()
{A.vars.debounceTimer=null,e.call(this)},A.setup.debounce)}function x()
{v(function(){s(null)})}function y(e){var r=null;return"string"==typeof e?
r=E.querySelectorAll(e):t.NodeList&&e instanceof t.NodeList?r=e:t.Node&&e
instanceof t.Node?r=[e]:t.HTMLCollection&&e instanceof t.HTMLCollection?
r=e:null===e&&(r=[]),r}function w(e,t){var r=new Image;r.onerror=function()
{t.call(this,!1,e)},r.onload=function(){t.call(this,!0,e)},r.src=e.src}function
b(e){for(var t=[],r=0,n=e.length-1;n>=0;n--)r=e[n].charCodeAt(),t.unshift(r>128?
["&#",r,";"].join(""):e[n]);return t.join("")}function S(e){return
e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(t)})}var
C="http://www.w3.org/2000/svg",E=t.document,k={addTheme:function(e,t){return null!
=e&&null!=t&&(A.settings.themes[e]=t),delete
A.vars.cache.themeKeys,this},addImage:function(e,t){var
r=E.querySelectorAll(t);if(r.length)for(var n=0,i=r.length;i>n;n++){var
o=u("img");c(o,{"data-src":e}),r[n].appendChild(o)}return this},run:function(e)
{e=e||{};var o={};A.vars.preempted=!0;var a=p(A.settings,e);o.renderer=a.renderer?
a.renderer:A.setup.renderer,-
1===A.setup.renderers.join(",").indexOf(o.renderer)&&(o.renderer=A.setup.supportsSV
G?"svg":A.setup.supportsCanvas?"canvas":"html"),a.use_canvas?
o.renderer="canvas":a.use_svg&&(o.renderer="svg");var
l=y(a.images),s=y(a.bgnodes),d=y(a.stylenodes),h=y(a.objects);o.stylesheets=[],o.sv
gXMLStylesheet=!0,o.noFontFallback=a.noFontFallback?a.noFontFallback:!1;for(var
c=0;c<d.length;c++){var
f=d[c];if(f.attributes.rel&&f.attributes.href&&"stylesheet"==f.attributes.rel.value
){var g=f.attributes.href.value,m=u("a");m.href=g;var
v=m.protocol+"//"+m.host+m.pathname+m.search;o.stylesheets.push(v)}}for(c=0;c<s.len
gth;c++){var x=t.getComputedStyle(s[c],null).getPropertyValue("background-
image"),b=s[c].getAttribute("data-background-src"),S=null;S=null==b?x:b;var
C=null,E="?"+a.domain+"/";if(0===S.indexOf(E))C=S.slice(1);else if(-1!
=S.indexOf(E)){var k=S.substr(S.indexOf(E)).slice(1),T=k.match(/
([^\"]*)"?\)/);null!=T&&(C=T[1])}if(null!=C){var
L=n(C,a);L&&i("background",s[c],L,o)}}for(c=0;c<h.length;c++){var
O=h[c],F={};try{F.data=O.getAttribute("data"),F.dataSrc=O.getAttribute("data-
src")}catch(z){}var M=null!=F.data&&0===F.data.indexOf(a.domain),D=null!
=F.dataSrc&&0===F.dataSrc.indexOf(a.domain);M?
r(a,o,F.data,O):D&&r(a,o,F.dataSrc,O)}for(c=0;c<l.length;c++){var
R=l[c],j={};try{j.src=R.getAttribute("src"),j.dataSrc=R.getAttribute("data-
src"),j.rendered=R.getAttribute("data-holder-rendered")}catch(z){}var B=null!
=j.src,P=null!=j.dataSrc&&0===j.dataSrc.indexOf(a.domain),N=null!
=j.rendered&&"true"==j.rendered;B?0===j.src.indexOf(a.domain)?r(a,o,j.src,R):P&&(N?
r(a,o,j.dataSrc,R):w({src:j.src,options:a,renderSettings:o,dataSrc:j.dataSrc,image:
R},function(e,t){e||
r(t.options,t.renderSettings,t.dataSrc,t.image)})):P&&r(a,o,j.dataSrc,R)}return
this},invisibleErrorFn:function(){return function(e){if(e.hasAttribute("data-
holder-invisible"))throw"Holder: invisible
placeholder"}}};k.add_theme=k.addTheme,k.add_image=k.addImage,k.invisible_error_fn=
k.invisibleErrorFn;var A={settings:
{domain:"holder.js",images:"img",objects:"object",bgnodes:"body
.holderjs",stylenodes:"head link.holderjs",stylesheets:[],themes:{gray:
{background:"#EEEEEE",foreground:"#AAAAAA"},social:
{background:"#3a5a97",foreground:"#FFFFFF"},industrial:
{background:"#434A52",foreground:"#C2F200"},sky:
{background:"#0D8FDB",foreground:"#FFFFFF"},vine:
{background:"#39DBAC",foreground:"#1E292C"},lava:
{background:"#F8591A",foreground:"#1C2846",size:12}}},flags:{dimensions:
{regex:/^(\d+)x(\d+)$/,output:function(e){var t=this.regex.exec(e);return{width:
+t[1],height:+t[2]}}},fluid:{regex:/^([0-9]+%?)x([0-9]+%?)$/,output:function(e){var
t=this.regex.exec(e);return{width:t[1],height:t[2]}}},colors:{regex:/(?:#|\^)([0-
9a-f]{3,})\:(?:#|\^)([0-9a-f]{3,})/i,output:function(e){var
t=this.regex.exec(e);return{foreground:"#"+t[2],background:"#"+t[1]}}},text:
{regex:/text\:(.*)/,output:function(e){return this.regex.exec(e)
[1].replace("\\/","/")}},font:{regex:/font\:(.*)/,output:function(e){return
this.regex.exec(e)[1]}},auto:{regex:/^auto$/},textmode:{regex:/textmode\:
(.*)/,output:function(e){return this.regex.exec(e)[1]}},random:
{regex:/^random$/}}},T=function(){var e=null,t=null,r=null;return function(n){var
i=n.root;if(A.setup.supportsSVG){var o=!1,a=function(e){return
E.createTextNode(e)};null==e&&(o=!
0),e=f(e,i.properties.width,i.properties.height),o&&(t=u("text",C),r=a(null),c(t,
{x:0}),t.appendChild(r),e.appendChild(t),E.body.appendChild(e),e.style.visibility="
hidden",e.style.position="absolute",e.style.top="-100%",e.style.left="-100%");var
l=i.children.holderTextGroup,s=l.properties;c(t,{y:s.font.size,style:m({"font-
weight":s.font.weight,"font-size":s.font.size+"px","font-
family":s.font.family,"dominant-baseline":"middle"})}),r.nodeValue=s.text;var
d=t.getBBox(),h=Math.ceil(d.width/
(i.properties.width*A.setup.lineWrapRatio)),g=s.text.split("
"),p=s.text.match(/\\n/g);h+=null==p?0:p.length,r.nodeValue=s.text.replace(/[ ]
+/g,"");var v=t.getComputedTextLength(),x=d.width-
v,y=Math.round(x/Math.max(1,g.length-1)),w=[];if(h>1){r.nodeValue="";for(var
b=0;b<g.length;b++)if(0!==g[b].length){r.nodeValue=S(g[b]);var
k=t.getBBox();w.push({text:g[b],width:k.width})}}return{spaceWidth:y,lineCount:h,bo
undingBox:d,words:w}}return!1}}(),L=function(){var e=u("canvas"),t=null;return
function(r){null==t&&(t=e.getContext("2d"));var
n=r.root;e.width=A.dpr(n.properties.width),e.height=A.dpr(n.properties.height),t.te
xtBaseline="middle",t.fillStyle=n.children.holderBg.properties.fill,t.fillRect(0,0,
A.dpr(n.children.holderBg.width),A.dpr(n.children.holderBg.height));{var
i=n.children.holderTextGroup;i.properties}t.font=i.properties.font.weight+"
"+A.dpr(i.properties.font.size)+"px "+i.properties.font.family+",
monospace",t.fillStyle=i.properties.fill;for(var
o in i.children){var a=i.children[o];for(var l in a.children){var
s=a.children[l],d=A.dpr(i.x+a.x+s.x),h=A.dpr(i.y+a.y+s.y+i.properties.leading/2);t.
fillText(s.properties.text,d,h)}}return e.toDataURL("image/png")}}(),O=function()
{if(t.XMLSerializer){var e=f(null,0,0),r=u("rect",C);return
e.appendChild(r),function(t,n){var
i=t.root;f(e,i.properties.width,i.properties.height);for(var
o=e.querySelectorAll("g"),a=0;a<o.length;a++)o[a].parentNode.removeChild(o[a]);c(r,
{width:i.children.holderBg.width,height:i.children.holderBg.height,fill:i.children.
holderBg.properties.fill});var
l=i.children.holderTextGroup,s=l.properties,d=u("g",C);e.appendChild(d);for(var h
in l.children){var p=l.children[h];for(var v in p.children){var
x=p.children[v],y=l.x+p.x+x.x,w=l.y+p.y+x.y+l.properties.leading/2,b=u("text",C),S=
E.createTextNode(null);c(b,{x:y,y:w,style:m({fill:s.fill,"font-
weight":s.font.weight,"font-family":s.font.family+", monospace","font-
size":s.font.size+"px","dominant-
baseline":"central"})}),S.nodeValue=x.properties.text,b.appendChild(S),d.appendChil
d(b)}}var
k="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(g(e,n))));return
k}}}(),F=function(e){function t(e,t){for(var r in t)e[r]=t[r];return e}var
r=1,n=augment.defclass({constructor:function(e){r+
+,this.parent=null,this.children={},this.id=r,this.name="n"+r,null!
=e&&(this.name=e),this.x=0,this.y=0,this.z=0,this.width=0,this.height=0},resize:fun
ction(e,t){null!=e&&(this.width=e),null!=t&&(this.height=t)},moveTo:function(e,t,r)
{this.x=null!=e?e:this.x,this.y=null!=t?t:this.y,this.z=null!=r?
r:this.z},add:function(e){var t=e.name;if(null!=this.children[t])throw"SceneGraph:
child with that name already exists:
"+t;this.children[t]=e,e.parent=this}}),i=augment(n,function(t)
{this.constructor=function()
{t.constructor.call(this,"root"),this.properties=e}}),o=augment(n,function(e)
{function r(r,n){if(e.constructor.call(this,r),this.properties={fill:"#000"},null!
=n)t(this.properties,n);else if(null!=r&&"string"!=typeof r)throw"SceneGraph:
invalid node name"}this.Group=augment.extend(this,
{constructor:r,type:"group"}),this.Rect=augment.extend(this,
{constructor:r,type:"rect"}),this.Text=augment.extend(this,{constructor:function(e)
{r.call(this),this.properties.text=e},type:"text"})}),a=new i;return
this.Shape=o,this.root=a,this};for(var z in
A.flags)A.flags.hasOwnProperty(z)&&(A.flags[z].match=function(e){return
e.match(this.regex)});A.setup={renderer:"html",debounce:100,ratio:1,supportsCanvas:
!1,supportsSVG:!1,lineWrapRatio:.9,renderers:
["html","canvas","svg"]},A.dpr=function(e){return
e*A.setup.ratio},A.vars={preempted:!1,resizableImages:[],debounceTimer:null,cache:
{}},function(){var e=1,r=1,n=u("canvas"),i=null;n.getContext&&-1!
=n.toDataURL("image/png").indexOf("data:image/png")&&(A.setup.renderer="canvas",i=n
.getContext("2d"),A.setup.supportsCanvas=!
0),A.setup.supportsCanvas&&(e=t.devicePixelRatio||
1,r=i.webkitBackingStorePixelRatio||i.mozBackingStorePixelRatio||
i.msBackingStorePixelRatio||i.oBackingStorePixelRatio||i.backingStorePixelRatio||
1),A.setup.ratio=e/r,E.createElementNS&&E.createElementNS(C,"svg").createSVGRect&&(
A.setup.renderer="svg",A.setup.supportsSVG=!0)}
(),e(k,"Holder",t),t.onDomReady&&t.onDomReady(function(){A.vars.preempted||
k.run(),t.addEventListener?(t.addEventListener("resize",x,!
1),t.addEventListener("orientationchange",x,!
1)):t.attachEvent("onresize",x),"object"==typeof
t.Turbolinks&&t.document.addEventListener("page:change",function(){k.run()})})}
(function(e,t,r){var n="function"==typeof define&&define.amd;n?
define(e):r[t]=e},this);//window.mobilecheck = function() {
// var check = false;
// (function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|
meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|
iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera
m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|
treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|
6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|
amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|
bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|
cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|
el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|
gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|
ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|
ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|
kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|
lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|
mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|
2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|
wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|
po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|
raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|
1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|
sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|
tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|
vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|
w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|
zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);
// return check;
// console.log(check);
// Don't like this method as much because of some of the overhead. Afraid it's
not scalable going forward. Trying method below.
//}
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() ||
isMobile.Opera() || isMobile.Windows());
} };
// to use: if( isMobile.any() ) do something ;
// if(! isMobile.any() ) do something;
/*!
* iCheck v2.0.0, http://git.io/arlzeA
* ===================================
* Cross-platform checkboxes and radio buttons customization
*
* (c) Damir Sultanov - http://fronteed.com
* MIT Licensed
*/
(function(win, doc, $) {
// default options
var defaults = {
checkedClass: 'checked',
disabledClass: 'disabled',
indeterminateClass: 'indeterminate',
hoverClass: 'hover',
// focusClass: 'focus',
// activeClass: 'active',
// default callbacks
callbacks: {
ifCreated: false
},
// useragent sniffing
var ua = win.navigator.userAgent;
var ie = /MSIE [5-8]/.test(ua) || doc.documentMode < 9;
var operaMini = /Opera Mini/.test(ua);
// classes cache
var baseClass = defaults.classes.base;
var divClass = defaults.classes.div.replace('#', baseClass);
var areaClass = defaults.classes.area.replace('#', baseClass);
var nodeClass = defaults.classes.input.replace('#', baseClass);
var labelClass = defaults.classes.label.replace('#', baseClass);
// default filter
var filter = 'input[type=checkbox],input[type=radio]';
// hashes container
var hashes = {};
// hash recognizer
var recognizer = new RegExp(baseClass + '\\[(.*?)\\]');
// hash extractor
var extract = function(className, matches, value) {
if (!!className) {
matches = recognizer.exec(className);
return value;
};
// choose events
var hoverStart = noMouse ? (isTouch ? touch[0] + touch[1] : pointer[0] +
pointer[3]) : mouse[0] + mouse[3];
var hoverEnd = noMouse ? (isTouch ? touch[0] + touch[2] : pointer[0] +
pointer[4]) : mouse[0] + mouse[4];
var tapStart = noMouse ? (isTouch ? false : pointer[0] + pointer[1]) :
mouse[0] + mouse[1];
var tapEnd = noMouse ? (isTouch ? false : pointer[0] + pointer[2]) : mouse[0]
+ mouse[2];
var hover = !operaMini ? hoverStart + '.i ' + hoverEnd + '.i ' : '';
var tap = !operaMini && tapStart ? tapStart + '.i ' + tapEnd + '.i' : '';
// styles options
var styleTag;
var styleList;
var styleArea = defaults.areaStyle !== false ?
'position:absolute;display:block;content:"";top:#;bottom:#;left:#;right:#;' : 0;
var styleInput = 'position:absolute!;display:block!;outline:none!;' +
(defaults.debug ? '' : 'opacity:0!;z-index:-99!;clip:rect(0 0 0 0)!;');
// styles addition
var style = function(rules, selector, area) {
if (!styleTag) {
// create container
styleTag = doc.createElement('style');
// append to header
(doc.head || doc.getElementsByTagName('head')[0]).appendChild(styleTag);
// webkit hack
if (!win.createPopup) {
styleTag.appendChild(doc.createTextNode(''));
}
// choose selector
if (!selector) {
selector = 'div.' + (area ? areaClass + area + ':after' : divClass + '
input.' + nodeClass);
}
// append styles
if (styleList.addRule) {
styleList.addRule(selector, rules, 0);
} else {
styleList.insertRule(selector + '{' + rules + '}', 0);
}
};
// class toggler
var toggle = function(node, className, status, currentClass, updatedClass,
addClass, removeClass) {
currentClass = node.className;
if (!!currentClass) {
updatedClass = ' ' + currentClass + ' ';
// add class
if (status === 1) {
addClass = className;
// remove class
} else if (status === 0) {
removeClass = className;
// add class
if (!!addClass && updatedClass.indexOf(' ' + addClass + ' ') < 0) {
updatedClass += addClass + ' ';
}
// remove class
if (!!removeClass && ~updatedClass.indexOf(' ' + removeClass + ' ')) {
updatedClass = updatedClass.replace(' ' + removeClass + ' ', ' ');
}
// trim class
updatedClass = updatedClass.replace(/^\s+|\s+$/g, '');
// update class
if (updatedClass !== currentClass) {
node.className = updatedClass;
}
// traces remover
var tidy = function(node, key, trigger, settings, className, parent) {
if (hashes[key]) {
settings = hashes[key];
className = settings.className;
parent = $(closest(node, 'div', className));
// prevent overlapping
if (parent.length) {
// input
$(node).removeClass(nodeClass + ' ' + className).attr('style',
settings.style);
// label
$('label.' + settings.esc).removeClass(labelClass + ' ' + className);
// parent
$(parent).replaceWith($(node));
// callback
if (trigger) {
callback(node, key, trigger);
}
}
// nodes inspector
var inspect = function(object, node, stack, direct, indirect) {
stack = [];
direct = object.length;
// inspect object
while (direct--) {
node = object[direct];
// direct input
if (node.type) {
// indirect input
} else {
node = $(node).find(filter);
indirect = node.length;
while (indirect--) {
stack.push(node[indirect]);
}
}
}
return stack;
};
// parent searcher
var closest = function(node, tag, className, parent) {
while (node && node.nodeType !== 9) {
node = node.parentNode;
return parent;
};
// callbacks farm
var callback = function(node, key, name) {
name = 'if' + name;
// direct callback
if (typeof hashes[key].callbacks[name] == 'function') {
hashes[key].callbacks[name](node, hashes[key]);
}
// indirect callback
if (hashes[key].callbacks[name] !== false) {
$(node).trigger(name);
}
}
};
// selection processor
var process = function(data, options, ajax, silent) {
// get inputs
var elements = inspect(data);
var element = elements.length;
if (~nodeAttrName.indexOf('data-')) {
nodeData[nodeAttrName.substr(5)] = nodeAttrValue;
}
if (nodeAttrName == 'style') {
nodeStyle = nodeAttrValue;
}
nodeAttrCache[nodeAttrName] = nodeAttrValue;
}
nodeDataCache[nodeDataProperty.replace(/checkbox|radio|class|id|
label/g, function(string, position) {
return position === 0 ? string : string.charAt(0).toUpperCase() +
string.slice(1);
})] = nodeAttrValue;
}
// merge options
settings = $.extend({}, defaults, win.icheck, nodeDataCache, options);
if (!hashes[key]) {
keyClass = baseClass + '[' + key + ']';
break;
}
}
// save settings
settings.style = nodeStyle || '';
settings.className = keyClass;
settings.esc = keyClass.replace(/(\[|\])/g, '\\$1');
hashes[key] = settings;
if (labelDirect) {
labels.push(labelDirect);
}
// merge labels
while (labelIndirect.length--) {
label = labelIndirect[labelIndirect.length];
while (labelsLength--) {
label = labels[labelsLength];
labelString = label.className;
labelKey = extract(labelString);
// prepare styler
styler = doc.createElement('div');
while (nodeInheritLength--) {
nodeInheritItem = nodeInherit[nodeInheritLength];
// replace node
node.parentNode.replaceChild(styler, node);
// append node
styler.appendChild(node);
// append additions
if (!!settings.insert) {
$(styler).append(settings.insert);
}
// operate
operate(node, styler, key, 'updated', true, false, ajax);
hashes[key].done = true;
// ifCreated callback
if (!silent) {
callback(node, key, 'Created');
}
}
}
};
// operations center
var operate = function(node, parent, key, method, silent, before, ajax) {
var settings = hashes[key];
var states = {};
var changes = {};
// current states
states.checked = [node.checked, 'Checked', 'Unchecked'];
// methods
if (method == 'updated' || method == 'click') {
changes.checked = before ? !states.checked[0] : states.checked[0];
// "toggle" method
} else {
changes.checked = !states.checked[0];
}
// apply changes
change(node, parent, states, changes, key, settings, method, silent,
before, ajax);
};
// state changer
var change = function(node, parent, states, changes, key, settings, method,
silent, before, ajax, loop) {
var type = node.type;
var typeCapital = type == 'radio' ? 'Radio' : 'Checkbox';
var property;
var value;
var classes;
var inputClass;
var label;
var labelClass = 'LabelClass';
var form;
var radios;
var radiosLength;
var radio;
var radioKey;
var radioStates;
var radioChanges;
var changed;
var toggled;
// check parent
if (!parent) {
parent = closest(node, 'div', settings.className);
}
// detect changes
for (property in changes) {
value = changes[property];
if (property == 'checked') {
toggled = true;
while (radiosLength--) {
radio = radios[radiosLength];
radioKey = extract(radio.className);
// toggle radios
if (node !== radio && hashes[radioKey] &&
hashes[radioKey].checked) {
radioStates = {checked: [true, 'Checked', 'Unchecked']};
radioChanges = {checked: false};
// cache classes
classes = [
settings[property + 'Class'], // 0, example: checkedClass
settings[property + typeCapital + 'Class'], // 1, example:
checkedCheckboxClass
settings[states[property][1] + 'Class'], // 2, example:
uncheckedClass
settings[states[property][1] + typeCapital + 'Class'], // 3,
example: uncheckedCheckboxClass
settings[property + labelClass] // 4, example: checkedLabelClass
];
// value == false
inputClass = [classes[3] || classes[2], classes[1] || classes[0]];
// value == true
if (value) {
inputClass.reverse();
}
while (label.length--) {
toggle(label[label.length], classes[4], value ? 1 : 0);
}
}
// callback
if (!silent || loop) {
callback(node, key, states[property][value ? 1 : 2]); // ifChecked
or ifUnchecked
}
}
}
// additional callbacks
if (!silent || loop) {
if (changed) {
callback(node, key, 'Changed'); // ifChanged
}
if (toggled) {
callback(node, key, 'Toggled'); // ifToggled
}
}
// cursor addition
if (!!settings.cursor && !isMobile) {
// 'pointer' for enabled
if (!settings.disabled && !settings.pointer) {
parent.style.cursor = 'pointer';
settings.pointer = true;
// update settings
hashes[key] = settings;
}
};
// plugin definition
$.fn.icheck = function(options, fire) {
// detect methods
if (/^(checked|unchecked|indeterminate|determinate|disabled|enabled|
updated|toggle|destroy|data|styler)$/.test(options)) {
var items = inspect(this);
var itemsLength = items.length;
if (key) {
// 'data' method
if (options == 'data') {
return hashes[key];
// 'styler' method
} else if (options == 'styler') {
return closest(item, 'div', hashes[key].className);
} else {
if (options == 'destroy') {
tidy(item, key, 'Destroyed');
} else {
operate(item, false, key, options);
}
// callback
if (typeof fire == 'function') {
fire(item);
}
}
}
}
// basic setup
} else if (typeof options == 'object' || !options) {
process(this, options || {});
}
// chain
return this;
};
if (key) {
var emitter = event.type;
var settings = hashes[key];
var className = settings.esc; // escaped class name
var div = self.tagName == 'DIV';
var input;
var target;
var partner;
var activate;
var states = [
['label', settings.activeLabelClass, settings.hoverLabelClass],
['div', settings.activeClass, settings.hoverClass]
];
// reverse array
if (div) {
states.reverse();
}
// active state
if (emitter == tapStart || emitter == tapEnd) {
while (partner.length--) {
toggle(partner[partner.length], states[1][1], emitter == tapStart ?
1 : 0);
}
}
// fast click
if (div && emitter == tapEnd && !!settings.tap && isMobile && isPointer
&& !operaMini) {
activate = true;
}
// hover state
} else if (emitter == hoverStart || emitter == hoverEnd) {
while (partner.length--) {
toggle(partner[partner.length], states[1][2], emitter == hoverStart
? 1 : 0);
}
}
// fast click
if (div && emitter == hoverEnd && !!settings.tap && isMobile && isTouch
&& !operaMini) {
activate = true;
}
// click
} else if (div) {
if (!(isMobile && (isTouch || isPointer)) || !!!settings.tap ||
operaMini) {
activate = true;
}
}
// currentTarget hack
setTimeout(function() {
target = event.currentTarget || {};
if (ie || operaMini) {
input.change();
}
}
}
}, 2);
}
}
// bind input
}).on('click.i change.i focusin.i focusout.i keyup.i keydown.i', 'input.' +
nodeClass, function(event) {
var self = this;
var key = extract(self.className);
if (key) {
var emitter = event.type;
var settings = hashes[key];
var className = settings.esc; // escaped class name
var parent = emitter == 'click' ? false : closest(self, 'div',
settings.className);
var label;
var states;
// click
if (emitter == 'click') {
hashes[key].change = +new Date();
// change
} else if (emitter == 'change') {
// focus state
} else if (~emitter.indexOf('focus')) {
states = [settings.focusClass, settings.focusLabelClass];
while (label.length--) {
toggle(label[label.length], states[1], emitter == 'focusin' ? 1 :
0);
}
}
// keyup
if (emitter == 'keyup') {
// spacebar or arrow
if (self.type == 'checkbox' && event.keyCode == 32 &&
settings.keydown || self.type == 'radio' && !self.checked) {
operate(self, parent, key, 'click', false, true); // 'toggle'
method
}
lastKey = key;
hashes[key].keydown = hashes[lastKey].keydown = false;
// keydown
} else {
lastKey = key;
hashes[key].keydown = true;
}
}
}
// domready
}).ready(function() {
// auto init
if (win.icheck.autoInit) {
$('.' + baseClass).icheck();
}
// auto ajax
if (win.jQuery) {
// apply converter
$.ajaxSetup({
converters: {
'text html': function(data) {
if (win.icheck.autoAjax && body) {
var frame = doc.createElement('iframe'); // create container
var frameData;
// set attributes
if (!ie) {
frame.style = 'display:none';
}
frame.className = 'iframe.icheck-frame';
frame.src ='about:blank';
// setup object
frameData = $(frameData);
// customize inputs
process(frameData.find('.' + baseClass), {}, true);
// extract HTML
frameData = frameData[0];
data = (frameData.body || frameData.getElementsByTagName('body')
[0]).innerHTML;
frameData = null; // prevent memory leaks
}
return data;
}
}
});
}
});
};
// on desktop
$('.search-bg .dropdown-menu li a').on('click', function(e) {
e.preventDefault();
$('.dropdown-toggle .search-category').text($(this).text());
var dynamicDropdownHook = $(this).parents(".search-bg").find("#search-
dropdown").innerWidth() + 15;
if($("html").attr("dir")=="ltr"){
$(this).parents(".search-bg").find(".search-input").css("padding-
left",dynamicDropdownHook).focus(); // Do not remove - VV
$(this).parents(".search-bg").find(".predictive-results").css("left",
dynamicDropdownHook); // Do not remove - VV
if($("body").hasClass("ie10")){ /* Coz- issue in IE10 - search text not
realigning - VV*/
var el=$(this).parents(".search-bg").find(".search-input");
$(el).val($(el).val()+" ");
$(el).val($(el).val().trim());
}
}
else{
$(this).parents(".search-bg").find(".search-input").css("padding-
right",dynamicDropdownHook).focus(); // Do not remove - VV
$(this).parents(".search-bg").find(".predictive-results").css("right",
dynamicDropdownHook); // Do not remove - VV
if($("body").hasClass("ie10")){ /* Coz- issue in IE10 - search text not
realigning - VV*/
var el=$(this).parents(".search-bg").find(".search-input");
$(el).val($(el).val()+" ");
$(el).val($(el).val().trim());
}
}
$(this).parents(".search-
bg").find(".typeaheadHook").val(dynamicDropdownHook); // Do not remove - VV
$('.dropdown-toggle .search-category').val(($(this).attr("data-value")));
$('.search-bg #searchCategory').val(($(this).parent("li").index()));
$(this).parents(".dropdown").removeClass("open");
});
// if the results dropdown is open and the select dropdown is clicked, hide the
results
$('.search-bg .dropdown-toggle').on('click', function() {
$('.predictive-results').hide();
});
// on iOS (Safari), remove the keyboard on active inputs when rotating device so
layout can readjust
if (window.addEventListener) {
window.addEventListener('orientationchange', function() {
$('.modal input, .modal textarea').blur();
});
}
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll >= 300) {
$('#styleguide-sidebar').addClass("affix");
} else {
$('#styleguide-sidebar').removeClass("affix");
}
});
// ---------------------------------------------- IOS FIXES FOR SEARCH HEADER
} else {$('#nav-dev').addClass('active');}
*/
// ---------------------------------------------- ICHECK
if ($('input[name="phone-number"]').length > 0) {
$('input[name="phone"').on('change', function(){
$('input[name="phone-number"]').val($(this).val());
});
}
/* if ($('input[type="tel"]').length > 0) {
$('input[type="tel"]').on('change', function(){
$('input[type="tel"]').val($(this).val());
});
}*/
// ---------------------------------------------- MAKE CONTACT TILES EQUAL HEIGHTS
$('.tile-block').matchHeight();
$('.equalize .column-block').matchHeight();
$('.equalize .gray-block').matchHeight();
$('.modal').on('show.bs.modal',function(e){
modalPos = $(e.currentTarget).offset();
});
$('.modal').on('hidden.bs.modal',function(e){
$('body').scrollTop(modalPos.top-200);
});
*/
/* do not uncomment
$(document).ready(function() {
$('#refine-results-modal').modal('show');
}); */
// --------------------------------------------- PSF
function isIE () {
var userAgent = navigator.userAgent.toLowerCase();
return (userAgent.indexOf('msie') != -1 ||
navigator.appVersion.indexOf('Trident/') > 0) ? true : false;
}
if ((!(window.ActiveXObject) && "ActiveXObject" in window) || isIE()) {
/*$('.psf-link').addClass('psf-link-ie'); Commented by VV */
}
if ($('[data-toggle="tab-box"]').length) {
$('[data-toggle="tab-box"]').click(function(e){
e.preventDefault();
$(this).parent(".nav-tabs ~ li").removeClass('active');
$(this).parent('li').addClass('active');
var tabShow = $(this).attr('href');
$(tabShow).addClass('active');
});
}
$('#ajaxMe').click(function (e) {
e.preventDefault();
$url = $(this).attr('href');
$('#content').load($url, function(html) {
if ( status == "error" ) {
var msg = "Sorry but there was an error: ";
$( "#content" ).html( msg + xhr.status + " " + xhr.statusText );
}
})
});
$('a.show-next').click( function(e) {
e.preventDefault();
var parentSection = $(this).closest("section").attr("id");
$('#'+parentSection).hide();
var next = $(this).attr('href');
$(next).removeClass('hidden');
$("html, body").animate();
return false;
});
} */
// --------------------------------------------HOLDER
Holder.run({
themes: {
"concentraProduct": {
background: "#0096d6",
foreground: "#ffffff",
size: 12
}
},
images: "#placeholder"
});
// ------------------------------------------- Assign ID of url to body for
styling HP-705
jQuery.get(imgURL, function(data) {
// Get the SVG tag, ignore the rest
var $svg = jQuery(data).find('svg');
}, 'xml');
});
// ------------------------------------------- Make Tabs Work differently if not
in vertical alignment
OsSelector.init();
Guided.init();
//do not uncomment, not using this file selfGuided.init();
DownloadTable.init();
// do not uncomment, not usingPdp.init();
});
function paintFacets(productFacets,osFacets,topicFacets) {
// check if there are no facets
if((productFacets == undefined && osFacets == undefined && topicFacets ==
undefined) ||
(JSON.stringify(productFacets)=="{}" && JSON.stringify(osFacets)=="{}"
&& topicFacets.length == 0)) {
hideFacets();
return;
}
// os facets display
if(!$.isEmptyObject(osFacets)) {
paintOSFacets(osFacets);
} else {
$('#osFacets').hide();
}
handleFacetsMobileView();
osPrePopulation();
Filters.init();
}
/* this function will bind click event for clear and clear all links in your
selection section */
function bindClearFacets() {
if ($('.applied-filters-item').length) {
$('.filter-close.icon').on('click', facetsAjax);
$('#filter-clear').on('click', facetsAjax);
}
}
function handleFacetsMobileView() {
$("#filter-close").on("click",function(){$("body").css("overflow","auto");});
$("#filter-trigger").on("click",function(){$
("body").css("overflow","hidden");});
}
for(var count2=0;count2<hierarchyLevel2.length;count2++) {
level2Label = hierarchyLevel2[count2].split('|')[0];
level2Id = hierarchyLevel2[count2].split('|')[1];
$('ul#productFacets'+hierarchyLevel1Ct).append('<li><div
class="checkbox"><label><input class="checkbox" type="checkbox"
onclick="facetsAjax();">'+level2Label+
'</input></label><input type="hidden"
value="'+level2Id+'"></input></label></div></li>');
}
hierarchyLevel1Ct++;
}
$(".show-more").on("click",function() {
if($(".show-more").hasClass('in')) {
$('.hideFacet').css('display','block');
} else {
$('.hideFacet').css('display','none');
}
});
}
/*create markup for os facets */
function paintOSFacets(osFacets) {
var hierarchyLevel1Ct = 0;
for(var hierarchyLevel1 in osFacets) {
var hierarchyLevel2 = osFacets[hierarchyLevel1];
var level2Label, level2Id;
// for upto 5 products
if(hierarchyLevel1Ct<5) {
$('div#osFacets ul.filter-level-1')
.append('<li><label class="expandable"><span></span><a
data-expandable="true" aria-expanded="false"
href="javascript:void(0)">'+hierarchyLevel1+'</a></label><ul
id="OSFacets'+hierarchyLevel1Ct+'" class="filter-options filter-options-
nested"></ul></li>');
}
else {
// for more than 5 records
$('div#osFacets ul.filter-level-1')
.append('<li class="hideFacetOS"><label
class="expandable"><span></span><a data-expandable="true" aria-expanded="false"
href="javascript:void(0)">'+hierarchyLevel1+'</a></label><ul
id="OSFacets'+hierarchyLevel1Ct+'" class="filter-options filter-options-
nested"></ul></li>');
}
for(var count2=0;count2<hierarchyLevel2.length;count2++) {
level2Label = hierarchyLevel2[count2].split('|')[0];
level2Id = hierarchyLevel2[count2].split('|')[1];
$('ul#OSFacets'+hierarchyLevel1Ct).append('<li><div
class="checkbox"><label><input class="checkbox" type="checkbox"
onclick="facetsAjax();">'+level2Label+
'</input></label><input type="hidden"
value="'+level2Id+'"></input></label></div></li>');
}
hierarchyLevel1Ct++;
}
// for more than 5 records, add show more products
if(hierarchyLevel1Ct>5)
$('div#osFacets ul.filter-level-1').append('<li><a
href="javascript:void(0)" class="show-more-OS in" data-more="more-category" data-
text="'+$("#searchLessOS").val()+'">'+$("#searchMoreOS").val()+'</a></li>');
$(".show-more-OS").on("click",function() {
if($(".show-more-OS").hasClass('in')) {
$('.hideFacetOS').css('display','block');
} else {
$('.hideFacetOS').css('display','none');
}
});
}
function facetsSearch() {
var selectedFacetsId, finalSelectedFacet = "", facetVal;
var productsFacets = "Products:";
var osFacets = "OS:";
var topicFacets = "Topics:";
/*var allFacets = $('.icheckbox_flat-blue');
$.each(allFacets,function(count,selectedFacet) {
if($(selectedFacet).hasClass('checked')){
selectedFacetsId = $
(selectedFacet).parent().siblings('input[type="hidden"]').val();
facetVal = ($(selectedFacet).parents('ul.filter-options-
nested').attr('id')) ? $(selectedFacet).parents('ul.filter-options-
nested').attr('id') : 'topicFacets';
if(selectedFacetsId!=undefined) {
if(facetVal.indexOf('product')!=-1)
productsFacets = productsFacets + selectedFacetsId +
',';
else if(facetVal.indexOf('OS')!=-1)
osFacets = osFacets + selectedFacetsId + ',';
else
topicFacets = topicFacets + selectedFacetsId + ',';
}
}
})*/
$.each(allFacets,function(count,selectedFacet) {
if($(selectedFacet).is(':checked')){
selectedFacetsId = $
(selectedFacet).parents('label').siblings('input[type="hidden"]').val();
facetVal = ($(selectedFacet).parents('ul.filter-options-
nested').attr('id')) ? $(selectedFacet).parents('ul.filter-options-
nested').attr('id') : 'topicFacets';
if(selectedFacetsId!=undefined) {
if(facetVal.indexOf('product')!=-1)
productsFacets = productsFacets + selectedFacetsId +
',';
else if(facetVal.indexOf('OS')!=-1)
osFacets = osFacets + selectedFacetsId + ',';
else
topicFacets = topicFacets + selectedFacetsId + ',';
}
}
})
if(productsFacets.indexOf(",")!=-1) {
productsFacets = productsFacets.substring(0,productsFacets.length-1);
finalSelectedFacet = productsFacets + '|';
}
if(osFacets.indexOf(",")!=-1) {
osFacets = osFacets.substring(0,osFacets.length-1);
finalSelectedFacet = finalSelectedFacet + osFacets + '|';
}
if(topicFacets.indexOf(",")!=-1) {
topicFacets = topicFacets.substring(0,topicFacets.length-1);
finalSelectedFacet = finalSelectedFacet + topicFacets + '|';
}
if(finalSelectedFacet!="") {
finalSelectedFacet =
finalSelectedFacet.substring(0,finalSelectedFacet.length-1);
}
return finalSelectedFacet;
}
/*to create params for ajax call for pagination and facets search - Richa*/
function facetsPaginationParams(pageNum) {
ajaxParam.paramData["cc"] = searchcc;
if(noLocalResultsOnLoad){
ajaxParam.paramData["lc"] = "en";
}
else{
ajaxParam.paramData["lc"] = searchlc;
}
ajaxParam.paramData["searchContext"] = $("#searchCategory").val();
ajaxParam.paramData["query"] = $('#searchQuery').val();
ajaxParam.paramData["pageNum"] = pageNum;
ajaxParam.paramData["os"] = osValue;
ajaxParam.paramData["keyword"] = keywordValue;
ajaxParam.paramData["prodCat"] = prodCatValue;
ajaxParam.paramData["contextClass"] = contextClass;
ajaxParam.paramData["contextValue"] = contextValue;
ajaxParam.paramData["searchQueryForDisplay"] = searchQueryForDisplay;
ajaxParam.paramData["CustomHierarchy2"] = facetsSearch();
ajaxParam.paramData["URL"] = location.href;
ajaxParam.paramData["pmNameValue"] = pmNameValue;
ajaxParam.paramData["pmNumberValue"] = pmNumberValue;
ajaxParam.paramData["pmSeriesValue"] = pmSeriesValue;
ajaxParam.paramData["seoFriendlyName"] = $('#seoFriendlyName').val();
ajaxParam.paramData["actualQuery"] = $('#actualQuery').val(); // mis-spelled
query
var promotionList = $('#promotionList').val();
if(promotionList == ""){
ajaxParam.paramData["promotionList"] = null;
}
else{
ajaxParam.paramData["promotionList"] = JSON.parse(promotionList);
}
return ajaxParam;
}
/*called on click of facets - ajax call to reload search and pagination - Richa*/
function facetsAjax() {
var ajaxParam = facetsPaginationParams(1);
var requestJson = JSON.stringify(ajaxParam.paramData);
var pageURL = $('#paginationURL').val();
callAjaxUtil("facets",pageURL,"POST",parsePaginationJson,"JSON", requestJson,
null,null,null,true,handleLoadingResult,true,handleLoadingResult,false);
}
/*called on click of View English results - ajax call to reload search and
pagination - Sushmita*/
function englishResultsAjax(searchLc) {
var ajaxParam = facetsPaginationParams(1);
ajaxParam.paramData["lc"] = searchLc;
var requestJson = JSON.stringify(ajaxParam.paramData);
var pageURL = $('#paginationURL').val();
callAjaxUtil("facets",pageURL,"POST",parsePaginationJsonEnglish,"JSON",
requestJson,
null,null,null,true,handleLoadingResult,true,handleLoadingResult,false);
}
function localResultsAjax(searchLc) {
null,null,null,true,handleLoadingResult,true,handleLoadingResult,false);
}
/* For os facet pre-population which is selected by user from 300 modal popup */
function osPrePopulation() {
var selectedModalVal = $("#interstitialSearchOSL1").val();
if(selectedModalVal!="") {
var allOSFacets = $("#osFacets").find('input[type="hidden"]');
var tobeSelectedFacet, selectedFacetSection;
$.each(allOSFacets, function(index, obj) {
if($(obj).val() == selectedModalVal) {
tobeSelectedFacet = $(obj).parent();
selectedFacetSection = tobeSelectedFacet.parents('.filter-
options-nested');
selectedFacetSection.siblings('.expandable').addClass('selected'); //
changing icon to expanded
}
});
}
}
function osPrePopulateClearFilter() {
$('.filter-options input[type="checkbox"]').not('[data-
filter="all"]').each(function(){
var $input = $(this);
var $filterList = $('.applied-filters');
if($input.prop('checked')){
var $tag = $(document.createElement('li'));
var $button = $(document.createElement('button'));
var parentTitle = $(this).parents('.filter-
category').children('.filter-title').html();
var title;
var categoryList;
$button.addClass('filter-close icon').attr('ref',
$input.attr('class').split(' ').pop());
$tag.text($(this).parents('label').text()).attr('ref',
$input.attr('class').split(' ').pop()).addClass('applied-filters-
item').prepend($button);
if ($('.filter-selected-title[data-selected-title="' +
parentTitle + '"]').length){
$('.filter-selected-title[data-selected-title="' +
parentTitle + '"]').append($tag);
}
else {
title = $(document.createElement('li')).html(parentTitle);
categoryList = $
(document.createElement('ul')).addClass('filter-selected-title').attr('data-
selected-title',parentTitle).append(title).append($tag);
$filterList.append(categoryList);
}
SCF.initElem($tag);
}
$('.applied-filters').show();
});
}
//Document Created on 30/March/2015
//This is to prevent all the portlet's title being read via screen reader.
$('document').ready(function(){
$(".ibmPortalControl").attr("aria-labelledby"," ");
//console.log('aria lablelled');
window.clearInterval(ariaTimer);
}, 1000 );
// $("#search-dropdown")
// .on("click",function(){
// $("#searchDdDivAT.dropdown").toggleClass("open")
// })
// .on("mousedown",function(e){
// if(e.which==1)$("#searchDdDivAT.dropdown").toggleClass("open")
// })
});
// communities link
/*
* commenting this as after code merge, the focus is coming inherently
$( "#navCommunities" ).focus(function() {
});
$( "#navCommunities" ).focusout(function() {
/*
Create dynamic menu item and append to sign in menu
@Param: data:{array} - contain link objects with URL and name attribute
*/
function createDynamicMenu(data) {
if (data) {
var $menuHolder = $("#signInOrEditMob");
for (var item in data) {
var newMenuItem = document.createElement('div');
newMenuItem.className = "mobMenuElement";
newMenuItem.appendChild(createLink(data[item]));
$menuHolder.append(newMenuItem);
}
}
}
/*
Create dynamic anchor element for passed item.
@Param: accept data object with name and url properties
@ return: anchor element
*/
function createLink(item) {
var a = document.createElement('a');
var linkText = document.createTextNode(item.name);
a.appendChild(linkText);
a.href = item.url;
return a;
}
$("document").ready(function(){
paintWelcomeHeader();
// defined in head.jsp
if(signOutMenuOptions && $.parseJSON(signOutMenuOptions)
&& $.parseJSON(signOutMenuOptions).menuOptions){
createDynamicMenu($.parseJSON(signOutMenuOptions).menuOptions);
}
function readCookie(key){
cookieName = key+"=";
cookieArray = document.cookie.split(";");
var numberOfMatch = 0;
for(i=0; i<cookieArray.length; i++){
if(cookieArray[i].indexOf(cookieName) >= 0){
var indexOfEq = cookieArray[i].indexOf("=");
var value = cookieArray[i].substr((indexOfEq+1),
(cookieArray[i].length-1));
numberOfMatch += 1;
if(value !=""){
return value;
}
else{
return null;
}
}
}
if(numberOfMatch == 0){
return null
}
}
// click event for after sign in menu for mobile and desktop
$("#welcomeMessageNew").on("click", function () {
if ($("#profileUtilityMenuMob").is(":visible")){
$("#profileUtilityMenuMob").slideUp("fast");
$(".welcomeOverlay").slideUp();
$("#welcomeUserLink i.hidden-lg").removeClass("icon-
up").addClass("icon-dwn");
$("#welcomeUserLink i.fa-caret-up").removeClass("fa-caret-
up").addClass("fa-caret-down");
$("body").css("overflow", "auto");
}
else{
$("#profileUtilityMenuMob").slideDown("fast");
$("body").animate({ scrollTop: "0px" }, 100);
$("body").animate({ scrollTop: "0px" }, 100, function () {
$(".welcomeOverlay").slideDown();
if ($(window).innerWidth() < 786){ // overflow hidden only
for mobile
$("body").css("overflow", "hidden");
$("#welcomeUserLink i.hidden-lg").removeClass("icon-
dwn").addClass("icon-up");
}
});
$("#welcomeUserLink i.fa-caret-down").removeClass("fa-caret-
down").addClass("fa-caret-up");
}
});
/**
*
*/
function paintWelcomeHeader(){
// $("#welcomeHeader").show();
}
}
$(window).on("load", function(){
if(!isMobileDevice() && screen.width>750) {
handleHoverText("bind");
}
var torontoLaunchedCheck = false;
if(localStorage.torontoChatLaunched == "true"){
torontoLaunchedCheck = true;
}
if(localStorage.torontoSN != undefined) {
handleProductContext("compare");
handleProductContext("save");
}
showHideChatbotWidget(torontoLaunchedCheck, pageIdentifierTorontoCheck,
tmsLevelTorontoCheck);
});
$(document).ready(function(){
if(localStorage.torontoEndTimeStamp != undefined){
//Checking localStorage timestamp
var endStampToronto = parseInt(localStorage.torontoEndTimeStamp);
var currentTimeStamp = new Date().getTime();
if(currentTimeStamp >= endStampToronto){
localStorage.removeItem("torontoChatLaunched");
localStorage.removeItem("expirationTimeWithBuffer");
localStorage.removeItem("torontoConversationId");
localStorage.removeItem("torontoConversationStart");
localStorage.removeItem("torontoChatBotToken");
localStorage.removeItem("dismissPromptFlag");
localStorage.removeItem("torontoProductContext");
localStorage.removeItem("torontoSN");
localStorage.removeItem("torontoPN");
}
}
$(".torontoCloseIcon").on("click", function(){
closeChatWindow();
});
if(localStorage.torontoChatLaunched == "true" ){
if(localStorage.expirationTimeWithBuffer){
startPollingTokenExpiry();
}
}
if(localStorage.torontoChatLaunched == "true"){
globalDataLayer.chatBotAccessed = true;
}
else{
globalDataLayer.chatBotAccessed = false;
}
if(localStorage.torontoConversationId != undefined){
globalDataLayer.conversationId = localStorage.torontoConversationId;
}
var payloadSkeleton = {
"type":"event",
"from":{
"id":"default_userid",
"name":"User"
},
"text":"",
"name":"contextReceived",
"value":{
"state" : {
"botClient" : chatBotClient,
"botSubClient": chatBotSubClient
},
"product":{
"productOid":"",
"countryCode":"",
"languageCode":"",
"productNumber":"",
"serialNumber":"",
"productSeriesOid":""
},
"user":{
"Email":"",
"FirstName":"",
"LastName":"",
"PhoneNumber":""
},
"conversationStart":false,
"GDL":{}
}
};
function loadChatBotIframe(token){
var iframeInstance = $("iframe.torontoChatBotIframe");
var chatBotUrlForIframe;
if(isMobileDevice()) {
chatBotUrlForIframe = chatBotUrlMobile;
} else {
chatBotUrlForIframe = chatBotUrl;
}
// if there are other query strings added to the bot
// iframe URL via SSC (e.g. for debugging)
if(chatBotUrlForIframe.indexOf("?")>=0){
// append a & instead of ?, if needed
if(chatBotUrlForIframe.charAt(chatBotUrlForIframe.length-1)!="&"){
chatBotUrlForIframe = chatBotUrlForIframe.concat("&");
}
}else{
// no query strings added yet
chatBotUrlForIframe = chatBotUrlForIframe.concat("?");
}
// append token
var iframeSrc = chatBotUrlForIframe+"t="+token;
iframeInstance.attr("src", iframeSrc);
}
/**
* @param iframeInstance
*/
function insertChatBotIframe(iframeInstance){
// show a spinner
hideLoadingSpinner();
function hideLoadingSpinner(){
//Hides the loading spinner
console.log("SPINNER HIDDEN");
$(".chatBotLoadingIndicator").fadeOut(200);
}
function showLoadingSpinner(){
hideChatbotUnavailable();
//Shows the loading spinner
console.log("SPINNER SHOWN");
$(".chatBotLoadingIndicator").fadeIn(500);
}
function showChatbotUnavailable(){
$(".chatBotUnavailable").show();
}
function hideChatbotUnavailable(){
$(".chatBotUnavailable").hide();
}
function closeChatWindow(){
$("#torontoChatPage").slideUp(100, function(){
$("#chatbotToronto").slideDown(300, onChatWindowCloseComplete());
});
// R182-70: reset checkTime flag and close the timer
handleTorontoTimer("close");
}
function onChatWindowOpenComplete(){
console.log("Chat Window is OPEN now!");
chatMinimized = false;
$("#openChatForAccessibilityMessage").focus();
function onChatWindowCloseComplete(){
console.log("Chat Window is CLOSED now!");
chatMinimized = true;
$("#chatbotToronto").focus();
handleHoverText("bind");
$("#torontoChatHoverText").addClass("hidden");
}
function showAndUpdateBadge(messageCount){
if(messageCount > 0){
$("#accessibility_number_notification").text(messageCount+$
("#accessibility_message_notification").text());
$(".chatNotificationBadge").text(messageCount);
if(!$(".chatNotificationBadge").is(":visible")){
$(".chatNotificationBadge").show();
}
}
}
function getProductObjForBot(){
var prodObj = {
"productOid": globalDataLayer.Product.supportNameOid,
"countryCode": getCCLC("cc"),
"languageCode": getCCLC("lc"),
"productNumber": $("#skuFromSession").val(),
"serialNumber": $("#serialNumberFromSession").val(),
"productSeriesOid": globalDataLayer.Product.seriesOid
}
return prodObj;
}
function launchChatBot(){
showLoadingSpinner();
console.log("BOT LAUNCHING");
//Gets chat token, and sends the GDL, conversation ID and conversationStart
var launchPayload = $.extend(true, {}, payloadSkeleton);
launchPayload.value.conversationStart = true;
launchPayload.value.product = getProductObjForBot();
launchPayload.value.GDL = globalDataLayer;
$.ajax({
type: 'POST',
url: "/hp-pps-services/bot/authenticatebot",
contentType: "application/json",
dataType: 'json',
data: JSON.stringify(launchPayload)
}).done(function(data){
//on success
var chatSessionInMilliseconds = parseFloat(chatSessionInHours) *
3600000;
/********************MAINTAINING TIMESTAMP TO EXPIRE LOCAL
STORAGE**************************/
var torontoStartStamp = new Date().getTime();
var torontoLaunchSessionEndStamp = parseInt(torontoStartStamp) +
parseInt(chatSessionInMilliseconds); //Keeping localStorage timestamp expiry for
8hrs.
localStorage.torontoStartTimeStamp = torontoStartStamp;
localStorage.torontoEndTimeStamp = torontoLaunchSessionEndStamp;
/**********************************************************************
*********************/
chatOpenedFirstTimeOnPage = false;
localStorage.torontoChatLaunched = true;
localStorage.torontoConversationStart = true;
localStorage.torontoConversationId = data.conversationId;
localStorage.torontoChatBotToken = data.token;
globalDataLayer.conversationId = data.conversationId;
loadChatBotIframe(data.token);
setTokenBuffer(parseInt(data.expires_in));
startPollingTokenExpiry();
}).fail(function(jqXHR, textStatus){
console.log("!!!!!!!!Launch service failed!!!!!!!!!!!");
hideLoadingSpinner();
showChatbotUnavailable();
});
}
function updateBotData(){
showLoadingSpinner();
console.log("UPDATE BOT HAPPENING");
var torontoChatPayload = $.extend(true, {}, payloadSkeleton);
//Ajax call to update bot with GDL, conversation ID and conversationStart
goes here
torontoChatPayload.value.conversationStart = false;
torontoChatPayload.value.product = getProductObjForBot();
torontoChatPayload.value.GDL = globalDataLayer;
$.ajax({
type: 'POST',
url: "/hp-pps-services/bot/sendbotactivity?
token="+localStorage.torontoChatBotToken+"&id="+localStorage.torontoConversationId,
contentType: "application/json",
dataType: 'json',
data: JSON.stringify(torontoChatPayload)
}).done(function(data){
// on success
//Chat has launched because of launchChatBot() hence
localStorage.torontoChatLaunched = true; and localStorage.torontoConversationStart
= true;
//**********************
// globalDataLayer.conversationId = conversationID;
//**********************
chatOpenedFirstTimeOnPage = false;
loadChatBotIframe(localStorage.torontoChatBotToken);
}).fail(function(jqXHR, textStatus){
console.log("!!!!!!!!Update service failed!!!!!!!!!!!");
if($(".torontoChatBotIframe").is(":visible")){
$(".torontoChatBotIframe").addClass("hideChatbot");
}
hideLoadingSpinner();
showChatbotUnavailable();
});
}
function refreshToken(){
//AJAX CALL TO REFRESH TOKEN
$.ajax({
type: 'POST',
url: "/hp-pps-services/bot/refreshchatbottoken?
token="+localStorage.torontoChatBotToken,
contentType: "application/json",
dataType: 'json'
}).done(function(data){
//on success
if(data.token != null && localStorage.torontoChatBotToken !=
data.token){
localStorage.torontoChatBotToken = data.token;
$(".torontoChatBotIframe").addClass("hideChatbot");
$("#torontoChatPrompt").addClass("hideChatbot");
$("#torontoChatHoverText").addClass("hideChatbot");
showLoadingSpinner();
loadChatBotIframe(data.token);
}
if(data.expires_in != null){
setTokenBuffer(parseInt(data.expires_in));
startPollingTokenExpiry();
}
}).fail(function(jqXHR, textStatus){
console.log("!!!!!!!!Refresh Token service failed!!!!!!!!!!!");
hideLoadingSpinner();
showChatbotUnavailable();
});
}
function setTokenBuffer(actualTokenExpiry){
var today = new Date();
var secsFromBegining = today.getTime();
var tokenExpiryWithBuffer = actualTokenExpiry - 120; //in seconds, also
keeping a buffer of 120 sec.
var expirationTime = secsFromBegining + (tokenExpiryWithBuffer*1000);
//milliseconds
localStorage.expirationTimeWithBuffer = expirationTime;
}
function startPollingTokenExpiry(){
var pollingInterval = setInterval(function(){
if(checkForTokenExpiry(localStorage.expirationTimeWithBuffer)){
clearInterval(pollingInterval);
localStorage.removeItem("expirationTimeWithBuffer");
refreshToken();
}
},3000);
}
function checkForTokenExpiry(expirationTime){
var today = new Date();
var secsFromBegining = today.getTime();
if(secsFromBegining >= expirationTime){
//token expired
return true;
}
else{
return false;
}
}
function receiveMessage(event){
if(chatBotUrl.indexOf(event.origin)>-1){
if(event.data == "botReplied"){
botReplied();
// R182-70: reset timer
handleTorontoTimer("reset");
}
else if(event.data == "botStartOver"){
botStartOver();
// R182-70: reset timer
handleTorontoTimer("reset");
}
console.log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++");
console.log(event);
console.log(JSON.stringify(event));
console.log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++");
}
}
function botStartOver(){
console.log("<==========================START OVER
YES==========================>");
console.log("START OVER BOT HAPPENING");
var startOverPayload = $.extend(true, {}, payloadSkeleton);
//Ajax call to update bot with GDL, conversation ID and conversationStart
goes here
startOverPayload.value.conversationStart = true;
startOverPayload.value.product = getProductObjForBot();
startOverPayload.value.GDL = globalDataLayer;
//AJAX CALL TO START OVER
$.ajax({
type: 'POST',
url: "/hp-pps-services/bot/sendbotactivity?
token="+localStorage.torontoChatBotToken+"&id="+localStorage.torontoConversationId,
contentType: "application/json",
dataType: 'json',
data: JSON.stringify(startOverPayload)
}).done(function(data){
// on success
}).fail(function(jqXHR, textStatus){
console.log("!!!!!!!!Start over service failed!!!!!!!!!!!");
$(".torontoChatBotIframe").addClass("hideChatbot");
$("#torontoChatPrompt").addClass("hideChatbot");
$("#torontoChatHoverText").addClass("hideChatbot");
showChatbotUnavailable();
});
}
function fetchProductInformation() {
var currentUrl = window.location.href;
var urlArray = currentUrl.split("/");
var product = {};
if(currentUrl.indexOf("model")>-1) {
// page contextual at product level
product.SN = urlArray[urlArray.length-3];
product.PN = urlArray[urlArray.length-1];
} else {
//lastUrlInfo will be a number in case of page contextual at series
level
var lastUrlInfo = urlArray[urlArray.length-1];
if(isNaN(lastUrlInfo)) {
product.SN = 0;
product.PN = 0;
} else {
product.SN = lastUrlInfo;
product.PN = 0;
}
}
return product;
}
function dismissChatPrompt(event) {
// hide the prompt
$("#torontoChatPrompt").addClass("hidden");
// disable timers
handleProactivePrompt("close");
handleDisableProactivePrompt("close");
//set dismissPromptFlag, so that user is not prompt in the same session
localStorage.dismissPromptFlag = true;
handleHoverText("bind");
if(event) event.stopPropagation();
}
function fetchWCMChatBotMobileImage() {
$.ajax({
type: "GET",
url: "/hp-pps-services/webcontent/image/url",
data:{
"sitearea": "/all-pages/chat-bot",
"component": "image-component"
},
dataType: "json",
beforeSend: function(xhr) {
xhr.setRequestHeader('Content-Type', 'application/json');
}
}).done(function(data){
$("#botMobileImage").attr("src",data);
}).fail(function(jqXHR, textStatus){
console.log("fail - fetch mobile chatbot img from WCM");
$("#botMobileImage").attr("src",$("#botImage").attr("src"));
});
}
function isMobileDevice(){
var mobileDevices = ["Android", "iPad", "iPhone"];
var currentDevice = isMobile.any();
currentDevice = currentDevice == null ? "" : currentDevice[0];
return $.inArray(currentDevice, mobileDevices) != -1;
}
function handleHoverText(state) {
if(state == "bind") {
$("#chatbotToronto").on("mouseenter",function() {
$("#torontoChatHoverText").removeClass("hidden");
dismissChatPrompt();
});
$("#chatbotToronto").on("mouseleave",function() {
$("#torontoChatHoverText").addClass("hidden");
});
$(".pageLevelPlaylist").each(function(index, value){
fetchPlaylist($(this).data("playlist-id"), 4);
});
});
var openVideoModalId = "";
var eventHandlersAttached = false;
$("html").on("click", ".videoContent", function(){
var targetId = $(this).children("a").data("target");
openVideoModalId = targetId.substring(1, targetId.length);
});
$.ajax({
type: 'GET',
url: "/hp-pps-
services/brightcove/accounts/"+accountId+"/playlists/"+playlistId+"/videos",
contentType: "application/json",
dataType: 'json'
}).done(function(data){
// on success
playlistMasterObject[playlistId].perPage = numberOfVideosPerPage;
playlistMasterObject[playlistId].playlistId = playlistId;
playlistMasterObject[playlistId].copyofjsonData = data;
playlistManager(playlistId);
}).fail(function(jqXHR, textStatus){
});
}
function playlistManager(playlistId){
playlistId = parseInt(playlistId);
if(!eventHandlersAttached){
eventHandlersAttached = true;
$('.prev').on('tap click', function(){
var playlistContext = $
(this).parents(".videoPlaylistWrapper").children(".videoPlaylist");
var playlistId = playlistContext.data("playlist-id");
var perPage = parseInt(playlistMasterObject[playlistId].perPage);
var copyofjsonData =
playlistMasterObject[playlistId].copyofjsonData;
var playlistContext = $
(this).parents(".videoPlaylistWrapper").children(".videoPlaylist");
var playlistId = playlistContext.data("playlist-id");
var perPage = parseInt(playlistMasterObject[playlistId].perPage);
var copyofjsonData =
playlistMasterObject[playlistId].copyofjsonData;
var curPage = parseInt($
(this).parents(".paginationText").find(".paginationEndVal").text())/perPage;
var playlistContext = $
(this).parents(".videoPlaylistWrapper").children(".videoPlaylist");
var playlistId = playlistContext.data("playlist-id");
var perPage = parseInt(playlistMasterObject[playlistId].perPage);
var copyofjsonData =
playlistMasterObject[playlistId].copyofjsonData;
var curPage = parseInt($
(this).parents(".paginationText").find(".paginationEndVal").text())/perPage;
videoContainerMainWrapper.find("figcaption").children("span").each
(function () {
if ($(this).text().length > truncVal)
$(this).text($(this).text().substring(0,truncVal) + '...');
});
videoContainerMainWrapper.find('.play').each(function() {
$(".videoContent img").load(function(){
var topPos = ($(".videoContent img").innerHeight()-36)/2;
$('.play').css("top", topPos);
if (null != jsonData)
pageTotalVal = jsonData.length;
else
pageTotalVal = "";
startValLocation.html('1');
endValLocation.html(endVal);
totalValLocation.html(pageTotalVal);
};
var pageTotalVal;
var startValLocation = objectInReference.find('.paginationStartVal');
var endValLocation = objectInReference.find('.paginationEndVal');
var totalValLocation = objectInReference.find('.paginationTotalVal');
if (null != jsonData){
pageTotalVal = jsonData.length;
}
else
pageTotalVal = "";
startValLocation.html(pageStartVal);
endValLocation.html(pageEndVal);
totalValLocation.html(pageTotalVal);
};
if(showall == 'true'){
startonPage =1;
upperLimit = jsonData.length;
videoContainerMainWrapper.find('.pagination-
less').attr('disabled','disabled');
videoContainerMainWrapper.find('.pagination-
less').addClass('disabled');
videoContainerMainWrapper.find('.pagination-
more').attr('disabled','disabled');
videoContainerMainWrapper.find('.pagination-
more').addClass('disabled');
if(parseInt(playlistMasterObject[playlistId].perPage) == 4){
str = str + '<div class="col-lg-6 col-md-12 col-sm-24
videoContent">' + '<a aria-describedby="videoCaption'+i+'" class="modal-trigger"
href="javascript:void(0)" data-toggle="modal" data-backdrop="static" data-
target="#video-modal'+videoId+'">' + '<img style="cursor:
pointer;clear:both;display:block;" src="' + videoPoster + '"><span title=\"play\"
rel=\"\" class=\"play js_video_trigger\"><\/span></a>' + '<figcaption
id="videoCaption'+i+'"><strong> '+videoName+' </strong>
<span>'+videoDescription+'</span> </figcaption></div>';
}
else{
str = str + '<div class="col-lg-8 col-md-12 col-sm-24
videoContent">' + '<a aria-describedby="videoCaption'+i+'" class="modal-trigger"
href="javascript:void(0)" data-toggle="modal" data-backdrop="static" data-
target="#video-modal'+videoId+'">' + '<img style="cursor:
pointer;clear:both;display:block;" src="' + videoPoster + '"><span title=\"play\"
rel=\"\" class=\"play js_video_trigger\"><\/span></a>' + '<figcaption
id="videoCaption'+i+'"><strong> '+videoName+' </strong>
<span>'+videoDescription+'</span> </figcaption></div>';
}
}
videoContainerReference.append(str);
// videoContainerReference.append(modal);
fillPagination(videoContainerMainWrapper.find('containerForPaginationHead'),
perPage, jsonData);
updatePagination(videoContainerMainWrapper.find('containerForPaginationHead'),
jsonData, startonPage, upperLimit);
fillPagination(videoContainerMainWrapper.find('.containerForPaginationFoot'),
perPage, jsonData);
updatePagination(videoContainerMainWrapper.find('.containerForPaginationFoot'),
jsonData, startonPage, upperLimit);
}
response(jsonData, "false", undefined, 1);
}
$(".bcSingleVideoContainer").each(function(index, val){
var actualVideoId = $(this).attr("id");
if(actualVideoId.indexOf(":") >= 0){
$(this).attr("id", $(this).attr("id").replace(":", ""));
}
$(this).attr("data-id", $(this).attr("id"));
fetchVideo($(this).data("id"), actualVideoId);
});
}).fail(function(jqXHR, textStatus){
});
}
$(window).on("load", function(){
if($("#pageIdentifier").val() == "HP Microsite"){
loadBrightcoveScriptForVideos();
}
});
function loadBrightcoveScriptForVideos(){
$("body").append("<script type='text/javascript'
src='"+window.location.protocol+"//players.brightcove.net/"+accountId+"/"+playerId+
"_default/index.min.js'></script>");
}
Handlebars.registerHelper({
getHiddenFieldValues: function(hidden_field_id){
return $("#"+hidden_field_id).val();
}
});
// $("#modalLoginBtn").on("click", loginCallHpsa);
// // })();
if(typeof profileDetails !== 'undefined' && profileDetails){
if(profileDetails.loggedIn == true){
} else {
fetchAllDevices(profileDetails.profileType);
}
if(profileDetails.profileType == "CONSUMER"){
globalDataLayer.customerState = "Personal";
}
else if(profileDetails.profileType == "COMMERCIAL"){
globalDataLayer.customerState = "Business";
}
else{
globalDataLayer.customerState = profileDetails.profileType;
}
if($("#pageIdentifier").val() == "Contact HP - Anonymous"){
var errorCodePresent = false;
var statusCode;
errorCodePresent = (globalDeviceObject.ErrorItem!=
undefined)? true : false;
if(errorCodePresent){
statusCode = globalDeviceObject.ErrorItem.statusCode;
if(statusCode == 'SERVICE_ERROR'){
// go to step 2 directly in case service is
down
showLoggedInView();
}
else{
$('#masterDiv').removeClass('hide');
}
}
// else{
// $('#masterDiv').removeClass('hide');
// }
}
}
else{
globalDataLayer.customerState = "Anonymous";
}
}
else{ //not logged in view
globalDataLayer.customerState = "Anonymous";
if($("#pageIdentifier").val() == "Dashboard"){
paintSessionTimedOutView();
}
else if($("#pageIdentifier").val() == "Add Device") {
window.location.href = "/"+getCCLC("cc")+"-"+getCCLC("lc")
+"/dashboard";
}
else if($("#pageIdentifier").val() == "Contact HP - Anonymous") {
$('#masterDiv').removeClass('hide');
var currentURL = window.location.href;
if(currentURL.indexOf("contact-hp")>-1) {
$(".sign-in-guest").removeClass("hide");
}
}
}
function loginCallHpsa(){
var payload = {
"KeepMeSignedIn": true,
"Credentials": {
"UserName": $("#modalLoginTxt").val(),
"Password": $('#exampleInputPassword1').val(),
"CallerId": "portal"
},
"cc": getCCLC("cc"),
"lc": getCCLC("lc")
};
var $loginModal = $('#login-modal');
//var $signInRegisterLink = $('.signInRegisterLink');
//var $welcomeUserLink = $('#welcomeUserLink');
//var $userNameHeader = $('#userName');
//var $userNameBanner = $('#userNameBanner');
//var $signInBanner = $('#signInBanner');
//var $loggedInUserBanner = $('#loggedInUserBanner');
$.ajax({
type: "POST",
url: "/hp-pps-services/hpsa/login",
data: JSON.stringify(payload),
contentType: "application/json",
dataType: "json"
}).done(function (data) {
console.log('### login success ###', data);
if (data) {
if (data.GetProfile.CustomerProfileObject.FirstName) {
var FirstName =
data.GetProfile.CustomerProfileObject.FirstName;
function fetchProductDetailsGDL(productObj) {
var tmpProductObj ={};
tmpProductObj.audienceType = productObj.AudienceType;
tmpProductObj.productLineCode = productObj.ProductLineCode;
tmpProductObj.productNumber = productObj.ProductNumber;
tmpProductObj.seriesName = productObj.FullSerialNumber; // this field name
says number but its actually giving name
tmpProductObj.productSeriesOID = productObj.ProductSeriesOID;
tmpProductObj.serialNumber = productObj.SerialNumber;
return tmpProductObj;
}
function fetchAllDevices(profileType){
$.ajax({
type: "GET",
cache: false,
url: "/hp-pps-services/hpsa/getAllDevices?cc="+getCCLC("cc")
+"&lc="+getCCLC("lc"),
contentType: "application/json",
dataType: "json"
}).done(function (data) {
globalDeviceObject = data;
var reqArrayForWCMContent = [];
var products = [];
var errorCodePresent = false;
var statusCode;
errorCodePresent = (data.ErrorItem!= undefined)? true : false;
products.push(fetchProductDetailsGDL(data.DeviceList[i].DeviceProperty));
}
paintDeviceView(data);
globalDataLayer.setValue("Template", "Dashboard");
// }
// }
if($("#pageIdentifier").val() == "SWDSelfService" || $
("#pageIdentifier").val() == "Product Home" || $("#pageIdentifier").val() ==
"Contact HP - Anonymous"){
paintDeviceViewLandingPages(data);
}
}).fail(function (jqXHR, textStatus) {
console.log('### fetch Devices failed ###');
// $loginModal.modal('hide');
});
}
function fetchDeviceWCMData(reqArr){
$.ajax({
type: "POST",
url: "/hp-pps-
services/webcontent/getDashboardProductTileIcons/cc/"+getCCLC("cc")
+"/lc/"+getCCLC("lc"),
contentType: "application/json",
data: JSON.stringify(reqArr),
dataType: "json"
}).done(function (data) {
for(var entry in data){
var cardPosition = personalDevicePNSNArr.indexOf(entry);
var paintingObj = {};
paintingObj["cardPosition"] = cardPosition;
paintingObj["contentArr"] = data[entry];
var source = $("#deviceSpecificWCMContentTemplate").html();
var template = Handlebars.compile(source);
// $('.relatedWcmContent-'+entry).html(template(data[entry]));
$('.relatedWcmContent-'+entry).html(template(paintingObj));
}
}).fail(function (jqXHR, textStatus) {
console.log('### fetch WCM Data for Devices failed ###');
// $loginModal.modal('hide');
});
}
function getClientDate(dateFormat){
//dateFormat passed in parameters should be a string
formattedDate = formattedDate
+"-"+formattedDateToday+"-"+dateToday.getFullYear();
return formattedDate;
};
break;
case "mm/dd/yyyy" : {
var formattedDate;
if(dateToday.getMonth() < 9){
formattedDate = "0"+(dateToday.getMonth() + 1);
}
else{
formattedDate = dateToday.getMonth() + 1;
}
formattedDate = formattedDate
+"/"+formattedDateToday+"/"+dateToday.getFullYear();
return formattedDate;
};
break;
case "dd-mm-yyyy" : {
var formattedDate;
if(dateToday.getDate() < 10){
formattedDateToday = "0"+(dateToday.getDate());
}
else{
formattedDateToday = dateToday.getDate();
}
formattedDate = formattedDateToday+"-";
if(dateToday.getMonth() < 9){
formattedDate = formattedDate+"0"+(dateToday.getMonth() +
1);
}
else{
formattedDate = formattedDate+(dateToday.getMonth() + 1);
}
formattedDate = formattedDate+"-"+dateToday.getFullYear();
return formattedDate;
};
break;
case "dd/mm/yyyy" : {
var formattedDate;
if(dateToday.getDate() < 10){
formattedDateToday = "0"+(dateToday.getDate());
}
else{
formattedDateToday = dateToday.getDate();
}
formattedDate = formattedDateToday+"/";
if(dateToday.getMonth() < 9){
formattedDate = formattedDate+"0"+(dateToday.getMonth() +
1);
}
else{
formattedDate = formattedDate+(dateToday.getMonth() + 1);
}
formattedDate = formattedDate+"/"+dateToday.getFullYear();
return formattedDate;
};
break;
case "yyyy-mm-dd" : {
var formattedDate;
formattedDate = dateToday.getFullYear()+"-";
if(dateToday.getMonth() < 9){
formattedDate = formattedDate+"0"+(dateToday.getMonth() +
1);
}
else{
formattedDate = formattedDate+(dateToday.getMonth() + 1);
}
formattedDate = formattedDate+"-"+formattedDateToday;
return formattedDate;
};
break;
case "yyyy/mm/dd" : {
var formattedDate;
formattedDate = dateToday.getFullYear()+"/";
if(dateToday.getMonth() < 9){
formattedDate = formattedDate+"0"+(dateToday.getMonth() +
1);
}
else{
formattedDate = formattedDate+(dateToday.getMonth() + 1);
}
formattedDate = formattedDate+"/"+formattedDateToday;
return formattedDate;
};
break;
case "yyyy-dd-mm" : {
var formattedDate;
formattedDate = dateToday.getFullYear()+"-";
formattedDate = formattedDate+formattedDateToday+"-";
if(dateToday.getMonth() < 9){
formattedDate = formattedDate+"0"+(dateToday.getMonth() +
1);
}
else{
formattedDate = formattedDate+(dateToday.getMonth() + 1);
}
return formattedDate;
};
break;
case "yyyy/dd/mm" : {
var formattedDate;
formattedDate = dateToday.getFullYear()+"/";
formattedDate = formattedDate+formattedDateToday+"/";
if(dateToday.getMonth() < 9){
formattedDate = formattedDate+"0"+(dateToday.getMonth() +
1);
}
else{
formattedDate = formattedDate+(dateToday.getMonth() + 1);
}
return formattedDate;
};
break;
case "mmm dd, yyyy":{
var monthArr = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct", "Nov", "Dec"];
var dd = dateToday.getDate();
if(dd < 10){
dd = "0"+dd;
}
var mmm = monthArr[dateToday.getMonth()];
var yyyy = dateToday.getFullYear();
function checkAndAddDevice(addBtnRef){
var serialNo = $(addBtnRef).data("sno");
var prodNo = $(addBtnRef).data("prodno");
var warrantyDate = $(addBtnRef).data("warrantydate");
// if(!isProductAdded(serialNo)){
var reqPayload = {};
reqPayload.serialNumber = serialNo;
reqPayload.productNumber = prodNo;
reqPayload.warrantyDate = warrantyDate;
addDevice(reqPayload, addDeviceSuccess, addDeviceFail)
// }
}
if(globalDeviceObject.DeviceList[entry].DeviceProperty.SerialNumber ==
serialNo.toUpperCase()){
deviceFound = true; //Serial number present
break;
}
}
if(!deviceFound){
return false;
}
else{
return true;
}
}
}
function addDeviceInfoPostRegistration(){
var serialNumber = localStorage.serialNumber;
var productNumber = localStorage.productNumber;
var productToBeAddedFlag = localStorage.productToBeAddedFlag;
function clearLocalStoragePostRegistration(){
localStorage.removeItem("serialNumber");
localStorage.removeItem("productNumber");
localStorage.removeItem("productToBeAddedFlag");
fetchAllDevices(profileDetails.profileType);
}
customSuccessCallback(addDeviceReqPayload.serialNumber);
}
else if(addDeviceReqPayload.page = "eas"){
customSuccessCallback(addDeviceReqPayload.serialNumber,
addDeviceReqPayload.productNumber);
}
else{
customSuccessCallback();
}
}
}).fail(function (jqXHR, textStatus) {
if(typeof(addDeviceReqPayload.dmdAddition) != "undefined"){
customFailCallback(addDeviceReqPayload.serialNumber);
}
else if(addDeviceReqPayload.page = "eas"){
customSuccessCallback(addDeviceReqPayload.serialNumber,
addDeviceReqPayload.productNumber);
}
else{
customFailCallback();
}
});
}(function(){
if(!i$.isIE){
i$.addOnLoad(function(){
var _1=document.createElement("div");
var _2=ibmCfg.themeConfig.themeWebAppBaseURI;
_1.style.cssText="border:1px solid;border-color:red
green;position:absolute;height:5px;top:-999px;background-
image:url(\""+_2+"/icons/blank.gif\");";
document.body.appendChild(_1);
var _3=null;
try{
_3=document.defaultView.getComputedStyle(_1,"");
}
catch(e){
_3=_1.currentStyle;
}
var _4=_3.backgroundImage;
if((_3.borderTopColor==_3.borderRightColor)||(_4!=null&&(_4=="none"||
_4=="url(invalid-url:)"))){
document.getElementsByTagName("body")[0].className+=" wpthemeImagesOff";
}
document.body.removeChild(_1);
});
}
})();
(function(){
var _1=false;
if(typeof wptheme==="undefined"||!wptheme){
wptheme={};
}
i$.mash(wptheme,{togglePageMode:function(){
return i$.modules.loadDeferred().then(function(){
var _2=i$.fromPath("com.ibm.mashups"),_3=_2?
com.ibm.mashups.builder.model.Factory.getRuntimeModel():null,_4=_2?
com.ibm.mashups.enabler.user.Factory.getUserModel():null,_5=document.getElementsByT
agName("body")[0],_6=function(_7){
if(_2){
com.ibm.mashups.services.ServiceManager.getService("eventService").broadcastEvent("
com.ibm.mashups.builder.changePageMode",_7);
_3.getCurrentPage().setPageMode(_7);
}
i$.fireEvent("wptheme/contextMenu/invalidate/all");
};
if((!_2&&!i$.hasClass(_5,"edit-mode"))||(_2&&_4.getAnonymousMode()!
=com.ibm.mashups.enabler.user.AnonymousMode.ANONYMOUS&&_3.getCurrentPage().getPageM
ode()!="edit")){
_6("edit");
i$.addClass(_5,"edit-mode");
if(!_1){
if(!i$.isIE&&!i$.isOpera&&_2){
window.onbeforeunload=function(){
if(com.ibm.mashups.builder.model.Factory.getRuntimeModel().getCurrentPage().isDirty
()){
return com.ibm.mm.builder.coreWidgetsStrings.I_PAGE_SAVE_WARNING;
}
};
}
_1=true;
}
}else{
_6("view");
i$.removeClass(_5,"edit-mode");
}
},function(_8){
console.log("Error going into edit mode. Most likely a session timeout. Refreshing.
"+_8);
window.location.reload();
});
},mobileGoToSearch:function(id,_9,_a,_b,_c,_d,_e){
var _f=document.getElementById(_c);
var _10=document.getElementById("wpthemeSearchBoxInput");
if(i$.hasClass(_f,_9)){
wptheme.toggleMobileNav(id,_9,_a,_b,_c,_d,_e);
if(_10){
setTimeout(function(){
_10.focus();
},550);
}
}else{
if(_10){
_10.focus();
}
}
},mobileNavResizeBinding:null,mobileNavSideLastExpanded:[],mobileNavSideExpanded:
[],mobileNavSideTogglingRoot:false,resizeMobileNavSide:function(e){
var _11=document.getElementsByTagName("header")[0];
var _12,id;
_12=document.getElementById("wpthemeNavRoot");
if(_12){
_12.style.top=_11.offsetHeight+"px";
_12.style.height=(window.innerHeight-_11.offsetHeight)+"px";
}
for(var i=0;i<wptheme.mobileNavSideExpanded.length;i++){
id=wptheme.mobileNavSideExpanded[i];
id=id.substr(0,id.length-4)+"Subnav";
_12=document.getElementById(id);
if(_12){
_12.style.top=_11.offsetHeight+"px";
_12.style.height=(window.innerHeight-_11.offsetHeight)+"px";
}
}
},animateMobileNavSidePanel:function(_13,_14,_15){
var _16=_13.offsetLeft;
if(ibmCfg.themeConfig.isRTL){
_16=parseInt(_13.style.right);
}
if(this.mobileNavSideTogglingRoot&&_14<_16){
_14=-_13.offsetWidth;
}
var _17=0;
var _18=Math.ceil(Math.abs(_14-_16)/5);
if(_16==_14){
_18=0;
}else{
if(_16>_14){
_18=-_18;
}
}
if(_18>0&&!this.mobileNavSideTogglingRoot){
if(ibmCfg.themeConfig.isRTL){
_13.style.clip="rect(0px,0px,"+_13.offsetHeight+"px,0px)";
}else{
_13.style.clip="rect(0px,"+_13.offsetWidth+"px,"+_13.offsetHeight+"px,"+_13.offsetW
idth+"px)";
}
}
var _19=setInterval(function(){
if(_18>0&&_16+_18>_14){
_18=_14-_16;
}
if(_18<0&&_16+_18<_14){
_18=-(_16-_14);
}
if(_18<0&&!wptheme.mobileNavSideTogglingRoot){
if(ibmCfg.themeConfig.isRTL){
_13.style.clip="rect(0px,"+(_13.offsetWidth-(_17-=_18))
+"px,"+_13.offsetHeight+"px,0px)";
}else{
_13.style.clip="rect(0px,"+_13.offsetWidth+"px,"+_13.offsetHeight+"px,"+(_17-
=_18)+"px)";
}
}
if(_18>0&&!wptheme.mobileNavSideTogglingRoot){
if(ibmCfg.themeConfig.isRTL){
_13.style.clip="rect(0px,"+(_17+=_18)+"px,"+_13.offsetHeight+"px,0px)";
}else{
_13.style.clip="rect(0px,"+_13.offsetWidth+"px,"+_13.offsetHeight+"px,"+
(_13.offsetWidth-(_17+=_18))+"px)";
}
}
if(ibmCfg.themeConfig.isRTL){
_13.style.right=(_16+=_18)+"px";
}else{
_13.style.left=(_16+=_18)+"px";
}
if(_18>0&&_16>=_14||_18<0&&_16<=_14||_18==0){
clearInterval(_19);
_13.style.clip="";
if(_15){
_15.call();
}
}
},1);
},toggleMobileNav:function(id,_1a,_1b,_1c,_1d,_1e,_1f){
var _20=document.getElementById(id);
var _21=document.getElementById("wpthemeNavRootLink");
var _22=document.getElementById(id+"Link");
var _23=document.getElementById(id+"Access");
var _24=document.getElementById(id+"Subnav");
var _25=document.getElementsByTagName("header")[0];
var _26=document.getElementById("layoutContainers");
if(_20){
if(_1f==0){
if(i$.hasClass(_21,"wpthemeNavOpened")){
i$.removeClass(_21,"wpthemeNavOpened");
}else{
i$.addClass(_21,"wpthemeNavOpened");
}
}
if(i$.hasClass(_20,_1a)){
if(id==_1d&&_1e){
this.mobileNavSideTogglingRoot=true;
_20.style.top=_25.offsetHeight+"px";
_20.style.height=(window.innerHeight-_20.offsetTop)+"px";
if(ibmCfg.themeConfig.isRTL){
_20.style.right=(-_20.offsetWidth)+"px";
}else{
_20.style.left=(-_20.offsetWidth)+"px";
}
this.mobileNavResizeBinding=i$.bindDomEvt(window,"resize",this.resizeMobileNavSide)
;
}
i$.removeClass(_20,_1a);
_20.setAttribute("aria-expanded","true");
_22.setAttribute("aria-label",_1c);
_22.title=_23.innerHTML=_1c;
if(id==_1d&&_1e){
_25.style.position="fixed";
_25.style.width="100%";
_26.style.paddingTop=_25.offsetHeight+10+"px";
_25.style.zIndex="9998";
_25.style.top="0px";
this.animateMobileNavSidePanel(_20,0,function(){
if(wptheme.mobileNavSideLastExpanded.length==0){
wptheme.mobileNavSideTogglingRoot=false;
}
});
}
if(_1e){
if(id==_1d){
for(var i=0;i<this.mobileNavSideLastExpanded.length;i++){
document.getElementById(this.mobileNavSideLastExpanded[i]).onclick.call();
}
}else{
this.mobileNavSideExpanded.push(id+"Link");
_22.parentNode.parentNode.parentNode.onclick=_22.onclick;
}
}
if(_24&&_1e){
var _27=document.getElementById(_1d);
var _28=_27.parentNode;
if(_24.parentNode!=_28){
_24=_24.parentNode.removeChild(_24);
_28.appendChild(_24);
}
var _29=Math.min((_1f*70),Math.floor(window.innerWidth-_24.offsetWidth)-1);
_24.style.top=_27.offsetTop+"px";
_24.style.height=(window.innerHeight-_24.offsetTop)+"px";
if(this.mobileNavSideTogglingRoot){
if(ibmCfg.themeConfig.isRTL){
_24.style.right=(-_24.offsetWidth)+"px";
}else{
_24.style.left=(-_24.offsetWidth)+"px";
}
}else{
if(ibmCfg.themeConfig.isRTL){
_24.style.right=(_29-_24.offsetWidth)+"px";
}else{
_24.style.left=(_29-_24.offsetWidth)+"px";
}
}
i$.removeClass(_24,_1a);
this.animateMobileNavSidePanel(_24,_29,function(){
if(wptheme.mobileNavSideTogglingRoot&&id+"Link"==wptheme.mobileNavSideLastExpanded[
wptheme.mobileNavSideLastExpanded.length-1]){
wptheme.mobileNavSideTogglingRoot=false;
}
});
}
}else{
if(_1e){
if(id==_1d){
this.mobileNavSideTogglingRoot=true;
this.mobileNavSideLastExpanded=this.mobileNavSideExpanded.slice(0);
for(var i=this.mobileNavSideExpanded.length-1;i>=0;i--){
document.getElementById(this.mobileNavSideExpanded[i]).onclick.call();
}
}else{
var _2a=id+"Link";
var i=-1;
for(var j=this.mobileNavSideExpanded.length-1;j>=0;j--){
if(this.mobileNavSideExpanded[j]==_2a){
i=j;
break;
}
}
if(i!=-1){
var _2b;
for(var j=this.mobileNavSideExpanded.length-1;j>=i;j--){
_2b=this.mobileNavSideExpanded.pop();
if(_2a!=_2b){
document.getElementById(_2b).onclick.call();
}
}
}
_22.parentNode.parentNode.parentNode.onclick=null;
}
}
if(_24&&_1e){
var _29=_24.offsetLeft;
if(ibmCfg.themeConfig.isRTL){
_29=parseInt(_24.style.right);
}
this.animateMobileNavSidePanel(_24,_29-_24.offsetWidth,function(){
i$.addClass(_24,_1a);
if(_24.parentNode!=_20){
_24=_24.parentNode.removeChild(_24);
_20.appendChild(_24);
}
});
}
if(id==_1d&&_1e){
_25.style.position="static";
_26.style.paddingTop="";
_25.style.width="auto";
_25.style.zIndex="auto";
this.animateMobileNavSidePanel(_20,-_20.offsetWidth,function(){
i$.addClass(_20,_1a);
_20.setAttribute("aria-expanded","false");
_22.setAttribute("aria-label",_1b);
_22.title=_23.innerHTML=_1b;
wptheme.mobileNavSideTogglingRoot=false;
});
i$.unbindDomEvt(this.mobileNavResizeBinding);
this.mobileNavResizeBinding=null;
}else{
i$.addClass(_20,_1a);
_20.setAttribute("aria-expanded","false");
_22.setAttribute("aria-label",_1b);
_22.title=_23.innerHTML=_1b;
}
}
}
},toggleMobileTopNav:function(_2c,_2d){
var _2e=document.getElementById("wpthemeTopNavToggleBtn");
var _2f=document.getElementById("wpthemeTopNavToggleBtnAccess");
var _30=document.getElementsByTagName("header")[0];
var _31=_30.children[0];
if(i$.hasClass(_2e,"wpthemeTopNavOpened")){
_31.style.display="none";
i$.removeClass(_2e,"wpthemeTopNavOpened");
_2e.setAttribute("aria-label",_2c);
_2e.title=_2f.innerHTML=_2c;
}else{
_31.style.display="block";
i$.addClass(_2e,"wpthemeTopNavOpened");
_2e.setAttribute("aria-label",_2d);
_2e.title=_2f.innerHTML=_2d;
}
this.resizeMobileNavSide();
}});
var _32=document.getElementById("wpthemeHelpLink");
var _33=document.getElementById("wpthemeHelpOnClick");
var _34=document.getElementById("wpthemeHelpAnchor");
if(!(_32===null&&_33===null)&&_34!=null){
if(_32!=null){
var _35=_32.innerHTML;
_34.onclick=function(){
window.open(_35,"wpthemeHelp","width=800,height=600");
};
}else{
if(_33!=null){
var _36=_33.innerHTML;
_34.onclick=function(){
eval(_36);
};
}
}
}
})();
(function(){
i$.merge({
"WARNING_0":"Aviso",
"DELETE_0":"Suprimir",
"INFO_0":"Información",
"MESSAGES_AVAILABLE_1":"Hay ${0} mensajes disponibles para revisarlos.",
"SHOW_DETAILS_0":"Mostrar detalles",
"ERROR_0":"Error",
"HIDE_DETAILS_0":"Ocultar detalles"
},i$.fromPath("wptheme.statusBar.nls",true));
})();
(function(){
if(typeof com==="undefined"||!com){
com={};
}
if(typeof com.ibm==="undefined"||!com.ibm){
com.ibm={};
}
if(typeof com.ibm.widgets==="undefined"||!com.ibm.widgets){
com.ibm.widgets={};
}
if(typeof com.ibm.widgets.StatusType==="undefined"||!com.ibm.widgets.StatusType){
com.ibm.widgets.StatusType=function(id,_1,_2,_3){
this._id=id;
this._styleClass=_1;
this._iconPath=_2;
this._iconAlt=_3;
};
}
if(typeof com.ibm.widgets.StatusMessage==="undefined"||!
com.ibm.widgets.StatusMessage){
com.ibm.widgets.StatusMessage=function(_4,_5,_6){
this._type=_4;
this._message=_5;
if(!i$.isString(_5)&&_5.message&&i$.isString(_5.message)){
this._message=_5.message;
}
this._details=_6;
};
}
if(typeof com.ibm.widgets.StatusBarV2==="undefined"||!com.ibm.widgets.StatusBarV2){
com.ibm.widgets.StatusBarV2=function(_7){
this.uid=_7;
this.showDetails=false;
this._messages=[];
this._connections=[];
this._numMessages=0;
this._baseURL=window.location.protocol+"//"+window.location.host;
this.errorGifPath=ibmCfg.themeConfig.modulesWebAppBaseURI+"/themes/html/dynamicSpot
s/icons/blank.gif";
this.warningGifPath=ibmCfg.themeConfig.modulesWebAppBaseURI+"/themes/html/dynamicSp
ots/icons/blank.gif";
this.infoGifPath=ibmCfg.themeConfig.modulesWebAppBaseURI+"/themes/html/dynamicSpots
/icons/blank.gif";
this._statusTypesMap={"error":new
com.ibm.widgets.StatusType(0,"lotusError",this.errorGifPath,wptheme.statusBar.nls.E
RROR_0),"warning":new
com.ibm.widgets.StatusType(1,"lotusWarning",this.warningGifPath,wptheme.statusBar.n
ls.WARNING_0),"info":new
com.ibm.widgets.StatusType(2,"lotusInfo",this.infoGifPath,wptheme.statusBar.nls.INF
O_0)};
i$.addListener("/portal/status",i$.scope(this,this.addMessage));
i$.addListener("/message/status",i$.scope(this,this.addMessage));
i$.addListener("/portal/status/clear",i$.scope(this,this.clearMessage));
i$.addListener("/message/status/clear",i$.scope(this,this.clearMessage));
if(typeof (ibmCfg)!="undefined"&&ibmCfg.portalConfig){
this.isBidi=ibmCfg.portalConfig.isRTL;
}else{
if(typeof (ibmPortalConfig)!="undefined"){
this.isBidi=ibmPortalConfig.isRTL;
}else{
if(typeof (ibmConfig)!="undefined"){
this.isBidi=ibmConfig.isBidi;
}
}
}
i$.addOnUnload(i$.scope(this,this._onWindowUnload));
this.containerNode=i$.byId("wpthemeStatusBarContainer");
};
}
i$.augment(com.ibm.widgets.StatusBarV2,{_onWindowUnload:function(){
i$.forEach(this._connections,function(_8){
i$.unbindDomEvt(_8);
});
this._connections=null;
this.clear();
this._messages=null;
},_getStatusContainer:function(){
return this.containerNode;
},_escapeHTML:function(_9){
if(_9.replace){
return
_9.replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/"/g,"&q
uot;");
}
return _9;
},setShowDetails:function(_a){
this.showDetails=_a;
},toggleShowDetails:function(){
this.setShowDetails(!this.showDetails);
this.render();
},clear:function(){
var _b=this._getStatusContainer();
if(!!_b){
_b.innerHTML="";
_b.setAttribute("role","");
_b.setAttribute("wairole","");
}
this._messages.length=0;
},clearMessage:function(_c){
if(_c.uid&&_c.uid!=this.uid){
return;
}
var _d=_c.message;
if(typeof _d==="undefined"||_d===null){
this.clear();
}else{
for(var i=this._messages.length-1;i>=0;i--){
if(this._messages[i]._type==_d._type&&this._messages[i]._message==_d._message&&this
._messages[i]._details==_d._details){
this._messages.splice(i,1);
}
}
if(this._messages.length==0){
this.clear();
}else{
if(this._messages.length<100){
this.render(this._getStatusContainer());
}
}
}
},addMessage:function(_e){
if(_e.uid&&_e.uid!=this.uid){
return;
}
var _f=_e.message;
this._messages.push(_f);
if(this._messages.length<100){
this.render(this._getStatusContainer());
}
},render:function(_10){
if(_10==null){
_10=this._getStatusContainer();
}
_10.innerHTML="";
if(this._messages.length>1){
this.renderHeader(_10);
}else{
if(this._messages.length==1){
this.renderMessage(_10,this._messages[0],this.showDetails,0);
}
}
if(this.showDetails&&this._messages.length>1){
for(x in this._messages){
this.renderMessage(_10,this._messages[x],this.showDetails,x);
}
}
},renderHeader:function(_11){
if(this._messages.length>1){
var _12=2;
for(var i=0;i<this._messages.length;i++){
_12=Math.min(_12,this._statusTypesMap[this._messages[i]._type]._id);
}
var _13="info";
for(x in this._statusTypesMap){
if(this._statusTypesMap[x]._id==_12){
_13=x;
break;
}
}
var _14=new
com.ibm.widgets.StatusMessage(_13,wptheme.statusBar.nls.MESSAGES_AVAILABLE_1.replac
e("${0}",this._messages.length),"");
this.renderMessage(_11,_14,this.showDetails,-1);
}
},renderMessage:function(_15,_16,_17,_18){
var _19=this._statusTypesMap[_16._type];
var _1a=document.createElement("div");
_1a.className="lotusMessage2 "+_19._styleClass;
if(this._messages.length>1&&_18>=0){
_1a.style.marginLeft="10px";
}
var _1b=document.createElement("img");
_1b.className="lotusIcon "+
(_19._styleClass=="lotusError"?"lotusIconMsgError":_19._styleClass=="lotusWarning"?
"lotusIconMsgWarning":"lotusIconMsgInfo");
_1b.src=_19._iconPath;
_1b.alt=_1b.title=_19._iconAlt;
_1a.appendChild(_1b);
var _1c=document.createElement("span");
_1c.className="lotusAltText";
_1c.innerHTML=this._escapeHTML(_19._iconAlt+":");
_1a.appendChild(_1c);
var _1d=document.createElement("div");
_1d.className="lotusMessageBody";
_1d.innerHTML=this._escapeHTML(_16._message);
_1a.appendChild(_1d);
if((this._messages.length>1&&_18<0)||(this._messages.length==1)){
if(_16._details&&_16._details.length>0||_18<0){
var _1e=document.createElement("a");
_1e.href="javascript:void(0)";
_1e.className="wpthemeHideShow";
_1e.role="button";
this._connections.push(i$.bindDomEvt(_1e,"onclick",i$.scope(this,this.toggleShowDet
ails)));
var _1f=document.createElement("img");
_1f.className="lotusIcon16";
_1f.src=ibmCfg.themeConfig.modulesWebAppBaseURI+"/themes/html/dynamicSpots/icons/bl
ank.gif";
_1e.appendChild(_1f);
var _20=document.createElement("span");
_20.className="lotusAltText";
_1e.appendChild(_20);
}else{
_17=false;
}
var _21=document.createElement("a");
_21.href="javascript:void(0);";
_21.className="lotusDelete";
_21.role="button";
_21.title=wptheme.statusBar.nls.DELETE_0;
this._connections.push(i$.bindDomEvt(_21,"onclick",i$.scope(this,this.clear)));
var _22=document.createElement("img");
_22.alt=wptheme.statusBar.nls.DELETE_0;
_22.src=ibmCfg.themeConfig.modulesWebAppBaseURI+"/themes/html/dynamicSpots/icons/bl
ank.gif";
_21.appendChild(_22);
var _23=document.createElement("span");
_23.className="lotusAltText";
_23.innerHTML=this._escapeHTML(wptheme.statusBar.nls.DELETE_0);
_21.appendChild(_23);
if(_16._details&&_16._details.length>0||_18<0){
if(_17){
_1e.title=wptheme.statusBar.nls.HIDE_DETAILS_0;
_1f.className+=" lotusIconHide";
_1f.alt=wptheme.statusBar.nls.HIDE_DETAILS_0;
_20.innerHTML=this._escapeHTML(wptheme.statusBar.nls.HIDE_DETAILS_0);
}else{
_1e.title=wptheme.statusBar.nls.SHOW_DETAILS_0;
_1f.className+=" lotusIconShow";
_1f.alt=wptheme.statusBar.nls.SHOW_DETAILS_0;
_20.innerHTML=this._escapeHTML(wptheme.statusBar.nls.SHOW_DETAILS_0);
}
_1a.appendChild(_1e);
if(!this.isBidi){
_1d.style.marginRight="32px";
}else{
_1d.style.marginLeft="32px";
}
}
_1a.appendChild(_21);
}
var _24=document.createElement("div");
_24.className="wpthemeClear";
_1a.appendChild(_24);
if(_16._details&&_16._details.length>0&&_17&&_18>=0){
var _25=document.createElement("div");
_25.className="wpthemeDetails";
_25.appendChild(document.createTextNode(_16._details));
_1a.appendChild(_25);
}
_15.appendChild(_1a);
_15.setAttribute("role","alert");
_15.setAttribute("wairole","alert");
}});
if(typeof wpstatusbar==="undefined"||!wpstatusbar){
wpstatusbar=new com.ibm.widgets.StatusBarV2("ibmStatusBox");
}
var _26=i$.getCookie("ibm.portal.operations.error");
if(_26){
var _27=i$.fromJson(_26);
var _28="error";
if(_27.errorType){
_28=_27.errorType;
}else{
if(_27.errorCode){
if(_27.errorCode=="400"){
_28="error";
}
}
}
i$.fireEvent("/portal/status",[{message:new
com.ibm.widgets.StatusMessage(_28,_27.errorMessage?
_27.errorMessage:"",_27.errorDetails?_27.errorDetails:""),uid:"ibmStatusBox"}]);
i$.deleteCookie("ibm.portal.operations.error");
}
i$.addOnLoad(function(){
if("localStorage" in window&&window["localStorage"]!==null){
if(localStorage["com.ibm.wp.toolbar.msg.msg"]!=null){
i$.fireEvent("/message/status",[{message:new
com.ibm.widgets.StatusMessage(localStorage["com.ibm.wp.toolbar.msg.type"],localStor
age["com.ibm.wp.toolbar.msg.msg"],""),uid:"ibmStatusBox"}]);
localStorage.removeItem("com.ibm.wp.toolbar.msg.type");
localStorage.removeItem("com.ibm.wp.toolbar.msg.msg");
}
}
});
})();