compass-jquery-plugin 0.3.2.7 → 0.3.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +17 -11
- data/VERSION.yml +2 -2
- data/lib/handle_js_files.rb +1 -1
- data/lib/jquery/emulators.rb +13 -0
- data/templates/dynatree/jquery.dynatree.min.js +79 -81
- data/templates/emulators/config/initializers/emulators.rb +0 -9
- data/templates/emulators/emulators/{blackberry.landscape.scss → blackberry.torch.landscape.scss} +6 -2
- data/templates/emulators/emulators/{blackberry.portrait.scss → blackberry.torch.portrait.scss} +6 -1
- data/templates/emulators/emulators/galaxy.s.landscape.png +0 -0
- data/templates/emulators/emulators/galaxy.s.landscape.scss +20 -0
- data/templates/emulators/emulators/galaxy.s.portrait.png +0 -0
- data/templates/emulators/emulators/galaxy.s.portrait.scss +20 -0
- data/templates/emulators/emulators/galaxy.s2.landscape.png +0 -0
- data/templates/emulators/emulators/galaxy.s2.landscape.scss +20 -0
- data/templates/emulators/emulators/galaxy.s2.portrait.png +0 -0
- data/templates/emulators/emulators/galaxy.s2.portrait.scss +20 -0
- data/templates/emulators/emulators/galaxy.tab.10.1.landscape.png +0 -0
- data/templates/emulators/emulators/galaxy.tab.10.1.landscape.scss +20 -0
- data/templates/emulators/emulators/galaxy.tab.10.1.portrait.png +0 -0
- data/templates/emulators/emulators/galaxy.tab.10.1.portrait.scss +20 -0
- data/templates/emulators/emulators/galaxy.tab.7.landscape.png +0 -0
- data/templates/emulators/emulators/galaxy.tab.7.landscape.scss +20 -0
- data/templates/emulators/emulators/galaxy.tab.7.portrait.png +0 -0
- data/templates/emulators/emulators/galaxy.tab.7.portrait.scss +20 -0
- data/templates/emulators/emulators/galaxy.tab.8.9.landscape.png +0 -0
- data/templates/emulators/emulators/galaxy.tab.8.9.landscape.scss +20 -0
- data/templates/emulators/emulators/galaxy.tab.8.9.portrait.png +0 -0
- data/templates/emulators/emulators/galaxy.tab.8.9.portrait.scss +20 -0
- data/templates/emulators/emulators/ipad.landscape.png +0 -0
- data/templates/emulators/emulators/ipad.landscape.scss +9 -4
- data/templates/emulators/emulators/ipad.portrait.png +0 -0
- data/templates/emulators/emulators/ipad.portrait.scss +9 -4
- data/templates/emulators/emulators/{iphone.landscape.png → iphone.3.landscape.png} +0 -0
- data/templates/emulators/emulators/{iphone.landscape.scss → iphone.3.landscape.scss} +7 -3
- data/templates/emulators/emulators/{iphone.portrait.png → iphone.3.portrait.png} +0 -0
- data/templates/emulators/emulators/{iphone.portrait.scss → iphone.3.portrait.scss} +7 -3
- data/templates/emulators/emulators/iphone.4.landscape .scss +20 -0
- data/templates/emulators/emulators/iphone.4.landscape.png +0 -0
- data/templates/emulators/emulators/iphone.4.portrait.png +0 -0
- data/templates/emulators/emulators/iphone.4.portrait.scss +20 -0
- data/templates/emulators/emulators/{palm.pre.landscape.png → palm.pre.2.landscape.png} +0 -0
- data/templates/emulators/emulators/{palm.landscape.scss → palm.pre.2.landscape.scss} +7 -3
- data/templates/emulators/emulators/{palm.pre.portrait.png → palm.pre.2.portrait.png} +0 -0
- data/templates/emulators/emulators/{palm.portrait.scss → palm.pre.2.portrait.scss} +7 -3
- data/templates/emulators/manifest.rb +34 -10
- data/templates/graphics/config/initializers/graphics.rb +8 -0
- data/templates/graphics/highcharts/dark-blue.js +170 -0
- data/templates/graphics/highcharts/dark-blue.min.js +4 -0
- data/templates/graphics/highcharts/dark-green.js +170 -0
- data/templates/graphics/highcharts/dark-green.min.js +4 -0
- data/templates/graphics/highcharts/gray.js +164 -0
- data/templates/graphics/highcharts/gray.min.js +4 -0
- data/templates/graphics/highcharts/grid.js +97 -0
- data/templates/graphics/highcharts/grid.min.js +3 -0
- data/templates/graphics/highcharts/highslide-config.js +12 -0
- data/templates/graphics/highcharts/highslide-config.min.js +1 -0
- data/templates/graphics/highcharts/highslide-full.js +3391 -0
- data/templates/graphics/highcharts/highslide-full.min.js +132 -0
- data/templates/graphics/highcharts/skies.js +89 -0
- data/templates/graphics/highcharts/skies.min.js +3 -0
- data/templates/graphics/jquery.ganttView.js +1 -1
- data/templates/graphics/jquery.ganttView.min.js +61 -61
- data/templates/graphics/jquery.highcharts.js +11342 -0
- data/templates/graphics/jquery.highcharts.min.js +176 -0
- data/templates/graphics/jquery.sparkline.min.js +35 -36
- data/templates/graphics/jquery/highcharts/graphics/close.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/closeX.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar-black-border.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar-text-buttons.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar-white-small.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar-white.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar2.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar3.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar4-hover.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/controlbar4.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/fullexpand.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/geckodimmer.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/icon.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/loader.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/loader.white.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/outlines/beveled.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/outlines/drop-shadow.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/outlines/glossy-dark.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/outlines/outer-glow.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/outlines/rounded-black.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/outlines/rounded-white.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/resize.gif +0 -0
- data/templates/graphics/jquery/highcharts/graphics/scrollarrows.png +0 -0
- data/templates/graphics/jquery/highcharts/graphics/zoomin.cur +0 -0
- data/templates/graphics/jquery/highcharts/graphics/zoomout.cur +0 -0
- data/templates/graphics/jquery/highcharts/skies.jpg +0 -0
- data/templates/graphics/jquery/highslide.scss +763 -0
- data/templates/graphics/manifest.rb +43 -0
- data/templates/ical/config/initializers/ical.rb +1 -0
- data/templates/ical/jquery.ical.js +8401 -8209
- data/templates/ical/jquery.ical.min.js +206 -208
- data/templates/ical/jquery/ical.print.scss +48 -0
- data/templates/ical/jquery/ical.scss +372 -343
- data/templates/ical/manifest.rb +1 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ar.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-cat.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-cn.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-cs.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-da.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-de.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-el.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-en.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-es.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-fa.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-fi.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-fr.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-gl.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-he.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-hu.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-it.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-ja.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-lt.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-nl.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-no.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pl.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pt.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ro.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ru.min.js +2 -2
- data/templates/jqgrid/i18n/jqgrid/locale-sk.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-sr.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-sv.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-tr.min.js +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ua.min.js +2 -2
- data/templates/jqgrid/jquery.jqGrid.js +162 -850
- data/templates/jqgrid/jquery.jqGrid.min.js +476 -497
- data/templates/jqgrid/jquery/jqGrid.scss +0 -19
- data/templates/jquery/amplify.store.js +248 -0
- data/templates/jquery/amplify.store.min.js +6 -0
- data/templates/jquery/config/initializers/jquery.rb +5 -1
- data/templates/jquery/history.adapter.jquery.js +37 -43
- data/templates/jquery/history.adapter.jquery.min.js +1 -1
- data/templates/jquery/history.html4.js +596 -587
- data/templates/jquery/history.html4.min.js +8 -8
- data/templates/jquery/history.js +1839 -1669
- data/templates/jquery/history.min.js +27 -25
- data/templates/jquery/i18n/jquery.ui/datepicker-af.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-az.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-bg.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-bs.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ca.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-cs.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-da.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-de.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-el.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-eo.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-es.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-et.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-eu.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-fa.min.js +2 -2
- data/templates/jquery/i18n/jquery.ui/datepicker-fi.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-fo.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-fr.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-gl.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-he.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hr.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hy.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-id.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-is.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-it.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ja.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ko.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-kz.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-lt.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-lv.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ml.min.js +2 -2
- data/templates/jquery/i18n/jquery.ui/datepicker-ms.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-nl.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-pl.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-pt.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-rm.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ro.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ru.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-sk.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-sl.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-sq.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-sr.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-sv.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ta.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-th.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-tj.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-tr.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-uk.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-vi.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.min.js +1 -1
- data/templates/jquery/jquery-ui.js +217 -104
- data/templates/jquery/jquery-ui.min.js +437 -436
- data/templates/jquery/jquery.bgiframe.min.js +1 -1
- data/templates/jquery/jquery.contextMenu.min.js +7 -7
- data/templates/jquery/jquery.cookie.js +60 -58
- data/templates/jquery/jquery.cookie.min.js +1 -1
- data/templates/jquery/jquery.dotimeout.min.js +2 -2
- data/templates/jquery/jquery.dst.min.js +4 -4
- data/templates/jquery/jquery.farbtastic.min.js +10 -10
- data/templates/jquery/jquery.form.js +15 -5
- data/templates/jquery/jquery.form.min.js +20 -20
- data/templates/jquery/jquery.haml.min.js +5 -5
- data/templates/jquery/jquery.hotkeys.min.js +3 -3
- data/templates/jquery/jquery.js +8205 -8170
- data/templates/jquery/jquery.layout.min.js +48 -50
- data/templates/jquery/jquery.min.js +166 -167
- data/templates/jquery/jquery.mousewheel.min.js +2 -2
- data/templates/jquery/jquery.offline.min.js +4 -4
- data/templates/jquery/jquery.pngFix.js +28 -30
- data/templates/jquery/jquery.pngFix.min.js +5 -5
- data/templates/jquery/jquery.rails.js +166 -0
- data/templates/jquery/jquery.rails.min.js +6 -0
- data/templates/jquery/jquery.replacetext.min.js +1 -1
- data/templates/jquery/jquery.themeswitchertool.min.js +4 -4
- data/templates/jquery/jquery.tmpl.js +14 -12
- data/templates/jquery/jquery.tmpl.min.js +12 -12
- data/templates/jquery/jquery.tmplPlus.js +2 -2
- data/templates/jquery/jquery.tmplPlus.min.js +3 -3
- data/templates/jquery/jquery.tokeninput.js +729 -0
- data/templates/jquery/jquery.tokeninput.min.js +14 -0
- data/templates/jquery/jquery/ui/_theme.scss +23 -16
- data/templates/jquery/jquery/ui/black-tie/ui-icons_4ca300_256x240.png +0 -0
- data/templates/jquery/jquery/ui/black-tie/ui-icons_bbbbbb_256x240.png +0 -0
- data/templates/jquery/jquery/ui/black-tie/ui-icons_ededed_256x240.png +0 -0
- data/templates/jquery/jquery/ui/black-tie/ui-icons_ffcf29_256x240.png +0 -0
- data/templates/jquery/jquery/ui/tokeninput.facebook.scss +95 -0
- data/templates/jquery/jquery/ui/tokeninput.mac.scss +164 -0
- data/templates/jquery/jquery/ui/tokeninput.scss +85 -0
- data/templates/jquery/jquery/ui/vader/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/templates/jquery/jquery/ui/vader/ui-icons_bbbbbb_256x240.png +0 -0
- data/templates/jquery/jquery/ui/vader/ui-icons_c98000_256x240.png +0 -0
- data/templates/jquery/jquery/ui/vader/ui-icons_f29a00_256x240.png +0 -0
- data/templates/jquery/json.min.js +6 -6
- data/templates/jquery/json2.js +214 -214
- data/templates/jquery/json2.min.js +5 -6
- data/templates/jquery/manifest.rb +9 -2
- data/templates/jstree/jquery.jstree.min.js +222 -224
- data/templates/mobile/config/initializers/mobile.rb +1 -1
- data/templates/mobile/jquery.mobile.js +887 -404
- data/templates/mobile/jquery.mobile.min.js +4 -4
- data/templates/mobile/jquery/mobile/_base.scss +50 -26
- data/templates/mobile/jquery/mobile/default.scss +59 -63
- data/templates/mobile/jquery/mobile/valencia.scss +44 -42
- data/templates/ribbon/jquery.ribbon.min.js +14 -14
- data/templates/tiny_mce/manifest.rb +4 -0
- data/templates/tiny_mce/tiny_mce/langs/de.js +1 -1
- data/templates/tiny_mce/tiny_mce/langs/en.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advimage/js/image.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advimage/langs/de_dlg.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advlink/js/advlink.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advlink/langs/en_dlg.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advlink/link.htm +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advlist/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advlist/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/autolink/editor_plugin.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/autolink/editor_plugin_src.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/autoresize/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/autoresize/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/contextmenu/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/css/fullpage.css +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/fullpage.htm +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/js/fullpage.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/lists/editor_plugin.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/lists/editor_plugin_src.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/media/js/media.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/media/media.htm +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/noneditable/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/noneditable/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/paste/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/paste/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/js/searchreplace.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/spellchecker/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/table/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/table/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/attributes.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/editor_template.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/editor_template_src.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/charmap.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/langs/de_dlg.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/langs/en_dlg.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/ui.css +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/dialog.css +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/ui.css +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +1 -1
- data/templates/tiny_mce/tiny_mce/tiny_mce.js +1 -1
- data/templates/tiny_mce/tiny_mce/utils/form_utils.js +1 -1
- data/templates/tiny_mce/tiny_mce/utils/validate.js +1 -1
- data/templates/tools/flowplayer.min.js +29 -30
- data/templates/tools/jquery.tools.min.js +96 -96
- data/templates/tools/swfobject.min.js +18 -19
- metadata +95 -16
- data/templates/jquery/jrails.js +0 -200
- data/templates/jquery/jrails.min.js +0 -8
@@ -1,5 +1,5 @@
|
|
1
|
-
(function(){jQuery.fn.pngFix=function(c){c=jQuery.extend({blankgif:"/images/jquery/ui/pngFix/blank.gif"},c)
|
2
|
-
jQuery(this).attr("height",jQuery(this).height());var a="",b="",
|
3
|
-
this.style.border+";"
|
4
|
-
"', sizingMethod='scale');";b+=
|
5
|
-
a+"',sizingMethod='scale')"}
|
1
|
+
(function(){jQuery.fn.pngFix=function(c){var c=jQuery.extend({blankgif:"/images/jquery/ui/pngFix/blank.gif"},c),d=navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1,e=navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1;if(jQuery.browser.msie&&(d||e))jQuery(this).find("img[@src$=.png]").each(function(){jQuery(this).attr("width",jQuery(this).width());
|
2
|
+
jQuery(this).attr("height",jQuery(this).height());var a="",b="",c=jQuery(this).attr("id")?'id="'+jQuery(this).attr("id")+'" ':"",d=jQuery(this).attr("class")?'class="'+jQuery(this).attr("class")+'" ':"",e=jQuery(this).attr("title")?'title="'+jQuery(this).attr("title")+'" ':"",g=jQuery(this).attr("alt")?'alt="'+jQuery(this).attr("alt")+'" ':"",h=jQuery(this).attr("align")?"float:"+jQuery(this).attr("align")+";":"",f=jQuery(this).parent().attr("href")?"cursor:hand;":"";if(this.style.border)a+="border:"+
|
3
|
+
this.style.border+";",this.style.border="";if(this.style.padding)a+="padding:"+this.style.padding+";",this.style.padding="";if(this.style.margin)a+="margin:"+this.style.margin+";",this.style.margin="";var i=this.style.cssText;b+="<span "+c+d+e+g;b+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+h+f;b+="width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+"px;";b+="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+jQuery(this).attr("src")+
|
4
|
+
"', sizingMethod='scale');";b+=i+'"></span>';a!=""&&(b='<span style="position:relative;display:inline-block;'+a+f+"width:"+jQuery(this).width()+"px;height:"+jQuery(this).height()+'px;">'+b+"</span>");jQuery(this).hide();jQuery(this).after(b)}),jQuery(this).find("*").each(function(){var a=jQuery(this).css("background-image");if(a.indexOf(".png")!=-1)a=a.split('url("')[1].split('")')[0],jQuery(this).css("background-image","none"),jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+
|
5
|
+
a+"',sizingMethod='scale')"}),jQuery(this).find("input[@src$=.png]").each(function(){var a=jQuery(this).attr("src");jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='scale');";jQuery(this).attr("src",c.blankgif)});return jQuery}})(jQuery);
|
@@ -0,0 +1,166 @@
|
|
1
|
+
/**
|
2
|
+
* Unobtrusive scripting adapter for jQuery
|
3
|
+
*
|
4
|
+
* Requires jQuery 1.4.3 or later.
|
5
|
+
* https://github.com/rails/jquery-ujs
|
6
|
+
*/
|
7
|
+
|
8
|
+
(function($) {
|
9
|
+
// Make sure that every Ajax request sends the CSRF token
|
10
|
+
function CSRFProtection(xhr) {
|
11
|
+
var token = $('meta[name="csrf-token"]').attr('content');
|
12
|
+
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
13
|
+
}
|
14
|
+
|
15
|
+
if ('ajaxPrefilter' in $) $.ajaxPrefilter(function(options, originalOptions, xhr) {
|
16
|
+
CSRFProtection(xhr)
|
17
|
+
});
|
18
|
+
else $(document).ajaxSend(function(e, xhr) {
|
19
|
+
CSRFProtection(xhr)
|
20
|
+
});
|
21
|
+
|
22
|
+
// Triggers an event on an element and returns the event result
|
23
|
+
function fire(obj, name, data) {
|
24
|
+
var event = $.Event(name);
|
25
|
+
obj.trigger(event, data);
|
26
|
+
return event.result !== false;
|
27
|
+
}
|
28
|
+
|
29
|
+
// Submits "remote" forms and links with ajax
|
30
|
+
function handleRemote(element) {
|
31
|
+
var method, url, data,
|
32
|
+
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
33
|
+
|
34
|
+
if (fire(element, 'ajax:before')) {
|
35
|
+
if (element.is('form')) {
|
36
|
+
method = element.attr('method');
|
37
|
+
url = element.attr('action');
|
38
|
+
data = element.serializeArray();
|
39
|
+
// memoized value from clicked submit button
|
40
|
+
var button = element.data('ujs:submit-button');
|
41
|
+
if (button) {
|
42
|
+
data.push(button);
|
43
|
+
element.data('ujs:submit-button', null);
|
44
|
+
}
|
45
|
+
} else {
|
46
|
+
method = element.data('method');
|
47
|
+
url = element.attr('href');
|
48
|
+
data = null;
|
49
|
+
}
|
50
|
+
$.ajax({
|
51
|
+
url: url, type: method || 'GET', data: data, dataType: dataType,
|
52
|
+
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
53
|
+
beforeSend: function(xhr, settings) {
|
54
|
+
if (settings.dataType === undefined) {
|
55
|
+
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
56
|
+
}
|
57
|
+
return fire(element, 'ajax:beforeSend', [xhr, settings]);
|
58
|
+
},
|
59
|
+
success: function(data, status, xhr) {
|
60
|
+
element.trigger('ajax:success', [data, status, xhr]);
|
61
|
+
},
|
62
|
+
complete: function(xhr, status) {
|
63
|
+
element.trigger('ajax:complete', [xhr, status]);
|
64
|
+
},
|
65
|
+
error: function(xhr, status, error) {
|
66
|
+
element.trigger('ajax:error', [xhr, status, error]);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
// Handles "data-method" on links such as:
|
73
|
+
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
74
|
+
function handleMethod(link) {
|
75
|
+
var href = link.attr('href'),
|
76
|
+
method = link.data('method'),
|
77
|
+
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
78
|
+
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
79
|
+
form = $('<form method="post" action="' + href + '"></form>'),
|
80
|
+
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
81
|
+
|
82
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
83
|
+
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
84
|
+
}
|
85
|
+
|
86
|
+
form.hide().append(metadata_input).appendTo('body');
|
87
|
+
form.submit();
|
88
|
+
}
|
89
|
+
|
90
|
+
function disableFormElements(form) {
|
91
|
+
form.find('input[data-disable-with], button[data-disable-with]').each(function() {
|
92
|
+
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
93
|
+
element.data('ujs:enable-with', element[method]());
|
94
|
+
element[method](element.data('disable-with'));
|
95
|
+
element.attr('disabled', 'disabled');
|
96
|
+
});
|
97
|
+
}
|
98
|
+
|
99
|
+
function enableFormElements(form) {
|
100
|
+
form.find('input[data-disable-with]:disabled, button[data-disable-with]:disabled').each(function() {
|
101
|
+
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
102
|
+
if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
|
103
|
+
element.removeAttr('disabled');
|
104
|
+
});
|
105
|
+
}
|
106
|
+
|
107
|
+
function allowAction(element) {
|
108
|
+
var message = element.data('confirm');
|
109
|
+
return !message || (fire(element, 'confirm') && confirm(message));
|
110
|
+
}
|
111
|
+
|
112
|
+
function requiredValuesMissing(form) {
|
113
|
+
var missing = false;
|
114
|
+
form.find('input[name][required]').each(function() {
|
115
|
+
if (!$(this).val()) missing = true;
|
116
|
+
});
|
117
|
+
return missing;
|
118
|
+
}
|
119
|
+
|
120
|
+
$('a[data-confirm], a[data-method], a[data-remote]').live('click.rails', function(e) {
|
121
|
+
var link = $(this);
|
122
|
+
if (!allowAction(link)) return false;
|
123
|
+
|
124
|
+
if (link.data('remote') != undefined) {
|
125
|
+
handleRemote(link);
|
126
|
+
return false;
|
127
|
+
} else if (link.data('method')) {
|
128
|
+
handleMethod(link);
|
129
|
+
return false;
|
130
|
+
}
|
131
|
+
});
|
132
|
+
|
133
|
+
$('form').live('submit.rails', function(e) {
|
134
|
+
var form = $(this), remote = form.data('remote') != undefined;
|
135
|
+
if (!allowAction(form)) return false;
|
136
|
+
|
137
|
+
// skip other logic when required values are missing
|
138
|
+
if (requiredValuesMissing(form)) return !remote;
|
139
|
+
|
140
|
+
if (remote) {
|
141
|
+
handleRemote(form);
|
142
|
+
return false;
|
143
|
+
} else {
|
144
|
+
// slight timeout so that the submit button gets properly serialized
|
145
|
+
setTimeout(function() {
|
146
|
+
disableFormElements(form)
|
147
|
+
}, 13);
|
148
|
+
}
|
149
|
+
});
|
150
|
+
|
151
|
+
$('form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])').live('click.rails', function() {
|
152
|
+
var button = $(this);
|
153
|
+
if (!allowAction(button)) return false;
|
154
|
+
// register the pressed submit button
|
155
|
+
var name = button.attr('name'), data = name ? {name:name, value:button.val()} : null;
|
156
|
+
button.closest('form').data('ujs:submit-button', data);
|
157
|
+
});
|
158
|
+
|
159
|
+
$('form').live('ajax:beforeSend.rails', function(event) {
|
160
|
+
if (this == event.target) disableFormElements($(this));
|
161
|
+
});
|
162
|
+
|
163
|
+
$('form').live('ajax:complete.rails', function(event) {
|
164
|
+
if (this == event.target) enableFormElements($(this));
|
165
|
+
});
|
166
|
+
})(jQuery);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
(function(c){function f(a){var b=c('meta[name="csrf-token"]').attr("content");b&&a.setRequestHeader("X-CSRF-Token",b)}function h(a,b,d){b=c.Event(b);a.trigger(b,d);return b.result!==!1}function i(a){var b,d,e,g=a.data("type")||c.ajaxSettings&&c.ajaxSettings.dataType;if(h(a,"ajax:before")){if(a.is("form")){b=a.attr("method");d=a.attr("action");e=a.serializeArray();var f=a.data("ujs:submit-button");f&&(e.push(f),a.data("ujs:submit-button",null))}else b=a.data("method"),d=a.attr("href"),e=null;c.ajax({url:d,
|
2
|
+
type:b||"GET",data:e,dataType:g,beforeSend:function(b,c){c.dataType===void 0&&b.setRequestHeader("accept","*/*;q=0.5, "+c.accepts.script);return h(a,"ajax:beforeSend",[b,c])},success:function(b,c,d){a.trigger("ajax:success",[b,c,d])},complete:function(b,c){a.trigger("ajax:complete",[b,c])},error:function(b,c,d){a.trigger("ajax:error",[b,c,d])}})}}function j(a){a.find("input[data-disable-with], button[data-disable-with]").each(function(){var b=c(this),a=b.is("button")?"html":"val";b.data("ujs:enable-with",
|
3
|
+
b[a]());b[a](b.data("disable-with"));b.attr("disabled","disabled")})}function k(a){a.find("input[data-disable-with]:disabled, button[data-disable-with]:disabled").each(function(){var a=c(this),d=a.is("button")?"html":"val";if(a.data("ujs:enable-with"))a[d](a.data("ujs:enable-with"));a.removeAttr("disabled")})}function g(a){var b=a.data("confirm");return!b||h(a,"confirm")&&confirm(b)}function l(a){var b=!1;a.find("input[name][required]").each(function(){c(this).val()||(b=!0)});return b}"ajaxPrefilter"in
|
4
|
+
c?c.ajaxPrefilter(function(a,b,c){f(c)}):c(document).ajaxSend(function(a,b){f(b)});c("a[data-confirm], a[data-method], a[data-remote]").live("click.rails",function(){var a=c(this);if(!g(a))return!1;if(a.data("remote")!=void 0)return i(a),!1;else if(a.data("method")){var b=a.attr("href"),d=a.data("method"),a=c("meta[name=csrf-token]").attr("content"),e=c("meta[name=csrf-param]").attr("content"),b=c('<form method="post" action="'+b+'"></form>'),d='<input name="_method" value="'+d+'" type="hidden" />';
|
5
|
+
e!==void 0&&a!==void 0&&(d+='<input name="'+e+'" value="'+a+'" type="hidden" />');b.hide().append(d).appendTo("body");b.submit();return!1}});c("form").live("submit.rails",function(){var a=c(this),b=a.data("remote")!=void 0;if(!g(a))return!1;if(l(a))return!b;if(b)return i(a),!1;else setTimeout(function(){j(a)},13)});c("form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])").live("click.rails",function(){var a=c(this);if(!g(a))return!1;var b=a.attr("name"),
|
6
|
+
b=b?{name:b,value:a.val()}:null;a.closest("form").data("ujs:submit-button",b)});c("form").live("ajax:beforeSend.rails",function(a){this==a.target&&j(c(this))});c("form").live("ajax:complete.rails",function(a){this==a.target&&k(c(this))})})(jQuery);
|
@@ -1 +1 @@
|
|
1
|
-
(function(c){c.fn.replaceText=function(f,g,h){return this.each(function(){var a=this.firstChild,d,b,e=[];if(a){do if(a.nodeType===3
|
1
|
+
(function(c){c.fn.replaceText=function(f,g,h){return this.each(function(){var a=this.firstChild,d,b,e=[];if(a){do if(a.nodeType===3&&(d=a.nodeValue,b=d.replace(f,g),b!==d))!h&&/</.test(b)?(c(a).before(b),e.push(a)):a.nodeValue=b;while(a=a.nextSibling)}e.length&&c(e).remove()})}})(jQuery);
|
@@ -1,7 +1,7 @@
|
|
1
|
-
$.fn.themeswitcher=function(e){var a=jQuery.extend({loadTheme:null,initialText:"Switch Theme",width:150,height:400,buttonPreText:"Theme: ",closeOnSelect
|
2
|
-
c.click(function(){b.is(":visible")?b.spHide():b.spShow();return
|
3
|
-
$("link.ui-theme").size()>3&&$("link.ui-theme:first").remove();d=$(this).find("span").text();c.find(".jquery-ui-themeswitcher-title").text(a.buttonPreText+d);$.cookie(a.cookieName,d);a.onSelect();a.closeOnSelect&&b.is(":visible")&&b.spHide();return
|
1
|
+
$.fn.themeswitcher=function(e){var a=jQuery.extend({loadTheme:null,initialText:"Switch Theme",width:150,height:400,buttonPreText:"Theme: ",closeOnSelect:!0,buttonHeight:14,cookieName:"jquery-ui-theme",onOpen:function(){},onClose:function(){},onSelect:function(){}},e),c=$('<a href="#" class="jquery-ui-themeswitcher-trigger"><span class="jquery-ui-themeswitcher-icon"></span><span class="jquery-ui-themeswitcher-title">'+a.initialText+"</span></a>"),b=$('<div class="jquery-ui-themeswitcher"><div id="themeGallery"> <ul> <li><a href="compiled/jquery/ui/ui-lightness.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_ui_light.png" alt="UI Lightness" title="UI Lightness" /> <span class="themeName">UI lightness</span></a></li> <li><a href="compiled/jquery/ui/ui-darkness.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_ui_dark.png" alt="UI Darkness" title="UI Darkness" /> <span class="themeName">UI darkness</span> </a></li> <li><a href="compiled/jquery/ui/smoothness.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_smoothness.png" alt="Smoothness" title="Smoothness" /> <span class="themeName">Smoothness</span> </a></li> <li><a href="compiled/jquery/ui/start.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_start_menu.png" alt="Start" title="Start" /> <span class="themeName">Start</span></a></li></li> <li><a href="compiled/jquery/ui/redmond.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_windoze.png" alt="Redmond" title="Redmond" /> <span class="themeName">Redmond</span></a></li></li> <li><a href="compiled/jquery/ui/sunny.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_sunny.png" alt="Sunny" title="Sunny" /> <span class="themeName">Sunny</span></a></li></li> <li><a href="compiled/jquery/ui/overcast.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_overcast.png" alt="Overcast" title="Overcast" /> <span class="themeName">Overcast</span></a></li> <li><a href="compiled/jquery/ui/le-frog.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_le_frog.png" alt="Le Frog" title="Le Frog" /> <span class="themeName">Le Frog</span></a></li></li> <li><a href="compiled/jquery/ui/flick.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_flick.png" alt="Flick" title="Flick" /> <span class="themeName">Flick</span></a></li> <li><a href="compiled/jquery/ui/pepper-grinder.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_pepper_grinder.png" alt="Pepper Grinder" title="Pepper Grinder" /> <span class="themeName">Pepper Grinder</span></a></li> <li><a href="compiled/jquery/ui/eggplant.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_eggplant.png" alt="Eggplant" title="Eggplant" /> <span class="themeName">Eggplant</span></a></li> <li><a href="compiled/jquery/ui/dark-hive.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_dark_hive.png" alt="Dark Hive" title="Dark Hive" /> <span class="themeName">Dark Hive</span></a></li></li> <li><a href="compiled/jquery/ui/cupertino.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_cupertino.png" alt="Cupertino" title="Cupertino" /> <span class="themeName">Cupertino</span></a></li> <li><a href="compiled/jquery/ui/south-street.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_south_street.png" alt="South St" title="South St" /> <span class="themeName">South Street</span></a></li> <li><a href="compiled/jquery/ui/blitzer.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_blitzer.png" alt="Blitzer" title="Blitzer" /> <span class="themeName">Blitzer</span></a></li></li> <li><a href="compiled/jquery/ui/humanity.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_humanity.png" alt="Humanity" title="Humanity" /> <span class="themeName">Humanity</span></a></li></li> <li><a href="compiled/jquery/ui/hot-sneaks.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_hot_sneaks.png" alt="Hot Sneaks" title="Hot Sneaks" /> <span class="themeName">Hot sneaks</span></a></li></li> <li><a href="compiled/jquery/ui/excite-bike.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_excite_bike.png" alt="Excite Bike" title="Excite Bike" /> <span class="themeName">Excite Bike</span></a></li> <li><a href="compiled/jquery/ui/vader.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_black_matte.png" alt="Vader" title="Vader" /> <span class="themeName">Vader</span></a></li> <li><a href="compiled/jquery/ui/dot-luv.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_dot_luv.png" alt="Dot Luv" title="Dot Luv" /> <span class="themeName">Dot Luv</span></a></li> <li><a href="compiled/jquery/ui/mint-choc.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_mint_choco.png" alt="Mint Choc" title="Mint Choc" /> <span class="themeName">Mint Choc</span></a></li></li> <li><a href="compiled/jquery/ui/black-tie.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_black_tie.png" alt="Black Tie" title="Black Tie" /> <span class="themeName">Black Tie</span></a></li></li> <li><a href="compiled/jquery/ui/trontastic.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_trontastic.png" alt="Trontastic" title="Trontastic" /><span class="themeName">Trontastic</span></a></li> <li><a href="compiled/jquery/ui/swanky-purse.css"> <img src="/images/jquery/ui/themeSwitcher/theme_90_swanky_purse.png" alt="Swanky Purse" title="Swanky Purse" /> <span class="themeName">Swanky Purse</span></a></li></ul></div></div>').find("div").removeAttr("id");
|
2
|
+
c.click(function(){b.is(":visible")?b.spHide():b.spShow();return!1});b.hover(function(){},function(){b.is(":visible")&&$(this).spHide()});$.fn.spShow=function(){$(this).css({top:c.offset().top+a.buttonHeight+6,left:c.offset().left}).slideDown(50);c.css(g);a.onOpen()};$.fn.spHide=function(){$(this).slideUp(50,function(){a.onClose()});c.css(f)};b.find("a").click(function(){var d=$(this).attr("href"),d=$('<link href="/stylesheets/'+d+'" type="text/css" rel="Stylesheet" class="ui-theme" />');$("head").append(d);
|
3
|
+
$("link.ui-theme").size()>3&&$("link.ui-theme:first").remove();d=$(this).find("span").text();c.find(".jquery-ui-themeswitcher-title").text(a.buttonPreText+d);$.cookie(a.cookieName,d);a.onSelect();a.closeOnSelect&&b.is(":visible")&&b.spHide();return!1});var f={fontFamily:"Trebuchet MS, Verdana, sans-serif",fontSize:"11px",color:"#666",background:'#eee image_url("jquery/ui/themeSwitcher/buttonbg.png") 50% 50% repeat-x',border:"1px solid #ccc","-moz-border-radius":"6px","-webkit-border-radius":"6px",
|
4
4
|
textDecoration:"none",padding:"3px 3px 3px 8px",width:a.width-11,display:"block",height:a.buttonHeight,outline:"0"},h={borderColor:"#bbb",background:"#f0f0f0",cursor:"pointer",color:"#444"},g={color:"#aaa",background:"#000",border:"1px solid #ccc",borderBottom:0,"-moz-border-radius-bottomleft":0,"-webkit-border-bottom-left-radius":0,"-moz-border-radius-bottomright":0,"-webkit-border-bottom-right-radius":0,outline:"0"};c.css(f).hover(function(){$(this).css(h)},function(){!b.is(":animated")&&b.is(":hidden")&&
|
5
5
|
$(this).css(f)}).find(".jquery-ui-themeswitcher-icon").css({"float":"right",width:"16px",height:"16px",background:'image_url("jquery/ui/themeSwitcher/icon_color_arrow.gif") 50% 50% no-repeat'});b.css({position:"absolute","float":"left",fontFamily:"Trebuchet MS, Verdana, sans-serif",fontSize:"12px",background:"#000",color:"#fff",padding:"8px 3px 3px",border:"1px solid #ccc","-moz-border-radius-bottomleft":"6px","-webkit-border-bottom-left-radius":"6px","-moz-border-radius-bottomright":"6px","-webkit-border-bottom-right-radius":"6px",
|
6
6
|
borderTop:0,zIndex:999999,width:a.width-6}).find("ul").css({listStyle:"none",margin:"0",padding:"0",overflow:"auto",height:a.height}).end().find("li").hover(function(){$(this).css({borderColor:"#555",background:'image_url("jquery/ui/themeSwitcher/menuhoverbg.png") 50% 50% repeat-x',cursor:"pointer"})},function(){$(this).css({borderColor:"#111",background:"#000",cursor:"auto"})}).css({width:a.width-30,height:"",padding:"2px",margin:"1px",border:"1px solid #111","-moz-border-radius":"4px",clear:"left",
|
7
|
-
"float":"left"}).end().find("a").css({color:"#aaa",textDecoration:"none","float":"left",width:"100%",outline:"0"}).end().find("img").css({"float":"left",border:"1px solid #333",margin:"0 2px"}).end().find(".themeName").css({"float":"left",margin:"3px 0"}).end();$(this).append(c);$("body").append(b);b.hide();if($.cookie(a.cookieName)||a.loadTheme)
|
7
|
+
"float":"left"}).end().find("a").css({color:"#aaa",textDecoration:"none","float":"left",width:"100%",outline:"0"}).end().find("img").css({"float":"left",border:"1px solid #333",margin:"0 2px"}).end().find(".themeName").css({"float":"left",margin:"3px 0"}).end();$(this).append(c);$("body").append(b);b.hide();if($.cookie(a.cookieName)||a.loadTheme)e=$.cookie(a.cookieName)||a.loadTheme,b.find("a:contains("+e+")").trigger("click");return this};
|
@@ -16,7 +16,7 @@
|
|
16
16
|
// The content field is a hierarchical array of strings and nested items (to be
|
17
17
|
// removed and replaced by nodes field of dom elements, once inserted in DOM).
|
18
18
|
var newItem = {
|
19
|
-
data: data || (parentItem ? parentItem.data : {}),
|
19
|
+
data: data || (data === 0 || data === false) ? data : (parentItem ? parentItem.data : {}),
|
20
20
|
_wrap: parentItem ? parentItem._wrap : null,
|
21
21
|
tmpl: null,
|
22
22
|
parent: parentItem || null,
|
@@ -195,7 +195,8 @@
|
|
195
195
|
// Return named compiled template
|
196
196
|
return name ? (typeof name !== "string" ? jQuery.template(null, name) :
|
197
197
|
(jQuery.template[name] ||
|
198
|
-
// If not in map,
|
198
|
+
// If not in map, and not containing at least on HTML tag, treat as a selector.
|
199
|
+
// (If integrated with core, use quickExpr.exec)
|
199
200
|
jQuery.template(null, htmlExpr.test(name) ? name : jQuery(name)))) : null;
|
200
201
|
},
|
201
202
|
|
@@ -209,15 +210,15 @@
|
|
209
210
|
tag: {
|
210
211
|
"tmpl": {
|
211
212
|
_default: { $2: "null" },
|
212
|
-
open: "if($notnull_1){
|
213
|
+
open: "if($notnull_1){__=__.concat($item.nest($1,$2));}"
|
213
214
|
// tmpl target parameter can be of type function, so use $1, not $1a (so not auto detection of functions)
|
214
215
|
// This means that {{tmpl foo}} treats foo as a template (which IS a function).
|
215
216
|
// Explicit parens can be used if foo is a function that returns a template: {{tmpl foo()}}.
|
216
217
|
},
|
217
218
|
"wrap": {
|
218
219
|
_default: { $2: "null" },
|
219
|
-
open: "$item.calls(
|
220
|
-
close: "call=$item.calls();
|
220
|
+
open: "$item.calls(__,$1,$2);__=[];",
|
221
|
+
close: "call=$item.calls();__=call._.concat($item.wrap(call,__));"
|
221
222
|
},
|
222
223
|
"each": {
|
223
224
|
_default: { $2: "$index, $value" },
|
@@ -234,12 +235,12 @@
|
|
234
235
|
},
|
235
236
|
"html": {
|
236
237
|
// Unecoded expression evaluation.
|
237
|
-
open: "if($notnull_1){
|
238
|
+
open: "if($notnull_1){__.push($1a);}"
|
238
239
|
},
|
239
240
|
"=": {
|
240
241
|
// Encoded expression evaluation. Abbreviated form is ${}.
|
241
242
|
_default: { $1: "$data" },
|
242
|
-
open: "if($notnull_1){
|
243
|
+
open: "if($notnull_1){__.push($.encode($1a));}"
|
243
244
|
},
|
244
245
|
"!": {
|
245
246
|
// Comment tag. Skipped by parser
|
@@ -316,10 +317,11 @@
|
|
316
317
|
// Generate a reusable function that will serve to render a template against data
|
317
318
|
function buildTmplFn(markup) {
|
318
319
|
return new Function("jQuery", "$item",
|
319
|
-
|
320
|
+
// Use the variable __ to hold a string array while building the compiled template. (See https://github.com/jquery/jquery-tmpl/issues#issue/10).
|
321
|
+
"var $=jQuery,call,__=[],$data=$item.data;" +
|
320
322
|
|
321
323
|
// Introduce the data as local variables using with(){}
|
322
|
-
"with($data){
|
324
|
+
"with($data){__.push('" +
|
323
325
|
|
324
326
|
// Convert the template into pure JavaScript
|
325
327
|
jQuery.trim(markup)
|
@@ -330,7 +332,7 @@
|
|
330
332
|
function(all, slash, type, fnargs, target, parens, args) {
|
331
333
|
var tag = jQuery.tmpl.tag[ type ], def, expr, exprAutoFnDetect;
|
332
334
|
if (!tag) {
|
333
|
-
throw "
|
335
|
+
throw "Unknown template tag: " + type;
|
334
336
|
}
|
335
337
|
def = tag._default || [];
|
336
338
|
if (parens && !/\w$/.test(target)) {
|
@@ -354,9 +356,9 @@
|
|
354
356
|
.split("$1a").join(exprAutoFnDetect)
|
355
357
|
.split("$1").join(expr)
|
356
358
|
.split("$2").join(fnargs || def.$2 || "") +
|
357
|
-
"
|
359
|
+
"__.push('";
|
358
360
|
}) +
|
359
|
-
"');}return
|
361
|
+
"');}return __;"
|
360
362
|
);
|
361
363
|
}
|
362
364
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
(function(d){function
|
2
|
-
function(
|
3
|
-
function(
|
4
|
-
"
|
5
|
-
|
6
|
-
b,e
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
open:"
|
12
|
-
|
1
|
+
(function(d){function m(a,b,e,c){c={data:c||c===0||c===!1?c:b?b.data:{},_wrap:b?b._wrap:null,tmpl:null,parent:b||null,nodes:[],calls:B,nest:C,wrap:D,html:E,update:F};a&&d.extend(c,a,{nodes:[],parent:b});if(e)c.tmpl=e,c._ctnt=c._ctnt||c.tmpl(d,c),c.key=++n,(t.length?o:j)[n]=c;return c}function p(a,b,e){var c,e=e?d.map(e,function(b){return typeof b==="string"?a.key?b.replace(/(<\w+)(?=[\s>])(?![^>]*_tmplitem)([^>]*)/g,"$1 "+l+'="'+a.key+'" $2'):b:p(b,a,b._ctnt)}):a;if(b)return e;e=e.join("");e.replace(/^\s*([^<\s][^<]*)?(<[\w\W]+>)([^>]*[^>\s])?\s*$/,
|
2
|
+
function(b,a,e,i){c=d(e).get();v(c);a&&(c=u(a).concat(c));i&&(c=c.concat(u(i)))});return c?c:u(e)}function u(a){var b=document.createElement("div");b.innerHTML=a;return d.makeArray(b.childNodes)}function w(a){return new Function("jQuery","$item","var $=jQuery,call,__=[],$data=$item.data;with($data){__.push('"+d.trim(a).replace(/([\\'])/g,"\\$1").replace(/[\r\t\n]/g," ").replace(/\$\{([^\}]*)\}/g,"{{= $1}}").replace(/\{\{(\/?)(\w+|.)(?:\(((?:[^\}]|\}(?!\}))*?)?\))?(?:\s+(.*?)?)?(\(((?:[^\}]|\}(?!\}))*?)\))?\s*\}\}/g,
|
3
|
+
function(a,e,c,g,h,f,i){a=d.tmpl.tag[c];if(!a)throw"Unknown template tag: "+c;c=a._default||[];f&&!/\w$/.test(h)&&(h+=f,f="");h?(h=q(h),i=i?","+q(i)+")":f?")":"",i=f?h.indexOf(".")>-1?h+q(f):"("+h+").call($item"+i:h,f=f?i:"(typeof("+h+")==='function'?("+h+").call($item):("+h+"))"):f=i=c.$1||"null";g=q(g);return"');"+a[e?"close":"open"].split("$notnull_1").join(h?"typeof("+h+")!=='undefined' && ("+h+")!=null":"true").split("$1a").join(f).split("$1").join(i).split("$2").join(g||c.$2||"")+"__.push('"})+
|
4
|
+
"');}return __;")}function x(a,b){a._wrap=p(a,!0,d.isArray(b)?b:[y.test(b)?b:d(b).html()]).join("")}function q(a){return a?a.replace(/\\'/g,"'").replace(/\\\\/g,"\\"):null}function v(a){function b(a){function b(a){var G;a+=e;G=h[a]=h[a]||m(f,j[f.parent.key+e]||f.parent),f=G}var c,g=a,f,i;if(i=a.getAttribute(l)){for(;g.parentNode&&(g=g.parentNode).nodeType===1&&!(c=g.getAttribute(l)););if(c!==i){g=g.parentNode?g.nodeType===11?0:g.getAttribute(l)||0:0;if(!(f=j[i]))f=o[i],f=m(f,j[g]||o[g]),f.key=++n,
|
5
|
+
j[n]=f;k&&b(i)}a.removeAttribute(l)}else if(k&&(f=d.data(a,"tmplItem")))b(f.key),j[f.key]=f,g=(g=d.data(a.parentNode,"tmplItem"))?g.key:0;if(f){for(c=f;c&&c.key!=g;)c.nodes.push(a),c=c.parent;delete f._ctnt;delete f._wrap;d.data(a,"tmplItem",f)}}var e="_"+k,c,g,h={},f,i,r;f=0;for(i=a.length;f<i;f++)if((c=a[f]).nodeType===1){g=c.getElementsByTagName("*");for(r=g.length-1;r>=0;r--)b(g[r]);b(c)}}function B(a,b,d,c){if(!a)return t.pop();t.push({_:a,tmpl:b,item:this,data:d,options:c})}function C(a,b,e){return d.tmpl(d.template(a),
|
6
|
+
b,e,this)}function D(a,b){var e=a.options||{};e.wrapped=b;return d.tmpl(d.template(a.tmpl),a.data,e,a.item)}function E(a,b){var e=this._wrap;return d.map(d(d.isArray(e)?e.join(""):e).filter(a||"*"),function(a){if(b)a=a.innerText||a.textContent;else{var d;if(!(d=a.outerHTML))d=document.createElement("div"),d.appendChild(a.cloneNode(!0)),d=d.innerHTML;a=d}return a})}function F(){var a=this.nodes;d.tmpl(null,null,null,this).insertBefore(a[0]);d(a).remove()}var z=d.fn.domManip,l="_tmplitem",y=/^[^<]*(<[\w\W]+>)[^>]*$|\{\{\! /,
|
7
|
+
j={},o={},s,A={key:0,data:{}},n=0,k=0,t=[];d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(e){var c=[],e=d(e),g,h,f;g=this.length===1&&this[0].parentNode;s=j||{};if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1)e[b](this[0]),c=this;else{h=0;for(f=e.length;h<f;h++)k=h,g=(h>0?this.clone(!0):this).get(),d(e[h])[b](g),c=c.concat(g);k=0;c=this.pushStack(c,a,e.selector)}e=s;s=null;d.tmpl.complete(e);
|
8
|
+
return c}});d.fn.extend({tmpl:function(a,b,e){return d.tmpl(this[0],a,b,e)},tmplItem:function(){return d.tmplItem(this[0])},template:function(a){return d.template(a,this[0])},domManip:function(a,b,e){if(a[0]&&d.isArray(a[0])){for(var c=d.makeArray(arguments),g=a[0],h=g.length,f=0,i;f<h&&!(i=d.data(g[f++],"tmplItem")););i&&k&&(c[2]=function(a){d.tmpl.afterManip(this,a,e)});z.apply(this,c)}else z.apply(this,arguments);k=0;s||d.tmpl.complete(j);return this}});d.extend({tmpl:function(a,b,e,c){var g=!c;
|
9
|
+
if(g)c=A,a=d.template[a]||d.template(null,a),o={};else if(!a)return a=c.tmpl,j[c.key]=c,c.nodes=[],c.wrapped&&x(c,c.wrapped),d(p(c,null,c.tmpl(d,c)));if(!a)return[];typeof b==="function"&&(b=b.call(c||{}));e&&e.wrapped&&x(e,e.wrapped);b=d.isArray(b)?d.map(b,function(b){return b?m(e,c,a,b):null}):[m(e,c,a,b)];return g?d(p(c,null,b)):b},tmplItem:function(a){var b;for(a instanceof d&&(a=a[0]);a&&a.nodeType===1&&!(b=d.data(a,"tmplItem"))&&(a=a.parentNode););return b||A},template:function(a,b){if(b)return typeof b===
|
10
|
+
"string"?b=w(b):b instanceof d&&(b=b[0]||{}),b.nodeType&&(b=d.data(b,"tmpl")||d.data(b,"tmpl",w(b.innerHTML))),typeof a==="string"?d.template[a]=b:b;return a?typeof a!=="string"?d.template(null,a):d.template[a]||d.template(null,y.test(a)?a:d(a)):null},encode:function(a){return(""+a).split("<").join("<").split(">").join(">").split('"').join(""").split("'").join("'")}});d.extend(d.tmpl,{tag:{tmpl:{_default:{$2:"null"},open:"if($notnull_1){__=__.concat($item.nest($1,$2));}"},wrap:{_default:{$2:"null"},
|
11
|
+
open:"$item.calls(__,$1,$2);__=[];",close:"call=$item.calls();__=call._.concat($item.wrap(call,__));"},each:{_default:{$2:"$index, $value"},open:"if($notnull_1){$.each($1a,function($2){with(this){",close:"}});}"},"if":{open:"if(($notnull_1) && $1a){",close:"}"},"else":{_default:{$1:"true"},open:"}else if(($notnull_1) && $1a){"},html:{open:"if($notnull_1){__.push($1a);}"},"=":{_default:{$1:"$data"},open:"if($notnull_1){__.push($.encode($1a));}"},"!":{open:""}},complete:function(){j={}},afterManip:function(a,
|
12
|
+
b,e){var c=b.nodeType===11?d.makeArray(b.childNodes):b.nodeType===1?[b]:[];e.call(a,b);v(c);k++}})})(jQuery);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
|
-
* tmplPlus.js: for jQuery Templates Plugin 1.0.0pre
|
2
|
+
* tmplPlus.js: for jQuery Templates Plugin 1.0.0pre
|
3
3
|
* Additional templating features or support for more advanced/less common scenarios.
|
4
|
-
* Requires jquery.tmpl.js
|
4
|
+
* Requires jquery.tmpl.js
|
5
5
|
* http://github.com/jquery/jquery-tmpl
|
6
6
|
*
|
7
7
|
* Copyright Software Freedom Conservancy, Inc.
|
@@ -1,3 +1,3 @@
|
|
1
|
-
(function(b){var
|
2
|
-
|
3
|
-
|
1
|
+
(function(b){var i=b.tmpl.complete,h=b.fn.domManip;b.tmpl.complete=function(c){var a;i(c);for(a in c)a=c[a],a.addedTmplItems&&b.inArray(a,a.addedTmplItems)===-1&&a.addedTmplItems.push(a);for(a in c)a=c[a],a.rendered&&a.rendered(a)};b.extend({tmplCmd:function(c,a,e){function d(a,b){for(var c=[],e,f,d=b.length,g,h=0,i=a.length;h<i;){g=a[h++];for(f=0;f<d;)e=b[f++],e.data===g&&c.push(e)}return c}var g=[],f,a=b.isArray(a)?a:[a];switch(c){case "find":return d(a,e);case "replace":a.reverse()}b.each(e?d(a,
|
2
|
+
e):a,function(a,d){coll=d.nodes;switch(c){case "update":d.update();break;case "remove":b(coll).remove();e&&e.splice(b.inArray(d,e),1);break;case "replace":f=f?b(coll).insertBefore(f)[0]:b(coll).appendTo(coll[0].parentNode)[0],g.unshift(d)}});return g}});b.fn.extend({domManip:function(c,a,e){var d=c[1],g=c[0],f;if(c.length>=2&&typeof d==="object"&&!d.nodeType&&!(d instanceof b))return f=b.makeArray(arguments),f[0]=[b.tmpl(b.template(g),d,c[2],c[3])],f[2]=function(a){b.tmpl.afterManip(this,a,e)},h.apply(this,
|
3
|
+
f);return h.apply(this,arguments)}})})(jQuery);
|
@@ -0,0 +1,729 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Plugin: Tokenizing Autocomplete Text Entry
|
3
|
+
* Version 1.4.2
|
4
|
+
*
|
5
|
+
* Copyright (c) 2009 James Smith (http://loopj.com)
|
6
|
+
* Licensed jointly under the GPL and MIT licenses,
|
7
|
+
* choose which one suits your project best!
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function ($) {
|
12
|
+
// Default settings
|
13
|
+
var DEFAULT_SETTINGS = {
|
14
|
+
hintText: "Type in a search term",
|
15
|
+
noResultsText: "No results",
|
16
|
+
searchingText: "Searching...",
|
17
|
+
deleteText: "×",
|
18
|
+
searchDelay: 300,
|
19
|
+
minChars: 1,
|
20
|
+
tokenLimit: null,
|
21
|
+
jsonContainer: null,
|
22
|
+
method: "GET",
|
23
|
+
contentType: "json",
|
24
|
+
queryParam: "q",
|
25
|
+
tokenDelimiter: ",",
|
26
|
+
preventDuplicates: false,
|
27
|
+
prePopulate: null,
|
28
|
+
animateDropdown: true,
|
29
|
+
onResult: null,
|
30
|
+
onAdd: null,
|
31
|
+
onDelete: null
|
32
|
+
};
|
33
|
+
|
34
|
+
// Default classes to use when theming
|
35
|
+
var DEFAULT_CLASSES = {
|
36
|
+
tokenList: "token-input-list",
|
37
|
+
token: "token-input-token",
|
38
|
+
tokenDelete: "token-input-delete-token",
|
39
|
+
selectedToken: "token-input-selected-token",
|
40
|
+
highlightedToken: "token-input-highlighted-token",
|
41
|
+
dropdown: "token-input-dropdown",
|
42
|
+
dropdownItem: "token-input-dropdown-item",
|
43
|
+
dropdownItem2: "token-input-dropdown-item2",
|
44
|
+
selectedDropdownItem: "token-input-selected-dropdown-item",
|
45
|
+
inputToken: "token-input-input-token"
|
46
|
+
};
|
47
|
+
|
48
|
+
// Input box position "enum"
|
49
|
+
var POSITION = {
|
50
|
+
BEFORE: 0,
|
51
|
+
AFTER: 1,
|
52
|
+
END: 2
|
53
|
+
};
|
54
|
+
|
55
|
+
// Keys "enum"
|
56
|
+
var KEY = {
|
57
|
+
BACKSPACE: 8,
|
58
|
+
TAB: 9,
|
59
|
+
ENTER: 13,
|
60
|
+
ESCAPE: 27,
|
61
|
+
SPACE: 32,
|
62
|
+
PAGE_UP: 33,
|
63
|
+
PAGE_DOWN: 34,
|
64
|
+
END: 35,
|
65
|
+
HOME: 36,
|
66
|
+
LEFT: 37,
|
67
|
+
UP: 38,
|
68
|
+
RIGHT: 39,
|
69
|
+
DOWN: 40,
|
70
|
+
NUMPAD_ENTER: 108,
|
71
|
+
COMMA: 188
|
72
|
+
};
|
73
|
+
|
74
|
+
|
75
|
+
// Expose the .tokenInput function to jQuery as a plugin
|
76
|
+
$.fn.tokenInput = function (url_or_data, options) {
|
77
|
+
var settings = $.extend({}, DEFAULT_SETTINGS, options || {});
|
78
|
+
|
79
|
+
return this.each(function () {
|
80
|
+
new $.TokenList(this, url_or_data, settings);
|
81
|
+
});
|
82
|
+
};
|
83
|
+
|
84
|
+
|
85
|
+
// TokenList class for each input
|
86
|
+
$.TokenList = function (input, url_or_data, settings) {
|
87
|
+
//
|
88
|
+
// Initialization
|
89
|
+
//
|
90
|
+
|
91
|
+
// Configure the data source
|
92
|
+
if(typeof(url_or_data) === "string") {
|
93
|
+
// Set the url to query against
|
94
|
+
settings.url = url_or_data;
|
95
|
+
|
96
|
+
// Make a smart guess about cross-domain if it wasn't explicitly specified
|
97
|
+
if(settings.crossDomain === undefined) {
|
98
|
+
if(settings.url.indexOf("://") === -1) {
|
99
|
+
settings.crossDomain = false;
|
100
|
+
} else {
|
101
|
+
settings.crossDomain = (location.href.split(/\/+/g)[1] !== settings.url.split(/\/+/g)[1]);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
} else if(typeof(url_or_data) === "object") {
|
105
|
+
// Set the local data to search through
|
106
|
+
settings.local_data = url_or_data;
|
107
|
+
}
|
108
|
+
|
109
|
+
// Build class names
|
110
|
+
if(settings.classes) {
|
111
|
+
// Use custom class names
|
112
|
+
settings.classes = $.extend({}, DEFAULT_CLASSES, settings.classes);
|
113
|
+
} else if(settings.theme) {
|
114
|
+
// Use theme-suffixed default class names
|
115
|
+
settings.classes = {};
|
116
|
+
$.each(DEFAULT_CLASSES, function(key, value) {
|
117
|
+
settings.classes[key] = value + "-" + settings.theme;
|
118
|
+
});
|
119
|
+
} else {
|
120
|
+
settings.classes = DEFAULT_CLASSES;
|
121
|
+
}
|
122
|
+
|
123
|
+
|
124
|
+
// Save the tokens
|
125
|
+
var saved_tokens = [];
|
126
|
+
|
127
|
+
// Keep track of the number of tokens in the list
|
128
|
+
var token_count = 0;
|
129
|
+
|
130
|
+
// Basic cache to save on db hits
|
131
|
+
var cache = new $.TokenList.Cache();
|
132
|
+
|
133
|
+
// Keep track of the timeout, old vals
|
134
|
+
var timeout;
|
135
|
+
var input_val;
|
136
|
+
|
137
|
+
// Create a new text input an attach keyup events
|
138
|
+
var input_box = $("<input type=\"text\" autocomplete=\"off\">")
|
139
|
+
.css({
|
140
|
+
outline: "none"
|
141
|
+
})
|
142
|
+
.focus(function () {
|
143
|
+
if (settings.tokenLimit === null || settings.tokenLimit !== token_count) {
|
144
|
+
show_dropdown_hint();
|
145
|
+
}
|
146
|
+
})
|
147
|
+
.blur(function () {
|
148
|
+
hide_dropdown();
|
149
|
+
})
|
150
|
+
.bind("keyup keydown blur update", resize_input)
|
151
|
+
.keydown(function (event) {
|
152
|
+
var previous_token;
|
153
|
+
var next_token;
|
154
|
+
|
155
|
+
switch(event.keyCode) {
|
156
|
+
case KEY.LEFT:
|
157
|
+
case KEY.RIGHT:
|
158
|
+
case KEY.UP:
|
159
|
+
case KEY.DOWN:
|
160
|
+
if(!$(this).val()) {
|
161
|
+
previous_token = input_token.prev();
|
162
|
+
next_token = input_token.next();
|
163
|
+
|
164
|
+
if((previous_token.length && previous_token.get(0) === selected_token) || (next_token.length && next_token.get(0) === selected_token)) {
|
165
|
+
// Check if there is a previous/next token and it is selected
|
166
|
+
if(event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) {
|
167
|
+
deselect_token($(selected_token), POSITION.BEFORE);
|
168
|
+
} else {
|
169
|
+
deselect_token($(selected_token), POSITION.AFTER);
|
170
|
+
}
|
171
|
+
} else if((event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) && previous_token.length) {
|
172
|
+
// We are moving left, select the previous token if it exists
|
173
|
+
select_token($(previous_token.get(0)));
|
174
|
+
} else if((event.keyCode === KEY.RIGHT || event.keyCode === KEY.DOWN) && next_token.length) {
|
175
|
+
// We are moving right, select the next token if it exists
|
176
|
+
select_token($(next_token.get(0)));
|
177
|
+
}
|
178
|
+
} else {
|
179
|
+
var dropdown_item = null;
|
180
|
+
|
181
|
+
if(event.keyCode === KEY.DOWN || event.keyCode === KEY.RIGHT) {
|
182
|
+
dropdown_item = $(selected_dropdown_item).next();
|
183
|
+
} else {
|
184
|
+
dropdown_item = $(selected_dropdown_item).prev();
|
185
|
+
}
|
186
|
+
|
187
|
+
if(dropdown_item.length) {
|
188
|
+
select_dropdown_item(dropdown_item);
|
189
|
+
}
|
190
|
+
return false;
|
191
|
+
}
|
192
|
+
break;
|
193
|
+
|
194
|
+
case KEY.BACKSPACE:
|
195
|
+
previous_token = input_token.prev();
|
196
|
+
|
197
|
+
if(!$(this).val().length) {
|
198
|
+
if(selected_token) {
|
199
|
+
delete_token($(selected_token));
|
200
|
+
} else if(previous_token.length) {
|
201
|
+
select_token($(previous_token.get(0)));
|
202
|
+
}
|
203
|
+
|
204
|
+
return false;
|
205
|
+
} else if($(this).val().length === 1) {
|
206
|
+
hide_dropdown();
|
207
|
+
} else {
|
208
|
+
// set a timeout just long enough to let this function finish.
|
209
|
+
setTimeout(function(){do_search();}, 5);
|
210
|
+
}
|
211
|
+
break;
|
212
|
+
|
213
|
+
case KEY.TAB:
|
214
|
+
case KEY.ENTER:
|
215
|
+
case KEY.NUMPAD_ENTER:
|
216
|
+
case KEY.COMMA:
|
217
|
+
if(selected_dropdown_item) {
|
218
|
+
add_token($(selected_dropdown_item));
|
219
|
+
return false;
|
220
|
+
}
|
221
|
+
break;
|
222
|
+
|
223
|
+
case KEY.ESCAPE:
|
224
|
+
hide_dropdown();
|
225
|
+
return true;
|
226
|
+
|
227
|
+
default:
|
228
|
+
if(String.fromCharCode(event.which)) {
|
229
|
+
// set a timeout just long enough to let this function finish.
|
230
|
+
setTimeout(function(){do_search();}, 5);
|
231
|
+
}
|
232
|
+
break;
|
233
|
+
}
|
234
|
+
});
|
235
|
+
|
236
|
+
// Keep a reference to the original input box
|
237
|
+
var hidden_input = $(input)
|
238
|
+
.hide()
|
239
|
+
.val("")
|
240
|
+
.focus(function () {
|
241
|
+
input_box.focus();
|
242
|
+
})
|
243
|
+
.blur(function () {
|
244
|
+
input_box.blur();
|
245
|
+
});
|
246
|
+
|
247
|
+
// Keep a reference to the selected token and dropdown item
|
248
|
+
var selected_token = null;
|
249
|
+
var selected_token_index = 0;
|
250
|
+
var selected_dropdown_item = null;
|
251
|
+
|
252
|
+
// The list to store the token items in
|
253
|
+
var token_list = $("<ul />")
|
254
|
+
.addClass(settings.classes.tokenList)
|
255
|
+
.click(function (event) {
|
256
|
+
var li = $(event.target).closest("li");
|
257
|
+
if(li && li.get(0) && $.data(li.get(0), "tokeninput")) {
|
258
|
+
toggle_select_token(li);
|
259
|
+
} else {
|
260
|
+
// Deselect selected token
|
261
|
+
if(selected_token) {
|
262
|
+
deselect_token($(selected_token), POSITION.END);
|
263
|
+
}
|
264
|
+
|
265
|
+
// Focus input box
|
266
|
+
input_box.focus();
|
267
|
+
}
|
268
|
+
})
|
269
|
+
.mouseover(function (event) {
|
270
|
+
var li = $(event.target).closest("li");
|
271
|
+
if(li && selected_token !== this) {
|
272
|
+
li.addClass(settings.classes.highlightedToken);
|
273
|
+
}
|
274
|
+
})
|
275
|
+
.mouseout(function (event) {
|
276
|
+
var li = $(event.target).closest("li");
|
277
|
+
if(li && selected_token !== this) {
|
278
|
+
li.removeClass(settings.classes.highlightedToken);
|
279
|
+
}
|
280
|
+
})
|
281
|
+
.insertBefore(hidden_input);
|
282
|
+
|
283
|
+
// The token holding the input box
|
284
|
+
var input_token = $("<li />")
|
285
|
+
.addClass(settings.classes.inputToken)
|
286
|
+
.appendTo(token_list)
|
287
|
+
.append(input_box);
|
288
|
+
|
289
|
+
// The list to store the dropdown items in
|
290
|
+
var dropdown = $("<div>")
|
291
|
+
.addClass(settings.classes.dropdown)
|
292
|
+
.appendTo("body")
|
293
|
+
.hide();
|
294
|
+
|
295
|
+
// Magic element to help us resize the text input
|
296
|
+
var input_resizer = $("<tester/>")
|
297
|
+
.insertAfter(input_box)
|
298
|
+
.css({
|
299
|
+
position: "absolute",
|
300
|
+
top: -9999,
|
301
|
+
left: -9999,
|
302
|
+
width: "auto",
|
303
|
+
fontSize: input_box.css("fontSize"),
|
304
|
+
fontFamily: input_box.css("fontFamily"),
|
305
|
+
fontWeight: input_box.css("fontWeight"),
|
306
|
+
letterSpacing: input_box.css("letterSpacing"),
|
307
|
+
whiteSpace: "nowrap"
|
308
|
+
});
|
309
|
+
|
310
|
+
// Pre-populate list if items exist
|
311
|
+
hidden_input.val("");
|
312
|
+
li_data = settings.prePopulate || hidden_input.data("pre");
|
313
|
+
if(li_data && li_data.length) {
|
314
|
+
$.each(li_data, function (index, value) {
|
315
|
+
insert_token(value.id, value.name);
|
316
|
+
});
|
317
|
+
}
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
//
|
322
|
+
// Private functions
|
323
|
+
//
|
324
|
+
|
325
|
+
function resize_input() {
|
326
|
+
if(input_val === (input_val = input_box.val())) {return;}
|
327
|
+
|
328
|
+
// Enter new content into resizer and resize input accordingly
|
329
|
+
var escaped = input_val.replace(/&/g, '&').replace(/\s/g,' ').replace(/</g, '<').replace(/>/g, '>');
|
330
|
+
input_resizer.html(escaped);
|
331
|
+
input_box.width(input_resizer.width() + 30);
|
332
|
+
}
|
333
|
+
|
334
|
+
function is_printable_character(keycode) {
|
335
|
+
return ((keycode >= 48 && keycode <= 90) || // 0-1a-z
|
336
|
+
(keycode >= 96 && keycode <= 111) || // numpad 0-9 + - / * .
|
337
|
+
(keycode >= 186 && keycode <= 192) || // ; = , - . / ^
|
338
|
+
(keycode >= 219 && keycode <= 222)); // ( \ ) '
|
339
|
+
}
|
340
|
+
|
341
|
+
// Inner function to a token to the list
|
342
|
+
function insert_token(id, value) {
|
343
|
+
var this_token = $("<li><p>"+ value +"</p></li>")
|
344
|
+
.addClass(settings.classes.token)
|
345
|
+
.insertBefore(input_token);
|
346
|
+
|
347
|
+
// The 'delete token' button
|
348
|
+
$("<span>" + settings.deleteText + "</span>")
|
349
|
+
.addClass(settings.classes.tokenDelete)
|
350
|
+
.appendTo(this_token)
|
351
|
+
.click(function () {
|
352
|
+
delete_token($(this).parent());
|
353
|
+
return false;
|
354
|
+
});
|
355
|
+
|
356
|
+
// Store data on the token
|
357
|
+
var token_data = {"id": id, "name": value};
|
358
|
+
$.data(this_token.get(0), "tokeninput", token_data);
|
359
|
+
|
360
|
+
// Save this token for duplicate checking
|
361
|
+
saved_tokens = saved_tokens.slice(0,selected_token_index).concat([token_data]).concat(saved_tokens.slice(selected_token_index));
|
362
|
+
selected_token_index++;
|
363
|
+
|
364
|
+
// Update the hidden input
|
365
|
+
var token_ids = $.map(saved_tokens, function (el) {
|
366
|
+
return el.id;
|
367
|
+
});
|
368
|
+
hidden_input.val(token_ids.join(settings.tokenDelimiter));
|
369
|
+
|
370
|
+
token_count += 1;
|
371
|
+
|
372
|
+
return this_token;
|
373
|
+
}
|
374
|
+
|
375
|
+
// Add a token to the token list based on user input
|
376
|
+
function add_token (item) {
|
377
|
+
var li_data = $.data(item.get(0), "tokeninput");
|
378
|
+
var callback = settings.onAdd;
|
379
|
+
|
380
|
+
// See if the token already exists and select it if we don't want duplicates
|
381
|
+
if(token_count > 0 && settings.preventDuplicates) {
|
382
|
+
var found_existing_token = null;
|
383
|
+
token_list.children().each(function () {
|
384
|
+
var existing_token = $(this);
|
385
|
+
var existing_data = $.data(existing_token.get(0), "tokeninput");
|
386
|
+
if(existing_data && existing_data.id === li_data.id) {
|
387
|
+
found_existing_token = existing_token;
|
388
|
+
return false;
|
389
|
+
}
|
390
|
+
});
|
391
|
+
|
392
|
+
if(found_existing_token) {
|
393
|
+
select_token(found_existing_token);
|
394
|
+
input_token.insertAfter(found_existing_token);
|
395
|
+
input_box.focus();
|
396
|
+
return;
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
// Insert the new tokens
|
401
|
+
insert_token(li_data.id, li_data.name);
|
402
|
+
|
403
|
+
// Check the token limit
|
404
|
+
if(settings.tokenLimit !== null && token_count >= settings.tokenLimit) {
|
405
|
+
input_box.hide();
|
406
|
+
hide_dropdown();
|
407
|
+
return;
|
408
|
+
} else {
|
409
|
+
input_box.focus();
|
410
|
+
}
|
411
|
+
|
412
|
+
// Clear input box
|
413
|
+
input_box.val("");
|
414
|
+
|
415
|
+
// Don't show the help dropdown, they've got the idea
|
416
|
+
hide_dropdown();
|
417
|
+
|
418
|
+
// Execute the onAdd callback if defined
|
419
|
+
if($.isFunction(callback)) {
|
420
|
+
callback(li_data);
|
421
|
+
}
|
422
|
+
}
|
423
|
+
|
424
|
+
// Select a token in the token list
|
425
|
+
function select_token (token) {
|
426
|
+
token.addClass(settings.classes.selectedToken);
|
427
|
+
selected_token = token.get(0);
|
428
|
+
|
429
|
+
// Hide input box
|
430
|
+
input_box.val("");
|
431
|
+
|
432
|
+
// Hide dropdown if it is visible (eg if we clicked to select token)
|
433
|
+
hide_dropdown();
|
434
|
+
}
|
435
|
+
|
436
|
+
// Deselect a token in the token list
|
437
|
+
function deselect_token (token, position) {
|
438
|
+
token.removeClass(settings.classes.selectedToken);
|
439
|
+
selected_token = null;
|
440
|
+
|
441
|
+
if(position === POSITION.BEFORE) {
|
442
|
+
input_token.insertBefore(token);
|
443
|
+
selected_token_index--;
|
444
|
+
} else if(position === POSITION.AFTER) {
|
445
|
+
input_token.insertAfter(token);
|
446
|
+
selected_token_index++;
|
447
|
+
} else {
|
448
|
+
input_token.appendTo(token_list);
|
449
|
+
selected_token_index = token_count;
|
450
|
+
}
|
451
|
+
|
452
|
+
// Show the input box and give it focus again
|
453
|
+
input_box.focus();
|
454
|
+
}
|
455
|
+
|
456
|
+
// Toggle selection of a token in the token list
|
457
|
+
function toggle_select_token(token) {
|
458
|
+
var previous_selected_token = selected_token;
|
459
|
+
|
460
|
+
if(selected_token) {
|
461
|
+
deselect_token($(selected_token), POSITION.END);
|
462
|
+
}
|
463
|
+
|
464
|
+
if(previous_selected_token === token.get(0)) {
|
465
|
+
deselect_token(token, POSITION.END);
|
466
|
+
} else {
|
467
|
+
select_token(token);
|
468
|
+
}
|
469
|
+
}
|
470
|
+
|
471
|
+
// Delete a token from the token list
|
472
|
+
function delete_token (token) {
|
473
|
+
// Remove the id from the saved list
|
474
|
+
var token_data = $.data(token.get(0), "tokeninput");
|
475
|
+
var callback = settings.onDelete;
|
476
|
+
|
477
|
+
var index = token.prevAll().length;
|
478
|
+
if(index > selected_token_index) index--;
|
479
|
+
|
480
|
+
// Delete the token
|
481
|
+
token.remove();
|
482
|
+
selected_token = null;
|
483
|
+
|
484
|
+
// Show the input box and give it focus again
|
485
|
+
input_box.focus();
|
486
|
+
|
487
|
+
// Remove this token from the saved list
|
488
|
+
saved_tokens = saved_tokens.slice(0,index).concat(saved_tokens.slice(index+1));
|
489
|
+
if(index < selected_token_index) selected_token_index--;
|
490
|
+
|
491
|
+
// Update the hidden input
|
492
|
+
var token_ids = $.map(saved_tokens, function (el) {
|
493
|
+
return el.id;
|
494
|
+
});
|
495
|
+
hidden_input.val(token_ids.join(settings.tokenDelimiter));
|
496
|
+
|
497
|
+
token_count -= 1;
|
498
|
+
|
499
|
+
if(settings.tokenLimit !== null) {
|
500
|
+
input_box
|
501
|
+
.show()
|
502
|
+
.val("")
|
503
|
+
.focus();
|
504
|
+
}
|
505
|
+
|
506
|
+
// Execute the onDelete callback if defined
|
507
|
+
if($.isFunction(callback)) {
|
508
|
+
callback(token_data);
|
509
|
+
}
|
510
|
+
}
|
511
|
+
|
512
|
+
// Hide and clear the results dropdown
|
513
|
+
function hide_dropdown () {
|
514
|
+
dropdown.hide().empty();
|
515
|
+
selected_dropdown_item = null;
|
516
|
+
}
|
517
|
+
|
518
|
+
function show_dropdown() {
|
519
|
+
dropdown
|
520
|
+
.css({
|
521
|
+
position: "absolute",
|
522
|
+
top: $(token_list).offset().top + $(token_list).outerHeight(),
|
523
|
+
left: $(token_list).offset().left,
|
524
|
+
zindex: 999
|
525
|
+
})
|
526
|
+
.show();
|
527
|
+
}
|
528
|
+
|
529
|
+
function show_dropdown_searching () {
|
530
|
+
if(settings.searchingText) {
|
531
|
+
dropdown.html("<p>"+settings.searchingText+"</p>");
|
532
|
+
show_dropdown();
|
533
|
+
}
|
534
|
+
}
|
535
|
+
|
536
|
+
function show_dropdown_hint () {
|
537
|
+
if(settings.hintText) {
|
538
|
+
dropdown.html("<p>"+settings.hintText+"</p>");
|
539
|
+
show_dropdown();
|
540
|
+
}
|
541
|
+
}
|
542
|
+
|
543
|
+
// Highlight the query part of the search term
|
544
|
+
function highlight_term(value, term) {
|
545
|
+
return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
|
546
|
+
}
|
547
|
+
|
548
|
+
// Populate the results dropdown with some results
|
549
|
+
function populate_dropdown (query, results) {
|
550
|
+
if(results && results.length) {
|
551
|
+
dropdown.empty();
|
552
|
+
var dropdown_ul = $("<ul>")
|
553
|
+
.appendTo(dropdown)
|
554
|
+
.mouseover(function (event) {
|
555
|
+
select_dropdown_item($(event.target).closest("li"));
|
556
|
+
})
|
557
|
+
.mousedown(function (event) {
|
558
|
+
add_token($(event.target).closest("li"));
|
559
|
+
return false;
|
560
|
+
})
|
561
|
+
.hide();
|
562
|
+
|
563
|
+
$.each(results, function(index, value) {
|
564
|
+
var this_li = $("<li>" + highlight_term(value.name, query) + "</li>")
|
565
|
+
.appendTo(dropdown_ul);
|
566
|
+
|
567
|
+
if(index % 2) {
|
568
|
+
this_li.addClass(settings.classes.dropdownItem);
|
569
|
+
} else {
|
570
|
+
this_li.addClass(settings.classes.dropdownItem2);
|
571
|
+
}
|
572
|
+
|
573
|
+
if(index === 0) {
|
574
|
+
select_dropdown_item(this_li);
|
575
|
+
}
|
576
|
+
|
577
|
+
$.data(this_li.get(0), "tokeninput", {"id": value.id, "name": value.name});
|
578
|
+
});
|
579
|
+
|
580
|
+
show_dropdown();
|
581
|
+
|
582
|
+
if(settings.animateDropdown) {
|
583
|
+
dropdown_ul.slideDown("fast");
|
584
|
+
} else {
|
585
|
+
dropdown_ul.show();
|
586
|
+
}
|
587
|
+
} else {
|
588
|
+
if(settings.noResultsText) {
|
589
|
+
dropdown.html("<p>"+settings.noResultsText+"</p>");
|
590
|
+
show_dropdown();
|
591
|
+
}
|
592
|
+
}
|
593
|
+
}
|
594
|
+
|
595
|
+
// Highlight an item in the results dropdown
|
596
|
+
function select_dropdown_item (item) {
|
597
|
+
if(item) {
|
598
|
+
if(selected_dropdown_item) {
|
599
|
+
deselect_dropdown_item($(selected_dropdown_item));
|
600
|
+
}
|
601
|
+
|
602
|
+
item.addClass(settings.classes.selectedDropdownItem);
|
603
|
+
selected_dropdown_item = item.get(0);
|
604
|
+
}
|
605
|
+
}
|
606
|
+
|
607
|
+
// Remove highlighting from an item in the results dropdown
|
608
|
+
function deselect_dropdown_item (item) {
|
609
|
+
item.removeClass(settings.classes.selectedDropdownItem);
|
610
|
+
selected_dropdown_item = null;
|
611
|
+
}
|
612
|
+
|
613
|
+
// Do a search and show the "searching" dropdown if the input is longer
|
614
|
+
// than settings.minChars
|
615
|
+
function do_search() {
|
616
|
+
var query = input_box.val().toLowerCase();
|
617
|
+
|
618
|
+
if(query && query.length) {
|
619
|
+
if(selected_token) {
|
620
|
+
deselect_token($(selected_token), POSITION.AFTER);
|
621
|
+
}
|
622
|
+
|
623
|
+
if(query.length >= settings.minChars) {
|
624
|
+
show_dropdown_searching();
|
625
|
+
clearTimeout(timeout);
|
626
|
+
|
627
|
+
timeout = setTimeout(function(){
|
628
|
+
run_search(query);
|
629
|
+
}, settings.searchDelay);
|
630
|
+
} else {
|
631
|
+
hide_dropdown();
|
632
|
+
}
|
633
|
+
}
|
634
|
+
}
|
635
|
+
|
636
|
+
// Do the actual search
|
637
|
+
function run_search(query) {
|
638
|
+
var cached_results = cache.get(query);
|
639
|
+
if(cached_results) {
|
640
|
+
populate_dropdown(query, cached_results);
|
641
|
+
} else {
|
642
|
+
// Are we doing an ajax search or local data search?
|
643
|
+
if(settings.url) {
|
644
|
+
// Extract exisiting get params
|
645
|
+
var ajax_params = {};
|
646
|
+
ajax_params.data = {};
|
647
|
+
if(settings.url.indexOf("?") > -1) {
|
648
|
+
var parts = settings.url.split("?");
|
649
|
+
ajax_params.url = parts[0];
|
650
|
+
|
651
|
+
var param_array = parts[1].split("&");
|
652
|
+
$.each(param_array, function (index, value) {
|
653
|
+
var kv = value.split("=");
|
654
|
+
ajax_params.data[kv[0]] = kv[1];
|
655
|
+
});
|
656
|
+
} else {
|
657
|
+
ajax_params.url = settings.url;
|
658
|
+
}
|
659
|
+
|
660
|
+
// Prepare the request
|
661
|
+
ajax_params.data[settings.queryParam] = query;
|
662
|
+
ajax_params.type = settings.method;
|
663
|
+
ajax_params.dataType = settings.contentType;
|
664
|
+
if(settings.crossDomain) {
|
665
|
+
ajax_params.dataType = "jsonp";
|
666
|
+
}
|
667
|
+
|
668
|
+
// Attach the success callback
|
669
|
+
ajax_params.success = function(results) {
|
670
|
+
if($.isFunction(settings.onResult)) {
|
671
|
+
results = settings.onResult.call(this, results);
|
672
|
+
}
|
673
|
+
cache.add(query, settings.jsonContainer ? results[settings.jsonContainer] : results);
|
674
|
+
|
675
|
+
// only populate the dropdown if the results are associated with the active search query
|
676
|
+
if(input_box.val().toLowerCase() === query) {
|
677
|
+
populate_dropdown(query, settings.jsonContainer ? results[settings.jsonContainer] : results);
|
678
|
+
}
|
679
|
+
};
|
680
|
+
|
681
|
+
// Make the request
|
682
|
+
$.ajax(ajax_params);
|
683
|
+
} else if(settings.local_data) {
|
684
|
+
// Do the search through local data
|
685
|
+
var results = $.grep(settings.local_data, function (row) {
|
686
|
+
return row.name.toLowerCase().indexOf(query.toLowerCase()) > -1;
|
687
|
+
});
|
688
|
+
|
689
|
+
if($.isFunction(settings.onResult)) {
|
690
|
+
results = settings.onResult.call(this, results);
|
691
|
+
}
|
692
|
+
cache.add(query, results);
|
693
|
+
populate_dropdown(query, results);
|
694
|
+
}
|
695
|
+
}
|
696
|
+
}
|
697
|
+
};
|
698
|
+
|
699
|
+
// Really basic cache for the results
|
700
|
+
$.TokenList.Cache = function (options) {
|
701
|
+
var settings = $.extend({
|
702
|
+
max_size: 500
|
703
|
+
}, options);
|
704
|
+
|
705
|
+
var data = {};
|
706
|
+
var size = 0;
|
707
|
+
|
708
|
+
var flush = function () {
|
709
|
+
data = {};
|
710
|
+
size = 0;
|
711
|
+
};
|
712
|
+
|
713
|
+
this.add = function (query, results) {
|
714
|
+
if(size > settings.max_size) {
|
715
|
+
flush();
|
716
|
+
}
|
717
|
+
|
718
|
+
if(!data[query]) {
|
719
|
+
size += 1;
|
720
|
+
}
|
721
|
+
|
722
|
+
data[query] = results;
|
723
|
+
};
|
724
|
+
|
725
|
+
this.get = function (query) {
|
726
|
+
return data[query];
|
727
|
+
};
|
728
|
+
};
|
729
|
+
}(jQuery));
|