]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: Update demos to use AMD
authorAlexander Schmitz <arschmitz@gmail.com>
Tue, 30 Jun 2015 19:22:59 +0000 (15:22 -0400)
committerAlexander Schmitz <arschmitz@gmail.com>
Tue, 21 Jul 2015 15:00:41 +0000 (11:00 -0400)
Ref #10119

12 files changed:
demos/autocomplete/categories.html
demos/autocomplete/combobox.html
demos/autocomplete/custom-data.html
demos/autocomplete/default.html
demos/autocomplete/folding.html
demos/autocomplete/maxheight.html
demos/autocomplete/multiple-remote.html
demos/autocomplete/multiple.html
demos/autocomplete/remote-jsonp.html
demos/autocomplete/remote-with-cache.html
demos/autocomplete/remote.html
demos/autocomplete/xml.html

index d986fdb11d301febba0243fd411fb0174b2cbc88..d2a107b53b474046f44831661ae59b9c73d902e0 100644 (file)
@@ -4,12 +4,6 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Categories</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .ui-autocomplete-category {
                line-height: 1.5;
        }
        </style>
-       <script>
-       $.widget( "custom.catcomplete", $.ui.autocomplete, {
-               _create: function() {
-                       this._super();
-                       this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" );
-               },
-               _renderMenu: function( ul, items ) {
-                       var that = this,
-                               currentCategory = "";
-                       $.each( items, function( index, item ) {
-                               var li;
-                               if ( item.category != currentCategory ) {
-                                       ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
-                                       currentCategory = item.category;
-                               }
-                               li = that._renderItemData( ul, item );
-                               if ( item.category ) {
-                                       li.attr( "aria-label", item.category + " : " + item.label );
-                               }
-                       });
-               }
-       });
-       </script>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
+               $.widget( "custom.catcomplete", $.ui.autocomplete, {
+                       _create: function() {
+                               this._super();
+                               this.widget().menu( "option", "items", "> :not(.ui-autocomplete-category)" );
+                       },
+                       _renderMenu: function( ul, items ) {
+                               var that = this,
+                                       currentCategory = "";
+                               $.each( items, function( index, item ) {
+                                       var li;
+                                       if ( item.category != currentCategory ) {
+                                               ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
+                                               currentCategory = item.category;
+                                       }
+                                       li = that._renderItemData( ul, item );
+                                       if ( item.category ) {
+                                               li.attr( "aria-label", item.category + " : " + item.label );
+                                       }
+                               });
+                       }
+               });
                var data = [
                        { label: "anders", category: "" },
                        { label: "andreas", category: "" },
@@ -60,7 +52,6 @@
                        delay: 0,
                        source: data
                });
-       });
        </script>
 </head>
 <body>
index 76d7924707a83ff3cfd7f2174dc563550a72ebc2..409e64d7c9dabe5e2234e881ff9573d8783cec6b 100644 (file)
@@ -4,14 +4,6 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Combobox</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/button.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
-       <script src="../../ui/tooltip.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .custom-combobox {
@@ -30,8 +22,8 @@
                padding: 5px 10px;
        }
        </style>
-       <script>
-       (function( $ ) {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js" data-modules="tooltip button">
                $.widget( "custom.combobox", {
                        _create: function() {
                                this.wrapper = $( "<span>" )
                                this.element.show();
                        }
                });
-       })( jQuery );
 
-       $(function() {
                $( "#combobox" ).combobox();
                $( "#toggle" ).on( "click", function() {
                        $( "#combobox" ).toggle();
                });
-       });
        </script>
 </head>
 <body>
index 1c94a877a220b88a5d37bf6d2dda6ba0c8de5126..06a777440a463ce652cbc53a10a0c9dc4f0b79f5 100644 (file)
@@ -4,12 +4,6 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Custom data and display</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        #project-label {
@@ -27,8 +21,8 @@
                padding: 0;
        }
        </style>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                var projects = [
                        {
                                value: "jquery",
@@ -71,7 +65,6 @@
                                .append( "<div>" + item.label + "<br>" + item.desc + "</div>" )
                                .appendTo( ul );
                };
-       });
        </script>
 </head>
 <body>
index f0ade5ea76421bb77c5ebea3593dcafa990f016e..49e575898a483cd39a70cc867a718ea2f4a9d105 100644 (file)
@@ -4,15 +4,9 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Default functionality</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                var availableTags = [
                        "ActionScript",
                        "AppleScript",
@@ -40,7 +34,6 @@
                $( "#tags" ).autocomplete({
                        source: availableTags
                });
-       });
        </script>
 </head>
 <body>
index 405809402f1add45d6801772247bf527f675d2af..98bc6bbb7f097324abefcc49779c6f56f81ba146 100644 (file)
@@ -4,15 +4,9 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Accent folding</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                var names = [ "Jörn Zaefferer", "Scott González", "John Resig" ];
 
                var accentMap = {
@@ -36,7 +30,6 @@
                                }) );
                        }
                });
-       });
        </script>
 </head>
 <body>
index 9d7961591d6cb06f4f1e654c9f2d5dcdbccf464a..8f65169c1425bfa735afcdf69d1e62154aeab329 100644 (file)
@@ -4,12 +4,6 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Scrollable results</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .ui-autocomplete {
@@ -25,8 +19,8 @@
                height: 100px;
        }
        </style>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                var availableTags = [
                        "ActionScript",
                        "AppleScript",
@@ -54,7 +48,6 @@
                $( "#tags" ).autocomplete({
                        source: availableTags
                });
-       });
        </script>
 </head>
 <body>
index 45f3198653d01cb7aa0033003fe40b84f7b51a3f..f263cf75c870bc1da2f4645d4f7cf0d4c49df469 100644 (file)
@@ -4,20 +4,14 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Multiple, remote</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .ui-autocomplete-loading {
                background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
        }
        </style>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                function split( val ) {
                        return val.split( /,\s*/ );
                }
@@ -62,7 +56,6 @@
                                        return false;
                                }
                        });
-       });
        </script>
 </head>
 <body>
index 1bd70f2289634df0bd7442fcc94e1f70884603c5..5ee4edb0a64e8be5cdcf82d1cc1a3349a9d203dd 100644 (file)
@@ -4,15 +4,9 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Multiple values</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                var availableTags = [
                        "ActionScript",
                        "AppleScript",
@@ -75,7 +69,6 @@
                                        return false;
                                }
                        });
-       });
        </script>
 </head>
 <body>
index 0d71dae9a7977ef3aaf479ccb723987b5564cb01..3c2f4921f24db15d9a95beb18b5ae600e5e17720 100644 (file)
@@ -4,12 +4,6 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Remote JSONP datasource</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .ui-autocomplete-loading {
@@ -17,8 +11,8 @@
        }
        #city { width: 25em; }
        </style>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                function log( message ) {
                        $( "<div>" ).text( message ).prependTo( "#log" );
                        $( "#log" ).scrollTop( 0 );
@@ -44,7 +38,6 @@
                                log( "Selected: " + ui.item.label );
                        }
                } );
-       } );
        </script>
 </head>
 <body>
index 1eea5eff137184c56dcdd53cdd57e8b3b0c2f5b3..4ab2fdefb2a60161b77a4aaa8e792d744153f0b4 100644 (file)
@@ -4,20 +4,14 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Remote with caching</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .ui-autocomplete-loading {
                background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
        }
        </style>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                var cache = {};
                $( "#birds" ).autocomplete({
                        minLength: 2,
@@ -34,7 +28,6 @@
                                });
                        }
                });
-       });
        </script>
 </head>
 <body>
index 95d2ae49ca890f581210a72702fb537c0843b94e..1993f8e6d17806765811d59c6b47013cb0145ee1 100644 (file)
@@ -4,20 +4,14 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - Remote datasource</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .ui-autocomplete-loading {
                background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
        }
        </style>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                function log( message ) {
                        $( "<div>" ).text( message ).prependTo( "#log" );
                        $( "#log" ).scrollTop( 0 );
@@ -32,7 +26,6 @@
                                        "Nothing selected, input was " + this.value );
                        }
                });
-       });
        </script>
 </head>
 <body>
index aa0394c10f075567273b9eda5cd228ede4549551..5bdf4d3cc54979c99b997b30ab7f3f0002fdffb6 100644 (file)
@@ -4,20 +4,14 @@
        <meta charset="utf-8">
        <title>jQuery UI Autocomplete - XML data parsed once</title>
        <link rel="stylesheet" href="../../themes/base/all.css">
-       <script src="../../external/jquery/jquery.js"></script>
-       <script src="../../ui/core.js"></script>
-       <script src="../../ui/widget.js"></script>
-       <script src="../../ui/position.js"></script>
-       <script src="../../ui/menu.js"></script>
-       <script src="../../ui/autocomplete.js"></script>
        <link rel="stylesheet" href="../demos.css">
        <style>
        .ui-autocomplete-loading {
                background: white url("images/ui-anim_basic_16x16.gif") right center no-repeat;
        }
        </style>
-       <script>
-       $(function() {
+       <script src="../../external/requirejs/require.js"></script>
+       <script src="../bootstrap.js">
                function log( message ) {
                        $( "<div/>" ).text( message ).prependTo( "#log" );
                        $( "#log" ).attr( "scrollTop", 0 );
@@ -45,7 +39,6 @@
                                });
                        }
                });
-       });
        </script>
 </head>
 <body>