1 2// jQuery_Auto 0.9 _overð_onÉÏX 3// Automatic functions for webpages (using the wonderful jQuery library) 4 5// Copyright: (c) 2006, Michal Tatarynowicz ([email protected]) 6// Licenced as Public Domain (http://creativecommons.org/licenses/publicdomain/) 7// $Id: jquery_auto.js 426 2006-05-06 19:54:39Z MichaÅ $ 8 9 10// prototype.js use $(); 11// jQuery use j$(); 12jQuery.noConflict(); 13var j$ = jQuery; 14 15 16// Initialization 17 18j$.auto = { 19 init: function() { 20 for (module in j$.auto) { 21 if (j$.auto[module].init) 22 j$.auto[module].init(); 23 } 24 } 25}; 26 27j$(document).ready(j$.auto.init); 28 29 30// Auto-hidden elements 31 32j$.auto.hide = { 33 init: function() { 34 j$('.Hide').hide(); 35 } 36}; 37 38 39// Mouse hover 40 41j$.auto.hover = { 42 43 init: function() { 44 j$('IMG.Hover') 45 .bind('mouseover', this.enter) 46 .bind('mouseout', this.exit) 47 .each(this.preload); 48 }, 49 50 preload: function() { 51 this.preloaded = new Image; 52 this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"); 53 }, 54 55 enter: function() { 56 this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_on$2"); 57 }, 58 59 exit: function() { 60 this.src = this.src.replace(/^(.+)_on(\.[a-z]+)$/, "$1$2"); 61 } 62}; 63 64 65// Auto-submitting SELECTs 66 67j$.auto.submit = { 68 init: function() { 69 j$('SELECT.Submit').bind('change', this.on_change); 70 }, 71 72 on_change: function() { 73 if (this.value) this.form.submit(); 74 } 75}; 76 77 78// Auto-selected text in text fields after a label click 79 80j$.auto.select = { 81 init: function() { 82 j$('LABEL.Select').each(this.label_action); 83 j$('INPUT.Select').bind('click', function(){ this.select(); }); 84 }, 85 86 label_action: function() { 87 var field = j$('#'+this.htmlFor).get(0); 88 if (field && field.focus && field.select) { 89 j$(this).bind('click', function(){ field.focus(); field.select(); }); 90 } 91 } 92}; 93 94 95// Switches tabs on click 96 97j$.auto.tabs = { 98 99 init: function() { 100 101 j$('.Tabs').each(function(){ 102 var f = j$.auto.tabs.click; 103 var group = this; 104 j$('.Tab', group).each(function(){ 105 this.group = group; 106 j$(this).click(f); 107 j$('#'+this.id+'_body').hide(); 108 }).filter(':first').trigger('click'); 109 }); 110 111 }, 112 113 click: function() { 114 var tab = j$('#'+this.id+'_body').get(0); 115 j$('.Tab', this.group).each(function(){ 116 j$(this).removeClass('Active'); 117 j$('#'+this.id+'_body').hide(); 118 }); 119 120 j$(this).addClass('Active'); 121 j$(tab).show(); 122 this.blur(); 123 124 return false; 125 } 126 127};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.