Skip to content

Instantly share code, notes, and snippets.

View scottgonzalez's full-sized avatar

Scott González scottgonzalez

View GitHub Profile
diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js
index 6b06cfe..3715fdd 100644
--- a/ui/jquery.ui.autocomplete.js
+++ b/ui/jquery.ui.autocomplete.js
@@ -43,6 +43,10 @@ $.widget( "ui.autocomplete", {
select: null
},
+ dependencies: {
+ menu: $.ui.menu
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Multiple Requests</title>
<script src="jquery-1.6.1.js"></script>
<script src="amplify.core.js"></script>
<script src="amplify.request.js"></script>
<script>
var multiRequest = function( requests ) {
$.fn.widget = function( widget, options ) {
var isMethodCall = typeof widget === "string",
widgetName = widget.prototype.name,
args = [].slice.call( arguments, 2 );
return this.each( isMethodCall ?
function() {
var instance = $( this ).data( name );
instance[ options ].apply( instance, args );
} :
@scottgonzalez
scottgonzalez / amplify-store-cleanup.js
Created June 10, 2011 12:30
clean up extra key from amplify.store <1.0.0
// Prior to 1.0.0, amplify.store created a key to track all of the values
// that were stored. The 1.0.0 release no longer uses this key and as a
// result, if you ask for all of the values (using amplify.store()) you'll
// get back one extra value.
//
// Simply include this code after you include amplify.store and it will
// remove the extra key. You'll want to include this anywhere that you
// have previously used amplify.store.
(function() {
@scottgonzalez
scottgonzalez / 1.8.js
Created May 9, 2011 16:42
quick overview of extending jQuery UI widgets in 1.8 and 1.9
(function( $, prototype ) {
$.extend( prototype.options, {
spinner: "<em>Loading&#8230;</em>"
});
var _create = prototype._create;
prototype._create = function() {
_create.call( this );
var self = this;
amplify.request.ajaxPollErrors = {
404: true
};
amplify.request.types[ "ajax-poll" ] = function( resource ) {
var baseResourceId = "ajax-poll-" + resource.resourceId;
amplify.request.define( baseResourceId, "ajax", resource );
return function( settings, request ) {
(function( $ ) {
$( "a[data-replace]" ).live( "click", function( event ) {
var anchor = $( this ),
replace = $( "#" + anchor.attr( "data-replace" ) ),
href = anchor.attr( "href" );
replace
.trigger( "replaceSend", [ {
anchor: anchor,
/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0525\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0621-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971\u0972\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-
$.event.special.hijax = {
setup: function() {
$.event.add( this, "click.specialHijax", function( event, data ) {
if ( event.which !== 1 || event.metaKey || event.ctrlKey ) {
return;
}
event.type = "hijax";
event.liveFired = undefined;
return jQuery.event.trigger( event, data, event.target );
$.widget( "ui.autocomplete", $.ui.autocomplete, {
_suggest: function( items ) {
var menu = this.menu.element,
width = menu.width(),
height = menu.height();
this._super( "_suggest", items );
var newWidth = menu.width(),
newHeight = menu.height();
menu.css({
width: width,