Продавец берет на себя полную ответственность за выставление данного товара на продажу.
3-Pack Mrs. Wages Mixed Pickling Spice
by Mrs. Wages
SKUW592-3ConditionBrand NewQuantity3 bottlesNet Wt.1.75 oz.
per bottleManufacturerMrs. Wages
A special blend of natural, choice spices originally formulated for preparing the famous Mrs. Wages Old South Cucumber Lime Pickle recipe. Use for all homemade pickles and relishes, or as a seasoning for boiled vegetables, shellfish, pork or beef.
Ingredients: Spice. Net wt. 1.75 oz. (50g) per bottle.

Payment Details
PayPal is our preferred method of payment. If you are paying with a credit card, you may do so through PayPal OR by calling us at (888) 404-6366 EXT 1 (M-F 9am-4pm Mountain Time) with your eBay order number and credit card information.
ATTENTION PAYPAL USERS: Please note that we DO NOT ship to your PayPal shipping addresses - we ship to your EBAY shipping address, so make sure it is correct before completing your order.
Shipping Details
Shipping Address: PLEASE make sure your eBay shipping address is correct BEFORE you complete your check out. If you would like the order shipped to someone else be sure to enter the correct address during the eBay checkout. If you complete checkout with the incorrect shipping address this is YOUR mistake and we are not responsible for packages that are shipped to the incorrect address you provided us. You will be responsible for all return shipping fees, package intercept fees, replacement product costs, and additional reshipping charges that may result from your mistake. It will be your responsibility to retrieve the package from the incorrect address if the package is not returned to us by the shipping company.
Shipping costs and times can be calculated on the Shipping Tab. Most orders are shipped within 1 business day of receipt of payment. Insurance is included with all packages shipped via UPS. If your order is sent via UPS or USPS Priority Mail, you should receive an e-mail confirmation with a tracking number so you can track your package.
Shipping Discounts: If you buy multiple items from us, shipping costs can be combined to save you money. In most cases, this is done automatically, but if you have a question, please contact us BEFORE YOU PAY and we will send you an invoice. Shipping discounts are only available when you complete your purchases with a single payment.
Please visit our store's Policies page for more details on available shipping methods and estimated transit times.
Return Policy
ALL CUSTOMER RETURNS AND CANCELLED TRANSACTIONS RECEIVE A RESTOCKING FEE OF AT LEAST 15% - BE SURE OF YOUR PURCHASE!
Please read the listings carefully and be sure of your purchase - all returns and cancelled paid transactions will be subject to a restocking fee of at least 15% - even if you request to cancel your order before it has been shipped. There is no fee to cancel a transaction that has not been paid for.
NON RETURNABLE ITEMS include but are not limited to personal care items, food items, custom made jewelry, and any replacement part that has been installed (vacuum belts, motor parts, etc).
RETURNABLE ITEMS are accepted with a 15% restocking fee if the product is still in new condition and in its original packaging. If you have damaged the original packaging or used the product there will be a 25% restocking fee. We will not refund shipping charges. Contact us via phone or email for a return authorization number before sending anything back. Returns that have not been authorized will be refused. Returns must be received within 30 days of authorization or they will be refused.
If you have a concern about an item you received, please contact us ASAP by email (via the Ask A Question link at the bottom of the listing) or by phone at (888) 404-6366 EXT 1 (M-F 9am-4pm Mountain Time) before leaving negative feedback… We have found that most problems can be solved with communication.
International Buyers
Delivery Time: International shipping is VERY unpredictable. Delivery time for USPS First Class, or Priority Mail International is generally 3-6 weeks to any international destination, including Canada. Please DO NOT expect to receive your package for at least 3 weeks and be prepared to wait as long as 6 weeks for delivery. Please do not contact us regarding the delivery of your package until you have waited at least 6 weeks. If you cannot wait this long please select and pay for the quicker and more reliable USPS Express Mail International for a delivery time of 7-10 business days.
Tracking: Please be aware that USPS is terrible about tracking international packages. Although you will receive a USPS tracking number, do not be alarmed if there is no updated tracking information available for you to view online. This is normal. You will receive a shipping confirmation email when your order has shipped. Know that your order was shipped on the date listed in the shipping confirmation email, regardless of what the USPS online tracking system may show.
Customs and Declared Values: We will declare the amount you paid for your purchase on the customs form - not including the shipping cost. We WILL NOT declare an amount that is less so you can avoid additional fees, nor will we claim the order is a "Gift" so please DO NOT ask us to do so. There may be additional customs fees due to your postal office upon delivery of your order. We are not responsible for these fees. Please contact your local post office for rates and information.
Electrical Ratings: Unless otherwise noted, ALL of our electrical products are 110/120 volts and are fitted with standard U.S./North American-style plugs. Please take note that you may require an adapter or converter to use them.
IF ANY OF THIS INFORMATION IS UNACCEPTABLE TO YOU, PLEASE MAKE YOUR PURCHASES ELSEWHERE.
About Us
We'll Treat You Right!
Here at The Mending Shed, we have been selling successfully on eBay since 1999 and have served thousands of satisfied customers, which is evident in our strong feedback ratings. We take our business seriously and do everything we can to assure you have a smooth transaction.
Have Questions?
Can't find what you're looking for? We have an extensive stockroom full of parts for all sorts of power tools, shavers, small appliances, and more. If you're looking for something you can't find here, please CONTACT US to see if we have it. If we do, we'll create a listing for you.
Please contact us if you have questions! We're knowledgable, friendly, and ready to help you find exactly what you need.

t.O of 1st element in the array i.e Span object , 1 --> t.O 2nd element in the array i.e Button object
// entrue -> enable true and enfalse -- > enable false
t.Cls = [{'mouseup': [0, ''],'mousedown' : [0, 'p'],'mouseout': [0, ''],'mouseover':[0, 'o'],'focus':[1, 'o'],'blur':[1, ''],'entrue' : 'd','enfalse' : ''}];
t.O = [];
t.init();
},
init : function () {
var t = this,D = t.vj$.ED, O=t.get();
D.addEventListener(window, 'load', function(){t.enDis(t.m.dis)}, window);
/*
t.Cls is JSON object. Only one index. [0][0] = mouseup, [0][1]=mousedown, etc...
t.Cls[0][0][0] = 0 and O[t.Cls[0][0][0]] == O[0] == Span object, O[t.Cls[0][4][0]] == 1 == Button object.
*/
for (var i in t.Cls[0]) {
var V = O[t.Cls[0][i][0]];
if (V) D.addEventListener(V, i ,t.handler(i), t);
}
},
handler : function (eT) {
var t = this;
return function () {
t.changeState({'eventType':eT});
};
},
//private void set();
get : function(){
var t=this,E=t.vj$.E, m=t.m;
if (t.O.length == 0){
t.O.push( E.get(m.SId), E.get(m.BId) , E.get(m.LId) );
}
return t.O;
},
//> public void changeState(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum)
changeState : function(e) {
var t=this,
O = t.get(),
eT = e.eventType;
if ((O[1].disabled || O[0].className.indexOf('-bd') != -1) || (t.state=='mousedown' && eT=='focus')) return;
t.state = eT;
O[0].className =t.dCls + t.Cls[0][eT][1] + ' '+t.m.BT;
},
//> public void enable()
enable : function () {
this.enDis(false);
},
//> public void disable()
disable : function () {
this.enDis(true);
},
isDisabled : function() {
return this.m.dis;
},
enDis :function (bool) {
var t=this,
N='none',
E=t.vj$.E,
m=t.m,
O = t.get(),
b=O[1],
bS = b.style,
tS=(O[2]) ? O[2].style : "",
B = vjo.dsf.client.Browser.bIE;
O[0].className =t.dCls + t.Cls[0]['en'+bool]+ ' '+t.m.BT;
t.m.dis = bool;
//If not an anchor and its IE then disable - bug fix BUGDB00618938 & BUGDB00618892
if(m.tp !== 2) b.disabled = bool;
else b.display = (bool) ? N : "";
//Not IE & Not anchor
if(!B && m.tp != 2) return;
if (bool) {
tS.display="inline-block";
if(!B){
tS.display="-moz-inline-box";
b.style.setProperty("display", "none", "important");
}
bS.display=N;
} else {
tS.display=N;
bS.display="";
}
}
})
.props ({
//> public static void enable(String)
enable : function (ins) {
var o = vjo.Registry.get(ins);
if (o) o.enable();
},
//> public void disable(String)
disable : function (ins) {
var o = vjo.Registry.get(ins);
if (o) o.disable();
},
//>public boolean onSubmit(String, com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum, boolean)
//>public boolean onSubmit(String, com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum)
onSubmit : function (svcId, evt, retType) {
this.sendMessage(svcId, evt);
return (!retType && retType==false) ? false : true;
},
sendMessage : function (svcId, evt) {
var o=this.vj$, msg =new o.M(svcId);
msg.event = evt;
o.S.handleRequest(msg);
}
})
.endType();vjo.ctype("vjo.darwin.comp.button.Button")
.needs("vjo.dsf.Element",'E')
.needs("vjo.dsf.Message",'M')
.needs("vjo.dsf.ServiceEngine",'S')
.needs("vjo.dsf.client.Browser")
.needs("vjo.dsf.EventDispatcher",'ED')
.needs('vjo.Registry')
.protos({
m : null,//
public constructs(com.ebay.darwin.comp.button.ButtonJsModel)
constructs:function(m)
{
var t=this;
t.m = m;
t.state='';
//Sc -> Scope
var Sc=m.scope;
var secS = m.subScope;
t.dCls = Sc+'-b '+secS+'-b';
// 0 --> t.O of 1st element in the array i.e Span object , 1 --> t.O 2nd element in the array i.e Button object
// entrue -> enable true and enfalse -- > enable false
t.Cls = [{'mouseup': [0, ''],'mousedown' : [0, 'p'],'mouseout': [0, ''],'mouseover':[0, 'o'],'focus':[1, 'o'],'blur':[1, ''],'entrue' : 'd','enfalse' : ''}];
t.O = [];
},
onLoad : function () {
var t = this,D = t.vj$.ED, O=t.get();
t.enDis(t.m.dis);
/*
t.Cls is JSON object. Only one index. [0][0] = mouseup, [0][1]=mousedown, etc...
t.Cls[0][0][0] = 0 and O[t.Cls[0][0][0]] == O[0] == Span object, O[t.Cls[0][4][0]] == 1 == Button object.
*/
for (var i in t.Cls[0]) {
var V = O[t.Cls[0][i][0]];
if (V) D.addEventListener(V, i ,t.handler(i), t);
}
},
handler : function (eT) {
var t = this;
return function () {
t.changeState({'eventType':eT});
};
},
//private void set();
get : function(){
var t=this,E=t.vj$.E, m=t.m;
if (t.O.length == 0){
t.O.push( E.get(m.SId), E.get(m.BId) , E.get(m.LId) );
}
return t.O;
},
//> public void changeState(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum)
changeState : function(e) {
var t=this,
O = t.get(),
eT = e.eventType;
if ((O[1].disabled || O[0].className.indexOf('-bd') != -1) || (t.state=='mousedown' && eT=='focus')) return;
t.state = eT;
O[0].className =t.dCls + t.Cls[0][eT][1] + ' '+t.m.BT;
},
//> public void enable()
enable : function () {
this.enDis(false);
},
//> public void disable()
disable : function () {
this.enDis(true);
},
isDisabled : function() {
return this.m.dis;
},
enDis :function (bool) {
var t=this,
N='none',
E=t.vj$.E,
m=t.m,
O = t.get(),
b=O[1],
bS = b.style,
tS=(O[2]) ? O[2].style : "",
B = vjo.dsf.client.Browser.bIE;
O[0].className =t.dCls + t.Cls[0]['en'+bool]+ ' '+t.m.BT;
t.m.dis = bool;
//If not an anchor and its IE then disable - bug fix BUGDB00618938 & BUGDB00618892
if(m.tp !== 2) b.disabled = bool;
else b.display = (bool) ? N : "";
//Not IE & Not anchor
if(!B && m.tp != 2) return;
if (bool) {
tS.display="inline-block";
if(!B){
//tS.display="-moz-inline-box";
b.style.setProperty("display", "none", "important");
}
bS.display=N;
} else {
tS.display=N;
bS.display="";
}
}
})
.props ({
//> public static void enable(String)
enable : function (ins) {
var o = vjo.Registry.get(ins);
if (o) o.enable();
},
//> public void disable(String)
disable : function (ins) {
var o = vjo.Registry.get(ins);
if (o) o.disable();
},
//>public boolean onSubmit(String, com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum)
onSubmit : function (svcId, evt) {
return this.sendMessage(svcId, evt);
},
sendMessage : function (svcId, evt) {
var o=this.vj$, msg =new o.M(svcId);
msg.event = evt;
return o.S.handleRequest(msg);
}
})
.endType();vjo.ctype("vjo.darwin.comp.base.Base")
.needs("vjo.dsf.EventDispatcher",'ED')
.props({
bodyLoaded:false//
public Object add(String, String, String, Object, Object)
add : function(cmpId, id, eventType, handler, scope) {
var rv = this.vj$.ED.add(id, eventType, handler, scope);
//Should not register for body events
if(id != "body") {
this.register(cmpId, id, eventType);
}
return rv;
},
/**
* Storing id and eventType in the associative array with the key cmpId
*/
//>public void register(String, String, String)
register : function(cmpId, id, eventType) {
if(!cmpId || !id) return;
this.reg[cmpId] = this.reg[cmpId] || {};
var htmlIds,
handlers = this.reg[cmpId];
if (!handlers[eventType]) {
handlers[eventType] = [];
}
handlers[eventType].push(id);
},
/**
* Remove events that associated to the component id.
* If eventType is not specified, will remove for all the events for the component id.
*/
//>public void unRegister(String)
//>public void unRegister(String, String)
unRegister : function(cmpId, eventType) {
var evts = this.reg[cmpId];
if(evts) {
evts = (eventType) ? [evts[eventType]] : evts;
for(var evtType in evts) {
var htmlIds = evts[evtType];
for(var idx in htmlIds) {
this.vj$.ED.detachHandlers(htmlIds[idx], (eventType || evtType));
}
}
}
},
//>public void callInit(Object,com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum, String);
callInit : function(elm,event,instanceId){
var eType = (event) ? event.type : null;
if (eType=="mouseover"){
elm.onmouseover = null;
} else if (eType=="focus"){
elm.onfocus=null;
}
var obj = this.vj$.R.get(instanceId);
if (obj) obj.init();
},
//>public void callOnLoad(java.util.List
)
callOnLoad : function(jsInstanceIds){
var t = this,
f = function() {
for(var i=0,l=jsInstanceIds.length;ipublic void showElems(String[] showId, String[] hideId, String radId, String radioNo, String numOfRadios)
showElems : function (showId, hideId, radId, radioNo, numOfRadios) {
if (showId && showId.length > 0) {
var l = showId.length;
for (var i=0; i 0) {
var m = hideId.length;
for (var j=0; jpublic void submitEimSearchBar(String url, String formId, String allCatUrl,String enUsParam)
submitEimSearchBar : function (url, formId, allCatUrl,enUsParam) {
var searchForm = document.forms[formId];
var formaction = searchForm.action;
var categoryDropDown = document.getElementById("ect");
var selectedIndex = categoryDropDown.selectedIndex;
var selectedCategoryId = categoryDropDown.options[selectedIndex].value;
var kw=document.getElementById("search").value;
kw=kw.replace(/^\s+/,'');
if(kw =="" && selectedCategoryId == ""){
searchForm.action = allCatUrl;
return;
}
var selectedCategoryText = "";
if(selectedIndex != 0){
selectedCategoryText = categoryDropDown.options[selectedIndex].text;
}
if(selectedCategoryId != "") {
url = url + selectedCategoryText + '/' + selectedCategoryId + '/';
}
var catIdAndLevel = selectedCategoryId.split("-");
if(selectedCategoryId != "" && url.indexOf(".ru") != -1 && allCatUrl.indexOf("index.en-US.html") != -1){
var ecVal = parseInt(catIdAndLevel[0]) + parseInt(250);
document.getElementById("ec").value = ecVal;
}else{
document.getElementById("ec").value = catIdAndLevel[0];
}
if (enUsParam != null && enUsParam != "") {
url = url + enUsParam;
}
searchForm.action = url;
},
/**
* Sets the form action to the EimSearch bar
*
* @param url
* @param formId
* @param locationDropdownHtmlId
* @param catDropdownHtmlId
* @param catId
*/
//>public void setSearchFormActionForLocation(String url, String formId, String dropDownHtmlId, String catDropdownHtmlId, String catId)
setSearchFormActionForLocation: function(url, formId, dropDownHtmlId, catDropdownHtmlId, catId){
var locationSelect = document.getElementById(dropDownHtmlId);
var selectedIndex = locationSelect.selectedIndex;
var dropDownValue = locationSelect.options[selectedIndex].value;
//var dropDownText = dropDownValueWithLevel.options[selectedIndex].text;
var searchForm = document.forms[formId];
var selectedCatId=document.getElementById(catDropdownHtmlId).value;
if(catId==null && (dropDownValue=="1" || dropDownValue=="3" || dropDownValue=="77" || dropDownValue=="-2")){
searchForm.action = url;
}
if(selectedCatId==catId
&& (dropDownValue=="1" || dropDownValue=="3" || dropDownValue=="77" || dropDownValue=="-2")){
searchForm.action = url;
}
} ,
//> public boolean focusTextbox(String psId)
focusTextbox:function(psId){
vjo.dsf.Element.get(psId).focus();
return true;
}/*,
//>public void adjustWidth(String selectId)
adjustWidth:function(selectId) {
var t=this;
var v=t.vj$;
//var elem=v.E;
var slct=document.getElementById(selectId);
var outerwidth=parseInt(slct.style.width);
if(v.B.bIE && v.B.iVer <= 8){
slct.style.width="auto";
v.ED.add(selectId, "blur change", vjo.bind(t, t.resize(slct,outerwidth)));
}
},
resize:function(select, wid){
select.style.width=wid;
}*/
}).endType();vjo.ctype("vjo.ebay.darwin.ebox.gbh.globalheader.GlobalHeader")
.needs('vjo.dsf.Element')
.needs( "vjo.dsf.EventDispatcher","EV")
.props({
//>public void show_list(String)
show_list:function(elementid) {
/* var eids = ["drpdwn","selectoption"]; // contain elementids
var e = document.getElementById(elementid);
for(j=0;jpublic void changebg(int,int)
changebg: function(elementid,menucnt) {
for(i=1 ; i<=menucnt; i++){
if(elementid == i) {
document.getElementById('menu' + elementid ).className = "mnu bg" ;
}
else {
document.getElementById('menu' + i).className = "mnu";
}
}
},
//>public void hideoptions(String)
hideoptions: function(e){
var eids = ["drpdwn","selectoption"]; // contain elementids
for(i=0;i= 4){
// this.findPosX(o,eids[i]);
//this.findPosY(o,eids[i]);
}
return true;
}
theElem = theElem.offsetParent;
}
if(elemId) elemId.style.display = 'none';
}
return true;
},
findPosX : function(obj){
var t = this, drp = document.getElementById("selectoption"),curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
drp.style.clientLeft = curleft;
return curleft;
},
findPosY : function(obj){
var t = this,drp = document.getElementById("selectoption"),curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
drp.style.clientTop = curtop;
return curtop;
},
findPosX1 : function(obj){
var t = this, drp = document.getElementById("drpdwn"),curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
drp.style.clientLeft = curleft;
return curleft;
},
findPosY1 : function(obj){
var t = this,drp = document.getElementById("drpdwn"),curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
drp.style.clientTop = curtop;
return curtop;
},
//>public void regCloseOnBdyClick()
regCloseOnBdyClick : function(){
document.onclick = this.hideoptions;
},
//>public void setstyles()
initsettings : function(){
// checking for settings link
var onclickfalse=function(){
return false;
}
this.vj$.EV.add("settings",'click',onclickfalse,this);
var browser=navigator.appName;
var rtmnu = document.getElementById("rt-mnu");
var ltmnu = document.getElementById("lt-mnu");
var ver = parseFloat(navigator.appVersion);
if(browser=="Microsoft Internet Explorer" && ver >= 4){
if(rtmnu) rtmnu.className ="";
if(ltmnu) ltmnu.className ="";
} else {
if(rtmnu) rtmnu.className ="flt-rt";
if(ltmnu) ltmnu.className ="flt-rt";
}
}
}).endType();/**
* Utility class for HTML Form.
*/
vjo.ctype("vjo.dsf.document.Form")
.props({
/**
* Gets an element in the form by specified name.
*
* @param {String} name
* the name of a element to be get
* @return {Object}
* the element in the form. If no such element, return null
*/
//> public HTMLFormElement get(String);
get : function(psName) {
var f = document.forms[psName];
return f?f:null;
},
/**
* Gets an element in a specified form.
*
* @param {String} name
* the name of the form that contains the element
* @param {String} elemName
* a name of the element to be get
* @return {Object}
* the element in the form. If no such element, return null
*/
//> public HTMLElement getElem(String,String);
getElem : function(psFormName,psElemName) {
var f =this.get(psFormName), e;
if(f)
e = f.elements[psElemName];
return e?e:null;
},
/**
* Submits the form.
*
* @param {String} name
* the name of the form
*/
//> public void submit(String);
submit : function(psName) {
var f = this.get(psName);
if(f)
f.submit();
},
/**
* Sets the form action value.
*
* @param {String} name
* the name of the form
* @param {String} action
* a value of the action to be set
*/
//> public void setAction(String,String);
setAction : function(psName, psAction) {
this.setAttr(psName, "action", psAction);
},
/**
* Gets the value of the action from a form.
*
* @param {String} name
* the name of the form
* @return {String}
* a value of the form action
*/
//> public String getAction(String);
getAction : function(psName) {
return this.getAttr(psName,"action");
},
/**
* Sets the form target value.
*
* @param {String} name
* the name of the form
* @param {String} target
* a value of the target to be set
*/
//> public void setTarget(String,String);
setTarget : function(psName, psTarget) {
this.setAttr(psName, "target", psTarget);
},
/**
* Gets the value of the target from a form
*
* @param {String} name
* the name of the form
* @return {String}
* a value of the form target
*/
//> public String getTarget(String);
getTarget : function(psName) {
return this.getAttr(psName,"target");
},
/**
* Sets the value to a specified form attribute.
*
* @param {String} name
* the name of the form
* @param {String} attrName
* the name of the attribute of the form
* @param {String} attrValue
* a value of the attribute to be set
*/
//> public void setAttr(String,String,String);
setAttr : function(psName, psAttrName, psAttrValue) {
var f = this.get(psName);
if(f)
eval("f." + psAttrName.toLowerCase() + "=psAttrValue;");
},
/**
* Gets a specified form attribute value.
*
* @param {String} name
* the name of the form
* @param {String} attrName
* a name of the attribute of the form
* @return {String}
* the value of the attribute
*/
//> public String getAttr(String,String);
getAttr : function(psName, psAttrName) {
var f = this.get(psName), v = null;
if(f)
v = eval("f." + psAttrName.toLowerCase());
return v;
}
})
.endType();
vjo.ctype("vjo.darwin.core.searchbox.EbaySearchBox")
.needs("vjo.dsf.Element")
.protos({
textBoxId : null,// public constructs(String textBoxId,String buttonId,boolean buttonInitiallyDisabled)
constructs : function(textBoxId, buttonId, buttonInitiallyDisabled) {
this.textBoxId = textBoxId;
this.buttonId = buttonId;
this.buttonInitiallyDisabled = buttonInitiallyDisabled;
if (this.buttonInitiallyDisabled) { this.updateButton();}
return this;
},
//> public void clearTextBox()
clearTextBox : function() {
var textBox = vjo.dsf.Element.get(this.textBoxId);
var button = vjo.dsf.Element.get(this.buttonId);
if(textBox.defaultValue == textBox.value) {
textBox.value = "";
}
},
//> public void updateButton()
updateButton : function() {
var button = vjo.dsf.Element.get(this.buttonId);
var textBox = vjo.dsf.Element.get(this.textBoxId);
if( button !== null && textBox !== null ) {
if(this.buttonInitiallyDisabled && (textBox.defaultValue == textBox.value)) {
button.disabled = true;
} else {
button.disabled = (textBox.value.replace(/\s/g, '').length < 1);
}
}
}
})
.endType();
vjo.ctype("vjo.ebay.shared.component.eimsearchbar.EIMSearchBar")
.needs("vjo.dsf.Element",'E')
.needs("vjo.dsf.utils.Object")
.needs("vjo.dsf.utils.Timer")
.needs('vjo.dsf.client.Browser','B')
.protos({
/**
* @JsClass EIMSearchBar
*
* @return void
* @access public
* @param {String} textBoxId
*/
//> public constructs(String textBoxId)
constructs : function(textBoxId) {
this.textBoxId = textBoxId;
return this;
},
/**
* @JsClass EbaySearchBox
*
* @return void
* @access public
* @param {String} searchText
* @JsEventHandler
*/
//> public void clearTextBox(String searchText)
clearTextBox : function(searchText) {
var textBox = document.getElementById(this.textBoxId);
if(searchText == textBox.value) {
textBox.value = "";
}
}
})
.props({
/**
* Sets the form action to the EimSearch bar
*
* @param url
* @param formId
* @param categoryHtmlId
* @param catLevelName
* @param catIdLevel
*/
//>public void setSearchFormAction(String url, String formId, String dropDownHtmlId, String enUsParam)
setSearchFormAction: function(url, formId, dropDownHtmlId, enUsParam){
var dropDownValueWithLevel = document.getElementById(dropDownHtmlId);
var selectedIndex = dropDownValueWithLevel.selectedIndex;
var dropDownValue = dropDownValueWithLevel.options[selectedIndex].value;
var dropDownText = dropDownValueWithLevel.options[selectedIndex].text;
var dropDownTitle = dropDownValueWithLevel.options[selectedIndex].title;
if(dropDownTitle && dropDownTitle != ""){
var formAction = url + dropDownTitle + '/';
} else{
var formAction = url + dropDownText + '/';
}
if(dropDownValue!=""){
formAction= formAction + dropDownValue + '/';
}else{
formAction=url;
}
if (enUsParam != null && enUsParam != "") {
formAction += enUsParam;
}
var searchForm = document.forms[formId];
searchForm.action = formAction;
},
/**
* Redirect 'Filter not selected' view
*
* @param url
* @param searchTextHtmlId
* @param defaultText
* @param dropDownHtmlId
* @param viewTypeText
* @param viewType
* @param allCatUrl
*/
//>public void submitEimSearchBar(String url, String searchTextHtmlId, String defaultText, String dropDownHtmlId, String viewTypeText, int viewType, String formId, String allCatUrl,boolean isRu)
submitEimSearchBar : function (url, searchTextHtmlId, defaultText, dropDownHtmlId, viewTypeText, viewType, formId, allCatUrl,isRu) {
var dropDownValueWithLevel = document.getElementById(dropDownHtmlId);
var selectedIndex = dropDownValueWithLevel.selectedIndex;
var dropDownValue = dropDownValueWithLevel.options[selectedIndex].value;
var searchForm = document.forms[formId];
if(document.getElementById(searchTextHtmlId)) {
var searchText = document.getElementById(searchTextHtmlId);
if (searchText.value == defaultText) {
searchText.value = "";
}
if (searchText.value == "" && dropDownValue == "" && formId != null) {
url = url + "?" + viewTypeText + "=" + viewType;
if (searchForm != null) {
location.href = url;
}
}
}
if(dropDownValue != "" && url.indexOf(".ru") != -1 && allCatUrl.indexOf("index.en-US.html") != -1){
var catIdAndLevel = dropDownValue.split("-");
var ecVal = parseInt(catIdAndLevel[0]) + parseInt(250);
document.getElementById("ec").value = ecVal;
}
var kw=document.getElementById("search").value;
kw=kw.replace(/^\s+/,'');
if(dropDownValue == '')
{
var searchForm = document.forms[formId];
var url = searchForm.action;
var t = url.split('/');
if(t.length==6){
var l=t.pop();
t.pop();
if(!isRu){
t.pop();
}
t.push(l);
url = t.join('/');
searchForm.action = url;
}
}
if(kw =="" && dropDownValue == ""){
searchForm.action = allCatUrl;
location.href = allCatUrl;
}
},
/**
* Sets the form action to the EimSearch bar
*
* @param url
* @param formId
* @param locationDropdownHtmlId
* @param catDropdownHtmlId
* @param catId
*/
//>public void setSearchFormActionForLocation(String url, String formId, String dropDownHtmlId, String catDropdownHtmlId, String catId,boolean locGroupEnable)
setSearchFormActionForLocation: function(url, formId, dropDownHtmlId, catDropdownHtmlId, catId,locGroupEnable){
var locationSelect = document.getElementById(dropDownHtmlId);
var selectedIndex = locationSelect.selectedIndex;
var dropDownValue = locationSelect.options[selectedIndex].value;
var searchForm = document.forms[formId];
var selectedCatId=document.getElementById(catDropdownHtmlId).value;
if(locGroupEnable){
var dropDown = dropDownValue.split("\_");
if(dropDown.length > 1){
dropDownValue = dropDown[1];
}
}
if((catId==null ||selectedCatId==catId) && (dropDownValue=="0" || dropDownValue=="3" || dropDownValue=="77"
|| dropDownValue=="-2" || dropDownValue =="1000")){
searchForm.action = url;
}
},
//>public void resetCategOnLocChange(String url, String formId, String enUsParam, String catDropDownHtmlId, String locDropDownHtmlId, int catLevel, String allCatText, String preLoc)
resetCategOnLocChange: function(url, formId, enUsParam, catDropDownHtmlId, locDropDownHtmlId, catLevel, allCatText, preLoc){
var locationSelect = document.getElementById(locDropDownHtmlId);
var locDropDownValue = locationSelect.options[locationSelect.selectedIndex].value;
var catDropDown = document.getElementById(catDropDownHtmlId);
var opts = new Array, i=0, total=(catDropDown.options.length-catLevel-1), cOps=catDropDown.options;
var catDropDownValue = catDropDown.options[catDropDown.selectedIndex].value;
var catDropDownLevel = catDropDownValue.split('-')[1];
if(typeof(CACHE)== 'undefined'){
while(i <= catLevel+1) {
opts.push(cOps[i]);
i++;
}
CACHE = { opts:opts, total: total };
}
if(preLoc != locDropDownValue && cOps.length > CACHE.total){
var t = catLevel+1;
var sOpt = cOps[catLevel-1].value;
var sOptTitle = cOps[catLevel-1].title;
while(t >= 0) {
catDropDown.remove(t);
t--;
}
var allCatOpt = document.createElement("option");
allCatOpt.text = allCatText;
allCatOpt.value = "";
try {
catDropDown.add(allCatOpt,catDropDown.options[0]);
} catch (e){
catDropDown.add(allCatOpt,0);
}
if(catDropDownLevel == 1 && catDropDownValue != sOpt){
return;
}
if(catDropDownValue == ""){
catDropDown.selectedIndex = 0;
return;
}
var tempOpt = sOpt;
if(enUsParam != ""){
var SOptCatId = sOpt.split('-')[0];
var SOptCatVal = sOpt.split('-')[1];
tempOpt = (SOptCatId % 25) + "-" + SOptCatVal;
}
for(var index=0; index < catDropDown.options.length; index++){
if(tempOpt == catDropDown.options[index].value){
catDropDown.selectedIndex = index;
var formAction = url + sOptTitle + '/';
if(sOpt != ""){
formAction += sOpt + '/';
}
if (enUsParam != null && enUsParam != "") {
formAction += enUsParam;
}
var searchForm = document.forms[formId];
searchForm.action = formAction;
break;
}
}
} else if(preLoc == locDropDownValue && catDropDown.options.length == CACHE.total){
catDropDown.remove(0);
var noReset = 0;
var x = CACHE.opts.length - 1;
while(x >= 0) {
var t = CACHE.opts[x];
var t1 = document.createElement('option');
t1.text = t.text; t1.value=t.value; t1.title = t.title;
try{
catDropDown.add(t1,catDropDown.options[0]);
} catch(e) {
catDropDown.add(t1,0);
}
if(x == (CACHE.opts.length - 3) && catDropDownLevel == 1){
if(enUsParam != ""){
var tOptCatId = t.value.split('-')[0];
var tOptCatVal = t.value.split('-')[1];
var tempOpt = (tOptCatId % 25) + '-' + tOptCatVal;
if(catDropDownValue != tempOpt){
noReset = 1;
}
} else if(catDropDownValue != t.value){
noReset = 1;
}
}
if(x == 0 && noReset == 0 && catDropDownValue != ""){
var formAction = url + t.title + '/';
if(t.value != ""){
formAction += t.value + '/';
}
if (enUsParam != null && enUsParam != "") {
formAction += enUsParam;
}
var searchForm = document.forms[formId];
searchForm.action = formAction;
}
x--;
}
if(catDropDownValue == ""){
catDropDown.selectedIndex = CACHE.opts.length - 2;
return;
}
if(noReset == 0){
catDropDown.selectedIndex = 0;
}
}
}
})
.endType();vjo.ctype("vjo.ebay.darwin.ebox.gbh.header.dropdown.DropDown")
.needs('vjo.dsf.Element')
.needs( "vjo.dsf.EventDispatcher","EV")
.props({
//>public void hideoptions(String)
hideoptions : function(e){
var evt = (e)?e:event;
var theElem = (evt.srcElement)?evt.srcElement:evt.target;
var t = this;
var browser=navigator.appName;
var ver = parseFloat(navigator.appVersion);
var drp = document.getElementById("selectoption");
while(theElem!=null){
if(theElem.id == "selectoption" || theElem.id == "clickclick" && drp.style.display == 'none' && (drp !="" || drp!= null)) {
document.getElementById("selectoption").style.display="";
drp.style.position="absolute";
var o = drp.offsetParent;
if(browser=="Microsoft Internet Explorer" && ver >= 4){
this.findPosX(o);
this.findPosY(o);
}
return true;
}
theElem = theElem.offsetParent;
}
document.getElementById("selectoption").style.display = 'none';
document.getElementById("d").style.display="";
return true;
},
//>public void regCloseOnBdyClick()
regCloseOnBdyClick : function(){
document.onclick = this.hideoptions;
},
//>public void initDrp()
initDrp : function(){
var f1=function(){
return false;
}
this.vj$.EV.add("dropdown",'click',f1,this);
},
//>public void diduknow()
diduknow : function () {
var t=this,sel = function(event) {return t.clickhere(event);}
var ddiv = document.getElementById("diduknow");
this.vj$.EV.addEventListener(ddiv, 'click', sel, t);
},
//>public void clickhere()
clickhere:function(e){
clickevnt = e.srcElement || e.target;
if(!clickevnt) { clickevnt =e.src; }
if(!clickevnt || clickevnt.tagName.toUpperCase() == 'A' )
{
window.open("http://pages.ebay.co.uk/sell/basics/index.html");
}
},
//>public void showoptions()
showoptions :function() {
var t = this;
var drp = document.getElementById("selectoption");
document.getElementById("selectoption").style.display="";
document.getElementById("d").style.display="none";
drp.style.position="absolute";
drp.style.zIndex="1000";
var o = drp.parentNode;
t.findPosX(o);
t.findPosY(o);
},
//> public void stopProp()
stopProp : function(){
return false;
},
findPosX : function(obj){
var t = this, drp = document.getElementById("selectoption"),curleft = 0;
if(obj.offsetParent)
while(1)
{
curleft += obj.offsetLeft;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.x)
curleft += obj.x;
drp.style.clientLeft = curleft;
return curleft;
},
findPosY : function(obj){
var t = this,drp = document.getElementById("selectoption"),curtop = 0;
if(obj.offsetParent)
while(1)
{
curtop += obj.offsetTop;
if(!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if(obj.y)
curtop += obj.y;
drp.style.clientTop = curtop;
return curtop;
},
//>public void showDrop(String, String)
showDrop : function(id, mainDiv){
document.getElementById(id).style.display = "";
document.getElementById(mainDiv).style.display = "none";
}
});/**
* This class allows user easily add/remove a iframe to/from its parent node.
*/
vjo.ctype("vjo.dsf.document.Shim")
.needs("vjo.dsf.client.Browser")
.props({
/**
* Appends an empty iframe shim to the nodes.
*
* @param {Object} Node
* the parent node that the ifram shim will append to
* @param {int} HPadding
* iframes horizontal padding to the parentNode
* @param {int} VPadding
* iframes vertical padding to the parentNode
* @return {Object}
* the reference of the newly created iframe shim
*/
//> public Object add(Object, int, int);
add : function(poNode, piHPadding, piVPadding) {
var f, p="px",w,h,s;
if(this.check())
{
w = poNode.offsetWidth;
h = poNode.offsetHeight;
w += piHPadding?piHPadding:0;
h += piVPadding?piVPadding:0;
f = document.createElement('IFRAME');
s = f.style;
s.width = w + p;
s.height = h + p;
s.filter = "chroma(color='white')";
f.frameBorder= 0;
s.position = "absolute";
s.left = "0"+p;
s.top = "0"+p;
s.zIndex="-1";
s.filter="Alpha(Opacity=\"0\")";
if(document.location.protocol=="https:"){
f.src = "https://securepics.ebaystatic.com/aw/pics/s.gif";
}
poNode.appendChild(f);
return f;
}
return null;
},
/**
* Remove the iframe shim from the node.
*
* @param {Object}
* the parent node that the iframe appends to
* @param {Object}
* the iframe that will be removed
*/
//> public void remove(Object, Object);
remove : function(poDiv,poIframe) {
if(this.check())
{
//if(poIframe && poIframe.parentElement)
//{
// poDiv.removeChild(poIframe);
//}
if(poIframe && poIframe.parentNode)
{
poIframe.parentNode.removeChild(poIframe);
}
}
},
//> private boolean check();
check : function() {
var B = vjo.dsf.client.Browser;
return (B.bIE || B.bFirefox);
}
})
.endType();
vjo.ctype("vjo.darwin.core.overlaypanel3.OverlayPanel")
.needs("vjo.dsf.client.Browser","B")
.needs( "vjo.dsf.Element","E")
.needs( "vjo.dsf.document.Shim","S")
.needs( "vjo.dsf.EventDispatcher","EV")
.needs( "vjo.darwin.core.utils.ServiceUtils","SE")
.needs('vjo.Registry')
//> needs vjo.dsf.Message
.protos({
m : null,// public void constructs(com.ebay.darwin.component.core.overlaypanel3.basic.OverlayPanelJsModel jsmdl)
constructs: function(jsmdl){
var t = this, J = t.J = t.vj$, B,
M=t.m=jsmdl,
E = J.E,
I=t.sId =M.CId;
//t.oOlp = E.get(t.sId);
t.Open = false;
t.sJsId =M.CJId;
t.cW=M.cW; //content width without scrollbar
t.minTries = 0;
t.maxTries = 10;
t.isPromoted = false;
t.promote2bodyFunc = function(){
if (t.minTries >= t.maxTries) return;
var readyState = document.documentElement.doScroll;
try {
if(readyState) readyState("left");
t.J.E.promoteToBody(t.sId);
t.isPromoted = true;
} catch(err) {
t.minTries++;
setTimeout(t.promote2bodyFunc, 200);
}
};
t.rgEH( 'load', t.promote2bodyFunc);
//if (t.oOlp)promote2bodyFunc();
//close timer
t.ct=null;
//starttimer
t.st=null;
//mouse state
t.mst=-1;
// reference element
t.refE=null;
t.ifm =null;
B=J.B;
t.IE= B.bIE && B.iVer<7;
M.sOn = !t.IE;
t.fCall=false;
t.AC = M.ACC; // Is the OverlayPanel Accessible or not
// content holder
//t.ctr=E.get(t.sId+"_olp_pad");
var f1=function(m){
t.open(m);
},
f2=function(m){
t.close(m);
},
f3=function(m){
var cl = J.E.get(t.sId+"_cbtn" ||t.sId+"_ctxt"),// close link or close button
ms =t.m.HM;// has mask
try{
if(ms && cl){
t.sa.focus();
return;
}
else if(t.refE){
if(t.m.ICOMO && t.TE) // add flag only for overlay which closes on mouseout and trigger element is focusible
t.skip=true;
t.refE.focus();
}
}catch(ex){
t.skip = false;
}
if(t.m.ICOMO || !cl) // if close link or close button not there then close when focus reaches to end anchor
t.close(m);
};
//instance for custom positioning ,the method position is called from this obejct
t.cusPos=null;
J.SE.rgSv(M.OSN+I,f1,t.sId);
J.SE.rgSv(M.CSN+I,f2,t.sId);
// handler to close all overlays
J.SE.rgSvRsp(M.CSN+'ALL',f2,t.sId);
J.SE.rgSv('ALL'+M.CSN,f2,t.sId);
if(t.AC){ // Set the handlers only if accessibility is supported
// on focus of end anchor the focus goes to triggering element
J.EV.addEventListener(M.CId+"_ea",'focus',f3,t); // added for accessibility
}
},
//>private boolean isTE(HTMLElement)
isTE : function(elm){
var t = this,
f = false;
for(var i=0, l=t.LST.length;ipublic void setCon(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum msg)
setCon : function(msg){
var content = msg.cnt;
if(!content) return;
var t=this,
cnt=t.getCtr(t),
cntC =cnt.childNodes, l=cntC.length,
isStr = (typeof content == "string") ;
if (isStr)
{
cnt.innerHTML = content;
} else {
for (var i=0;ipublic void onResize()
onResize : function(t){
if(!t)t=this;
if(t.Open && (t.refE || t.m.SIC )) { t.posPanel(t.oOlp,t.refE); }
},
regEvt : function(){
var t=this,
rF=function()
{
t.onResize(t);
};
if(!t.m.STK){
t.rgEH('resize' ,rF);
t.rgEH( 'scroll' ,rF);
}
var f1=function(e){
if(!t.Open)return;
var el=e.nativeEvent.srcElement || e.nativeEvent.target;
if(!t.m.COB)
return;
while(el){
if(el.id==t.sId || (t.refE && t.refE.id==el.id)){
return ;
}
el=el.parentNode;
}
t.close();
};
//calling addEventListener is not working properly in case of MyeBay so changed to add
t.J.EV.add('body','click' ,f1,t);
t.fCall=true;
},
// function to register event handler
rgEH: function(evt,hnd)
{
this.J.EV.addEventListener(window, evt ,hnd, window);
},
/* used to set custom position logic for overlay .The object that is passed must implement the method position which should return back
the following values [ overlaypanel's top, overlaypanel's left, overlaypanel's width,overlaypanel's height ];*/
//>public void setPositionHandler(Object handler)
setPositionHandler: function(handler){
this.cusPos=handler;
},
//>public void open(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum message)
//>public void open(vjo.dsf.Message message)
open : function(message)
{ var t=this, cnt=t.getCtr(t),rid,mm,
f4=function(){
t.skip=false;
};
if (!t.isPromoted) t.promote2bodyFunc();
t.getOlp(t);
if(t.skip && t.AC && t.m.ICOMO){
t.skip=false;
if(t.refE)
t.refE.focus();
return;
}
if(message) {
rid=message.sAnchorId,
cnt=t.ctr;
t.refE=(rid && rid.getAttribute)?rid:t.J.E.get(rid),
mm = message.model;
t.setCon(message);
(mm) ? t.setVals(mm) : '';
if(message.dspModel)
t.setMdl(message.dspModel,message.cmpId);
if(mm){
if(mm.posHandler)t.cusPos=mm.posHandler;
if(mm.VOF) t.m.VOF = mm.VOF; //Sets the Vertical Offset in model
if(mm.HOF) t.m.HOF = mm.HOF;//Sets the horizontal Offset in model
}
if(message.ho!=null)
t.m.ICOMO=message.ho;
}
(!t.fCall) ? t.regEvt() : '';
if(t.ctr)t.ctr.scrollTop=0; //BUGDB00615277
if(t.m.ICOMO)
clearTimeout(t.ct);
var f=function()
{
if(! t.ifm && t.oOlp && t.IE){
t.ifm = t.J.S.add(t.oOlp);
}
var anchObj = t.refE;
if (anchObj || t.m.SIC)
t.posPanel(t.oOlp, anchObj);
else {
t.oOlp.style.visibility="hidden";
return;
}
t.oOlp.style.visibility = 'visible';
t.Open = true;
//var sa = t.J.E.get( (t.m.SA == '_sa')? (t.m.CId+t.m.SA) : t.m.SA);
//added to move focus to starting anchor of the overlay
t.sa = t.J.E.get(t.m.CId+"_sa");
if(t.sa && t.Open && t.AC){
try{
if(!(t.AC && t.refE && t.refE.getAttribute && t.refE.getAttribute('ska'))){
t.sa.focus();
}
}catch(ex){
}
}
if(t.refE && t.isTE(t.refE)){
t.TE = true;
}
if(t.refE && t.AC && t.m.ICOMO){
t.J.EV.detachHandler(t.refE.id,'focus',f4);
t.J.EV.add(t.refE.id,'focus',f4,t); // added for accessibility
}
t.J.SE.sndM(t.m.POSN+t.sId);
var mskM=t.J.SE.gM(t.m.MCO);
mskM.containerId=t.sId;
if(t.m.HM)
t.J.SE.sndM(mskM);
};
clearTimeout(t.st);
t.st=setTimeout(f,t.m.OD);
},
setVals : function(m){
var t=this,md=t.m;
(m[4])? (md.scrbl=(m[4]=='true')?true:false ): '';
(m[5]) ? md.scrlH=parseInt(m[5]) : 0;
(m[1]) ? md.HA=m[1] : '';
(m[7]) ? md.VA=m[7] : '';
var ce=t.J.E.get(t.sId+'_cbtn');
if(ce)ce.style.display=(m[9]=='true')?'inline':'none';
md.ICOMO=(m[12]=='true')?true:false;
md.HOF=(m[10]!=null)?parseInt(m[10]):0;
md.VOF=(m[11]!=null)?parseInt(m[11]):0;
},
posPanel:function(olp,refElem)
{
var u='px',
t=this, m = t.m,
h=t.cusPos?t.cusPos: (vjo.Registry.get(m.HJId));
if(!h)return;
var p=h.position(olp, refElem, m.HA, m.VA, m);
// add iframe to avoid bleed througn issue in IE
if(t.ifm){ var ifmS=t.ifm.style;
ifmS.top='0'+u;
ifmS.left='0'+u;
ifmS.width=p[2]+u;
ifmS.height=p[3]+u;
}
},
//> public void setMState(int state)
setMState: function(state)
{
this.mst=state;
},
//> public void onMout()
onMout: function()
{
var t=this;
var f=function()
{
if (t.mst === 0 && t.m.ICOMO) {
t.mst = -1;
t.close();
}
};
setTimeout(f,50);
},
//> public void onMout()
onMin: function()
{
if(this.m.ICOMO)
clearTimeout(this.ct);
},
//> public void close(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum message)
close: function(message){
var t = this,
f =function(){
if(!t.oOlp) return;
var s = t.oOlp.style;
s.visibility = 'hidden';
s.left = "-1000px";
t.Open = false;
//if isRetire parameter is set to true then dont broadcast the pre/post close message object.
//this can be used when user wants to close the overlay but dont want to trigger pre/post close service handler.
var isRetire = (message && message.isRetire);
if (!isRetire) {
//broadcast post close messsasge
t.J.SE.sndM(t.m.PCSN+t.sId);
//broadcast message to close Mask
if(t.m.HM)
t.J.SE.sndM(t.m.MCI);
}
};
// This block is added to set the focus back to the triggering element once the close button or close link is being clicked
if(message && t.AC){
var aid = message.sAnchorId,flg = aid && (aid ==t.sId+"_cbtn") || (aid==t.sId+"_ctxt");
if(flg){
if(t.refE){
if(t.m.ICOMO && t.TE)
t.skip = true;
try{
t.refE.focus();
}catch(ex){
t.skip = false;
}
}
}
}
clearTimeout(t.ct);
t.ct=setTimeout(f,(message && message.ignDelay)?0:t.m.CD);
}
})
.props({
//> public void olpMsg(String messageId)
//> public void olpMsg(String messageId,String anchorId)
//> public void olpMsg(String messageId,String anchorId, Object cnt)
//> public void olpMsg(String messageId,String anchorId, Object cnt, Object model)
//> public void olpMsg(String messageId,String anchorId, Object cnt, Object model, Object ho, Object delay)
olpMsg: function(messageId, anchorId,cnt,model,ho,delay){
var o=this.vj$.SE,m=o.gM(messageId);
m.sAnchorId=anchorId;
if(cnt)m.cnt=cnt;
if(model)m.model=model;
if(ho!=null)m.ho=ho;
if(delay!=null)m.ignDelay=delay;
o.sndM(m);
},
sendMessage : function(svcId, model) {
this.olpMsg(svcId, model.anchorId, model.cnt, model);
},
registerEvent : function(model, openServiceId, closeServiceId, openEvent, closeEvent) {
var t=this,
handler = vjo.dsf.EventDispatcher,
f1 = function() { t.sendMessage(openServiceId, model)},
f2 = function() { t.sendMessage(closeServiceId, model)};
handler.add(model.anchorId,openEvent,f1,t);
handler.add(model.anchorId,closeEvent,f2,t);
},
// this function returns true if the idx th bit of the integer num is 1 else returns false
i2B: function(num, idx)
{
var val = num.toString(2),
l = val.length-1,
ds = (idx-l)< 0 ? -(idx-l) : (idx-l);
if(idx>=val.length) return false;
return (val.charAt(ds) == 1);
}
}).endType();
vjo.ctype("vjo.darwin.core.utils.WindowDimension") // public int[] getBrowserDimension()
getBrowserDimension : function() {
/*var s = self,d = document.documentElement || document.body;
if (s.innerHeight){
// all except Explorer
return [ s.innerWidth , s.innerHeight] ;
}else if (d){
return [ d.clientWidth , d.clientHeight];
}*/
var s = self;
var d = document;
var de = d.documentElement;
if (s.innerHeight){
// all except Explorer
return [ s.innerWidth , s.innerHeight] ;
}else if (de && de.clientHeight){
// Explorer 6 Strict Mode
return [de.clientWidth , de.clientHeight];
}
return [d.body.clientWidth, d.body.clientHeight];
},
//> public int[] getScrollXY()
getScrollXY : function() {
var scrOfX = 0, scrOfY = 0,scrOfH = 0, scrOfW = 0, d = document.documentElement || document.body;
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
return [window.pageXOffset,window.pageYOffset,document.height,document.width];
} else if( d ) {
return [ d.scrollLeft, d.scrollTop,d.scrollHeight, d.scrollWidth];
}
return [ scrOfX, scrOfY,scrOfH,scrOfW ];
},
//> public int[] getOffsetPosition(Object poElem)
getOffsetPosition : function(poElem) {
var e = poElem, l = 0,t=0,z=0,tz,
h = e.offsetHeight,w = e.offsetWidth;
while (e)
{
l += e.offsetLeft;
t += e.offsetTop;
if(e.style) {
tz=parseInt(e.style.zIndex,10);
z=!isNaN(tz)&&tz>z?tz:z;
}
e = e.offsetParent;
}
return [l,t,z,h,w];
}
}).endType();
vjo.ctype("vjo.darwin.core.overlaypanel3.ZIndexUtil")
.props({
//hasM = is Mask enabled, mzid=min zindex, bzid=base overlay zindex, czid=calculated zindex based on trigger element
//>public int getNewZIndex(boolean,int,int,int)
getNewZIndex : function(hasM, mzid, bzid, czid) {
if(!bzid&&!czid) {return 0;}
var z=((hasM==false)? mzid : bzid); //If masking present use Base zIndex or use minimal z-index
z=(czid&&czid>=z)?czid : z;
return (z+10);
}
}).endType();vjo.ctype("vjo.darwin.core.overlaypanel3.PositionElement")
.needs("vjo.darwin.core.overlaypanel3.ZIndexUtil","ZU")
.needs("vjo.darwin.core.utils.WindowDimension")
.needs('vjo.dsf.Element')
.protos({
cBT : false,// public constructs(boolean chkBT)
constructs:function(chkBT)
{
this.cBT=chkBT;
this.W = vjo.darwin.core.utils.WindowDimension;
},
position : function(olp,refElem ,halign,valign,model)
{
var t = this,tp='top',bt='bottom',rt='right',lt='left', u='px', oc = vjo.dsf.Element.get(olp.id+"_olp_pad"),
ocS=oc.style,id=model.overlayCompId ,scrbl=model.scrbl,scrlH=model.scrlH,md=model,z=0,
olpS = olp.style;
ocS.height = (scrlH>0)?(scrlH+u):'auto';
//removing scrollbar
ocS.overflowY= (scrlH>0)?'auto':"";
ocS.overflowX = "";
//to fix rendering issue in IE 6
olpS.left ='-1000px';
olpS.top ='-1000px';
var ofst=25,
P=t.P,
hof=model.HOF,
vof=model.VOF,
iW = olp.offsetWidth,
iH = olp.offsetHeight;
var W=t.W,wD= W.getBrowserDimension(),
aS = W.getScrollXY(),finalZ=0;
var finalX;
var finalY;
if(model.SIC){
// Position At the center of the screen or a container element
var idx=model.CID, con=vjo.dsf.Element.get(idx),
cW=idx?con.offsetWidth:wD[0],cH=idx?con.offsetHeight:wD[1],
cd=idx?t.W.getOffsetPosition(con):aS;
finalX=(cW-iW)/2+cd[0];
finalY=(cH-iH)/2+cd[1];
if(iH>(wD[1]+ ofst))
finalY=aS[1]+ofst;
finalZ=cd[2]?cd[2]:finalZ;
}
else if(refElem)
{
//Position below a trigger element
var rH=refElem.offsetHeight,
rW=refElem.offsetWidth,
oP=W.getOffsetPosition(refElem),
rX=oP[0],
rY= oP[1],
x =rX-aS[0],
y= rY-aS[1],
spB=wD[1]-y-rH-ofst,
spT=y-ofst,
ovh=0,
vAl=bt,hAl;
//calculating Top posiiton of overlay
if( (( iH+vof) spT)
{
finalY=rY+rH+vof;
ovh=spB;
}
else
{
ovh=spT;
finalY=(scrbl && (ovh> 55 ) )?(rY-spT):(rY-iH-vof);
vAl=tp;
}
if( scrbl && (ovh> 55 )) {
//setting scrollbar
ocS.overflowY = "auto";
ocS.overflowX="hidden";
ocS.height =(scrlH>0)?(scrlH + u) :(ovh-ofst+u);
}
}
}
// recalculating Overlay dimensions after setting scrollbar as the size may be altered
iW = olp.offsetWidth;
rW=refElem.offsetWidth;
var offsetP=W.getOffsetPosition(refElem);
rX=offsetP[0];
//Calculating Left position
if( ( ( (iW+ofst+hof)<(wD[0]-x) ) && halign=='auto' ) ||( halign ==lt) )
{
finalX= rX+hof+hof;
hAl=lt;
}
else if( ( ( (iW+ofst+hof)needs(vjo.dsf.Message)
.protos({
IE : false,// public constructs(String id,String png,String gif,String oid,String cid)
//> public constructs(String id,String png,String gif,String oid,String cid,int zindx)
constructs : function (id,png,gif,oid,cid,zidx) {
var t = this,
b = vjo.dsf.client.Browser;
t.IE = (b.bIE && b.iVer <= 6);
var o;
if(!o) {
t.o = o = t.vj$.E.createElement('DIV');
o.id = id;
}
t.minTries = 0;
t.maxTries = 10;
t.promote2bodyFunc = function() {
var readyState = document.documentElement.doScroll;
try {
if (t.minTries >= t.maxTries) return;
if(readyState) readyState("left");
var b = document.body;
if(b) b.appendChild(t.o);
t.isPromoted = true;
}catch(err){
t.minTries++;
setTimeout(t.promote2bodyFunc, 200);
}
};
var url =(t.IE)?gif:png;
if (o) {
var s = t.st= o.style;
s.position="absolute";
s.display="none";
s.top="0";
s.left="0";
s.zIndex=(zidx?zidx:5000)+'';
s.background ='transparent url('+url+') repeat left top';
}
t.ar = [];
var f1=function(m)
{
t.open(m);
}
var f2=function(m)
{
t.close();
}
var j=t.vj$.SE;
j.rgSv(oid+id,f1);
j.rgSv(cid+id,f2);
},
//>public void open(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum pMsg)
//>public void open(Message)
open : function(pMsg) {
var t = this,s=t.st;
if(!t.isPromoted) t.promote2bodyFunc();
//making the mask display as block and setting the bgimage
s.display="block";
t.setWH();
if(t.IE) t.dEs(true,pMsg.containerId);
var rF=function()
{
t.setWH();
}
t.vj$.EV.addEventListener(window, 'resize',rF, window);
},
//> public void close()
close : function() {
var t=this;
t.st.display="none";
if(t.IE) t.dEs(false);
},
//get all the enabled select boxes in the page
mkAr : function(containerId){
var t = this,
sels = document.body.getElementsByTagName("select"),
k=0,
l = sels.length,
id,
cntr = t.vj$.E.get(containerId);
for (id = 0; id public void dEs(boolean,String)
//>public void dEs(boolean)
dEs : function(eOrd,containerId)
{
var t=this.ar, i;
if(eOrd) this.mkAr(containerId);
var l = t.length;
for(i=0;ipublic void sndMsg(String pSrvId,String id)
//>public void sndMsg(String pSrvId)
sndMsg : function(pSrvId,id){
var o=vjo.darwin.core.utils.ServiceUtils,m=o.gM(pSrvId);
m.containerId = id;
o.sndM(m);
}
})
.endType();
/* wiki link : http://wiki.arch.ebay.com/index.php?page=V4_Yoda_VJO_UPREV */
vjo.ctype('vjo.darwin.core.utils.WindowUtils') //< public
.props({
eventTop : function(ev) {
var t=this, de=document.documentElement, db= document.body;
if (ev.pageY != null) { return ev.pageY; }
if (de)
return ev.clientY + Math.max(de.scrollTop,db.scrollTop);
else
return ev.clientY + db.scrollTop;
},
eventLeft : function(ev) {
var t=this, de=document.documentElement, db= document.body;
if (ev.pageX != null) { return ev.pageX; }
if (de)
return ev.clientX + Math.max(de.scrollLeft,db.scrollLeft);
else
return ev.clientX + db.scrollLeft;
},
offsetTop : function(e) {
var d= document.documentElement, c = (d && d.clientTop)? d.clientTop:0;
for (var o = 0;(e != null);e = e.offsetParent)
o += e.offsetTop;
return o + c;
}
})
.endType();
vjo.ctype("vjo.darwin.core.utils.DragUtils")
.needs("vjo.dsf.Element","E")
.needs("vjo.dsf.EventDispatcher","ED")
.needs("vjo.darwin.core.utils.WindowUtils","W")
.needs("vjo.darwin.core.utils.WindowDimension","WD")
.protos({
stDrag : false,// public constructs(String regId,String cId)
constructs:function(regId,cId){
var t=this;
t.stDrag=false;
t.xPix='';
t.yPix='';
t.xOs='';
t.yOs='';
t.p='';
t.regId=regId;
t.cId=cId;
},
//register drag events
//> public void regDrag()
regDrag:function(){
var t=this;
var f3=function(e)
{
var srcTagName = e.srcElement ||e.target;
var ignorableElems = ['SELECT','INPUT','TEXTAREA'];
for(var i=0;ipublic void stopDrag(Object)
stopDrag:function(t)
{
t.stDrag=false;
},
//>public void startDrag(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum event,Object)
startDrag:function(event,t)
{
var J=t.vj$;
t.stDrag=true;
t.xPx=J.W.eventLeft(event);
t.yPx=J.W.eventTop(event);
t.p=J.WD.getOffsetPosition(J.E.get(t.cId));
},
//>public drag(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum eventObj,Object)
drag:function(event,t)
{
var J=t.vj$;
if(typeof event!="undefined"){
if(t.cId!==null && t.stDrag===true){
t.xOs=J.W.eventLeft(event);
t.yOs=J.W.eventTop(event);
var oS=(J.E.get(t.cId)).style, lt=t.xOs-t.xPx+t.p[0] ,tp=t.yOs-t.yPx+t.p[1];
if(lt<0){lt=0;}
if(tp<0){tp=0;}
oS.left=lt+"px";
oS.top=tp+"px";
}
}
}
}).endType();
vjo.ctype("vjo.darwin.core.overlaypanel3.harrow.OverlayPanelWithHArrow")
.needs("vjo.darwin.core.utils.WindowDimension")
.needs( "vjo.dsf.Element","E")
.needs("vjo.darwin.core.overlaypanel3.ZIndexUtil","ZU")
.needs("vjo.dsf.client.Browser","B")
.protos({
st : null,// public constructs(String arrId,String[] styles,int yof,String pointPos,String arHW)
constructs:function(arrId,styles,yof,pointPos,arHW)
{
var t=this;
var E=t.E=t.vj$.E;
t.st=styles;
t.yof=yof;
t.aHW=arHW;
t.pP = pointPos;
t.ar=E.get(arrId);
var b = t.vj$.B;
t.IE = (b.bIE && b.iVer <= 6);
t.W =vjo.darwin.core.utils.WindowDimension;//oH/2 )?-28:0)+(rY- oY)+u
if( rXoH/2)
st=(rXpublic constructs(String itemId, String itemUrl)
constructs: function(itemId, itemUrl){
var t=this;
t.itemId=itemId;
t.itemUrl=itemUrl;
},
//>public void onContinue()
onContinue: function(){
var url=this.itemUrl+this.itemId;
window.open(url,"CoreItemWin");
history.go(-1);
},
//>public onCancel()
onCancel: function(){
history.go(-1);
}
});vjo.type("vjo.ebay.darwin.ebox.gbh.viewitem.sellerinfo.SellerInfo")
.protos({
/**
* @return Void
* @access public
* @param {String} imgId
* @param {String} srcImg
*/
constructs: function(imgId,srcImg){
var t=this;
t.imgId=imgId;
t.srcImg=srcImg;
t.changeImg();
},
/**
* @return Void
* @access public
*/
changeImg: function(){
var t=this;
var oImg=new Image;
var oEl = document.getElementById(t.imgId);
oImg.onload = function(){
t.resizeImage(oImg,oEl,64);
oEl.src=oImg.src;
};
oImg.onerror = function(){
t.srcImg="http://pics.ebaystatic.com/aw/pics/row/gbh/shared/SellerBlank.gif";
t.changeImg();
}
oImg.src=t.srcImg;
},
/**
* @return Void
* @access private
*/
resizeImage: function(oSrcImg, oTgtImg, iSz){
if(iSz) iSize = iSz;
else iSize = oTgtImg.parentNode.offsetHeight;
if(oSrcImg && oTgtImg) {
var aspect = oSrcImg.width/oSrcImg.height;
if(oSrcImg.width >= oSrcImg.height) {
if(oSrcImg.width > iSize) {
oTgtImg.width = iSize;
oTgtImg.height = parseInt(iSize/aspect);
}
else {
oTgtImg.width = oSrcImg.width;
oTgtImg.height = oSrcImg.height;
}
}
else {
if(oSrcImg.height > iSize) {
oTgtImg.width = parseInt(iSize*aspect);
oTgtImg.height = iSize;
}
else {
oTgtImg.width = oSrcImg.width;
oTgtImg.height = oSrcImg.height;
}
}
}
}
});/**
* This class contains functions for getting elements position info
*
*/
vjo.ctype("vjo.dsf.document.Positioning")
.props({
/**
* Gets the number of pixels that the content is scrolled to the left and
* top. This function will return an Array structure which has two elements -
* the first one is the pixel number of scorlled content to left, and the
* other one is the number to top.
*
* Examples:
*
* var offsets = getScrollLeftTop();
* alert("The left offset is: " + offsets[0]);
* alert("The top offset is: " + offsets[1]);
*
*
* @return {Object}
* an array structure that contains number of pixels of scorlled
* content to left and top
*/
//> public Object getScrollLeftTop();
getScrollLeftTop : function() {
var d = document, rv = [0,0], db = d.body, de = d.documentElement;
if (db)
{
rv[0] += db.scrollLeft;
rv[1] += db.scrollTop;
}
if (de)
{
//using xhtml1-transitional.dtd de scrolltop needs to be appended
rv[0] += de.scrollLeft;
rv[1] += de.scrollTop;
}
return rv;
},
/**
* Gets the number of pixels that the upper left corner of the current
* element is offset to the left within the offsetParent node.
*
* @param {Object} elem
* an element to be got the number of pixels
* @return {int}
* the number of pixels of the element's offset to the left
*/
//> public int getOffsetLeft(Object);
getOffsetLeft : function(poElem) {
var e = poElem, l = 0;
while (e)
{
l += e.offsetLeft;
e = e.offsetParent;
}
return l;
},
/**
* Gets the number of pixels that the upper left corner of the current
* element is offset to the top within the offsetParent node.
*
* @param {Object} elem
* an element to be got the number of pixels
* @return {int}
* the number of pixels of the element's offset to the top
*/
//> public int getOffsetTop(Object);
getOffsetTop : function(poElem) {
var e = poElem, t = 0;
while (e)
{
t += e.offsetTop;
e = e.offsetParent;
}
return t;
},
/**
* Gets the number of pixels of the content's width.
*
* @return {int}
* the number of pixels of the content's width
*/
//> public int getClientWidth();
getClientWidth : function() {
var s = self, d = document, de = d.documentElement, w;
if (s.innerWidth)
{
w = s.innerWidth;
}
else if (de && de.clientWidth)
{
w = de.clientWidth;
}
else
{
w = d.body.clientWidth;
}
return w;
},
/**
* Gets the number of pixels of the content's height.
*
* @return {int}
* the number of pixels of the content's height
*/
//> public int getClientHeight();
getClientHeight : function() {
var s = self, d = document, de = d.documentElement, h;
if (s.innerHeight)
{
h = s.innerHeight;
}
else if (de && de.clientHeight)
{
h = de.clientHeight;
}
else
{
h = d.body.clientHeight;
}
return h;
},
/**
* Gets the number of pixels that the event element's offset to the left and
* top. This function will return an array structure which has two elements
* - the first one is the pixels number of event element's offset to left,
* and the other one is to top.
*
* Examples:
*
* var eventOffsets = getScrollLeftTop(event);
* alert("The event left offset is: " + eventOffsets[0]);
* alert("The event top offset is: " + eventOffsets[1]);
*
*
* @return {Object}
* an array structure that contains number of pixels of event element's
* offset to left and top
*/
//> public Object getEventLeftTop(MouseEvent);
getEventLeftTop : function(poEvent) {
//Height offset isn't exact in non-IE. It doesn't accomodate for toolbars and
//status bar. Must be calculated by outer and inner height, minus a fixed height
//for status bar
var u = "undefined", evt = window.event || poEvent,
xOff = (typeof(screenLeft) != u) ? screenLeft : screenX,
yOff = (typeof(screenTop) != u) ? screenTop : (screenY + (outerHeight - innerHeight) - 25);
return [evt.screenX - xOff,evt.screenY - yOff];
}
})
.endType();
/**
* Attaches/detaches handlers on an event/service. This class encapsulates
* the related functions from {@link EventDispatcher} and {@link ServiceEngine}
*
* @see EventDispatcher
* @see SeriveEngine
*/
vjo.ctype("vjo.dsf.utils.Handlers")
.needs(["vjo.dsf.EventDispatcher",
"vjo.dsf.Message",
"vjo.dsf.ServiceEngine"])
.props({
ED : vjo.dsf.EventDispatcher, // public boolean attachEvt(Object, String, Object, Object);
attachEvt : function(target, type, func, scope){
return this.ED.addEventListener(target, type, func, scope);
},
/**
* Detaches a given handler from a DOM element.
*
* @param {Object} target
* A DOM element which the handler attached to
* @param {String} type
* An event type that the handler handles
* @param {Object} hdl
* a handler bound that is returned from attachEvt()
* @return {boolean}
* The boolean value to show whether this action is successful
* @see #attachEvt(Object, String, Object, Object)
*/
//> public boolean detachEvt(Object, String, Object);
detachEvt : function(target, type, hdl){
this.ED.removeEventListener(target, type, hdl);
return true;
},
/**
* Creates a new message for given service name.
*
* @param {String} svcName A name of service name this message sends to
* @return {vjo.dsf.Message} The new message for the given service name
*/
//> public vjo.dsf.Message newMsg(String);
newMsg : function(svcName){
return new vjo.dsf.Message(svcName);
},
/**
* Puts the giving message into the ServiceEngine. ServiceEngine calls all
* registered handlers in sequence to handle the message
*
* @param {vjo.dsf.Message} msg
* A service message to be processed
*/
//> public void handle(vjo.dsf.Message);
handle : function(msg){
this.SE.handleRequest(msg);
},
//> private Object createHdl(Object, Object, String);
createHdl : function(scope, func, name){
var scp = scope,
hdl = {};
hdl[name] = function(){func.apply(scp, arguments);};
return hdl;
},
/**
* Attaches a handler to a service. Only one handler could be attached per
* a service id
*
* @param {String} svcName
* A name of service to associate the handler with
* @param {Object} func
* A handler that represents the target service.
* @param {Object} scope
* A scope that the handler belongs to
*/
//> public void attachSvc(String, Object, Object);
attachSvc : function(svcName, func, scope){
var t = this,
hdl = t.createHdl(scope, func, 'invoke');
if(t.SE && hdl){
t.SE.registerSvcHdl(svcName, hdl);
}
},
/**
* Attaches a request handler to a service.There can be multiple service
* request handlers for a given service id.
*
* @param {String} svcName
* A name of service to associate the handler with
* @param {Object} func
* A function that represents the target service.
* @param {Object} scope
* A scope that the handler belongs to
*/
//> public void attachSvcReqt(String, Object, Object);
attachSvcReqt : function(svcName, func, scope){
var t = this,
hdl = t.createHdl(scope, func, 'handleRequest');
if(t.SE && hdl){
t.SE.registerSvcReqtHdl(svcName, hdl);
}
},
/**
* Attaches a response handler to a service. These handlers should be able to
* use the data provided by the service. There can be multiple service
* response handlers for a given service id. In an Ajax call, these handlers
* would be equivalent to a callback function. When the response gets back
* to the client, these handlers are notified.
*
* @param {String} svcName
* A name of service to associate the handler with
* @param {Object} func
* A function that represents the target service.
* @param {Object} scope
* A scope that the handler belongs to
*/
//> public void attachSvcResp(String, Object, Object);
attachSvcResp : function(svcName, func, scope){
var t = this,
hdl = t.createHdl(scope, func, 'handleResponse');
if(t.SE && hdl){
t.SE.registerSvcRespHdl(svcName, hdl);
}
},
/**
* Detaches the handler from a specified service.
* @param {String} svcName
* A name of service to detach the handler from
*/
//> public void resetSvc(String);
resetSvc : function(svcName){
this.SE.inProcHdl.svcHdls[svcName] = [];
},
/**
* Detaches all request handlers from a specified service.
* @param {String} svcName
* A name of service to detach the handler from
*/
//> public void resetSvcReqt(String);
resetSvcReqt : function(svcName){
this.SE.svcReqtHdls[svcName] = [];
},
/**
* Detaches all response handlers from a specified service.
* @param {String} svcName
* A name of service to detach the handler from
*/
//> public void resetSvcResp(String);
resetSvcResp : function(svcName){
this.SE.svcRespHdls[svcName] = [];
}
})
.endType();
/**
* Provides utilities to get the browser window's position and size informations.
*/
vjo.ctype("vjo.dsf.window.utils.VjWindowUtils")
.props({
/**
* Gets the height value of the browser window.
*
* @return {int}
* The hight value of the browser window
*/
//> public int getBrowserWindowHeight();
getBrowserWindowHeight : function() {
var s = self;
var d = document;
var de = d.documentElement;
if (s.innerHeight){
// all except Explorer
return s.innerHeight;
}else if (de && de.clientHeight){
// Explorer 6 Strict Mode
return de.clientHeight;
}
return d.body.clientHeight;
},
/**
* Gets the width value of the browser window.
*
* @return {int}
* The width value of the browser window
*/
//> public int getBrowserWindowWidth();
getBrowserWindowWidth : function() {
var s = self;
var d = document;
var de = d.documentElement;
if (s.innerWidth){
// all except Explorer
return s.innerWidth;
}else if (de && de.clientWidth){
// Explorer 6 Strict Mode
return de.clientWidth;
}
return d.body.clientWidth;
},
/**
* Gets the distance from the top-left corner of the page's current
* displayed part to the top-left corner of the page.
*
* @return {Object}
* An array contains the position information as [X,Y]
*/
//> public Object getScrollXY();
getScrollXY : function() {
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
//DOM compliant
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
return [ scrOfX, scrOfY ];
},
//> public String toPixels(int);
toPixels : function(number) {
return number + "px";
},
/**
* Gets the vertical distance from the top-left corner of the page's current
* displayed part to the top side of the page.
*
* @return {int}
* The value of the distance
* @see #clientTop
* @see #browserTop
*/
//> public int scrollTop();
scrollTop : function() {
if (window.pageYOffset != null) { return window.pageYOffset; }
if (document.documentElement) { return Math.max(document.documentElement.scrollTop,document.body.scrollTop); }
else { return document.body.scrollTop; }
},
/**
* Gets the horizontal distance from the top-left corner of the page's
* current displayed part to the left side of the page.
*
* @return {int}
* The value of the distance
* @see #clientLeft
* @see #browserLeft
*/
//> public int scrollLeft();
scrollLeft : function() {
if (window.pageXOffset != null) { return window.pageXOffset; }
if (document.documentElement) { return Math.max(document.documentElement.scrollLeft,document.body.scrollLeft); }
else { return document.body.scrollLeft; }
},
/**
* Gets the page's actual width which includes the invisible part of the page.
*
* @return {int}
* The width value of the page.
* @see #scrollHeight
* @see #clientWidth
*/
//> public int scrollWidth();
scrollWidth : function() {
if (document.documentElement) { return document.documentElement.scrollWidth; }
else { return Math.max(document.body.scrollWidth,document.body.offsetWidth); }
},
/**
* Gets the page's actual height which includes the invisible part of the page.
*
* @return {int}
* The height value of the page
* @see #scrollWidth
* @see #clientHeight
*/
//> public int scrollHeight();
scrollHeight : function() {
if (document.documentElement) { return document.documentElement.scrollHeight; }
else { return Math.max(document.body.scrollHeight,document.body.offsetHeight); }
},
/**
* Gets the vertical distance from the top-left corner of the page to the top
* side of the page. It always returns 0
*
* @return {int}
* The value of the distance. It's always 0
* @see #scrollTop
* @see #browserTop
*/
//> public int clientTop();
clientTop : function() {
if (document.documentElement) { return document.documentElement.clientTop; }
else { return document.body.clientTop; }
},
/**
* Gets the horizontal distance from the top-left corner of the page to the
* left side of the page. It always returns 0
*
* @return {int}
* The value of the distance. It's always 0
* @see #scrollLeft
* @see #browserLeft
*/
//> public int clientLeft();
clientLeft : function() {
if (document.documentElement) { return document.documentElement.clientLeft; }
else { return document.body.clientLeft; }
},
/**
* Gets the page's display width in which the invisible part is not included.
*
* @return {int}
* The width value of the page's display part.
* @see #clientHeight
* @see #scrollWidth
*/
//> public int clientWidth();
clientWidth : function() {
var documentElement = document.documentElement;
if (documentElement && window.innerWidth) { return Math.min(documentElement.clientWidth,window.innerWidth); }
else if (documentElement && documentElement.clientWidth ) { return documentElement.clientWidth; }
else if (window.innerWidth) { return window.innerWidth; }
else if (document.body.clientWidth) { return document.body.clientWidth; }
else { return document.body.offsetWidth; }
},
/**
* Gets the page's display height in which the invisible part is not included.
*
* @return {int}
* The height value of the page's display part.
* @see #clientWidth
* @see #scrollHeight
*/
//> public int clientHeight();
clientHeight : function() {
var documentElement = document.documentElement;
if (documentElement && window.innerHeight) { return Math.min(documentElement.clientHeight,window.innerHeight); }
else if (documentElement && documentElement.clientHeight) { return documentElement.clientHeight; }
else if (window.innerHeight) { return window.innerHeight; }
else if (document.body.clientHeight) { return document.body.clientHeight; }
else { return document.body.offsetHeight; }
},
/**
* Gets the vertical distance from the top-left corner of the page to the top
* side of the screen.
*
* @return {int}
* The value of the distance
* @see #scrollTop
* @see #clientTop
*/
//> public int browserTop();
browserTop : function() {
return (window.innerHeight)?window.screenY + (window.outerHeight - window.innerHeight):window.screenTop;
},
/**
* Gets the horizontal distance from the top-left corner of the page to the left
* side of the screen.
*
* @return {int}
* The value of the distance
* @see #scrollLeft
* @see #browserLeft
*/
//> public int browserLeft();
browserLeft : function() {
return (window.innerWidth)?window.screenX + (window.outerWidth - window.innerWidth):window.screenLeft;
},
/**
* Gets the vertical distance from the mouse position to the top side of
* the page when a event is triggered.
*
* @return {int}
* The value of the distance
*/
//> public int eventTop(MouseEvent);
eventTop : function(event) {
if (event.pageY != null) { return event.pageY; }
if (document.documentElement) { return event.clientY + Math.max(document.documentElement.scrollTop,document.body.scrollTop); }
else { return event.clientY + document.body.scrollTop; }
},
/**
* Gets the horizontal distance from the mouse position to the left side of
* the page when a event is triggered.
*
* @return {int}
* The value of the distance
*/
//> public int eventLeft(MouseEvent);
eventLeft : function(event) {
if (event.pageX != null) { return event.pageX; }
if (document.documentElement) { return event.clientX + Math.max(document.documentElement.scrollLeft,document.body.scrollLeft); }
else { return event.clientX + document.body.scrollLeft; }
},
/**
* Gets the vertical distance from the top-left corner of the specified
* element to the top side of the page.
*
* @param {Object}
* A DOM element
* @return {int}
* The value of the distance
*/
//> public int offsetTop(HTMLElement);
offsetTop : function(element) {
var clientTop = (document.documentElement && document.documentElement.clientTop)?document.documentElement.clientTop:0;
for (var offsetTop = 0;(element != null);element = element.offsetParent) { offsetTop += element.offsetTop; }
return offsetTop + clientTop;
},
/**
* Gets the horizontal distance from the top-left corner of the specified
* element to the left side of the page.
*
* @param {Object}
* A DOM element
* @return {int}
* The value of the distance
*/
//> public int offsetLeft(HTMLElement);
offsetLeft : function(element) {
var clientLeft = (document.documentElement && document.documentElement.clientLeft)?document.documentElement.clientLeft:0;
for (var offsetLeft = 0;(element != null);element = element.offsetParent) { offsetLeft += element.offsetLeft; }
return offsetLeft + clientLeft;
},
/**
* Opens a new browser window with specified arguments. This function calls
* window.open().
*
* @param {String} url
* A specified URL of the page to open. If it is null,
* nothing would be shown in the new window
* @param {String} windowName
* An optional value string which will be passed as the second
* parameter to window.open(). This string contains the
* information about window's name and open target
* @param {vjo.dsf.window.utils.JsWindowFeatures} features
* An optional value string which will be passed as the third
* parameter to window.open(). This string contains the
* information about the display styles of the new window
* @return {Object}
* The reference of the newly opened window
*/
//> public Object openWindow(String,String,Object);
openWindow : function(url,name,features) {
var parameters = new Array();
var WindowUtils = vjo.dsf.window.utils.VjWindowUtils;
features.top = WindowUtils.browserTop() + Math.round((WindowUtils.clientHeight() - features.height)/2) + 25;
features.left = WindowUtils.browserLeft() + Math.round((WindowUtils.clientWidth() - features.width)/2);
for (var key in features) parameters.push(key.concat("=",features[key]));
return window.open(url,name,parameters.join(","),true);
}
})
.endType();
/**
* Invokes some actions periodically. There are three functions defined
* in this class which could be overwritten for the specify actions,
*
onTick - be invoked periodically with the interval time when timer is
* started
* onStart - be invoked when timer is started
* onStop - be invoked when timer is stopped
*/
vjo.ctype("vjo.dsf.utils.Timer")
.protos({
timer : null,
isRunning : false,
interval : null,
onTick : function(){},
onStart : null,
onStop : null,
/**
* Constructs a Timer object with default interval time.
*
* @constructor
* @param {int} interval
* a default interval time
*/
//> public void constructs(int);
constructs : function(intvl) {
this.interval = intvl;
},
/**
* Re-sets the interval time of the timer
*
* @param {int} interval
* an interval time to be set
*/
//> public void setInterval(int);
setInterval : function(ms) {
var t = this;
if (t.isRunning){
window.clearInterval(t.timer);
}
t.interval = ms;
// TODO -- adapt hitch function .. think ej2 has utility for this as well
if(t.isRunning){
t.setInt();
//t.timer = window.setInterval(vjo.hitch(t, this.onTick), t.interval);
}
//if (t.isRunning) timer = window.setInterval(dojo.lang.hitch(t, "onTick"), t.interval);
},
/**
* Invokes onStart event handler and Starts the timer.
*/
//> public void start();
start : function() {
var t = this;
if (typeof t.onStart == "function"){
t.onStart();
}
t.isRunning = true;
t.setInt();
//t.timer = window.setInterval(vjo.hitch(t, this.onTick), t.interval);
},
/**
* Stops the timer and invokes onStop handler.
*/
//> public void stop();
stop : function(){
var t = this;
if (typeof t.onStop == "function"){
t.onStop();
}
t.isRunning = false;
window.clearInterval(t.timer);
},
//> public void setInt();
setInt : function(){
var t = this; // public void registerOverlayPanel(com.ebay.darwin.component.core.overlaypanel.OverlayPanel poOverlayPanel)
registerOverlayPanel : function( poOverlayPanel ){
var t = this;
t.aOlps[t.aOlps.length] = poOverlayPanel;
} ,
//> public void initCloseOnMouseOut()
initCloseOnMouseOut : function(){
var t = this;
t.oCloseTimer = new vjo.dsf.utils.Timer(100);
var tCT= t.oCloseTimer;
tCT.onTick = function(){
var i = 0, arr = t.aOlps, len = arr.length;
while(i < len){
var olp = arr[i];
if(olp.bCloseOnMouseOut){
olp.tryCloseOnMouseOut();
}
i++;
}
};
tCT.start();
},
//[e559] wrapping zIndex access into a function
//> public long zIndex()
zIndex : function(){
var o = this.openAtZIndex;
o += 1;
return o;
},
//> public void requireResize()
requireResize : function(){
this.sIsActivated = true;
},
//added so that OverlayPanel could be re-rendered not bound to a window resize event
//olpCmpId is optional, if given, the overlay with this id will be re-rendered only, otherwise, all registered overlay will be re-rendered
//> public void forceResize(String olpCmpId)
forceResize : function(olpCmpId){
var t = this, i = 0;
for(var l=t.aOlps.length; i < l; i++){
var tO = t.aOlps[i];
if(olpCmpId && tO.sOverlayDivId == olpCmpId){
tO.onResize();
break;
}
else{
tO.onResize();
}
}
},
//> public void initResize()
initResize : function(){
var t = this,H=t.H;
H.detachEvt(window,'resize',t.initResize);
H.attachEvt(window,'resize',t.requireResize, t);
t.requireResize();
t.oResizeTimer = new vjo.dsf.utils.Timer(500);
var tRT=t.oResizeTimer;
// tRT.interval = 500;
tRT.onTick = function(){
var bA=t.sIsActivated;
if (bA){
for(var i=0, l=t.aOlps.length ; i public void resizeOlps()
resizeOlps : function(){
var i = 0,
t = this;
for (var l=t.aOlps.length; i needs vjo.dsf.Message
.protos({
sOverlayPanelJsCompId : null,// public constructs(String psId)
constructs: function (psId) {
this.sOverlayPanelJsCompId = psId;
},
//> public vjo.dsf.Message invoke(vjo.dsf.Message)
//> public vjo.dsf.Message invoke(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum message)
invoke: function(message){
var panel = vjo.Registry.get(this.sOverlayPanelJsCompId),
mO = message.bOver,
LS = message.leftOffset,
TS = message.topOffset,
mL = message.left,
mT = message.top,
pAC = panel.aAnchorCoor;
panel.fSetNotchLocation = message.fSetNotchLocation;
panel.oSetNotchLocationOverrider = message.oSetNotchLocationOverrider;
var como = true;
if(typeof(mO)!="undefined"){
como = mO;
}
panel.bCloseOnMouseOut = como;
panel.setAnchorName(message.sAnchorId);
//[e559] allowing message set with leftOffset, topOffset & initial position
// the left/top offset will be effective till the panel get's closed
panel.iTmpLftOfset = LS ? LS : 0;
panel.iTmpTopOfset = TS ? TS : 0;
pAC = (mL && mT) ? {x: mL, y: mT} : false;
if(message.bResetPosition){
panel.bPanelOpen = false;
}
panel.onOpenOverlayPanel(pAC || false);
message.returnData = false;
return message;
}
})
.endType();
vjo.ctype("vjo.darwin.core.overlaypanel.VjOverlayPanelCloseSvcHandler")
.needs('vjo.Registry')
//>needs vjo.darwin.core.overlaypanel.VjOverlayPanelMessage
.protos({
sOverlayPanelJsCompId : null,// public constructs(String psId)
constructs: function (psId) {
this.sOverlayPanelJsCompId = psId;
},
//> public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage invoke(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum message)
//> public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage invoke(vjo.darwin.core.overlaypanel.VjOverlayPanelMessage)
invoke: function(message){
var panel = vjo.Registry.get(this.sOverlayPanelJsCompId);
/**Method getCheckState is defined inside VjOverlayPanelMessage which inherits Message*/
panel.onClosePanel(message.getCheckState?message.getCheckState():false);
return message;
}
})
.endType();
vjo.ctype("vjo.darwin.core.overlaypanel.VjOverlayPanel")
.needs("vjo.dsf.client.Browser")
.needs("vjo.dsf.Element")
.needs("vjo.dsf.document.Positioning")
.needs("vjo.dsf.document.Shim")
.needs("vjo.dsf.utils.Handlers")
.needs("vjo.dsf.Message")
.needs("vjo.dsf.window.utils.VjWindowUtils")
.needs("vjo.darwin.core.overlaypanel.VjOverlayPanelController")
.needs("vjo.darwin.core.overlaypanel.VjOverlayPanelOpenSvcHandler")
.needs("vjo.darwin.core.overlaypanel.VjOverlayPanelCloseSvcHandler")
.inherits("vjo.dsf.utils.Timer")
.protos({
//optimization for finding domain
H : vjo.dsf.utils.Handlers,//type::vjo.darwin.core.overlaypanel.VjOverlayPanelController
PC : vjo.darwin.core.overlaypanel.VjOverlayPanelController,
E : vjo.dsf.Element,// public constructs(com.ebay.darwin.component.core.overlaypanel.OverlayPanelJsModel overlayJsModel)
constructs: function(overlayJsModel){
//[e559] naming shortened to reduce js weight
var t = this,
E = t.E;
t.sOverlayDivId = overlayJsModel.overlayCompId;
var sId = t.sOverlayDivId;
t.sOlpId = overlayJsModel.cmpWrapperId;
//[e559] hold nodes in adv to speed up opening
t.oOlp = E.get(sId);
t.oCntnt = E.get(sId+'olpcontent');
t.oShdw = E.get(sId+'olpshadow');
t.oArr = E.get(sId+'olparrow');
//[e573]enhancement for vertical pointers
t.pVt = overlayJsModel.pointerVertical;
t.sArrowVTL = overlayJsModel.arrowVTL;
t.sArrowVTR = overlayJsModel.arrowVTR;
t.sArrowVBL = overlayJsModel.arrowVBL;
t.sArrowVBR = overlayJsModel.arrowVBR;
t.sArrowTL = overlayJsModel.arrowTL;
t.sArrowTR = overlayJsModel.arrowTR;
t.sArrowBR = overlayJsModel.arrowBR;
t.sArrowBL = overlayJsModel.arrowBL;
//[e559] merged same value assignements in 1 line
t.iLastLeft = t.iLastTop = t.mouseState = -1;
t.initDx = t.initDy = t.top = t.left = t.iTmpLftOfset = t.iTmpTopOfset = 0;
t.bShownInCenter = overlayJsModel.isShownInCenter;
//[e559] const offset holds value from java bean, while temp ones will come from open msg, and expires after close
t.iCnstLftOfset = overlayJsModel.leftOffset;
t.iCnstTopOfset = overlayJsModel.topOffset;
//[e559] new attr for open msg to pass x, y position without anchor id
t.aAnchorCoor = false;
t.sHAlgn = overlayJsModel.horizontalAlign || false;
t.sVAlgn = overlayJsModel.verticalAlign || false;
t.iShdwOfset = overlayJsModel.shadowOffset;
t.iOpDlay = overlayJsModel.openDelay;
t.iClsDlay = overlayJsModel.closeDelay;
t.bCloseOnMouseOut = overlayJsModel.isCloseOnMouseOut;
t.bHasMask = overlayJsModel.hasMask;
//[e559] js name shortened to reduce weight
t.sOpMaskServId = overlayJsModel.openMaskServiceName;
t.sClsMaskServId = overlayJsModel.closeMaskServiceName;
t.sPostOpServId = overlayJsModel.postOpenedServiceName;
t.sPostClsServId = overlayJsModel.postClosedServiceName;
t.bAdjustSize = overlayJsModel.adjustSize;
//[e559] merge init assignment together
t.fSetNotchLocation = t.oSetNotchLocationOverrider = t.closeByButton = t.bPanelOpen = t.bCheckState= false;
//optimization for finding domain
t.sOpenServiceName = 'OPEN_OVERLAY_PANEL' + sId;
t.sCloseServiceName = 'CLOSE_OVERLAY_PANEL' + sId;
t.bSelfRegistry = overlayJsModel.selfRegistry;
t.bPromote2Body = overlayJsModel.promote2Body;
t.bPromoted = false;
//t.oHeader = E.get(sId+'olpctenttitle');
t.oWHeader = E.get(sId+'olpctnhd');
t.oCntn = E.get(sId+'_cnt_n');
t.oCntntBox = E.get(sId+'olpctnbox');
t.oCloseBtn = E.get(sId+'closebtn');
t.oCloseLink = E.get(sId+'closelink');
t.sJsId = overlayJsModel.cmpJsId;
t.bHeaderDraggable = overlayJsModel.headerDraggable;
t.bDraggable = overlayJsModel.draggable;
t.bHasCloseBtn = overlayJsModel.hasCloseBtn;
t.bHasCloseLink = overlayJsModel.hasCloseText;
t.icmpWidth = overlayJsModel.cmpWidth;
t.sCmpOpacity = overlayJsModel.cmpOpacity;
t.PC.registerOverlayPanel(t);
//[e559]
//drag timer moved into startDrag method
//mouseOutClose timer moved into VjOverlayPanelController, centralized 1.
//[e559]
//create iframe at the very beginning
//[e603] isIFrameOff option is provided to increase the performance on myebay page.
//due to this Iframe, users see about:blank request.
var ifrOffHidd = E.get("IFrameOff");
t.IfrOFF = false;
if ( ifrOffHidd) {
t.IfrOFF = ifrOffHidd.value;
}
/*
Commenting this code due to the performance issue and bug fix BUGDB00594589
IFrame should be attached only when user opens overlay. Better not to add IFrame for all the instances.
if( !t.IfrOFF && !t.oIFrame && t.oOlp){
t.oIFrame = vjo.dsf.document.Shim.add(t.oOlp);
//[e559] combined to aAnchorCoor
//this.coor = false;
}
*/
// register event
if (t.bSelfRegistry) {
t.init();
}
//BUGDB00580305
if(t.bPromote2Body){
var promote2bodyFunc = function(){t.promote2body(true);};
t.H.attachEvt(window, 'load', promote2bodyFunc, window);
}
t.strExt = ".gif";
t.pngs = overlayJsModel.pngImgs;
t.gifs = overlayJsModel.gifImgs;
if ( t.B.bIE && t.B.bWin && t.B.iVer > 5 && t.B.iVer <= 6 ) {
t.pngalpha = true;
t.strExt = ".png";
} else if ( (t.B.bFirefox) || (t.B.bSafari) || (t.B.bNav) || (t.B.bIE && t.B.bMac)
|| (t.B.bOpera && t.B.bWin && t.B.iVer >= 6) || (t.B.bOpera && t.B.iVer >= 6)
|| (t.B.bOpera && t.B.bMac && t.B.iVer >= 5) || (t.B.bWebTV)
|| (t.B.bIE && t.B.bWin && t.B.iVer > 6) ) {
t.pngnorm = true;
t.strExt = ".png";
if (!t.B.bSafari && t.oIFrame) {
t.oIFrame.style.visibility="hidden";
}
}
},
//> public void init()
init : function() {
var t = this,H = t.H,
open = new vjo.darwin.core.overlaypanel.VjOverlayPanelOpenSvcHandler(t.sJsId),
close = new vjo.darwin.core.overlaypanel.VjOverlayPanelCloseSvcHandler(t.sJsId);
H.attachSvcReqt(t.sOpenServiceName,open.invoke, open);
H.attachSvcReqt(t.sCloseServiceName,close.invoke, close);
if((t.bDraggable && !t.bHeaderDraggable) && t.oWHeader){
H.attachEvt(t.oWHeader, 'mousedown', t.startDrag, t);
//t.H.attachEvt(t.oWHeader, 'mouseup', t.stopDrag, t);
}
if(t.oOlp && t.oOlp.firstChild){
var sO = t.oOlp.firstChild;
sO.setAttribute('style',t.sCmpOpacity);
}
if(t.bDraggable && t.oWHeader && t.oWHeader.firstChild) {
var ss = t.oWHeader.firstChild;
t.setStyle(ss,'cursor','move');
//t.setStyle(t.oHeader,'cursor','move');
}
if(t.bHeaderDraggable && t.oCntn){
H.attachEvt(t.oCntn, 'mousedown', t.startDrag, t);
//t.H.attachEvt(t.oCntn, 'mouseup', t.stopDrag, t);
t.setStyle(t.oCntn,'cursor','move');
}
if(t.bCloseOnMouseOut && t.oCntntBox){
H.attachEvt(t.oCntntBox, 'mouseover', t.panelMouseOver, t);
H.attachEvt(t.oCntntBox, 'mouseout', t.panelMouseOut, t);
}
//TODO check if there's a close link
if (t.bHasCloseBtn && t.oCloseBtn){
H.attachEvt(t.oCloseBtn, 'click', t.onClosePanel, t);
}
if(t.bHasCloseLink && t.oCloseLink){
H.attachEvt(t.oCloseLink, 'click', t.onClosePanel, t);
H.attachEvt(t.oCloseLink,'mouseover',t.closeLinkMouseOver,t);
H.attachEvt(t.oCloseLink,'mouseout',t.closeLinkMouseOut,t);
}
//if(t.bPromote2Body){
// H.attachEvt(body, 'load', t.promote2body, t);
//}
if (t.icmpWidth!==0 && t.oOlp){
t.setStyle(t.oOlp,'width',(t.icmpWidth+'PX'));
}
},
//> private void setStyle(HTMLElement,String,String)
setStyle:function(div,key,value){
div.style[key] = value;
},
//> private void closeLinkMouseOut()
closeLinkMouseOut:function(){
var t= this;
t.oCloseLink.style.textDecoration = 'none';
},
//> private void closeLinkMouseOver()
closeLinkMouseOver:function(){
var t= this;
t.oCloseLink.style.textDecoration = 'underline';
},
//> public void promote2body(boolean? promote)
promote2body: function(promote){
var t = this;
if(promote){
t.E.promoteToBody(t.sOlpId);
t.bPromoted = true;
}
},
//> public void onResize()
onResize: function(){
var t = this;
if(t.bPanelOpen){
if(!t.bDragged){
t.bPanelOpen = false;
}
t.openOverlayPanel();
}
},
//> public void onOpenOverlayPanel(Object coordinates)
onOpenOverlayPanel: function(coordinates){
var t = this;
//if we open the overlay before page load we want to promote the overlay
if(t.bPromote2Body && !t.bPromoted){
t.promote2body(true);
}
t.aAnchorCoor = coordinates?coordinates:false;
t.openTimer = (t.iOpDlay <= 0)?t.openOverlayPanel():window.setTimeout(vjo.hitch(t, t.openOverlayPanel), t.iOpDlay);
},
//> public void openOverlayPanel()
openOverlayPanel: function(){
var t = this,
openedInfo = false;
//[e559] clear open timer
if(t.openTimer){
window.clearTimeout(t.openTimer);
t.openTimer = null;
}
if (!t.bPanelOpen){
t.bPanelOpen = true;
openedInfo = t.render();
if (t.bHasMask) {
t.openMask();
}
var postOpenedMsg = new t.M(t.sPostOpServId);
if(openedInfo){
postOpenedMsg.clientContext = {x: openedInfo[0], y: openedInfo[1], w: openedInfo[2], h: openedInfo[3]};
t.H.handle(postOpenedMsg);
}
}
},
//BUGDB00516040, contentDiv missing
//> public void openMask()
openMask : function(){
var t = this,
maskMsg = new t.M(t.sOpMaskServId),
cnt = t.oCntnt;
try { //Fix for bug BUGDB00616782 - passing the container reference
//var formElement = cnt?cnt.getElementsByTagName("form")[0]:{name:''};
maskMsg.clientContext = {formName : cnt}; // formElement.name || formElement.id};
}catch (e){
}
t.H.handle(maskMsg);
},
//> private int align(float origin,String alignment,float pad,float offset)
align : function(origin, alignment, pad, offset){
return origin+
((alignment=='right'||alignment=='bottom')?pad:0)+
((alignment=='middle')?(pad/2):0)+
offset;
},
//[e559] internal used to return the sum of const & temp left/top offset
//> public float getLeftOffset()
getLeftOffset : function(){
var t = this;
return t.iCnstLftOfset+t.iTmpLftOfset;
},
//> public float getTopOffset()
getTopOffset : function(){
var t = this;
return t.iCnstTopOfset+t.iTmpTopOfset;
},
//> public Object render()
render : function(){
var t = this,
E = t.E,
B = t.B,
P = t.P,
W = t.W,
anc = E.get(t.sAnchorName),
coordinates = {x:0, y:0},
openedInfo = false,
AC = t.aAnchorCoor,
LS = t.getLeftOffset(),
TS = t.getTopOffset(),
SS = t.iShdwOfset;
if(!t.bShownInCenter){
if(AC){ //[e559] skipped coor calculation if x,y pos is given in open msg
coordinates.x = AC.x+LS;
coordinates.y = AC.y+TS;
// t.aAnchorCoor = false; //reset for next open request
}
else{ //[e559] coor calculation flow updated to turn IE
coordinates.x = (B.bIE&&B.fVer<7)?P.getOffsetLeft(anc)+1:P.getOffsetLeft(anc);
coordinates.y = P.getOffsetTop(anc);
//[e559] refactored to align method
coordinates.x = t.align(coordinates.x, t.sHAlgn, anc?anc.offsetWidth:0,LS);
coordinates.y = t.align(coordinates.y, t.sVAlgn, anc?anc.offsetHeight:0,TS);
}
}
var olp = t.oOlp,
olpS = olp.style;
if (olpS) {
olpS.visibility = 'visible';
//[e559] commented out these 2 lines, IE6 consumes a lot time doing these change even if there's no such change needed
//olpS.display = 'block';
//olpS.position = 'absolute';
//[e559] moved static zIndex from EvtHandler to Controller, making more sense
olpS.zIndex = t.PC.zIndex();
if(olpS.zIndex===0){//TODO, why need this?
t.promote2body();
}
}
//[e559] using ?: instead of if/else
openedInfo = t.fSetNotchLocation ? t.fSetNotchLocation(t.oSetNotchLocationOverrider, t, olp, coordinates) : t.setNotchLocation(olp, coordinates);
t.oShdw.style.height=W.toPixels(t.oCntnt.offsetHeight+2);
if(t.oIFrame){//[e559] reduced local vars w, h
var s = t.oIFrame.style;
s.width = W.toPixels(olp.offsetWidth+SS);
s.height = W.toPixels(olp.offsetHeight+SS+2);
}
else if (!t.IfrOFF && (t.B.bIE && t.B.iVer <= 6)){//for 2nd & subsequent opening [merged from e557_caboose manually]
//Restricted to add the iframe only in case of IE6
t.oIFrame = t.S.add(olp, SS, SS+2);
}
t.changeImage();
return openedInfo;
},
changeImage : function(){
var t = this;
var e = vjo.dsf.Element;
var elem =e.get(t.sOlpId);
var cornerImgs = e.getElementsByTagClass(elem,"div","basOlp-scn");
var bkImg = e.getElementsByTagClass(elem,"div","basOlp-s");
var bkImg1 = null;
for(var idx = 0; idx public void setAnchorName(String sAnchorName)
setAnchorName: function(sAnchorName){
this.sAnchorName= sAnchorName;
},
//> public void setBubbleDivId(String sDivId)
setBubbleDivId: function(sDivId){
this.sOverlayDivId = sDivId;
},
//> public void onClosePanel(boolean? pbCheckState)
onClosePanel: function(pbCheckState){
var t = this,CD = t.iClsDlay;
t.bCheckState = pbCheckState;
t.closeTimer = (CD <= 0)?t.closePanel():window.setTimeout(vjo.hitch(t, t.closePanel), CD);
},
//> public void closePanel()
closePanel: function(){
//[e559] using t for this to reduce js size
var t = this,cT=t.closeTimer;
//[e559] clear close timer
if(cT){
window.clearTimeout(cT);
cT = null;
}
if(t.bCheckState && t.mouseState == 1){
t.bCheckState = false;
return;
}
t.hidePanel();
if (t.mouseState == 1) {
t.closeByButton = true;
}
t.bDragged = false;
},
//> private int[] setNotchLocation(HTMLElement olp,Object oCoordinates)
setNotchLocation: function(olp, oCoordinates){
//[e559] using iX & iY to hold x,y value from oCoordinates to reduce references depth.
// using iScrollX & iScrollY to hold x,y value from aScrollLocation ro reduce references depth.
// merged var declarations to 1 line, var names shortened
var t = this,
W = t.W,
olpS = olp.style,
iX = oCoordinates.x,
iY = oCoordinates.y,
iW = olp.offsetWidth,
iH = olp.offsetHeight,
iScreenW = W.getBrowserWindowWidth(),
iScreenH = W.getBrowserWindowHeight(),
aScollLoc = W.getScrollXY(),
iScrollX = aScollLoc[0],
iScrollY = aScollLoc[1],
arr = t.oArr;
if (!t.bShownInCenter) {
//[e573]enhancement for vertical pointers
if(t.pVt){
var xLoc=iX-iScrollX,
yLoc=iY-iScrollY,
finalX=0,
finalY=0,
arrH = 21,
sAuto = 'auto',
iAdj = 5,
bTop = true,
bLeft = false,
B = t.B,
iGuard = 1; //keep pointer away from mouse, decrease chance of flashing
if(!B.bIE){
iAdj += 16;
}
//calc Y
if((yLoc-iH-arrH)<0){
finalY = iY+arrH+iGuard;
bTop = false;
}
else{
finalY = iY-iH-arrH-iGuard;
}
//calc X
if(iX - iW/2 < 0){
finalX = 0;
}else if(iX + iW/2 + iAdj > iScreenW){
finalX = iScreenW - iW - iAdj;
bLeft = true;
}else{
finalX = iX - (iW/2);
}
//pointer
if(arr){
arr.style.left = W.toPixels( iX - finalX - ( bLeft ? arr.offsetWidth + iGuard : -iGuard ) );
}
if(bTop){
t.setArrDivStyle(arr, bLeft ? t.sArrowVBL : t.sArrowVBR, sAuto, W.toPixels(-arrH));
}else{
t.setArrDivStyle(arr, bLeft ? t.sArrowVTL : t.sArrowVTR, W.toPixels(-arrH), sAuto);
}
}else{
//[e559] shortened value assignment
var xLoc=iX-iScrollX,
yLoc=iY-iScrollY,
arrH=arr?21:0,
arrW=arr?21:0,
arrS=arr?14:0,//arrow div space
finalX=0,
finalY=0,
finalW=iW+arrW,
finalH=iH,
sAuto = 'auto',
iAdj = 0,
bLeft = false;
//[e559] added bLeft for the veritical positioning flow below
if((xLoc+iW+arrW)iScreenW || (t.sHAlgn&&t.sHAlgn!='middle')){
finalX = iX+arrW;
bLeft = true;
}
else{
if((xLoc-iW-arrW) < 0){//show @ x center when there's no space for left or right orientation, & there's no arrow.
finalX = (iScreenW/2-iW/2)+iScrollX+t.getLeftOffset();
}
else{
finalX = iX-iW-arrW;
}
}
//[e559] merged left/right orientations' vertical positioning logic flow
if((yLoc+iH)iH){
finalY = iY-iH+arrS;
finalY -= t.getTopOffset()*2;//[e569] reverse topOffset if opening in opposite direction, 4 ngvi none-covering lnk need
t.setArrDivStyle(arr, bLeft?t.sArrowBL:t.sArrowBR, sAuto, W.toPixels(arrS));
}
else{
if(yLoc<(iScreenH/2) && (iH0?finalY:0;
finalY = finalY+iScrollY+t.getTopOffset();
}
//[e559] merged top assignment using finalY
olpS.left = W.toPixels(finalX);
olpS.top = W.toPixels(finalY);
return [finalX, finalY, finalW, finalH];
},
//> private void setArrDivStyle(vjo.dsf.Element,String,String,String)
setArrDivStyle: function(arrowDiv, cssClz, topValue, bottomValue){
var arrDiv= arrowDiv;
if(arrowDiv){
arrDiv.className = cssClz;
arrDiv.style.top = topValue;
arrDiv.style.bottom = bottomValue;
}
},
//>public void startDrag(Event pEvent)
startDrag: function(pEvent){
var t = this,
P = t.P,
W = t.W,
olp = t.oOlp,
SR = t.bSelfRegistry,
H = t.H,
db = document.body;
if (!t.bMonitorDrag){
t.bMonitorDrag = true;
t.bDragged = true;
var event = pEvent.nativeEvent;
if(SR){
event = pEvent.nativeEvent || pEvent;
}
var mouseY = W.eventTop(event),
mouseX = W.eventLeft(event);
//[e559] replaced Bubble anchor util with Positioning
t.initDx = P.getOffsetLeft(olp) - mouseX;
t.initDy = P.getOffsetTop(olp) - mouseY;
//[e559] merged assignement
t.top = t.iLastTop = mouseY;
t.left = t.iLastLeft = mouseX;
//[e559] switched to addEventListener, eliminated method handle creation
t.fOnMouseMoveHdl = H.attachEvt(db, 'mousemove', t.onMouseMove, t);//can't bind with window, has to be document.body
t.fOnMouseUpHdl = H.attachEvt(db, 'mouseup', t.onMouseUp, t);
if(olp){
olp.onselectstart = olp.onmousedown = function(){return false;};
}
//[e559] defered timer construction till drag started
t.interval = 50;
t.onTick = function(){
t.monitorMouseDrag();
};
t.start();
}
if(SR){
var target = event.target || event.srcElement;
H.attachEvt(target, 'mouseup', t.stopDrag, t);
}
},
//>public void onMouseMove(vjo.dsf.Event pEvent)
onMouseMove: function(pEvent) {
var t = this,
W = t.W;
if (t.bMonitorDrag){
var event = window.event?window.event:pEvent;
//[e559] replaced self eventTop/eventLeft methods with VjWindowUtils's, does the same thing
var topValue = W.eventTop(event),
leftValue = W.eventLeft(event);
if (topValue>=0 && leftValue>=0) {
t.top = topValue;
t.left = leftValue;
}
}
},
//> public void onMouseUp(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum event)
onMouseUp: function(event) {
var t = this,
H = t.H,
db = document.body;
if (t.bMonitorDrag){
//[e559] fixed handler unremoved issue
H.detachEvt(db, 'mousemove', t.fOnMouseMoveHdl);
H.detachEvt(db, 'mouseup', t.fOnMouseUpHdl);
t.stopDrag();
}
},
//> public void monitorMouseDrag()
monitorMouseDrag: function(){
if (this.bMonitorDrag){
var t = this,
P = t.P,
W = t.W;
if ((t.left!=t.iLastLeft) || (t.top!=t.iLastTop)){
var dx = t.left-t.iLastLeft,
dy = t.top-t.iLastTop;
t.iLastLeft = t.left;
t.iLastTop = t.top;
//[e559] replaced VjAnchorUtil with Positioning lib function
var olp = t.oOlp,
olpS = olp.style,
x = P.getOffsetLeft(olp),
y = P.getOffsetTop(olp);
olpS.left = W.toPixels(x+dx);
olpS.top = W.toPixels(y+dy);
}
}
},
//> public void stopDrag()
stopDrag: function(){
var t = this;
t.bMonitorDrag = false;
var olp = t.oOlp;
if (olp) {
olp.onselectstart = olp.onmousedown = null;
}
//[e559] added to stop the timer
t.stop();
},
//> public void panelMouseOver()
panelMouseOver: function(){
this.mouseState = 1;
},
//> public void panelMouseOut()
panelMouseOut: function(){
this.mouseState = 0;
},
//> public void tryCloseOnMouseOut()
tryCloseOnMouseOut: function(){
var t = this;
if (t.mouseState === 0) {
t.mouseState = -1;
if (!t.closeByButton) {
t.onClosePanel();
} else {
t.closeByButton = false;
t.mouseState = -1;
}
}
},
//> public void hidePanel()
hidePanel: function(){
//[e559] shortened var names
var t = this,
H = t.H,
M = t.M,
olp = t.oOlp,
olpS = olp.style;
//olp.style.display = "none"; can't use due to magellandialog dependency
olpS.visibility = 'hidden';
olpS.left = '-1600px'; //set only left
t.bPanelOpen = false;
//[e559] clean temp offset when closing the panel
t.iTmpLftOfset = t.iTmpTopOfset = 0;
if (t.bHasMask) {
H.handle(new M(t.sClsMaskServId));
}
if(t.sPostClsServId){
H.handle(new M(t.sPostClsServId));
}
//[e563] delay iframe collection to page unload
if(t.oIFrame){//[e559] clean up the oIFrame
if(!t.fCleanUp){
t.fCleanUp = function(){
t.S.remove(t.oOlp, t.oIFrame);
t.oIFrame = null;
};
H.attachEvt(window, 'unload', t.fCleanUp, t);
}
}
},
//> public void setContentTitle(String sContentTitle)
setContentTitle: function(sContentTitle){
var t = this,tcnt=t.oTitlCntnr;
//[e559] get title container only once
if(!tcnt){
tcnt = t.E.get(t.sOverlayDivId + "olpcontenttitle");
}
if(tcnt){
tcnt.innerHTML = sContentTitle;
}
}
})
.endType();
vjo.ctype("vjo.darwin.core.overlaypanel.VjOverlayPanelMessage")
.inherits("vjo.dsf.Message")
.protos({
bCheckState : false,// public constructs(String name,String src)
//> public constructs(String name)
constructs: function(name, src){
var t = this;
t.base.call(t,name);
t.request = t.response = {}; //overwriting Message properties
t.sAnchorId = t.sBubbleId = "";
t.bCheckState = false;
},
//> public void setBubbleId(String sId)
setBubbleId: function(sId){
this.sBubbleId = sId;
},
//> public String getBubbleId()
getBubbleId: function(){
return this.sBubbleId;
},
//> public void setAnchorId(String sId)
setAnchorId: function(sId){
this.sAnchorId = sId;
},
//> public String getAnchorId()
getAnchorId: function(){
return this.sAnchorId;
},
//> public Boolean getCheckState()
getCheckState: function(){
return this.bCheckState;
}
})
.endType();
vjo.ctype("vjo.darwin.core.overlaypanel.VjOverlayPanelEvtHandlers")
.needs("vjo.darwin.core.overlaypanel.VjOverlayPanelMessage")
.needs("vjo.dsf.window.utils.VjWindowUtils")
.props({
M : vjo.darwin.core.overlaypanel.VjOverlayPanelMessage, // public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage handleOpenEvent(String messageId,String anchorId)
handleOpenEvent: function(messageId, anchorId){
var message = new this.M(messageId);
message.setAnchorId(anchorId);
return message;
},
//> public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage handleOpenEventXY(String messageId,String x,String y)
handleOpenEventXY: function(messageId, x, y){
var message = new this.M(messageId);
message.left = x;
message.top = y;
message.resetPosition = false;
return message;
},
//> public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage handleOpenEventByLoc(String messageId,com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum pEvent)
//> public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage handleOpenEventByLoc(String messageId,vjo.darwin.core.overlaypanel.VjOverlayPanelMessage)
handleOpenEventByLoc: function(messageId, pEvent){
var e = pEvent.nativeEvent,
W = vjo.dsf.window.utils.VjWindowUtils,
x = W.eventLeft(e),
y = W.eventTop(e);
return this.handleOpenEventXY(messageId, x, y);
},
//> public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage handleCloseEvent(String messageId)
handleCloseEvent: function(messageId){
var message = new this.M(messageId);
return message;
},
//> public vjo.darwin.core.overlaypanel.VjOverlayPanelMessage handleCloseEventWithCheck(String messageId,boolean checkState)
handleCloseEventWithCheck: function(messageId, checkState){
var message = new this.M(messageId);
message.bCheckState = checkState;
return message;
}
})
.endType();
vjo.ctype("vjo.darwin.app.common.mask.MaskHandlers")
.props({
/**
* @JsReturnType void
* @JsJavaAccessToJs public
* @JsParamType psId String
* @JsParamType psMsg com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum
* @JsServiceHandler
*/
//> public void openService(String psId,com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum psMsg)
openService : function (psId, psMsg) {
var ctrl = vjo.Registry.get(psId);
if (ctrl) ctrl.show(psMsg.clientContext);
},
/**
* @JsReturnType void
* @JsJavaAccessToJs public
* @JsParamType psId String
* @JsParamType psMsg com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum
* @JsServiceHandler
*/
//> public void closeService(String psId,com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum psMsg)
closeService : function (psId, psMsg) {
var ctrl = vjo.Registry.get(psId);
if (ctrl) ctrl.hide();
}
})
.endType();
vjo.ctype("vjo.darwin.app.common.mask.Mask")
.needs("vjo.dsf.window.utils.VjWindowUtils")
.needs("vjo.dsf.EventDispatcher")
.needs("vjo.dsf.utils.Timer")
.needs("vjo.darwin.app.common.mask.MaskHandlers")
.needs("vjo.dsf.client.Browser")
.protos({
/**
* @JsReturnType void
* @JsJavaAccessToJs public
* @JsParamType psId String
* @JsParamType psOpacity String
* @JsParamType pngImg String
* @JsParamType gifImg String
*/
//> public constructs(String psId,String psOpacity,String pngImg,String gifImg)
constructs : function (psId,psOpacity,pngImg,gifImg) {
var t = this;
t.eElem = document.getElementById(psId);
t.iOpacity = (psOpacity) ? parseFloat(psOpacity) : 0;
t.showing = false;
t.zIndex = 100;
t.sIsActivated = false;
t.oTimer = false;
t.ED = vjo.dsf.EventDispatcher;
t.pngalpha = false;
t.pngnorm = false;
t.strExt = ".gif";
t.B = vjo.dsf.client.Browser;
t.png =pngImg;
t.gif=gifImg;
// if IE6 then display GIF else display PNG - fix for bug BUGDB00616782
if ( t.B.bIE && t.B.iVer <= 6 ) {
t.setDefaultBg(t.gif);
} else {
t.setDefaultBg(t.png);
}
},
/**
* @JsReturnType boolean
* @JsJavaAccessToJs public
* @JsEventHandler
*/
//>public boolean show(Object?)
show : function(ctx) {
var t = this;
if (t.showing){ return;}
else {t.showing = true;}
t.cntr = (ctx)?ctx.formName:"";
t.zIndex = (ctx && ctx.overlayPanelIndex)?ctx.overlayPanelIndex:t.zIndex;
t.render();
t.disableSelects();
t.startResizeListener();
},
//> private void render()
render : function(){
var t = this;
t.WU = vjo.dsf.window.utils.VjWindowUtils;
var offsetWidth = t.WU.scrollWidth();
var offsetHeight = t.WU.scrollHeight();
t.setStyle("display","block");
t.setStyle("width",offsetWidth+'px');
t.setStyle("height",offsetHeight+'px');
t.setStyle("zIndex", t.zIndex);
//Commented moved this logic to constructor
/* if (t.pngalpha) {
t.setStyle("background", 'transparent');
t.setStyle("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+t.png+", sizingMethod='scale')");
try{
t.eElem.filters['DXImageTransform.Microsoft.AlphaImageLoader'].enabled=true;
} catch(e){
t.setDefaultBg();
t.setStyle("filter", "");
}
} else if (t.pngnorm) {
t.setStyle("background", 'transparent url('+t.png+') repeat left top');
} else {
t.setDefaultBg();
}*/
//Reverting this fix for bug BUGDB00616782
//vjo.dsf.document.Shim.add(t.eElem);
},
setDefaultBg : function(img) {
this.setStyle("background", 'transparent url('+ img +') repeat left top');
},
/**
* @JsReturnType boolean
* @JsJavaAccessToJs public
* @JsEventHandler
*/
//> public boolean hide()
hide : function() {
var t = this;
if (!t.showing){ return;}
else{ t.showing = false;}
t.setStyle("display","none");
t.setStyle("width",'0');
t.setStyle("height",'0');
t.enableSelects();
t.stopResizeListener();
},
//> private void disableSelects()
disableSelects : function() {
var keepLiveSelectIds,selects, t=this,c=t.cntr,ids;
t.disabledSelects = new Array();
if( typeof c === "object") {
keepLiveSelectIds = t.getCntrSelects(c);
} else {
keepLiveSelectIds = t.getCntrSelects(document.forms[c]);
}
selects = document.body.getElementsByTagName("select");
ids=keepLiveSelectIds.toString();
for (var idx = 0;(idx < selects.length);idx++) {
var select = selects[idx];
if (select.disabled) {continue;}
if(ids.indexOf(select.id+',') !== -1) {continue;}
select.disabled = true;
t.disabledSelects.push(select);
}
},
//> private void getCntrSelects(Object)
getCntrSelects : function(c){
if(!c) {return []};
var ids = [], lst = c.getElementsByTagName("select"), l=lst.length,j=0;
for(;j private void enableSelects()
enableSelects : function() {
var selects = this.disabledSelects;
for (var idx = 0;(idx < selects.length);idx++) {
selects[idx].disabled = false;
}
},
setStyle : function(name,value) {
var e = this.eElem;
if (!e || !e.style) { return; }
e.style[name] = value;
},
//> private void requireResize()
requireResize : function(){
this.sIsActivated = true;
},
//> private void startResizeListener()
startResizeListener : function(){
var t = this;
t.ED.addEventListener(window,'resize',t.requireResize, t);
if(!t.oTimer){
t.oTimer = new vjo.dsf.utils.Timer();
t.oTimer.interval = 500;
t.oTimer.onTick = function(){
if (t.sIsActivated){
t.render();
t.sIsActivated = false;
}
};
}
t.oTimer.start();
},
//> private void stopResizeListener()
stopResizeListener : function(){
var t = this;
t.ED.removeEventListener(window,'resize',t.requireResize, t);
if(t.oTimer){
t.oTimer.stop();
}
}
})
.endType();
vjo.ctype("vjo.com.ebay.bizmo.tracking.EimPiwikPageData")
.needs("vjo.dsf.Element",'E')
.needs("vjo.dsf.document.Form")
.needs("vjo.dsf.assembly.VjClientAssemblerRequest",'VCR')
.props({
//>public void trackFunc(String pwId,String siteId)
trackFunc :function(pwId,siteId) {
_rover.setAppId(siteId);
var pageImpEvent=pwId;
var impEvt=_rover.createPageImpEvent(pageImpEvent,siteId);
impEvt.setLVTrk(true);
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageImpEvent);
ebayLVTr.setActionSampling(100);
ebayLVTr.setEnableHeatMap();
ebayLVTrClk._ebayLVTrackerClk_init_tracker();
_rover.track();
},
//>public void captureValues(String pageId, String siteId, String tagName, String tagValue)
captureValues :function(pageId, siteId, tagName, tagValue) {
_rover.setAppId(siteId);
// Page Impression
var pageImpEvent=pageId;
var impEvt=_rover.createPageImpEvent(pageImpEvent);
impEvt.setLVTrk(true);
impEvt.getTrackData().addNvp(tagName, tagValue);
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageImpEvent);
ebayLVTrClk._ebayLVTrackerClk_init_tracker();
_rover.track();
}
});//@Package vjo.dsf.typeextensions.string
vjo.needs("vjo.dsf.typeextensions.string.Comparison");
vjo.ctype("vjo.dsf.typeextensions.string.Trim").endType();
String.prototype.trim = function() {
var s = this;
//Remove leading spaces and carriage returns
while (s.substring(0,1).isAny(' ','\n','\r'))
s = s.substring(1,s.length);
//Remove trailing spaces and carriage returns
while (s.substring(s.length-1,s.length).isAny(' ','\n','\r'))
s = s.substring(0,s.length-1);
return s;
};
vjo.ctype("vjo.ebay.darwin.ebox.gbh.tracking.piwik.PiwikPageData")
.needs("vjo.dsf.Element",'E')
.needs("vjo.dsf.document.Form")
.needs("vjo.dsf.assembly.VjClientAssemblerRequest",'VCR')
.props({
//>public void trackFunc(String pwId,String siteId)
trackFunc :function(pwId,siteId) {
_rover.setAppId(siteId);
// _rover.setServer("ebay.fr");
// Page Impression
var pageImpEvent=pwId;
var impEvt=_rover.createPageImpEvent(pageImpEvent,siteId);
impEvt.setLVTrk(true);
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageImpEvent);
ebayLVTr.setActionSampling(100);
ebayLVTr.setEnableHeatMap();
ebayLVTrClk._ebayLVTrackerClk_init_tracker();
_rover.track();
},
//>public void trackBINPage(String siteId, String itemId, String transType, String encodedEiasUserId, String rotationId)
trackBINPage :function(siteId,itemId,transType,encodedEiasUserId,rotationId) {
var roi = _rover.createROIEvent();
roi.setSite(3);//will be 3 always
roi.setSegment(rotationId);
// roi.setEiasId(eiasToken);
// roi.setItemId(itemId);
var mpuidVal="";
if(itemId && itemId!=null){
mpuidVal= encodedEiasUserId+";"+itemId;
//mpuidVal= siteId+";"+itemId;
}else {
mpuidVal= encodedEiasUserId+";"+siteId;
// mpuidVal= ";"+siteId;
}
var nvp = roi.getTrackData();
//setting transaction type
if(transType && transType!=null){
nvp.addNvp("tranType", transType);
nvp.addNvp(transType,"1");
}
nvp.addNvp("mpuid",mpuidVal);
//roi.setSecured(true);
_rover.track();
},
/*//>public void enableHeatMap(String pageId, String siteId)
enableHeatMap :function(pageId, siteId) {
_rover.setAppId(siteId);
// Page Impression
var pageImpEvent=pageId;
var impEvt=_rover.createPageImpEvent(pageImpEvent);
impEvt.setLVTrk(true);
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageImpEvent);
ebayLVTr.setActionSampling(100);
ebayLVTr.setEnableHeatMap();
ebayLVTrClk._ebayLVTrackerClk_init_tracker();
_rover.track();
},*/
//>public void captureSearchKWs(String pageId, String siteId, String sQr, String numRslts)
captureSearchKWs : function(pageId, siteId, sQr, numRslts) {
_rover.setAppId(siteId);
// Page Impression
var pageImpEvent=pageId;
var impEvt=_rover.createPageImpEvent(pageImpEvent);
impEvt.setLVTrk(true);
impEvt.getTrackData().addNvp("sQr", sQr);
impEvt.getTrackData().addNvp("num_rslts", numRslts);
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageImpEvent);
ebayLVTrClk._ebayLVTrackerClk_init_tracker();
_rover.track();
},
//>public void trackBundleTech(String pageId, String siteId)
trackBundleTech : function(pageId, siteId) {
_rover.setAppId(siteId);
// Page Impression
var pageImpEvent=pageId;
var impEvt=_rover.createPageImpEvent(pageImpEvent);
impEvt.setLVTrk(true);
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageImpEvent);
_rover.track();
},
//>public void trackGoogle()
trackGoogle : function(){
var ns = _rover.createNSEvent();
ns.setSegment("14361-92751-7832-0");
_rover.track();
},
//>public void trackINSItem(String site,String siteId,String itemId,String rotationId,String tranType,String itemUrl)
trackINSItem : function(site,siteId,itemId,rotationId,tranType,itemUrl){
var roi = _rover.createROIEvent();
roi.setSite(site);
roi.setSegment(rotationId);
//roi.setEiasId(eias);
//roi.setItemId(itemId);
var nvp = roi.getTrackData();
nvp.addNvp("tranType", tranType);
nvp.addNvp(tranType,1);
var mpuidVal=siteId+";"+itemId;
nvp.addNvp("mpuid",mpuidVal);
//nvp.addNvp("Bid", "1");
//nvp.addNvp("Bid-20081", "1");
_rover.track();
var url=itemUrl+itemId;
window.open(url,"CoreItemWin");
history.go(-1);
},
//>public void trackVOLItem(String site,String siteId,String itemId,String rotationId,String tranType)
trackVOLItem : function(site,siteId,itemId,rotationId,tranType){
var roi = _rover.createROIEvent();
roi.setSite(site);
roi.setSegment(rotationId);
//roi.setEiasId(eias);
//roi.setItemId(itemId);
var nvp = roi.getTrackData();
nvp.addNvp("tranType", tranType);
nvp.addNvp(tranType,1);
var mpuidVal=siteId+";"+itemId;
nvp.addNvp("mpuid",mpuidVal);
//nvp.addNvp("Bid", "1");
//nvp.addNvp("Bid-20081", "1");
_rover.track();
},
//>public void trackMachineTrans(String siteId, String pageId, String tagName, String lang)
trackMachineTrans : function(siteId, pageId, tagName, lang){
_rover.setAppId(siteId);
var pageEvt = _rover.createPageImpEvent(pageId, siteId);
pageEvt.getTrackData().addNvp(tagName, lang);
pageEvt.setLVTrk(true);
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageEvt);
ebayLVTrClk._ebayLVTrackerClk_init_tracker();
_rover.track();
},
//>public void openWindow(String url)
openWindow : function(url){
window.open(url,"CoreItemWin");
}
});
vjo.ctype("vjo.ebay.darwin.ebox.gbh.ajax.EimTranslationAjax")
.needs("vjo.util.List",'')
.needs("vjo.dsf.Element",'E')
.needs("vjo.dsf.Message","M")
.protos({
//>public constructs(com.ebay.darwin.ebox.gbh.ajax.server.EimTranslationAjaxJsModel)
constructs : function(model) {
var t = this, o=t.vj$;
t.m=model;
},
//>public boolean onRequest(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum msg)
onRequest: function(msg){
var t = this;
var E = vjo.dsf.Element;
var msg = new vjo.dsf.Message(t.m.serviceId);
msg.request = {};
msg.request.selectedService = 1;
msg.request.showOriginal = t.m.showOriginal;
msg.request.eimDomain=t.m.eimDomain;
msg.request.itemId=t.m.itemId;
msg.request.pageId = t.m.pageId;
msg.request.siteId = t.m.siteId;
msg.request.desc = t.m.desc;
msg.request.rPolicy = t.m.rPolicy;
msg.request.tnc = t.m.tnc;
msg.request.itemAttribute = t.m.itemAttribute;
var tDiv=E.get("tBtnId");
var betaSup = E.get("betaSup");
var showEnDiv=E.get("sBtnId");
var transDiv=E.get("transDisc");
var erDiv=E.get("errorId");
var divList = t.m.divList;
var transConst = '_tr';
if(t.m.showOriginal==true){
for (var i=0; i public void handleResponse(com.ebay.dsf.resource.html.event.handler.JsHandlerObjectEnum msg);
handleResponse : function (msg) {
var t = this;
var E = vjo.dsf.Element;
var res = msg.response.data;
//handle errors
if (msg.errors && msg.errors.length>0 && msg.response.data) {
return;
}
var errorDiv = E.get("errorId");
var betaSup = E.get("betaSup");
var tDiv=E.get("tBtnId");
var showEnDiv=E.get("sBtnId");
var transDiv = E.get("transDisc");
if(res.statusCode === 1){
var divListres = ['descId','rPolId','tncId','iAttrsId'];
var transCons = '_tr';
var mapTrans = res.contentMap;
for (var k=0; kpublic void trackMachineTransBtnClk(String siteId, String pageId, String tagName, String lang)
trackMachineTransBtnClk : function(siteId, pageId, tagName, lang){
var clkEvt = _rover.createClickEvent(pageId, siteId);
clkEvt.getTrackData().addNvp(tagName, lang);
clkEvt.track();
}
});
/**
* Represents an list structrue used to handle response data.
*/
vjo.ctype('vjo.util.List')
.protos({
//> public void constructs(Object);
//> public void constructs(java.util.ArrayList);
constructs : function (psJavaClass) {
this.javaClass = psJavaClass || 'java.util.ArrayList';
this.list = [];
},
/**
* Returns the element at the specified position in this list.
*
* @param {int} index
* Index of element to return
* @return {Object}
* The element on the position
*/
//> public Object get(int);
get : function (index) {
if (this.size()>index) {
return this.list[index]
}
//array out of bounds exception?
return null;
},
/**
* Appends the specified element to the end of this list (optional operation).
*
* @param {Object} value
* Element to be appended to this list
* @return {Object}
* The added element
*/
//> public Object add(Object);
add : function (value) {
return this.list[this.size()] = value;
},
/**
* Removes the value if it in the list.
*
* @param {Object} value
* Element to be removed
* @return {boolean}
* True if the element in the list and be successfully removed
*/
//> public boolean remove(Object);
remove : function (value) {//TODO: by index also?
var len = this.size(), tmp = this.list, nlist = [], rv = false;
for (var i=0; i public int size();
size : function () {
return this.list.length;
}
//for all in?
})
.endType();
vjo.ctype("vjo.ebay.shared.component.viewitem.ViewItemUtils")
.needs('vjo.dsf.Element','E')
.props({
//> public void promoteOverlayToBody()
promoteOverlayToBody : function(){
var t = this;
var ovrlys = document.getElementsByClassName('olp-mn');
for(var i = 0; i < ovrlys.length; i++ ){
t.promoteToBody(ovrlys[i]);
}
},
//> public void promoteOverlayByIdToBody(String id)
promoteOverlayByIdToBody : function(id){
var t = this;
var ovrContainer = document.getElementById(id);
if(ovrContainer)
t.promoteToBody(ovrContainer.childNodes[0]);
},
promoteToBody : function(elem){
var e = elem , b = document.body;
if(e && b && e.parentNode && (e.parentNode !== b)){
e.parentNode.removeChild(e);
b.appendChild(e);
}
}
}).endType();
//@Package vjo.dsf.typeextensions.string
/**
* Checks if current string contains the given sub-string.
*
* @param {String} str
* a sub-string to be tested
* @return {boolean}
* true if the sub-string is in the current string
*/
vjo.ctype("vjo.dsf.typeextensions.string.Comparison").endType();
String.prototype.has = function (pStr) {
return (this.indexOf(pStr) != -1);
};
/**
* Checks if current string contains the given arguments.
* @param {String} arg
* a given arguments object. This can be a single string or a string array.
* @return {boolean}
* true if the arguments is in the current string
*/
String.prototype.hasArg = function (pArg) {
var a = pArg, rv = false;
if (typeof(a) == "string")
{
rv = this.has(a);
}
else{
var aL = a.length;
for (var j=0; jtrue if any of the given arguments is in the current string
*/
String.prototype.hasAny = function () {
var a = arguments, l = a.length, rv = false;
for (var i=0; itrue if all of the given arguments is in the current string
*/
String.prototype.hasAll = function () {
var a = arguments, l = a.length;
for (var i=0; itrue if the specified string is equal to current string
*/
String.prototype.is = function (s) {
return (this == s);
};
String.prototype.isAny = function () {
var a = arguments, l = a.length, rv = false, aL;
for (var i=0; i public void detach(HTMLElement )
detachAll : function(obj){
if(obj.id){
vjo.darwin.core.utils.DetachEvents.detach(obj.id);
}
var childs=obj.childNodes;
for(var i=0,l=childs.length;i public void detach(String)
//>public void detach(String [])
//> public void detach(String ,boolean)
//> public void detach(String [],boolean )
//> public void detach()
detach :function(ids,dtchChildNodes){
if(!ids) return;
var ED= vjo.dsf.EventDispatcher,t=this;
var handlers = ED.nativeEventHandlers;
if(ids instanceof Array){
for (var i in ids)
t.detach(ids[i],dtchChildNodes);
}
for (var ev in handlers[ids]) {
ED.detachHandlers(ids,ev,true);
}
var elem = vjo.dsf.Element.get(ids);
if(dtchChildNodes){
var childNodes=elem.childNodes;
for(var childIdx in childNodes )
this.detach(childNodes[childIdx].id,dtchChildNodes)
}
}
}
)
.endType();
vjo.ctype("vjo.ebay.ebox.tracking.Tracker")
.props({
// >public void trackFunc(String, String, java.util.Map)
trackFunc : function(pageId, appId, mOfcustomTags) {
_rover.setAppId(appId);
// Page Impression
var pageImpEvent= pageId;
var impEvt=_rover.createPageImpEvent(pageImpEvent);
impEvt.setLVTrk(true);
if(mOfcustomTags !== null) {
for (var key in mOfcustomTags) {
impEvt.getTrackData().addNvp(key, mOfcustomTags[key]);
}
}
ebayLVTr.setRover(_rover);
ebayLVTr.setPageImpEvent(pageImpEvent);
ebayLVTrClk._ebayLVTrackerClk_init_tracker();
_rover.track();
},
//>public void trackRoiEvent(String siteId, String itemId, String transType, String encodedEiasUserId, String rotationId)
trackRoiEvent :function(siteId,itemId,transType,encodedEiasUserId,rotationId) {
var roi = _rover.createROIEvent();
roi.setSite(3);//will be 3 always
roi.setSegment(rotationId);
var mpuidVal="";
if(itemId){
mpuidVal= encodedEiasUserId+";"+itemId;
}else {
mpuidVal= encodedEiasUserId+";"+siteId;
}
var nvp = roi.getTrackData();
//setting transaction type
if(transType && transType!=null){
nvp.addNvp("tranType", transType);
nvp.addNvp(transType,"1");
}
nvp.addNvp("mpuid",mpuidVal);
_rover.track();
}
})
.endType();
/*
*
* Handling Encoding/Decoding more efficently when switching from ISO to UTF-8
* for encoding
*
*/
vjo.ctype("vjo.dsf.Enc")
.props({
unescape:vjo.NEEDS_IMPL, // needs vjo.dsf.IBinding, vjo.dsf.Message
.props({
clientInfo:null, // public void callback(Object xmlHttpReq, Message message);
callback : function (xmlHttpReq, message) {
if (xmlHttpReq.readyState != 4) {
return;
}
message.response = new vjo.dsf.ServiceResponse();
try {
if (xmlHttpReq.status >= 200 && xmlHttpReq.status < 300 ) {
message.response.data = xmlHttpReq.responseText;
var binding = vjo.dsf.ServiceRegistry.getBinding(message.svcConfig.respMarshalling); //< public Object getXmlHttpReq();
getXmlHttpReq : function () {
//Re-order the code based on popularity of the browsers
var o = null;
//XMLHttpRequest first since it's available in most of modern browsers
if (typeof XMLHttpRequest != 'undefined') {
o = new XMLHttpRequest();
} else {
if (window.ActiveXObject) {
try {
o = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
o = new ActiveXObject("Msxml2.XMLHTTP");
}
}
}
return o;
},
//> private String getClientInfo();
getClientInfo : function () {
//returns Browser|Version|[Env] used by V4Services
//use browser util, once vjlib moves to dsf
if (this.clientInfo) {
return this.clientInfo;
}
var nv = navigator, agt = nv.userAgent.toLowerCase(), i = 0, ver=0, b="";
if (agt.indexOf("firefox")!=-1) {
b = "Firefox";
i = agt.lastIndexOf("firefox") + 8;
}
else if ((/webkit|khtml/).test(agt)) {
b = "Safari";
i = agt.lastIndexOf("safari") + 7;
} else if(typeof(window.opera)!="undefined") {
b = "Opera";
i = agt.lastIndexOf("opera") + 6;
}
else if (nv.appName == "Netscape") {
b = "Netscape";
i = agt.lastIndexOf("/") + 1;
}
else if (agt.indexOf("msie")!=-1) {
b = "IE";
i = agt.indexOf("msie") + 4;
}
if (b) ver = parseInt((b=="Opera")?window.opera.version():agt.substring(i));
this.clientInfo = b+":"+ver+":"
return this.clientInfo;
},
//> public String generateReqParams(Message message);
generateReqParams : function(message) {
var requestParams = 'svcid=' + vjo.dsf.Enc.encodeURIComponent(message.svcId);
// tracking params
if (message.stok) {
requestParams += '&stok=' + message.stok;
}
if (message.pId) {
requestParams += '&pId=' + message.pId;
}
if (message.v) {
requestParams += '&v=' + message.v;
}
var ma = message.svcConfig.reqtMarshalling;
requestParams += '&reqttype=' + ma + '&resptype=' + message.svcConfig.respMarshalling;
requestParams += '&clientType=' + this.getClientInfo();
requestParams += '&request=';
if ('JSCALLBACK' == ma){
requestParams += vjo.dsf.Enc.encodeURIComponent(JSON.stringify(message.request));//< @SUPRESSTYPECHECK
}
return requestParams;
}
})
.inits(function(){
this.E = this.vj$.SvcErr;
})
.endType();
vjo.ctype('vjo.dsf.XhrTransport') //< public
.satisfies('vjo.dsf.ITransport')
.needs(['vjo.dsf.Service',
'vjo.dsf.ServiceEngine',
'vjo.dsf.SvcErr',
'vjo.dsf.assembly.VjClientAssembler'
])
//< needs(vjo.dsf.Message)
.protos({
processed : [], //< boolean[]
timerCount : 0, //< int
reqTimers : [], //< int[]
//>public void handleRequest(Message message, Object callback)
handleRequest : function(message, callback){
// message.trace += '-->XhrTransport' + message.svcId;
this.remoteTrspHdl(message);
var svc = vjo.dsf.Service,
xmlHttpReq = svc.getXmlHttpReq(),
requestUrl = this.appendPort80ForSafari(document.location.href, message.svcConfig.url),
cfg = message.svcConfig;
message.status = -1; //do not handle Response. Ajax call will handle response
try {
var async = (cfg.async === false) ? false : true;
xmlHttpReq.open(cfg.method, requestUrl, async);
var idx = this.timerCount++;
if (async) {
this.setupReadyState(xmlHttpReq,message,idx);
}
if (cfg.method == 'POST') {
xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttpReq.setRequestHeader('Content-Length', message.rawRequest.length);
if (message.headers !== 'undefined' && message.headers) {
// populate HttpReq header from message.headers
for (var m in message.headers) {
xmlHttpReq.setRequestHeader(m, message.headers[m]);
}
}
xmlHttpReq.send(message.rawRequest);
}
else {
xmlHttpReq.send(null);
}
if (!async && !this.checkAndSetProcessed(idx)) {
vjo.dsf.Service.callback(xmlHttpReq, message);
} else if (cfg.timeout) { //default is 0. do not set timeout, if not defined
var _this = this;
this.reqTimers[idx] = window.setTimeout(function () { _this.timeout(xmlHttpReq,message,idx); },cfg.timeout)
}
}
catch (e) {
vjo.dsf.SvcErr.err(message, vjo.dsf.SvcErr.InvRq, "Cannot open URL '" + requestUrl + "'");
}
},
//> private void setupReadyState(Object xmlHttp, Message message, String idx);
setupReadyState : function (xmlHttp,message,idx) {
var _this = this;
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState != 4 || _this.checkAndSetProcessed(idx)) {
return;
}
var timer = _this.reqTimers[idx];
if (timer) {//clear timeout
window.clearTimeout(timer);
delete _this.reqTimers[idx];
}
vjo.dsf.Service.callback(xmlHttp, message);
}
},
//> public void timeout(Object xmlHttp, Message message, String idx);
timeout : function (xmlHttp,message,idx) {
if (this.checkAndSetProcessed(idx)) {
return;
}
delete xmlHttp.onreadystatechange;
xmlHttp.abort();
delete this.reqTimers[idx];
vjo.dsf.SvcErr.err(message, vjo.dsf.SvcErr.TO, "Timed out:" + message.svcConfig.timeout);
vjo.dsf.ServiceEngine.handleResponse(message);
},
//> private boolean checkAndSetProcessed(String idx);
checkAndSetProcessed : function(idx) {
if (this.processed[idx]) {
return true;
}
this.processed[idx] = true;
return false;
},
//> private void remoteTrspHdl(Message message);
remoteTrspHdl : function (message) {//default v4 remote transport handler
//NOTE: if there are any "this" references in this method, there may be problems.
//will need to register with some scope
var cfg = message.svcConfig;
if (!cfg || cfg.objType!="dsf_SvcConfig") { //create other svc cfg for existing urls
return;
} else if (cfg.respMarshalling == 'JSCALLBACK') {//client assembler
if (typeof vjo.dsf.assembly != 'undefined'
&& typeof vjo.dsf.assembly.VjClientAssembler != 'undefined'
&& !vjo.dsf.assembly.VjClientAssembler.bBodyLoaded) {
vjo.dsf.assembly.VjClientAssembler.load(message);
message.status = -1;
return;
}
}
if (message.request && message.request.javaClass) {
delete message.request.b; //remove this.b from vjo type before serialization
}
var svc = vjo.dsf.Service, requestUrl = cfg.url;
if (message.svcConfig.method == 'GET') {
var sep = (requestUrl.indexOf('?') == -1) ? '?':'&';
requestUrl = requestUrl + sep + message.rawRequest;
} else if (!message.rawRequest) {
// FIXME review and remove
var payload = svc.generateReqParams(message);
message.rawRequest = payload;
}
//if (message.svcConfig.respMarshalling == 'JSCALLBACK') {
//requestUrl += "&callback="+vjo.dsf.XDomainRequest.createCallback(message);
//}
message.svcConfig.url = requestUrl;
},
//> private String appendPort80ForSafari(String hrefUrl, String requestUrl);
appendPort80ForSafari : function(hrefUrl, requestUrl){
try{
if(navigator.userAgent.toLowerCase().indexOf('safari') >= 0){//check if browser is safari
var regex = '(([^:]*)://([^:/?]*)(:([0-9]+))?)?([^?#]*)([?]([^#]*))?(#(.*))?',
ajaxUrl = requestUrl,
safariIssuePort = '80';
var hrefUrlMatch = hrefUrl.match(regex);
if(hrefUrlMatch && hrefUrlMatch.length >= 5 && hrefUrlMatch[5] && hrefUrlMatch[5] == safariIssuePort){//port number is 80
var ajaxUrlMatch = ajaxUrl.match(regex);
if(ajaxUrlMatch && ajaxUrlMatch[2] && ajaxUrlMatch[2].length > 0){//request url is absolute
if(ajaxUrlMatch[5] && ajaxUrlMatch[5].length > 0){//request url has explicit port number
//explicit port number exists
}
else{//inject :80 to the request url
var requestUrlWithPort = '';
if(ajaxUrlMatch[2]){
requestUrlWithPort += ajaxUrlMatch[2] + '://';
}
if(ajaxUrlMatch[3]){
requestUrlWithPort += ajaxUrlMatch[3] + ':' + safariIssuePort;
}
if(ajaxUrlMatch[6]){
requestUrlWithPort += ajaxUrlMatch[6];
}
if(ajaxUrlMatch[8]){
requestUrlWithPort += '?' + ajaxUrlMatch[8];
}
if(ajaxUrlMatch[10]){
requestUrlWithPort += '#' + ajaxUrlMatch[10];
}
requestUrl = requestUrlWithPort;
}
}
}
}
}
catch(e){
}
return requestUrl;
}
})
.endType();
// @JsDoNotOptimize
// @JsMinimize
// @JsDoNotLintValidate
// @Package vjo.dsf
vjo.ctype("vjo.dsf.Json")
.endType();
if (!this.JSON) {
JSON = function () {
function f(n) {
return n < 10 ? '0' + n : n;
}
Date.prototype.toJSON = function (key) {
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapeable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
escapeable.lastIndex = 0;
return escapeable.test(string) ?
'"' + string.replace(escapeable, function (a) {
var c = meta[a];
if (typeof c === 'string') {
return c;
}
return '\\u' + ('0000' +
(+(a.charCodeAt(0))).toString(16)).slice(-4);
}) + '"' :
'"' + string + '"';
}
function str(key, holder) {
var i,
k,
v,
length,
mind = gap,
partial,
value = holder[key];
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
return String(value);
case 'object':
if (!value) {
return 'null';
}
gap += indent;
partial = [];
if (typeof value.length === 'number' &&
!(value.propertyIsEnumerable('length'))) {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
v = partial.length === 0 ? '[]' :
gap ? '[\n' + gap +
partial.join(',\n' + gap) + '\n' +
mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
k = rep[i];
if (typeof k === 'string') {
v = str(k, value, rep);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = str(k, value, rep);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
v = partial.length === 0 ? '{}' :
gap ? '{\n' + gap +
partial.join(',\n' + gap) + '\n' +
mind + '}' :
'{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
return {
stringify: function (value, replacer, space) {
var i;
gap = '';
indent = '';
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
} else if (typeof space === 'string') {
indent = space;
}
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
return str('', {'': value});
},
parse: function (text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' + ('0000' +
(+(a.charCodeAt(0))).toString(16)).slice(-4);
});
}
if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
j = eval('(' + text + ')');
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
throw new SyntaxError('JSON.parse');
}
};
}();
}
vjo.itype("vjo.dsf.IBinding") //< public
//> needs vjo.dsf.Message
.protos({
//> public String serialize(vjo.dsf.Message)
serialize : function(message){
},
//> public void deserialize(vjo.dsf.Message)
deserialize : function(message){
}
})
.endType();
/**
* Represents an map structrue used to handle response data.
*/
vjo.ctype('vjo.util.Map')
.protos({
//> public void constructs();
//> public void constructs(Object);
//> public void constructs(java.util.HashMap);
constructs : function (psJavaClass) {
this.javaClass = psJavaClass || 'java.util.HashMap';
this.map = {};
},
/**
* Returns the element with the specified key in this map.
*
* @param {Object} key
* An object used as key value
* @return {Object}
* The element with the key
*/
//> public Object get(Object);
get : function (key) {
return this.map[key];
},
/**
* Appends the specified element to the map.
*
* @param {Object} key
* An object used as key value
* @param {Object} value
* An object value with a key
* @return {Object}
* The added object
*/
//> public Object add(Object, Object);
put : function (key,value) {
return this.map[key] = value;
},
/**
* Removes a specified value with specified key object.
*
* @param {Object} key
* A key object of the value object to be removed
* @return {boolean}
* The removed value object
*/
//> public boolean remove(Object);
remove : function (key) {
var val = this.map[key];
delete this.map[key];
return val;
},
/**
* Gets the number of key-value pairs in current map.
*
* @return {int}
* The number of key-value pairs
*/
//> public int size();
size : function () {
var count = 0;
for (var key in this.map){
count ++;
}
return count;
}
//TODO: keys & values, or possibly a foreach that takes a function
})
.endType();
/**
* vjo.dsf.Json is added outside of type since it's
* not a vjo object, and will not notify it's loaded.
* inits block will only init once all dependencies are
* loaded. specify a global needs for any non vjo dependencies.
*/
vjo.needs("vjo.dsf.Json");
vjo.ctype('vjo.dsf.JsonBinding') //< public
.satisfies('vjo.dsf.IBinding')
.needs('vjo.dsf.Error')
.needs('vjo.dsf.SvcErr')
.needs('vjo.dsf.Message')
.needs('vjo.util.List')
.needs('vjo.util.Map')
.needs('vjo.dsf.ServiceResponse')
.needs('vjo.dsf.Service')
.needs('vjo.dsf.Enc')
.protos({
//>public String serialize(Message message)
serialize : function(message){
var request = '';
request += vjo.dsf.Service.generateReqParams(message);
request += vjo.dsf.Enc.encodeURIComponent(JSON.stringify(message.request));//< @SUPRESSTYPECHECK
message.rawRequest = request;
return request;
},
//>public void deserialize(Message message)
deserialize : function(message){
// TODO integrate new TypeMappingClz or create new binding
// lookup the response type name from TypeMappings (from message)
// var TypeMappingClz = eval(message.svcConfig.typeMappingClassName);
// var TypeMappingObj = new TypeMappingClz();
// var responseTypeName = TypeMappingObj.getResponseTypeName(message.svcConfig.operationName);
var respStr = message.response.data;
try {
message.response = eval("("+respStr+")");
// backwards compatibility logic here
// add ServiceResponse.addError methods
this.addMethods(message.response,vjo.dsf.ServiceResponse.prototype.addError);
// javaclass hint is used then use default binding
if (message.response.data) {
this.processObj(message.response.data);
}
} catch (e) {
//JSON Parse error
//attach to message and send to handler
var error = new vjo.dsf.Error();
error.id = vjo.dsf.SvcErr.Prs;
error.message = "marshalling=" + message.svcConfig.respMarshalling + ":responseText=" + respStr;
message.response.addError(error);
}
},
//> private void processObj(Object obj);
processObj : function (obj) {
var hint = obj.javaClass;
if (hint && hint.length>0) {
if (/java.util.([^\s])*List/.test(hint)) {
this.addMethods(obj,vjo.util.List.prototype);
} else if (/java.util.([^\s])*Map/.test(hint)) {
this.addMethods(obj,vjo.util.Map.prototype);
}
}
},
//> private void addMethods(Object obj, Object methods);
addMethods : function (obj,methods) {
for (var key in methods) {
obj[key] = methods[key];
}
}
})
.endType();