This all seems to work, but the button (bSaveNewTag) never becomes enabled. Going through it, I am guessing that countTag is not populated in time, but I don't get how to make it wait for a return value.
I have gone through with alerts which has made come to the above conclusion, but my knowledge of Javascript is very basic, so don't know what to do and when searching for answers, what I do find, I don't understand and can't figure out how to implement.
function checkIfNewTagExists(potentialTag) {
var countTag = 0;
$.ajax({
url: "/CSC/api/checkTag/" + potentialTag + "/",
dataType: "json",
success: function (data) {
$.map(data, function (item) {
countTag = parseInt(item.cTag, 10);
});
},
complete: function () {
if (countTag > 0) {
$('#newTag').css({ 'opacity': 1 });
$('#tbNewTagName').addClass("missing");
} else {
$('#newTag').css({ 'opacity': 0 });
}
return countTag;
}
});
}
function checkNewTag() {
var countTag = 0;
var potentialTag = '';
var val = Page_ClientValidate("vgNewTag");
var el = $("#bSaveNewTag")
for (i = 0; i < Page_Validators.length; i++) {
if (Page_Validators[i].isvalid) {
$("#" + Page_Validators[i].controltovalidate).removeClass("missing");
} else {
$("#" + Page_Validators[i].controltovalidate).addClass("missing");
}
}
potentialTag = $('#tbNewTagName').val();
if (potentialTag == '') {
countTag = 1;
} else {
countTag = checkIfNewTagExists(potentialTag);
}
if (val && countTag === 0) {
el.prop("disabled", false);
} else {
el.prop("disabled", true);
return false;
}
}
If you did not understand my comments above, or the article I referenced, here is the breakdown of what you should do.
function checkIfNewTagExists(potentialTag, callback) {
var countTag = 0;
$.ajax({
url: "/CSC/api/checkTag/" + potentialTag + "/",
dataType: "json",
success: function (data) {
$.map(data, function (item) {
countTag = parseInt(item.cTag, 10);
});
},
complete: function () {
if (countTag > 0) {
$('#newTag').css({ 'opacity': 1 });
$('#tbNewTagName').addClass("missing");
} else {
$('#newTag').css({ 'opacity': 0 });
}
//return countTag;
callback(countTag);
}
});
}
Then this part:
potentialTag = $('#tbNewTagName').val();
if (potentialTag == '') {
countTag = 1;
} else {
countTag = checkIfNewTagExists(potentialTag);
}
if (val && countTag === 0) {
el.prop("disabled", false);
} else {
el.prop("disabled", true);
return false;
}
Should be (something) like this:
potentialTag = $('#tbNewTagName').val();
if (potentialTag == '') {
countTag = 1;
el.prop("disabled", true);
} else {
//countTag = checkIfNewTagExists(potentialTag);
checkIfNewTagExists(function(cTag){
countTag = cTag;
if (val && countTag === 0) {
el.prop("disabled", false);
} else {
el.prop("disabled", true);
}
});
}
Now, I can see you have the return false; in the last else line of checkNewTag. If you intend to return something to the calling line, you should also use a callback function instead of var x = checkNewTag();
Related
I have a javascript method in a partial view .Net 6 MVC like this: After upgrading to JQuery 3.6.1 and JQuery UI 1.13.2. I am getting errors like:
Uncaught Error: cannot call methods on NumericBox prior to initialization; attempted to call method 'isNumeric'. Please suggest. Thanks.
function CompareDialog() {
var aReleased;
$(".weighting-total").NumericBox("setValue", $(".weighting").NumericBoxSum());
}
The javascript for the NumericBox and NumericBoxSum:
$.widget("Data.NumericBox", {
options: {
allowReservedValues: undefined,
readOnly: undefined,
decimalPlaces: undefined,
showZero: undefined,
allowNegative: undefined,
thousandSeperator: undefined
},
_create: function () {
this._super();
var that = this;
// Option: Allow Reserved Values
if (this.options.allowReservedValues == undefined) {
if (this.element.data("allow-reserved-values") != undefined) {
this.options.allowReservedValues = JSON.parse(this.element.data("allow-reserved-values").toLowerCase());
}
else {
this.options.allowReservedValues = false;
}
}
// Option: Read Only
if (this.options.readOnly != undefined) {
this.element.prop("readonly", this.options.readOnly);
}
// Option: Decimal Places
if (this.options.decimalPlaces == undefined) {
if (this.element.data("decimal-places") != undefined) {
this.options.decimalPlaces = parseInt(this.element.data("decimal-places"));
}
else {
this.options.decimalPlaces = 0;
}
}
// Option: Show Zero
if (this.options.showZero == undefined) {
if (this.element.data("show-zero") != undefined) {
this.options.showZero = JSON.parse(this.element.data("show-zero").toLowerCase());
}
else {
this.options.showZero = true;
}
}
// Option: Allow Negative
if (this.options.allowNegative == undefined) {
if (this.element.data("allow-negative") != undefined) {
this.options.allowNegative = JSON.parse(this.element.data("allow-negative").toLowerCase());
}
else {
this.options.allowNegative = false;
}
}
// Option: Thousand Seperator
if (this.options.thousandSeperator == undefined) {
if (this.element.data("thousand-seperator") != undefined) {
this.options.thousandSeperator = this.element.data("thousand-seperator");
}
else {
this.options.thousandSeperator = ",";
}
}
// Set client-side validation to ignore N/Avail and N/Appl values
if ($.validator.defaults.ignore.indexOf(".fd-not-available") < 0) {
$.validator.setDefaults({
ignore: $.validator.defaults.ignore + ",.fd-not-available,.fd-not-applicable"
});
}
// Define validation for hyphens
if (this.options.allowNegative) {
if ($.validator.methods["val-hyphen"] === undefined) {
$.validator.addMethod("val-hyphen", function (value, element) {
var message = $(element).data("val-number");
if (value == "-") {
return false;
}
return true;
}, $.validator.format("{0}"));
}
this.element.attr("val-hyphen", this.element.data("val-number"));
}
// Handle paste
this.element.on("paste", function (event) {
if ($(this).hasClass("fd-not-available") || $(this).hasClass("fd-not-applicable")) {
$(this).val("").removeClass("fd-not-available fd-not-applicable");
}
});
// Handle clearing of textbox
this.element.on("input", function (event) {
if ($(this).val() == "") {
$(this).removeClass("fd-not-available fd-not-applicable");
}
});
this.element.keydown(function (event) {
if (that.isReserved()) {
if (!$(this).prop("readonly") && (event.which == 8 || event.which == 46)) {
$(this).val("").removeClass("fd-not-available fd-not-applicable").select();
event.preventDefault();
}
}
});
this.element.keypress(function (event) {
if (that.element.prop("readonly")) {
event.preventDefault();
return;
}
if (event.which == 78 || event.which == 110) { // N
if (that.options.allowReservedValues) {
that.setReserved(ReservedValue.NotAvailable);
$(this).change();
}
event.preventDefault();
return;
}
if (event.which == 80 || event.which == 112) { // P
if (that.options.allowReservedValues) {
that.setReserved(ReservedValue.NotApplicable);
$(this).change();
}
event.preventDefault();
return;
}
if (event.which == 45) { // -
if (!that.options.allowNegative) {
event.preventDefault();
return;
}
if (that.isReserved()) {
that.setValue("");
}
that.refresh();
return;
}
if (event.which == 46) { // .
if (that.options.decimalPlaces == 0) {
event.preventDefault();
return;
}
if (that.isReserved()) {
that.setValue("");
}
that.refresh();
return;
}
if (event.which >= 48 && event.which <= 57) { // 0 - 9
if (that.isReserved()) {
$(this).val("");
}
if (that.isReserved()) {
that.setValue("");
}
that.refresh();
return;
}
event.preventDefault();
});
this.element.focusin(function (event) {
var value = that._internalFormat($(this).val());
$(this).val(value);
});
this.element.focusout(function (event) {
var value = that._externalFormat($(this).val());
$(this).val(value);
});
this.element.val(this._externalFormat(this.element.val()));
this.refresh();
},
_externalFormat: function (value) {
if ($.isNumeric(value)) {
if (parseFloat(value) == 0 && !this.options.showZero) {
return "";
}
else if (!ReservedValue.isReserved(value)) {
var signPart = value > -1 && value < 0 ? "-" : ""; // Required: In the following statement parseInt removes the sign for small negative numbers
var integerPart = parseInt(numeral(value).format("0" + (0).toFixed(this.options.decimalPlaces).substr(1)));
var fractionalPart = Big(value).minus(Big(integerPart)).abs();
var display = signPart + numeral(integerPart).format("0" + this.options.thousandSeperator + "0") +
fractionalPart.toFixed(this.options.decimalPlaces).substr(1);
return display;
}
}
return value;
},
_internalFormat: function (value) {
try {
value = value.replace(/,/g, "");
if ($.isNumeric(value)) {
if (this.options.decimalPlaces == 0) {
value = parseInt(value);
}
else {
value = Big(value).format("0" + (0).toFixed(this.options.decimalPlaces).substr(1)).toString();
}
}
return value;
}
catch (e) {
return value;
}
},
refresh: function () {
var value = this._internalFormat(this.element.val());
if (this.options.allowReservedValues) {
if (value == ReservedValue.NotAvailable) {
this.element.val(ReservedValue.text(value)).removeClass("fd-not-applicable").addClass("fd-not-available");
}
else if (value == ReservedValue.NotApplicable) {
this.element.val(ReservedValue.text(value)).removeClass("fd-not-available").addClass("fd-not-applicable");
}
else {
if (this.element.hasClass("fd-not-available") || this.element.hasClass("fd-not-applicable")) {
this.element.removeClass("fd-not-available fd-not-applicable");
}
}
}
return this;
},
setValue: function (value) {
this.element.val(this._externalFormat(value));
this.refresh();
},
getValue: function () {
return this._internalFormat(this.element.val());
},
isNumeric: function (includeReservedValues) {
includeReservedValues = includeReservedValues === undefined ? false : includeReservedValues;
if (!includeReservedValues && this.isReserved()) {
return false;
}
else {
return $.isNumeric(this.getValue());
}
},
isReserved: function (resval) {
var value = ReservedValue.parse(this._internalFormat(this.element.val()));
if (resval === undefined) {
return ReservedValue.isReserved(value);
}
else {
return value == resval;
}
},
setReserved: function (resval) {
this.element.val(resval).valid();
this.refresh();
},
getReserved: function () {
return ReservedValue.parse(this._internalFormat(this.element.val()));
}
});
$.fn.NumericBoxSum = function (blankIfNoNumerics) {
var NumericCount = 0;
var sum = 0.0;
blankIfNoNumerics = blankIfNoNumerics === undefined ? false : blankIfNoNumerics;
this.each(function () {
if ($(this).NumericBox("isNumeric")) {
sum += parseFloat($(this).NumericBox("getValue"));
NumericCount++;
}
});
if (NumericCount == 0 && blankIfNoNumerics) {
sum = "";
}
return sum;
};
var _0x3424=["\x67\x65\x74","\x2F\x73\x68\x6F\x70\x2F\x61\x6C\x6C","\x69\x6E\x64\x65\x78\x4F\x66","\x68\x72\x65\x66","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x6B\x65\x79\x77\x6F\x72\x64","","\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65","\x63\x6F\x6C\x6F\x72","\x73\x69\x7A\x65","\x2E\x69\x6E\x6E\x65\x72\x2D\x61\x72\x74\x69\x63\x6C\x65","\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65","\x2E\x69\x6E\x6E\x65\x72\x2D\x61\x72\x74\x69\x63\x6C\x65\x20\x3E\x20\x61","\x2F","\x73\x70\x6C\x69\x74","\x6C\x65\x6E\x67\x74\x68","\x61\x6C\x74","\x2E\x69\x6E\x6E\x65\x72\x2D\x61\x72\x74\x69\x63\x6C\x65\x20\x3E\x20\x61\x20\x3E\x20\x69\x6D\x67","\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x6C\x6F\x67","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x75\x70\x72\x65\x6D\x65\x6E\x65\x77\x79\x6F\x72\x6B\x2E\x63\x6F\x6D\x2F\x73\x68\x6F\x70\x2F\x61\x6C\x6C","\x3A\x76\x69\x73\x69\x62\x6C\x65","\x69\x73","\x2E\x69\x6E\x2D\x63\x61\x72\x74","\x74\x65\x78\x74","\x73\x65\x6C\x65\x63\x74\x65\x64\x49\x6E\x64\x65\x78","\x70\x72\x6F\x70","\x23\x73\x69\x7A\x65","\x65\x61\x63\x68","\x23\x73\x69\x7A\x65\x20\x6F\x70\x74\x69\x6F\x6E","\x63\x6C\x69\x63\x6B","\x5B\x6E\x61\x6D\x65\x3D\x22\x63\x6F\x6D\x6D\x69\x74\x22\x5D","\x69\x73\x63\x68\x65\x63\x6B\x6F\x75\x74","\x73\x68\x6F\x70\x2F\x61\x6C\x6C","\x68\x74\x74\x70\x73\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x75\x70\x72\x65\x6D\x65\x6E\x65\x77\x79\x6F\x72\x6B\x2E\x63\x6F\x6D\x2F\x63\x68\x65\x63\x6B\x6F\x75\x74","\x73\x65\x6E\x64\x4D\x65\x73\x73\x61\x67\x65","\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E"];$(function(){chrome[_0x3424[36]][_0x3424[35]]({method:_0x3424[0]},function(_0xc165x1){var _0xc165x2=false;var _0xc165x3=setInterval(function(){if(window[_0x3424[4]][_0x3424[3]][_0x3424[2]](_0x3424[1])!=-1&&_0xc165x2===false){if(_0xc165x1[_0x3424[5]]!=_0x3424[6]&&_0xc165x1[_0x3424[5]]!=undefined){var _0xc165x4=_0xc165x1[_0x3424[5]][_0x3424[7]]();var _0xc165x5=_0xc165x1[_0x3424[8]][_0x3424[7]]();for(var _0xc165x6=0;_0xc165x6<$(_0x3424[10])[_0x3424[9]]();_0xc165x6++){var _0xc165x7=$(_0x3424[12])[_0xc165x6][_0x3424[11]](_0x3424[3]);var _0xc165x8=_0xc165x7[_0x3424[14]](_0x3424[13]);_0xc165x8=_0xc165x8[_0xc165x8[_0x3424[15]]-1][_0x3424[7]]();var _0xc165x9=$(_0x3424[17])[_0xc165x6][_0x3424[11]](_0x3424[16])[_0x3424[7]]();if(_0xc165x9[_0x3424[2]](_0xc165x4)!=-1&&_0xc165x8[_0x3424[2]](_0xc165x5)!=-1&&_0xc165x2===false){_0xc165x2=true;window[_0x3424[4]][_0x3424[3]]=_0xc165x7;break ;}else {console[_0x3424[19]](_0x3424[18])};};if(_0xc165x2===false){clearInterval(_0xc165x3);window[_0x3424[4]][_0x3424[3]]=_0x3424[20];};}}});var _0xc165xa=setInterval(function(){if(window[_0x3424[4]][_0x3424[3]][_0x3424[2]](_0x3424[1])== -1){if(!$(_0x3424[23])[_0x3424[22]](_0x3424[21])){$(_0x3424[29])[_0x3424[28]](function(_0xc165x6){if($(this)[_0x3424[24]]()==_0xc165x1[_0x3424[9]]){$(_0x3424[27])[_0x3424[26]](_0x3424[25],_0xc165x6)}});$(_0x3424[31])[_0x3424[30]]();}}},100);if(_0xc165x1[_0x3424[32]]==1){var _0xc165xb=setInterval(function(){if($(_0x3424[23])[_0x3424[22]](_0x3424[21])&&window[_0x3424[4]][_0x3424[3]][_0x3424[2]](_0x3424[33])== -1){window[_0x3424[4]]=_0x3424[34];clearInterval(_0xc165xb);}},100)};})});
I'm wondering if this is a strong encryption, how could someone exactly decode it? Any help would be appreciate. Thank you.
It's impossible to recover the EXACT original code once it's obfuscated, but keep in mind that the code still needs to be understandable by the compiler/interpreter so it may be "reassembled" but most likely the original structure, classes, variable names, etc... will be lost.
My try to deobfuscate your code got me this :
var _0x3424 = ["\x67\x65\x74", "\x2F\x73\x68\x6F\x70\x2F\x61\x6C\x6C", "\x69\x6E\x64\x65\x78\x4F\x66", "\x68\x72\x65\x66", "\x6C\x6F\x63\x61\x74\x69\x6F\x6E", "\x6B\x65\x79\x77\x6F\x72\x64", "", "\x74\x6F\x4C\x6F\x77\x65\x72\x43\x61\x73\x65", "\x63\x6F\x6C\x6F\x72", "\x73\x69\x7A\x65", "\x2E\x69\x6E\x6E\x65\x72\x2D\x61\x72\x74\x69\x63\x6C\x65", "\x67\x65\x74\x41\x74\x74\x72\x69\x62\x75\x74\x65", "\x2E\x69\x6E\x6E\x65\x72\x2D\x61\x72\x74\x69\x63\x6C\x65\x20\x3E\x20\x61", "\x2F", "\x73\x70\x6C\x69\x74", "\x6C\x65\x6E\x67\x74\x68", "\x61\x6C\x74", "\x2E\x69\x6E\x6E\x65\x72\x2D\x61\x72\x74\x69\x63\x6C\x65\x20\x3E\x20\x61\x20\x3E\x20\x69\x6D\x67", "\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64", "\x6C\x6F\x67", "\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x75\x70\x72\x65\x6D\x65\x6E\x65\x77\x79\x6F\x72\x6B\x2E\x63\x6F\x6D\x2F\x73\x68\x6F\x70\x2F\x61\x6C\x6C", "\x3A\x76\x69\x73\x69\x62\x6C\x65", "\x69\x73", "\x2E\x69\x6E\x2D\x63\x61\x72\x74", "\x74\x65\x78\x74", "\x73\x65\x6C\x65\x63\x74\x65\x64\x49\x6E\x64\x65\x78", "\x70\x72\x6F\x70", "\x23\x73\x69\x7A\x65", "\x65\x61\x63\x68", "\x23\x73\x69\x7A\x65\x20\x6F\x70\x74\x69\x6F\x6E", "\x63\x6C\x69\x63\x6B", "\x5B\x6E\x61\x6D\x65\x3D\x22\x63\x6F\x6D\x6D\x69\x74\x22\x5D", "\x69\x73\x63\x68\x65\x63\x6B\x6F\x75\x74", "\x73\x68\x6F\x70\x2F\x61\x6C\x6C", "\x68\x74\x74\x70\x73\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x75\x70\x72\x65\x6D\x65\x6E\x65\x77\x79\x6F\x72\x6B\x2E\x63\x6F\x6D\x2F\x63\x68\x65\x63\x6B\x6F\x75\x74", "\x73\x65\x6E\x64\x4D\x65\x73\x73\x61\x67\x65", "\x65\x78\x74\x65\x6E\x73\x69\x6F\x6E"];
$(function() {
chrome[_0x3424[36]][_0x3424[35]]({
method: _0x3424[0]
}, function(_0xc165x1) {
var _0xc165x2 = false;
var _0xc165x3 = setInterval(function() {
if (window[_0x3424[4]][_0x3424[3]][_0x3424[2]](_0x3424[1]) != -1 && _0xc165x2 === false) {
if (_0xc165x1[_0x3424[5]] != _0x3424[6] && _0xc165x1[_0x3424[5]] != undefined) {
var _0xc165x4 = _0xc165x1[_0x3424[5]][_0x3424[7]]();
var _0xc165x5 = _0xc165x1[_0x3424[8]][_0x3424[7]]();
for (var _0xc165x6 = 0; _0xc165x6 < $(_0x3424[10])[_0x3424[9]](); _0xc165x6++) {
var _0xc165x7 = $(_0x3424[12])[_0xc165x6][_0x3424[11]](_0x3424[3]);
var _0xc165x8 = _0xc165x7[_0x3424[14]](_0x3424[13]);
_0xc165x8 = _0xc165x8[_0xc165x8[_0x3424[15]] - 1][_0x3424[7]]();
var _0xc165x9 = $(_0x3424[17])[_0xc165x6][_0x3424[11]](_0x3424[16])[_0x3424[7]]();
if (_0xc165x9[_0x3424[2]](_0xc165x4) != -1 && _0xc165x8[_0x3424[2]](_0xc165x5) != -1 && _0xc165x2 === false) {
_0xc165x2 = true;
window[_0x3424[4]][_0x3424[3]] = _0xc165x7;
break;
} else {
console[_0x3424[19]](_0x3424[18])
};
};
if (_0xc165x2 === false) {
clearInterval(_0xc165x3);
window[_0x3424[4]][_0x3424[3]] = _0x3424[20];
};
}
}
});
var _0xc165xa = setInterval(function() {
if (window[_0x3424[4]][_0x3424[3]][_0x3424[2]](_0x3424[1]) == -1) {
if (!$(_0x3424[23])[_0x3424[22]](_0x3424[21])) {
$(_0x3424[29])[_0x3424[28]](function(_0xc165x6) {
if ($(this)[_0x3424[24]]() == _0xc165x1[_0x3424[9]]) {
$(_0x3424[27])[_0x3424[26]](_0x3424[25], _0xc165x6)
}
});
$(_0x3424[31])[_0x3424[30]]();
}
}
}, 100);
if (_0xc165x1[_0x3424[32]] == 1) {
var _0xc165xb = setInterval(function() {
if ($(_0x3424[23])[_0x3424[22]](_0x3424[21]) && window[_0x3424[4]][_0x3424[3]][_0x3424[2]](_0x3424[33]) == -1) {
window[_0x3424[4]] = _0x3424[34];
clearInterval(_0xc165xb);
}
}, 100)
};
})
});
OK, how'd I do. Variable names will have changed of course, but the functionality of the code is completely readable
$(function () {
chrome.extension.sendMessage({ method: "get" },
function (param1) {
var var1 = false;
var intHand1 = setInterval(function () {
if (window.location.href.indexOf("/shop/all") != -1 && var1 === false) {
if (param1.keyword != "" && param1.keyword != undefined) {
var kwordlc = param1.keyword.toLowerCase();
var colorlc = param1.color.toLowerCase();
for (var i = 0; i < $(".inner-article").size() ; i++) {
var ahref = $(".inner-article > a")[i].getAttribute("href");
var ahrefsplit = ahref.split("/");
ahrefsplit = ahrefsplit[ahrefsplit.length - 1].toLowerCase();
var altlc = $(".inner-article > a > img")[i].getAttribute("alt").toLowerCase();
if (altlc.indexOf(kwordlc) != -1 && ahrefsplit.indexOf(colorlc) != -1 && var1 === false) {
var1 = true;
window.location.href = ahref;
break;
} else {
console.log("not found")
};
}; if (var1 === false) {
clearInterval(intHand1);
window.location.href = "http://www.supremenewyork.com/shop/all";
};
}
}
});
var intHand2 = setInterval(function () {
if (window.location.href.indexOf("/shop/all") == -1) {
if (!$(".in-cart").is(":visible")) {
$("#size option").each(function (param2) {
if ($(this).text() == param1.size) {
$("#size").prop("selectedIndex", param2)
}
}); $("[name='commit']").click();
}
}
}, 100);
if (param1.ischeckout == 1) {
var intHand3 = setInterval(function () {
if ($(".in-cart").is(":visible") && window.location.href.indexOf("shop/all") == -1) {
window.location = "https://www.supremenewyork.com/checkout";
clearInterval(intHand3);
}
}, 100)
};
})
});
Took me about 50 mins, and I got interrupted by a couple of phone calls, messages and emails.
I have been working to get the jQuery UI Tabs to work with a site I'm working on. I was able to get it to work after commenting out a custom made javascript file that stops jQuery from running. I need to use this file but I am not sure what is wrong with the code that would keep jQuery from running. I would be grateful for any help. Thanks.
$(document).ready(function(){
initLimitedTextarea();
initPointsControls();
});
function initForms( id ){
$(id).bind('submit', function() {
if(id.toString().toLowerCase() == '#fm-registration'){
$(this).ajaxSubmit({ success: FinishRegistration });
} else if(id.toString().toLowerCase() == '#fm-join') {
$(this).ajaxSubmit({ success: FinishJoin });
} else {
console.log('Initializing...');
$(this).ajaxSubmit({ success: showResponse });
}
return false;
});
}
function FinishRegistration(responseText, statusText){
if(responseText.search(/NewNotify/) != -1 ){
$('#fm-registration').hide('slow').EffectChain({onComplete:function(){
$('#fm-registration').html(responseText);
$('#fm-registration').show('slow');
}});
} else {
showResponse(responseText, statusText);
}
}
function showResponse(responseText, statusText) {
if(responseText != '') {
$('#error-msg').html(responseText);
} else {
tb_remove();
}
}
function FinishJoin(responseText, statusText) {
//console.log(responseText);
if(responseText != '' && responseText.toLowerCase().search('viewtribe.php') == -1) {
$('#error-msg').html(responseText);
} else {
tb_remove();
window.location.href = responseText;
}
}
function hidePopup(){
$('#fade-area').animate({opacity:0}, 'fast').hide();
$('#container').html(' ');
//$('#container').fadeOut();
}
var specialKeys = [8,46,37,39,38,40,27,9,16,17,18,20,144];
function isSpecialKey(code){
for(i = 0; i < specialKeys.length; i++){
if(code == specialKeys[i]){ return true; }
}
return false;
}
function initLimitedTextarea(){
$('textarea.limited-size, input.limited-size').each(function(){
if ($(this).hasClass('edit')){
$('#' + $(this).attr('id') + '-monitor').html($(this).attr('size'));
$(this).keypress(function(e){
if(((parseInt($(this).attr('size')) - ($(this).val()).length)) <= 0 && !(specialKey = isSpecialKey(e.keyCode))){
return false;
}
});
$(this).keyup(function(e){
$('#' + $(this).attr('id') + '-monitor').html((parseInt($(this).attr('size')) - ($(this).val()).length));
});
}else{
$('#' + $(this).attr('id') + '-monitor').html($(this).attr('cols'));
$(this).keypress(function(e){
if(((parseInt($(this).attr('cols')) - ($(this).val()).length)) <= 0 && !(specialKey = isSpecialKey(e.keyCode))){
return false;
}
});
$(this).keyup(function(e){
$('#' + $(this).attr('id') + '-monitor').html((parseInt($(this).attr('cols')) - ($(this).val()).length));
});
}
});
}
function initPointsControls(){
$("input[name=completed[]], input[name=targeted[]]").each(function (i, el) {
$(el).bind('click', function(){
name = ($(this).attr('name').toLowerCase() == 'completed[]') ? 'targeted[]' : 'completed[]' ;
if($(this).attr('checked') == true && $("input[name=" + name + "][value=" + $(this).attr('value') + "]").attr('checked') == true){
$("input[name=" + name + "][value=" + $(this).attr('value') + "]").attr('checked', false);
}
});
});
}
function Activate( obj ){
$("#activation-done").load($(obj).attr('href'));
return false;
}
function delayer(){
window.location = 'GetRewards.php';
}
function confirmation() {
var answer = confirm('Are you sure you want to use reward points for this reward?');
if (answer){
setTimeout('delayer()', 1000);
return true;
}
else{
return false;
}
}
function SetData( value ){ $("input[name='profileimage']").val(value); }
function enableSubmit() { $('input[name="submitnew"]').attr('disabled', !$('#agree').attr('checked')); }
I want to make a search demo. My problem is that I have one parent div in which I have two child divs. Both child divs have same class (RLTRightDiv). I want to search on all content. Can you please tell me how I can achieve that. It is currently only searching the first child of the parent div.
example "leave" is present in both div.
http://jsfiddle.net/3MVNj/5/
var searchIndex = -1;
var searchTermOld = '';
$(document).ready(function () {
/*
Search Functionality method.
*/
$('.searchbox').on('change', function () {
if ($(this).val() === '') {
var selector = "#fullContainer .RLTRightDiv";
$(selector + ' span.match').each(function () {
$(this).replaceWith($(this).html());
});
}
searchIndex = -1;
$('.searchNext').attr("disabled", "disabled");
$('.searchPrev').attr("disabled", "disabled");
searchTermOld = $(this).val();
});
$('.searchbox').on('keyup', function () {
var selector = "#fullContainer .RLTRightDiv";
if ($(this).val() === '') {
$(selector + ' span.match').each(function () {
$(this).replaceWith($(this).html());
});
}
if ($(this).val() !== searchTermOld) {
$(selector + ' span.match').each(function () {
$(this).replaceWith($(this).html());
});
searchIndex = -1;
$('.searchNext').attr("disabled", "disabled");
$('.searchPrev').attr("disabled", "disabled");
}
});
//Search Click method
$('.search').on('click', function () {
if (searchIndex == -1) {
var searchTerm = $('.searchbox').val();
if (searchTerm == '') {
PG_alert("Please Insert Text.")
return;
}
if (searchTerm == 'b'||searchTerm == 'br'||searchTerm == 'r') {
return;
}
setTimeout(function(){
searchAndHighlight(searchTerm);
},300);
} else
{
//naveen
setTimeout(function(){
searchNext();
},300);
}
if ($('.match').length > 1) {
$('.searchNext').removeAttr("disabled");
$('.searchPrev').removeAttr("disabled");
}
});
$('.searchNext').on('click', searchNext);
});
/*
Seacrh and highlight text method.
*/
function searchAndHighlight(searchTerm) {
if (searchTerm) {
var searchTermRegEx, matches;
var selector = "#fullContainer .RLTRightDiv";
$(selector + ' span.match').each(function () {
$(this).replaceWith($(this).html());
});
try {
searchTermRegEx = new RegExp('(' + searchTerm + ')', "ig");
} catch (e) {
return false;
}
$('.highlighted').removeClass('highlighted');
matches = $(selector).text().match(searchTermRegEx);
if (matches !== null && matches.length > 0) {
var txt = $(selector).html().replace(searchTermRegEx, '<span class="match">$1</span>');
$(selector).html(txt);
searchIndex++;
$('.match:first').addClass('highlighted');
$('#realTimeContents').animate({
scrollTop: $('.match').eq(searchIndex).get(0).offsetTop
});
return true;
} else {
console.log("yes===========")
searchIndex = -1;
}
return false;
}
return false;
}
function searchNext() {
var searchTerm = $('.searchbox').val();
if (searchTerm == '') {
PG_alert("Please Insert Text.")
return;
}
if (searchTerm == 'b'||searchTerm == 'r'||searchTerm == 'br') {
// PG_alert("Please .")
return;
}
if(searchIndex!=-1){
searchIndex++;
if (searchIndex >= $('.match').length) {
//naveen end
searchIndex = -1;
}
$('.highlighted').removeClass('highlighted');
$('.match').eq(searchIndex).addClass('highlighted');
$('#realTimeContents').animate({
scrollTop: $('.match').eq(searchIndex).get(0).offsetTop
});
}
}
in the html i have this call to a java script function:
<span class="lotusBtn lotusBtnAction">
<a dojoType="quickr.widgets.menu.placeActionsMenu" linkText="##[PLACE.ACTIONS.PLACE_ACTIONS]##"></a>
</span>
this java script file looks as follows:
dojo.provide("quickr.widgets.menu.placeActionsMenu");
dojo.require("quickr.widgets.menu.baseMenu");
dojo.require("quickr.widgets.modal.list");
dojo.require("quickr.widgets.misc.connectors");
dojo.declare("quickr.widgets.menu._placeActionsMenu",
[quickr.widgets.menu.baseMenu],
{
linkText: "",
// Assumes that the page must reload in order to go between a place and a room
// TODO: Replace this with an event based system
isRoom: q_GeneralUtils.isRoom(),
postMixInProperties: function() {
this.inherited('postMixInProperties', arguments);
},
postCreate: function() {
// make dropdown menu
var label = (this.isRoom ? "PLACE.ACTIONS.ROOM_ACTIONS": "PLACE.ACTIONS.PLACE_ACTIONS");
this.createDropDownMenuOnButton(this.domNode, label, true);
this._populate();
if(dojo.isIE < 8) {
dojo.addOnLoad(function() {
if(document.body.dir == 'rtl') {
var container = dojo.query('#pagePlaceBar .lotusBtnContainer');
var actionsNode = container.query('.lotusBtnAction');
actionsNode.removeClass('lotusLeft');
actionsNode.addClass('lotusRight');
container.addContent(actionsNode[0], "last");
}
});
}
},
_item: function(label, action, bDisabled) {
return {label: q_LocaleUtils.getStringResource(label), action: action, disabled: bDisabled};
},
_addItem: function(label, action) {
this.addItem(q_LocaleUtils.getStringResource(label), action);
},
_addItemDisabled: function(label) {
this.addItemDisabled(q_LocaleUtils.getStringResource(label));
},
_createFromForm: function(formUnid, defFolder) {
if (!defFolder || defFolder == "") {
defFolder = this._getLibraryOrRoomIndex();
}
// TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
var oEvt = new quickr.widgets.misc.eventlink(
{
event: this.ACTION.PAGE.CREATE,
args: { folderUnid: defFolder, formUnid: formUnid }
}
);
window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
oEvt.destroyRecursive();
},
_populate: function() {
if (q_BaseLoader.user.baseAccess > window.q_GeneralUtils.access.level.reader) {
var aForms = q_BaseLoader.defaultForms;
var createList = [];
var aForms = this._getFormsList(true);
for (var ii = 0; ii < aForms.length; ii++) {
var oFrm = aForms[ii];
if (this._isPredefinedForm(oFrm, "CustomLibrary"))
{
if (true == q_BaseLoader.ecm.enabled) createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_WIDGET", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createLibraryConnectorPage"), undefined),false));
}
else
if (this._isPredefinedForm(oFrm, "SingleUpload")) {
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_UPLOAD", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createUpload"), undefined),false));
}
else
if (this._isPredefinedForm(oFrm, "ImportedFile")) {
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_IMPORTED_PAGE", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createImportedPage"), undefined), false));
}
else
if (this._isPredefinedForm(oFrm, "List")) {
if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC(null, false) == null) {
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_LIST", null, true));
} else {
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_LIST", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createListFolder"), false), false));
}
}
else
if (this._isPredefinedForm(oFrm, "HTMLPage")) {
}
else
{
createList.push(this._item(oFrm.name, dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createFromForm", oFrm.unid), undefined),false));
}
}
//Comment by haoxiangyu on10/14/2011. for lineitem "Editor can not create folder"
//Originally, blow code makes editor can not create folder in room, but can do it in place
/*
if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC(null, false) == null) {
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", null, true));
} else {
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createFolder"), false)));
}*/
if (window.q_FolderUtils.canCreateFolder() ){
if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC(null, false) == null) {
createList.push(new dijit.MenuSeparator());
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", null, true));
} else {
createList.push(new dijit.MenuSeparator());
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", dojo.hitch(this, "_getDefaultCreateFolder", dojo.hitch(this, "_createFolder"), false)));
}
}else{
createList.push(new dijit.MenuSeparator());
createList.push(this._item("PLACE.PLACE_ACTIONS.NEW_FOLDER", null, true));
}
//if no folders, add a disabled "New" item...
if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager && window.q_FolderUtils.getFirstFolderInTOC() == null) {
this._addItemDisabled("PLACE.PLACE_ACTIONS.NEW_PAGE");
} else {
var submenu = this.addSubmenu(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.NEW_PAGE"), createList);
}
}
if (q_BaseLoader.user.baseAccess > window.q_GeneralUtils.access.level.reader && q_BaseLoader.user.canManageTOC == true) {
//this._addItemDisabled("PLACE.PLACE_ACTIONS.NEW_FORM"); // would use listfolder.htm
if ((q_BaseLoader.user.canManagePlace) && (q_BaseLoader.environment.createRoom) && (!q_BaseLoader.environment.isOffline)) {
this._addItem("PLACE.PLACE_ACTIONS.NEW_ROOM", dojo.hitch(this, "_createRoom"));
}
}
this.addSeparator();
//if(!q_BaseLoader.sametime.enabled85 && q_BaseLoader.sametime.serverLocation != '')
// this._addItem("PLACE.PLACE_ACTIONS.CHAT_WITH_MEMBERS", dojo.hitch(this, "_chatwithMembers"));
if (q_BaseLoader.place.show.sitemap) {
this._addItem("PLACE.PLACE_ACTIONS.SITE_MAP", dojo.hitch(this, "_goToSiteMap"));
}
if (q_BaseLoader.place.show.placeoffline == true && (this.getRoomName().toLowerCase() =="main.nsf") && (this.baseContext.user.DN != "Anonymous")) {
if (q_BaseLoader.offline.enabled && (dojo.isIE || dojo.isFF)) {
this._addItem("PLACE.PLACE_ACTIONS.OFFLINE", dojo.hitch(this, "_offline"));
}
else if (q_BaseLoader.offline.enabled == false) {
this._addItemDisabled("PLACE.PLACE_ACTIONS.OFFLINE");
}
}
if (q_BaseLoader.place.show.whatsNew) {
this._addItem("WHATS_NEW.TITLE", dojo.hitch(this, "_whatsNew"));
}
var showPrefs = window.connectors.showPreferences();
var showAddToConnectorsUI = window.connectors.showAddToConnectors();
if (showPrefs || (showAddToConnectorsUI == true )) //AVAILABLE))
{
this.addSeparator();
}
if (showPrefs) this._addItem(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.PREFERENCES").replace("{0}", window.q_BaseLoader.place.title), dojo.hitch(this, "_showPreferences"));
if (showAddToConnectorsUI== 1) this._addItem(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.ADD_TO_CONNECTORS").replace("{0}", window.q_BaseLoader.place.title), dojo.hitch(this, "_addToConnectors"));
this.publishEvent(this.ACTION.MENU.POPCOM.PLACE_ACTIONS, this._menu);
},
_publishEvent: function(e, a) {
if (typeof a == "undefined") a = new Object();
/* No need to put it in the url
var oEvt = new quickr.widgets.misc.eventlink(
{
event: e,
args: a
}
);
window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
oEvt.destroyRecursive();
*/
//just publish the event directly. No neeed to put it in the url
this.publishEvent(e, a);
},
_getFolderUnid: function()
{
var _LIBRARYFOLDER = 'CD0EF97D625305B90525670800167213';
var _ROOMINDEX = 'A7986FD2A9CD47090525670800167225';
return this.isRoom ? _ROOMINDEX : _LIBRARYFOLDER;
},
_getLibraryOrRoomIndex: function() {
var _PLACEINDEX = 'CE6A3D6B1F546C9405256708001671FF';
var _ROOMINDEX = 'A7986FD2A9CD47090525670800167225';
return this.isRoom ? _ROOMINDEX : _PLACEINDEX;
},
_chatwithMembers: function() {
openPeopleOnline();
},
_getDefaultCreateFolder: function(callback, bAllowIndex) {
if (typeof callback == "undefined") callback = null;
// SPR: #ESEO89JKU9
var unid = window.q_GeneralUtils.getUnidFromUrl();
if (unid) {
var folder = window.q_BaseLoader.allViews[unid];
if (typeof folder == "undefined") {
var type = window.q_GeneralUtils.getParameterFromUrl('type');
if (type == "0") {
var document_xml = "";
var document_url = window.q_RestUtils.getURI("document",unid) + "/feed?includePropertySheets=true&includeAllFields=true";
window.q_AjaxUtils.get ( {
sync: true,
url: document_url,
//I found out that the response is NOT declared as XML.
handleAs: "text",
timeout: 5000,
load: function(response, ioArgs){
document_xml = response;
},
// The ERROR function will be called in an error case.
error: function(response, ioArgs){
}
});
if(document_xml != null && document_xml != "") {
var document_xmldoc = window.q_XmlUtils.getXmlDocFromString(document_xml);
var document_FolderUNID = window.q_XmlUtils.getDocSnxValue(document_xmldoc, "h_FolderUNID");
if (document_FolderUNID) {
folder = window.q_BaseLoader.allViews[document_FolderUNID];
}
}
if (typeof folder == "undefined") {
return window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
}
} else {
return window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
}
}
// filter out Index, Forums, Calendar, Tasks, Customize and Trash in TOC
// also filter out Lists
if ((folder.systemName && (folder.systemName == "h_Index"
|| folder.systemName == "h_49B9AB68350FB355482576890021FE8D"
|| folder.systemName == "h_Calendar"
|| folder.systemName == "h_TaskList"
|| folder.systemName == "h_Tailor"
|| folder.systemName == "h_TrashList")) ||
(folder.folderSubStyle && (folder.folderSubStyle == "h_List"))) {
return window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
}
if (folder && folder.proxyUnid && folder.proxyUnid.length > 0) {
unid = folder.proxyUnid;
if (callback && typeof callback == "function") {
callback(unid);
}
return unid;
}
} else {
window.q_FolderUtils.getFirstFolderInTOC(callback, bAllowIndex);
}
},
_allowPageNav: function() {
return q_DocUtils.state.allowPageNav();
},
_createFolder: function(defFolder) {
if (!defFolder || defFolder == "") {
if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager) {//if not a manager need to alert the user they can't do this
window.q_GeneralUtils.qkrWarning(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.NO_FOLDERS"));
return;
}
defFolder = "toc";
}
if (this._allowPageNav()) {
this.publishEvent(this.ACTION.FOLDER.CREATE, {folderUnid: defFolder});
}
},
_createRoom: function() {
if (this._allowPageNav()) {
this.publishEvent(this.ACTION.ROOM.CREATE, {});
}
},
_createImportedPage: function(defFolder) {
if (!defFolder || defFolder == "") {
defFolder = this._getLibraryOrRoomIndex();
}
if (this._allowPageNav()) {
this.publishEvent(
this.ACTION.MODALPAGE.CREATE,
{
folderUnid: defFolder,
modal: true,
formUnid: q_BaseLoader.defaultForms["ImportedFile"].unid,
createParms: {
xsl: "importedPage_create.xsl",
formName: "CreateModalPage",
title: "FOLDER.NEW_MENU.IMPORTED_PAGE"
}
}
);
}
},
_createPage: function(defFolder) {
if (!defFolder || defFolder == "") {
defFolder = this._getLibraryOrRoomIndex();
}
// TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
var oEvt = new quickr.widgets.misc.eventlink(
{
event: this.ACTION.PAGE.CREATE,
args: {folderUnid: defFolder, formUnid: q_BaseLoader.defaultForms["BasicPage"].unid}
}
);
window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
oEvt.destroyRecursive();
},
_createLinkPage: function(defFolder) {
if (!defFolder || defFolder == "") {
defFolder = this._getLibraryOrRoomIndex();
}
// TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
var oEvt = new quickr.widgets.misc.eventlink(
{
event: this.ACTION.PAGE.CREATE,
args: { folderUnid: defFolder, formUnid: q_BaseLoader.defaultForms["URLLinkPage"].unid }
}
);
window.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
oEvt.destroyRecursive();
},
_createUpload: function(defFolder) {
// TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
if (!defFolder || defFolder == "") {
defFolder = this._getLibraryOrRoomIndex();
}
if (this._allowPageNav()) {
this.publishEvent(this.ACTION.UPLOAD.CREATE,
{folderUnid: defFolder, modal: true, formUnid: q_BaseLoader.defaultForms["SingleUpload"].unid });
}
},
_createLibraryConnectorPage: function(defFolder) {
// TO DO: CHANGE THIS WHEN THERE IS A FOLDER PICKER!
if (!defFolder || defFolder == "") {
defFolder = this._getLibraryOrRoomIndex();
}
if (this._allowPageNav()) {
this.publishEvent(this.ACTION.CUSTOMLIBRARY.CREATE,
{ folderUnid: defFolder, modal: true, unid: q_BaseLoader.defaultForms["CustomLibrary"].unid });
}
},
_addToConnectors: function() {
window.location.href = window.connectors.getAddPlaceURL();
},
_showPreferences: function() {
window.connectors.showPreferencesDialog("");
},
_goToCreatePage: function() {
q_GeneralUtils.goToCreatePage();
},
_createListFolder: function (defFolder) {
if (this._allowPageNav()) {
if (!defFolder || defFolder == "") {
if (q_BaseLoader.user.baseAccess < window.q_GeneralUtils.access.level.manager) {//if not a manager need to alert the user they can't do this
window.q_GeneralUtils.qkrWarning(q_LocaleUtils.getStringResource("PLACE.PLACE_ACTIONS.NO_FOLDERS"));
return;
}
defFolder = "toc";
}
this.publishEvent(this.ACTION.LIST.CREATE, {folderUnid: defFolder});
}
},
_whatsNew: function () {
var oEvt = new quickr.widgets.misc.eventlink(
{
event: this.ACTION.PAGE.OPEN,
args: {systemName: "h_WhatsNew", period: "day" }
}
);
document.location.href = oEvt.getEventLinkFromProperties(oEvt.getLinkArguments());
oEvt.destroyRecursive();
},
_offline: function() {
this.publishEvent(
this.ACTION.DIALOG.OPEN,
{
fullScreen: true,
title: 'PLACE.PLACE_ACTIONS.OFFLINE_TITLE',
href: this.getRootUrl() + this.getBaseUrl() + '/$defaultview/A22C4328A85E9873052568B0005C0C98/?OpenDocument'
}
);
},
_goToSiteMap: function () {
var windowWidth=275;
var windowHeight=300;
window.currentRoom = { roomNsf: window.q_GeneralUtils.getRoomNSF() };
var remoteUrl = window.q_GeneralUtils.getPlaceUrl() + "/" + "Main.nsf" + "/?OpenDatabase&Form=h_SiteMapUI&NoWebCaching";
var remoteWindow = window.open( remoteUrl, "Remote", "resizable=yes,width=" + windowWidth + ",height=" + windowHeight + ",top=20,left=20,toolbar=no,scrollbars=yes,menubar=no,status=no");
if (remoteWindow != null) {
remoteWindow.focus();
}
}
});
dojo.declare("quickr.widgets.menu.placeActionsMenu",
[quickr.widgets.menu._placeActionsMenu],
{
}
);
Where would i change the width of this button?
Width is changed using CSS.
You can do it inline like...
<span class="lotusBtn lotusBtnAction" style="width:300px">
or in a CSS file like..
.lotusBtn{width:300px}