Need help debugging greasemonkey script - javascript

I'm quite new here, and just as new with GM scripting. With the help of some of the members here, Brock and others, I'm making progress.
I currently have the problem of debugging Greasemonkey scripts, but for some reason I'm not getting the hang of it. My first problem, to debug using console.log for firebug.
Sometimes I find the logs, most of the times I cant find anything there, guess I'm using it wrongly. Then trying to use alert in order to see variable values... same story.
I'm currently trying to get a script going to handle some auctions on the site Trada.net with the great help of Brock Adams, we got more than halfway there, but I'm still hitting my head on JS scripting... quiet a new experience, if u take I was used to turbo pascal 15 + years ago.:)
Well, currently this is what I got together on the script:
// ==UserScript==
// #name bid up to test3
// #include http://www.trada.net/*
// #require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
// ==/UserScript==
//--- Create a cell for transmitting the date from page scope to GM scope.
$('body'). prepend ('<div id="LatestJSON_Data"></div>');
var J_DataCell = $('#LatestJSON_Data');
//--- Eavesdrop on the page's AJAX calls and paste the data into our special div.
unsafeWindow.$('body').ajaxSuccess (
function (event, requestData)
{
J_DataCell.text (requestData.responseText);
}
);
// **bid function and var's
// **var interval = 50;
// **var bidClickTimer = setInterval (function() {BidClick (); }, interval);
// **var numBidClicks = 0;
// **var A1reset_go = false;
// **function BidClick1 ()
// **{var //bidBtn1=document.getElementById("ctl00_mainContentPlaceholder_AirtimeAuctionItem1_btn_BidButton");
//** numBidClicks++;
//** if (numBidClicks > 10)
//** { Alert("check10");
//** clearInterval (bidClickTimer);
//** bidClickTimer = "";
//** }
//** else
//** { Alert("check11");
//** bidBtn1.click (1);
//** }
//**};
//**end bid function
//--- Listen for changes to the special div and parse the data.
J_DataCell.bind ('DOMSubtreeModified', ParseJSON_Data);
function ParseJSON_Data ()
{
//**my var
//**var auction_type ;A1_upto;A1_start;A1_current;A1_reset;
//**end my var
//--- Get the latest data from the special cell and parse it.
var myJson = J_DataCell.text ();
var jsonObj = $.parseJSON (myJson);
//--- The JSON should return a 2-D array, named "d".
var BidDataArray = jsonObj.d;
//--- Loop over each row in the array.
$.each (
BidDataArray,
function (rowIndex, rowValue) {
//--- Print the 7th column.
console.log ('Row: ' + (parseInt (rowIndex) + 1) + ' Column: 7 Value: ' + rowValue[6]);
//** my part
//** Alert("check1");
//** auction_type=parseInt (rowValue[4]);
//** if (auction_type== 1)
//**
//** {Alert("check2");
//** A1_upto=parseInt (rowValue[12]);
//** Alert("check3");
//** A1_current=parseInt (rowValue[8]);
//** Alert("check4");
//** A1_reset=rowValue[16];
//** if (A1_reset != "null")
//** {Alert("check5");
//** A1reset_go='true';
//** };
//** if (A1_reset == "null") and (A1reset_go=='true')
//** {Alert("check6");
//** A1reset_go=false;
//** Alert("check7");
//** A1_start=rowValue[8];
//** };
//** if ((A1_current - A1_start) <= (A1_upto - 10))
//** {Alert("check8");
//** BidClick1 ();
//** };
//** };
//** end my part
};
);
}
//--- Format our special cell with CSS. Add "visibility: hidden;" or "display: none;", if desired.
GM_addStyle ( (<><![CDATA[
#LatestJSON_Data
{
background: gold;
border: 3px ridge #0000DD;
font-size: 10px;
margin: 0 2em;
padding: 1ex 1em;
width: 94%;
opacity: 0.8;
overflow: hidden;
z-index: 666;
position: absolute;
color: black;
}
]]></>).toString () );
Basically, so far, it did create a cell in which it displays all the auction data which was put into an array BidDataArray.
I want to use the data in the array, which is updated every second, to get certain pieces of data,and then decide whether or not to click on the bid button.
For the first auction I got to a stand still. The timer auctions I got it to work to click every few seconds.
On the first auction I basically want to:
Check which auction it is,
Find out if it is the first bid for auction,
Get the bid up to amount,
Do calculations to start clicking the last 10 clicks of the auction.
Reset the starting amount.
Sounds quite simple, but without a debugger and very little knowledge about Js and GM, it is keeping me quite busy. I've tried putting my Var's in console log, but cant track them. might have declared them wrongly, or used them wrongly... but I cant see the mistake, and I don't have an debugger to test them.
Will a java debugger work? but it is not linked to the site...
Also, the moment I added my parts into Brock's code, it didn't display the cell with the info any more... so somewhere I broke his code I cant find the problem... Before i added anything to his code, it worked well, then i added my parts, it didnt work any more, so i took it out by using "//". so the script should skip it, but his parts dont work anymore. I tried adding "alerts", but cant seem to find the problem. all my parts is marked with "//**" and should be inactive at the moment.
Any help will be appreciated. Thanks

Well, I didnt get much response from here, but I've tried...:( I managed to get it debugged 90%, but here is my answer sofar...will update it after i've found a way aroud the minor glitches..:
// ==UserScript==
// #name let's try 3.42
// #include http://www.trada.net/*
// #require http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js
// ==/UserScript==
var auctiontyp = 0;var aupto = 0;var A1_start = 0;var A1_current = 0;var A1_rest= 'x';
// **bid function and var's
var interval = 50;
var bidClickTimer = setInterval (function() {BidClick1 (); }, interval);
var numBidClicks = 0;
var A1reset_go = false;
function BidClick1 ()
{var bidBtn1=document.getElementById("ctl00_mainContentPlaceholder_AirtimeAuctionItem1_btn_BidButton");
numBidClicks++;
if (numBidClicks > 3)
{ alert("check10");
clearInterval (bidClickTimer);
bidClickTimer = "";
}
else
{ alert('check11');
//bidBtn1.click (1);
}
};
// end bid function
var myJson = '{"d":[["","","y","ZAR","1","49517","6458, 8270, 8270, 8270, 7635",null,"1.40","6458","0:13:30","","12","","C","30",null],["y","-00:00","y","ZAR","2","49593","6458, 6458, 6458, 6458, 6458",null,"2.92","6458","0:13:37","","12","","L","12","Ve4mYdrvkkQMKxBH1\/1VMtDTCDQBRspg5jB8jjY08zg="],["","","y","ZAR","3","49058","7456, 9216, 6458, 5153, 7456",null,"194.40","7456","0:00:31","","1100","","T",null,null],["","","y","ZAR","4","49597","2935, 6554",null,"1.22","2935","0:01:16","","12","","T",null,null],["","","y","ZAR","5","49590","4440, 0518, 5343, 2625, 4848",null,"0.95","4440","0:15:58","","5","","L",null,null],["","","y","ZAR","6","49591","4848, 4440, 4440, 0518, 2625",null,"1.81","4848","0:16:05","","12","","L",null,null],["","","y","ZAR","7","49595","6458",null,"5.55","6458","0:04:13","","55","","T",null,null],["","","y","ZAR","8","49596","",null,"2.90","NONE","0:04:35","","29","","T",null,null],["","","y","ZAR","9","49496","6458, 2427, 2427, 7863, 5845",null,"2.56","6458","0:06:07","","10","","B",null,null],["","","y","ZAR","10","49524","6458, 2427, 7863, 7863, 5845",null,"1.67","6458","0:06:00","","5","","B",null,null],["","","y","ZAR","11","49539","6458, 2427, 7863, 7863, 0764",null,"2.02","6458","0:04:25","","10","","B",null,null]]}'
var jsonObj = $.parseJSON (myJson);
//--- The JSON should return a 2-D array, named "d".
var arrayOfAuctions = jsonObj.d;
//--- Loop over each row in the array.
$.each (
arrayOfAuctions,
function (rowIndex, singleAuctionData) {
//--- Print the 7th column.
console.log ('Row: ' + (parseInt (rowIndex) + 1) + ' Column: 7 Value: ' + singleAuctionData[6]);
alert('test3.41');
auctiontyp=parseInt (singleAuctionData[4]);
if (auctiontyp== 1)
{
aupto=parseInt (singleAuctionData[15]);alert('check2.6');
alert('check3 '+(singleAuctionData[8]));
A1_current=parseFloat (singleAuctionData[8]);
alert('check4 '+(singleAuctionData[16]));
A1_rest=singleAuctionData[16];
alert(A1_rest);
if (A1_rest != 'null')
{alert('check5');
A1reset_go=true;
};
alert('check5.1');
alert(A1reset_go);
if (A1_rest == 'null') and (A1reset_go==true)
{alert('check6');
A1reset_go=false;
alert('check7');
A1_start=singleAuctionData[8];
};
alert('check7.3');
alert((A1_current) );
alert(( A1_start));
alert((aupto) );
if (((A1_current - A1_start)*100) < (aupto - 10))
{alert('check8');
//BidClick1 ();
};
};
}
);
My current problems on this script:
1.The "BidClick1" function runs in the beginning of the script without being called, i only call it close to the end, but then it is not running..
2.This part:
A1_rest=singleAuctionData[16];
alert(A1_rest);
if (A1_rest != 'null')
{alert('check5');
A1reset_go=true;
};
alert('check5.1');
alert(A1reset_go);
if (A1_rest == 'null') and (A1reset_go==true)
{alert('check6');
A1reset_go=false;
alert('check7');
A1_start=singleAuctionData[8];
};
is not executing correctly., for this array,"arrayOfAuctions", on the first segmant, that im doing all the tests on, "A1_rest" should be = to "null", but it's not, thus it executes:"
if (A1_rest != 'null')
{alert('check5');
A1reset_go=true;
};"
and also, it doesnt execute this statement :
"
if (A1_rest == 'null') and (A1reset_go==true)
{alert('check6');
A1reset_go=false;
correctly, it should only execute if A1_rest="null" AND A1_reset_go is true. It executes no matter which one is true,and if i put it as:if ((A1_rest == 'null') and (A1reset_go==true)) ,it doesnt run the script at all.
If any1 got an complete answer, i will mark it as such.
Thanks.
alert('check7');
A1_start=singleAuctionData[8];
};" executes always

Related

where is showing conversation value

THis topic is abouton google add word (conversation)
Below is my conversation setup screenshot
http://nimb.ws/alycTQ
Below is my code that was putted on body tag
<script type="text/javascript">
/* <![CDATA[ */
function GoogleFormTracker()
{
goog_snippet_vars = function() {
var w = window;
w.google_conversion_id = 949468534;
w.google_conversion_label = "9xLwCK7rm3IQ9vrexAM";
w.google_conversion_value = 1;
w.google_remarketing_only = false;
}
// DO NOT CHANGE THE CODE BELOW.
goog_report_conversion = function(url) {
goog_snippet_vars();
window.google_conversion_format = "3";
var opt = new Object();
opt.onload_callback = function() {
if (typeof(url) != 'undefined') {
window.location = url;
}
}
var conv_handler = window['google_trackConversion'];
if (typeof(conv_handler) == 'function') {
conv_handler(opt);
}
}
}
/* ]]> */
</script>
<script type="text/javascript"
src="//www.googleadservices.com/pagead/conversion_async.js">
</script>
GoogleFormTracker() fired on footer when site is load.
And also i verified my code on tag manager chrome addons(No error showing there).
but i don't know where to showing me how many time this function is fired ?
let me know any mistake in my code or where is showing tracking value in add word (with screenshot and step by step).
Thanks
In google add word account follow below step
Tool->Attribution
In Attribution available you conversation value.
I hope u need like above
"but i don't know where to showing me how many time this function is fired". Not entirely sure I understand, but perhaps you just need to put a console.log('marco'); inside the function and view the browser console (ctrl + shift + i) to see how many times the function is called?

Greasemonkey js going to subpage, again, again and wait

sorry for bad english and maybe newby question.
I want to write script that makes something automatic (in web game), everything I need to is go to subpage, then next one, and other. Then script needs to wait specific time and repeat.
I'm using global variable (boolean) and if its true I'm trying to do something like that:
unsafeWindow.location.href = linktodo + linkequipeq + accesKey;
unsafeWindow.location.href = linktodo + linkjednoraz + accesKey;
Script skips first going to page. Using setTimeout doesn't helped. I'm using:
// #run-at document-end
Still not working, I tried to use addEventListener wit parametr 'load' but nothing (I think I need to "clean" eventlistener by closing the window? - tried to use removeEventListener after first function/window redirect is done, fail).
Is it possible to do this without opening and closing new tabs/popups?
Will script like this work in inactive tab?
Can somebody post some example of doing it or tutorial I'll learn it alone?
P.s
for some explanations, those subpages will fill on some equipment, then get some cash and go quest.
linktodo is hostname, linkequipeq is pathname, and accesKey is some secuirty builded in webpage to not doing something after reload (I get acces to it via GM using unsafeWindow).
Huh mayby somebody understand me :D
// #include "site"
// #grant GM_addStyle
// #grant GM_getValue
// #grant GM_setValue
// #grant GM_deleteValue
// #grant GM_listValues
// #grant GM_xmlhttpRequest
// #require http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// #require https://gist.github.com/raw/2625891/waitForKeyElements.js
// #run-at document-end
var wypki = 0;
var cash = 0;
var czas = 0;
var autowypki = false;
var linkwypki = '?a=q';
var linksklep = '?a=town=';
var linkequipeq = '?a=equip';
var linkjednoraz = '?a=buyone';
var linkrealm;
var accesKey = unsafeWindow.accessKey;
var numbercash = document.getElementsByClassName('cash')[0].getElementsByClassName('panel');
var mynumbercash = numbercash[0];
var cash1 = (mynumbercash.innerHTML);
cash = cash1.slice(28, cash1.indexOf('PLN'));
cash = parseInt(cash.replace(/\s+/g, ''));
var linktodo = link.slice(0, link.indexOf('?a='));
function doquest() {
'use strict';
unsafeWindow.location.href = linktodo + linkwypki;
setTimeout(function () {
unsafeWindow.getElementById('start')[0].click();
}, 2000);
}
function zlomek() {
'use strict';
if (cash < 20000) {
unsafeWindow.location.href = linktodo + linksklep + accesKey;
}
}
function jednoraz() {
'use strict';
if (autowypki === true && cash > 20000) {
unsafeWindow.location.href = linktodo + linkjednoraz + accesKey;
}
}
function equip() {
'use strict';
unsafeWindow.location.href = linktodo + linkequipeq + accesKey;
}
/* --- Main ----*/
function autoQuest() {
'use strict';
autowypki = true;
equip();
setTimeout(jednoraz(),5000);
}
/* --- Main ----*/
if (a === linkwypki) {
var przyciskwypki = document.getElementsByTagName("form")[0].getElementsByTagName('div')[13];
przyciskwypki.innerHTML = przyciskwypki.innerHTML + '<input class="button" type="button" style="height: 20px; width: 110px;" id="autowypki" value=" Robimy wypki" />';
}
document.getElementById("autowypki").addEventListener("click", autoQuest, false);
Greasemonkey scripts are exactly like normal scripts, they don't run unless the page is loaded
On any page that this script is injected loaded, this script will add a click event listener to the element with ID='autowypki'
when that event is fired, the script will set the page to linktodo + linkequipeq + accesKey in function equip
and that's all this script will ever do
there's nowhere that invokes functions doquest and zlomak, so they're just along for the ride in this script
function jednoraz is set to be called after a timeout of 5 seconds, but by then equip has loaded a new page, so, jednoraz wont actually be called as the page it was on is no longer loaded
however, if the same click event is fired in the page that equip loads, then perhaps jednoraz will be called - and then the page linktodo + linkjednoraz + accesKey will be loaded ... I say perhaps, because I'm not 100% sure what function equip will do if it's effectively setting the page to the current page - i.e. if that causes a page load, then jednoraz wont be called because the timeout will probably never fire as the page has reloaded

Issue with setTimeOut and non-response script in IE8

I am getting an issue with a large amount of processing causing the non-responsive script error in IE8 (and no, I cannot make the users use a better browser).
I then read that it should be possible to split up the tasks and cede control back to the browser in between different parts of the validation. So I decided to make a simple example based on some code I found to figure out where the breaking points are. The real code is doing lots of jquery validationengine processing.
I tried to use jsFiddle but I can't get jsFiddle to run in IE8. Bummer. So, I'll have to share inline here.
When I first load it, it seems to work just fine. I push the button and both functions finish without a problem. However, subsequent pushes causes an unresponsive script error. I've played around with the number of loops in my simulated work function. Much more than 1.25 million loops and it dies with unresponsive script.
Shouldn't separate calls to the onClick start the non-responsive counter anew? What am I missing here?
<html>
<head>
<script>
var progress = null;
var goButton = null;
window.onload = function() {
progress = document.getElementById("progress");
goButton = document.getElementById("goButton");
}
function runLongScript(){
// clear status
progress.value = "";
goButton.disabled=true;
var tasks = [function1, function2];
multistep(tasks,null,function() {goButton.disabled=false;});
}
function function1() {
var result = 0;
var i = 1250000;
for (;i>0; i--) {
result = result + 1;
}
progress.value = progress.value + "f1 end ";
}
function function2() {
var result = 0;
var i = 1250000;
for (;i>0; i--) {
result = result + 1;
}
progress.value = progress.value + "f2 end";
}
function multistep(tasks, args, callback){
var tasksClone = tasks.slice(0); //clone the array
setTimeout(function(){
//execute the next task
var task = tasksClone.shift();
task.apply(null, args || []);
//determine if there's more
if (tasksClone.length > 0){
setTimeout(function () {
multistep(tasksClone, args, callback);
}, 100);
} else {
callback();
}
}, 100);
}
</script>
</head>
<body>
<p><input type="button" id="goButton" onClick="runLongScript();" value="Run Long Script" /></p>
<input type="text" id="progress" />
</body>
</html>
You're never calling clearTimeout() to remove the one currently running when the button has been pressed already. Add an if statement before you start another setTimeout and check to see if one is already running, clear it if it is, and then continue. Here's a link that should help you if you have any questions: https://developer.mozilla.org/en-US/docs/Web/API/window.clearTimeout

Clear Var or Callback in Javascript

Sorry, i am not sure if I am asking the question correctly. When a date is changed by a user the date count down changes on the page. If the date is changed more than once it flashes all date changes. I guess it is storing the previous information somewhere. I have tried clearing the vars.
var deal_yeax = '';
as I would do in php with no luck
$('#deal_end').focusout(function() {
var deal_end = $("#deal_end").val();
var array = deal_end .split('-');
var deal_montx = array[0];
var deal_dax = array[1];
var deal_yeax = array[2];
deal_montx = deal_montx - 1;
$(function(){
ts = new Date(deal_yeax , deal_montx , deal_dax );
$(".h").countdown({
timestamp : ts,
callback : function(days, hours, minutes, seconds){
message_days = (days);
var message_hours = (hours);
$(".message_hours").text(message_hours + " Hours");
var message_minutes = (minutes);
$(".message_minutes").text(message_minutes + " Minutes");
var message_seconds = (seconds);
// Creat the display
if ( message_days < 1 && message_hours < 1 ) { $(".message_seconds").text(message_seconds + " Seconds"); }
else if ( message_days < 1 && message_hours > 1 ) { }
else if ( message_days == 1 ) { $(".message_days").text(message_days + " Day"); }
else { $(".message_days").text(message_days + " Days"); }
if ( message_days < 1 && message_hours < 1 && message_minutes < 1 && seconds < 1 ) {
$(".hide_my_buy_button").fadeOut("fast");
}
}
});
});
});
Everytime you "focusout" from #deal_end, you'll attach a countdown event to .h. Without knowing exactly how countdown(...) works (It'll be good if you provide the source so we can provide more help!), one way to fix the issue maybe to use JQuery's unbind(...) function to remove existing listeners on an event before adding a new one to it.
Here's an example on the issue:
<!-- HTML -->
<div>
<input id="text" />
<button id="clicker" />
</div>
<!-- Javascript -->
$('#text').focusout(function() {
var text = this.value;
// Everytime #text is "focused out", a new event is registered with #clicker.
$('#clicker').click(function() {
console.log('Value: ' + text);
});
});
... and here's how to solve the issue (It's just one of the many ways. This way is probably not the most elegant but anyhow.)
$('#text').focusout(function() {
var text = this.value;
$('#clicker').unbind('click');
// Everytime #text is "focused out", a new event is registered with #clicker.
$('#clicker').click(function() {
console.log('Value: ' + text);
});
});
Bottom line: It seems focusout(...) is adding a new countdown everytime it is triggered. That might be the problem you're having.
Not sure if this helps? Lemme know.
P.S. JSFiddle to go with it: http://jsfiddle.net/PE9eW/
The problem seems to be with .countdown function that you are using in your code to flash the date changes. When you assign a new count down object to $(".h") the plugin or the function probably assign some event handler or interval to it, but it doesn't seem to clear the old ones when it is called again and that is why it flashing all the dates for each countdown. So you will have to do it manually. I am not sure if you are using an external plugin or is it your own function but what you need to do is to clear the existing events or intervals that is assigned to your element when you call the function. I can be more helpful if you tell me which plugin you are using or maybe show the code if it is your own function. (referring to .countdown() )

Javascript: IE Error, Firebug not erring. Where is it?

Again, I am working with code from my predecessor and am at a loss for this one. It appears to be a sampled navigation script. It is receiving an error in IE stating Object doesn't support this property or method. Here is what I have narrowed the error down to.
The function:
/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
*
* #param f onMouseOver function || An object with configuration options
* #param g onMouseOut function || Nothing (use configuration options object)
* #author Brian Cherne <brian#cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};
cfg=$.extend(cfg,g?{over:f,out:g}:f);
var cX,cY,pX,pY;
var track=function(ev){cX=ev.pageX;
cY=ev.pageY;
};
var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);
if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);
ob.hoverIntent_s=1;
return cfg.over.apply(ob,[ev]);
}else{pX=cX;
pY=cY;
ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);
},cfg.interval);
}};
var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);
ob.hoverIntent_s=0;
return cfg.out.apply(ob,[ev]);
};
var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;
while(p&&p!=this){try{p=p.parentNode;
}catch(e){p=this;
}}if(p==this){return false;
}var ev=jQuery.extend({},e);
var ob=this;
if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);
}if(e.type=="mouseover"){pX=ev.pageX;
pY=ev.pageY;
$(ob).bind("mousemove",track);
if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);
},cfg.interval);
}}else{$(ob).unbind("mousemove",track);
if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);
},cfg.timeout);
}}};
return this.mouseover(handleHover).mouseout(handleHover);
};
})(jQuery);
The document.ready line triggering the error:
var config = {
sensitivity: 1, // number = sensitivity threshold (must be 1 or higher)
interval: 50, // number = milliseconds for onMouseOver polling interval
over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
timeout: 200, // number = milliseconds delay before onMouseOut
out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};
$("ul#topnav li .sub").css({'opacity':'0'});
$("ul#topnav li").hoverIntent(config);
I am at a loss as to how to resolve this and finally get this section fixed.
The two functions that are defined within document.ready.
function megaHoverOver(){
$(this).find(".sub").stop().fadeTo('fast', 1).show();
//Calculate width of all ul's
(function($) {
jQuery.fn.calcSubWidth = function() {
rowWidth = 0;
//Calculate row
$(this).find("ul").each(function() {
rowWidth += $(this).width();
});
};
})(jQuery);
if ( $(this).find(".row").length > 0 ) { //If row exists...
var biggestRow = 0;
//Calculate each row
$(this).find(".row").each(function() {
$(this).calcSubWidth();
//Find biggest row
if(rowWidth > biggestRow) {
biggestRow = rowWidth;
}
});
//Set width
$(this).find(".sub").css({'width' :biggestRow});
$(this).find(".row:last").css({'margin':'0'});
} else { //If row does not exist...
$(this).calcSubWidth();
//Set Width
$(this).find(".sub").css({'width' : rowWidth});
}
}
function megaHoverOut(){
$(this).find(".sub").stop().fadeTo('fast', 0, function() {
$(this).hide();
});
}
I'm able to run that code without errors (see http://jsfiddle.net/veHEY/). It looks like the issue might be in the megaHoverOver and megaHoverOut functions that you're passing in through the configuration object. Do you have the code for those functions?
Previously:
The problem is almost certainly
opacity, which is not supported in
IE. Check out this nice quirksmode
article on cross-browser opacity
issues.
Correction: As #patrick rightly points out, and backs up with a source code reference to boot, jQuery is smart enough to automatically deal with IE's own special brands of opacity handling. Whatever the OP's problem is, this is not the answer.

Categories