semantic_ui_rails 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +4 -0
- data/Rakefile +1 -0
- data/app/assets/fonts/semantic/icons.eot +0 -0
- data/app/assets/fonts/semantic/icons.svg +450 -0
- data/app/assets/fonts/semantic/icons.ttf +0 -0
- data/app/assets/fonts/semantic/icons.woff +0 -0
- data/app/assets/images/semantic/loader-large-inverted.gif +0 -0
- data/app/assets/images/semantic/loader-large.gif +0 -0
- data/app/assets/images/semantic/loader-medium-inverted.gif +0 -0
- data/app/assets/images/semantic/loader-medium.gif +0 -0
- data/app/assets/images/semantic/loader-mini-inverted.gif +0 -0
- data/app/assets/images/semantic/loader-mini.gif +0 -0
- data/app/assets/images/semantic/loader-small-inverted.gif +0 -0
- data/app/assets/images/semantic/loader-small.gif +0 -0
- data/app/assets/javascript/semantic/accordion.js +411 -0
- data/app/assets/javascript/semantic/behavior/api.js +666 -0
- data/app/assets/javascript/semantic/behavior/colorize.js +271 -0
- data/app/assets/javascript/semantic/behavior/form.js +703 -0
- data/app/assets/javascript/semantic/behavior/state.js +752 -0
- data/app/assets/javascript/semantic/chatroom.js +766 -0
- data/app/assets/javascript/semantic/checkbox.js +348 -0
- data/app/assets/javascript/semantic/dimmer.js +524 -0
- data/app/assets/javascript/semantic/dropdown.js +707 -0
- data/app/assets/javascript/semantic/modal.js +478 -0
- data/app/assets/javascript/semantic/nag.js +542 -0
- data/app/assets/javascript/semantic/popup.js +721 -0
- data/app/assets/javascript/semantic/rating.js +358 -0
- data/app/assets/javascript/semantic/search.js +769 -0
- data/app/assets/javascript/semantic/shape.js +776 -0
- data/app/assets/javascript/semantic/sidebar.js +489 -0
- data/app/assets/javascript/semantic/tab.js +674 -0
- data/app/assets/javascript/semantic/transition.js +650 -0
- data/app/assets/javascript/semantic/video.js +459 -0
- data/app/assets/stylesheets/semantic/accordion.css +97 -0
- data/app/assets/stylesheets/semantic/breadcrumb.css +66 -0
- data/app/assets/stylesheets/semantic/button.css +993 -0
- data/app/assets/stylesheets/semantic/chatroom.css +242 -0
- data/app/assets/stylesheets/semantic/checkbox.css +300 -0
- data/app/assets/stylesheets/semantic/comment.css +178 -0
- data/app/assets/stylesheets/semantic/dimmer.css +185 -0
- data/app/assets/stylesheets/semantic/divider.css +155 -0
- data/app/assets/stylesheets/semantic/dropdown.css +415 -0
- data/app/assets/stylesheets/semantic/feed.css +126 -0
- data/app/assets/stylesheets/semantic/form.css +427 -0
- data/app/assets/stylesheets/semantic/grid.css +561 -0
- data/app/assets/stylesheets/semantic/header.css +277 -0
- data/app/assets/stylesheets/semantic/icon.css +811 -0
- data/app/assets/stylesheets/semantic/image.css +143 -0
- data/app/assets/stylesheets/semantic/input.css +225 -0
- data/app/assets/stylesheets/semantic/item.css +564 -0
- data/app/assets/stylesheets/semantic/label.css +687 -0
- data/app/assets/stylesheets/semantic/list.css +418 -0
- data/app/assets/stylesheets/semantic/loader.css +148 -0
- data/app/assets/stylesheets/semantic/menu.css +1409 -0
- data/app/assets/stylesheets/semantic/message.css +242 -0
- data/app/assets/stylesheets/semantic/modal.css +123 -0
- data/app/assets/stylesheets/semantic/nag.css +130 -0
- data/app/assets/stylesheets/semantic/popup.css +209 -0
- data/app/assets/stylesheets/semantic/progress.css +257 -0
- data/app/assets/stylesheets/semantic/rating.css +120 -0
- data/app/assets/stylesheets/semantic/reveal.css +283 -0
- data/app/assets/stylesheets/semantic/search.css +222 -0
- data/app/assets/stylesheets/semantic/segment.css +362 -0
- data/app/assets/stylesheets/semantic/shape.css +87 -0
- data/app/assets/stylesheets/semantic/sidebar.css +100 -0
- data/app/assets/stylesheets/semantic/step.css +240 -0
- data/app/assets/stylesheets/semantic/tab.css +52 -0
- data/app/assets/stylesheets/semantic/table.css +468 -0
- data/app/assets/stylesheets/semantic/transition.css +867 -0
- data/app/assets/stylesheets/semantic/video.css +81 -0
- data/lib/semantic_ui_rails/version.rb +3 -0
- data/lib/semantic_ui_rails.rb +7 -0
- data/semantic_ui_rails.gemspec +23 -0
- metadata +149 -0
| @@ -0,0 +1,769 @@ | |
| 1 | 
            +
            /*  ******************************
         | 
| 2 | 
            +
              Search Prompt
         | 
| 3 | 
            +
              Author: Jack Lukic
         | 
| 4 | 
            +
             | 
| 5 | 
            +
              Designed to be used as an autocomplete
         | 
| 6 | 
            +
              or to deliver quick inline search results
         | 
| 7 | 
            +
            ******************************  */
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ;(function ($, window, document, undefined) {
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            $.fn.search = function(source, parameters) {
         | 
| 12 | 
            +
              var
         | 
| 13 | 
            +
                $allModules     = $(this),
         | 
| 14 | 
            +
                settings        = $.extend(true, {}, $.fn.search.settings, parameters),
         | 
| 15 | 
            +
             | 
| 16 | 
            +
             | 
| 17 | 
            +
                className       = settings.className,
         | 
| 18 | 
            +
                selector        = settings.selector,
         | 
| 19 | 
            +
                error           = settings.error,
         | 
| 20 | 
            +
                namespace       = settings.namespace,
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                eventNamespace  = '.' + namespace,
         | 
| 23 | 
            +
                moduleNamespace = namespace + '-module',
         | 
| 24 | 
            +
                moduleSelector  = $allModules.selector || '',
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                time            = new Date().getTime(),
         | 
| 27 | 
            +
                performance     = [],
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                query           = arguments[0],
         | 
| 30 | 
            +
                methodInvoked   = (typeof query == 'string'),
         | 
| 31 | 
            +
                queryArguments  = [].slice.call(arguments, 1),
         | 
| 32 | 
            +
                invokedResponse
         | 
| 33 | 
            +
              ;
         | 
| 34 | 
            +
              $(this)
         | 
| 35 | 
            +
                .each(function() {
         | 
| 36 | 
            +
                  var
         | 
| 37 | 
            +
                    $module       = $(this),
         | 
| 38 | 
            +
                    $prompt       = $module.find(selector.prompt),
         | 
| 39 | 
            +
                    $searchButton = $module.find(selector.searchButton),
         | 
| 40 | 
            +
                    $results      = $module.find(selector.results),
         | 
| 41 | 
            +
                    $result       = $module.find(selector.result),
         | 
| 42 | 
            +
                    $category     = $module.find(selector.category),
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    element       = this,
         | 
| 45 | 
            +
                    instance      = $module.data(moduleNamespace),
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                    module
         | 
| 48 | 
            +
                  ;
         | 
| 49 | 
            +
                  module = {
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                    initialize: function() {
         | 
| 52 | 
            +
                      module.verbose('Initializing module');
         | 
| 53 | 
            +
                      var
         | 
| 54 | 
            +
                        prompt = $prompt[0],
         | 
| 55 | 
            +
                        inputEvent   = (prompt.oninput !== undefined)
         | 
| 56 | 
            +
                          ? 'input'
         | 
| 57 | 
            +
                          : (prompt.onpropertychange !== undefined)
         | 
| 58 | 
            +
                            ? 'propertychange'
         | 
| 59 | 
            +
                            : 'keyup'
         | 
| 60 | 
            +
                      ;
         | 
| 61 | 
            +
                      // attach events
         | 
| 62 | 
            +
                      $prompt
         | 
| 63 | 
            +
                        .on('focus' + eventNamespace, module.event.focus)
         | 
| 64 | 
            +
                        .on('blur' + eventNamespace, module.event.blur)
         | 
| 65 | 
            +
                        .on('keydown' + eventNamespace, module.handleKeyboard)
         | 
| 66 | 
            +
                      ;
         | 
| 67 | 
            +
                      if(settings.automatic) {
         | 
| 68 | 
            +
                        $prompt
         | 
| 69 | 
            +
                          .on(inputEvent + eventNamespace, module.search.throttle)
         | 
| 70 | 
            +
                        ;
         | 
| 71 | 
            +
                      }
         | 
| 72 | 
            +
                      $searchButton
         | 
| 73 | 
            +
                        .on('click' + eventNamespace, module.search.query)
         | 
| 74 | 
            +
                      ;
         | 
| 75 | 
            +
                      $results
         | 
| 76 | 
            +
                        .on('click' + eventNamespace, selector.result, module.results.select)
         | 
| 77 | 
            +
                      ;
         | 
| 78 | 
            +
                      module.instantiate();
         | 
| 79 | 
            +
                    },
         | 
| 80 | 
            +
                    instantiate: function() {
         | 
| 81 | 
            +
                      module.verbose('Storing instance of module', module);
         | 
| 82 | 
            +
                      instance = module;
         | 
| 83 | 
            +
                      $module
         | 
| 84 | 
            +
                        .data(moduleNamespace, module)
         | 
| 85 | 
            +
                      ;
         | 
| 86 | 
            +
                    },
         | 
| 87 | 
            +
                    destroy: function() {
         | 
| 88 | 
            +
                      module.verbose('Destroying instance');
         | 
| 89 | 
            +
                      $module
         | 
| 90 | 
            +
                        .removeData(moduleNamespace)
         | 
| 91 | 
            +
                      ;
         | 
| 92 | 
            +
                    },
         | 
| 93 | 
            +
                    event: {
         | 
| 94 | 
            +
                      focus: function() {
         | 
| 95 | 
            +
                        $module
         | 
| 96 | 
            +
                          .addClass(className.focus)
         | 
| 97 | 
            +
                        ;
         | 
| 98 | 
            +
                        module.results.show();
         | 
| 99 | 
            +
                      },
         | 
| 100 | 
            +
                      blur: function() {
         | 
| 101 | 
            +
                        module.search.cancel();
         | 
| 102 | 
            +
                        $module
         | 
| 103 | 
            +
                          .removeClass(className.focus)
         | 
| 104 | 
            +
                        ;
         | 
| 105 | 
            +
                        module.results.hide();
         | 
| 106 | 
            +
                      }
         | 
| 107 | 
            +
                    },
         | 
| 108 | 
            +
                    handleKeyboard: function(event) {
         | 
| 109 | 
            +
                      var
         | 
| 110 | 
            +
                        // force latest jq dom
         | 
| 111 | 
            +
                        $result       = $module.find(selector.result),
         | 
| 112 | 
            +
                        $category     = $module.find(selector.category),
         | 
| 113 | 
            +
                        keyCode       = event.which,
         | 
| 114 | 
            +
                        keys          = {
         | 
| 115 | 
            +
                          backspace : 8,
         | 
| 116 | 
            +
                          enter     : 13,
         | 
| 117 | 
            +
                          escape    : 27,
         | 
| 118 | 
            +
                          upArrow   : 38,
         | 
| 119 | 
            +
                          downArrow : 40
         | 
| 120 | 
            +
                        },
         | 
| 121 | 
            +
                        activeClass  = className.active,
         | 
| 122 | 
            +
                        currentIndex = $result.index( $result.filter('.' + activeClass) ),
         | 
| 123 | 
            +
                        resultSize   = $result.size(),
         | 
| 124 | 
            +
                        newIndex
         | 
| 125 | 
            +
                      ;
         | 
| 126 | 
            +
                      // search shortcuts
         | 
| 127 | 
            +
                      if(keyCode == keys.escape) {
         | 
| 128 | 
            +
                        module.verbose('Escape key pressed, blurring search field');
         | 
| 129 | 
            +
                        $prompt
         | 
| 130 | 
            +
                          .trigger('blur')
         | 
| 131 | 
            +
                        ;
         | 
| 132 | 
            +
                      }
         | 
| 133 | 
            +
                      // result shortcuts
         | 
| 134 | 
            +
                      if($results.filter(':visible').size() > 0) {
         | 
| 135 | 
            +
                        if(keyCode == keys.enter) {
         | 
| 136 | 
            +
                          module.verbose('Enter key pressed, selecting active result');
         | 
| 137 | 
            +
                          if( $result.filter('.' + activeClass).exists() ) {
         | 
| 138 | 
            +
                            $.proxy(module.results.select, $result.filter('.' + activeClass) )();
         | 
| 139 | 
            +
                            event.preventDefault();
         | 
| 140 | 
            +
                            return false;
         | 
| 141 | 
            +
                          }
         | 
| 142 | 
            +
                        }
         | 
| 143 | 
            +
                        else if(keyCode == keys.upArrow) {
         | 
| 144 | 
            +
                          module.verbose('Up key pressed, changing active result');
         | 
| 145 | 
            +
                          newIndex = (currentIndex - 1 < 0)
         | 
| 146 | 
            +
                            ? currentIndex
         | 
| 147 | 
            +
                            : currentIndex - 1
         | 
| 148 | 
            +
                          ;
         | 
| 149 | 
            +
                          $category
         | 
| 150 | 
            +
                            .removeClass(activeClass)
         | 
| 151 | 
            +
                          ;
         | 
| 152 | 
            +
                          $result
         | 
| 153 | 
            +
                            .removeClass(activeClass)
         | 
| 154 | 
            +
                            .eq(newIndex)
         | 
| 155 | 
            +
                              .addClass(activeClass)
         | 
| 156 | 
            +
                              .closest($category)
         | 
| 157 | 
            +
                                .addClass(activeClass)
         | 
| 158 | 
            +
                          ;
         | 
| 159 | 
            +
                          event.preventDefault();
         | 
| 160 | 
            +
                        }
         | 
| 161 | 
            +
                        else if(keyCode == keys.downArrow) {
         | 
| 162 | 
            +
                          module.verbose('Down key pressed, changing active result');
         | 
| 163 | 
            +
                          newIndex = (currentIndex + 1 >= resultSize)
         | 
| 164 | 
            +
                            ? currentIndex
         | 
| 165 | 
            +
                            : currentIndex + 1
         | 
| 166 | 
            +
                          ;
         | 
| 167 | 
            +
                          $category
         | 
| 168 | 
            +
                            .removeClass(activeClass)
         | 
| 169 | 
            +
                          ;
         | 
| 170 | 
            +
                          $result
         | 
| 171 | 
            +
                            .removeClass(activeClass)
         | 
| 172 | 
            +
                            .eq(newIndex)
         | 
| 173 | 
            +
                              .addClass(activeClass)
         | 
| 174 | 
            +
                              .closest($category)
         | 
| 175 | 
            +
                                .addClass(activeClass)
         | 
| 176 | 
            +
                          ;
         | 
| 177 | 
            +
                          event.preventDefault();
         | 
| 178 | 
            +
                        }
         | 
| 179 | 
            +
                      }
         | 
| 180 | 
            +
                      else {
         | 
| 181 | 
            +
                        // query shortcuts
         | 
| 182 | 
            +
                        if(keyCode == keys.enter) {
         | 
| 183 | 
            +
                          module.verbose('Enter key pressed, executing query');
         | 
| 184 | 
            +
                          module.search.query();
         | 
| 185 | 
            +
                          $searchButton
         | 
| 186 | 
            +
                            .addClass(className.down)
         | 
| 187 | 
            +
                          ;
         | 
| 188 | 
            +
                          $prompt
         | 
| 189 | 
            +
                            .one('keyup', function(){
         | 
| 190 | 
            +
                              $searchButton
         | 
| 191 | 
            +
                                .removeClass(className.down)
         | 
| 192 | 
            +
                              ;
         | 
| 193 | 
            +
                            })
         | 
| 194 | 
            +
                          ;
         | 
| 195 | 
            +
                        }
         | 
| 196 | 
            +
                      }
         | 
| 197 | 
            +
                    },
         | 
| 198 | 
            +
                    search: {
         | 
| 199 | 
            +
                      cancel: function() {
         | 
| 200 | 
            +
                        var
         | 
| 201 | 
            +
                          xhr = $module.data('xhr') || false
         | 
| 202 | 
            +
                        ;
         | 
| 203 | 
            +
                        if( xhr && xhr.state() != 'resolved') {
         | 
| 204 | 
            +
                          module.debug('Cancelling last search');
         | 
| 205 | 
            +
                          xhr.abort();
         | 
| 206 | 
            +
                        }
         | 
| 207 | 
            +
                      },
         | 
| 208 | 
            +
                      throttle: function() {
         | 
| 209 | 
            +
                        var
         | 
| 210 | 
            +
                          searchTerm    = $prompt.val(),
         | 
| 211 | 
            +
                          numCharacters = searchTerm.length
         | 
| 212 | 
            +
                        ;
         | 
| 213 | 
            +
                        clearTimeout(module.timer);
         | 
| 214 | 
            +
                        if(numCharacters >= settings.minCharacters)  {
         | 
| 215 | 
            +
                          module.timer = setTimeout(module.search.query, settings.searchThrottle);
         | 
| 216 | 
            +
                        }
         | 
| 217 | 
            +
                        else {
         | 
| 218 | 
            +
                          module.results.hide();
         | 
| 219 | 
            +
                        }
         | 
| 220 | 
            +
                      },
         | 
| 221 | 
            +
                      query: function() {
         | 
| 222 | 
            +
                        var
         | 
| 223 | 
            +
                          searchTerm = $prompt.val(),
         | 
| 224 | 
            +
                          cachedHTML = module.search.cache.read(searchTerm)
         | 
| 225 | 
            +
                        ;
         | 
| 226 | 
            +
                        if(cachedHTML) {
         | 
| 227 | 
            +
                          module.debug("Reading result for '" + searchTerm + "' from cache");
         | 
| 228 | 
            +
                          module.results.add(cachedHTML);
         | 
| 229 | 
            +
                        }
         | 
| 230 | 
            +
                        else {
         | 
| 231 | 
            +
                          module.debug("Querying for '" + searchTerm + "'");
         | 
| 232 | 
            +
                          if(typeof source == 'object') {
         | 
| 233 | 
            +
                            module.search.local(searchTerm);
         | 
| 234 | 
            +
                          }
         | 
| 235 | 
            +
                          else {
         | 
| 236 | 
            +
                            module.search.remote(searchTerm);
         | 
| 237 | 
            +
                          }
         | 
| 238 | 
            +
                          $.proxy(settings.onSearchQuery, $module)(searchTerm);
         | 
| 239 | 
            +
                        }
         | 
| 240 | 
            +
                      },
         | 
| 241 | 
            +
                      local: function(searchTerm) {
         | 
| 242 | 
            +
                        var
         | 
| 243 | 
            +
                          results   = [],
         | 
| 244 | 
            +
                          fullTextResults = [],
         | 
| 245 | 
            +
                          searchFields    = $.isArray(settings.searchFields)
         | 
| 246 | 
            +
                            ? settings.searchFields
         | 
| 247 | 
            +
                            : [settings.searchFields],
         | 
| 248 | 
            +
             | 
| 249 | 
            +
                          searchRegExp   = new RegExp('(?:\s|^)' + searchTerm, 'i'),
         | 
| 250 | 
            +
                          fullTextRegExp = new RegExp(searchTerm, 'i'),
         | 
| 251 | 
            +
                          searchHTML
         | 
| 252 | 
            +
                        ;
         | 
| 253 | 
            +
                        $module
         | 
| 254 | 
            +
                          .addClass(className.loading)
         | 
| 255 | 
            +
                        ;
         | 
| 256 | 
            +
                        // iterate through search fields in array order
         | 
| 257 | 
            +
                        $.each(searchFields, function(index, field) {
         | 
| 258 | 
            +
                          $.each(source, function(label, thing) {
         | 
| 259 | 
            +
                            if(typeof thing[field] == 'string' && ($.inArray(thing, results) == -1) && ($.inArray(thing, fullTextResults) == -1) ) {
         | 
| 260 | 
            +
                              if( searchRegExp.test( thing[field] ) ) {
         | 
| 261 | 
            +
                                results.push(thing);
         | 
| 262 | 
            +
                              }
         | 
| 263 | 
            +
                              else if( fullTextRegExp.test( thing[field] ) ) {
         | 
| 264 | 
            +
                                fullTextResults.push(thing);
         | 
| 265 | 
            +
                              }
         | 
| 266 | 
            +
                            }
         | 
| 267 | 
            +
                          });
         | 
| 268 | 
            +
                        });
         | 
| 269 | 
            +
                        searchHTML = module.results.generate({
         | 
| 270 | 
            +
                          results: $.merge(results, fullTextResults)
         | 
| 271 | 
            +
                        });
         | 
| 272 | 
            +
                        $module
         | 
| 273 | 
            +
                          .removeClass(className.loading)
         | 
| 274 | 
            +
                        ;
         | 
| 275 | 
            +
                        module.search.cache.write(searchTerm, searchHTML);
         | 
| 276 | 
            +
                        module.results.add(searchHTML);
         | 
| 277 | 
            +
                      },
         | 
| 278 | 
            +
                      remote: function(searchTerm) {
         | 
| 279 | 
            +
                        var
         | 
| 280 | 
            +
                          apiSettings = {
         | 
| 281 | 
            +
                            stateContext  : $module,
         | 
| 282 | 
            +
                            url           : source,
         | 
| 283 | 
            +
                            urlData: { query: searchTerm },
         | 
| 284 | 
            +
                            success       : function(response) {
         | 
| 285 | 
            +
                              searchHTML = module.results.generate(response);
         | 
| 286 | 
            +
                              module.search.cache.write(searchTerm, searchHTML);
         | 
| 287 | 
            +
                              module.results.add(searchHTML);
         | 
| 288 | 
            +
                            },
         | 
| 289 | 
            +
                            failure      : module.error
         | 
| 290 | 
            +
                          },
         | 
| 291 | 
            +
                          searchHTML
         | 
| 292 | 
            +
                        ;
         | 
| 293 | 
            +
                        module.search.cancel();
         | 
| 294 | 
            +
                        module.debug('Executing search');
         | 
| 295 | 
            +
                        $.extend(true, apiSettings, settings.apiSettings);
         | 
| 296 | 
            +
                        $.api(apiSettings);
         | 
| 297 | 
            +
                      },
         | 
| 298 | 
            +
             | 
| 299 | 
            +
                      cache: {
         | 
| 300 | 
            +
                        read: function(name) {
         | 
| 301 | 
            +
                          var
         | 
| 302 | 
            +
                            cache = $module.data('cache')
         | 
| 303 | 
            +
                          ;
         | 
| 304 | 
            +
                          return (settings.cache && (typeof cache == 'object') && (cache[name] !== undefined) )
         | 
| 305 | 
            +
                            ? cache[name]
         | 
| 306 | 
            +
                            : false
         | 
| 307 | 
            +
                          ;
         | 
| 308 | 
            +
                        },
         | 
| 309 | 
            +
                        write: function(name, value) {
         | 
| 310 | 
            +
                          var
         | 
| 311 | 
            +
                            cache = ($module.data('cache') !== undefined)
         | 
| 312 | 
            +
                              ? $module.data('cache')
         | 
| 313 | 
            +
                              : {}
         | 
| 314 | 
            +
                          ;
         | 
| 315 | 
            +
                          cache[name] = value;
         | 
| 316 | 
            +
                          $module
         | 
| 317 | 
            +
                            .data('cache', cache)
         | 
| 318 | 
            +
                          ;
         | 
| 319 | 
            +
                        }
         | 
| 320 | 
            +
                      }
         | 
| 321 | 
            +
                    },
         | 
| 322 | 
            +
             | 
| 323 | 
            +
                    results: {
         | 
| 324 | 
            +
                      generate: function(response) {
         | 
| 325 | 
            +
                        module.debug('Generating html from response', response);
         | 
| 326 | 
            +
                        var
         | 
| 327 | 
            +
                          template = settings.templates[settings.type],
         | 
| 328 | 
            +
                          html     = ''
         | 
| 329 | 
            +
                        ;
         | 
| 330 | 
            +
                        if(($.isPlainObject(response.results) && !$.isEmptyObject(response.results)) || ($.isArray(response.results) && response.results.length > 0) ) {
         | 
| 331 | 
            +
                          if(settings.maxResults > 0) {
         | 
| 332 | 
            +
                            response.results = $.makeArray(response.results).slice(0, settings.maxResults);
         | 
| 333 | 
            +
                          }
         | 
| 334 | 
            +
                          if(response.results.length > 0) {
         | 
| 335 | 
            +
                            if($.isFunction(template)) {
         | 
| 336 | 
            +
                              html = template(response);
         | 
| 337 | 
            +
                            }
         | 
| 338 | 
            +
                            else {
         | 
| 339 | 
            +
                              module.error(error.noTemplate, false);
         | 
| 340 | 
            +
                            }
         | 
| 341 | 
            +
                          }
         | 
| 342 | 
            +
                        }
         | 
| 343 | 
            +
                        else {
         | 
| 344 | 
            +
                          html = module.message(error.noResults, 'empty');
         | 
| 345 | 
            +
                        }
         | 
| 346 | 
            +
                        $.proxy(settings.onResults, $module)(response);
         | 
| 347 | 
            +
                        return html;
         | 
| 348 | 
            +
                      },
         | 
| 349 | 
            +
                      add: function(html) {
         | 
| 350 | 
            +
                        if(settings.onResultsAdd == 'default' || $.proxy(settings.onResultsAdd, $results)(html) == 'default') {
         | 
| 351 | 
            +
                          $results
         | 
| 352 | 
            +
                            .html(html)
         | 
| 353 | 
            +
                          ;
         | 
| 354 | 
            +
                        }
         | 
| 355 | 
            +
                        module.results.show();
         | 
| 356 | 
            +
                      },
         | 
| 357 | 
            +
                      show: function() {
         | 
| 358 | 
            +
                        if( ($results.filter(':visible').size() === 0) && ($prompt.filter(':focus').size() > 0) && $results.html() !== '') {
         | 
| 359 | 
            +
                          $results
         | 
| 360 | 
            +
                            .stop()
         | 
| 361 | 
            +
                            .fadeIn(200)
         | 
| 362 | 
            +
                          ;
         | 
| 363 | 
            +
                          $.proxy(settings.onResultsOpen, $results)();
         | 
| 364 | 
            +
                        }
         | 
| 365 | 
            +
                      },
         | 
| 366 | 
            +
                      hide: function() {
         | 
| 367 | 
            +
                        if($results.filter(':visible').size() > 0) {
         | 
| 368 | 
            +
                          $results
         | 
| 369 | 
            +
                            .stop()
         | 
| 370 | 
            +
                            .fadeOut(200)
         | 
| 371 | 
            +
                          ;
         | 
| 372 | 
            +
                          $.proxy(settings.onResultsClose, $results)();
         | 
| 373 | 
            +
                        }
         | 
| 374 | 
            +
                      },
         | 
| 375 | 
            +
                      select: function(event) {
         | 
| 376 | 
            +
                        module.debug('Search result selected');
         | 
| 377 | 
            +
                        var
         | 
| 378 | 
            +
                          $result = $(this),
         | 
| 379 | 
            +
                          $title  = $result.find('.title'),
         | 
| 380 | 
            +
                          title   = $title.html()
         | 
| 381 | 
            +
                        ;
         | 
| 382 | 
            +
                        if(settings.onSelect == 'default' || $.proxy(settings.onSelect, this)(event) == 'default') {
         | 
| 383 | 
            +
                          var
         | 
| 384 | 
            +
                            $link  = $result.find('a[href]').eq(0),
         | 
| 385 | 
            +
                            href   = $link.attr('href') || false,
         | 
| 386 | 
            +
                            target = $link.attr('target') || false
         | 
| 387 | 
            +
                          ;
         | 
| 388 | 
            +
                          module.results.hide();
         | 
| 389 | 
            +
                          $prompt
         | 
| 390 | 
            +
                            .val(title)
         | 
| 391 | 
            +
                          ;
         | 
| 392 | 
            +
                          if(href) {
         | 
| 393 | 
            +
                            if(target == '_blank' || event.ctrlKey) {
         | 
| 394 | 
            +
                              window.open(href);
         | 
| 395 | 
            +
                            }
         | 
| 396 | 
            +
                            else {
         | 
| 397 | 
            +
                              window.location.href = (href);
         | 
| 398 | 
            +
                            }
         | 
| 399 | 
            +
                          }
         | 
| 400 | 
            +
                        }
         | 
| 401 | 
            +
                      }
         | 
| 402 | 
            +
                    },
         | 
| 403 | 
            +
             | 
| 404 | 
            +
                    setting: function(name, value) {
         | 
| 405 | 
            +
                      module.debug('Changing setting', name, value);
         | 
| 406 | 
            +
                      if(value !== undefined) {
         | 
| 407 | 
            +
                        if( $.isPlainObject(name) ) {
         | 
| 408 | 
            +
                          $.extend(true, settings, name);
         | 
| 409 | 
            +
                        }
         | 
| 410 | 
            +
                        else {
         | 
| 411 | 
            +
                          settings[name] = value;
         | 
| 412 | 
            +
                        }
         | 
| 413 | 
            +
                      }
         | 
| 414 | 
            +
                      else {
         | 
| 415 | 
            +
                        return settings[name];
         | 
| 416 | 
            +
                      }
         | 
| 417 | 
            +
                    },
         | 
| 418 | 
            +
                    internal: function(name, value) {
         | 
| 419 | 
            +
                      module.debug('Changing internal', name, value);
         | 
| 420 | 
            +
                      if(value !== undefined) {
         | 
| 421 | 
            +
                        if( $.isPlainObject(name) ) {
         | 
| 422 | 
            +
                          $.extend(true, module, name);
         | 
| 423 | 
            +
                        }
         | 
| 424 | 
            +
                        else {
         | 
| 425 | 
            +
                          module[name] = value;
         | 
| 426 | 
            +
                        }
         | 
| 427 | 
            +
                      }
         | 
| 428 | 
            +
                      else {
         | 
| 429 | 
            +
                        return module[name];
         | 
| 430 | 
            +
                      }
         | 
| 431 | 
            +
                    },
         | 
| 432 | 
            +
                    debug: function() {
         | 
| 433 | 
            +
                      if(settings.debug) {
         | 
| 434 | 
            +
                        if(settings.performance) {
         | 
| 435 | 
            +
                          module.performance.log(arguments);
         | 
| 436 | 
            +
                        }
         | 
| 437 | 
            +
                        else {
         | 
| 438 | 
            +
                          module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
         | 
| 439 | 
            +
                          module.debug.apply(console, arguments);
         | 
| 440 | 
            +
                        }
         | 
| 441 | 
            +
                      }
         | 
| 442 | 
            +
                    },
         | 
| 443 | 
            +
                    verbose: function() {
         | 
| 444 | 
            +
                      if(settings.verbose && settings.debug) {
         | 
| 445 | 
            +
                        if(settings.performance) {
         | 
| 446 | 
            +
                          module.performance.log(arguments);
         | 
| 447 | 
            +
                        }
         | 
| 448 | 
            +
                        else {
         | 
| 449 | 
            +
                          module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
         | 
| 450 | 
            +
                          module.verbose.apply(console, arguments);
         | 
| 451 | 
            +
                        }
         | 
| 452 | 
            +
                      }
         | 
| 453 | 
            +
                    },
         | 
| 454 | 
            +
                    error: function() {
         | 
| 455 | 
            +
                      module.error = Function.prototype.bind.call(console.error, console, settings.moduleName + ':');
         | 
| 456 | 
            +
                      module.error.apply(console, arguments);
         | 
| 457 | 
            +
                    },
         | 
| 458 | 
            +
                    performance: {
         | 
| 459 | 
            +
                      log: function(message) {
         | 
| 460 | 
            +
                        var
         | 
| 461 | 
            +
                          currentTime,
         | 
| 462 | 
            +
                          executionTime,
         | 
| 463 | 
            +
                          previousTime
         | 
| 464 | 
            +
                        ;
         | 
| 465 | 
            +
                        if(settings.performance) {
         | 
| 466 | 
            +
                          currentTime   = new Date().getTime();
         | 
| 467 | 
            +
                          previousTime  = time || currentTime;
         | 
| 468 | 
            +
                          executionTime = currentTime - previousTime;
         | 
| 469 | 
            +
                          time          = currentTime;
         | 
| 470 | 
            +
                          performance.push({
         | 
| 471 | 
            +
                            'Element'        : element,
         | 
| 472 | 
            +
                            'Name'           : message[0],
         | 
| 473 | 
            +
                            'Arguments'      : [].slice.call(message, 1) || '',
         | 
| 474 | 
            +
                            'Execution Time' : executionTime
         | 
| 475 | 
            +
                          });
         | 
| 476 | 
            +
                        }
         | 
| 477 | 
            +
                        clearTimeout(module.performance.timer);
         | 
| 478 | 
            +
                        module.performance.timer = setTimeout(module.performance.display, 100);
         | 
| 479 | 
            +
                      },
         | 
| 480 | 
            +
                      display: function() {
         | 
| 481 | 
            +
                        var
         | 
| 482 | 
            +
                          title = settings.name + ':',
         | 
| 483 | 
            +
                          totalTime = 0
         | 
| 484 | 
            +
                        ;
         | 
| 485 | 
            +
                        time = false;
         | 
| 486 | 
            +
                        clearTimeout(module.performance.timer);
         | 
| 487 | 
            +
                        $.each(performance, function(index, data) {
         | 
| 488 | 
            +
                          totalTime += data['Execution Time'];
         | 
| 489 | 
            +
                        });
         | 
| 490 | 
            +
                        title += ' ' + totalTime + 'ms';
         | 
| 491 | 
            +
                        if(moduleSelector) {
         | 
| 492 | 
            +
                          title += ' \'' + moduleSelector + '\'';
         | 
| 493 | 
            +
                        }
         | 
| 494 | 
            +
                        if($allModules.size() > 1) {
         | 
| 495 | 
            +
                          title += ' ' + '(' + $allModules.size() + ')';
         | 
| 496 | 
            +
                        }
         | 
| 497 | 
            +
                        if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
         | 
| 498 | 
            +
                          console.groupCollapsed(title);
         | 
| 499 | 
            +
                          if(console.table) {
         | 
| 500 | 
            +
                            console.table(performance);
         | 
| 501 | 
            +
                          }
         | 
| 502 | 
            +
                          else {
         | 
| 503 | 
            +
                            $.each(performance, function(index, data) {
         | 
| 504 | 
            +
                              console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
         | 
| 505 | 
            +
                            });
         | 
| 506 | 
            +
                          }
         | 
| 507 | 
            +
                          console.groupEnd();
         | 
| 508 | 
            +
                        }
         | 
| 509 | 
            +
                        performance = [];
         | 
| 510 | 
            +
                      }
         | 
| 511 | 
            +
                    },
         | 
| 512 | 
            +
                    invoke: function(query, passedArguments, context) {
         | 
| 513 | 
            +
                      var
         | 
| 514 | 
            +
                        maxDepth,
         | 
| 515 | 
            +
                        found,
         | 
| 516 | 
            +
                        response
         | 
| 517 | 
            +
                      ;
         | 
| 518 | 
            +
                      passedArguments = passedArguments || queryArguments;
         | 
| 519 | 
            +
                      context         = element         || context;
         | 
| 520 | 
            +
                      if(typeof query == 'string' && instance !== undefined) {
         | 
| 521 | 
            +
                        query    = query.split(/[\. ]/);
         | 
| 522 | 
            +
                        maxDepth = query.length - 1;
         | 
| 523 | 
            +
                        $.each(query, function(depth, value) {
         | 
| 524 | 
            +
                          var camelCaseValue = (depth != maxDepth)
         | 
| 525 | 
            +
                            ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
         | 
| 526 | 
            +
                            : query
         | 
| 527 | 
            +
                          ;
         | 
| 528 | 
            +
                          if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
         | 
| 529 | 
            +
                            instance = instance[value];
         | 
| 530 | 
            +
                          }
         | 
| 531 | 
            +
                          else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
         | 
| 532 | 
            +
                            instance = instance[camelCaseValue];
         | 
| 533 | 
            +
                          }
         | 
| 534 | 
            +
                          else if( instance[value] !== undefined ) {
         | 
| 535 | 
            +
                            found = instance[value];
         | 
| 536 | 
            +
                            return false;
         | 
| 537 | 
            +
                          }
         | 
| 538 | 
            +
                          else if( instance[camelCaseValue] !== undefined ) {
         | 
| 539 | 
            +
                            found = instance[camelCaseValue];
         | 
| 540 | 
            +
                            return false;
         | 
| 541 | 
            +
                          }
         | 
| 542 | 
            +
                          else {
         | 
| 543 | 
            +
                            module.error(error.method);
         | 
| 544 | 
            +
                            return false;
         | 
| 545 | 
            +
                          }
         | 
| 546 | 
            +
                        });
         | 
| 547 | 
            +
                      }
         | 
| 548 | 
            +
                      if ( $.isFunction( found ) ) {
         | 
| 549 | 
            +
                        response = found.apply(context, passedArguments);
         | 
| 550 | 
            +
                      }
         | 
| 551 | 
            +
                      else if(found !== undefined) {
         | 
| 552 | 
            +
                        response = found;
         | 
| 553 | 
            +
                      }
         | 
| 554 | 
            +
                      if($.isArray(invokedResponse)) {
         | 
| 555 | 
            +
                        invokedResponse.push(response);
         | 
| 556 | 
            +
                      }
         | 
| 557 | 
            +
                      else if(typeof invokedResponse == 'string') {
         | 
| 558 | 
            +
                        invokedResponse = [invokedResponse, response];
         | 
| 559 | 
            +
                      }
         | 
| 560 | 
            +
                      else if(response !== undefined) {
         | 
| 561 | 
            +
                        invokedResponse = response;
         | 
| 562 | 
            +
                      }
         | 
| 563 | 
            +
                      return found;
         | 
| 564 | 
            +
                    }
         | 
| 565 | 
            +
                  };
         | 
| 566 | 
            +
                  if(methodInvoked) {
         | 
| 567 | 
            +
                    if(instance === undefined) {
         | 
| 568 | 
            +
                      module.initialize();
         | 
| 569 | 
            +
                    }
         | 
| 570 | 
            +
                    module.invoke(query);
         | 
| 571 | 
            +
                  }
         | 
| 572 | 
            +
                  else {
         | 
| 573 | 
            +
                    if(instance !== undefined) {
         | 
| 574 | 
            +
                      module.destroy();
         | 
| 575 | 
            +
                    }
         | 
| 576 | 
            +
                    module.initialize();
         | 
| 577 | 
            +
                  }
         | 
| 578 | 
            +
             | 
| 579 | 
            +
                })
         | 
| 580 | 
            +
              ;
         | 
| 581 | 
            +
             | 
| 582 | 
            +
              return (invokedResponse !== undefined)
         | 
| 583 | 
            +
                ? invokedResponse
         | 
| 584 | 
            +
                : this
         | 
| 585 | 
            +
              ;
         | 
| 586 | 
            +
            };
         | 
| 587 | 
            +
             | 
| 588 | 
            +
            $.fn.search.settings = {
         | 
| 589 | 
            +
             | 
| 590 | 
            +
              name     : 'Search Module',
         | 
| 591 | 
            +
              namespace      : 'search',
         | 
| 592 | 
            +
             | 
| 593 | 
            +
              debug          : true,
         | 
| 594 | 
            +
              verbose        : true,
         | 
| 595 | 
            +
              performance    : true,
         | 
| 596 | 
            +
             | 
| 597 | 
            +
              // onSelect default action is defined in module
         | 
| 598 | 
            +
              onSelect       : 'default',
         | 
| 599 | 
            +
              onResultsAdd   : 'default',
         | 
| 600 | 
            +
             | 
| 601 | 
            +
              onSearchQuery  : function(){},
         | 
| 602 | 
            +
              onResults      : function(response){},
         | 
| 603 | 
            +
             | 
| 604 | 
            +
              onResultsOpen  : function(){},
         | 
| 605 | 
            +
              onResultsClose : function(){},
         | 
| 606 | 
            +
             | 
| 607 | 
            +
              automatic      : 'true',
         | 
| 608 | 
            +
              type           : 'simple',
         | 
| 609 | 
            +
              minCharacters  : 3,
         | 
| 610 | 
            +
              searchThrottle : 300,
         | 
| 611 | 
            +
              maxResults     : 7,
         | 
| 612 | 
            +
              cache          : true,
         | 
| 613 | 
            +
             | 
| 614 | 
            +
              searchFields    : [
         | 
| 615 | 
            +
                'title',
         | 
| 616 | 
            +
                'description'
         | 
| 617 | 
            +
              ],
         | 
| 618 | 
            +
             | 
| 619 | 
            +
              // api config
         | 
| 620 | 
            +
              apiSettings: {
         | 
| 621 | 
            +
             | 
| 622 | 
            +
              },
         | 
| 623 | 
            +
             | 
| 624 | 
            +
              className: {
         | 
| 625 | 
            +
                active  : 'active',
         | 
| 626 | 
            +
                down    : 'down',
         | 
| 627 | 
            +
                focus   : 'focus',
         | 
| 628 | 
            +
                empty   : 'empty',
         | 
| 629 | 
            +
                loading : 'loading'
         | 
| 630 | 
            +
              },
         | 
| 631 | 
            +
             | 
| 632 | 
            +
              error : {
         | 
| 633 | 
            +
                noResults   : 'Your search returned no results',
         | 
| 634 | 
            +
                logging     : 'Error in debug logging, exiting.',
         | 
| 635 | 
            +
                noTemplate  : 'A valid template name was not specified.',
         | 
| 636 | 
            +
                serverError : 'There was an issue with querying the server.',
         | 
| 637 | 
            +
                method      : 'The method you called is not defined.'
         | 
| 638 | 
            +
              },
         | 
| 639 | 
            +
             | 
| 640 | 
            +
              selector : {
         | 
| 641 | 
            +
                prompt       : '.prompt',
         | 
| 642 | 
            +
                searchButton : '.search.button',
         | 
| 643 | 
            +
                results      : '.results',
         | 
| 644 | 
            +
                category     : '.category',
         | 
| 645 | 
            +
                result       : '.result'
         | 
| 646 | 
            +
              },
         | 
| 647 | 
            +
             | 
| 648 | 
            +
              templates: {
         | 
| 649 | 
            +
                message: function(message, type) {
         | 
| 650 | 
            +
                  var
         | 
| 651 | 
            +
                    html = ''
         | 
| 652 | 
            +
                  ;
         | 
| 653 | 
            +
                  if(message !== undefined && type !== undefined) {
         | 
| 654 | 
            +
                    html +=  ''
         | 
| 655 | 
            +
                      + '<div class="message ' + type +'">'
         | 
| 656 | 
            +
                    ;
         | 
| 657 | 
            +
                    // message type
         | 
| 658 | 
            +
                    if(type == 'empty') {
         | 
| 659 | 
            +
                      html += ''
         | 
| 660 | 
            +
                        + '<div class="header">No Results</div class="header">'
         | 
| 661 | 
            +
                        + '<div class="description">' + message + '</div class="description">'
         | 
| 662 | 
            +
                      ;
         | 
| 663 | 
            +
                    }
         | 
| 664 | 
            +
                    else {
         | 
| 665 | 
            +
                      html += ' <div class="description">' + message + '</div>';
         | 
| 666 | 
            +
                    }
         | 
| 667 | 
            +
                    html += '</div>';
         | 
| 668 | 
            +
                  }
         | 
| 669 | 
            +
                  return html;
         | 
| 670 | 
            +
                },
         | 
| 671 | 
            +
                categories: function(response) {
         | 
| 672 | 
            +
                  var
         | 
| 673 | 
            +
                    html = ''
         | 
| 674 | 
            +
                  ;
         | 
| 675 | 
            +
                  if(response.results !== undefined) {
         | 
| 676 | 
            +
                    // each category
         | 
| 677 | 
            +
                    $.each(response.results, function(index, category) {
         | 
| 678 | 
            +
                      if(category.results !== undefined && category.results.length > 0) {
         | 
| 679 | 
            +
                        html  += ''
         | 
| 680 | 
            +
                          + '<div class="category">'
         | 
| 681 | 
            +
                          + '<div class="name">' + category.name + '</div>'
         | 
| 682 | 
            +
                        ;
         | 
| 683 | 
            +
                        // each item inside category
         | 
| 684 | 
            +
                        $.each(category.results, function(index, result) {
         | 
| 685 | 
            +
                          html  += '<div class="result">';
         | 
| 686 | 
            +
                          html  += '<a href="' + result.url + '"></a>';
         | 
| 687 | 
            +
                          if(result.image !== undefined) {
         | 
| 688 | 
            +
                            html+= ''
         | 
| 689 | 
            +
                              + '<div class="image">'
         | 
| 690 | 
            +
                              + ' <img src="' + result.image + '">'
         | 
| 691 | 
            +
                              + '</div>'
         | 
| 692 | 
            +
                            ;
         | 
| 693 | 
            +
                          }
         | 
| 694 | 
            +
                          html += '<div class="info">';
         | 
| 695 | 
            +
                          if(result.price !== undefined) {
         | 
| 696 | 
            +
                            html+= '<div class="price">' + result.price + '</div>';
         | 
| 697 | 
            +
                          }
         | 
| 698 | 
            +
                          if(result.title !== undefined) {
         | 
| 699 | 
            +
                            html+= '<div class="title">' + result.title + '</div>';
         | 
| 700 | 
            +
                          }
         | 
| 701 | 
            +
                          if(result.description !== undefined) {
         | 
| 702 | 
            +
                            html+= '<div class="description">' + result.description + '</div>';
         | 
| 703 | 
            +
                          }
         | 
| 704 | 
            +
                          html  += ''
         | 
| 705 | 
            +
                            + '</div>'
         | 
| 706 | 
            +
                            + '</div>'
         | 
| 707 | 
            +
                          ;
         | 
| 708 | 
            +
                        });
         | 
| 709 | 
            +
                        html  += ''
         | 
| 710 | 
            +
                          + '</div>'
         | 
| 711 | 
            +
                        ;
         | 
| 712 | 
            +
                      }
         | 
| 713 | 
            +
                    });
         | 
| 714 | 
            +
                    if(response.resultPage) {
         | 
| 715 | 
            +
                      html += ''
         | 
| 716 | 
            +
                      + '<a href="' + response.resultPage.url + '" class="all">'
         | 
| 717 | 
            +
                      +   response.resultPage.text
         | 
| 718 | 
            +
                      + '</a>';
         | 
| 719 | 
            +
                    }
         | 
| 720 | 
            +
                    return html;
         | 
| 721 | 
            +
                  }
         | 
| 722 | 
            +
                  return false;
         | 
| 723 | 
            +
                },
         | 
| 724 | 
            +
                simple: function(response) {
         | 
| 725 | 
            +
                  var
         | 
| 726 | 
            +
                    html = ''
         | 
| 727 | 
            +
                  ;
         | 
| 728 | 
            +
                  if(response.results !== undefined) {
         | 
| 729 | 
            +
             | 
| 730 | 
            +
                    // each result
         | 
| 731 | 
            +
                    $.each(response.results, function(index, result) {
         | 
| 732 | 
            +
                      html  += '<a class="result" href="' + result.url + '">';
         | 
| 733 | 
            +
                      if(result.image !== undefined) {
         | 
| 734 | 
            +
                        html+= ''
         | 
| 735 | 
            +
                          + '<div class="image">'
         | 
| 736 | 
            +
                          + ' <img src="' + result.image + '">'
         | 
| 737 | 
            +
                          + '</div>'
         | 
| 738 | 
            +
                        ;
         | 
| 739 | 
            +
                      }
         | 
| 740 | 
            +
                      html += '<div class="info">';
         | 
| 741 | 
            +
                      if(result.price !== undefined) {
         | 
| 742 | 
            +
                        html+= '<div class="price">' + result.price + '</div>';
         | 
| 743 | 
            +
                      }
         | 
| 744 | 
            +
                      if(result.title !== undefined) {
         | 
| 745 | 
            +
                        html+= '<div class="title">' + result.title + '</div>';
         | 
| 746 | 
            +
                      }
         | 
| 747 | 
            +
                      if(result.description !== undefined) {
         | 
| 748 | 
            +
                        html+= '<div class="description">' + result.description + '</div>';
         | 
| 749 | 
            +
                      }
         | 
| 750 | 
            +
                      html  += ''
         | 
| 751 | 
            +
                        + '</div>'
         | 
| 752 | 
            +
                        + '</a>'
         | 
| 753 | 
            +
                      ;
         | 
| 754 | 
            +
                    });
         | 
| 755 | 
            +
             | 
| 756 | 
            +
                    if(response.resultPage) {
         | 
| 757 | 
            +
                      html += ''
         | 
| 758 | 
            +
                      + '<a href="' + response.resultPage.url + '" class="all">'
         | 
| 759 | 
            +
                      +   response.resultPage.text
         | 
| 760 | 
            +
                      + '</a>';
         | 
| 761 | 
            +
                    }
         | 
| 762 | 
            +
                    return html;
         | 
| 763 | 
            +
                  }
         | 
| 764 | 
            +
                  return false;
         | 
| 765 | 
            +
                }
         | 
| 766 | 
            +
              }
         | 
| 767 | 
            +
            };
         | 
| 768 | 
            +
             | 
| 769 | 
            +
            })( jQuery, window , document );
         |