View Full Version : JQuery Help

3 Jul 2010, 4:20 PM
Can someone please convert this code from jquery to extjs thanks

<script type="text/javascript">
var idleTime = 2000; // number of miliseconds until the user is considered idle
var initialSessionTimeoutMessage = 'Your session will expire in <span id="sessionTimeoutCountdown"></span>&nbsp;seconds.<br/><br />Click on <b>OK</b> to continue your session.';
var sessionTimeoutCountdownId = 'sessionTimeoutCountdown';
var redirectAfter = 10; // number of seconds to wait before redirecting the user
var redirectTo = 'http://pure-essence.net/2010/02/14/jquery-session-timeout-countdown/'; // URL to relocate the user to once they have timed out
var keepAliveURL = 'keepAlive.php'; // URL to call to keep the session alive
var expiredMessage = 'Your session has expired. You are being logged out for security reasons.'; // message to show user when the countdown reaches 0
var running = false; // var to check if the countdown is running
var timer; // reference to the setInterval timer so it can be stopped
$(document).ready(function() {
// create the warning window and set autoOpen to false
var sessionTimeoutWarningDialog = $("#sessionTimeoutWarning");
title: 'Session Expiration Warning',
autoOpen: false, // set this to false so we can manually open it
closeOnEscape: false,
draggable: false,
width: 460,
minHeight: 50,
modal: true,
beforeclose: function() { // bind to beforeclose so if the user clicks on the "X" or escape to close the dialog, it will work too
// stop the timer

// stop countdown
running = false;

// ajax call to keep the server-side session alive
url: keepAliveURL,
async: false
buttons: {
OK: function() {
// close dialog
resizable: false,
open: function() {
// scrollbar fix for IE
close: function() {
// reset overflow
}); // end of dialog

// start the idle timer

// bind to idleTimer's idle.idleTimer event
$(document).bind("idle.idleTimer", function(){
// if the user is idle and a countdown isn't already running
if($.data(document,'idleTimer') === 'idle' && !running){
var counter = redirectAfter;
running = true;

// intialisze timer
// open dialog

// create a timer that runs every second
timer = setInterval(function(){
counter -= 1;

// if the counter is 0, redirect the user
if(counter === 0) {
window.location = redirectTo;
} else {
}, 1000);


3 Jul 2010, 5:48 PM
Can someone please convert this code from jquery to extjs thanks

You're joking right? First, your code is unreadable. If you want free help, then make it easy to read. Is this the first time you posted code? Maybe think about using the code tags.

Second, this is ExtJS help forum so we (shouldn't speak for everyone but oh well) will help you figure out what your ExtJS code should be to accomplish something or how to fix your ExtJS code.