Ok, I will be honest - my first javascript challenge is a little hard, but has been handed down to me from my uncle. He doesnt know how to do it, and thinks a fresh mind might be able to make sence of it. Fresh meaning fairly new to js... not his wisest move I would say.

I come here instead :)

Here's the deal - I believe that he intends to make a program to execute a function (in his case, a vote) when a timer reaches 1.
The timer is located somewhere in a javascript he has provided me with, and after some scouring, I think I have found the relevent area.

The script passes along the timer text to a webpage in the form of HH:MM:SS - but I need another way of geting that timer data out (to a program or script??).

1. Is there a way to extract the timer data in any way shape or form?

He would be rapt if I could solve his final programming challenge too, but this might be a bit (read: lot) more challenging.

2. What ways could I get that data into a local javascript (or anything else if easier) script to make it execute a function (not sure, but I believe just a url or mouse press) when the timer reaches 1 second. The original script in full and page with the timer will be located on his server and accessable to me through the web, so the script would need to be capable of running locally from me to him. Can that be done??

Please ask and I would be delighted to give you any other info you need.

Here is the part of the script where I believe the final condition for the timer is handled. As I am new to js, let me know if I have butchered anything before or after that is critical to you understanding the timer function.

// JavaScript Document (Part)

 update: function (updateTime) {var id, pollId, i, count, item, amount_element, time_element, element, field, value;if ((typeof updateTime === "undefined" || updateTime === true) && this.serverTimeUpdated === null || new Date - this.serverTimeUpdated > 1000) {++this.serverTime;}this.updateServerTime();if (typeof this.data.pollList !== "undefined") {for (pollId in this.data.pollList.itemList) {item = this.data.pollList.itemList[pollId];if (item.status !== "online" && item.status !== "offline") {continue;}item.updated.push("time");id = "poll_" + pollId;i = 0;count = item.updated.length;if (typeof this.elementList[id] !== "undefined" && count > 0) {for (; i < count; ++i) {field = item.updated[i];if (field === "count_down_time") {if (this.ignoreNextTimeHighlight === pollId) {this.ignoreNextTimeHighlight = false;} else {this.highlight(this.elementList[id].time);}continue;}value = item[field];if (field === "amount") {this.needAdditionalDataUpdate = true;value = this.formatAmount(value);} else if (field === "time") {if (item.status === "offline") {value = "00:00:00";} else {timeRemaining = value - this.serverTime - 1;if (timeRemaining > 0) {if (item.status === "completed") {item.status = "online";this.setPollAsOnline(item);}value = this.formatTime(timeRemaining);} else {value = "00:00:00";if (item.status === "completed") {continue;}}if (typeof this.elementList[id][field] !== "undefined") {element = this.elementList[id][field];var className = this.getTimerColorClass(item.status, timeRemaining);element.className = element.className.replace(/ red| green| dark_gray/, "") + " " + className;}}}

Well firstly, how 'bout you give us a non-minified version of the javascript. I am not about to go wading through that block of crap. And by non-minifid I mean put some damn newlines in there, perhaps some tabs or spaces, some form of indentation. If it was written this way then whoever wrote it needs to be shot.

As what have, Shawn said: Providing us with less lines of codes, will just complicate the whole thing. You must provide us with all the Functions:Classes—Variables: Declared-Values&#8212;Labels:Objects/Values that you used on your stated code.

Compacting your code:

<script type="text/javascript">
<!-- 

// Making us guess on what you have on the lines, will take plenty of our time, solving your problem and might as well drop the whole issue.

// knowing that we offer free service on your solution(s)... 
  

var Mystery = function( serverTimeUpdated ) {
   this.serverTimeUpdated = (( serverTimeUpdated ) ? serverTimeUpdated : null );
   this.serverTime = 0;
};

Mystery.prototype = {
// GUESSING GAME!
   data : { 
      pollList : {
         itemList : {
            online : "online",
            offline : "offline",
            completed : "completed",
            updated : [ ]
         }
      }
   }, updateServerTime : function() {
   alert( "updateServerTime" );
   }, update : function( updateTime ) {
   updateTime = (( updateTime ) ? updateTime : undefined );
var id;
var pollId;
var i;
var item;
var count;
var amount_element;
var time_element;
var element;
var field;
var value;
   (( updateTime || !( updateTime && this.serverTimeUpdated ) || (( new Date - this.serverTimeUpdated ) > 1000 )) ? ++this.serverTime : null );
   this.updateServerTime(); // What could be the statements inside this function?
   if ( this.data.pollList ) { // What could be the ( LABEL/KEY : OBJECT/VALUE )?
      for ( pollId in this.data.pollList.itemList ) {
         item = this.data.pollList.itemList[ pollId ];
         if ( item.status !== "offline" && item.status !== "online" ) {
            continue;
         }
         item.updated.push( "time" );
         id = "poll_" + pollId;
         count = item.updated.length;
         if ( this.element[ id ] && count > 0 ) {
            for ( i = 0; i < count; ++i ) {
               field = item.updated[ i ];
              if ( field === "count_down_timer" ) {                               this.ignoreNextTimeHighlight = (( this.ignoreNextTimeHighlight === pollId ) ? false : pollId );
                 if ( !this.ignoreNextTimeHighlight ) {
                    this.highlight( this.elementList[ id ].time );
                 } continue;
              } value = item[ field ];
                 switch( field ) {
                 case "amount" :
                 this.needAdditionalDataUpdate = true; 
                 value = this.formatAmount( value );
                 break;
                 case "time" : 
                 (( item.status === "offline" ) ? value = "00:00:00" : timeRemaining = ((( value ) - this.serverTime ) - 1 ));
                 (( timeRemaining > 0 && item.status === "complete" ) ? item.status = "online" : (( item.status === "online" ) ? this.formatTime( item ) : value = this.formatTime( timeRemaining ))); 
                 break;
                 default :
                 value = "00:00:00";
                    if ( item.status === "complete" ) {
                       continue;
                    }
                 }
              } if ( this.element[ id ][ field ] ) {
                 element = this.element[ id ][ field ];
                 var className = this.getTimerColorClass( item.status, timeRemaining );
                 element.className = element.className.replace(/ red| green| dark_grey/, "" ) + " " + className;
               }
            }
         }
      }
   }
};

var fun = new Mystery();
window.onload = function() {
 
// BOUNDLESs Call-->
fun.updateServerTime();
   for ( var x in fun.data.pollList.itemList ) {
      alert( x );
   }
};
// -->
</script>

Right, so lets give you the whole script.

I must apologize greatly though, as it looks like a piece of **@#.

I had to run it through a decoder, that is why there is little to no formatting. So, umm please don't shoot me?

My aim is to find a way to use that timer to vote last minute.
I assume I need to run a script on the page after load, but that is a later stage.

It seems that javascript:alert(timeRemaining) gives me the time remaining for other polls on the page - not necessarily the main one I want! (There is a "related polls" section near the bottom of the page) Is there something I can use to specify WHICH timeRemaining I want?

My final script would probably look something like:
(Psuedocode here... dont know the exact wording)
If: timeRemaing on this poll = 1
then: vote (yet to find out the correct command for this - this is stage 2)
loop the If to keep checking

The timer counts down from the time the last person voted, if that's relevent.

Well, heres the script. The stuff you got was down near line 17 (although it's a LONG line).

Thanks again!

Attachments
// JavaScript Document
(function(){var window=this,undefined,_jQuery=window.jQuery,_$=window.$,jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context)},quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,isSimple=/^.[^:#\[\.,]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;this.context=selector;return this}if(typeof selector==="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem&&elem.id!=match[3])return jQuery().find(selector);var ret=jQuery(elem||[]);ret.context=document;ret.selector=selector;return ret}}else return jQuery(context).find(selector)}else if(jQuery.isFunction(selector))return jQuery(document).ready(selector);if(selector.selector&&selector.context){this.selector=selector.selector;this.context=selector.context}return this.setArray(jQuery.isArray(selector)?selector:jQuery.makeArray(selector))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(num){return num===undefined?Array.prototype.slice.call(this):this[num]},pushStack:function(elems,name,selector){var ret=jQuery(elems);ret.prevObject=this;ret.context=this.context;if(name==="find")ret.selector=this.selector+(this.selector?" ":"")+selector;else if(name)ret.selector=this.selector+"."+name+"("+selector+")";return ret},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this},each:function(callback,args){return jQuery.each(this,callback,args)},index:function(elem){return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this)},attr:function(name,value,type){var options=name;if(typeof name==="string")if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name))})},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS")},text:function(text){if(typeof text!=="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this])})});return ret},wrapAll:function(html){if(this[0]){var wrap=jQuery(html,this[0].ownerDocument).clone();if(this[0].parentNode)wrap.insertBefore(this[0]);wrap.map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem}).append(this)}return this},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html)})},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html)})},append:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)this.appendChild(elem)})},prepend:function(){return this.domManip(arguments,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild)})},before:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this)})},after:function(){return this.domManip(arguments,false,function(elem){this.parentNode.insertBefore(elem,this.nextSibling)})},end:function(){return this.prevObject||jQuery([])},push:[].push,sort:[].sort,splice:[].splice,find:function(selector){if(this.length===1){var ret=this.pushStack([],"find",selector);ret.length=0;jQuery.find(selector,this[0],ret);return ret}else{return this.pushStack(jQuery.unique(jQuery.map(this,function(elem){return jQuery.find(selector,elem)})),"find",selector)}},clone:function(events){var ret=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var html=this.outerHTML;if(!html){var div=this.ownerDocument.createElement("div");div.appendChild(this.cloneNode(true));html=div.innerHTML}return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else return this.cloneNode(true)});if(events===true){var orig=this.find("*").andSelf(),i=0;ret.find("*").andSelf().each(function(){if(this.nodeName!==orig[i].nodeName)return;var events=jQuery.data(orig[i],"events");for(var type in events){for(var handler in events[type]){jQuery.event.add(this,type,events[type][handler],events[type][handler].data)}}i++})}return ret},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i)})||jQuery.multiFilter(selector,jQuery.grep(this,function(elem){return elem.nodeType===1})),"filter",selector)},closest:function(selector){var pos=jQuery.expr.match.POS.test(selector)?jQuery(selector):null,closer=0;return this.map(function(){var cur=this;while(cur&&cur.ownerDocument){if(pos?pos.index(cur)>-1:jQuery(cur).is(selector)){jQuery.data(cur,"closest",closer);return cur}cur=cur.parentNode;closer++}})},not:function(selector){if(typeof selector==="string")if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true),"not",selector);else selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector})},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector==="string"?jQuery(selector):jQuery.makeArray(selector))))},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0},hasClass:function(selector){return!!selector&&this.is("."+selector)},val:function(value){if(value===undefined){var elem=this[0];if(elem){if(jQuery.nodeName(elem,'option'))return(elem.attributes.value||{}).specified?elem.value:elem.text;if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery(option).val();if(one)return value;values.push(value)}}return values}return(elem.value||"").replace(/\r/g,"")}return undefined}if(typeof value==="number")value+='';return this.each(function(){if(this.nodeType!=1)return;if(jQuery.isArray(value)&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0)});if(!values.length)this.selectedIndex=-1}else this.value=value})},html:function(value){return value===undefined?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(value)},replaceWith:function(value){return this.after(value).remove()},eq:function(i){return this.slice(i,+i+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(args,table,callback){if(this[0]){var fragment=(this[0].ownerDocument||this[0]).createDocumentFragment(),scripts=jQuery.clean(args,(this[0].ownerDocument||this[0]),fragment),first=fragment.firstChild;if(first)for(var i=0,l=this.length;i<l;i++)callback.call(root(this[i],first),this.length>1||i>0?fragment.cloneNode(true):fragment);if(scripts)jQuery.each(scripts,evalScript)}return this;function root(elem,cur){return table&&jQuery.nodeName(elem,"table")&&jQuery.nodeName(cur,"tr")?(elem.getElementsByTagName("tbody")[0]||elem.appendChild(elem.ownerDocument.createElement("tbody"))):elem}}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem)}function now(){return+new Date}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target))target={};if(length==i){target=this;--i}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy==="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy}return target};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{},toString=Object.prototype.toString;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery},isFunction:function(obj){return toString.call(obj)==="[object Function]"},isArray:function(obj){return toString.call(obj)==="[object Array]"},isXMLDoc:function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&jQuery.isXMLDoc(elem.ownerDocument)},globalEval:function(data){if(data&&/\S/.test(data)){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.support.scriptEval)script.appendChild(document.createTextNode(data));else script.text=data;head.insertBefore(script,head.firstChild);head.removeChild(script)}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase()},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length===undefined){for(name in object)if(callback.apply(object[name],args)===false)break}else for(;i<length;)if(callback.apply(object[i++],args)===false)break}else{if(length===undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break}else

Aaaaaaaaagh!!!!

Did I hear a distant pop? I think ShawnCPlus just burst a blood vessel.

Airshow

I'm pretty sure we said don't post minified versions. Ya gotta have some newlines and indentation in there.

Good thing I found a beautifier. I wouldn't want to be responsible for any blood, other bodily fluids and/or ruptured organs/vessels that may be caused by reading the other version. :)

I went through the script today with the IE8 developer tool.
It seems that "timeRemaining" is only assigned a value for a part of the script, otherwise it is undefined.

You guys know this better than me though.

Also, with looping the testing for timer value part of the script (which I will end up creating), it would have to allow for the timeRemaining to be refreshed before executing the check again. (Yes, new to js; but still can think logically)

Thanks

Attachments
// JavaScript Document
(function () {
    var window = this,
    undefined, _jQuery = window.jQuery,
    _$ = window.$,
    jQuery = window.jQuery = window.$ = function (selector, context) {
        return new jQuery.fn.init(selector, context)
    },
    quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,
    isSimple = /^.[^:#\[\.,]*$/;
    jQuery.fn = jQuery.prototype = {
        init: function (selector, context) {
            selector = selector || document;
            if (selector.nodeType) {
                this[0] = selector;
                this.length = 1;
                this.context = selector;
                return this
            }
            if (typeof selector === "string") {
                var match = quickExpr.exec(selector);
                if (match && (match[1] || !context)) {
                    if (match[1]) selector = jQuery.clean([match[1]], context);
                    else {
                        var elem = document.getElementById(match[3]);
                        if (elem && elem.id != match[3]) return jQuery().find(selector);
                        var ret = jQuery(elem || []);
                        ret.context = document;
                        ret.selector = selector;
                        return ret
                    }
                } else return jQuery(context).find(selector)
            } else if (jQuery.isFunction(selector)) return jQuery(document).ready(selector);
            if (selector.selector && selector.context) {
                this.selector = selector.selector;
                this.context = selector.context
            }
            return this.setArray(jQuery.isArray(selector) ? selector: jQuery.makeArray(selector))
        },
        selector: "",
        jquery: "1.3.2",
        size: function () {
            return this.length
        },
        get: function (num) {
            return num === undefined ? Array.prototype.slice.call(this) : this[num]
        },
        pushStack: function (elems, name, selector) {
            var ret = jQuery(elems);
            ret.prevObject = this;
            ret.context = this.context;
            if (name === "find") ret.selector = this.selector + (this.selector ? " ": "") + selector;
            else if (name) ret.selector = this.selector + "." + name + "(" + selector + ")";
            return ret
        },
        setArray: function (elems) {
            this.length = 0;
            Array.prototype.push.apply(this, elems);
            return this
        },
        each: function (callback, args) {
            return jQuery.each(this, callback, args)
        },
        index: function (elem) {
            return jQuery.inArray(elem && elem.jquery ? elem[0] : elem, this)
        },
        attr: function (name, value, type) {
            var options = name;
            if (typeof name === "string") if (value === undefined) return this[0] && jQuery[type || "attr"](this[0], name);
            else {
                options = {};
                options[name] = value
            }
            return this.each(function (i) {
                for (name in options) jQuery.attr(type ? this.style: this, name, jQuery.prop(this, options[name], type, i, name))
            })
        },
        css: function (key, value) {
            if ((key == 'width' || key == 'height') && parseFloat(value) < 0) value = undefined;
            return this.attr(key, value, "curCSS")
        },
        text: function (text) {
            if (typeof text !== "object" && text != null) return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text));
            var ret = "";
            jQuery.each(text || this, function () {
                jQuery.each(this.childNodes, function () {
                    if (this.nodeType != 8) ret += this.nodeType != 1 ? this.nodeValue: jQuery.fn.text([this])
                })
            });
            return ret
        },
        wrapAll: function (html) {
            if (this[0]) {
                var wrap = jQuery(html, this[0].ownerDocument).clone();
                if (this[0].parentNode) wrap.insertBefore(this[0]);
                wrap.map(function () {
                    var elem = this;
                    while (elem.firstChild) elem = elem.firstChild;
                    return elem
                }).append(this)
            }
            return this
        },
        wrapInner: function (html) {
            return this.each(function () {
                jQuery(this).contents().wrapAll(html)
            })
        },
        wrap: function (html) {
            return this.each(function () {
                jQuery(this).wrapAll(html)
            })
        },
        append: function () {
            return this.domManip(arguments, true, function (elem) {
                if (this.nodeType == 1) this.appendChild(elem)
            })
        },
        prepend: function () {
            return this.domManip(arguments, true, function (elem) {
                if (this.nodeType == 1) this.insertBefore(elem, this.firstChild)
            })
        },
        before: function () {
            return this.domManip(arguments, false, function (elem) {
                this.parentNode.insertBefore(elem, this)
            })
        },
        after: function () {
            return this.domManip(arguments, false, function (elem) {
                this.parentNode.insertBefore(elem, this.nextSibling)
            })
        },
        end: function () {
            return this.prevObject || jQuery([])
        },
        push: [].push,
        sort: [].sort,
        splice: [].splice,
        find: function (selector) {
            if (this.length === 1) {
                var ret = this.pushStack([], "find", selector);
                ret.length = 0;
                jQuery.find(selector, this[0], ret);
                return ret
            } else {
                return this.pushStack(jQuery.unique(jQuery.map(this, function (elem) {
                    return jQuery.find(selector, elem)
                })), "find", selector)
            }
        },
        clone: function (events) {
            var ret = this.map(function () {
                if (!jQuery.support.noCloneEvent && !jQuery.isXMLDoc(this)) {
                    var html = this.outerHTML;
                    if (!html) {
                        var div = this.ownerDocument.createElement("div");
                        div.appendChild(this.cloneNode(true));
                        html = div.innerHTML
                    }
                    return jQuery.clean([html.replace(/ jQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]
                } else return this.cloneNode(true)
            });
            if (events === true) {
                var orig = this.find("*").andSelf(),
                i = 0;
                ret.find("*").andSelf().each(function () {
                    if (this.nodeName !== orig[i].nodeName) return;
                    var events = jQuery.data(orig[i], "events");
                    for (var type in events) {
                        for (var handler in events[type]) {
                            jQuery.event.add(this, type, events[type][handler], events[type][handler].data)
                        }
                    }
                    i++
                })
            }
            return ret
        },
        filter: function (selector) {
            return this.pushStack(jQuery.isFunction(selector) && jQuery.grep(this, function (elem, i) {
                return selector.call(elem, i)
            }) || jQuery.multiFilter(selector, jQuery.grep(this, function (elem) {
                return elem.nodeType === 1
            })), "filter", selector)
        },
        closest: function (selector) {
            var pos = jQuery.expr.match.POS.test(selector) ? jQuery(selector) : null,
            closer = 0;
            return this.map(function () {
                var cur = this;
                while (cur && cur.ownerDocument) {
                    if (pos ? pos.index(cur) > -1 : jQuery(cur).is(selector)) {
                        jQuery.data(cur, "closest", closer);
                        return cur
                    }
                    cur = cur.parentNode;
                    closer++
                }
            })
        },
        not: function (selector) {
            if (typeof selector === "string") if (isSimple.test(selector)) return this.pushStack(jQuery.multiFilter(selector, this, true), "not", selector);
            else selector = jQuery.multiFilter(selector, this);
            var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
            return this.filter(function () {
                return isArrayLike ? jQuery.inArray(this, selector) < 0 : this != selector
            })
        },
        add: function (selector) {
            return this.pushStack(jQuery.unique(jQuery.merge(this.get(), typeof selector === "string" ? jQuery(selector) : jQuery.makeArray(selector))))
        },
        is: function (selector) {
            return !! selector && jQuery.multiFilter(selector, this).length > 0
        },
        hasClass: function (selector) {
            return !! selector && this.is("." + selector)
        },
        val: function (value) {
            if (value === undefined) {
                var elem = this[0];
                if (elem) {
                    if (jQuery.nodeName(elem, 'option')) return (elem.attributes.value || {}).specified ? elem.value: elem.text;
                    if (jQuery.nodeName(elem, "select")) {
                        var index = elem.selectedIndex,
                        values = [],
                        options = elem.options,
                        one = elem.type == "select-one";
                        if (index < 0) return null;
                        for (var i = one ? index: 0, max = one ? index + 1 : options.length; i < max; i++) {

Has anyone had any luck with this?

I have been poking around myself, but without knowing where and what to look for - I'm stumped.

This article has been dead for over six months. Start a new discussion instead.