Alright, I've tried both methods, my code looks like this:
left_menu.php
Code:
<ul id="menuList">
<li><img src="images/bullet1.gif" class="imgMiddle"></img> <span class="clickable midContent" id="home.php"><?php echo $ll["home"]; ?></span></li>
<li><img src="images/bullet1.gif" class="imgMiddle"></img> <span class="clickable midContent" id="register.php"><?php echo $ll["signUp"]; ?></span></li>
<li><img src="images/bullet1.gif" class="imgMiddle"></img> <span class="clickable midContent" id="download.php"><?php echo $ll["download"]; ?></span></li>
<li><img src="images/bullet1.gif" class="imgMiddle"></img> <span class="clickable midContent" id="rankings.php"><?php echo $ll["rankings"]; ?></span></li>
<li><img src="images/bullet1.gif" class="imgMiddle"></img> <span class="clickable midContent" id="contact.php"><?php echo $ll["contactUs"]; ?></span></li>
</ul>
fakeLinks plugin:
Code:
(function($){
$.fn.fakeLinks = function(options,callback){
var defaults = {
trgt: 'div#midContent',
auth: ''
}
if (options) { var options = $.extend(defaults, options); }
return this.each(function() {
var ax = 0;
$(this).unbind().click(function() {
ax++
if (ax == 1) {
var file = $(this).attr('id');
$(options.trgt).preloader(function() {
$(this).load('./include/' + file, { auth: options.auth }, function() {
if ($(this).height() > 300) {
$('#leftRanks').fadeIn();
} else {
$('#leftRanks').hide();
}
ax = 0;
});
});
}
});
if ($.isFunction(callback)){
//callback.call(element,options.seconds);
callback.call(element);
}
});
}})(jQuery);
register.php
Code:
//Submit block
var waitSubmit = 0;
var el = $('#submitButtonInfo');
if (el.timer) {
clearInterval(el.timer); //Never clears it because it seems like at this point el.timer is never defined, even tho the interval is running...
}
el.wait({ seconds: <?php echo $cfg['submitSecs']; ?>, left: '(', right: ')' }, function(){
waitSubmit = 1;
$(this).html('');
submitButton();
});
wait plugin:
Code:
(function($){
$.fn.wait = function(options,callback){
var element = this;
var defaults = {
seconds: 60,
output: '',
left: '',
right: ''
}
if (options) { var options = $.extend(defaults, options); }
return this.each(function() {
var count = 0;
if (options.output != 'hidden') {
element.html(options.left + options.seconds + options.right);
}
function timer() {
++count
alert(element.timer); //This shows an int e.g: 215 and when clicked twice on register link, shows 2 pop ups, 215 and let's say 513.
if (options.output != 'hidden') {
var rem = options.seconds-count;
var secHtml = options.left + rem + options.right;
element.html(secHtml);
}
if (count == options.seconds) {
clearInterval(element.timer);
if ($.isFunction(callback)){
callback.call(element);
}
}
}
element.timer = setInterval(timer, 1000);
});
}})(jQuery);
It doesn't work, obviously I'm doing something wrong. The old interval is still there.
Bookmarks