(function() { var loh_load_teste_load = 0; try { if (window['loh']) { loh_load_teste_load = 1;} } catch (e) { } if (loh_load_teste_load == 1) {return;} window['loh'] = new Object(); // alert(1); loh.loh_domain = "http://likeorhate.com";loh.loh_staticdomain = "http://static.likeorhate.com";/* * likeorhate.com * Copyright (c) 2008 likeorhate.com */ loh.addEvent = function(el,ev,fn, capture) { if (el.addEventListener) el.addEventListener(ev, fn, capture); else el.attachEvent('on'+ev, fn); }; loh.getLocaleFromPageContext = function() { var lng = loh.conf.language; if (lng != null) return loh.conf.language; if (navigator.userLanguage == "string") return navigator.userLanguage.substring(0,2); if (navigator.language == "string") return navigator.language.substring(0,2); return 'en'; } ///// FROM: http://techpatterns.com/downloads/javascript_cookies.php // this fixes an issue with the old method, ambiguous values // with this test document.cookie.indexOf( name + "=" ); loh.getCookie = function(check_name) { // first we'll split this cookie up into name/value pairs // note: document.cookie only returns name=value, not the other components var a_all_cookies = document.cookie.split( ';' ); var a_temp_cookie = ''; var cookie_name = ''; var cookie_value = ''; var b_cookie_found = false; // set boolean t/f default f for (var i = 0; i < a_all_cookies.length; i++) { // now we'll split apart each name=value pair a_temp_cookie = a_all_cookies[i].split( '=' ); // and trim left/right whitespace while we're at it cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, ''); // if the extracted name matches passed check_name if (cookie_name == check_name) { b_cookie_found = true; // we need to handle case where cookie has no value but exists (no = sign, that is): if (a_temp_cookie.length > 1) cookie_value = unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g, '')); // note that in cases where cookie is initialized but no value, null is returned return cookie_value; } a_temp_cookie = null; cookie_name = ''; } if (!b_cookie_found) return null; } loh.setCookie = function(cookiename, data) { // TODO } /** * Controls space. */ loh.ctrl = new Object(); /** * Configuration space. */ loh.conf = new Object(); // Defaults { /** * Load or not loh information: */ loh.conf.loadThingOnPages = false; /** * Things popups fadeout behaviour: */ loh.conf.timeoutWindows = true; loh.conf.timeoutWindowPeriod = 200; /** * Allow multiple windows opened. It can be usefull combined no timeout option. * * It does not affect pinned windows. */ loh.conf.multipleWindows = false; /** * Allow drag the windows around */ loh.conf.dragableWindows = true; /** * Appearance of the things delimiters */ loh.conf.showLimiterChar = true; loh.conf.colorLimiterChar = true; // Tipo de indicador de votação: // 0 - nenhum indicador // 1 - cor dos limitadores // 2 - imagens envolvendo a expressão // 3 - imagem a direita /** * Type of likeness/hateness rates hint to use: * 0 - no indicator * 1 - limiter's color * 2 - images around the things * 3 - images on the right of the things */ loh.conf.voteIndicatorType = 1; /** * Indicates the characters taht will surround the thing on the page. */ loh.conf.limiterCharLeft = '#'; loh.conf.limiterCharRight = '#'; /** * When images surround the things, these vars indicates what imagens to display, * and how the will respond to likeness/hateness rates. */ loh.conf.changeSideImagesSize = true; loh.conf.sideImagesSizeMin = 5; loh.conf.sideImagesSizeMax = 15; loh.conf.sideImageLeft = loh.loh_staticdomain + '/images/likeicon.png'; loh.conf.sideImageRight = loh.loh_staticdomain + '/images/hateicon.png'; /** * Base name for the images that will be shown on the right of each marked term. */ loh.conf.onlyRightImageBegin = loh.loh_staticdomain + '/images/arrowicon'; loh.conf.onlyRightImageEnd = '.png'; /** * Indicates how many different images will have to indicate the likeness/hateness rate. * It's assumed that the names of the images are: * loh.conf.onlyRightImageBegin + Math.floor(like*loh.conf.onlyRightSteps/(like + hate)) + loh.conf.onlyRightImageEnd * * Besides those images, is expected an image named: * loh.conf.onlyRightImageBegin + 'load' + loh.conf.onlyRightImageEnd */ loh.conf.onlyRightSteps = 5; /** * Indicates if we should show a hint of the likeness/hateness rate. * It's assumed that the names of the images are: * loh.conf.onlyRightImageBegin + Math.floor(like*loh.conf.onlyRightSteps/(like + hate)) + loh.conf.onlyRightImageEnd */ loh.conf.showStartupHint = false; /** * Sets the page language. This info is sent to the server. Null it if you * want the server to discover it info by itself. */ loh.conf.language = null; /** * Sets the page permalink. This info is sent to the server. Null it if you * want the server to discover it info by itself. */ loh.conf.permalink = null; /** * Sizes and positions that are set directly in js: */ // Thing on text: surrounding images loh.conf.szThingSurrImg = [10, 10]; // Thing on text: sidekick images loh.conf.szThingSideImg = [10, 10]; // Box size loh.conf.szBoxDefault = [310, 290]; loh.conf.szShadowOffset = 6; // Minimum box size loh.conf.szBoxMin = [310, 290]; // Thumbnail box loh.conf.szThumbBox = [102, 108]; // Tab general loh.conf.szTabGeneral = [310, 290]; // Tab comments loh.conf.szTabComments = [520, 460]; // Tab links loh.conf.szTabLinks = [320, 450]; // Tab Trackback loh.conf.szTabTrackback = [430, 420]; // Tab googleit loh.conf.szTabGoogleit = [550, 410]; // Tab wikit loh.conf.szTabWikit = [550, 410]; // LOH Logo loh.conf.szLOHLogo = [219, 40]; // Votebar size loh.conf.heightVotebar = 15; // Tabbox no-auth top loh.conf.topNoauthTabbox = 70; loh.conf.heightpercNoauthTabbox = 70; // Moneymaker boxxy dimensions: left, bottom, right, height (!) loh.conf.mrktingBox = [5, 5, 10, 18]; loh.conf.szVotebarleftcap = [10, 25]; loh.conf.szVotebarcenter = [1, 25]; loh.conf.szVotebarrightcap = [10, 25]; // Tabs that will be shown for the things on the page. Extra to these tabs, // it will be included the main tab and any aditional tab that are specific // for some kind of things. loh.conf.selectedTabs = ['main', 'comments', 'trackback', 'googleit', 'relatedthings', 'wikipedia', 'youtube']; loh.conf.selectedTab = 'main'; // Basic schema for each tab. loh.conf.tabsAvailable = { 'main': { 'size': loh.conf.szBoxDefault, 'lbl_size': 58, 'pane': 'tab_general', 'onShow': loh.tabShowDefault, 'onHide': loh.tabHideDefault }, 'comments': { 'size': loh.conf.szTabComments, 'lbl_size': 91, 'pane': 'tab_iframe', 'onShow': loh.tabShowDefault, 'onHide': loh.tabHideDefault }, 'trackback': { 'size': loh.conf.szTabTrackback, 'lbl_size': 93, 'pane': 'tab_trackback', 'onShow': loh.tabShowDefault, 'onHide': loh.tabHideDefault }, 'googleit': { 'size': loh.conf.szTabGoogleit, 'lbl_size': 62, 'pane': 'tab_iframe', 'onShow': loh.tabShowDefault, 'onHide': loh.tabHideDefault }, 'relatedthings': { 'size': loh.conf.szTabLinks, 'lbl_size': 110, 'pane': 'tab_iframe', 'onShow': loh.tabShowDefault, 'onHide': loh.tabHideDefault }, 'wikipedia': { 'size': loh.conf.szTabWikit, 'lbl_size': 97, 'pane': 'tab_iframe', 'onShow': loh.tabShowDefault, 'onHide': loh.tabHideDefault }, 'youtube': { 'size': loh.conf.szTabWikit, 'lbl_size': 97, 'pane': 'tab_iframe', 'onShow': loh.tabShowDefault, 'onHide': loh.tabHideDefault } }; } /* 310 155 77 38 19 extra for icon: 22 //*/ /** * core - Constructor */ loh.core = function() { // alert('?'); this.thinglist = new Object(); this.thinglist2request = new Object(); this.thinglistid = new Object(); this.thingarray = new Array(); // have we started the code yet? this.started = false; // current language this.language = this.getPageLanguage(); }; loh.core.prototype.getPageLanguage = function() { if (loh.conf.language != null) return loh.conf.language; else return loh.conf.def_language; }; /** * Magic event callback. Used for communication with other javascript * * @param */ loh.core.prototype.divEventCallback = function(ev) { var div = $lhj('#likeorhate-event'); var command = div.attr('data-command'); switch (command) { case 'makeTag': var target = $lhj('#'+div.attr('data-target')); var query = div.attr('data-query'); loh.loh_sngltn.findThing4JElem(target); break; default: } ev.stopPropagation(); } /** * Loads external files. * * @param scripts A list of js files to load. * @param css A list of css files to load. * @param string onloadFnc The function to run after everything is loaded (as a string) */ loh.core.prototype.loadFiles = function(scripts, css, onloadFnc) { var head = document.getElementsByTagName('head').item(0); for (var i = 0; i < css.length; i++) { var cssLink = document.createElement("link"); cssLink.href = css[i]; cssLink.rel = "stylesheet"; cssLink.type = "text/css"; head.appendChild(cssLink); } // TODO: apparently IE doesn't guarantee that scripts are loaded in sequence for (i = 0; i < scripts.length; i++) { var js = document.createElement("script"); js.src = scripts[i]; if (i == scripts.length-1 && onloadFnc) { js.onload = function () { eval(onloadFnc); }; js.onreadystatechange = function () { if (js.readyState == 'loaded' || js.readyState == 'complete') { eval(onloadFnc); } }; } js.type = "text/javascript"; head.appendChild(js); } }; /** * Load all necessary scripts, css, etc, and call start() */ loh.core.prototype.load = function() { try { if (loh_is_mainsite) ; } catch (e) { var css = [ loh.loh_domain + "/css/loh_js.css?version=1.1" ]; var scripts = [ // loh.loh_domain + "/js/internal/loh_main.js" ]; loh.loh_sngltn.loadFiles(scripts, css, 'loh.loh_sngltn.start()'); } // and create a fake div that we use for event triggering var div = document.createElement("div"); div.id = 'likeorhate-event'; div.style.visibility = 'hidden'; div.style.display = 'none'; loh.addEvent(div, 'click', function(ev) { loh.loh_sngltn.divEventCallback(ev); }, true); var body = document.getElementsByTagName('body').item(0); body.appendChild(div); }; /** * Destructor */ loh.core.prototype.destroy = function() { }; // Default page language loh.conf.def_language = loh.getLocaleFromPageContext(); //loh.conf.def_language = ''; // Is user authenticated? // loh.ctrl.isauth = if ($login->isLogged()) echo 'true'; else echo 'false'; var tmp_cookie = loh.getCookie('likeorhate'); if (tmp_cookie == null) tmp_cookie = ''; //alert('tmp_cookie: ' + tmp_cookie); loh.ctrl.isauth = tmp_cookie.length > 0; loh.loh_sngltn = new loh.core(); // Search things on page on load? loh.conf.loadThingOnPages = true; // Event handlers loh.addEvent(window, 'load', loh.loh_sngltn.load); /** * Get translations */ loh.core.prototype.getStrings = function() { // translated strings this.strings = new Object(); this.strings = { 'or': 'or', 'i_like': 'I like', 'i_hate': 'I hate', 'like': 'Like!', 'whatever': 'Whatever...', 'hate': 'Hate!', 'votes_title': 'Votes', 'votes_subtitle': 'Click on the bars to vote!', 'total_votes': 'Votes', 'total_views': 'Views', 'total_comments': 'Comments', 'created': 'Created on ', 'dec_sep': '.', 'thousand': 'thousand', 'million': 'million', 'billion': 'billion', 'thumb_not_ok': 'Image is not ok?', 'thumb_not_ok_tell': 'Tell us!', 'main': 'General', 'comments': 'Comments', 'link': 'Links', 'trackback':'Trackbacks', 'googleit': 'Google it', 'wikipedia': 'Wikipedia', 'relatedthings': 'Related things', 'buyit': 'Buy it!', 'compare': 'Compare Things', 'youtube':'YouTube!', 'compare_btn': 'Compare >>', 'prepare_compare_title': 'Compare Things', 'loading': 'Loading ...', 'thanks_reporting_buggythumb': 'Thank you!', 'data_not_loaded_yet': 'Still loading data!', 'sign_in': 'Sign-in', 'sign_in_tooltip': 'Click to sign-in!', 'register': 'Register now', 'register_tooltip': 'Click to register now (opens a new window)', 'disamb_diag_title': 'Are you looking for a different', 'disamb_diag_title_end': '?', 'mistype_diag_title': 'Are you looking for something different?', 'votelike_tit': 'Do you like it? Click now and vote!', 'votewhtvr_tit': 'Don\'t care? Click now and vote!', 'votehate_tit': 'Do you hate it? Click now and vote!', 'authvotelike_tip': 'Author likes it!', 'authvotewhtvr_tip': 'Author really doesn\'t care...', 'authvotehate_tip': 'Author hates it!', 'commentreplytitle': 'Replying to: ', 'trck_notfound': 'Links found: zero', 'trck_found_tit': 'Links found: ', 'wouldlikelogin': 'Would you like to login (or register) and associate this vote to your account? This dialog will not be shown again.', 'yesplease': 'Yes, please', 'nothanks': 'No, thanks', 'error_on_rate_thing': 'Our servers didn\'t register your vote, sorry. Please try again.', 'error_on_rate_thing_det1': 'If the problem persists, please try again later! We\'ll probably had the problem solved!', 'error_ack_lbl': 'Ok ...', 'error_img_notfound': 'Image not found.', 'error_onop': 'An error occured.' }; }; // get translations loh.loh_sngltn.getStrings(); })(); loh.doImg = function(src, cls, id, width, height, tit, styl, clickable, border) { if (document.body.filters) { var version = parseFloat(navigator.appVersion.split("MSIE")); if (version >= 4 && version < 7.0 && src.substring(src.length - 3, src.length).toUpperCase() == "PNG") { // bad browser var html = ""; // alert(html); return html; } } // good browser / no-png var html = ""; }; loh.swapImgs = function(lhjImgs, srcNew) { if (document.body.filters) { var version = parseFloat(navigator.appVersion.split("MSIE")); if (version >= 4 && version < 7.0 && srcNew.substring(srcNew.length - 3, srcNew.length).toUpperCase() == "PNG") { for (var i = 0; i < lhjImgs.length; i++) { var spn = lhjImgs[i]; var imgID = (spn.id) ? "id='" + spn.id + "' " : ""; var imgClass = (spn.className) ? "class='" + spn.className + "' " : ""; var imgTitle = (spn.title) ? "title='" + spn.title + "' " : ""; var imgStyle = spn.style.cssText; var strNewHTML = ""; spn.outerHTML = strNewHTML; } return; } } // good browser lhjImgs.attr('src', srcNew); }; /*! * jlorhQuery JavaScript Library v1.3.2 * http://jquery.com/ * * Copyright (c) 2009 John Resig * Dual licensed under the MIT and GPL licenses. * http://docs.jquery.com/License * * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) * Revision: 6246 */ if (!window.jlorhQuery) (function(){ var // Will speed up references to window, and allows munging its name. window = this, // Will speed up references to undefined, and allows munging its name. undefined, // Map over jlorhQuery in case of overwrite _jlorhQuery = window.jlorhQuery, // Map over the $ in case of overwrite _$ = window.$, jlorhQuery = window.jlorhQuery = window.$ = function( selector, context ) { // The jlorhQuery object is actually just the init constructor 'enhanced' return new jlorhQuery.fn.init( selector, context ); }, // A simple way to check for HTML strings or ID strings // (both of which we optimize for) quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/, // Is it a simple selector isSimple = /^.[^:#\[\.,]*$/; jlorhQuery.fn = jlorhQuery.prototype = { init: function( selector, context ) { // Make sure that a selection was provided selector = selector || document; // Handle $(DOMElement) if ( selector.nodeType ) { this[0] = selector; this.length = 1; this.context = selector; return this; } // Handle HTML strings if ( typeof selector === "string" ) { // Are we dealing with HTML string or an ID? var match = quickExpr.exec( selector ); // Verify a match, and that no context was specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) selector = jlorhQuery.clean( [ match[1] ], context ); // HANDLE: $("#id") else { var elem = document.getElementById( match[3] ); // Handle the case where IE and Opera return items // by name instead of ID if ( elem && elem.id != match[3] ) return jlorhQuery().find( selector ); // Otherwise, we inject the element directly into the jlorhQuery object var ret = jlorhQuery( elem || [] ); ret.context = document; ret.selector = selector; return ret; } // HANDLE: $(expr, [context]) // (which is just equivalent to: $(content).find(expr) } else return jlorhQuery( context ).find( selector ); // HANDLE: $(function) // Shortcut for document ready } else if ( jlorhQuery.isFunction( selector ) ) return jlorhQuery( document ).ready( selector ); // Make sure that old selector state is passed along if ( selector.selector && selector.context ) { this.selector = selector.selector; this.context = selector.context; } return this.setArray(jlorhQuery.isArray( selector ) ? selector : jlorhQuery.makeArray(selector)); }, // Start with an empty selector selector: "", // The current version of jlorhQuery being used jquery: "1.3.2", // The number of elements contained in the matched element set size: function() { return this.length; }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num === undefined ? // Return a 'clean' array Array.prototype.slice.call( this ) : // Return just the object this[ num ]; }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jlorhQuery matched element set var ret = jlorhQuery( elems ); // Add the old object onto the stack (as a reference) 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 the newly-formed element set return ret; }, // Force the current matched set of elements to become // the specified array of elements (destroying the stack in the process) // You should use pushStack() in order to do this, but maintain the stack setArray: function( elems ) { // Resetting the length to 0, then using the native Array push // is a super-fast way to populate an object with array-like properties this.length = 0; Array.prototype.push.apply( this, elems ); return this; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jlorhQuery.each( this, callback, args ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // Locate the position of the desired element return jlorhQuery.inArray( // If it receives a jlorhQuery object, the first element is used elem && elem.jquery ? elem[0] : elem , this ); }, attr: function( name, value, type ) { var options = name; // Look for the case where we're accessing a style value if ( typeof name === "string" ) if ( value === undefined ) return this[0] && jlorhQuery[ type || "attr" ]( this[0], name ); else { options = {}; options[ name ] = value; } // Check to see if we're setting style values return this.each(function(i){ // Set all the styles for ( name in options ) jlorhQuery.attr( type ? this.style : this, name, jlorhQuery.prop( this, options[ name ], type, i, name ) ); }); }, css: function( key, value ) { // ignore negative width and height values 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 = ""; jlorhQuery.each( text || this, function(){ jlorhQuery.each( this.childNodes, function(){ if ( this.nodeType != 8 ) ret += this.nodeType != 1 ? this.nodeValue : jlorhQuery.fn.text( [ this ] ); }); }); return ret; }, wrapAll: function( html ) { if ( this[0] ) { // The elements to wrap the target around var wrap = jlorhQuery( 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(){ jlorhQuery( this ).contents().wrapAll( html ); }); }, wrap: function( html ) { return this.each(function(){ jlorhQuery( 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 || jlorhQuery( [] ); }, // For internal use only. // Behaves like an Array's method, not like a jlorhQuery method. push: [].push, sort: [].sort, splice: [].splice, find: function( selector ) { if ( this.length === 1 ) { var ret = this.pushStack( [], "find", selector ); ret.length = 0; jlorhQuery.find( selector, this[0], ret ); return ret; } else { return this.pushStack( jlorhQuery.unique(jlorhQuery.map(this, function(elem){ return jlorhQuery.find( selector, elem ); })), "find", selector ); } }, clone: function( events ) { // Do the clone var ret = this.map(function(){ if ( !jlorhQuery.support.noCloneEvent && !jlorhQuery.isXMLDoc(this) ) { // IE copies events bound via attachEvent when // using cloneNode. Calling detachEvent on the // clone will also remove the events from the orignal // In order to get around this, we use innerHTML. // Unfortunately, this means some modifications to // attributes in IE that are actually only stored // as properties will not be copied (such as the // the name attribute on an input). var html = this.outerHTML; if ( !html ) { var div = this.ownerDocument.createElement("div"); div.appendChild( this.cloneNode(true) ); html = div.innerHTML; } return jlorhQuery.clean([html.replace(/ jlorhQuery\d+="(?:\d+|null)"/g, "").replace(/^\s*/, "")])[0]; } else return this.cloneNode(true); }); // Copy the events from the original to the clone if ( events === true ) { var orig = this.find("*").andSelf(), i = 0; ret.find("*").andSelf().each(function(){ if ( this.nodeName !== orig[i].nodeName ) return; var events = jlorhQuery.data( orig[i], "events" ); for ( var type in events ) { for ( var handler in events[ type ] ) { jlorhQuery.event.add( this, type, events[ type ][ handler ], events[ type ][ handler ].data ); } } i++; }); } // Return the cloned set return ret; }, filter: function( selector ) { return this.pushStack( jlorhQuery.isFunction( selector ) && jlorhQuery.grep(this, function(elem, i){ return selector.call( elem, i ); }) || jlorhQuery.multiFilter( selector, jlorhQuery.grep(this, function(elem){ return elem.nodeType === 1; }) ), "filter", selector ); }, closest: function( selector ) { var pos = jlorhQuery.expr.match.POS.test( selector ) ? jlorhQuery(selector) : null, closer = 0; return this.map(function(){ var cur = this; while ( cur && cur.ownerDocument ) { if ( pos ? pos.index(cur) > -1 : jlorhQuery(cur).is(selector) ) { jlorhQuery.data(cur, "closest", closer); return cur; } cur = cur.parentNode; closer++; } }); }, not: function( selector ) { if ( typeof selector === "string" ) // test special case where just one selector is passed in if ( isSimple.test( selector ) ) return this.pushStack( jlorhQuery.multiFilter( selector, this, true ), "not", selector ); else selector = jlorhQuery.multiFilter( selector, this ); var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; return this.filter(function() { return isArrayLike ? jlorhQuery.inArray( this, selector ) < 0 : this != selector; }); }, add: function( selector ) { return this.pushStack( jlorhQuery.unique( jlorhQuery.merge( this.get(), typeof selector === "string" ? jlorhQuery( selector ) : jlorhQuery.makeArray( selector ) ))); }, is: function( selector ) { return !!selector && jlorhQuery.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( jlorhQuery.nodeName( elem, 'option' ) ) return (elem.attributes.value || {}).specified ? elem.value : elem.text; // We need to handle select boxes special if ( jlorhQuery.nodeName( elem, "select" ) ) { var index = elem.selectedIndex, values = [], options = elem.options, one = elem.type == "select-one"; // Nothing was selected if ( index < 0 ) return null; // Loop through all the selected options for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { var option = options[ i ]; if ( option.selected ) { // Get the specifc value for the option value = jlorhQuery(option).val(); // We don't need an array for one selects if ( one ) return value; // Multi-Selects return an array values.push( value ); } } return values; } // Everything else, we just grab the value return (elem.value || "").replace(/\r/g, ""); } return undefined; } if ( typeof value === "number" ) value += ''; return this.each(function(){ if ( this.nodeType != 1 ) return; if ( jlorhQuery.isArray(value) && /radio|checkbox/.test( this.type ) ) this.checked = (jlorhQuery.inArray(this.value, value) >= 0 || jlorhQuery.inArray(this.name, value) >= 0); else if ( jlorhQuery.nodeName( this, "select" ) ) { var values = jlorhQuery.makeArray(value); jlorhQuery( "option", this ).each(function(){ this.selected = (jlorhQuery.inArray( this.value, values ) >= 0 || jlorhQuery.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(/ jlorhQuery\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( jlorhQuery.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 = jlorhQuery.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 ) jlorhQuery.each( scripts, evalScript ); } return this; function root( elem, cur ) { return table && jlorhQuery.nodeName(elem, "table") && jlorhQuery.nodeName(cur, "tr") ? (elem.getElementsByTagName("tbody")[0] || elem.appendChild(elem.ownerDocument.createElement("tbody"))) : elem; } } }; // Give the init function the jlorhQuery prototype for later instantiation jlorhQuery.fn.init.prototype = jlorhQuery.fn; function evalScript( i, elem ) { if ( elem.src ) jlorhQuery.ajax({ url: elem.src, async: false, dataType: "script" }); else jlorhQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); if ( elem.parentNode ) elem.parentNode.removeChild( elem ); } function now(){ return +new Date; } jlorhQuery.extend = jlorhQuery.fn.extend = function() { // copy reference to target object var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jlorhQuery.isFunction(target) ) target = {}; // extend jlorhQuery itself if only one argument is passed if ( length == i ) { target = this; --i; } for ( ; i < length; i++ ) // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) // Extend the base object for ( var name in options ) { var src = target[ name ], copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) continue; // Recurse if we're merging object values if ( deep && copy && typeof copy === "object" && !copy.nodeType ) target[ name ] = jlorhQuery.extend( deep, // Never move original objects, clone them src || ( copy.length != null ? [ ] : { } ) , copy ); // Don't bring in undefined values else if ( copy !== undefined ) target[ name ] = copy; } // Return the modified object return target; }; // exclude the following css properties to add px var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i, // cache defaultView defaultView = document.defaultView || {}, toString = Object.prototype.toString; jlorhQuery.extend({ noConflict: function( deep ) { window.$ = _$; if ( deep ) window.jlorhQuery = _jlorhQuery; return jlorhQuery; }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return toString.call(obj) === "[object Function]"; }, isArray: function( obj ) { return toString.call(obj) === "[object Array]"; }, // check if an element is in a (or is an) XML document isXMLDoc: function( elem ) { return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" || !!elem.ownerDocument && jlorhQuery.isXMLDoc( elem.ownerDocument ); }, // Evalulates a script in a global context globalEval: function( data ) { if ( data && /\S/.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html var head = document.getElementsByTagName("head")[0] || document.documentElement, script = document.createElement("script"); script.type = "text/javascript"; if ( jlorhQuery.support.scriptEval ) script.appendChild( document.createTextNode( data ) ); else script.text = data; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709). head.insertBefore( script, head.firstChild ); head.removeChild( script ); } }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); }, // args is for internal usage only 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; // A special, fast, case for the most common use of each } else { if ( length === undefined ) { for ( name in object ) if ( callback.call( object[ name ], name, object[ name ] ) === false ) break; } else for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} } return object; }, prop: function( elem, value, type, i, name ) { // Handle executable functions if ( jlorhQuery.isFunction( value ) ) value = value.call( elem, i ); // Handle passing in a number to a CSS property return typeof value === "number" && type == "curCSS" && !exclude.test( name ) ? value + "px" : value; }, className: { // internal only, use addClass("class") add: function( elem, classNames ) { jlorhQuery.each((classNames || "").split(/\s+/), function(i, className){ if ( elem.nodeType == 1 && !jlorhQuery.className.has( elem.className, className ) ) elem.className += (elem.className ? " " : "") + className; }); }, // internal only, use removeClass("class") remove: function( elem, classNames ) { if (elem.nodeType == 1) elem.className = classNames !== undefined ? jlorhQuery.grep(elem.className.split(/\s+/), function(className){ return !jlorhQuery.className.has( classNames, className ); }).join(" ") : ""; }, // internal only, use hasClass("class") has: function( elem, className ) { return elem && jlorhQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; } }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var old = {}; // Remember the old values, and insert the new ones for ( var name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } callback.call( elem ); // Revert the old values for ( var name in options ) elem.style[ name ] = old[ name ]; }, css: function( elem, name, force, extra ) { if ( name == "width" || name == "height" ) { var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; function getWH() { val = name == "width" ? elem.offsetWidth : elem.offsetHeight; if ( extra === "border" ) return; jlorhQuery.each( which, function() { if ( !extra ) val -= parseFloat(jlorhQuery.curCSS( elem, "padding" + this, true)) || 0; if ( extra === "margin" ) val += parseFloat(jlorhQuery.curCSS( elem, "margin" + this, true)) || 0; else val -= parseFloat(jlorhQuery.curCSS( elem, "border" + this + "Width", true)) || 0; }); } if ( elem.offsetWidth !== 0 ) getWH(); else jlorhQuery.swap( elem, props, getWH ); return Math.max(0, Math.round(val)); } return jlorhQuery.curCSS( elem, name, force ); }, curCSS: function( elem, name, force ) { var ret, style = elem.style; // We need to handle opacity special in IE if ( name == "opacity" && !jlorhQuery.support.opacity ) { ret = jlorhQuery.attr( style, "opacity" ); return ret == "" ? "1" : ret; } // Make sure we're using the right name for getting the float value if ( name.match( /float/i ) ) name = styleFloat; if ( !force && style && style[ name ] ) ret = style[ name ]; else if ( defaultView.getComputedStyle ) { // Only "float" is needed here if ( name.match( /float/i ) ) name = "float"; name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); var computedStyle = defaultView.getComputedStyle( elem, null ); if ( computedStyle ) ret = computedStyle.getPropertyValue( name ); // We should always get a number back from opacity if ( name == "opacity" && ret == "" ) ret = "1"; } else if ( elem.currentStyle ) { var camelCase = name.replace(/\-(\w)/g, function(all, letter){ return letter.toUpperCase(); }); ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { // Remember the original values var left = style.left, rsLeft = elem.runtimeStyle.left; // Put in the new values to get a computed value out elem.runtimeStyle.left = elem.currentStyle.left; style.left = ret || 0; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; elem.runtimeStyle.left = rsLeft; } } return ret; }, clean: function( elems, context, fragment ) { context = context || document; // !context.createElement fails in IE with an error but returns typeof 'object' if ( typeof context.createElement === "undefined" ) context = context.ownerDocument || context[0] && context[0].ownerDocument || document; // If a single string is passed in and it's a single tag // just do a createElement and skip the rest if ( !fragment && elems.length === 1 && typeof elems[0] === "string" ) { var match = /^<(\w+)\s*\/?>$/.exec(elems[0]); if ( match ) return [ context.createElement( match[1] ) ]; } var ret = [], scripts = [], div = context.createElement("div"); jlorhQuery.each(elems, function(i, elem){ if ( typeof elem === "number" ) elem += ''; if ( !elem ) return; // Convert html string into DOM nodes if ( typeof elem === "string" ) { // Fix "XHTML"-style tags in all browsers elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? all : front + ">"; }); // Trim whitespace, otherwise indexOf won't work as expected var tags = elem.replace(/^\s+/, "").substring(0, 10).toLowerCase(); var wrap = // option or optgroup !tags.indexOf("", "" ] || !tags.indexOf("", "" ] || tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && [ 1, "", "
" ] || !tags.indexOf("", "" ] || // matched above (!tags.indexOf("", "" ] || !tags.indexOf("", "" ] || // IE can't serialize and