Commit 89a5b6dc5de92a07cf5b5c760cf766fc7b92f3af

Authored by Braulio Bhavamitra
1 parent d6a6f2a4
Exists in staging

Move vendor javascripts used on application.js

Showing 1969 changed files with 235991 additions and 236891 deletions   Show diff stats

Too many changes.

To preserve performance only 100 of 1969 files displayed.

app/helpers/application_helper.rb
... ... @@ -984,8 +984,8 @@ module ApplicationHelper
984 984 end
985 985  
986 986 def add_zoom_to_images
987   - stylesheet_link_tag('jquery.fancybox') +
988   - javascript_include_tag('jquery.fancybox.pack') +
  987 + stylesheet_link_tag('vendor/jquery.fancybox') +
  988 + javascript_include_tag('vendor/jquery.fancybox.pack') +
989 989 javascript_tag("apply_zoom_to_images(#{_('Zoom in').to_json})")
990 990 end
991 991  
... ...
app/views/categories/_form.html.erb
1   -<%= stylesheet_link_tag 'spectrum.css' %>
2   -<%= javascript_include_tag "spectrum.js" %>
  1 +<%= stylesheet_link_tag 'vendor/spectrum.css' %>
  2 +<%= javascript_include_tag "vendor/spectrum.js" %>
3 3 <%= javascript_include_tag "colorpicker-noosfero.js" %>
4 4  
5 5 <%= error_messages_for 'category' %>
... ...
app/views/cms/_text_editor_sidebar.html.erb
... ... @@ -48,4 +48,4 @@
48 48 </script>
49 49  
50 50 <%= render :partial => 'media_new_folder', :locals => {:default_folder => default_folder} %>
51   -<%= javascript_include_tag 'jquery.fileupload.js', 'tmpl.js', 'media-panel.js' %>
  51 +<%= javascript_include_tag 'vendor/jquery.fileupload.js', 'vendor/tmpl.js', 'media-panel.js' %>
... ...
app/views/layouts/slideshow.html.erb
... ... @@ -11,7 +11,7 @@
11 11 %></title>
12 12  
13 13 <%= stylesheet_import "slideshow" %>
14   - <%= javascript_include_tag 'jquery-2.1.1.min', 'sliderjs', 'pikachoose' %>
  14 + <%= javascript_include_tag 'jquery-2.1.1.min', 'vendor/sliderjs', 'vendor/pikachoose' %>
15 15 <script type="text/javascript">
16 16 $(document).ready(function (){
17 17 $("#slideshow").PikaChoose({
... ...
app/views/shared/logged_in/xmpp_chat.html.erb
1   - <%= javascript_include_tag 'strophejs-1.1.3/strophe.min', 'jquery.emoticon', 'designs/icons/pidgin/emoticons.js', 'ba-linkify', 'jquery.ba-hashchange', 'jquery.sound', 'chat', 'vendor/perfect-scrollbar.min.js', 'vendor/perfect-scrollbar.with-mousewheel.min.js', 'jquery.timeago.js' %>
  1 + <%= javascript_include_tag 'vendor/strophejs-1.1.3/strophe.min', 'vendor/jquery.emoticon', 'designs/icons/pidgin/emoticons.js', 'vendor/ba-linkify', 'vendor/jquery.ba-hashchange', 'vendor/jquery.sound', 'chat', 'vendor/perfect-scrollbar.min.js', 'vendor/perfect-scrollbar.with-mousewheel.min.js', 'vendor/jquery.timeago.js' %>
2 2 <%= stylesheet_link_tag 'vendor/perfect-scrollbar.min.css' %>
3 3  
4 4 <% extend ChatHelper %>
... ...
config/Gemfile 0 → 100644
... ... @@ -0,0 +1 @@
  1 +gem 'pry'
... ...
plugins/fb_app/views/fb_app_plugin/_load.html.slim
1 1 = content_for :head do
2   - = javascript_include_tag 'typeahead.bundle.js'
3   - = stylesheet_link_tag 'typeahead'
  2 + = javascript_include_tag 'vendor/typeahead.bundle.js'
  3 + = stylesheet_link_tag 'vendor/typeahead'
4 4 = stylesheet_link_tag 'plugins/fb_app/stylesheets/bootstrap-tokenfield.css'
5 5 = stylesheet_link_tag 'plugins/fb_app/stylesheets/tokenfield-typeahead.css'
6 6 = javascript_include_tag 'plugins/fb_app/javascripts/bootstrap-tokenfield.js'
... ...
plugins/orders/views/orders_plugin_admin/_load.html.slim
1 1 = content_for :head do
2   - = javascript_include_tag 'typeahead.bundle.js'
3   - = stylesheet_link_tag 'typeahead'
  2 + = javascript_include_tag 'vendor/typeahead.bundle.js'
  3 + = stylesheet_link_tag 'vendor/typeahead'
... ...
plugins/suppliers/views/suppliers_plugin/manage_products/_basket_add.html.slim
1 1 = content_for :head do
2   - = javascript_include_tag 'typeahead.bundle.js'
3   - = stylesheet_link_tag 'typeahead'
  2 + = javascript_include_tag 'vendor/typeahead.bundle.js'
  3 + = stylesheet_link_tag 'vendor/typeahead'
4 4  
5 5 = text_field_tag :query, nil, id: 'basket-add', placeholder: t('suppliers_plugin.views.manage_products.basket_tab.search')
6 6  
... ...
public/javascripts/application.js
... ... @@ -2,36 +2,38 @@
2 2 // This file is automatically included by javascript_include_tag :defaults
3 3 /*
4 4 * third party libraries
5   -*= require lodash.js
6   -*= require jquery-2.1.1.min.js
7   -*= require jquery-migrate-1.2.1.js
8   -*= require jquery.cycle.all.min.js
9   -*= require jquery.colorbox-min.js
10   -*= require jquery-ui-1.10.4/js/jquery-ui-1.10.4.min.js
11   -*= require jquery.scrollTo.js
12   -*= require jquery.form.js
13   -*= require jquery-validation/jquery.validate.js
14   -*= require jquery.cookie.js
15   -*= require jquery.ba-bbq.min.js
16   -*= require jquery.tokeninput.js
17   -*= require jquery-timepicker-addon/dist/jquery-ui-timepicker-addon.js
18   -*= require inputosaurus.js
19   -*= require reflection.js
20   -*= require rails.js
21   -*= require jrails.js
  5 +*= require vendor/lodash.js
  6 +*= require vendor/jquery-2.1.1.min.js
  7 +*= require vendor/jquery-migrate-1.2.1.js
  8 +*= require vendor/jquery.cycle.all.min.js
  9 +*= require vendor/jquery.colorbox-min.js
  10 +*= require vendor/jquery-ui-1.10.4/js/jquery-ui-1.10.4.min.js
  11 +*= require vendor/jquery.scrollTo.js
  12 +*= require vendor/jquery.form.js
  13 +*= require vendor/jquery-validation/jquery.validate.js
  14 +*= require vendor/jquery.cookie.js
  15 +*= require vendor/jquery.ba-bbq.min.js
  16 +*= require vendor/jquery.tokeninput.js
  17 +*= require vendor/jquery-timepicker-addon/dist/jquery-ui-timepicker-addon.js
  18 +*= require vendor/inputosaurus.js
  19 +*= require vendor/reflection.js
  20 +*= require vendor/rails.js
  21 +*= require vendor/jrails.js
  22 +*= require vendor/slick.js
  23 +*= require vendor/autogrow.js
  24 +*
22 25 * noosfero libraries
23 26 *= require_self
24 27 *= require modal.js
25 28 *= require loading-overlay.js
26 29 *= require pagination.js
  30 +*
27 31 * views speficics
28 32 *= require add-and-join.js
29 33 *= require followers.js
30 34 *= require manage-followers.js
31 35 *= require report-abuse.js
32   -*= require autogrow.js
33 36 *= require require_login.js
34   -*= require slick.js
35 37 *= require block-store.js
36 38 *= require email_templates.js
37 39 */
... ...
public/javascripts/autogrow.js
... ... @@ -1,93 +0,0 @@
1   -;(function($){
2   - //pass in just the context as a $(obj) or a settings JS object
3   - $.fn.autogrow = function(opts) {
4   - var that = $(this).css({overflow: 'hidden', resize: 'none'}) //prevent scrollies
5   - , selector = that.selector
6   - , defaults = {
7   - context: $(document) //what to wire events to
8   - , animate: true //if you want the size change to animate
9   - , speed: 200 //speed of animation
10   - , fixMinHeight: true //if you don't want the box to shrink below its initial size
11   - , cloneClass: 'autogrowclone' //helper CSS class for clone if you need to add special rules
12   - , onInitialize: false //resizes the textareas when the plugin is initialized
13   - }
14   - ;
15   - opts = $.isPlainObject(opts) ? opts : {context: opts ? opts : $(document)};
16   - opts = $.extend({}, defaults, opts);
17   - that.each(function(i, elem){
18   - var min, clone;
19   - elem = $(elem);
20   - //if the element is "invisible", we get an incorrect height value
21   - //to get correct value, clone and append to the body.
22   - if (elem.is(':visible') || parseInt(elem.css('height'), 10) > 0) {
23   - min = parseInt(elem.css('height'), 10) || elem.innerHeight();
24   - } else {
25   - clone = elem.clone()
26   - .addClass(opts.cloneClass)
27   - .val(elem.val())
28   - .css({
29   - position: 'absolute'
30   - , visibility: 'hidden'
31   - , display: 'block'
32   - })
33   - ;
34   - $('body').append(clone);
35   - min = clone.innerHeight();
36   - clone.remove();
37   - }
38   - if (opts.fixMinHeight) {
39   - elem.data('autogrow-start-height', min); //set min height
40   - }
41   - elem.css('height', min);
42   -
43   - if (opts.onInitialize) {
44   - resize.call(elem);
45   - }
46   - });
47   - opts.context
48   - .on('keyup paste', selector, resize)
49   - ;
50   -
51   - function resize (e){
52   - var box = $(this)
53   - , oldHeight = box.innerHeight()
54   - , newHeight = this.scrollHeight
55   - , minHeight = box.data('autogrow-start-height') || 0
56   - , clone
57   - ;
58   - if (oldHeight < newHeight) { //user is typing
59   - this.scrollTop = 0; //try to reduce the top of the content hiding for a second
60   - opts.animate ? box.stop().animate({height: newHeight}, opts.speed) : box.innerHeight(newHeight);
61   - } else if (!e || e.which == 8 || e.which == 46 || (e.ctrlKey && e.which == 88)) { //user is deleting, backspacing, or cutting
62   - if (oldHeight > minHeight) { //shrink!
63   - //this cloning part is not particularly necessary. however, it helps with animation
64   - //since the only way to cleanly calculate where to shrink the box to is to incrementally
65   - //reduce the height of the box until the $.innerHeight() and the scrollHeight differ.
66   - //doing this on an exact clone to figure out the height first and then applying it to the
67   - //actual box makes it look cleaner to the user
68   - clone = box.clone()
69   - .addClass(opts.cloneClass) //add clone class for extra css rules
70   - .css({position: 'absolute', zIndex:-10}) //make "invisible"
71   - .val(box.val()) //populate with content for consistent measuring
72   - ;
73   - box.after(clone); //append as close to the box as possible for best CSS matching for clone
74   - do { //reduce height until they don't match
75   - newHeight = clone[0].scrollHeight - 1;
76   - clone.innerHeight(newHeight);
77   - } while (newHeight === clone[0].scrollHeight);
78   - newHeight++; //adding one back eliminates a wiggle on deletion
79   - clone.remove();
80   - box.focus(); // Fix issue with Chrome losing focus from the textarea.
81   -
82   - //if user selects all and deletes or holds down delete til beginning
83   - //user could get here and shrink whole box
84   - newHeight < minHeight && (newHeight = minHeight);
85   - oldHeight > newHeight && opts.animate ? box.stop().animate({height: newHeight}, opts.speed) : box.innerHeight(newHeight);
86   - } else { //just set to the minHeight
87   - box.innerHeight(minHeight);
88   - }
89   - }
90   - }
91   - return that;
92   - }
93   -})(jQuery);
public/javascripts/ba-linkify.js
... ... @@ -1,214 +0,0 @@
1   -/*!
2   - * JavaScript Linkify - v0.3 - 6/27/2009
3   - * http://benalman.com/projects/javascript-linkify/
4   - *
5   - * Copyright (c) 2009 "Cowboy" Ben Alman
6   - * Dual licensed under the MIT and GPL licenses.
7   - * http://benalman.com/about/license/
8   - *
9   - * Some regexps adapted from http://userscripts.org/scripts/review/7122
10   - */
11   -
12   -// Script: JavaScript Linkify: Process links in text!
13   -//
14   -// *Version: 0.3, Last updated: 6/27/2009*
15   -//
16   -// Project Home - http://benalman.com/projects/javascript-linkify/
17   -// GitHub - http://github.com/cowboy/javascript-linkify/
18   -// Source - http://github.com/cowboy/javascript-linkify/raw/master/ba-linkify.js
19   -// (Minified) - http://github.com/cowboy/javascript-linkify/raw/master/ba-linkify.min.js (2.8kb)
20   -//
21   -// About: License
22   -//
23   -// Copyright (c) 2009 "Cowboy" Ben Alman,
24   -// Dual licensed under the MIT and GPL licenses.
25   -// http://benalman.com/about/license/
26   -//
27   -// About: Examples
28   -//
29   -// This working example, complete with fully commented code, illustrates one way
30   -// in which this code can be used.
31   -//
32   -// Linkify - http://benalman.com/code/projects/javascript-linkify/examples/linkify/
33   -//
34   -// About: Support and Testing
35   -//
36   -// Information about what browsers this code has been tested in.
37   -//
38   -// Browsers Tested - Internet Explorer 6-8, Firefox 2-3.7, Safari 3-4, Chrome, Opera 9.6-10.
39   -//
40   -// About: Release History
41   -//
42   -// 0.3 - (6/27/2009) Initial release
43   -
44   -// Function: linkify
45   -//
46   -// Turn text into linkified html.
47   -//
48   -// Usage:
49   -//
50   -// > var html = linkify( text [, options ] );
51   -//
52   -// Arguments:
53   -//
54   -// text - (String) Non-HTML text containing links to be parsed.
55   -// options - (Object) An optional object containing linkify parse options.
56   -//
57   -// Options:
58   -//
59   -// callback (Function) - If specified, this will be called once for each link-
60   -// or non-link-chunk with two arguments, text and href. If the chunk is
61   -// non-link, href will be omitted. If unspecified, the default linkification
62   -// callback is used.
63   -// punct_regexp (RegExp) - A RegExp that will be used to trim trailing
64   -// punctuation from links, instead of the default. If set to null, trailing
65   -// punctuation will not be trimmed.
66   -//
67   -// Returns:
68   -//
69   -// (String) An HTML string containing links.
70   -
71   -window.linkify = (function(){
72   - var
73   - SCHEME = "[a-z\\d.-]+://",
74   - IPV4 = "(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",
75   - HOSTNAME = "(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",
76   - TLD = "(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",
77   - HOST_OR_IP = "(?:" + HOSTNAME + TLD + "|" + IPV4 + ")",
78   - PATH = "(?:[;/][^#?<>\\s]*)?",
79   - QUERY_FRAG = "(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",
80   - URI1 = "\\b" + SCHEME + "[^<>\\s]+",
81   - URI2 = "\\b" + HOST_OR_IP + PATH + QUERY_FRAG + "(?!\\w)",
82   -
83   - MAILTO = "mailto:",
84   - EMAIL = "(?:" + MAILTO + ")?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@" + HOST_OR_IP + QUERY_FRAG + "(?!\\w)",
85   -
86   - URI_RE = new RegExp( "(?:" + URI1 + "|" + URI2 + "|" + EMAIL + ")", "ig" ),
87   - SCHEME_RE = new RegExp( "^" + SCHEME, "i" ),
88   -
89   - quotes = {
90   - "'": "`",
91   - '>': '<',
92   - ')': '(',
93   - ']': '[',
94   - '}': '{',
95   - '»': '«',
96   - '›': '‹'
97   - },
98   -
99   - default_options = {
100   - callback: function( text, href ) {
101   - return href ? '<a href="' + href + '" title="' + href + '">' + text + '</a>' : text;
102   - },
103   - punct_regexp: /(?:[!?.,:;'"]|(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)$/
104   - };
105   -
106   - return function( txt, options ) {
107   - options = options || {};
108   -
109   - // Temp variables.
110   - var arr,
111   - i,
112   - link,
113   - href,
114   -
115   - // Output HTML.
116   - html = '',
117   -
118   - // Store text / link parts, in order, for re-combination.
119   - parts = [],
120   -
121   - // Used for keeping track of indices in the text.
122   - idx_prev,
123   - idx_last,
124   - idx,
125   - link_last,
126   -
127   - // Used for trimming trailing punctuation and quotes from links.
128   - matches_begin,
129   - matches_end,
130   - quote_begin,
131   - quote_end;
132   -
133   - // Initialize options.
134   - for ( i in default_options ) {
135   - if ( options[ i ] === undefined ) {
136   - options[ i ] = default_options[ i ];
137   - }
138   - }
139   -
140   - // Find links.
141   - while ( arr = URI_RE.exec( txt ) ) {
142   -
143   - link = arr[0];
144   - idx_last = URI_RE.lastIndex;
145   - idx = idx_last - link.length;
146   -
147   - // Not a link if preceded by certain characters.
148   - if ( /[\/:]/.test( txt.charAt( idx - 1 ) ) ) {
149   - continue;
150   - }
151   -
152   - // Trim trailing punctuation.
153   - do {
154   - // If no changes are made, we don't want to loop forever!
155   - link_last = link;
156   -
157   - quote_end = link.substr( -1 )
158   - quote_begin = quotes[ quote_end ];
159   -
160   - // Ending quote character?
161   - if ( quote_begin ) {
162   - matches_begin = link.match( new RegExp( '\\' + quote_begin + '(?!$)', 'g' ) );
163   - matches_end = link.match( new RegExp( '\\' + quote_end, 'g' ) );
164   -
165   - // If quotes are unbalanced, remove trailing quote character.
166   - if ( ( matches_begin ? matches_begin.length : 0 ) < ( matches_end ? matches_end.length : 0 ) ) {
167   - link = link.substr( 0, link.length - 1 );
168   - idx_last--;
169   - }
170   - }
171   -
172   - // Ending non-quote punctuation character?
173   - if ( options.punct_regexp ) {
174   - link = link.replace( options.punct_regexp, function(a){
175   - idx_last -= a.length;
176   - return '';
177   - });
178   - }
179   - } while ( link.length && link !== link_last );
180   -
181   - href = link;
182   -
183   - // Add appropriate protocol to naked links.
184   - if ( !SCHEME_RE.test( href ) ) {
185   - href = ( href.indexOf( '@' ) !== -1 ? ( !href.indexOf( MAILTO ) ? '' : MAILTO )
186   - : !href.indexOf( 'irc.' ) ? 'irc://'
187   - : !href.indexOf( 'ftp.' ) ? 'ftp://'
188   - : 'http://' )
189   - + href;
190   - }
191   -
192   - // Push preceding non-link text onto the array.
193   - if ( idx_prev != idx ) {
194   - parts.push([ txt.slice( idx_prev, idx ) ]);
195   - idx_prev = idx_last;
196   - }
197   -
198   - // Push massaged link onto the array
199   - parts.push([ link, href ]);
200   - };
201   -
202   - // Push remaining non-link text onto the array.
203   - parts.push([ txt.substr( idx_prev ) ]);
204   -
205   - // Process the array items.
206   - for ( i = 0; i < parts.length; i++ ) {
207   - html += options.callback.apply( window, parts[i] );
208   - }
209   -
210   - // In case of catastrophic failure, return the original text;
211   - return html || txt;
212   - };
213   -
214   -})();
215 0 \ No newline at end of file
public/javascripts/inputosaurus.js
... ... @@ -1,523 +0,0 @@
1   -/**
2   - * Inputosaurus Text
3   - *
4   - * Must be instantiated on an <input> element
5   - * Allows multiple input items. Each item is represented with a removable tag that appears to be inside the input area.
6   - *
7   - * @requires:
8   - *
9   - * jQuery 1.7+
10   - * jQueryUI 1.8+ Core
11   - *
12   - * @version 0.1.6
13   - * @author Dan Kielp <dan@sproutsocial.com>
14   - * @created October 3,2012
15   - *
16   - */
17   -
18   -
19   -(function($) {
20   -
21   - var inputosaurustext = {
22   -
23   - version: "0.1.6",
24   -
25   - eventprefix: "inputosaurus",
26   -
27   - options: {
28   -
29   - // bindable events
30   - //
31   - // 'change' - triggered whenever a tag is added or removed (should be similar to binding the the change event of the instantiated input
32   - // 'keyup' - keyup event on the newly created input
33   -
34   - // while typing, the user can separate values using these delimiters
35   - // the value tags are created on the fly when an inputDelimiter is detected
36   - inputDelimiters : [',', ';'],
37   -
38   - // this separator is used to rejoin all input items back to the value of the original <input>
39   - outputDelimiter : ',',
40   -
41   - allowDuplicates : false,
42   -
43   - parseOnBlur : false,
44   -
45   - // optional wrapper for widget
46   - wrapperElement : null,
47   -
48   - width : null,
49   -
50   - // simply passing an autoComplete source (array, string or function) will instantiate autocomplete functionality
51   - autoCompleteSource : '',
52   -
53   - // When forcing users to select from the autocomplete list, allow them to press 'Enter' to select an item if it's the only option left.
54   - activateFinalResult : false,
55   -
56   - // manipulate and return the input value after parseInput() parsing
57   - // the array of tag names is passed and expected to be returned as an array after manipulation
58   - parseHook : null,
59   -
60   - // define a placeholder to display when the input is empty
61   - placeholder: null,
62   -
63   - // when you check for duplicates it check for the case
64   - caseSensitiveDuplicates: false
65   - },
66   -
67   - _create: function() {
68   - var widget = this,
69   - els = {},
70   - o = widget.options,
71   - placeholder = o.placeholder || this.element.attr('placeholder') || null;
72   -
73   - this._chosenValues = [];
74   -
75   - // Create the elements
76   - els.ul = $('<ul class="inputosaurus-container">');
77   - els.input = $('<input type="text" />');
78   - els.inputCont = $('<li class="inputosaurus-input inputosaurus-required"></li>');
79   - els.origInputCont = $('<li class="inputosaurus-input-hidden inputosaurus-required">');
80   -
81   - // define starting placeholder
82   - if (placeholder) {
83   - o.placeholder = placeholder;
84   - els.input.attr('placeholder', o.placeholder);
85   - if (o.width) {
86   - els.input.css('min-width', o.width - 50);
87   - }
88   - }
89   -
90   - o.wrapperElement && o.wrapperElement.append(els.ul);
91   - this.element.replaceWith(o.wrapperElement || els.ul);
92   - els.origInputCont.append(this.element).hide();
93   -
94   - els.inputCont.append(els.input);
95   - els.ul.append(els.inputCont);
96   - els.ul.append(els.origInputCont);
97   -
98   - o.width && els.ul.css('width', o.width);
99   -
100   - this.elements = els;
101   -
102   - widget._attachEvents();
103   -
104   - // if instantiated input already contains a value, parse that junk
105   - if($.trim(this.element.val())){
106   - els.input.val( this.element.val() );
107   - this.parseInput();
108   - }
109   -
110   - this._instAutocomplete();
111   - },
112   -
113   - _instAutocomplete : function() {
114   - if(this.options.autoCompleteSource){
115   - var widget = this;
116   -
117   - this.elements.input.autocomplete({
118   - position : {
119   - of : this.elements.ul
120   - },
121   - source : this.options.autoCompleteSource,
122   - minLength : 1,
123   - select : function(ev, ui){
124   - ev.preventDefault();
125   - widget.elements.input.val(ui.item.value);
126   - widget.parseInput();
127   - },
128   - open : function() {
129   - // Older versions of jQueryUI have a different namespace
130   - var auto = $(this).data('ui-autocomplete') || $(this).data('autocomplete');
131   - var menu = auto.menu,
132   - $menuItems;
133   -
134   -
135   - // zIndex will force the element on top of anything (like a dialog it's in)
136   - menu.element.zIndex && menu.element.zIndex($(this).zIndex() + 1);
137   - menu.element.width(widget.elements.ul.outerWidth());
138   -
139   - // auto-activate the result if it's the only one
140   - if(widget.options.activateFinalResult){
141   - $menuItems = menu.element.find('li');
142   -
143   - // activate single item to allow selection upon pressing 'Enter'
144   - if($menuItems.size() === 1){
145   - menu[menu.activate ? 'activate' : 'focus']($.Event('click'), $menuItems);
146   - }
147   - }
148   - }
149   - });
150   - }
151   - },
152   -
153   - _autoCompleteMenuPosition : function() {
154   - var widget;
155   - if(this.options.autoCompleteSource){
156   - widget = this.elements.input.data('ui-autocomplete') || this.elements.input.data('autocomplete');
157   - widget && widget.menu.element.position({
158   - of: this.elements.ul,
159   - my: 'left top',
160   - at: 'left bottom',
161   - collision: 'none'
162   - });
163   - }
164   - },
165   -
166   - /*_closeAutoCompleteMenu : function() {
167   - if(this.options.autoCompleteSource){
168   - this.elements.input.autocomplete('close');
169   - }
170   - },*/
171   -
172   - parseInput : function(ev) {
173   - var widget = (ev && ev.data.widget) || this,
174   - val,
175   - delimiterFound = false,
176   - values = [];
177   -
178   - val = widget.elements.input.val();
179   -
180   - val && (delimiterFound = widget._containsDelimiter(val));
181   -
182   - if(delimiterFound !== false){
183   - values = val.split(delimiterFound);
184   - } else if(!ev || ev.which === $.ui.keyCode.ENTER && !$('.ui-menu-item.ui-state-focus').size() && !$('.ui-menu-item .ui-state-focus').size() && !$('#ui-active-menuitem').size()){
185   - values.push(val);
186   - ev && ev.preventDefault();
187   -
188   - // prevent autoComplete menu click from causing a false 'blur'
189   - } else if(ev.type === 'blur' && !$('#ui-active-menuitem').size()){
190   - values.push(val);
191   - }
192   -
193   - $.isFunction(widget.options.parseHook) && (values = widget.options.parseHook(values));
194   -
195   - if(values.length){
196   - widget._setChosen(values);
197   - widget.elements.input.val('');
198   - widget._resizeInput();
199   - }
200   -
201   - widget._resetPlaceholder();
202   - },
203   -
204   - _inputFocus : function(ev) {
205   - var widget = ev.data.widget || this;
206   -
207   - widget.elements.input.value || (widget.options.autoCompleteSource.length && widget.elements.input.autocomplete('search', ''));
208   - },
209   -
210   - _inputKeypress : function(ev) {
211   - var widget = ev.data.widget || this;
212   -
213   - ev.type === 'keyup' && widget._trigger('keyup', ev, widget);
214   -
215   - switch(ev.which){
216   - case $.ui.keyCode.BACKSPACE:
217   - ev.type === 'keydown' && widget._inputBackspace(ev);
218   - break;
219   -
220   - case $.ui.keyCode.LEFT:
221   - ev.type === 'keydown' && widget._inputBackspace(ev);
222   - break;
223   -
224   - default :
225   - widget.parseInput(ev);
226   - widget._resizeInput(ev);
227   - }
228