compass-jquery-plugin 0.3.0.0 → 0.3.1.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +69 -13
- data/Rakefile +1 -1
- data/VERSION.yml +2 -2
- data/gem_tasks/jqgrid.rake +119 -0
- data/gem_tasks/jrails.rake +78 -77
- data/gem_tasks/mobile.rake +156 -0
- data/gem_tasks/rubygems.rake +5 -1
- data/gem_tasks/secret_sauce.rake +64 -0
- data/lib/jquery/gridify.rb +42 -0
- data/lib/jquery/gridify/assertions.rb +37 -0
- data/lib/jquery/gridify/grid.rb +210 -0
- data/lib/jquery/gridify/grid_column.rb +134 -0
- data/lib/jquery/gridify/grid_finder.rb +223 -0
- data/lib/jquery/gridify/grid_options.rb +279 -0
- data/lib/jquery/gridify/grid_view.rb +435 -0
- data/lib/jquery/jqgrid.rb +5 -0
- data/lib/jquery/jqgrid/jqgrid.rb +438 -0
- data/lib/jquery/mobile.rb +3 -0
- data/lib/jquery/secret_sauce.rb +9 -0
- data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +14 -0
- data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +18 -0
- data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +6 -0
- data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +118 -0
- data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +226 -0
- data/lib/jquery/secret_sauce/model/find_for_grid.rb +42 -0
- data/templates/dynatree/jquery.dynatree.js +258 -147
- data/templates/dynatree/jquery.dynatree.min.js +81 -79
- data/templates/dynatree/jquery/dynatree/aero.scss +35 -18
- data/templates/dynatree/jquery/dynatree/aero/drop_sibling_here.png +0 -0
- data/templates/dynatree/jquery/dynatree/aqua.scss +36 -19
- data/templates/dynatree/jquery/dynatree/aqua/drop_sibling_here.png +0 -0
- data/templates/dynatree/jquery/dynatree/crystal.scss +38 -21
- data/templates/dynatree/jquery/dynatree/crystal/drop_sibling_here.png +0 -0
- data/templates/dynatree/jquery/dynatree/xp.scss +59 -42
- data/templates/dynatree/jquery/dynatree/xp/drop_sibling_here.png +0 -0
- data/templates/dynatree/manifest.rb +4 -0
- data/templates/jqgrid/config/initializers/jqgrid.rb +4 -0
- data/templates/jqgrid/config/locales/jquery/jqgrid/de.yml +7 -0
- data/templates/jqgrid/config/locales/jquery/jqgrid/en.yml +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +132 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +132 -0
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cat.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cn.js +132 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cn.min.js +5 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-cs.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-da.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-da.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +133 -0
- data/templates/jqgrid/i18n/jqgrid/locale-de.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-el.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-en.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-es.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-es.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +125 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fa.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +130 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fi.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-fr.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-gl.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-gl.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-he.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-hu.js +129 -0
- data/templates/jqgrid/i18n/jqgrid/locale-hu.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-is.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +1 -0
- data/templates/jqgrid/i18n/jqgrid/locale-it.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ja.js +155 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ja.min.js +5 -0
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +149 -0
- data/templates/jqgrid/i18n/jqgrid/locale-nl.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +1 -0
- data/templates/jqgrid/i18n/jqgrid/locale-no.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pl.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +125 -0
- data/templates/jqgrid/i18n/jqgrid/locale-pt.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +139 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ro.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ru.min.js +7 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sk.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sk.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sr.js +128 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sr.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-sv.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +126 -0
- data/templates/jqgrid/i18n/jqgrid/locale-tr.min.js +6 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +127 -0
- data/templates/jqgrid/i18n/jqgrid/locale-ua.min.js +7 -0
- data/templates/jqgrid/jquery.jqGrid.js +11604 -0
- data/templates/jqgrid/jquery.jqGrid.min.js +472 -0
- data/templates/jqgrid/jquery/jqGrid.scss +692 -0
- data/templates/jqgrid/manifest.rb +72 -0
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +13 -0
- data/templates/jqtouch/jquery/touch/apple.scss +5 -5
- data/templates/jqtouch/jquery/touch/default.scss +5 -5
- data/templates/jqtouch/jquery/touch/jqt.scss +5 -5
- data/templates/jrails/config/initializers/jrails.rb +3 -0
- data/templates/jrails/jquery-ui.js +45 -62
- data/templates/jrails/jquery-ui.min.js +22 -22
- data/templates/jrails/jquery.js +340 -206
- data/templates/jrails/jquery.min.js +152 -151
- data/templates/jrails/jquery.tmpl.js +489 -0
- data/templates/jrails/jquery.tmpl.min.js +12 -0
- data/templates/jrails/jquery.tmplPlus.js +98 -0
- data/templates/jrails/jquery.tmplPlus.min.js +3 -0
- data/templates/jrails/jquery/ui/_theme.scss +3 -1
- data/templates/jrails/manifest.rb +4 -0
- data/templates/jstree/jquery.jstree.js +4479 -4468
- data/templates/jstree/jquery.jstree.min.js +4 -3
- data/templates/mobile/config/initializers/mobile.rb +6 -0
- data/templates/mobile/glyphish/Read me first - license.txt +14 -0
- data/templates/mobile/glyphish/icons-black/01-refresh.png +0 -0
- data/templates/mobile/glyphish/icons-black/02-redo.png +0 -0
- data/templates/mobile/glyphish/icons-black/03-loopback.png +0 -0
- data/templates/mobile/glyphish/icons-black/04-squiggle.png +0 -0
- data/templates/mobile/glyphish/icons-black/05-shuffle.png +0 -0
- data/templates/mobile/glyphish/icons-black/06-magnifying-glass.png +0 -0
- data/templates/mobile/glyphish/icons-black/07-map-marker.png +0 -0
- data/templates/mobile/glyphish/icons-black/08-chat.png +0 -0
- data/templates/mobile/glyphish/icons-black/09-chat2.png +0 -0
- data/templates/mobile/glyphish/icons-black/10-medical.png +0 -0
- data/templates/mobile/glyphish/icons-black/100-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-black/101-gameplan.png +0 -0
- data/templates/mobile/glyphish/icons-black/102-walk.png +0 -0
- data/templates/mobile/glyphish/icons-black/103-map.png +0 -0
- data/templates/mobile/glyphish/icons-black/104-index-cards.png +0 -0
- data/templates/mobile/glyphish/icons-black/105-piano.png +0 -0
- data/templates/mobile/glyphish/icons-black/106-sliders.png +0 -0
- data/templates/mobile/glyphish/icons-black/107-widescreen.png +0 -0
- data/templates/mobile/glyphish/icons-black/108-badge.png +0 -0
- data/templates/mobile/glyphish/icons-black/109-chicken.png +0 -0
- data/templates/mobile/glyphish/icons-black/11-clock.png +0 -0
- data/templates/mobile/glyphish/icons-black/110-bug.png +0 -0
- data/templates/mobile/glyphish/icons-black/111-user.png +0 -0
- data/templates/mobile/glyphish/icons-black/112-group.png +0 -0
- data/templates/mobile/glyphish/icons-black/113-navigation.png +0 -0
- data/templates/mobile/glyphish/icons-black/114-balloon.png +0 -0
- data/templates/mobile/glyphish/icons-black/115-bow-and-arrow.png +0 -0
- data/templates/mobile/glyphish/icons-black/116-controller.png +0 -0
- data/templates/mobile/glyphish/icons-black/117-todo.png +0 -0
- data/templates/mobile/glyphish/icons-black/118-coathanger.png +0 -0
- data/templates/mobile/glyphish/icons-black/119-piggybank.png +0 -0
- data/templates/mobile/glyphish/icons-black/12-eye.png +0 -0
- data/templates/mobile/glyphish/icons-black/120-headphones.png +0 -0
- data/templates/mobile/glyphish/icons-black/121-lanscape.png +0 -0
- data/templates/mobile/glyphish/icons-black/122-stats.png +0 -0
- data/templates/mobile/glyphish/icons-black/123-id-card.png +0 -0
- data/templates/mobile/glyphish/icons-black/124-bullhorn.png +0 -0
- data/templates/mobile/glyphish/icons-black/125-food.png +0 -0
- data/templates/mobile/glyphish/icons-black/126-moon.png +0 -0
- data/templates/mobile/glyphish/icons-black/127-sock.png +0 -0
- data/templates/mobile/glyphish/icons-black/128-bone.png +0 -0
- data/templates/mobile/glyphish/icons-black/129-golf.png +0 -0
- data/templates/mobile/glyphish/icons-black/13-target.png +0 -0
- data/templates/mobile/glyphish/icons-black/130-dice.png +0 -0
- data/templates/mobile/glyphish/icons-black/14-tag.png +0 -0
- data/templates/mobile/glyphish/icons-black/15-tags.png +0 -0
- data/templates/mobile/glyphish/icons-black/16-line-chart.png +0 -0
- data/templates/mobile/glyphish/icons-black/17-bar-chart.png +0 -0
- data/templates/mobile/glyphish/icons-black/18-envelope.png +0 -0
- data/templates/mobile/glyphish/icons-black/19-gear.png +0 -0
- data/templates/mobile/glyphish/icons-black/20-gear2.png +0 -0
- data/templates/mobile/glyphish/icons-black/21-skull.png +0 -0
- data/templates/mobile/glyphish/icons-black/22-skull-n-crossbones.png +0 -0
- data/templates/mobile/glyphish/icons-black/23-bird.png +0 -0
- data/templates/mobile/glyphish/icons-black/24-gift.png +0 -0
- data/templates/mobile/glyphish/icons-black/25-weather.png +0 -0
- data/templates/mobile/glyphish/icons-black/26-bandaid.png +0 -0
- data/templates/mobile/glyphish/icons-black/27-planet.png +0 -0
- data/templates/mobile/glyphish/icons-black/28-star.png +0 -0
- data/templates/mobile/glyphish/icons-black/29-heart.png +0 -0
- data/templates/mobile/glyphish/icons-black/30-key.png +0 -0
- data/templates/mobile/glyphish/icons-black/31-ipod.png +0 -0
- data/templates/mobile/glyphish/icons-black/32-iphone.png +0 -0
- data/templates/mobile/glyphish/icons-black/33-cabinet.png +0 -0
- data/templates/mobile/glyphish/icons-black/34-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-black/35-shopping-bag.png +0 -0
- data/templates/mobile/glyphish/icons-black/36-toolbox.png +0 -0
- data/templates/mobile/glyphish/icons-black/37-suitcase.png +0 -0
- data/templates/mobile/glyphish/icons-black/38-airplane.png +0 -0
- data/templates/mobile/glyphish/icons-black/39-spraycan.png +0 -0
- data/templates/mobile/glyphish/icons-black/40-inbox.png +0 -0
- data/templates/mobile/glyphish/icons-black/41-picture-frame.png +0 -0
- data/templates/mobile/glyphish/icons-black/42-photos.png +0 -0
- data/templates/mobile/glyphish/icons-black/43-film-roll.png +0 -0
- data/templates/mobile/glyphish/icons-black/44-shoebox.png +0 -0
- data/templates/mobile/glyphish/icons-black/45-movie1.png +0 -0
- data/templates/mobile/glyphish/icons-black/46-movie2.png +0 -0
- data/templates/mobile/glyphish/icons-black/47-fuel.png +0 -0
- data/templates/mobile/glyphish/icons-black/48-fork-and-knife.png +0 -0
- data/templates/mobile/glyphish/icons-black/49-battery.png +0 -0
- data/templates/mobile/glyphish/icons-black/50-beaker.png +0 -0
- data/templates/mobile/glyphish/icons-black/51-outlet.png +0 -0
- data/templates/mobile/glyphish/icons-black/52-pinetree.png +0 -0
- data/templates/mobile/glyphish/icons-black/53-house.png +0 -0
- data/templates/mobile/glyphish/icons-black/54-lock.png +0 -0
- data/templates/mobile/glyphish/icons-black/55-network.png +0 -0
- data/templates/mobile/glyphish/icons-black/56-cloud.png +0 -0
- data/templates/mobile/glyphish/icons-black/57-download.png +0 -0
- data/templates/mobile/glyphish/icons-black/58-bookmark.png +0 -0
- data/templates/mobile/glyphish/icons-black/59-flag.png +0 -0
- data/templates/mobile/glyphish/icons-black/60-signpost.png +0 -0
- data/templates/mobile/glyphish/icons-black/61-brightness.png +0 -0
- data/templates/mobile/glyphish/icons-black/62-contrast.png +0 -0
- data/templates/mobile/glyphish/icons-black/63-runner.png +0 -0
- data/templates/mobile/glyphish/icons-black/64-zap.png +0 -0
- data/templates/mobile/glyphish/icons-black/65-note.png +0 -0
- data/templates/mobile/glyphish/icons-black/66-microphone.png +0 -0
- data/templates/mobile/glyphish/icons-black/67-tshirt.png +0 -0
- data/templates/mobile/glyphish/icons-black/68-paperclip.png +0 -0
- data/templates/mobile/glyphish/icons-black/69-display.png +0 -0
- data/templates/mobile/glyphish/icons-black/70-tv.png +0 -0
- data/templates/mobile/glyphish/icons-black/71-compass.png +0 -0
- data/templates/mobile/glyphish/icons-black/72-pin.png +0 -0
- data/templates/mobile/glyphish/icons-black/73-radar.png +0 -0
- data/templates/mobile/glyphish/icons-black/74-location.png +0 -0
- data/templates/mobile/glyphish/icons-black/75-phone.png +0 -0
- data/templates/mobile/glyphish/icons-black/76-baby.png +0 -0
- data/templates/mobile/glyphish/icons-black/77-ekg.png +0 -0
- data/templates/mobile/glyphish/icons-black/78-stopwatch.png +0 -0
- data/templates/mobile/glyphish/icons-black/79-medical-bag.png +0 -0
- data/templates/mobile/glyphish/icons-black/80-shopping-cart.png +0 -0
- data/templates/mobile/glyphish/icons-black/81-dashboard.png +0 -0
- data/templates/mobile/glyphish/icons-black/82-dogpaw.png +0 -0
- data/templates/mobile/glyphish/icons-black/83-calendar.png +0 -0
- data/templates/mobile/glyphish/icons-black/84-lightbulb.png +0 -0
- data/templates/mobile/glyphish/icons-black/85-trophy.png +0 -0
- data/templates/mobile/glyphish/icons-black/86-camera.png +0 -0
- data/templates/mobile/glyphish/icons-black/87-wineglass.png +0 -0
- data/templates/mobile/glyphish/icons-black/88-beermug.png +0 -0
- data/templates/mobile/glyphish/icons-black/89-dumbbell.png +0 -0
- data/templates/mobile/glyphish/icons-black/90-lifebuoy.png +0 -0
- data/templates/mobile/glyphish/icons-black/91-beaker2.png +0 -0
- data/templates/mobile/glyphish/icons-black/92-testtube.png +0 -0
- data/templates/mobile/glyphish/icons-black/93-thermometer.png +0 -0
- data/templates/mobile/glyphish/icons-black/94-pill.png +0 -0
- data/templates/mobile/glyphish/icons-black/95-equalizer.png +0 -0
- data/templates/mobile/glyphish/icons-black/96-book.png +0 -0
- data/templates/mobile/glyphish/icons-black/97-puzzle.png +0 -0
- data/templates/mobile/glyphish/icons-black/98-palette.png +0 -0
- data/templates/mobile/glyphish/icons-black/99-umbrella.png +0 -0
- data/templates/mobile/glyphish/icons-white/09-chat2.png +0 -0
- data/templates/mobile/glyphish/icons-white/100-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-white/18-envelope.png +0 -0
- data/templates/mobile/glyphish/icons-white/19-gear.png +0 -0
- data/templates/mobile/glyphish/icons-white/21-skull.png +0 -0
- data/templates/mobile/glyphish/icons-white/30-key.png +0 -0
- data/templates/mobile/glyphish/icons-white/34-coffee.png +0 -0
- data/templates/mobile/glyphish/icons-white/88-beermug.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/band-aid.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/chat.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/clock.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/eye.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/flag.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/fork-and-knife.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/gear.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/heart.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/lightning-bolt.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/magnifying-glass.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/map-marker.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/map-pin.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/microphone.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/music-note.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/paw.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/plus.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/puzzle.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/star.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/tag.png +0 -0
- data/templates/mobile/glyphish/mini-icons-black/tshirt.png +0 -0
- data/templates/mobile/jquery.mobile.js +3995 -0
- data/templates/mobile/jquery.mobile.min.js +28 -0
- data/templates/mobile/jquery/mobile/_base.scss +1344 -0
- data/templates/mobile/jquery/mobile/default.scss +745 -0
- data/templates/mobile/jquery/mobile/default/ajax-loader.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-check-off.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-check-on.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-radio-off.png +0 -0
- data/templates/mobile/jquery/mobile/default/form-radio-on.png +0 -0
- data/templates/mobile/jquery/mobile/default/icon-search-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-18-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-18-white.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-36-black.png +0 -0
- data/templates/mobile/jquery/mobile/default/icons-36-white.png +0 -0
- data/templates/mobile/jquery/mobile/valencia.scss +807 -0
- data/templates/mobile/jquery/mobile/valencia/ajax-loader.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-check-off.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-check-on.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-radio-off.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/form-radio-on.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icon-search-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-18-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-18-white.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-36-black.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/icons-36-white.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/texture_05.png +0 -0
- data/templates/mobile/jquery/mobile/valencia/texture_075.png +0 -0
- data/templates/mobile/lib/tasks/jquery.mobile.rake +106 -0
- data/templates/mobile/manifest.rb +191 -0
- data/templates/secret_sauce/app/views/shared/_ui_form_error_messages.html.haml +6 -0
- data/templates/secret_sauce/app/views/shared/_ui_grid_for_without_block.js.haml +144 -0
- data/templates/secret_sauce/app/views/shared/_ui_static_dialog.html.haml +6 -0
- data/templates/secret_sauce/config/initializers/secret_sauce.rb +8 -0
- data/templates/secret_sauce/jquery/secret_sauce.scss +33 -0
- data/templates/secret_sauce/manifest.rb +10 -0
- data/templates/secret_sauce/secret_sauce.js +12 -0
- data/templates/secret_sauce/secret_sauce.min.js +1 -0
- metadata +313 -17
- data/.gitignore +0 -22
- data/compass-jquery-plugin.gemspec +0 -1064
@@ -7,7 +7,7 @@ c(this).addClass("jstree jstree-"+l),o);c.each(a[l]._get_settings().plugins,func
|
|
7
7
|
g,h){this.data={core:{}};this.get_settings=function(){return c.extend(true,{},h)};this._get_settings=function(){return h};this.get_index=function(){return b};this.get_container=function(){return g};this.get_container_ul=function(){return g.children("ul:eq(0)")};this._set_settings=function(j){h=c.extend(true,{},h,j)}},_fn:{},plugin:function(b,g){g=c.extend({},{__init:c.noop,__destroy:c.noop,_fn:{},defaults:false},g);f[b]=g;c.jstree.defaults[b]=g.defaults;c.each(g._fn,function(h,j){j.plugin=b;j.old=
|
8
8
|
c.jstree._fn[h];c.jstree._fn[h]=function(){var l,i=j,k=Array.prototype.slice.call(arguments);l=new c.Event("before.jstree");var m=false;if(!(this.data.core.locked===true&&h!=="unlock"&&h!=="is_locked")){do{if(i&&i.plugin&&c.inArray(i.plugin,this._get_settings().plugins)!==-1)break;i=i.old}while(i);if(i){if(h.indexOf("_")===0)l=i.apply(this,k);else{l=this.get_container().triggerHandler(l,{func:h,inst:this,args:k,plugin:i.plugin});if(l===false)return;if(typeof l!=="undefined")k=l;l=i.apply(c.extend({},
|
9
9
|
this,{__callback:function(o){this.get_container().triggerHandler(h+".jstree",{inst:this,args:k,rslt:o,rlbk:m})},__rollback:function(){return m=this.get_rollback()},__call_old:function(o){return i.old.apply(this,o?Array.prototype.slice.call(arguments,1):k)}}),k)}return l}}};c.jstree._fn[h].old=j.old;c.jstree._fn[h].plugin=b})},rollback:function(b){if(b){c.isArray(b)||(b=[b]);c.each(b,function(g,h){a[h.i].set_rollback(h.h,h.d)})}}};c.jstree._fn=c.jstree._instance.prototype={};c(function(){var b=navigator.userAgent.toLowerCase(),
|
10
|
-
g=(b.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],h=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";
|
10
|
+
g=(b.match(/.+?(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],h=".jstree ul, .jstree li { display:block; margin:0 0 0 0; padding:0 0 0 0; list-style-type:none; } .jstree li { display:block; min-height:18px; line-height:18px; white-space:nowrap; margin-left:18px; min-width:18px; } .jstree-rtl li { margin-left:0; margin-right:18px; } .jstree > ul > li { margin-left:0px; } .jstree-rtl > ul > li { margin-right:0px; } .jstree ins { display:inline-block; text-decoration:none; width:18px; height:18px; margin:0 0 0 0; padding:0; } .jstree a { display:inline-block; line-height:16px; height:16px; color:black; white-space:nowrap; text-decoration:none; padding:1px 2px; margin:0; } .jstree a:focus { outline: none; } .jstree a > ins { height:16px; width:16px; } .jstree a > .jstree-icon { margin-right:3px; } .jstree-rtl a > .jstree-icon { margin-left:3px; margin-right:0; } li.jstree-open > ul { display:block; } li.jstree-closed > ul { display:none; } ";
|
11
11
|
if(/msie/.test(b)&&parseInt(g,10)==6){r=true;try{document.execCommand("BackgroundImageCache",false,true)}catch(j){}h+=".jstree li { height:18px; margin-left:0; margin-right:0; } .jstree li li { margin-left:18px; } .jstree-rtl li li { margin-left:0px; margin-right:18px; } li.jstree-open ul { display:block; } li.jstree-closed ul { display:none !important; } .jstree li a { display:inline; border-width:0 !important; padding:0px 2px !important; } .jstree li a ins { height:16px; width:16px; margin-right:3px; } .jstree-rtl li a ins { margin-right:0px; margin-left:3px; } "}if(/msie/.test(b)&&
|
12
12
|
parseInt(g,10)==7){t=true;h+=".jstree li a { border-width:0 !important; padding:0px 2px !important; } "}if(!/compatible/.test(b)&&/mozilla/.test(b)&&parseFloat(g,10)<1.9){u=true;h+=".jstree ins { display:-moz-inline-box; } .jstree li { line-height:12px; } .jstree a { display:-moz-inline-box; } .jstree .jstree-no-icons .jstree-checkbox { display:-moz-inline-stack !important; } "}c.vakata.css.add_sheet({str:h,title:"jstree"})});c.jstree.plugin("core",{__init:function(){this.data.core.locked=false;this.data.core.to_open=
|
13
13
|
this.get_settings().core.initially_open;this.data.core.to_load=this.get_settings().core.initially_load},defaults:{html_titles:false,animation:500,initially_open:[],initially_load:[],open_parents:true,notify_plugins:true,rtl:false,load_open:false,strings:{loading:"Loading ...",new_node:"New node",multiple_selection:"Multiple selection"}},_fn:{init:function(){this.set_focus();this._get_settings().core.rtl&&this.get_container().addClass("jstree-rtl").css("direction","rtl");this.get_container().html("<ul><li class='jstree-last jstree-leaf'><ins> </ins><a class='jstree-loading' href='#'><ins class='jstree-icon'> </ins>"+
|
@@ -138,8 +138,9 @@ is_checked:function(a){a=this._get_node(a);return a.length?a.is(".jstree-checked
|
|
138
138
|
show_checkboxes:function(){this.get_container().children("ul").removeClass("jstree-no-checkboxes")},hide_checkboxes:function(){this.get_container().children("ul").addClass("jstree-no-checkboxes")},_repair_state:function(a){a=this._get_node(a);if(a.length){var d=this._get_settings().checkbox.real_checkboxes,f=a.find("> ul > .jstree-checked").length,e=a.find("> ul > .jstree-undetermined").length,b=a.find("> ul > li").length;if(b===0)a.hasClass("jstree-undetermined")&&this.change_state(a,false);else if(f===
|
139
139
|
0&&e===0)this.change_state(a,true);else if(f===b)this.change_state(a,false);else{a.parentsUntil(".jstree","li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");d&&a.parentsUntil(".jstree","li").andSelf().children(":checkbox").removeAttr("checked")}}},reselect:function(){if(this.data.ui&&this.data.checkbox.noui){var a=this,d=this.data.ui.to_select;d=c.map(c.makeArray(d),function(f){return"#"+f.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\/").replace(/\\\./g,
|
140
140
|
".").replace(/\./g,"\\.")});this.deselect_all();c.each(d,function(f,e){a.check_node(e)});this.__callback()}else this.__call_old()},save_loaded:function(){var a=this;this.data.core.to_load=[];this.get_container_ul().find("li.jstree-closed.jstree-undetermined").each(function(){this.id&&a.data.core.to_load.push("#"+this.id)})}}});c(function(){c.vakata.css.add_sheet({str:".jstree .jstree-real-checkbox { display:none; } ",title:"jstree"})})})(jQuery);(function(c){c.vakata.xslt=function(d,f,e){var b="",
|
141
|
-
g;if(document.recalc){g=document.createElement("xml");b=document.createElement("xml");g.innerHTML=d;b.innerHTML=f;c("body").append(g).append(b);setTimeout(function(h,j,l){return function(){l.call(null,h.transformNode(j.XMLDocument));setTimeout(function(i,k){return function(){c(i).remove();c(k).remove()}}(h,j),200)}}(g,b,e),100);return true}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor
|
142
|
-
typeof window.XMLSerializer!=="undefined":true;if(!b)return false;d=(new DOMParser).parseFromString(d,"text/xml");f=(new DOMParser).parseFromString(f,"text/xml");if(c.isFunction(g.transformDocument)){b=document.implementation.createDocument("","",null);g.transformDocument(d,
|
141
|
+
g;if(document.recalc){g=document.createElement("xml");b=document.createElement("xml");g.innerHTML=d;b.innerHTML=f;c("body").append(g).append(b);setTimeout(function(h,j,l){return function(){l.call(null,h.transformNode(j.XMLDocument));setTimeout(function(i,k){return function(){c(i).remove();c(k).remove()}}(h,j),200)}}(g,b,e),100);return true}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor==="undefined"){d=(new DOMParser).parseFromString(d,
|
142
|
+
"text/xml");f=(new DOMParser).parseFromString(f,"text/xml")}if(typeof window.DOMParser!=="undefined"&&typeof window.XMLHttpRequest!=="undefined"&&typeof window.XSLTProcessor!=="undefined"){g=new XSLTProcessor;b=c.isFunction(g.transformDocument)?typeof window.XMLSerializer!=="undefined":true;if(!b)return false;d=(new DOMParser).parseFromString(d,"text/xml");f=(new DOMParser).parseFromString(f,"text/xml");if(c.isFunction(g.transformDocument)){b=document.implementation.createDocument("","",null);g.transformDocument(d,
|
143
|
+
f,b,null);e.call(null,(new XMLSerializer).serializeToString(b))}else{g.importStylesheet(f);b=g.transformToFragment(d,document);e.call(null,c("<div />").append(b).html())}return true}return false};var a={nest:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/html" /><xsl:template match="/">\t<xsl:call-template name="nodes">\t\t<xsl:with-param name="node" select="/root" />\t</xsl:call-template></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<ul>\t<xsl:for-each select="$node/item">\t\t<xsl:variable name="children" select="count(./item) > 0" />\t\t<li>\t\t\t<xsl:attribute name="class">\t\t\t\t<xsl:if test="position() = last()">jstree-last </xsl:if>\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t\t\t</xsl:choose>\t\t\t\t<xsl:value-of select="@class" />\t\t\t</xsl:attribute>\t\t\t<xsl:for-each select="@*">\t\t\t\t<xsl:if test="name() != \'class\' and name() != \'state\' and name() != \'hasChildren\'">\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t</xsl:if>\t\t\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t\t\t<xsl:for-each select="content/name">\t\t\t\t<a>\t\t\t\t<xsl:attribute name="href">\t\t\t\t\t<xsl:choose>\t\t\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t\t\t</xsl:choose>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t\t\t<xsl:for-each select="@*">\t\t\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t\t\t</xsl:if>\t\t\t\t</xsl:for-each>\t\t\t\t\t<ins>\t\t\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t\t\t</xsl:attribute>\t\t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t\t\t<xsl:text> </xsl:text>\t\t\t\t\t</ins>\t\t\t\t\t<xsl:copy-of select="./child::node()" />\t\t\t\t</a>\t\t\t</xsl:for-each>\t\t\t<xsl:if test="$children or @hasChildren"><xsl:call-template name="nodes"><xsl:with-param name="node" select="current()" /></xsl:call-template></xsl:if>\t\t</li>\t</xsl:for-each>\t</ul></xsl:template></xsl:stylesheet>',
|
143
144
|
flat:'<?xml version="1.0" encoding="utf-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ><xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" standalone="no" indent="no" media-type="text/xml" /><xsl:template match="/">\t<ul>\t<xsl:for-each select="//item[not(@parent_id) or @parent_id=0 or not(@parent_id = //item/@id)]">\t\t<xsl:call-template name="nodes">\t\t\t<xsl:with-param name="node" select="." />\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t</xsl:call-template>\t</xsl:for-each>\t</ul></xsl:template><xsl:template name="nodes">\t<xsl:param name="node" />\t<xsl:param name="is_last" />\t<xsl:variable name="children" select="count(//item[@parent_id=$node/attribute::id]) > 0" />\t<li>\t<xsl:attribute name="class">\t\t<xsl:if test="$is_last = true()">jstree-last </xsl:if>\t\t<xsl:choose>\t\t\t<xsl:when test="@state = \'open\'">jstree-open </xsl:when>\t\t\t<xsl:when test="$children or @hasChildren or @state = \'closed\'">jstree-closed </xsl:when>\t\t\t<xsl:otherwise>jstree-leaf </xsl:otherwise>\t\t</xsl:choose>\t\t<xsl:value-of select="@class" />\t</xsl:attribute>\t<xsl:for-each select="@*">\t\t<xsl:if test="name() != \'parent_id\' and name() != \'hasChildren\' and name() != \'class\' and name() != \'state\'">\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t</xsl:if>\t</xsl:for-each>\t<ins class="jstree-icon"><xsl:text> </xsl:text></ins>\t<xsl:for-each select="content/name">\t\t<a>\t\t<xsl:attribute name="href">\t\t\t<xsl:choose>\t\t\t<xsl:when test="@href"><xsl:value-of select="@href" /></xsl:when>\t\t\t<xsl:otherwise>#</xsl:otherwise>\t\t\t</xsl:choose>\t\t</xsl:attribute>\t\t<xsl:attribute name="class"><xsl:value-of select="@lang" /> <xsl:value-of select="@class" /></xsl:attribute>\t\t<xsl:attribute name="style"><xsl:value-of select="@style" /></xsl:attribute>\t\t<xsl:for-each select="@*">\t\t\t<xsl:if test="name() != \'style\' and name() != \'class\' and name() != \'href\'">\t\t\t\t<xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>\t\t\t</xsl:if>\t\t</xsl:for-each>\t\t\t<ins>\t\t\t\t<xsl:attribute name="class">jstree-icon \t\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and not(contains(@icon,\'/\'))"><xsl:value-of select="@icon" /></xsl:if>\t\t\t\t</xsl:attribute>\t\t\t\t<xsl:if test="string-length(attribute::icon) > 0 and contains(@icon,\'/\')"><xsl:attribute name="style">background:url(<xsl:value-of select="@icon" />) center center no-repeat;</xsl:attribute></xsl:if>\t\t\t\t<xsl:text> </xsl:text>\t\t\t</ins>\t\t\t<xsl:copy-of select="./child::node()" />\t\t</a>\t</xsl:for-each>\t<xsl:if test="$children">\t\t<ul>\t\t<xsl:for-each select="//item[@parent_id=$node/attribute::id]">\t\t\t<xsl:call-template name="nodes">\t\t\t\t<xsl:with-param name="node" select="." />\t\t\t\t<xsl:with-param name="is_last" select="number(position() = last())" />\t\t\t</xsl:call-template>\t\t</xsl:for-each>\t\t</ul>\t</xsl:if>\t</li></xsl:template></xsl:stylesheet>'};
|
144
145
|
c.jstree.plugin("xml_data",{defaults:{data:false,ajax:false,xsl:"flat",clean_node:false,correct_state:true,get_skip_empty:false},_fn:{load_node:function(d,f,e){var b=this;this.load_node_xml(d,function(){b.__callback({obj:b._get_node(d)});f.call(this)},e)},_is_loaded:function(d){var f=this._get_settings().xml_data;d=this._get_node(d);return d==-1||!d||!f.ajax&&!c.isFunction(f.data)||d.is(".jstree-open, .jstree-leaf")||d.children("ul").children("li").size()>0},load_node_xml:function(d,f,e){var b=this.get_settings().xml_data,
|
145
146
|
g=function(){},h=function(){};if((d=this._get_node(d))&&d!==-1)if(d.data("jstree-is-loading"))return;else d.data("jstree-is-loading",true);switch(true){case !b.data&&!b.ajax:throw"Neither data nor ajax settings supplied.";case c.isFunction(b.data):b.data.call(this,d,c.proxy(function(j){this.parse_xml(j,c.proxy(function(l){if(l){l=l.replace(/ ?xmlns="[^"]*"/ig,"");if(l.length>10){l=c(l);if(d===-1||!d)this.get_container().children("ul").empty().append(l.children());else{d.children("a.jstree-loading").removeClass("jstree-loading");
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require 'jquery/mobile'
|
2
|
+
|
3
|
+
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :mobile_default => ['compiled/jquery/mobile/default.css']
|
4
|
+
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :mobile_valencia => ['compiled/jquery/mobile/valencia.css']
|
5
|
+
|
6
|
+
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :mobile => ['jquery.min', 'jquery.mobile.min']
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Created by Joseph Wain (see http://penandthink.com) at and probably downloaded from http://glyphish.com
|
2
|
+
|
3
|
+
This work is licensed under the Creative Commons Attribution 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
|
4
|
+
|
5
|
+
You are free to share it and to remix it remix under the following conditions:
|
6
|
+
|
7
|
+
* You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
|
8
|
+
* For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to http://creativecommons.org/licenses/by/3.0/us/
|
9
|
+
* Any of the above conditions can be waived if you get permission from the copyright holder (send me an email!).
|
10
|
+
* Apart from the remix rights granted under this license, nothing in this license impairs or restricts the author's moral rights.
|
11
|
+
|
12
|
+
ATTRIBUTION -- a note reading "icons by Joseph Wain / glyphish.com" or similar, plus a link back to glyphish.com from your app's website, is the preferred form of attribution. Also acceptable would be, like, a link from within your iPhone application, or from the iTunes store page, but those aren't as useful to other people. If none of these work for you, please contact hello@glyphish.com and we can work something out.
|
13
|
+
|
14
|
+
USE WITHOUT ATTRIBUTION -- If attribution is not possible, workable or desirable for your application, contact hello@glyphish.com for commercial non-attributed licensing terms.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,3995 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery UI Widget @VERSION
|
3
|
+
*
|
4
|
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
5
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6
|
+
* http://jquery.org/license
|
7
|
+
*
|
8
|
+
* http://docs.jquery.com/UI/Widget
|
9
|
+
*/
|
10
|
+
(function( $, undefined ) {
|
11
|
+
|
12
|
+
// jQuery 1.4+
|
13
|
+
if ( $.cleanData ) {
|
14
|
+
var _cleanData = $.cleanData;
|
15
|
+
$.cleanData = function( elems ) {
|
16
|
+
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
17
|
+
$( elem ).triggerHandler( "remove" );
|
18
|
+
}
|
19
|
+
_cleanData( elems );
|
20
|
+
};
|
21
|
+
} else {
|
22
|
+
var _remove = $.fn.remove;
|
23
|
+
$.fn.remove = function( selector, keepData ) {
|
24
|
+
return this.each(function() {
|
25
|
+
if ( !keepData ) {
|
26
|
+
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
27
|
+
$( "*", this ).add( [ this ] ).each(function() {
|
28
|
+
$( this ).triggerHandler( "remove" );
|
29
|
+
});
|
30
|
+
}
|
31
|
+
}
|
32
|
+
return _remove.call( $(this), selector, keepData );
|
33
|
+
});
|
34
|
+
};
|
35
|
+
}
|
36
|
+
|
37
|
+
$.widget = function( name, base, prototype ) {
|
38
|
+
var namespace = name.split( "." )[ 0 ],
|
39
|
+
fullName;
|
40
|
+
name = name.split( "." )[ 1 ];
|
41
|
+
fullName = namespace + "-" + name;
|
42
|
+
|
43
|
+
if ( !prototype ) {
|
44
|
+
prototype = base;
|
45
|
+
base = $.Widget;
|
46
|
+
}
|
47
|
+
|
48
|
+
// create selector for plugin
|
49
|
+
$.expr[ ":" ][ fullName ] = function( elem ) {
|
50
|
+
return !!$.data( elem, name );
|
51
|
+
};
|
52
|
+
|
53
|
+
$[ namespace ] = $[ namespace ] || {};
|
54
|
+
$[ namespace ][ name ] = function( options, element ) {
|
55
|
+
// allow instantiation without initializing for simple inheritance
|
56
|
+
if ( arguments.length ) {
|
57
|
+
this._createWidget( options, element );
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
var basePrototype = new base();
|
62
|
+
// we need to make the options hash a property directly on the new instance
|
63
|
+
// otherwise we'll modify the options hash on the prototype that we're
|
64
|
+
// inheriting from
|
65
|
+
// $.each( basePrototype, function( key, val ) {
|
66
|
+
// if ( $.isPlainObject(val) ) {
|
67
|
+
// basePrototype[ key ] = $.extend( {}, val );
|
68
|
+
// }
|
69
|
+
// });
|
70
|
+
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
71
|
+
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
72
|
+
namespace: namespace,
|
73
|
+
widgetName: name,
|
74
|
+
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
75
|
+
widgetBaseClass: fullName
|
76
|
+
}, prototype );
|
77
|
+
|
78
|
+
$.widget.bridge( name, $[ namespace ][ name ] );
|
79
|
+
};
|
80
|
+
|
81
|
+
$.widget.bridge = function( name, object ) {
|
82
|
+
$.fn[ name ] = function( options ) {
|
83
|
+
var isMethodCall = typeof options === "string",
|
84
|
+
args = Array.prototype.slice.call( arguments, 1 ),
|
85
|
+
returnValue = this;
|
86
|
+
|
87
|
+
// allow multiple hashes to be passed on init
|
88
|
+
options = !isMethodCall && args.length ?
|
89
|
+
$.extend.apply( null, [ true, options ].concat(args) ) :
|
90
|
+
options;
|
91
|
+
|
92
|
+
// prevent calls to internal methods
|
93
|
+
if ( isMethodCall && options.charAt( 0 ) === "_" ) {
|
94
|
+
return returnValue;
|
95
|
+
}
|
96
|
+
|
97
|
+
if ( isMethodCall ) {
|
98
|
+
this.each(function() {
|
99
|
+
var instance = $.data( this, name );
|
100
|
+
if ( !instance ) {
|
101
|
+
throw "cannot call methods on " + name + " prior to initialization; " +
|
102
|
+
"attempted to call method '" + options + "'";
|
103
|
+
}
|
104
|
+
if ( !$.isFunction( instance[options] ) ) {
|
105
|
+
throw "no such method '" + options + "' for " + name + " widget instance";
|
106
|
+
}
|
107
|
+
var methodValue = instance[ options ].apply( instance, args );
|
108
|
+
if ( methodValue !== instance && methodValue !== undefined ) {
|
109
|
+
returnValue = methodValue;
|
110
|
+
return false;
|
111
|
+
}
|
112
|
+
});
|
113
|
+
} else {
|
114
|
+
this.each(function() {
|
115
|
+
var instance = $.data( this, name );
|
116
|
+
if ( instance ) {
|
117
|
+
instance.option( options || {} )._init();
|
118
|
+
} else {
|
119
|
+
$.data( this, name, new object( options, this ) );
|
120
|
+
}
|
121
|
+
});
|
122
|
+
}
|
123
|
+
|
124
|
+
return returnValue;
|
125
|
+
};
|
126
|
+
};
|
127
|
+
|
128
|
+
$.Widget = function( options, element ) {
|
129
|
+
// allow instantiation without initializing for simple inheritance
|
130
|
+
if ( arguments.length ) {
|
131
|
+
this._createWidget( options, element );
|
132
|
+
}
|
133
|
+
};
|
134
|
+
|
135
|
+
$.Widget.prototype = {
|
136
|
+
widgetName: "widget",
|
137
|
+
widgetEventPrefix: "",
|
138
|
+
options: {
|
139
|
+
disabled: false
|
140
|
+
},
|
141
|
+
_createWidget: function( options, element ) {
|
142
|
+
// $.widget.bridge stores the plugin instance, but we do it anyway
|
143
|
+
// so that it's stored even before the _create function runs
|
144
|
+
$.data( element, this.widgetName, this );
|
145
|
+
this.element = $( element );
|
146
|
+
this.options = $.extend( true, {},
|
147
|
+
this.options,
|
148
|
+
this._getCreateOptions(),
|
149
|
+
options );
|
150
|
+
|
151
|
+
var self = this;
|
152
|
+
this.element.bind( "remove." + this.widgetName, function() {
|
153
|
+
self.destroy();
|
154
|
+
});
|
155
|
+
|
156
|
+
this._create();
|
157
|
+
this._trigger( "create" );
|
158
|
+
this._init();
|
159
|
+
},
|
160
|
+
_getCreateOptions: function() {
|
161
|
+
var options = {};
|
162
|
+
if ( $.metadata ) {
|
163
|
+
options = $.metadata.get( element )[ this.widgetName ];
|
164
|
+
}
|
165
|
+
return options;
|
166
|
+
},
|
167
|
+
_create: function() {},
|
168
|
+
_init: function() {},
|
169
|
+
|
170
|
+
destroy: function() {
|
171
|
+
this.element
|
172
|
+
.unbind( "." + this.widgetName )
|
173
|
+
.removeData( this.widgetName );
|
174
|
+
this.widget()
|
175
|
+
.unbind( "." + this.widgetName )
|
176
|
+
.removeAttr( "aria-disabled" )
|
177
|
+
.removeClass(
|
178
|
+
this.widgetBaseClass + "-disabled " +
|
179
|
+
"ui-state-disabled" );
|
180
|
+
},
|
181
|
+
|
182
|
+
widget: function() {
|
183
|
+
return this.element;
|
184
|
+
},
|
185
|
+
|
186
|
+
option: function( key, value ) {
|
187
|
+
var options = key;
|
188
|
+
|
189
|
+
if ( arguments.length === 0 ) {
|
190
|
+
// don't return a reference to the internal hash
|
191
|
+
return $.extend( {}, this.options );
|
192
|
+
}
|
193
|
+
|
194
|
+
if (typeof key === "string" ) {
|
195
|
+
if ( value === undefined ) {
|
196
|
+
return this.options[ key ];
|
197
|
+
}
|
198
|
+
options = {};
|
199
|
+
options[ key ] = value;
|
200
|
+
}
|
201
|
+
|
202
|
+
this._setOptions( options );
|
203
|
+
|
204
|
+
return this;
|
205
|
+
},
|
206
|
+
_setOptions: function( options ) {
|
207
|
+
var self = this;
|
208
|
+
$.each( options, function( key, value ) {
|
209
|
+
self._setOption( key, value );
|
210
|
+
});
|
211
|
+
|
212
|
+
return this;
|
213
|
+
},
|
214
|
+
_setOption: function( key, value ) {
|
215
|
+
this.options[ key ] = value;
|
216
|
+
|
217
|
+
if ( key === "disabled" ) {
|
218
|
+
this.widget()
|
219
|
+
[ value ? "addClass" : "removeClass"](
|
220
|
+
this.widgetBaseClass + "-disabled" + " " +
|
221
|
+
"ui-state-disabled" )
|
222
|
+
.attr( "aria-disabled", value );
|
223
|
+
}
|
224
|
+
|
225
|
+
return this;
|
226
|
+
},
|
227
|
+
|
228
|
+
enable: function() {
|
229
|
+
return this._setOption( "disabled", false );
|
230
|
+
},
|
231
|
+
disable: function() {
|
232
|
+
return this._setOption( "disabled", true );
|
233
|
+
},
|
234
|
+
|
235
|
+
_trigger: function( type, event, data ) {
|
236
|
+
var callback = this.options[ type ];
|
237
|
+
|
238
|
+
event = $.Event( event );
|
239
|
+
event.type = ( type === this.widgetEventPrefix ?
|
240
|
+
type :
|
241
|
+
this.widgetEventPrefix + type ).toLowerCase();
|
242
|
+
data = data || {};
|
243
|
+
|
244
|
+
// copy original event properties over to the new event
|
245
|
+
// this would happen if we could call $.event.fix instead of $.Event
|
246
|
+
// but we don't have a way to force an event to be fixed multiple times
|
247
|
+
if ( event.originalEvent ) {
|
248
|
+
for ( var i = $.event.props.length, prop; i; ) {
|
249
|
+
prop = $.event.props[ --i ];
|
250
|
+
event[ prop ] = event.originalEvent[ prop ];
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
this.element.trigger( event, data );
|
255
|
+
|
256
|
+
return !( $.isFunction(callback) &&
|
257
|
+
callback.call( this.element[0], event, data ) === false ||
|
258
|
+
event.isDefaultPrevented() );
|
259
|
+
}
|
260
|
+
};
|
261
|
+
|
262
|
+
})( jQuery );
|
263
|
+
|
264
|
+
|
265
|
+
/*
|
266
|
+
* jQuery Mobile Framework : widget factory extentions for mobile
|
267
|
+
* Copyright (c) jQuery Project
|
268
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
269
|
+
* http://jquery.org/license
|
270
|
+
*/
|
271
|
+
(function($, undefined ) {
|
272
|
+
|
273
|
+
$.widget( "mobile.widget", {
|
274
|
+
_getCreateOptions: function() {
|
275
|
+
var elem = this.element,
|
276
|
+
options = {};
|
277
|
+
$.each( this.options, function( option ) {
|
278
|
+
var value = elem.data( option.replace( /[A-Z]/g, function( c ) {
|
279
|
+
return "-" + c.toLowerCase();
|
280
|
+
} ) );
|
281
|
+
if ( value !== undefined ) {
|
282
|
+
options[ option ] = value;
|
283
|
+
}
|
284
|
+
});
|
285
|
+
return options;
|
286
|
+
}
|
287
|
+
});
|
288
|
+
|
289
|
+
})( jQuery );
|
290
|
+
|
291
|
+
|
292
|
+
/*
|
293
|
+
* jQuery Mobile Framework : resolution and CSS media query related helpers and behavior
|
294
|
+
* Copyright (c) jQuery Project
|
295
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
296
|
+
* http://jquery.org/license
|
297
|
+
*/
|
298
|
+
(function($, undefined ) {
|
299
|
+
|
300
|
+
var $window = $(window),
|
301
|
+
$html = $( "html" ),
|
302
|
+
|
303
|
+
//media-query-like width breakpoints, which are translated to classes on the html element
|
304
|
+
resolutionBreakpoints = [320,480,768,1024];
|
305
|
+
|
306
|
+
|
307
|
+
/* $.mobile.media method: pass a CSS media type or query and get a bool return
|
308
|
+
note: this feature relies on actual media query support for media queries, though types will work most anywhere
|
309
|
+
examples:
|
310
|
+
$.mobile.media('screen') //>> tests for screen media type
|
311
|
+
$.mobile.media('screen and (min-width: 480px)') //>> tests for screen media type with window width > 480px
|
312
|
+
$.mobile.media('@media screen and (-webkit-min-device-pixel-ratio: 2)') //>> tests for webkit 2x pixel ratio (iPhone 4)
|
313
|
+
*/
|
314
|
+
$.mobile.media = (function() {
|
315
|
+
// TODO: use window.matchMedia once at least one UA implements it
|
316
|
+
var cache = {},
|
317
|
+
testDiv = $( "<div id='jquery-mediatest'>" ),
|
318
|
+
fakeBody = $( "<body>" ).append( testDiv );
|
319
|
+
|
320
|
+
return function( query ) {
|
321
|
+
if ( !( query in cache ) ) {
|
322
|
+
var styleBlock = $( "<style type='text/css'>" +
|
323
|
+
"@media " + query + "{#jquery-mediatest{position:absolute;}}" +
|
324
|
+
"</style>" );
|
325
|
+
$html.prepend( fakeBody ).prepend( styleBlock );
|
326
|
+
cache[ query ] = testDiv.css( "position" ) === "absolute";
|
327
|
+
fakeBody.add( styleBlock ).remove();
|
328
|
+
}
|
329
|
+
return cache[ query ];
|
330
|
+
};
|
331
|
+
})();
|
332
|
+
|
333
|
+
/*
|
334
|
+
private function for adding/removing breakpoint classes to HTML element for faux media-query support
|
335
|
+
It does not require media query support, instead using JS to detect screen width > cross-browser support
|
336
|
+
This function is called on orientationchange, resize, and mobileinit, and is bound via the 'htmlclass' event namespace
|
337
|
+
*/
|
338
|
+
function detectResolutionBreakpoints(){
|
339
|
+
var currWidth = $window.width(),
|
340
|
+
minPrefix = "min-width-",
|
341
|
+
maxPrefix = "max-width-",
|
342
|
+
minBreakpoints = [],
|
343
|
+
maxBreakpoints = [],
|
344
|
+
unit = "px",
|
345
|
+
breakpointClasses;
|
346
|
+
|
347
|
+
$html.removeClass( minPrefix + resolutionBreakpoints.join(unit + " " + minPrefix) + unit + " " +
|
348
|
+
maxPrefix + resolutionBreakpoints.join( unit + " " + maxPrefix) + unit );
|
349
|
+
|
350
|
+
$.each(resolutionBreakpoints,function( i, breakPoint ){
|
351
|
+
if( currWidth >= breakPoint ){
|
352
|
+
minBreakpoints.push( minPrefix + breakPoint + unit );
|
353
|
+
}
|
354
|
+
if( currWidth <= breakPoint ){
|
355
|
+
maxBreakpoints.push( maxPrefix + breakPoint + unit );
|
356
|
+
}
|
357
|
+
});
|
358
|
+
|
359
|
+
if( minBreakpoints.length ){ breakpointClasses = minBreakpoints.join(" "); }
|
360
|
+
if( maxBreakpoints.length ){ breakpointClasses += " " + maxBreakpoints.join(" "); }
|
361
|
+
|
362
|
+
$html.addClass( breakpointClasses );
|
363
|
+
};
|
364
|
+
|
365
|
+
/* $.mobile.addResolutionBreakpoints method:
|
366
|
+
pass either a number or an array of numbers and they'll be added to the min/max breakpoint classes
|
367
|
+
Examples:
|
368
|
+
$.mobile.addResolutionBreakpoints( 500 );
|
369
|
+
$.mobile.addResolutionBreakpoints( [500, 1200] );
|
370
|
+
*/
|
371
|
+
$.mobile.addResolutionBreakpoints = function( newbps ){
|
372
|
+
if( $.type( newbps ) === "array" ){
|
373
|
+
resolutionBreakpoints = resolutionBreakpoints.concat( newbps );
|
374
|
+
}
|
375
|
+
else {
|
376
|
+
resolutionBreakpoints.push( newbps );
|
377
|
+
}
|
378
|
+
resolutionBreakpoints.sort(function(a,b){ return a-b; });
|
379
|
+
detectResolutionBreakpoints();
|
380
|
+
};
|
381
|
+
|
382
|
+
/* on mobileinit, add classes to HTML element
|
383
|
+
and set handlers to update those on orientationchange and resize*/
|
384
|
+
$(document).bind("mobileinit.htmlclass", function(){
|
385
|
+
/* bind to orientationchange and resize
|
386
|
+
to add classes to HTML element for min/max breakpoints and orientation */
|
387
|
+
$window.bind("orientationchange.htmlclass resize.htmlclass", function(event){
|
388
|
+
//add orientation class to HTML element on flip/resize.
|
389
|
+
if(event.orientation){
|
390
|
+
$html.removeClass( "portrait landscape" ).addClass( event.orientation );
|
391
|
+
}
|
392
|
+
//add classes to HTML element for min/max breakpoints
|
393
|
+
detectResolutionBreakpoints();
|
394
|
+
});
|
395
|
+
|
396
|
+
//trigger event manually
|
397
|
+
$window.trigger( "orientationchange.htmlclass" );
|
398
|
+
});
|
399
|
+
|
400
|
+
})(jQuery);
|
401
|
+
|
402
|
+
/*
|
403
|
+
* jQuery Mobile Framework : support tests
|
404
|
+
* Copyright (c) jQuery Project
|
405
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
406
|
+
* http://jquery.org/license
|
407
|
+
*/
|
408
|
+
(function($, undefined ) {
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
var fakeBody = $( "<body>" ).prependTo( "html" ),
|
413
|
+
fbCSS = fakeBody[0].style,
|
414
|
+
vendors = ['webkit','moz','o'],
|
415
|
+
webos = window.palmGetResource || window.PalmServiceBridge, //only used to rule out scrollTop
|
416
|
+
bb = window.blackberry; //only used to rule out box shadow, as it's filled opaque on BB
|
417
|
+
|
418
|
+
//thx Modernizr
|
419
|
+
function propExists( prop ){
|
420
|
+
var uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1),
|
421
|
+
props = (prop + ' ' + vendors.join(uc_prop + ' ') + uc_prop).split(' ');
|
422
|
+
for(var v in props){
|
423
|
+
if( fbCSS[ props[v] ] !== undefined ){
|
424
|
+
return true;
|
425
|
+
}
|
426
|
+
}
|
427
|
+
};
|
428
|
+
|
429
|
+
//test for dynamic-updating base tag support (allows us to avoid href,src attr rewriting)
|
430
|
+
function baseTagTest(){
|
431
|
+
var fauxBase = location.protocol + '//' + location.host + location.pathname + "ui-dir/",
|
432
|
+
base = $("<base>", {"href": fauxBase}).appendTo("head"),
|
433
|
+
link = $( "<a href='testurl'></a>" ).prependTo( fakeBody ),
|
434
|
+
rebase = link[0].href;
|
435
|
+
base.remove();
|
436
|
+
return rebase.indexOf(fauxBase) === 0;
|
437
|
+
};
|
438
|
+
|
439
|
+
$.extend( $.support, {
|
440
|
+
orientation: "orientation" in window,
|
441
|
+
touch: "ontouchend" in document,
|
442
|
+
cssTransitions: "WebKitTransitionEvent" in window,
|
443
|
+
pushState: !!history.pushState,
|
444
|
+
mediaquery: $.mobile.media('only all'),
|
445
|
+
cssPseudoElement: !!propExists('content'),
|
446
|
+
boxShadow: !!propExists('boxShadow') && !bb,
|
447
|
+
scrollTop: ("pageXOffset" in window || "scrollTop" in document.documentElement || "scrollTop" in fakeBody[0]) && !webos,
|
448
|
+
dynamicBaseTag: baseTagTest()
|
449
|
+
});
|
450
|
+
|
451
|
+
fakeBody.remove();
|
452
|
+
|
453
|
+
//for ruling out shadows via css
|
454
|
+
if( !$.support.boxShadow ){ $('html').addClass('ui-mobile-nosupport-boxshadow'); }
|
455
|
+
|
456
|
+
})( jQuery );
|
457
|
+
|
458
|
+
/*
|
459
|
+
* jQuery Mobile Framework : events
|
460
|
+
* Copyright (c) jQuery Project
|
461
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
462
|
+
* http://jquery.org/license
|
463
|
+
*/
|
464
|
+
(function($, undefined ) {
|
465
|
+
|
466
|
+
// add new event shortcuts
|
467
|
+
$.each( "touchstart touchmove touchend orientationchange tap taphold swipe swipeleft swiperight scrollstart scrollstop".split( " " ), function( i, name ) {
|
468
|
+
$.fn[ name ] = function( fn ) {
|
469
|
+
return fn ? this.bind( name, fn ) : this.trigger( name );
|
470
|
+
};
|
471
|
+
$.attrFn[ name ] = true;
|
472
|
+
});
|
473
|
+
|
474
|
+
var supportTouch = $.support.touch,
|
475
|
+
scrollEvent = "touchmove scroll",
|
476
|
+
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
|
477
|
+
touchStopEvent = supportTouch ? "touchend" : "mouseup",
|
478
|
+
touchMoveEvent = supportTouch ? "touchmove" : "mousemove";
|
479
|
+
|
480
|
+
// also handles scrollstop
|
481
|
+
$.event.special.scrollstart = {
|
482
|
+
enabled: true,
|
483
|
+
|
484
|
+
setup: function() {
|
485
|
+
var thisObject = this,
|
486
|
+
$this = $( thisObject ),
|
487
|
+
scrolling,
|
488
|
+
timer;
|
489
|
+
|
490
|
+
function trigger( event, state ) {
|
491
|
+
scrolling = state;
|
492
|
+
var originalType = event.type;
|
493
|
+
event.type = scrolling ? "scrollstart" : "scrollstop";
|
494
|
+
$.event.handle.call( thisObject, event );
|
495
|
+
event.type = originalType;
|
496
|
+
}
|
497
|
+
|
498
|
+
// iPhone triggers scroll after a small delay; use touchmove instead
|
499
|
+
$this.bind( scrollEvent, function( event ) {
|
500
|
+
if ( !$.event.special.scrollstart.enabled ) {
|
501
|
+
return;
|
502
|
+
}
|
503
|
+
|
504
|
+
if ( !scrolling ) {
|
505
|
+
trigger( event, true );
|
506
|
+
}
|
507
|
+
|
508
|
+
clearTimeout( timer );
|
509
|
+
timer = setTimeout(function() {
|
510
|
+
trigger( event, false );
|
511
|
+
}, 50 );
|
512
|
+
});
|
513
|
+
}
|
514
|
+
};
|
515
|
+
|
516
|
+
// also handles taphold
|
517
|
+
$.event.special.tap = {
|
518
|
+
setup: function() {
|
519
|
+
var thisObject = this,
|
520
|
+
$this = $( thisObject );
|
521
|
+
|
522
|
+
$this
|
523
|
+
.bind( touchStartEvent, function( event ) {
|
524
|
+
if ( event.which && event.which !== 1 ) {
|
525
|
+
return;
|
526
|
+
}
|
527
|
+
|
528
|
+
var moved = false,
|
529
|
+
touching = true,
|
530
|
+
origPos = [ event.pageX, event.pageY ],
|
531
|
+
originalType,
|
532
|
+
timer;
|
533
|
+
|
534
|
+
function moveHandler() {
|
535
|
+
if ((Math.abs(origPos[0] - event.pageX) > 10) ||
|
536
|
+
(Math.abs(origPos[1] - event.pageY) > 10)) {
|
537
|
+
moved = true;
|
538
|
+
}
|
539
|
+
}
|
540
|
+
|
541
|
+
timer = setTimeout(function() {
|
542
|
+
if ( touching && !moved ) {
|
543
|
+
originalType = event.type;
|
544
|
+
event.type = "taphold";
|
545
|
+
$.event.handle.call( thisObject, event );
|
546
|
+
event.type = originalType;
|
547
|
+
}
|
548
|
+
}, 750 );
|
549
|
+
|
550
|
+
$this
|
551
|
+
.one( touchMoveEvent, moveHandler)
|
552
|
+
.one( touchStopEvent, function( event ) {
|
553
|
+
$this.unbind( touchMoveEvent, moveHandler );
|
554
|
+
clearTimeout( timer );
|
555
|
+
touching = false;
|
556
|
+
|
557
|
+
if ( !moved ) {
|
558
|
+
originalType = event.type;
|
559
|
+
event.type = "tap";
|
560
|
+
$.event.handle.call( thisObject, event );
|
561
|
+
event.type = originalType;
|
562
|
+
}
|
563
|
+
});
|
564
|
+
});
|
565
|
+
}
|
566
|
+
};
|
567
|
+
|
568
|
+
// also handles swipeleft, swiperight
|
569
|
+
$.event.special.swipe = {
|
570
|
+
setup: function() {
|
571
|
+
var thisObject = this,
|
572
|
+
$this = $( thisObject );
|
573
|
+
|
574
|
+
$this
|
575
|
+
.bind( touchStartEvent, function( event ) {
|
576
|
+
var data = event.originalEvent.touches ?
|
577
|
+
event.originalEvent.touches[ 0 ] :
|
578
|
+
event,
|
579
|
+
start = {
|
580
|
+
time: (new Date).getTime(),
|
581
|
+
coords: [ data.pageX, data.pageY ],
|
582
|
+
origin: $( event.target )
|
583
|
+
},
|
584
|
+
stop;
|
585
|
+
|
586
|
+
function moveHandler( event ) {
|
587
|
+
if ( !start ) {
|
588
|
+
return;
|
589
|
+
}
|
590
|
+
|
591
|
+
var data = event.originalEvent.touches ?
|
592
|
+
event.originalEvent.touches[ 0 ] :
|
593
|
+
event;
|
594
|
+
stop = {
|
595
|
+
time: (new Date).getTime(),
|
596
|
+
coords: [ data.pageX, data.pageY ]
|
597
|
+
};
|
598
|
+
|
599
|
+
// prevent scrolling
|
600
|
+
if ( Math.abs( start.coords[0] - stop.coords[0] ) > 10 ) {
|
601
|
+
event.preventDefault();
|
602
|
+
}
|
603
|
+
}
|
604
|
+
|
605
|
+
$this
|
606
|
+
.bind( touchMoveEvent, moveHandler )
|
607
|
+
.one( touchStopEvent, function( event ) {
|
608
|
+
$this.unbind( touchMoveEvent, moveHandler );
|
609
|
+
if ( start && stop ) {
|
610
|
+
if ( stop.time - start.time < 1000 &&
|
611
|
+
Math.abs( start.coords[0] - stop.coords[0]) > 30 &&
|
612
|
+
Math.abs( start.coords[1] - stop.coords[1]) < 75 ) {
|
613
|
+
start.origin
|
614
|
+
.trigger( "swipe" )
|
615
|
+
.trigger( start.coords[0] > stop.coords[0] ? "swipeleft" : "swiperight" );
|
616
|
+
}
|
617
|
+
}
|
618
|
+
start = stop = undefined;
|
619
|
+
});
|
620
|
+
});
|
621
|
+
}
|
622
|
+
};
|
623
|
+
|
624
|
+
(function($){
|
625
|
+
// "Cowboy" Ben Alman
|
626
|
+
|
627
|
+
var win = $(window),
|
628
|
+
special_event,
|
629
|
+
get_orientation,
|
630
|
+
last_orientation;
|
631
|
+
|
632
|
+
$.event.special.orientationchange = special_event = {
|
633
|
+
setup: function(){
|
634
|
+
// If the event is supported natively, return false so that jQuery
|
635
|
+
// will bind to the event using DOM methods.
|
636
|
+
if ( $.support.orientation ) { return false; }
|
637
|
+
|
638
|
+
// Get the current orientation to avoid initial double-triggering.
|
639
|
+
last_orientation = get_orientation();
|
640
|
+
|
641
|
+
// Because the orientationchange event doesn't exist, simulate the
|
642
|
+
// event by testing window dimensions on resize.
|
643
|
+
win.bind( "resize", handler );
|
644
|
+
},
|
645
|
+
teardown: function(){
|
646
|
+
// If the event is not supported natively, return false so that
|
647
|
+
// jQuery will unbind the event using DOM methods.
|
648
|
+
if ( $.support.orientation ) { return false; }
|
649
|
+
|
650
|
+
// Because the orientationchange event doesn't exist, unbind the
|
651
|
+
// resize event handler.
|
652
|
+
win.unbind( "resize", handler );
|
653
|
+
},
|
654
|
+
add: function( handleObj ) {
|
655
|
+
// Save a reference to the bound event handler.
|
656
|
+
var old_handler = handleObj.handler;
|
657
|
+
|
658
|
+
handleObj.handler = function( event ) {
|
659
|
+
// Modify event object, adding the .orientation property.
|
660
|
+
event.orientation = get_orientation();
|
661
|
+
|
662
|
+
// Call the originally-bound event handler and return its result.
|
663
|
+
return old_handler.apply( this, arguments );
|
664
|
+
};
|
665
|
+
}
|
666
|
+
};
|
667
|
+
|
668
|
+
// If the event is not supported natively, this handler will be bound to
|
669
|
+
// the window resize event to simulate the orientationchange event.
|
670
|
+
function handler() {
|
671
|
+
// Get the current orientation.
|
672
|
+
var orientation = get_orientation();
|
673
|
+
|
674
|
+
if ( orientation !== last_orientation ) {
|
675
|
+
// The orientation has changed, so trigger the orientationchange event.
|
676
|
+
last_orientation = orientation;
|
677
|
+
win.trigger( "orientationchange" );
|
678
|
+
}
|
679
|
+
};
|
680
|
+
|
681
|
+
// Get the current page orientation. This method is exposed publicly, should it
|
682
|
+
// be needed, as jQuery.event.special.orientationchange.orientation()
|
683
|
+
special_event.orientation = get_orientation = function() {
|
684
|
+
var elem = document.documentElement;
|
685
|
+
return elem && elem.clientWidth / elem.clientHeight < 1.1 ? "portrait" : "landscape";
|
686
|
+
};
|
687
|
+
|
688
|
+
})(jQuery);
|
689
|
+
|
690
|
+
$.each({
|
691
|
+
scrollstop: "scrollstart",
|
692
|
+
taphold: "tap",
|
693
|
+
swipeleft: "swipe",
|
694
|
+
swiperight: "swipe"
|
695
|
+
}, function( event, sourceEvent ) {
|
696
|
+
$.event.special[ event ] = {
|
697
|
+
setup: function() {
|
698
|
+
$( this ).bind( sourceEvent, $.noop );
|
699
|
+
}
|
700
|
+
};
|
701
|
+
});
|
702
|
+
|
703
|
+
})( jQuery );
|
704
|
+
|
705
|
+
|
706
|
+
/*!
|
707
|
+
* jQuery hashchange event - v1.3 - 7/21/2010
|
708
|
+
* http://benalman.com/projects/jquery-hashchange-plugin/
|
709
|
+
*
|
710
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
711
|
+
* Dual licensed under the MIT and GPL licenses.
|
712
|
+
* http://benalman.com/about/license/
|
713
|
+
*/
|
714
|
+
|
715
|
+
// Script: jQuery hashchange event
|
716
|
+
//
|
717
|
+
// *Version: 1.3, Last updated: 7/21/2010*
|
718
|
+
//
|
719
|
+
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
|
720
|
+
// GitHub - http://github.com/cowboy/jquery-hashchange/
|
721
|
+
// Source - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.js
|
722
|
+
// (Minified) - http://github.com/cowboy/jquery-hashchange/raw/master/jquery.ba-hashchange.min.js (0.8kb gzipped)
|
723
|
+
//
|
724
|
+
// About: License
|
725
|
+
//
|
726
|
+
// Copyright (c) 2010 "Cowboy" Ben Alman,
|
727
|
+
// Dual licensed under the MIT and GPL licenses.
|
728
|
+
// http://benalman.com/about/license/
|
729
|
+
//
|
730
|
+
// About: Examples
|
731
|
+
//
|
732
|
+
// These working examples, complete with fully commented code, illustrate a few
|
733
|
+
// ways in which this plugin can be used.
|
734
|
+
//
|
735
|
+
// hashchange event - http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/
|
736
|
+
// document.domain - http://benalman.com/code/projects/jquery-hashchange/examples/document_domain/
|
737
|
+
//
|
738
|
+
// About: Support and Testing
|
739
|
+
//
|
740
|
+
// Information about what version or versions of jQuery this plugin has been
|
741
|
+
// tested with, what browsers it has been tested in, and where the unit tests
|
742
|
+
// reside (so you can test it yourself).
|
743
|
+
//
|
744
|
+
// jQuery Versions - 1.2.6, 1.3.2, 1.4.1, 1.4.2
|
745
|
+
// Browsers Tested - Internet Explorer 6-8, Firefox 2-4, Chrome 5-6, Safari 3.2-5,
|
746
|
+
// Opera 9.6-10.60, iPhone 3.1, Android 1.6-2.2, BlackBerry 4.6-5.
|
747
|
+
// Unit Tests - http://benalman.com/code/projects/jquery-hashchange/unit/
|
748
|
+
//
|
749
|
+
// About: Known issues
|
750
|
+
//
|
751
|
+
// While this jQuery hashchange event implementation is quite stable and
|
752
|
+
// robust, there are a few unfortunate browser bugs surrounding expected
|
753
|
+
// hashchange event-based behaviors, independent of any JavaScript
|
754
|
+
// window.onhashchange abstraction. See the following examples for more
|
755
|
+
// information:
|
756
|
+
//
|
757
|
+
// Chrome: Back Button - http://benalman.com/code/projects/jquery-hashchange/examples/bug-chrome-back-button/
|
758
|
+
// Firefox: Remote XMLHttpRequest - http://benalman.com/code/projects/jquery-hashchange/examples/bug-firefox-remote-xhr/
|
759
|
+
// WebKit: Back Button in an Iframe - http://benalman.com/code/projects/jquery-hashchange/examples/bug-webkit-hash-iframe/
|
760
|
+
// Safari: Back Button from a different domain - http://benalman.com/code/projects/jquery-hashchange/examples/bug-safari-back-from-diff-domain/
|
761
|
+
//
|
762
|
+
// Also note that should a browser natively support the window.onhashchange
|
763
|
+
// event, but not report that it does, the fallback polling loop will be used.
|
764
|
+
//
|
765
|
+
// About: Release History
|
766
|
+
//
|
767
|
+
// 1.3 - (7/21/2010) Reorganized IE6/7 Iframe code to make it more
|
768
|
+
// "removable" for mobile-only development. Added IE6/7 document.title
|
769
|
+
// support. Attempted to make Iframe as hidden as possible by using
|
770
|
+
// techniques from http://www.paciellogroup.com/blog/?p=604. Added
|
771
|
+
// support for the "shortcut" format $(window).hashchange( fn ) and
|
772
|
+
// $(window).hashchange() like jQuery provides for built-in events.
|
773
|
+
// Renamed jQuery.hashchangeDelay to <jQuery.fn.hashchange.delay> and
|
774
|
+
// lowered its default value to 50. Added <jQuery.fn.hashchange.domain>
|
775
|
+
// and <jQuery.fn.hashchange.src> properties plus document-domain.html
|
776
|
+
// file to address access denied issues when setting document.domain in
|
777
|
+
// IE6/7.
|
778
|
+
// 1.2 - (2/11/2010) Fixed a bug where coming back to a page using this plugin
|
779
|
+
// from a page on another domain would cause an error in Safari 4. Also,
|
780
|
+
// IE6/7 Iframe is now inserted after the body (this actually works),
|
781
|
+
// which prevents the page from scrolling when the event is first bound.
|
782
|
+
// Event can also now be bound before DOM ready, but it won't be usable
|
783
|
+
// before then in IE6/7.
|
784
|
+
// 1.1 - (1/21/2010) Incorporated document.documentMode test to fix IE8 bug
|
785
|
+
// where browser version is incorrectly reported as 8.0, despite
|
786
|
+
// inclusion of the X-UA-Compatible IE=EmulateIE7 meta tag.
|
787
|
+
// 1.0 - (1/9/2010) Initial Release. Broke out the jQuery BBQ event.special
|
788
|
+
// window.onhashchange functionality into a separate plugin for users
|
789
|
+
// who want just the basic event & back button support, without all the
|
790
|
+
// extra awesomeness that BBQ provides. This plugin will be included as
|
791
|
+
// part of jQuery BBQ, but also be available separately.
|
792
|
+
|
793
|
+
(function($,window,undefined){
|
794
|
+
'$:nomunge'; // Used by YUI compressor.
|
795
|
+
|
796
|
+
// Reused string.
|
797
|
+
var str_hashchange = 'hashchange',
|
798
|
+
|
799
|
+
// Method / object references.
|
800
|
+
doc = document,
|
801
|
+
fake_onhashchange,
|
802
|
+
special = $.event.special,
|
803
|
+
|
804
|
+
// Does the browser support window.onhashchange? Note that IE8 running in
|
805
|
+
// IE7 compatibility mode reports true for 'onhashchange' in window, even
|
806
|
+
// though the event isn't supported, so also test document.documentMode.
|
807
|
+
doc_mode = doc.documentMode,
|
808
|
+
supports_onhashchange = 'on' + str_hashchange in window && ( doc_mode === undefined || doc_mode > 7 );
|
809
|
+
|
810
|
+
// Get location.hash (or what you'd expect location.hash to be) sans any
|
811
|
+
// leading #. Thanks for making this necessary, Firefox!
|
812
|
+
function get_fragment( url ) {
|
813
|
+
url = url || location.href;
|
814
|
+
return '#' + url.replace( /^[^#]*#?(.*)$/, '$1' );
|
815
|
+
};
|
816
|
+
|
817
|
+
// Method: jQuery.fn.hashchange
|
818
|
+
//
|
819
|
+
// Bind a handler to the window.onhashchange event or trigger all bound
|
820
|
+
// window.onhashchange event handlers. This behavior is consistent with
|
821
|
+
// jQuery's built-in event handlers.
|
822
|
+
//
|
823
|
+
// Usage:
|
824
|
+
//
|
825
|
+
// > jQuery(window).hashchange( [ handler ] );
|
826
|
+
//
|
827
|
+
// Arguments:
|
828
|
+
//
|
829
|
+
// handler - (Function) Optional handler to be bound to the hashchange
|
830
|
+
// event. This is a "shortcut" for the more verbose form:
|
831
|
+
// jQuery(window).bind( 'hashchange', handler ). If handler is omitted,
|
832
|
+
// all bound window.onhashchange event handlers will be triggered. This
|
833
|
+
// is a shortcut for the more verbose
|
834
|
+
// jQuery(window).trigger( 'hashchange' ). These forms are described in
|
835
|
+
// the <hashchange event> section.
|
836
|
+
//
|
837
|
+
// Returns:
|
838
|
+
//
|
839
|
+
// (jQuery) The initial jQuery collection of elements.
|
840
|
+
|
841
|
+
// Allow the "shortcut" format $(elem).hashchange( fn ) for binding and
|
842
|
+
// $(elem).hashchange() for triggering, like jQuery does for built-in events.
|
843
|
+
$.fn[ str_hashchange ] = function( fn ) {
|
844
|
+
return fn ? this.bind( str_hashchange, fn ) : this.trigger( str_hashchange );
|
845
|
+
};
|
846
|
+
|
847
|
+
// Property: jQuery.fn.hashchange.delay
|
848
|
+
//
|
849
|
+
// The numeric interval (in milliseconds) at which the <hashchange event>
|
850
|
+
// polling loop executes. Defaults to 50.
|
851
|
+
|
852
|
+
// Property: jQuery.fn.hashchange.domain
|
853
|
+
//
|
854
|
+
// If you're setting document.domain in your JavaScript, and you want hash
|
855
|
+
// history to work in IE6/7, not only must this property be set, but you must
|
856
|
+
// also set document.domain BEFORE jQuery is loaded into the page. This
|
857
|
+
// property is only applicable if you are supporting IE6/7 (or IE8 operating
|
858
|
+
// in "IE7 compatibility" mode).
|
859
|
+
//
|
860
|
+
// In addition, the <jQuery.fn.hashchange.src> property must be set to the
|
861
|
+
// path of the included "document-domain.html" file, which can be renamed or
|
862
|
+
// modified if necessary (note that the document.domain specified must be the
|
863
|
+
// same in both your main JavaScript as well as in this file).
|
864
|
+
//
|
865
|
+
// Usage:
|
866
|
+
//
|
867
|
+
// jQuery.fn.hashchange.domain = document.domain;
|
868
|
+
|
869
|
+
// Property: jQuery.fn.hashchange.src
|
870
|
+
//
|
871
|
+
// If, for some reason, you need to specify an Iframe src file (for example,
|
872
|
+
// when setting document.domain as in <jQuery.fn.hashchange.domain>), you can
|
873
|
+
// do so using this property. Note that when using this property, history
|
874
|
+
// won't be recorded in IE6/7 until the Iframe src file loads. This property
|
875
|
+
// is only applicable if you are supporting IE6/7 (or IE8 operating in "IE7
|
876
|
+
// compatibility" mode).
|
877
|
+
//
|
878
|
+
// Usage:
|
879
|
+
//
|
880
|
+
// jQuery.fn.hashchange.src = 'path/to/file.html';
|
881
|
+
|
882
|
+
$.fn[ str_hashchange ].delay = 50;
|
883
|
+
/*
|
884
|
+
$.fn[ str_hashchange ].domain = null;
|
885
|
+
$.fn[ str_hashchange ].src = null;
|
886
|
+
*/
|
887
|
+
|
888
|
+
// Event: hashchange event
|
889
|
+
//
|
890
|
+
// Fired when location.hash changes. In browsers that support it, the native
|
891
|
+
// HTML5 window.onhashchange event is used, otherwise a polling loop is
|
892
|
+
// initialized, running every <jQuery.fn.hashchange.delay> milliseconds to
|
893
|
+
// see if the hash has changed. In IE6/7 (and IE8 operating in "IE7
|
894
|
+
// compatibility" mode), a hidden Iframe is created to allow the back button
|
895
|
+
// and hash-based history to work.
|
896
|
+
//
|
897
|
+
// Usage as described in <jQuery.fn.hashchange>:
|
898
|
+
//
|
899
|
+
// > // Bind an event handler.
|
900
|
+
// > jQuery(window).hashchange( function(e) {
|
901
|
+
// > var hash = location.hash;
|
902
|
+
// > ...
|
903
|
+
// > });
|
904
|
+
// >
|
905
|
+
// > // Manually trigger the event handler.
|
906
|
+
// > jQuery(window).hashchange();
|
907
|
+
//
|
908
|
+
// A more verbose usage that allows for event namespacing:
|
909
|
+
//
|
910
|
+
// > // Bind an event handler.
|
911
|
+
// > jQuery(window).bind( 'hashchange', function(e) {
|
912
|
+
// > var hash = location.hash;
|
913
|
+
// > ...
|
914
|
+
// > });
|
915
|
+
// >
|
916
|
+
// > // Manually trigger the event handler.
|
917
|
+
// > jQuery(window).trigger( 'hashchange' );
|
918
|
+
//
|
919
|
+
// Additional Notes:
|
920
|
+
//
|
921
|
+
// * The polling loop and Iframe are not created until at least one handler
|
922
|
+
// is actually bound to the 'hashchange' event.
|
923
|
+
// * If you need the bound handler(s) to execute immediately, in cases where
|
924
|
+
// a location.hash exists on page load, via bookmark or page refresh for
|
925
|
+
// example, use jQuery(window).hashchange() or the more verbose
|
926
|
+
// jQuery(window).trigger( 'hashchange' ).
|
927
|
+
// * The event can be bound before DOM ready, but since it won't be usable
|
928
|
+
// before then in IE6/7 (due to the necessary Iframe), recommended usage is
|
929
|
+
// to bind it inside a DOM ready handler.
|
930
|
+
|
931
|
+
// Override existing $.event.special.hashchange methods (allowing this plugin
|
932
|
+
// to be defined after jQuery BBQ in BBQ's source code).
|
933
|
+
special[ str_hashchange ] = $.extend( special[ str_hashchange ], {
|
934
|
+
|
935
|
+
// Called only when the first 'hashchange' event is bound to window.
|
936
|
+
setup: function() {
|
937
|
+
// If window.onhashchange is supported natively, there's nothing to do..
|
938
|
+
if ( supports_onhashchange ) { return false; }
|
939
|
+
|
940
|
+
// Otherwise, we need to create our own. And we don't want to call this
|
941
|
+
// until the user binds to the event, just in case they never do, since it
|
942
|
+
// will create a polling loop and possibly even a hidden Iframe.
|
943
|
+
$( fake_onhashchange.start );
|
944
|
+
},
|
945
|
+
|
946
|
+
// Called only when the last 'hashchange' event is unbound from window.
|
947
|
+
teardown: function() {
|
948
|
+
// If window.onhashchange is supported natively, there's nothing to do..
|
949
|
+
if ( supports_onhashchange ) { return false; }
|
950
|
+
|
951
|
+
// Otherwise, we need to stop ours (if possible).
|
952
|
+
$( fake_onhashchange.stop );
|
953
|
+
}
|
954
|
+
|
955
|
+
});
|
956
|
+
|
957
|
+
// fake_onhashchange does all the work of triggering the window.onhashchange
|
958
|
+
// event for browsers that don't natively support it, including creating a
|
959
|
+
// polling loop to watch for hash changes and in IE 6/7 creating a hidden
|
960
|
+
// Iframe to enable back and forward.
|
961
|
+
fake_onhashchange = (function(){
|
962
|
+
var self = {},
|
963
|
+
timeout_id,
|
964
|
+
|
965
|
+
// Remember the initial hash so it doesn't get triggered immediately.
|
966
|
+
last_hash = get_fragment(),
|
967
|
+
|
968
|
+
fn_retval = function(val){ return val; },
|
969
|
+
history_set = fn_retval,
|
970
|
+
history_get = fn_retval;
|
971
|
+
|
972
|
+
// Start the polling loop.
|
973
|
+
self.start = function() {
|
974
|
+
timeout_id || poll();
|
975
|
+
};
|
976
|
+
|
977
|
+
// Stop the polling loop.
|
978
|
+
self.stop = function() {
|
979
|
+
timeout_id && clearTimeout( timeout_id );
|
980
|
+
timeout_id = undefined;
|
981
|
+
};
|
982
|
+
|
983
|
+
// This polling loop checks every $.fn.hashchange.delay milliseconds to see
|
984
|
+
// if location.hash has changed, and triggers the 'hashchange' event on
|
985
|
+
// window when necessary.
|
986
|
+
function poll() {
|
987
|
+
var hash = get_fragment(),
|
988
|
+
history_hash = history_get( last_hash );
|
989
|
+
|
990
|
+
if ( hash !== last_hash ) {
|
991
|
+
history_set( last_hash = hash, history_hash );
|
992
|
+
|
993
|
+
$(window).trigger( str_hashchange );
|
994
|
+
|
995
|
+
} else if ( history_hash !== last_hash ) {
|
996
|
+
location.href = location.href.replace( /#.*/, '' ) + history_hash;
|
997
|
+
}
|
998
|
+
|
999
|
+
timeout_id = setTimeout( poll, $.fn[ str_hashchange ].delay );
|
1000
|
+
};
|
1001
|
+
|
1002
|
+
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
1003
|
+
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
|
1004
|
+
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
|
1005
|
+
$.browser.msie && !supports_onhashchange && (function(){
|
1006
|
+
// Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
|
1007
|
+
// when running in "IE7 compatibility" mode.
|
1008
|
+
|
1009
|
+
var iframe,
|
1010
|
+
iframe_src;
|
1011
|
+
|
1012
|
+
// When the event is bound and polling starts in IE 6/7, create a hidden
|
1013
|
+
// Iframe for history handling.
|
1014
|
+
self.start = function(){
|
1015
|
+
if ( !iframe ) {
|
1016
|
+
iframe_src = $.fn[ str_hashchange ].src;
|
1017
|
+
iframe_src = iframe_src && iframe_src + get_fragment();
|
1018
|
+
|
1019
|
+
// Create hidden Iframe. Attempt to make Iframe as hidden as possible
|
1020
|
+
// by using techniques from http://www.paciellogroup.com/blog/?p=604.
|
1021
|
+
iframe = $('<iframe tabindex="-1" title="empty"/>').hide()
|
1022
|
+
|
1023
|
+
// When Iframe has completely loaded, initialize the history and
|
1024
|
+
// start polling.
|
1025
|
+
.one( 'load', function(){
|
1026
|
+
iframe_src || history_set( get_fragment() );
|
1027
|
+
poll();
|
1028
|
+
})
|
1029
|
+
|
1030
|
+
// Load Iframe src if specified, otherwise nothing.
|
1031
|
+
.attr( 'src', iframe_src || 'javascript:0' )
|
1032
|
+
|
1033
|
+
// Append Iframe after the end of the body to prevent unnecessary
|
1034
|
+
// initial page scrolling (yes, this works).
|
1035
|
+
.insertAfter( 'body' )[0].contentWindow;
|
1036
|
+
|
1037
|
+
// Whenever `document.title` changes, update the Iframe's title to
|
1038
|
+
// prettify the back/next history menu entries. Since IE sometimes
|
1039
|
+
// errors with "Unspecified error" the very first time this is set
|
1040
|
+
// (yes, very useful) wrap this with a try/catch block.
|
1041
|
+
doc.onpropertychange = function(){
|
1042
|
+
try {
|
1043
|
+
if ( event.propertyName === 'title' ) {
|
1044
|
+
iframe.document.title = doc.title;
|
1045
|
+
}
|
1046
|
+
} catch(e) {}
|
1047
|
+
};
|
1048
|
+
|
1049
|
+
}
|
1050
|
+
};
|
1051
|
+
|
1052
|
+
// Override the "stop" method since an IE6/7 Iframe was created. Even
|
1053
|
+
// if there are no longer any bound event handlers, the polling loop
|
1054
|
+
// is still necessary for back/next to work at all!
|
1055
|
+
self.stop = fn_retval;
|
1056
|
+
|
1057
|
+
// Get history by looking at the hidden Iframe's location.hash.
|
1058
|
+
history_get = function() {
|
1059
|
+
return get_fragment( iframe.location.href );
|
1060
|
+
};
|
1061
|
+
|
1062
|
+
// Set a new history item by opening and then closing the Iframe
|
1063
|
+
// document, *then* setting its location.hash. If document.domain has
|
1064
|
+
// been set, update that as well.
|
1065
|
+
history_set = function( hash, history_hash ) {
|
1066
|
+
var iframe_doc = iframe.document,
|
1067
|
+
domain = $.fn[ str_hashchange ].domain;
|
1068
|
+
|
1069
|
+
if ( hash !== history_hash ) {
|
1070
|
+
// Update Iframe with any initial `document.title` that might be set.
|
1071
|
+
iframe_doc.title = doc.title;
|
1072
|
+
|
1073
|
+
// Opening the Iframe's document after it has been closed is what
|
1074
|
+
// actually adds a history entry.
|
1075
|
+
iframe_doc.open();
|
1076
|
+
|
1077
|
+
// Set document.domain for the Iframe document as well, if necessary.
|
1078
|
+
domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );
|
1079
|
+
|
1080
|
+
iframe_doc.close();
|
1081
|
+
|
1082
|
+
// Update the Iframe's hash, for great justice.
|
1083
|
+
iframe.location.hash = hash;
|
1084
|
+
}
|
1085
|
+
};
|
1086
|
+
|
1087
|
+
})();
|
1088
|
+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
1089
|
+
// ^^^^^^^^^^^^^^^^^^^ REMOVE IF NOT SUPPORTING IE6/7/8 ^^^^^^^^^^^^^^^^^^^
|
1090
|
+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
1091
|
+
|
1092
|
+
return self;
|
1093
|
+
})();
|
1094
|
+
|
1095
|
+
})(jQuery,this);
|
1096
|
+
|
1097
|
+
|
1098
|
+
/*!
|
1099
|
+
* jQuery Mobile v@VERSION
|
1100
|
+
* http://jquerymobile.com/
|
1101
|
+
*
|
1102
|
+
* Copyright 2010, jQuery Project
|
1103
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1104
|
+
* http://jquery.org/license
|
1105
|
+
*/
|
1106
|
+
|
1107
|
+
(function( $, window, undefined ) {
|
1108
|
+
|
1109
|
+
//jQuery.mobile configurable options
|
1110
|
+
$.extend( $.mobile, {
|
1111
|
+
|
1112
|
+
//define the url parameter used for referencing widget-generated sub-pages.
|
1113
|
+
//Translates to to example.html&ui-page=subpageIdentifier
|
1114
|
+
//hash segment before &ui-page= is used to make Ajax request
|
1115
|
+
subPageUrlKey: 'ui-page',
|
1116
|
+
|
1117
|
+
//anchor links with a data-rel, or pages with a data-role, that match these selectors will be untrackable in history
|
1118
|
+
//(no change in URL, not bookmarkable)
|
1119
|
+
nonHistorySelectors: 'dialog',
|
1120
|
+
|
1121
|
+
//class assigned to page currently in view, and during transitions
|
1122
|
+
activePageClass: 'ui-page-active',
|
1123
|
+
|
1124
|
+
//class used for "active" button state, from CSS framework
|
1125
|
+
activeBtnClass: 'ui-btn-active',
|
1126
|
+
|
1127
|
+
//automatically handle link clicks through Ajax, when possible
|
1128
|
+
ajaxLinksEnabled: true,
|
1129
|
+
|
1130
|
+
//automatically handle form submissions through Ajax, when possible
|
1131
|
+
ajaxFormsEnabled: true,
|
1132
|
+
|
1133
|
+
//set default transition - 'none' for no transitions
|
1134
|
+
defaultTransition: 'slide',
|
1135
|
+
|
1136
|
+
//show loading message during Ajax requests
|
1137
|
+
//if false, message will not appear, but loading classes will still be toggled on html el
|
1138
|
+
loadingMessage: "loading",
|
1139
|
+
|
1140
|
+
//configure meta viewport tag's content attr:
|
1141
|
+
metaViewportContent: "width=device-width, minimum-scale=1, maximum-scale=1",
|
1142
|
+
|
1143
|
+
//support conditions that must be met in order to proceed
|
1144
|
+
gradeA: function(){
|
1145
|
+
return $.support.mediaquery;
|
1146
|
+
}
|
1147
|
+
});
|
1148
|
+
|
1149
|
+
|
1150
|
+
//trigger mobileinit event - useful hook for configuring $.mobile settings before they're used
|
1151
|
+
$( window.document ).trigger('mobileinit');
|
1152
|
+
|
1153
|
+
|
1154
|
+
//support conditions
|
1155
|
+
//if device support condition(s) aren't met, leave things as they are -> a basic, usable experience,
|
1156
|
+
//otherwise, proceed with the enhancements
|
1157
|
+
if ( !$.mobile.gradeA() ) {
|
1158
|
+
return;
|
1159
|
+
}
|
1160
|
+
|
1161
|
+
|
1162
|
+
//define vars for interal use
|
1163
|
+
var $window = $(window),
|
1164
|
+
$html = $('html'),
|
1165
|
+
$head = $('head'),
|
1166
|
+
|
1167
|
+
//loading div which appears during Ajax requests
|
1168
|
+
//will not appear if $.mobile.loadingMessage is false
|
1169
|
+
$loader = $.mobile.loadingMessage ?
|
1170
|
+
$('<div class="ui-loader ui-body-a ui-corner-all">'+
|
1171
|
+
'<span class="ui-icon ui-icon-loading spin"></span>'+
|
1172
|
+
'<h1>'+ $.mobile.loadingMessage +'</h1>'+
|
1173
|
+
'</div>')
|
1174
|
+
: undefined;
|
1175
|
+
|
1176
|
+
|
1177
|
+
//add mobile, initial load "rendering" classes to docEl
|
1178
|
+
$html.addClass('ui-mobile ui-mobile-rendering');
|
1179
|
+
|
1180
|
+
|
1181
|
+
//define & prepend meta viewport tag, if content is defined
|
1182
|
+
$.mobile.metaViewportContent ? $("<meta>", { name: "viewport", content: $.mobile.metaViewportContent}).prependTo( $head ) : undefined;
|
1183
|
+
|
1184
|
+
|
1185
|
+
//expose some core utilities
|
1186
|
+
$.extend($.mobile, {
|
1187
|
+
|
1188
|
+
// turn on/off page loading message.
|
1189
|
+
pageLoading: function ( done ) {
|
1190
|
+
if ( done ) {
|
1191
|
+
$html.removeClass( "ui-loading" );
|
1192
|
+
} else {
|
1193
|
+
if( $.mobile.loadingMessage ){
|
1194
|
+
$loader.appendTo($.mobile.pageContainer).css({top: $(window).scrollTop() + 75});
|
1195
|
+
}
|
1196
|
+
$html.addClass( "ui-loading" );
|
1197
|
+
}
|
1198
|
+
},
|
1199
|
+
|
1200
|
+
//scroll page vertically: scroll to 0 to hide iOS address bar, or pass a Y value
|
1201
|
+
silentScroll: function( ypos ) {
|
1202
|
+
// prevent scrollstart and scrollstop events
|
1203
|
+
$.event.special.scrollstart.enabled = false;
|
1204
|
+
setTimeout(function() {
|
1205
|
+
window.scrollTo( 0, ypos || 0 );
|
1206
|
+
},20);
|
1207
|
+
setTimeout(function() {
|
1208
|
+
$.event.special.scrollstart.enabled = true;
|
1209
|
+
}, 150 );
|
1210
|
+
}
|
1211
|
+
});
|
1212
|
+
|
1213
|
+
|
1214
|
+
//dom-ready inits
|
1215
|
+
$(function(){
|
1216
|
+
|
1217
|
+
//find present pages
|
1218
|
+
var $pages = $("[data-role='page']");
|
1219
|
+
|
1220
|
+
//set up active page
|
1221
|
+
$.mobile.startPage = $.mobile.activePage = $pages.first();
|
1222
|
+
|
1223
|
+
//set page container
|
1224
|
+
$.mobile.pageContainer = $.mobile.startPage.parent().addClass('ui-mobile-viewport');
|
1225
|
+
|
1226
|
+
//cue page loading message
|
1227
|
+
$.mobile.pageLoading();
|
1228
|
+
|
1229
|
+
//initialize all pages present
|
1230
|
+
$pages.page();
|
1231
|
+
|
1232
|
+
//trigger a new hashchange, hash or not
|
1233
|
+
$window.trigger( "hashchange", [ true ] );
|
1234
|
+
|
1235
|
+
//remove rendering class
|
1236
|
+
$html.removeClass('ui-mobile-rendering');
|
1237
|
+
});
|
1238
|
+
|
1239
|
+
|
1240
|
+
//window load event
|
1241
|
+
//hide iOS browser chrome on load
|
1242
|
+
$window.load( $.mobile.silentScroll );
|
1243
|
+
|
1244
|
+
})( jQuery, this );
|
1245
|
+
|
1246
|
+
|
1247
|
+
/*
|
1248
|
+
* jQuery Mobile Framework : core utilities for auto ajax navigation, base tag mgmt,
|
1249
|
+
* Copyright (c) jQuery Project
|
1250
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1251
|
+
* http://jquery.org/license
|
1252
|
+
*/
|
1253
|
+
(function($, undefined ) {
|
1254
|
+
|
1255
|
+
//define vars for interal use
|
1256
|
+
var $window = $(window),
|
1257
|
+
$html = $('html'),
|
1258
|
+
$head = $('head'),
|
1259
|
+
|
1260
|
+
//url path helpers for use in relative url management
|
1261
|
+
path = {
|
1262
|
+
|
1263
|
+
//get path from current hash, or from a file path
|
1264
|
+
get: function( newPath ){
|
1265
|
+
if( newPath == undefined ){
|
1266
|
+
newPath = location.hash;
|
1267
|
+
}
|
1268
|
+
newPath = newPath.replace(/#/,'').split('/');
|
1269
|
+
newPath.pop();
|
1270
|
+
return newPath.join('/') + (newPath.length ? '/' : '');
|
1271
|
+
},
|
1272
|
+
|
1273
|
+
//return the substring of a filepath before the sub-page key, for making a server request
|
1274
|
+
getFilePath: function( path ){
|
1275
|
+
var splitkey = '&' + $.mobile.subPageUrlKey;
|
1276
|
+
return path.indexOf( splitkey ) > -1 ? path.split( splitkey )[0] : path;
|
1277
|
+
},
|
1278
|
+
|
1279
|
+
set: function( path, disableListening){
|
1280
|
+
if(disableListening) { hashListener = false; }
|
1281
|
+
location.hash = path;
|
1282
|
+
},
|
1283
|
+
|
1284
|
+
//location pathname from intial directory request
|
1285
|
+
origin: null,
|
1286
|
+
|
1287
|
+
setOrigin: function(){
|
1288
|
+
path.origin = path.get( location.protocol + '//' + location.host + location.pathname );
|
1289
|
+
}
|
1290
|
+
},
|
1291
|
+
|
1292
|
+
//base element management, defined depending on dynamic base tag support
|
1293
|
+
base = $.support.dynamicBaseTag ? {
|
1294
|
+
|
1295
|
+
//define base element, for use in routing asset urls that are referenced in Ajax-requested markup
|
1296
|
+
element: $("<base>", { href: path.origin }).prependTo( $head ),
|
1297
|
+
|
1298
|
+
//set the generated BASE element's href attribute to a new page's base path
|
1299
|
+
set: function( href ){
|
1300
|
+
base.element.attr('href', path.origin + path.get( href ));
|
1301
|
+
},
|
1302
|
+
|
1303
|
+
//set the generated BASE element's href attribute to a new page's base path
|
1304
|
+
reset: function(){
|
1305
|
+
base.element.attr('href', path.origin );
|
1306
|
+
}
|
1307
|
+
|
1308
|
+
} : undefined,
|
1309
|
+
|
1310
|
+
|
1311
|
+
//will be defined when a link is clicked and given an active class
|
1312
|
+
$activeClickedLink = null,
|
1313
|
+
|
1314
|
+
//array of pages that are visited during a single page load
|
1315
|
+
//length will grow as pages are visited, and shrink as "back" link/button is clicked
|
1316
|
+
//each item has a url (string matches ID), and transition (saved for reuse when "back" link/button is clicked)
|
1317
|
+
urlStack = [ {
|
1318
|
+
url: location.hash.replace( /^#/, "" ),
|
1319
|
+
transition: undefined
|
1320
|
+
} ],
|
1321
|
+
|
1322
|
+
//define first selector to receive focus when a page is shown
|
1323
|
+
focusable = "[tabindex],a,button:visible,select:visible,input",
|
1324
|
+
|
1325
|
+
//contains role for next page, if defined on clicked link via data-rel
|
1326
|
+
nextPageRole = null,
|
1327
|
+
|
1328
|
+
//enable/disable hashchange event listener
|
1329
|
+
//toggled internally when location.hash is updated to match the url of a successful page load
|
1330
|
+
hashListener = true;
|
1331
|
+
|
1332
|
+
//set location pathname from intial directory request
|
1333
|
+
path.setOrigin();
|
1334
|
+
|
1335
|
+
|
1336
|
+
/*
|
1337
|
+
internal utility functions
|
1338
|
+
--------------------------------------*/
|
1339
|
+
|
1340
|
+
|
1341
|
+
//direct focus to the page title, or otherwise first focusable element
|
1342
|
+
function reFocus( page ){
|
1343
|
+
var pageTitle = page.find( ".ui-title:eq(0)" );
|
1344
|
+
if( pageTitle.length ){
|
1345
|
+
pageTitle.focus();
|
1346
|
+
}
|
1347
|
+
else{
|
1348
|
+
page.find( focusable ).eq(0).focus();
|
1349
|
+
}
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
//remove active classes after page transition or error
|
1353
|
+
function removeActiveLinkClass( forceRemoval ){
|
1354
|
+
if( !!$activeClickedLink && (!$activeClickedLink.closest( '.ui-page-active' ).length || forceRemoval )){
|
1355
|
+
$activeClickedLink.removeClass( $.mobile.activeBtnClass );
|
1356
|
+
}
|
1357
|
+
$activeClickedLink = null;
|
1358
|
+
};
|
1359
|
+
|
1360
|
+
|
1361
|
+
//animation complete callback
|
1362
|
+
$.fn.animationComplete = function( callback ){
|
1363
|
+
if($.support.cssTransitions){
|
1364
|
+
return $(this).one('webkitAnimationEnd', callback);
|
1365
|
+
}
|
1366
|
+
else{
|
1367
|
+
callback();
|
1368
|
+
}
|
1369
|
+
};
|
1370
|
+
|
1371
|
+
|
1372
|
+
|
1373
|
+
/* exposed $.mobile methods */
|
1374
|
+
|
1375
|
+
//update location.hash, with or without triggering hashchange event
|
1376
|
+
$.mobile.updateHash = path.set;
|
1377
|
+
|
1378
|
+
//url stack, useful when plugins need to be aware of previous pages viewed
|
1379
|
+
$.mobile.urlStack = urlStack;
|
1380
|
+
|
1381
|
+
// changepage function
|
1382
|
+
$.mobile.changePage = function( to, transition, back, changeHash){
|
1383
|
+
|
1384
|
+
//from is always the currently viewed page
|
1385
|
+
var toIsArray = $.type(to) === "array",
|
1386
|
+
from = toIsArray ? to[0] : $.mobile.activePage,
|
1387
|
+
to = toIsArray ? to[1] : to,
|
1388
|
+
url = fileUrl = $.type(to) === "string" ? to.replace( /^#/, "" ) : null,
|
1389
|
+
data = undefined,
|
1390
|
+
type = 'get',
|
1391
|
+
isFormRequest = false,
|
1392
|
+
duplicateCachedPage = null,
|
1393
|
+
back = (back !== undefined) ? back : ( urlStack.length > 1 && urlStack[ urlStack.length - 2 ].url === url ),
|
1394
|
+
transition = (transition !== undefined) ? transition : $.mobile.defaultTransition;
|
1395
|
+
|
1396
|
+
if( $.type(to) === "object" && to.url ){
|
1397
|
+
url = to.url,
|
1398
|
+
data = to.data,
|
1399
|
+
type = to.type,
|
1400
|
+
isFormRequest = true;
|
1401
|
+
//make get requests bookmarkable
|
1402
|
+
if( data && type == 'get' ){
|
1403
|
+
url += "?" + data;
|
1404
|
+
data = undefined;
|
1405
|
+
}
|
1406
|
+
}
|
1407
|
+
|
1408
|
+
//reset base to pathname for new request
|
1409
|
+
if(base){ base.reset(); }
|
1410
|
+
|
1411
|
+
// if the new href is the same as the previous one
|
1412
|
+
if ( back ) {
|
1413
|
+
var pop = urlStack.pop();
|
1414
|
+
if( pop ){
|
1415
|
+
transition = pop.transition;
|
1416
|
+
}
|
1417
|
+
} else {
|
1418
|
+
urlStack.push({ url: url, transition: transition });
|
1419
|
+
}
|
1420
|
+
|
1421
|
+
//function for transitioning between two existing pages
|
1422
|
+
function transitionPages() {
|
1423
|
+
|
1424
|
+
//kill the keyboard
|
1425
|
+
$( window.document.activeElement ).blur();
|
1426
|
+
|
1427
|
+
//get current scroll distance
|
1428
|
+
var currScroll = $window.scrollTop();
|
1429
|
+
|
1430
|
+
//set as data for returning to that spot
|
1431
|
+
from.data('lastScroll', currScroll);
|
1432
|
+
|
1433
|
+
//trigger before show/hide events
|
1434
|
+
from.data("page")._trigger("beforehide", {nextPage: to});
|
1435
|
+
to.data("page")._trigger("beforeshow", {prevPage: from});
|
1436
|
+
|
1437
|
+
function loadComplete(){
|
1438
|
+
$.mobile.pageLoading( true );
|
1439
|
+
//trigger show/hide events, allow preventing focus change through return false
|
1440
|
+
if( from.data("page")._trigger("hide", null, {nextPage: to}) !== false && to.data("page")._trigger("show", null, {prevPage: from}) !== false ){
|
1441
|
+
$.mobile.activePage = to;
|
1442
|
+
}
|
1443
|
+
reFocus( to );
|
1444
|
+
if( changeHash !== false && url ){
|
1445
|
+
path.set(url, true);
|
1446
|
+
}
|
1447
|
+
removeActiveLinkClass();
|
1448
|
+
|
1449
|
+
//if there's a duplicateCachedPage, remove it from the DOM now that it's hidden
|
1450
|
+
if( duplicateCachedPage != null ){
|
1451
|
+
duplicateCachedPage.remove();
|
1452
|
+
}
|
1453
|
+
|
1454
|
+
//jump to top or prev scroll, if set
|
1455
|
+
$.mobile.silentScroll( to.data( 'lastScroll' ) );
|
1456
|
+
};
|
1457
|
+
|
1458
|
+
if(transition && (transition !== 'none')){
|
1459
|
+
$.mobile.pageContainer.addClass('ui-mobile-viewport-transitioning');
|
1460
|
+
// animate in / out
|
1461
|
+
from.addClass( transition + " out " + ( back ? "reverse" : "" ) );
|
1462
|
+
to.addClass( $.mobile.activePageClass + " " + transition +
|
1463
|
+
" in " + ( back ? "reverse" : "" ) );
|
1464
|
+
|
1465
|
+
// callback - remove classes, etc
|
1466
|
+
to.animationComplete(function() {
|
1467
|
+
from.add( to ).removeClass("out in reverse " + transition );
|
1468
|
+
from.removeClass( $.mobile.activePageClass );
|
1469
|
+
loadComplete();
|
1470
|
+
$.mobile.pageContainer.removeClass('ui-mobile-viewport-transitioning');
|
1471
|
+
});
|
1472
|
+
}
|
1473
|
+
else{
|
1474
|
+
from.removeClass( $.mobile.activePageClass );
|
1475
|
+
to.addClass( $.mobile.activePageClass );
|
1476
|
+
loadComplete();
|
1477
|
+
}
|
1478
|
+
};
|
1479
|
+
|
1480
|
+
//shared page enhancements
|
1481
|
+
function enhancePage(){
|
1482
|
+
|
1483
|
+
//set next page role, if defined
|
1484
|
+
if ( nextPageRole ) {
|
1485
|
+
to.attr( "data-role", nextPageRole );
|
1486
|
+
nextPageRole = undefined;
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
//run page plugin
|
1490
|
+
to.page();
|
1491
|
+
};
|
1492
|
+
|
1493
|
+
//if url is a string
|
1494
|
+
if( url ){
|
1495
|
+
to = $( "[id='" + url + "']" ),
|
1496
|
+
fileUrl = path.getFilePath(url);
|
1497
|
+
}
|
1498
|
+
else{ //find base url of element, if avail
|
1499
|
+
var toID = to.attr('id'),
|
1500
|
+
toIDfileurl = path.getFilePath(toID);
|
1501
|
+
|
1502
|
+
if(toID != toIDfileurl){
|
1503
|
+
fileUrl = toIDfileurl;
|
1504
|
+
}
|
1505
|
+
}
|
1506
|
+
|
1507
|
+
// find the "to" page, either locally existing in the dom or by creating it through ajax
|
1508
|
+
if ( to.length && !isFormRequest ) {
|
1509
|
+
if( fileUrl && base ){
|
1510
|
+
base.set( fileUrl );
|
1511
|
+
}
|
1512
|
+
enhancePage();
|
1513
|
+
transitionPages();
|
1514
|
+
} else {
|
1515
|
+
|
1516
|
+
//if to exists in DOM, save a reference to it in duplicateCachedPage for removal after page change
|
1517
|
+
if( to.length ){
|
1518
|
+
duplicateCachedPage = to;
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
$.mobile.pageLoading();
|
1522
|
+
|
1523
|
+
$.ajax({
|
1524
|
+
url: fileUrl,
|
1525
|
+
type: type,
|
1526
|
+
data: data,
|
1527
|
+
success: function( html ) {
|
1528
|
+
|
1529
|
+
if(base){ base.set(fileUrl); }
|
1530
|
+
|
1531
|
+
var all = $("<div></div>");
|
1532
|
+
//workaround to allow scripts to execute when included in page divs
|
1533
|
+
all.get(0).innerHTML = html;
|
1534
|
+
to = all.find('[data-role="page"]');
|
1535
|
+
|
1536
|
+
//rewrite src and href attrs to use a base url
|
1537
|
+
if( !$.support.dynamicBaseTag ){
|
1538
|
+
var newPath = path.get( fileUrl );
|
1539
|
+
to.find('[src],link[href]').each(function(){
|
1540
|
+
var thisAttr = $(this).is('[href]') ? 'href' : 'src',
|
1541
|
+
thisUrl = $(this).attr(thisAttr);
|
1542
|
+
|
1543
|
+
//if full path exists and is same, chop it - helps IE out
|
1544
|
+
thisUrl.replace( location.protocol + '//' + location.host + location.pathname, '' );
|
1545
|
+
|
1546
|
+
if( !/^(\w+:|#|\/)/.test(thisUrl) ){
|
1547
|
+
$(this).attr(thisAttr, newPath + thisUrl);
|
1548
|
+
}
|
1549
|
+
});
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
//preserve ID on a retrieved page
|
1553
|
+
if ( to.attr('id') ) {
|
1554
|
+
//wrap page and transfer data-attrs if it has an ID
|
1555
|
+
var copyAttrs = ['data-role', 'data-theme', 'data-fullscreen'], //TODO: more page-level attrs?
|
1556
|
+
wrapper = to.wrap( "<div>" ).parent();
|
1557
|
+
|
1558
|
+
$.each(copyAttrs,function(i){
|
1559
|
+
if( to.attr( copyAttrs[ i ] ) ){
|
1560
|
+
wrapper.attr( copyAttrs[ i ], to.attr( copyAttrs[ i ] ) );
|
1561
|
+
to.removeAttr( copyAttrs[ i ] );
|
1562
|
+
}
|
1563
|
+
});
|
1564
|
+
to = wrapper;
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
to
|
1568
|
+
.attr( "id", fileUrl )
|
1569
|
+
.appendTo( $.mobile.pageContainer );
|
1570
|
+
|
1571
|
+
enhancePage();
|
1572
|
+
transitionPages();
|
1573
|
+
},
|
1574
|
+
error: function() {
|
1575
|
+
$.mobile.pageLoading( true );
|
1576
|
+
removeActiveLinkClass(true);
|
1577
|
+
$("<div class='ui-loader ui-overlay-shadow ui-body-e ui-corner-all'><h1>Error Loading Page</h1></div>")
|
1578
|
+
.css({ "display": "block", "opacity": 0.96, "top": $(window).scrollTop() + 100 })
|
1579
|
+
.appendTo( $.mobile.pageContainer )
|
1580
|
+
.delay( 800 )
|
1581
|
+
.fadeOut( 400, function(){
|
1582
|
+
$(this).remove();
|
1583
|
+
});
|
1584
|
+
}
|
1585
|
+
});
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
};
|
1589
|
+
|
1590
|
+
|
1591
|
+
|
1592
|
+
|
1593
|
+
/* Event Bindings - hashchange, submit, and click */
|
1594
|
+
|
1595
|
+
//bind to form submit events, handle with Ajax
|
1596
|
+
$('form').live('submit', function(event){
|
1597
|
+
if( !$.mobile.ajaxFormsEnabled ){ return; }
|
1598
|
+
|
1599
|
+
var type = $(this).attr("method"),
|
1600
|
+
url = $(this).attr( "action" ).replace( location.protocol + "//" + location.host, "");
|
1601
|
+
|
1602
|
+
//external submits use regular HTTP
|
1603
|
+
if( /^(:?\w+:)/.test( url ) ){
|
1604
|
+
return;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
//if it's a relative href, prefix href with base url
|
1608
|
+
if( url.indexOf('/') && url.indexOf('#') !== 0 ){
|
1609
|
+
url = path.get() + url;
|
1610
|
+
}
|
1611
|
+
|
1612
|
+
$.mobile.changePage({
|
1613
|
+
url: url,
|
1614
|
+
type: type,
|
1615
|
+
data: $(this).serialize()
|
1616
|
+
},
|
1617
|
+
undefined,
|
1618
|
+
undefined,
|
1619
|
+
true
|
1620
|
+
);
|
1621
|
+
event.preventDefault();
|
1622
|
+
});
|
1623
|
+
|
1624
|
+
|
1625
|
+
//click routing - direct to HTTP or Ajax, accordingly
|
1626
|
+
$( "a" ).live( "click", function(event) {
|
1627
|
+
if( !$.mobile.ajaxLinksEnabled ){ return; }
|
1628
|
+
var $this = $(this),
|
1629
|
+
//get href, remove same-domain protocol and host
|
1630
|
+
href = $this.attr( "href" ).replace( location.protocol + "//" + location.host, ""),
|
1631
|
+
//if target attr is specified, it's external, and we mimic _blank... for now
|
1632
|
+
target = $this.is( "[target]" ),
|
1633
|
+
//if it still starts with a protocol, it's external, or could be :mailto, etc
|
1634
|
+
external = target || /^(:?\w+:)/.test( href ) || $this.is( "[rel=external]" ),
|
1635
|
+
target = $this.is( "[target]" );
|
1636
|
+
|
1637
|
+
if( href === '#' ){
|
1638
|
+
//for links created purely for interaction - ignore
|
1639
|
+
return false;
|
1640
|
+
}
|
1641
|
+
|
1642
|
+
$activeClickedLink = $this.closest( ".ui-btn" ).addClass( $.mobile.activeBtnClass );
|
1643
|
+
|
1644
|
+
if( external || !$.mobile.ajaxLinksEnabled ){
|
1645
|
+
//remove active link class if external
|
1646
|
+
removeActiveLinkClass(true);
|
1647
|
+
|
1648
|
+
//deliberately redirect, in case click was triggered
|
1649
|
+
if( target ){
|
1650
|
+
window.open(href);
|
1651
|
+
}
|
1652
|
+
else{
|
1653
|
+
location.href = href;
|
1654
|
+
}
|
1655
|
+
}
|
1656
|
+
else {
|
1657
|
+
//use ajax
|
1658
|
+
var transition = $this.data( "transition" ),
|
1659
|
+
back = $this.data( "back" ),
|
1660
|
+
changeHashOnSuccess = !$this.is( "[data-rel="+ $.mobile.nonHistorySelectors +"]" );
|
1661
|
+
|
1662
|
+
nextPageRole = $this.attr( "data-rel" );
|
1663
|
+
|
1664
|
+
//if it's a relative href, prefix href with base url
|
1665
|
+
if( href.indexOf('/') && href.indexOf('#') !== 0 ){
|
1666
|
+
href = path.get() + href;
|
1667
|
+
}
|
1668
|
+
|
1669
|
+
href.replace(/^#/,'');
|
1670
|
+
|
1671
|
+
$.mobile.changePage(href, transition, back, changeHashOnSuccess);
|
1672
|
+
}
|
1673
|
+
event.preventDefault();
|
1674
|
+
});
|
1675
|
+
|
1676
|
+
|
1677
|
+
|
1678
|
+
//hashchange event handler
|
1679
|
+
$window.bind( "hashchange", function(e, triggered) {
|
1680
|
+
if( !hashListener ){
|
1681
|
+
hashListener = true;
|
1682
|
+
return;
|
1683
|
+
}
|
1684
|
+
|
1685
|
+
if( $(".ui-page-active").is("[data-role=" + $.mobile.nonHistorySelectors + "]") ){
|
1686
|
+
return;
|
1687
|
+
}
|
1688
|
+
|
1689
|
+
var to = location.hash,
|
1690
|
+
transition = triggered ? false : undefined;
|
1691
|
+
|
1692
|
+
//if to is defined, use it
|
1693
|
+
if ( to ){
|
1694
|
+
$.mobile.changePage( to, transition);
|
1695
|
+
}
|
1696
|
+
//there's no hash, the active page is not the start page, and it's not manually triggered hashchange
|
1697
|
+
//we probably backed out to the first page visited
|
1698
|
+
else if( $.mobile.activePage.length && $.mobile.startPage[0] !== $.mobile.activePage[0] && !triggered ) {
|
1699
|
+
$.mobile.changePage( $.mobile.startPage, transition, true );
|
1700
|
+
}
|
1701
|
+
//probably the first page - show it
|
1702
|
+
else{
|
1703
|
+
$.mobile.startPage.trigger("pagebeforeshow", {prevPage: $('')});
|
1704
|
+
$.mobile.startPage.addClass( $.mobile.activePageClass );
|
1705
|
+
$.mobile.pageLoading( true );
|
1706
|
+
|
1707
|
+
if( $.mobile.startPage.trigger("pageshow", {prevPage: $('')}) !== false ){
|
1708
|
+
reFocus($.mobile.startPage);
|
1709
|
+
}
|
1710
|
+
}
|
1711
|
+
});
|
1712
|
+
})( jQuery );
|
1713
|
+
|
1714
|
+
/*
|
1715
|
+
* jQuery Mobile Framework : "page" plugin
|
1716
|
+
* Copyright (c) jQuery Project
|
1717
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1718
|
+
* http://jquery.org/license
|
1719
|
+
*/
|
1720
|
+
(function($, undefined ) {
|
1721
|
+
|
1722
|
+
$.widget( "mobile.page", $.mobile.widget, {
|
1723
|
+
options: {
|
1724
|
+
backBtnText: "Back",
|
1725
|
+
addBackBtn: true,
|
1726
|
+
degradeInputs: {
|
1727
|
+
color: false,
|
1728
|
+
date: false,
|
1729
|
+
datetime: false,
|
1730
|
+
"datetime-local": false,
|
1731
|
+
email: false,
|
1732
|
+
month: false,
|
1733
|
+
number: false,
|
1734
|
+
range: "number",
|
1735
|
+
search: true,
|
1736
|
+
tel: false,
|
1737
|
+
time: false,
|
1738
|
+
url: false,
|
1739
|
+
week: false
|
1740
|
+
}
|
1741
|
+
},
|
1742
|
+
|
1743
|
+
_create: function() {
|
1744
|
+
var $elem = this.element,
|
1745
|
+
o = this.options;
|
1746
|
+
|
1747
|
+
if ( this._trigger( "beforeCreate" ) === false ) {
|
1748
|
+
return;
|
1749
|
+
}
|
1750
|
+
|
1751
|
+
//some of the form elements currently rely on the presence of ui-page and ui-content
|
1752
|
+
// classes so we'll handle page and content roles outside of the main role processing
|
1753
|
+
// loop below.
|
1754
|
+
$elem.find( "[data-role='page'], [data-role='content']" ).andSelf().each(function() {
|
1755
|
+
$(this).addClass( "ui-" + $(this).data( "role" ) );
|
1756
|
+
});
|
1757
|
+
|
1758
|
+
$elem.find( "[data-role='nojs']" ).addClass( "ui-nojs" );
|
1759
|
+
|
1760
|
+
this._enchanceControls();
|
1761
|
+
|
1762
|
+
// pre-find data els
|
1763
|
+
var $dataEls = $elem.find( "[data-role]" ).andSelf().each(function() {
|
1764
|
+
var $this = $( this ),
|
1765
|
+
role = $this.data( "role" ),
|
1766
|
+
theme = $this.data( "theme" );
|
1767
|
+
|
1768
|
+
//apply theming and markup modifications to page,header,content,footer
|
1769
|
+
if ( role === "header" || role === "footer" ) {
|
1770
|
+
$this.addClass( "ui-bar-" + (theme || $this.parent('[data-role=page]').data( "theme" ) || "a") );
|
1771
|
+
|
1772
|
+
// add ARIA role
|
1773
|
+
$this.attr( "role", role === "header" ? "banner" : "contentinfo" );
|
1774
|
+
|
1775
|
+
//right,left buttons
|
1776
|
+
var $headeranchors = $this.children( "a" ),
|
1777
|
+
leftbtn = $headeranchors.hasClass( "ui-btn-left" ),
|
1778
|
+
rightbtn = $headeranchors.hasClass( "ui-btn-right" );
|
1779
|
+
|
1780
|
+
if ( !leftbtn ) {
|
1781
|
+
leftbtn = $headeranchors.eq( 0 ).not( ".ui-btn-right" ).addClass( "ui-btn-left" ).length;
|
1782
|
+
}
|
1783
|
+
|
1784
|
+
if ( !rightbtn ) {
|
1785
|
+
rightbtn = $headeranchors.eq( 1 ).addClass( "ui-btn-right" ).length;
|
1786
|
+
}
|
1787
|
+
|
1788
|
+
// auto-add back btn on pages beyond first view
|
1789
|
+
if ( o.addBackBtn && role === "header" &&
|
1790
|
+
($.mobile.urlStack.length > 1 || $(".ui-page").length > 1) &&
|
1791
|
+
!leftbtn && !$this.data( "noBackBtn" ) ) {
|
1792
|
+
|
1793
|
+
$( "<a href='#' class='ui-btn-left' data-icon='arrow-l'>"+ o.backBtnText +"</a>" )
|
1794
|
+
.click(function() {
|
1795
|
+
history.back();
|
1796
|
+
return false;
|
1797
|
+
})
|
1798
|
+
.prependTo( $this );
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
//page title
|
1802
|
+
$this.children( "h1, h2, h3, h4, h5, h6" )
|
1803
|
+
.addClass( "ui-title" )
|
1804
|
+
//regardless of h element number in src, it becomes h1 for the enhanced page
|
1805
|
+
.attr({ "tabindex": "0", "role": "heading", "aria-level": "1" });
|
1806
|
+
|
1807
|
+
} else if ( role === "content" ) {
|
1808
|
+
if ( theme ) {
|
1809
|
+
$this.addClass( "ui-body-" + theme );
|
1810
|
+
}
|
1811
|
+
|
1812
|
+
// add ARIA role
|
1813
|
+
$this.attr( "role", "main" );
|
1814
|
+
|
1815
|
+
} else if ( role === "page" ) {
|
1816
|
+
$this.addClass( "ui-body-" + (theme || "c") );
|
1817
|
+
}
|
1818
|
+
|
1819
|
+
switch(role) {
|
1820
|
+
case "header":
|
1821
|
+
case "footer":
|
1822
|
+
case "page":
|
1823
|
+
case "content":
|
1824
|
+
$this.addClass( "ui-" + role );
|
1825
|
+
break;
|
1826
|
+
case "collapsible":
|
1827
|
+
case "fieldcontain":
|
1828
|
+
case "navbar":
|
1829
|
+
case "listview":
|
1830
|
+
case "dialog":
|
1831
|
+
$this[ role ]();
|
1832
|
+
break;
|
1833
|
+
}
|
1834
|
+
});
|
1835
|
+
|
1836
|
+
//links in bars, or those with data-role become buttons
|
1837
|
+
$elem.find( "[data-role='button'], .ui-bar a, .ui-header a, .ui-footer a" )
|
1838
|
+
.not( ".ui-btn" )
|
1839
|
+
.buttonMarkup();
|
1840
|
+
|
1841
|
+
$elem
|
1842
|
+
.find("[data-role='controlgroup']")
|
1843
|
+
.controlgroup();
|
1844
|
+
|
1845
|
+
//links within content areas
|
1846
|
+
$elem.find( "a:not(.ui-btn):not(.ui-link-inherit)" )
|
1847
|
+
.addClass( "ui-link" );
|
1848
|
+
|
1849
|
+
//fix toolbars
|
1850
|
+
$elem.fixHeaderFooter();
|
1851
|
+
},
|
1852
|
+
|
1853
|
+
_enchanceControls: function() {
|
1854
|
+
var o = this.options;
|
1855
|
+
// degrade inputs to avoid poorly implemented native functionality
|
1856
|
+
this.element.find( "input" ).each(function() {
|
1857
|
+
var type = this.getAttribute( "type" ),
|
1858
|
+
optType = o.degradeInputs[ type ] || "text";
|
1859
|
+
|
1860
|
+
if ( o.degradeInputs[ type ] ) {
|
1861
|
+
$( this ).replaceWith(
|
1862
|
+
$( "<div>" ).html( $(this).clone() ).html()
|
1863
|
+
.replace( /type="([a-zA-Z]+)"/, "type="+ optType +" data-type='$1'" ) );
|
1864
|
+
}
|
1865
|
+
});
|
1866
|
+
|
1867
|
+
// enchance form controls
|
1868
|
+
this.element
|
1869
|
+
.find( "[type='radio'], [type='checkbox']" )
|
1870
|
+
.checkboxradio();
|
1871
|
+
|
1872
|
+
this.element
|
1873
|
+
.find( "button, [type='button'], [type='submit'], [type='reset'], [type='image']" )
|
1874
|
+
.not( ".ui-nojs" )
|
1875
|
+
.button();
|
1876
|
+
|
1877
|
+
this.element
|
1878
|
+
.find( "input, textarea" )
|
1879
|
+
.not( "[type='radio'], [type='checkbox'], button, [type='button'], [type='submit'], [type='reset'], [type='image']" )
|
1880
|
+
.textinput();
|
1881
|
+
|
1882
|
+
this.element
|
1883
|
+
.find( "input, select" )
|
1884
|
+
.filter( "[data-role='slider'], [data-type='range']" )
|
1885
|
+
.slider();
|
1886
|
+
|
1887
|
+
this.element
|
1888
|
+
.find( "select:not([data-role='slider'])" )
|
1889
|
+
.selectmenu();
|
1890
|
+
}
|
1891
|
+
});
|
1892
|
+
|
1893
|
+
})( jQuery );
|
1894
|
+
|
1895
|
+
|
1896
|
+
/*
|
1897
|
+
* jQuery UI Position @VERSION
|
1898
|
+
*
|
1899
|
+
* Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
|
1900
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
1901
|
+
* http://jquery.org/license
|
1902
|
+
*
|
1903
|
+
* http://docs.jquery.com/UI/Position
|
1904
|
+
*/
|
1905
|
+
(function( $, undefined ) {
|
1906
|
+
|
1907
|
+
$.ui = $.ui || {};
|
1908
|
+
|
1909
|
+
var horizontalPositions = /left|center|right/,
|
1910
|
+
verticalPositions = /top|center|bottom/,
|
1911
|
+
center = "center",
|
1912
|
+
_position = $.fn.position,
|
1913
|
+
_offset = $.fn.offset;
|
1914
|
+
|
1915
|
+
$.fn.position = function( options ) {
|
1916
|
+
if ( !options || !options.of ) {
|
1917
|
+
return _position.apply( this, arguments );
|
1918
|
+
}
|
1919
|
+
|
1920
|
+
// make a copy, we don't want to modify arguments
|
1921
|
+
options = $.extend( {}, options );
|
1922
|
+
|
1923
|
+
var target = $( options.of ),
|
1924
|
+
targetElem = target[0],
|
1925
|
+
collision = ( options.collision || "flip" ).split( " " ),
|
1926
|
+
offset = options.offset ? options.offset.split( " " ) : [ 0, 0 ],
|
1927
|
+
targetWidth,
|
1928
|
+
targetHeight,
|
1929
|
+
basePosition;
|
1930
|
+
|
1931
|
+
if ( targetElem.nodeType === 9 ) {
|
1932
|
+
targetWidth = target.width();
|
1933
|
+
targetHeight = target.height();
|
1934
|
+
basePosition = { top: 0, left: 0 };
|
1935
|
+
// TODO: use $.isWindow() in 1.9
|
1936
|
+
} else if ( targetElem.setTimeout ) {
|
1937
|
+
targetWidth = target.width();
|
1938
|
+
targetHeight = target.height();
|
1939
|
+
basePosition = { top: target.scrollTop(), left: target.scrollLeft() };
|
1940
|
+
} else if ( targetElem.preventDefault ) {
|
1941
|
+
// force left top to allow flipping
|
1942
|
+
options.at = "left top";
|
1943
|
+
targetWidth = targetHeight = 0;
|
1944
|
+
basePosition = { top: options.of.pageY, left: options.of.pageX };
|
1945
|
+
} else {
|
1946
|
+
targetWidth = target.outerWidth();
|
1947
|
+
targetHeight = target.outerHeight();
|
1948
|
+
basePosition = target.offset();
|
1949
|
+
}
|
1950
|
+
|
1951
|
+
// force my and at to have valid horizontal and veritcal positions
|
1952
|
+
// if a value is missing or invalid, it will be converted to center
|
1953
|
+
$.each( [ "my", "at" ], function() {
|
1954
|
+
var pos = ( options[this] || "" ).split( " " );
|
1955
|
+
if ( pos.length === 1) {
|
1956
|
+
pos = horizontalPositions.test( pos[0] ) ?
|
1957
|
+
pos.concat( [center] ) :
|
1958
|
+
verticalPositions.test( pos[0] ) ?
|
1959
|
+
[ center ].concat( pos ) :
|
1960
|
+
[ center, center ];
|
1961
|
+
}
|
1962
|
+
pos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;
|
1963
|
+
pos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;
|
1964
|
+
options[ this ] = pos;
|
1965
|
+
});
|
1966
|
+
|
1967
|
+
// normalize collision option
|
1968
|
+
if ( collision.length === 1 ) {
|
1969
|
+
collision[ 1 ] = collision[ 0 ];
|
1970
|
+
}
|
1971
|
+
|
1972
|
+
// normalize offset option
|
1973
|
+
offset[ 0 ] = parseInt( offset[0], 10 ) || 0;
|
1974
|
+
if ( offset.length === 1 ) {
|
1975
|
+
offset[ 1 ] = offset[ 0 ];
|
1976
|
+
}
|
1977
|
+
offset[ 1 ] = parseInt( offset[1], 10 ) || 0;
|
1978
|
+
|
1979
|
+
if ( options.at[0] === "right" ) {
|
1980
|
+
basePosition.left += targetWidth;
|
1981
|
+
} else if (options.at[0] === center ) {
|
1982
|
+
basePosition.left += targetWidth / 2;
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
if ( options.at[1] === "bottom" ) {
|
1986
|
+
basePosition.top += targetHeight;
|
1987
|
+
} else if ( options.at[1] === center ) {
|
1988
|
+
basePosition.top += targetHeight / 2;
|
1989
|
+
}
|
1990
|
+
|
1991
|
+
basePosition.left += offset[ 0 ];
|
1992
|
+
basePosition.top += offset[ 1 ];
|
1993
|
+
|
1994
|
+
return this.each(function() {
|
1995
|
+
var elem = $( this ),
|
1996
|
+
elemWidth = elem.outerWidth(),
|
1997
|
+
elemHeight = elem.outerHeight(),
|
1998
|
+
marginLeft = parseInt( $.curCSS( this, "marginLeft", true ) ) || 0,
|
1999
|
+
marginTop = parseInt( $.curCSS( this, "marginTop", true ) ) || 0,
|
2000
|
+
collisionWidth = elemWidth + marginLeft +
|
2001
|
+
parseInt( $.curCSS( this, "marginRight", true ) ) || 0,
|
2002
|
+
collisionHeight = elemHeight + marginTop +
|
2003
|
+
parseInt( $.curCSS( this, "marginBottom", true ) ) || 0,
|
2004
|
+
position = $.extend( {}, basePosition ),
|
2005
|
+
collisionPosition;
|
2006
|
+
|
2007
|
+
if ( options.my[0] === "right" ) {
|
2008
|
+
position.left -= elemWidth;
|
2009
|
+
} else if ( options.my[0] === center ) {
|
2010
|
+
position.left -= elemWidth / 2;
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
if ( options.my[1] === "bottom" ) {
|
2014
|
+
position.top -= elemHeight;
|
2015
|
+
} else if ( options.my[1] === center ) {
|
2016
|
+
position.top -= elemHeight / 2;
|
2017
|
+
}
|
2018
|
+
|
2019
|
+
// prevent fractions (see #5280)
|
2020
|
+
position.left = parseInt( position.left );
|
2021
|
+
position.top = parseInt( position.top );
|
2022
|
+
|
2023
|
+
collisionPosition = {
|
2024
|
+
left: position.left - marginLeft,
|
2025
|
+
top: position.top - marginTop
|
2026
|
+
};
|
2027
|
+
|
2028
|
+
$.each( [ "left", "top" ], function( i, dir ) {
|
2029
|
+
if ( $.ui.position[ collision[i] ] ) {
|
2030
|
+
$.ui.position[ collision[i] ][ dir ]( position, {
|
2031
|
+
targetWidth: targetWidth,
|
2032
|
+
targetHeight: targetHeight,
|
2033
|
+
elemWidth: elemWidth,
|
2034
|
+
elemHeight: elemHeight,
|
2035
|
+
collisionPosition: collisionPosition,
|
2036
|
+
collisionWidth: collisionWidth,
|
2037
|
+
collisionHeight: collisionHeight,
|
2038
|
+
offset: offset,
|
2039
|
+
my: options.my,
|
2040
|
+
at: options.at
|
2041
|
+
});
|
2042
|
+
}
|
2043
|
+
});
|
2044
|
+
|
2045
|
+
if ( $.fn.bgiframe ) {
|
2046
|
+
elem.bgiframe();
|
2047
|
+
}
|
2048
|
+
elem.offset( $.extend( position, { using: options.using } ) );
|
2049
|
+
});
|
2050
|
+
};
|
2051
|
+
|
2052
|
+
$.ui.position = {
|
2053
|
+
fit: {
|
2054
|
+
left: function( position, data ) {
|
2055
|
+
var win = $( window ),
|
2056
|
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();
|
2057
|
+
position.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );
|
2058
|
+
},
|
2059
|
+
top: function( position, data ) {
|
2060
|
+
var win = $( window ),
|
2061
|
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();
|
2062
|
+
position.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );
|
2063
|
+
}
|
2064
|
+
},
|
2065
|
+
|
2066
|
+
flip: {
|
2067
|
+
left: function( position, data ) {
|
2068
|
+
if ( data.at[0] === center ) {
|
2069
|
+
return;
|
2070
|
+
}
|
2071
|
+
var win = $( window ),
|
2072
|
+
over = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),
|
2073
|
+
myOffset = data.my[ 0 ] === "left" ?
|
2074
|
+
-data.elemWidth :
|
2075
|
+
data.my[ 0 ] === "right" ?
|
2076
|
+
data.elemWidth :
|
2077
|
+
0,
|
2078
|
+
atOffset = data.at[ 0 ] === "left" ?
|
2079
|
+
data.targetWidth :
|
2080
|
+
-data.targetWidth,
|
2081
|
+
offset = -2 * data.offset[ 0 ];
|
2082
|
+
position.left += data.collisionPosition.left < 0 ?
|
2083
|
+
myOffset + atOffset + offset :
|
2084
|
+
over > 0 ?
|
2085
|
+
myOffset + atOffset + offset :
|
2086
|
+
0;
|
2087
|
+
},
|
2088
|
+
top: function( position, data ) {
|
2089
|
+
if ( data.at[1] === center ) {
|
2090
|
+
return;
|
2091
|
+
}
|
2092
|
+
var win = $( window ),
|
2093
|
+
over = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),
|
2094
|
+
myOffset = data.my[ 1 ] === "top" ?
|
2095
|
+
-data.elemHeight :
|
2096
|
+
data.my[ 1 ] === "bottom" ?
|
2097
|
+
data.elemHeight :
|
2098
|
+
0,
|
2099
|
+
atOffset = data.at[ 1 ] === "top" ?
|
2100
|
+
data.targetHeight :
|
2101
|
+
-data.targetHeight,
|
2102
|
+
offset = -2 * data.offset[ 1 ];
|
2103
|
+
position.top += data.collisionPosition.top < 0 ?
|
2104
|
+
myOffset + atOffset + offset :
|
2105
|
+
over > 0 ?
|
2106
|
+
myOffset + atOffset + offset :
|
2107
|
+
0;
|
2108
|
+
}
|
2109
|
+
}
|
2110
|
+
};
|
2111
|
+
|
2112
|
+
// offset setter from jQuery 1.4
|
2113
|
+
if ( !$.offset.setOffset ) {
|
2114
|
+
$.offset.setOffset = function( elem, options ) {
|
2115
|
+
// set position first, in-case top/left are set even on static elem
|
2116
|
+
if ( /static/.test( $.curCSS( elem, "position" ) ) ) {
|
2117
|
+
elem.style.position = "relative";
|
2118
|
+
}
|
2119
|
+
var curElem = $( elem ),
|
2120
|
+
curOffset = curElem.offset(),
|
2121
|
+
curTop = parseInt( $.curCSS( elem, "top", true ), 10 ) || 0,
|
2122
|
+
curLeft = parseInt( $.curCSS( elem, "left", true ), 10) || 0,
|
2123
|
+
props = {
|
2124
|
+
top: (options.top - curOffset.top) + curTop,
|
2125
|
+
left: (options.left - curOffset.left) + curLeft
|
2126
|
+
};
|
2127
|
+
|
2128
|
+
if ( 'using' in options ) {
|
2129
|
+
options.using.call( elem, props );
|
2130
|
+
} else {
|
2131
|
+
curElem.css( props );
|
2132
|
+
}
|
2133
|
+
};
|
2134
|
+
|
2135
|
+
$.fn.offset = function( options ) {
|
2136
|
+
var elem = this[ 0 ];
|
2137
|
+
if ( !elem || !elem.ownerDocument ) { return null; }
|
2138
|
+
if ( options ) {
|
2139
|
+
return this.each(function() {
|
2140
|
+
$.offset.setOffset( this, options );
|
2141
|
+
});
|
2142
|
+
}
|
2143
|
+
return _offset.call( this );
|
2144
|
+
};
|
2145
|
+
}
|
2146
|
+
|
2147
|
+
}( jQuery ));
|
2148
|
+
|
2149
|
+
/*
|
2150
|
+
* jQuery Mobile Framework : "fixHeaderFooter" plugin - on-demand positioning for headers,footers
|
2151
|
+
* Copyright (c) jQuery Project
|
2152
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
2153
|
+
* http://jquery.org/license
|
2154
|
+
*/
|
2155
|
+
(function($, undefined ) {
|
2156
|
+
$.fn.fixHeaderFooter = function(options){
|
2157
|
+
if( !$.support.scrollTop ){ return $(this); }
|
2158
|
+
return $(this).each(function(){
|
2159
|
+
if( $(this).data('fullscreen') ){ $(this).addClass('ui-page-fullscreen'); }
|
2160
|
+
$(this).find('.ui-header[data-position="fixed"]').addClass('ui-header-fixed ui-fixed-inline fade'); //should be slidedown
|
2161
|
+
$(this).find('.ui-footer[data-position="fixed"]').addClass('ui-footer-fixed ui-fixed-inline fade'); //should be slideup
|
2162
|
+
});
|
2163
|
+
};
|
2164
|
+
|
2165
|
+
//single controller for all showing,hiding,toggling
|
2166
|
+
$.fixedToolbars = (function(){
|
2167
|
+
if( !$.support.scrollTop ){ return; }
|
2168
|
+
var currentstate = 'inline',
|
2169
|
+
delayTimer,
|
2170
|
+
ignoreTargets = 'a,input,textarea,select,button,label,.ui-header-fixed,.ui-footer-fixed',
|
2171
|
+
toolbarSelector = '.ui-header-fixed:first, .ui-footer-fixed:not(.ui-footer-duplicate):last',
|
2172
|
+
stickyFooter, //for storing quick references to duplicate footers
|
2173
|
+
supportTouch = $.support.touch,
|
2174
|
+
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
|
2175
|
+
touchStopEvent = supportTouch ? "touchend" : "mouseup",
|
2176
|
+
stateBefore = null,
|
2177
|
+
scrollTriggered = false;
|
2178
|
+
|
2179
|
+
$(function() {
|
2180
|
+
$(document)
|
2181
|
+
.bind(touchStartEvent,function(event){
|
2182
|
+
if( $(event.target).closest(ignoreTargets).length ){ return; }
|
2183
|
+
stateBefore = currentstate;
|
2184
|
+
$.fixedToolbars.hide(true);
|
2185
|
+
})
|
2186
|
+
.bind('scrollstart',function(event){
|
2187
|
+
if( $(event.target).closest(ignoreTargets).length ){ return; } //because it could be a touchmove...
|
2188
|
+
scrollTriggered = true;
|
2189
|
+
if(stateBefore == null){ stateBefore = currentstate; }
|
2190
|
+
$.fixedToolbars.hide(true);
|
2191
|
+
})
|
2192
|
+
.bind(touchStopEvent,function(event){
|
2193
|
+
if( $(event.target).closest(ignoreTargets).length ){ return; }
|
2194
|
+
if( !scrollTriggered ){
|
2195
|
+
$.fixedToolbars.toggle(stateBefore);
|
2196
|
+
stateBefore = null;
|
2197
|
+
}
|
2198
|
+
})
|
2199
|
+
.bind('scrollstop',function(event){
|
2200
|
+
if( $(event.target).closest(ignoreTargets).length ){ return; }
|
2201
|
+
scrollTriggered = false;
|
2202
|
+
$.fixedToolbars.toggle( stateBefore == 'overlay' ? 'inline' : 'overlay' );
|
2203
|
+
stateBefore = null;
|
2204
|
+
});
|
2205
|
+
|
2206
|
+
//function to return another footer already in the dom with the same data-id
|
2207
|
+
function findStickyFooter(el){
|
2208
|
+
var thisFooter = el.find('[data-role="footer"]');
|
2209
|
+
return $( '.ui-footer[data-id="'+ thisFooter.data('id') +'"]:not(.ui-footer-duplicate)' ).not(thisFooter);
|
2210
|
+
}
|
2211
|
+
|
2212
|
+
//before page is shown, check for duplicate footer
|
2213
|
+
$('.ui-page').live('pagebeforeshow', function(event, ui){
|
2214
|
+
stickyFooter = findStickyFooter( $(event.target) );
|
2215
|
+
if( stickyFooter.length ){
|
2216
|
+
//if the existing footer is the first of its kind, create a placeholder before stealing it
|
2217
|
+
if( stickyFooter.parents('.ui-page:eq(0)').find('.ui-footer[data-id="'+ stickyFooter.data('id') +'"]').length == 1 ){
|
2218
|
+
stickyFooter.before( stickyFooter.clone().addClass('ui-footer-duplicate') );
|
2219
|
+
}
|
2220
|
+
$(event.target).find('[data-role="footer"]').addClass('ui-footer-duplicate');
|
2221
|
+
stickyFooter.appendTo($.pageContainer).css('top',0);
|
2222
|
+
setTop(stickyFooter);
|
2223
|
+
}
|
2224
|
+
});
|
2225
|
+
|
2226
|
+
//after page is shown, append footer to new page
|
2227
|
+
$('.ui-page').live('pageshow', function(event, ui){
|
2228
|
+
if( stickyFooter && stickyFooter.length ){
|
2229
|
+
stickyFooter.appendTo(event.target).css('top',0);
|
2230
|
+
}
|
2231
|
+
$.fixedToolbars.show(true, this);
|
2232
|
+
});
|
2233
|
+
|
2234
|
+
});
|
2235
|
+
|
2236
|
+
// element.getBoundingClientRect() is broken in iOS 3.2.1 on the iPad. The
|
2237
|
+
// coordinates inside of the rect it returns don't have the page scroll position
|
2238
|
+
// factored out of it like the other platforms do. To get around this,
|
2239
|
+
// we'll just calculate the top offset the old fashioned way until core has
|
2240
|
+
// a chance to figure out how to handle this situation.
|
2241
|
+
//
|
2242
|
+
// TODO: We'll need to get rid of getOffsetTop() once a fix gets folded into core.
|
2243
|
+
|
2244
|
+
function getOffsetTop(ele)
|
2245
|
+
{
|
2246
|
+
var top = 0;
|
2247
|
+
if (ele)
|
2248
|
+
{
|
2249
|
+
var op = ele.offsetParent, body = document.body;
|
2250
|
+
top = ele.offsetTop;
|
2251
|
+
while (ele && ele != body)
|
2252
|
+
{
|
2253
|
+
top += ele.scrollTop || 0;
|
2254
|
+
if (ele == op)
|
2255
|
+
{
|
2256
|
+
top += op.offsetTop;
|
2257
|
+
op = ele.offsetParent;
|
2258
|
+
}
|
2259
|
+
ele = ele.parentNode;
|
2260
|
+
}
|
2261
|
+
}
|
2262
|
+
return top;
|
2263
|
+
}
|
2264
|
+
|
2265
|
+
function setTop(el){
|
2266
|
+
var fromTop = $(window).scrollTop(),
|
2267
|
+
thisTop = getOffsetTop(el[0]), // el.offset().top returns the wrong value on iPad iOS 3.2.1, call our workaround instead.
|
2268
|
+
thisCSStop = el.css('top') == 'auto' ? 0 : parseFloat(el.css('top')),
|
2269
|
+
screenHeight = window.innerHeight,
|
2270
|
+
thisHeight = el.outerHeight(),
|
2271
|
+
useRelative = el.parents('.ui-page:not(.ui-page-fullscreen)').length,
|
2272
|
+
relval;
|
2273
|
+
if( el.is('.ui-header-fixed') ){
|
2274
|
+
relval = fromTop - thisTop + thisCSStop;
|
2275
|
+
if( relval < thisTop){ relval = 0; }
|
2276
|
+
return el.css('top', ( useRelative ) ? relval : fromTop);
|
2277
|
+
}
|
2278
|
+
else{
|
2279
|
+
//relval = -1 * (thisTop - (fromTop + screenHeight) + thisCSStop + thisHeight);
|
2280
|
+
//if( relval > thisTop ){ relval = 0; }
|
2281
|
+
relval = fromTop + screenHeight - thisHeight - (thisTop - thisCSStop);
|
2282
|
+
return el.css('top', ( useRelative ) ? relval : fromTop + screenHeight - thisHeight );
|
2283
|
+
}
|
2284
|
+
}
|
2285
|
+
|
2286
|
+
//exposed methods
|
2287
|
+
return {
|
2288
|
+
show: function(immediately, page){
|
2289
|
+
currentstate = 'overlay';
|
2290
|
+
var $ap = page ? $(page) : ($.mobile.activePage ? $.mobile.activePage : $(".ui-page-active"));
|
2291
|
+
return $ap.children( toolbarSelector ).each(function(){
|
2292
|
+
var el = $(this),
|
2293
|
+
fromTop = $(window).scrollTop(),
|
2294
|
+
thisTop = getOffsetTop(el[0]), // el.offset().top returns the wrong value on iPad iOS 3.2.1, call our workaround instead.
|
2295
|
+
screenHeight = window.innerHeight,
|
2296
|
+
thisHeight = el.outerHeight(),
|
2297
|
+
alreadyVisible = (el.is('.ui-header-fixed') && fromTop <= thisTop + thisHeight) || (el.is('.ui-footer-fixed') && thisTop <= fromTop + screenHeight);
|
2298
|
+
|
2299
|
+
//add state class
|
2300
|
+
el.addClass('ui-fixed-overlay').removeClass('ui-fixed-inline');
|
2301
|
+
|
2302
|
+
if( !alreadyVisible && !immediately ){
|
2303
|
+
el.addClass('in').animationComplete(function(){
|
2304
|
+
el.removeClass('in');
|
2305
|
+
});
|
2306
|
+
}
|
2307
|
+
setTop(el);
|
2308
|
+
});
|
2309
|
+
},
|
2310
|
+
hide: function(immediately){
|
2311
|
+
currentstate = 'inline';
|
2312
|
+
var $ap = $.mobile.activePage ? $.mobile.activePage : $(".ui-page-active");
|
2313
|
+
return $ap.children( toolbarSelector ).each(function(){
|
2314
|
+
var el = $(this);
|
2315
|
+
|
2316
|
+
var thisCSStop = el.css('top'); thisCSStop = thisCSStop == 'auto' ? 0 : parseFloat(thisCSStop);
|
2317
|
+
|
2318
|
+
//add state class
|
2319
|
+
el.addClass('ui-fixed-inline').removeClass('ui-fixed-overlay');
|
2320
|
+
|
2321
|
+
if (thisCSStop < 0 || (el.is('.ui-header-fixed') && thisCSStop != 0))
|
2322
|
+
{
|
2323
|
+
if(immediately){
|
2324
|
+
el.css('top',0);
|
2325
|
+
}
|
2326
|
+
else{
|
2327
|
+
if( el.css('top') !== 'auto' && parseFloat(el.css('top')) !== 0 ){
|
2328
|
+
var classes = 'out reverse';
|
2329
|
+
el.addClass(classes).animationComplete(function(){
|
2330
|
+
el.removeClass(classes);
|
2331
|
+
el.css('top',0);
|
2332
|
+
});
|
2333
|
+
}
|
2334
|
+
}
|
2335
|
+
}
|
2336
|
+
});
|
2337
|
+
},
|
2338
|
+
hideAfterDelay: function(){
|
2339
|
+
delayTimer = setTimeout(function(){
|
2340
|
+
$.fixedToolbars.hide();
|
2341
|
+
}, 3000);
|
2342
|
+
},
|
2343
|
+
toggle: function(from){
|
2344
|
+
if(from){ currentstate = from; }
|
2345
|
+
return (currentstate == 'overlay') ? $.fixedToolbars.hide() : $.fixedToolbars.show();
|
2346
|
+
}
|
2347
|
+
};
|
2348
|
+
})();
|
2349
|
+
|
2350
|
+
})(jQuery);
|
2351
|
+
|
2352
|
+
/*
|
2353
|
+
* jQuery Mobile Framework : "checkboxradio" plugin
|
2354
|
+
* Copyright (c) jQuery Project
|
2355
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
2356
|
+
* http://jquery.org/license
|
2357
|
+
*/
|
2358
|
+
(function($, undefined ) {
|
2359
|
+
$.widget( "mobile.checkboxradio", $.mobile.widget, {
|
2360
|
+
options: {
|
2361
|
+
theme: null
|
2362
|
+
},
|
2363
|
+
_create: function(){
|
2364
|
+
var input = this.element,
|
2365
|
+
label = $("label[for='" + input.attr( "id" ) + "']"),
|
2366
|
+
inputtype = input.attr( "type" ),
|
2367
|
+
checkedicon = "ui-icon-" + inputtype + "-on",
|
2368
|
+
uncheckedicon = "ui-icon-" + inputtype + "-off";
|
2369
|
+
|
2370
|
+
if ( inputtype != "checkbox" && inputtype != "radio" ) { return; }
|
2371
|
+
|
2372
|
+
label
|
2373
|
+
.buttonMarkup({
|
2374
|
+
theme: this.options.theme,
|
2375
|
+
icon: this.element.parents( "[data-type='horizontal']" ).length ? undefined : uncheckedicon,
|
2376
|
+
shadow: false
|
2377
|
+
});
|
2378
|
+
|
2379
|
+
// wrap the input + label in a div
|
2380
|
+
input
|
2381
|
+
.add( label )
|
2382
|
+
.wrapAll( "<div class='ui-" + inputtype +"'></div>" );
|
2383
|
+
|
2384
|
+
label.bind({
|
2385
|
+
mouseover: function() {
|
2386
|
+
if( $(this).parent().is('.ui-disabled') ){ return false; }
|
2387
|
+
},
|
2388
|
+
|
2389
|
+
mousedown: function() {
|
2390
|
+
if( $(this).parent().is('.ui-disabled') ){ return false; }
|
2391
|
+
label.data( "state", input.attr( "checked" ) );
|
2392
|
+
},
|
2393
|
+
|
2394
|
+
click: function() {
|
2395
|
+
setTimeout(function() {
|
2396
|
+
if ( input.attr( "checked" ) === label.data( "state" ) ) {
|
2397
|
+
input.trigger( "click" );
|
2398
|
+
}
|
2399
|
+
}, 1);
|
2400
|
+
}
|
2401
|
+
});
|
2402
|
+
|
2403
|
+
input
|
2404
|
+
.bind({
|
2405
|
+
|
2406
|
+
click: function() {
|
2407
|
+
$( "input[name='" + input.attr( "name" ) + "'][type='" + inputtype + "']" ).checkboxradio( "refresh" );
|
2408
|
+
},
|
2409
|
+
|
2410
|
+
focus: function() {
|
2411
|
+
label.addClass( "ui-focus" );
|
2412
|
+
},
|
2413
|
+
|
2414
|
+
blur: function() {
|
2415
|
+
label.removeClass( "ui-focus" );
|
2416
|
+
}
|
2417
|
+
});
|
2418
|
+
|
2419
|
+
this.refresh();
|
2420
|
+
|
2421
|
+
},
|
2422
|
+
|
2423
|
+
refresh: function( ){
|
2424
|
+
var input = this.element,
|
2425
|
+
label = $("label[for='" + input.attr( "id" ) + "']"),
|
2426
|
+
inputtype = input.attr( "type" ),
|
2427
|
+
icon = label.find( ".ui-icon" ),
|
2428
|
+
checkedicon = "ui-icon-" + inputtype + "-on",
|
2429
|
+
uncheckedicon = "ui-icon-" + inputtype + "-off";
|
2430
|
+
|
2431
|
+
if ( input[0].checked ) {
|
2432
|
+
label.addClass( "ui-btn-active" );
|
2433
|
+
icon.addClass( checkedicon );
|
2434
|
+
icon.removeClass( uncheckedicon );
|
2435
|
+
|
2436
|
+
} else {
|
2437
|
+
label.removeClass( "ui-btn-active" );
|
2438
|
+
icon.removeClass( checkedicon );
|
2439
|
+
icon.addClass( uncheckedicon );
|
2440
|
+
}
|
2441
|
+
|
2442
|
+
if( input.is( ":disabled" ) ){
|
2443
|
+
this.disable();
|
2444
|
+
}
|
2445
|
+
else {
|
2446
|
+
this.enable();
|
2447
|
+
}
|
2448
|
+
},
|
2449
|
+
|
2450
|
+
disable: function(){
|
2451
|
+
this.element.attr("disabled",true).parent().addClass("ui-disabled");
|
2452
|
+
},
|
2453
|
+
|
2454
|
+
enable: function(){
|
2455
|
+
this.element.attr("disabled",false).parent().removeClass("ui-disabled");
|
2456
|
+
}
|
2457
|
+
});
|
2458
|
+
})( jQuery );
|
2459
|
+
|
2460
|
+
|
2461
|
+
/*
|
2462
|
+
* jQuery Mobile Framework : "textinput" plugin for text inputs, textareas
|
2463
|
+
* Copyright (c) jQuery Project
|
2464
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
2465
|
+
* http://jquery.org/license
|
2466
|
+
*/
|
2467
|
+
(function($, undefined ) {
|
2468
|
+
$.widget( "mobile.textinput", $.mobile.widget, {
|
2469
|
+
options: {
|
2470
|
+
theme: null
|
2471
|
+
},
|
2472
|
+
_create: function(){
|
2473
|
+
var input = this.element,
|
2474
|
+
o = this.options,
|
2475
|
+
theme = o.theme,
|
2476
|
+
themeclass;
|
2477
|
+
|
2478
|
+
if ( !theme ) {
|
2479
|
+
var themedParent = this.element.closest("[class*='ui-bar-'],[class*='ui-body-']");
|
2480
|
+
theme = themedParent.length ?
|
2481
|
+
/ui-(bar|body)-([a-z])/.exec( themedParent.attr("class") )[2] :
|
2482
|
+
"c";
|
2483
|
+
}
|
2484
|
+
|
2485
|
+
themeclass = " ui-body-" + theme;
|
2486
|
+
|
2487
|
+
$('label[for='+input.attr('id')+']').addClass('ui-input-text');
|
2488
|
+
|
2489
|
+
input.addClass('ui-input-text ui-body-'+ o.theme);
|
2490
|
+
|
2491
|
+
var focusedEl = input;
|
2492
|
+
|
2493
|
+
//"search" input widget
|
2494
|
+
if( input.is('[type="search"],[data-type="search"]') ){
|
2495
|
+
focusedEl = input.wrap('<div class="ui-input-search ui-shadow-inset ui-btn-corner-all ui-btn-shadow ui-icon-search'+ themeclass +'"></div>').parent();
|
2496
|
+
var clearbtn = $('<a href="#" class="ui-input-clear" title="clear text">clear text</a>')
|
2497
|
+
.click(function(){
|
2498
|
+
input.val('').focus();
|
2499
|
+
input.trigger('change');
|
2500
|
+
clearbtn.addClass('ui-input-clear-hidden');
|
2501
|
+
return false;
|
2502
|
+
})
|
2503
|
+
.appendTo(focusedEl)
|
2504
|
+
.buttonMarkup({icon: 'delete', iconpos: 'notext', corners:true, shadow:true});
|
2505
|
+
|
2506
|
+
function toggleClear(){
|
2507
|
+
if(input.val() == ''){
|
2508
|
+
clearbtn.addClass('ui-input-clear-hidden');
|
2509
|
+
}
|
2510
|
+
else{
|
2511
|
+
clearbtn.removeClass('ui-input-clear-hidden');
|
2512
|
+
}
|
2513
|
+
}
|
2514
|
+
|
2515
|
+
toggleClear();
|
2516
|
+
input.keyup(toggleClear);
|
2517
|
+
}
|
2518
|
+
else{
|
2519
|
+
input.addClass('ui-corner-all ui-shadow-inset' + themeclass);
|
2520
|
+
}
|
2521
|
+
|
2522
|
+
input
|
2523
|
+
.focus(function(){
|
2524
|
+
focusedEl.addClass('ui-focus');
|
2525
|
+
})
|
2526
|
+
.blur(function(){
|
2527
|
+
focusedEl.removeClass('ui-focus');
|
2528
|
+
});
|
2529
|
+
|
2530
|
+
//autogrow
|
2531
|
+
if ( input.is('textarea') ) {
|
2532
|
+
var extraLineHeight = 15,
|
2533
|
+
keyupTimeoutBuffer = 100,
|
2534
|
+
keyup = function() {
|
2535
|
+
var scrollHeight = input[0].scrollHeight,
|
2536
|
+
clientHeight = input[0].clientHeight;
|
2537
|
+
if ( clientHeight < scrollHeight ) {
|
2538
|
+
input.css({ height: (scrollHeight + extraLineHeight) });
|
2539
|
+
}
|
2540
|
+
},
|
2541
|
+
keyupTimeout;
|
2542
|
+
input.keyup(function() {
|
2543
|
+
clearTimeout( keyupTimeout );
|
2544
|
+
keyupTimeout = setTimeout( keyup, keyupTimeoutBuffer );
|
2545
|
+
});
|
2546
|
+
}
|
2547
|
+
},
|
2548
|
+
|
2549
|
+
disable: function(){
|
2550
|
+
( this.element.attr("disabled",true).is('[type="search"],[data-type="search"]') ? this.element.parent() : this.element ).addClass("ui-disabled");
|
2551
|
+
},
|
2552
|
+
|
2553
|
+
enable: function(){
|
2554
|
+
( this.element.attr("disabled", false).is('[type="search"],[data-type="search"]') ? this.element.parent() : this.element ).removeClass("ui-disabled");
|
2555
|
+
}
|
2556
|
+
});
|
2557
|
+
})( jQuery );
|
2558
|
+
|
2559
|
+
|
2560
|
+
/*
|
2561
|
+
* jQuery Mobile Framework : "selectmenu" plugin
|
2562
|
+
* Copyright (c) jQuery Project
|
2563
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
2564
|
+
* http://jquery.org/license
|
2565
|
+
*/
|
2566
|
+
(function($, undefined ) {
|
2567
|
+
$.widget( "mobile.selectmenu", $.mobile.widget, {
|
2568
|
+
options: {
|
2569
|
+
theme: null,
|
2570
|
+
disabled: false,
|
2571
|
+
icon: 'arrow-d',
|
2572
|
+
iconpos: 'right',
|
2573
|
+
inline: null,
|
2574
|
+
corners: true,
|
2575
|
+
shadow: true,
|
2576
|
+
iconshadow: true,
|
2577
|
+
menuPageTheme: 'b',
|
2578
|
+
overlayTheme: 'a'
|
2579
|
+
},
|
2580
|
+
_create: function(){
|
2581
|
+
|
2582
|
+
var self = this,
|
2583
|
+
|
2584
|
+
o = this.options,
|
2585
|
+
|
2586
|
+
select = this.element
|
2587
|
+
.attr( "tabindex", "-1" )
|
2588
|
+
.wrap( "<div class='ui-select'>" ),
|
2589
|
+
|
2590
|
+
selectID = select.attr( "id" ),
|
2591
|
+
|
2592
|
+
label = $( "label[for="+ selectID +"]" ).addClass( "ui-select" ),
|
2593
|
+
|
2594
|
+
buttonId = selectID + "-button",
|
2595
|
+
|
2596
|
+
menuId = selectID + "-menu",
|
2597
|
+
|
2598
|
+
thisPage = select.closest( ".ui-page" ),
|
2599
|
+
|
2600
|
+
button = $( "<a>", {
|
2601
|
+
"href": "#",
|
2602
|
+
"role": "button",
|
2603
|
+
"id": buttonId,
|
2604
|
+
"aria-haspopup": "true",
|
2605
|
+
"aria-owns": menuId
|
2606
|
+
})
|
2607
|
+
.text( $( select[0].options.item(select[0].selectedIndex) ).text() )
|
2608
|
+
.insertBefore( select )
|
2609
|
+
.buttonMarkup({
|
2610
|
+
theme: o.theme,
|
2611
|
+
icon: o.icon,
|
2612
|
+
iconpos: o.iconpos,
|
2613
|
+
inline: o.inline,
|
2614
|
+
corners: o.corners,
|
2615
|
+
shadow: o.shadow,
|
2616
|
+
iconshadow: o.iconshadow
|
2617
|
+
}),
|
2618
|
+
|
2619
|
+
theme = /ui-btn-up-([a-z])/.exec( button.attr("class") )[1],
|
2620
|
+
|
2621
|
+
menuPage = $( "<div data-role='dialog' data-theme='"+ o.menuPageTheme +"'>" +
|
2622
|
+
"<div data-role='header'>" +
|
2623
|
+
"<div class='ui-title'>" + label.text() + "</div>"+
|
2624
|
+
"</div>"+
|
2625
|
+
"<div data-role='content'></div>"+
|
2626
|
+
"</div>" )
|
2627
|
+
.appendTo( $.mobile.pageContainer )
|
2628
|
+
.page(),
|
2629
|
+
|
2630
|
+
menuPageContent = menuPage.find( ".ui-content" ),
|
2631
|
+
|
2632
|
+
screen = $( "<div>", {"class": "ui-selectmenu-screen ui-screen-hidden"})
|
2633
|
+
.appendTo( thisPage ),
|
2634
|
+
|
2635
|
+
listbox = $( "<div>", { "class": "ui-selectmenu ui-selectmenu-hidden ui-overlay-shadow ui-corner-all pop ui-body-" + o.overlayTheme } )
|
2636
|
+
.insertAfter(screen),
|
2637
|
+
|
2638
|
+
list = $( "<ul>", {
|
2639
|
+
"class": "ui-selectmenu-list",
|
2640
|
+
"id": menuId,
|
2641
|
+
"role": "listbox",
|
2642
|
+
"aria-labelledby": buttonId,
|
2643
|
+
"data-theme": theme
|
2644
|
+
})
|
2645
|
+
.appendTo( listbox ),
|
2646
|
+
|
2647
|
+
menuType;
|
2648
|
+
|
2649
|
+
//expose to other methods
|
2650
|
+
$.extend(self, {
|
2651
|
+
select: select,
|
2652
|
+
selectID: selectID,
|
2653
|
+
label: label,
|
2654
|
+
buttonId:buttonId,
|
2655
|
+
menuId:menuId,
|
2656
|
+
thisPage:thisPage,
|
2657
|
+
button:button,
|
2658
|
+
menuPage:menuPage,
|
2659
|
+
menuPageContent:menuPageContent,
|
2660
|
+
screen:screen,
|
2661
|
+
listbox:listbox,
|
2662
|
+
list:list,
|
2663
|
+
menuType:menuType
|
2664
|
+
});
|
2665
|
+
|
2666
|
+
|
2667
|
+
//create list from select, update state
|
2668
|
+
self.refresh();
|
2669
|
+
|
2670
|
+
//disable if specified
|
2671
|
+
if( this.options.disabled ){ this.disable(); }
|
2672
|
+
|
2673
|
+
//events on native select
|
2674
|
+
select
|
2675
|
+
.change(function(){
|
2676
|
+
self.refresh();
|
2677
|
+
})
|
2678
|
+
.focus(function(){
|
2679
|
+
$(this).blur();
|
2680
|
+
button.focus();
|
2681
|
+
});
|
2682
|
+
|
2683
|
+
//button events
|
2684
|
+
button.bind( $.support.touch ? "touchstart" : "click", function(event){
|
2685
|
+
self.open();
|
2686
|
+
return false;
|
2687
|
+
});
|
2688
|
+
|
2689
|
+
//events for list items
|
2690
|
+
list.delegate("li",'click', function(){
|
2691
|
+
//update select
|
2692
|
+
var newIndex = list.find( "li" ).index( this ),
|
2693
|
+
prevIndex = select[0].selectedIndex;
|
2694
|
+
|
2695
|
+
select[0].selectedIndex = newIndex;
|
2696
|
+
|
2697
|
+
//trigger change event
|
2698
|
+
if(newIndex !== prevIndex){
|
2699
|
+
select.trigger( "change" );
|
2700
|
+
}
|
2701
|
+
|
2702
|
+
self.refresh();
|
2703
|
+
|
2704
|
+
//hide custom select
|
2705
|
+
self.close();
|
2706
|
+
return false;
|
2707
|
+
});
|
2708
|
+
|
2709
|
+
//events on "screen" overlay
|
2710
|
+
screen.click(function(){
|
2711
|
+
self.close();
|
2712
|
+
return false;
|
2713
|
+
});
|
2714
|
+
},
|
2715
|
+
|
2716
|
+
_buildList: function(){
|
2717
|
+
var self = this;
|
2718
|
+
|
2719
|
+
self.list.empty().filter('.ui-listview').listview('destroy');
|
2720
|
+
|
2721
|
+
//populate menu with options from select element
|
2722
|
+
self.select.find( "option" ).each(function( i ){
|
2723
|
+
var anchor = $("<a>", {
|
2724
|
+
"role": "option",
|
2725
|
+
"href": "#"
|
2726
|
+
})
|
2727
|
+
.text( $(this).text() );
|
2728
|
+
|
2729
|
+
$( "<li>", {"data-icon": "checkbox-on"})
|
2730
|
+
.append( anchor )
|
2731
|
+
.appendTo( self.list );
|
2732
|
+
});
|
2733
|
+
|
2734
|
+
//now populated, create listview
|
2735
|
+
self.list.listview();
|
2736
|
+
},
|
2737
|
+
|
2738
|
+
refresh: function( forceRebuild ){
|
2739
|
+
var self = this,
|
2740
|
+
select = this.element,
|
2741
|
+
selected = select[0].selectedIndex;
|
2742
|
+
|
2743
|
+
if( forceRebuild || select[0].options.length > self.list.find('li').length ){
|
2744
|
+
self._buildList();
|
2745
|
+
}
|
2746
|
+
|
2747
|
+
self.button.find( ".ui-btn-text" ).text( $(select[0].options.item(selected)).text() );
|
2748
|
+
self.list
|
2749
|
+
.find('li').removeClass( $.mobile.activeBtnClass ).attr('aria-selected', false)
|
2750
|
+
.eq(selected).addClass( $.mobile.activeBtnClass ).find('a').attr('aria-selected', true);
|
2751
|
+
},
|
2752
|
+
|
2753
|
+
open: function(){
|
2754
|
+
if( this.options.disabled ){ return; }
|
2755
|
+
|
2756
|
+
var self = this,
|
2757
|
+
menuHeight = self.list.outerHeight(),
|
2758
|
+
menuWidth = self.list.outerWidth(),
|
2759
|
+
scrollTop = $(window).scrollTop(),
|
2760
|
+
btnOffset = self.button.offset().top,
|
2761
|
+
screenHeight = window.innerHeight,
|
2762
|
+
screenWidth = window.innerWidth;
|
2763
|
+
|
2764
|
+
//add active class to button
|
2765
|
+
self.button.addClass( $.mobile.activeBtnClass );
|
2766
|
+
|
2767
|
+
function focusMenuItem(){
|
2768
|
+
self.list.find( ".ui-btn-active" ).focus();
|
2769
|
+
}
|
2770
|
+
|
2771
|
+
if( menuHeight > screenHeight - 80 || !$.support.scrollTop ){
|
2772
|
+
|
2773
|
+
//for webos (set lastscroll using button offset)
|
2774
|
+
if( scrollTop == 0 && btnOffset > screenHeight ){
|
2775
|
+
self.thisPage.one('pagehide',function(){
|
2776
|
+
$(this).data('lastScroll', btnOffset);
|
2777
|
+
});
|
2778
|
+
}
|
2779
|
+
|
2780
|
+
self.menuPage.one('pageshow',focusMenuItem);
|
2781
|
+
|
2782
|
+
self.menuType = "page";
|
2783
|
+
self.menuPageContent.append( self.list );
|
2784
|
+
$.mobile.changePage(self.menuPage, 'pop', false, false);
|
2785
|
+
}
|
2786
|
+
else {
|
2787
|
+
self.menuType = "overlay";
|
2788
|
+
|
2789
|
+
self.screen
|
2790
|
+
.height( $(document).height() )
|
2791
|
+
.removeClass('ui-screen-hidden');
|
2792
|
+
|
2793
|
+
self.listbox
|
2794
|
+
.append( self.list )
|
2795
|
+
.removeClass( "ui-selectmenu-hidden" )
|
2796
|
+
.position({
|
2797
|
+
my: "center center",
|
2798
|
+
at: "center center",
|
2799
|
+
of: self.button,
|
2800
|
+
collision: "fit"
|
2801
|
+
})
|
2802
|
+
.addClass("in");
|
2803
|
+
|
2804
|
+
focusMenuItem();
|
2805
|
+
}
|
2806
|
+
},
|
2807
|
+
|
2808
|
+
close: function(){
|
2809
|
+
if( this.options.disabled ){ return; }
|
2810
|
+
var self = this;
|
2811
|
+
|
2812
|
+
function focusButton(){
|
2813
|
+
setTimeout(function(){
|
2814
|
+
self.button.focus();
|
2815
|
+
//remove active class from button
|
2816
|
+
self.button.removeClass( $.mobile.activeBtnClass );
|
2817
|
+
}, 40);
|
2818
|
+
|
2819
|
+
self.listbox.removeAttr('style').append( self.list );
|
2820
|
+
}
|
2821
|
+
|
2822
|
+
if(self.menuType == "page"){
|
2823
|
+
$.mobile.changePage([self.menuPage,self.thisPage], 'pop', true, false);
|
2824
|
+
self.menuPage.one("pagehide",function(){
|
2825
|
+
focusButton();
|
2826
|
+
//return false;
|
2827
|
+
});
|
2828
|
+
}
|
2829
|
+
else{
|
2830
|
+
self.screen.addClass( "ui-screen-hidden" );
|
2831
|
+
self.listbox.addClass( "ui-selectmenu-hidden" ).removeAttr( "style" ).removeClass("in");
|
2832
|
+
focusButton();
|
2833
|
+
}
|
2834
|
+
|
2835
|
+
},
|
2836
|
+
|
2837
|
+
disable: function(){
|
2838
|
+
this.element.attr("disabled",true);
|
2839
|
+
this.button.addClass('ui-disabled').attr("aria-disabled", true);
|
2840
|
+
return this._setOption( "disabled", true );
|
2841
|
+
},
|
2842
|
+
|
2843
|
+
enable: function(){
|
2844
|
+
this.element.attr("disabled",false);
|
2845
|
+
this.button.removeClass('ui-disabled').attr("aria-disabled", false);
|
2846
|
+
return this._setOption( "disabled", false );
|
2847
|
+
}
|
2848
|
+
});
|
2849
|
+
})( jQuery );
|
2850
|
+
|
2851
|
+
|
2852
|
+
|
2853
|
+
/*
|
2854
|
+
* jQuery Mobile Framework : plugin for making button-like links
|
2855
|
+
* Copyright (c) jQuery Project
|
2856
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
2857
|
+
* http://jquery.org/license
|
2858
|
+
*/
|
2859
|
+
(function($, undefined ) {
|
2860
|
+
|
2861
|
+
$.fn.buttonMarkup = function( options ){
|
2862
|
+
return this.each( function() {
|
2863
|
+
var el = $( this ),
|
2864
|
+
o = $.extend( {}, $.fn.buttonMarkup.defaults, el.data(), options),
|
2865
|
+
|
2866
|
+
// Classes Defined
|
2867
|
+
buttonClass,
|
2868
|
+
innerClass = "ui-btn-inner",
|
2869
|
+
iconClass;
|
2870
|
+
|
2871
|
+
if ( attachEvents ) {
|
2872
|
+
attachEvents();
|
2873
|
+
}
|
2874
|
+
|
2875
|
+
// if not, try to find closest theme container
|
2876
|
+
if ( !o.theme ) {
|
2877
|
+
var themedParent = el.closest("[class*='ui-bar-'],[class*='ui-body-']");
|
2878
|
+
o.theme = themedParent.length ?
|
2879
|
+
/ui-(bar|body)-([a-z])/.exec( themedParent.attr("class") )[2] :
|
2880
|
+
"c";
|
2881
|
+
}
|
2882
|
+
|
2883
|
+
buttonClass = "ui-btn ui-btn-up-" + o.theme;
|
2884
|
+
|
2885
|
+
if ( o.inline ) {
|
2886
|
+
buttonClass += " ui-btn-inline";
|
2887
|
+
}
|
2888
|
+
|
2889
|
+
if ( o.icon ) {
|
2890
|
+
o.icon = "ui-icon-" + o.icon;
|
2891
|
+
o.iconpos = o.iconpos || "left";
|
2892
|
+
|
2893
|
+
iconClass = "ui-icon " + o.icon;
|
2894
|
+
|
2895
|
+
if ( o.shadow ) {
|
2896
|
+
iconClass += " ui-icon-shadow"
|
2897
|
+
}
|
2898
|
+
}
|
2899
|
+
|
2900
|
+
if ( o.iconpos ) {
|
2901
|
+
buttonClass += " ui-btn-icon-" + o.iconpos;
|
2902
|
+
|
2903
|
+
if ( o.iconpos == "notext" && !el.attr("title") ) {
|
2904
|
+
el.attr( "title", el.text() );
|
2905
|
+
}
|
2906
|
+
}
|
2907
|
+
|
2908
|
+
if ( o.corners ) {
|
2909
|
+
buttonClass += " ui-btn-corner-all";
|
2910
|
+
innerClass += " ui-btn-corner-all";
|
2911
|
+
}
|
2912
|
+
|
2913
|
+
if ( o.shadow ) {
|
2914
|
+
buttonClass += " ui-shadow";
|
2915
|
+
}
|
2916
|
+
|
2917
|
+
el
|
2918
|
+
.attr( "data-theme", o.theme )
|
2919
|
+
.addClass( buttonClass );
|
2920
|
+
|
2921
|
+
var wrap = ("<D class='" + innerClass + "'><D class='ui-btn-text'></D>" +
|
2922
|
+
( o.icon ? "<span class='" + iconClass + "'></span>" : "" ) +
|
2923
|
+
"</D>").replace(/D/g, o.wrapperEls);
|
2924
|
+
|
2925
|
+
el.wrapInner( wrap );
|
2926
|
+
});
|
2927
|
+
};
|
2928
|
+
|
2929
|
+
$.fn.buttonMarkup.defaults = {
|
2930
|
+
corners: true,
|
2931
|
+
shadow: true,
|
2932
|
+
iconshadow: true,
|
2933
|
+
wrapperEls: "span"
|
2934
|
+
};
|
2935
|
+
|
2936
|
+
var attachEvents = function() {
|
2937
|
+
$(".ui-btn").live({
|
2938
|
+
mousedown: function() {
|
2939
|
+
var theme = $(this).attr( "data-theme" );
|
2940
|
+
$(this).removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme );
|
2941
|
+
},
|
2942
|
+
mouseup: function() {
|
2943
|
+
var theme = $(this).attr( "data-theme" );
|
2944
|
+
$(this).removeClass( "ui-btn-down-" + theme ).addClass( "ui-btn-up-" + theme );
|
2945
|
+
},
|
2946
|
+
"mouseover focus": function() {
|
2947
|
+
var theme = $(this).attr( "data-theme" );
|
2948
|
+
$(this).removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-hover-" + theme );
|
2949
|
+
},
|
2950
|
+
"mouseout blur": function() {
|
2951
|
+
var theme = $(this).attr( "data-theme" );
|
2952
|
+
$(this).removeClass( "ui-btn-hover-" + theme ).addClass( "ui-btn-up-" + theme );
|
2953
|
+
}
|
2954
|
+
});
|
2955
|
+
|
2956
|
+
attachEvents = null;
|
2957
|
+
};
|
2958
|
+
|
2959
|
+
})(jQuery);
|
2960
|
+
|
2961
|
+
|
2962
|
+
/*
|
2963
|
+
* jQuery Mobile Framework : "button" plugin - links that proxy to native input/buttons
|
2964
|
+
* Copyright (c) jQuery Project
|
2965
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
2966
|
+
* http://jquery.org/license
|
2967
|
+
*/
|
2968
|
+
(function($, undefined ) {
|
2969
|
+
$.widget( "mobile.button", $.mobile.widget, {
|
2970
|
+
options: {
|
2971
|
+
theme: null,
|
2972
|
+
icon: null,
|
2973
|
+
iconpos: null,
|
2974
|
+
inline: null,
|
2975
|
+
corners: true,
|
2976
|
+
shadow: true,
|
2977
|
+
iconshadow: true
|
2978
|
+
},
|
2979
|
+
_create: function(){
|
2980
|
+
var $el = this.element,
|
2981
|
+
o = this.options,
|
2982
|
+
type = $el.attr('type');
|
2983
|
+
$el
|
2984
|
+
.addClass('ui-btn-hidden')
|
2985
|
+
.attr('tabindex','-1');
|
2986
|
+
|
2987
|
+
//add ARIA role
|
2988
|
+
this.button = $( "<a>", {
|
2989
|
+
"href": "#",
|
2990
|
+
"role": "button",
|
2991
|
+
"aria-label": $el.attr( "type" )
|
2992
|
+
} )
|
2993
|
+
.text( $el.text() || $el.val() )
|
2994
|
+
.insertBefore( $el )
|
2995
|
+
.click(function(){
|
2996
|
+
if(!o.disabled){
|
2997
|
+
if( type == "submit" ){
|
2998
|
+
$(this).closest('form').submit();
|
2999
|
+
}
|
3000
|
+
else{
|
3001
|
+
$el.click();
|
3002
|
+
}
|
3003
|
+
}
|
3004
|
+
|
3005
|
+
return false;
|
3006
|
+
})
|
3007
|
+
.buttonMarkup({
|
3008
|
+
theme: o.theme,
|
3009
|
+
icon: o.icon,
|
3010
|
+
iconpos: o.iconpos,
|
3011
|
+
inline: o.inline,
|
3012
|
+
corners: o.corners,
|
3013
|
+
shadow: o.shadow,
|
3014
|
+
iconshadow: o.iconshadow
|
3015
|
+
});
|
3016
|
+
},
|
3017
|
+
|
3018
|
+
enable: function(){
|
3019
|
+
this.element.attr("disabled", false);
|
3020
|
+
this.button.removeClass("ui-disabled").attr("aria-disabled", false);
|
3021
|
+
return this._setOption("disabled", false);
|
3022
|
+
},
|
3023
|
+
|
3024
|
+
disable: function(){
|
3025
|
+
this.element.attr("disabled", true);
|
3026
|
+
this.button.addClass("ui-disabled").attr("aria-disabled", true);
|
3027
|
+
return this._setOption("disabled", true);
|
3028
|
+
}
|
3029
|
+
});
|
3030
|
+
})( jQuery );
|
3031
|
+
|
3032
|
+
/*
|
3033
|
+
* jQuery Mobile Framework : "slider" plugin
|
3034
|
+
* Copyright (c) jQuery Project
|
3035
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3036
|
+
* http://jquery.org/license
|
3037
|
+
*/
|
3038
|
+
(function($, undefined ) {
|
3039
|
+
$.widget( "mobile.slider", $.mobile.widget, {
|
3040
|
+
options: {
|
3041
|
+
theme: null,
|
3042
|
+
trackTheme: null,
|
3043
|
+
disabled: false
|
3044
|
+
},
|
3045
|
+
_create: function(){
|
3046
|
+
var self = this,
|
3047
|
+
|
3048
|
+
control = this.element,
|
3049
|
+
|
3050
|
+
parentTheme = control.parents('[class*=ui-bar-],[class*=ui-body-]').eq(0),
|
3051
|
+
|
3052
|
+
parentTheme = parentTheme.length ? parentTheme.attr('class').match(/ui-(bar|body)-([a-z])/)[2] : 'c',
|
3053
|
+
|
3054
|
+
theme = this.options.theme ? this.options.theme : parentTheme,
|
3055
|
+
|
3056
|
+
trackTheme = this.options.trackTheme ? this.options.trackTheme : parentTheme,
|
3057
|
+
|
3058
|
+
cType = control[0].nodeName.toLowerCase(),
|
3059
|
+
selectClass = (cType == 'select') ? 'ui-slider-switch' : '',
|
3060
|
+
controlID = control.attr('id'),
|
3061
|
+
labelID = controlID + '-label',
|
3062
|
+
label = $('[for='+ controlID +']').attr('id',labelID),
|
3063
|
+
val = (cType == 'input') ? parseFloat(control.val()) : control[0].selectedIndex,
|
3064
|
+
min = (cType == 'input') ? parseFloat(control.attr('min')) : 0,
|
3065
|
+
max = (cType == 'input') ? parseFloat(control.attr('max')) : control.find('option').length-1,
|
3066
|
+
slider = $('<div class="ui-slider '+ selectClass +' ui-btn-down-'+ trackTheme+' ui-btn-corner-all" role="application"></div>'),
|
3067
|
+
handle = $('<a href="#" class="ui-slider-handle"></a>')
|
3068
|
+
.appendTo(slider)
|
3069
|
+
.buttonMarkup({corners: true, theme: theme, shadow: true})
|
3070
|
+
.attr({
|
3071
|
+
'role': 'slider',
|
3072
|
+
'aria-valuemin': min,
|
3073
|
+
'aria-valuemax': max,
|
3074
|
+
'aria-valuenow': val,
|
3075
|
+
'aria-valuetext': val,
|
3076
|
+
'title': val,
|
3077
|
+
'aria-labelledby': labelID
|
3078
|
+
});
|
3079
|
+
|
3080
|
+
$.extend(this, {
|
3081
|
+
slider: slider,
|
3082
|
+
handle: handle,
|
3083
|
+
dragging: false,
|
3084
|
+
beforeStart: null
|
3085
|
+
});
|
3086
|
+
|
3087
|
+
if(cType == 'select'){
|
3088
|
+
slider.wrapInner('<div class="ui-slider-inneroffset"></div>');
|
3089
|
+
var options = control.find('option');
|
3090
|
+
|
3091
|
+
control.find('option').each(function(i){
|
3092
|
+
var side = (i==0) ?'b':'a',
|
3093
|
+
corners = (i==0) ? 'right' :'left',
|
3094
|
+
theme = (i==0) ? ' ui-btn-down-' + trackTheme :' ui-btn-active';
|
3095
|
+
$('<div class="ui-slider-labelbg ui-slider-labelbg-'+ side + theme +' ui-btn-corner-'+ corners+'"></div>').prependTo(slider);
|
3096
|
+
$('<span class="ui-slider-label ui-slider-label-'+ side + theme +' ui-btn-corner-'+ corners+'" role="img">'+$(this).text()+'</span>').prependTo(handle);
|
3097
|
+
});
|
3098
|
+
|
3099
|
+
}
|
3100
|
+
|
3101
|
+
label.addClass('ui-slider');
|
3102
|
+
|
3103
|
+
control
|
3104
|
+
.addClass((cType == 'input') ? 'ui-slider-input' : 'ui-slider-switch')
|
3105
|
+
.keyup(function(){
|
3106
|
+
self.refresh( $(this).val() );
|
3107
|
+
});
|
3108
|
+
|
3109
|
+
$(document).bind($.support.touch ? "touchmove" : "mousemove", function(event){
|
3110
|
+
if ( self.dragging ) {
|
3111
|
+
self.refresh( event );
|
3112
|
+
return false;
|
3113
|
+
}
|
3114
|
+
});
|
3115
|
+
|
3116
|
+
slider
|
3117
|
+
.bind($.support.touch ? "touchstart" : "mousedown", function(event){
|
3118
|
+
self.dragging = true;
|
3119
|
+
if ( cType === "select" ) {
|
3120
|
+
self.beforeStart = control[0].selectedIndex;
|
3121
|
+
}
|
3122
|
+
self.refresh( event );
|
3123
|
+
return false;
|
3124
|
+
});
|
3125
|
+
|
3126
|
+
slider
|
3127
|
+
.add(document)
|
3128
|
+
.bind($.support.touch ? "touchend" : "mouseup", function(){
|
3129
|
+
if ( self.dragging ) {
|
3130
|
+
self.dragging = false;
|
3131
|
+
if ( cType === "select" ) {
|
3132
|
+
if ( self.beforeStart === control[0].selectedIndex ) {
|
3133
|
+
//tap occurred, but value didn't change. flip it!
|
3134
|
+
self.refresh( self.beforeStart === 0 ? 1 : 0 );
|
3135
|
+
}
|
3136
|
+
var curval = (cType === "input") ? parseFloat(control.val()) : control[ 0 ].selectedIndex;
|
3137
|
+
var snapped = Math.round( curval / (max - min) * 100 );
|
3138
|
+
handle
|
3139
|
+
.addClass("ui-slider-handle-snapping")
|
3140
|
+
.css("left", snapped + "%")
|
3141
|
+
.animationComplete(function(){
|
3142
|
+
handle.removeClass("ui-slider-handle-snapping");
|
3143
|
+
});
|
3144
|
+
}
|
3145
|
+
return false;
|
3146
|
+
}
|
3147
|
+
});
|
3148
|
+
|
3149
|
+
slider.insertAfter(control);
|
3150
|
+
handle.bind('click', function(e){ return false; });
|
3151
|
+
this.refresh();
|
3152
|
+
},
|
3153
|
+
|
3154
|
+
refresh: function(val){
|
3155
|
+
if ( this.options.disabled ) { return; }
|
3156
|
+
|
3157
|
+
var control = this.element, percent,
|
3158
|
+
cType = control[0].nodeName.toLowerCase(),
|
3159
|
+
min = (cType === "input") ? parseFloat(control.attr("min")) : 0,
|
3160
|
+
max = (cType === "input") ? parseFloat(control.attr("max")) : control.find("option").length - 1;
|
3161
|
+
|
3162
|
+
if ( typeof val === "object" ) {
|
3163
|
+
var data = val.originalEvent.touches ? val.originalEvent.touches[ 0 ] : val,
|
3164
|
+
// a slight tolerance helped get to the ends of the slider
|
3165
|
+
tol = 8;
|
3166
|
+
if ( !this.dragging
|
3167
|
+
|| data.pageX < this.slider.offset().left - tol
|
3168
|
+
|| data.pageX > this.slider.offset().left + this.slider.width() + tol ) {
|
3169
|
+
return;
|
3170
|
+
}
|
3171
|
+
percent = Math.round( ((data.pageX - this.slider.offset().left) / this.slider.width() ) * 100 );
|
3172
|
+
} else {
|
3173
|
+
if ( val == null ) {
|
3174
|
+
val = (cType === "input") ? parseFloat(control.val()) : control[ 0 ].selectedIndex;
|
3175
|
+
}
|
3176
|
+
percent = (parseFloat(val) - min) / (max - min) * 100;
|
3177
|
+
}
|
3178
|
+
|
3179
|
+
if ( isNaN(percent) ) { return; }
|
3180
|
+
if ( percent < 0 ) { percent = 0; }
|
3181
|
+
if ( percent > 100 ) { percent = 100; }
|
3182
|
+
|
3183
|
+
var newval = Math.round( (percent / 100) * (max - min) ) + min;
|
3184
|
+
if ( newval < min ) { newval = min; }
|
3185
|
+
if ( newval > max ) { newval = max; }
|
3186
|
+
|
3187
|
+
//flip the stack of the bg colors
|
3188
|
+
if ( percent > 60 && cType === "select" ) {
|
3189
|
+
|
3190
|
+
}
|
3191
|
+
this.handle.css("left", percent + "%");
|
3192
|
+
this.handle.attr({
|
3193
|
+
"aria-valuenow": (cType === "input") ? newval : control.find("option").eq(newval).attr("value"),
|
3194
|
+
"aria-valuetext": (cType === "input") ? newval : control.find("option").eq(newval).text(),
|
3195
|
+
title: newval
|
3196
|
+
});
|
3197
|
+
|
3198
|
+
// add/remove classes for flip toggle switch
|
3199
|
+
if ( cType === "select" ) {
|
3200
|
+
if ( newval === 0 ) {
|
3201
|
+
this.slider.addClass("ui-slider-switch-a")
|
3202
|
+
.removeClass("ui-slider-switch-b");
|
3203
|
+
} else {
|
3204
|
+
this.slider.addClass("ui-slider-switch-b")
|
3205
|
+
.removeClass("ui-slider-switch-a");
|
3206
|
+
}
|
3207
|
+
}
|
3208
|
+
|
3209
|
+
// update control's value
|
3210
|
+
if ( cType === "input" ) {
|
3211
|
+
control.val(newval);
|
3212
|
+
} else {
|
3213
|
+
control[ 0 ].selectedIndex = newval;
|
3214
|
+
}
|
3215
|
+
control.trigger("change");
|
3216
|
+
},
|
3217
|
+
|
3218
|
+
enable: function(){
|
3219
|
+
this.element.attr("disabled", false);
|
3220
|
+
this.slider.removeClass("ui-disabled").attr("aria-disabled", false);
|
3221
|
+
return this._setOption("disabled", false);
|
3222
|
+
},
|
3223
|
+
|
3224
|
+
disable: function(){
|
3225
|
+
this.element.attr("disabled", true);
|
3226
|
+
this.slider.addClass("ui-disabled").attr("aria-disabled", true);
|
3227
|
+
return this._setOption("disabled", true);
|
3228
|
+
}
|
3229
|
+
});
|
3230
|
+
})( jQuery );
|
3231
|
+
|
3232
|
+
|
3233
|
+
|
3234
|
+
/*
|
3235
|
+
* jQuery Mobile Framework : "collapsible" plugin
|
3236
|
+
* Copyright (c) jQuery Project
|
3237
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3238
|
+
* http://jquery.org/license
|
3239
|
+
*/
|
3240
|
+
(function($, undefined ) {
|
3241
|
+
$.widget( "mobile.collapsible", $.mobile.widget, {
|
3242
|
+
options: {
|
3243
|
+
expandCueText: ' click to expand contents',
|
3244
|
+
collapseCueText: ' click to collapse contents',
|
3245
|
+
collapsed: false,
|
3246
|
+
heading: '>:header,>legend',
|
3247
|
+
theme: null,
|
3248
|
+
iconTheme: 'd'
|
3249
|
+
},
|
3250
|
+
_create: function(){
|
3251
|
+
|
3252
|
+
var $el = this.element,
|
3253
|
+
o = this.options,
|
3254
|
+
collapsibleContain = $el.addClass('ui-collapsible-contain'),
|
3255
|
+
collapsibleHeading = $el.find(o.heading).eq(0),
|
3256
|
+
collapsibleContent = collapsibleContain.wrapInner('<div class="ui-collapsible-content"></div>').find('.ui-collapsible-content'),
|
3257
|
+
collapsibleParent = $el.closest('[data-role="collapsible-set"]').addClass('ui-collapsible-set');
|
3258
|
+
|
3259
|
+
//replace collapsibleHeading if it's a legend
|
3260
|
+
if(collapsibleHeading.is('legend')){
|
3261
|
+
collapsibleHeading = $('<div role="heading">'+ collapsibleHeading.html() +'</div>').insertBefore(collapsibleHeading);
|
3262
|
+
collapsibleHeading.next().remove();
|
3263
|
+
}
|
3264
|
+
|
3265
|
+
//drop heading in before content
|
3266
|
+
collapsibleHeading.insertBefore(collapsibleContent);
|
3267
|
+
|
3268
|
+
//modify markup & attributes
|
3269
|
+
collapsibleHeading.addClass('ui-collapsible-heading')
|
3270
|
+
.append('<span class="ui-collapsible-heading-status"></span>')
|
3271
|
+
.wrapInner('<a href="#" class="ui-collapsible-heading-toggle"></a>')
|
3272
|
+
.find('a:eq(0)')
|
3273
|
+
.buttonMarkup({
|
3274
|
+
shadow: !!!collapsibleParent.length,
|
3275
|
+
corners:false,
|
3276
|
+
iconPos: 'left',
|
3277
|
+
icon: 'plus',
|
3278
|
+
theme: o.theme
|
3279
|
+
})
|
3280
|
+
.find('.ui-icon')
|
3281
|
+
.removeAttr('class')
|
3282
|
+
.buttonMarkup({
|
3283
|
+
shadow: true,
|
3284
|
+
corners:true,
|
3285
|
+
iconPos: 'notext',
|
3286
|
+
icon: 'plus',
|
3287
|
+
theme: o.iconTheme
|
3288
|
+
});
|
3289
|
+
|
3290
|
+
if( !collapsibleParent.length ){
|
3291
|
+
collapsibleHeading
|
3292
|
+
.find('a:eq(0)')
|
3293
|
+
.addClass('ui-corner-all')
|
3294
|
+
.find('.ui-btn-inner')
|
3295
|
+
.addClass('ui-corner-all');
|
3296
|
+
}
|
3297
|
+
else {
|
3298
|
+
if( collapsibleContain.data('collapsible-last') ){
|
3299
|
+
collapsibleHeading
|
3300
|
+
.find('a:eq(0), .ui-btn-inner')
|
3301
|
+
.addClass('ui-corner-bottom');
|
3302
|
+
}
|
3303
|
+
}
|
3304
|
+
|
3305
|
+
|
3306
|
+
//events
|
3307
|
+
collapsibleContain
|
3308
|
+
.bind('collapse', function(event){
|
3309
|
+
if( !event.isDefaultPrevented() ){
|
3310
|
+
event.preventDefault();
|
3311
|
+
collapsibleHeading
|
3312
|
+
.addClass('ui-collapsible-heading-collapsed')
|
3313
|
+
.find('.ui-collapsible-heading-status').text(o.expandCueText);
|
3314
|
+
|
3315
|
+
collapsibleHeading.find('.ui-icon').removeClass('ui-icon-minus').addClass('ui-icon-plus');
|
3316
|
+
collapsibleContent.addClass('ui-collapsible-content-collapsed').attr('aria-hidden',true);
|
3317
|
+
|
3318
|
+
if( collapsibleContain.data('collapsible-last') ){
|
3319
|
+
collapsibleHeading
|
3320
|
+
.find('a:eq(0), .ui-btn-inner')
|
3321
|
+
.addClass('ui-corner-bottom');
|
3322
|
+
}
|
3323
|
+
}
|
3324
|
+
|
3325
|
+
})
|
3326
|
+
.bind('expand', function(event){
|
3327
|
+
if( !event.isDefaultPrevented() ){
|
3328
|
+
event.preventDefault();
|
3329
|
+
collapsibleHeading
|
3330
|
+
.removeClass('ui-collapsible-heading-collapsed')
|
3331
|
+
.find('.ui-collapsible-heading-status').text(o.collapseCueText);
|
3332
|
+
|
3333
|
+
collapsibleHeading.find('.ui-icon').removeClass('ui-icon-plus').addClass('ui-icon-minus');
|
3334
|
+
collapsibleContent.removeClass('ui-collapsible-content-collapsed').attr('aria-hidden',false);
|
3335
|
+
|
3336
|
+
if( collapsibleContain.data('collapsible-last') ){
|
3337
|
+
collapsibleHeading
|
3338
|
+
.find('a:eq(0), .ui-btn-inner')
|
3339
|
+
.removeClass('ui-corner-bottom');
|
3340
|
+
}
|
3341
|
+
|
3342
|
+
}
|
3343
|
+
})
|
3344
|
+
.trigger(o.collapsed ? 'collapse' : 'expand');
|
3345
|
+
|
3346
|
+
|
3347
|
+
//close others in a set
|
3348
|
+
if( collapsibleParent.length && !collapsibleParent.data("collapsiblebound") ){
|
3349
|
+
collapsibleParent
|
3350
|
+
.data("collapsiblebound", true)
|
3351
|
+
.bind("expand", function( event ){
|
3352
|
+
$(this).find( ".ui-collapsible-contain" )
|
3353
|
+
.not( $(event.target).closest( ".ui-collapsible-contain" ) )
|
3354
|
+
.not( "> .ui-collapsible-contain .ui-collapsible-contain" )
|
3355
|
+
.trigger( "collapse" );
|
3356
|
+
})
|
3357
|
+
var set = collapsibleParent.find('[data-role=collapsible]')
|
3358
|
+
|
3359
|
+
set.first()
|
3360
|
+
.find('a:eq(0)')
|
3361
|
+
.addClass('ui-corner-top')
|
3362
|
+
.find('.ui-btn-inner')
|
3363
|
+
.addClass('ui-corner-top');
|
3364
|
+
|
3365
|
+
set.last().data('collapsible-last', true)
|
3366
|
+
}
|
3367
|
+
|
3368
|
+
collapsibleHeading.bind( $.support.touch ? "touchstart" : "click", function(){
|
3369
|
+
if( collapsibleHeading.is('.ui-collapsible-heading-collapsed') ){
|
3370
|
+
collapsibleContain.trigger('expand');
|
3371
|
+
}
|
3372
|
+
else {
|
3373
|
+
collapsibleContain.trigger('collapse');
|
3374
|
+
}
|
3375
|
+
return false;
|
3376
|
+
});
|
3377
|
+
|
3378
|
+
}
|
3379
|
+
});
|
3380
|
+
})( jQuery );
|
3381
|
+
|
3382
|
+
/*
|
3383
|
+
* jQuery Mobile Framework: "controlgroup" plugin - corner-rounding for groups of buttons, checks, radios, etc
|
3384
|
+
* Copyright (c) jQuery Project
|
3385
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3386
|
+
* http://jquery.org/license
|
3387
|
+
*/
|
3388
|
+
(function($, undefined ) {
|
3389
|
+
$.fn.controlgroup = function(options){
|
3390
|
+
|
3391
|
+
return $(this).each(function(){
|
3392
|
+
var o = $.extend({
|
3393
|
+
direction: $( this ).data( "type" ) || "vertical",
|
3394
|
+
shadow: false
|
3395
|
+
},options);
|
3396
|
+
var groupheading = $(this).find('>legend'),
|
3397
|
+
flCorners = o.direction == 'horizontal' ? ['ui-corner-left', 'ui-corner-right'] : ['ui-corner-top', 'ui-corner-bottom'],
|
3398
|
+
type = $(this).find('input:eq(0)').attr('type');
|
3399
|
+
|
3400
|
+
//replace legend with more stylable replacement div
|
3401
|
+
if( groupheading.length ){
|
3402
|
+
$(this).wrapInner('<div class="ui-controlgroup-controls"></div>');
|
3403
|
+
$('<div role="heading" class="ui-controlgroup-label">'+ groupheading.html() +'</div>').insertBefore( $(this).children(0) );
|
3404
|
+
groupheading.remove();
|
3405
|
+
}
|
3406
|
+
|
3407
|
+
$(this).addClass('ui-corner-all ui-controlgroup ui-controlgroup-'+o.direction);
|
3408
|
+
|
3409
|
+
function flipClasses(els){
|
3410
|
+
els
|
3411
|
+
.removeClass('ui-btn-corner-all ui-shadow')
|
3412
|
+
.eq(0).addClass(flCorners[0])
|
3413
|
+
.end()
|
3414
|
+
.filter(':last').addClass(flCorners[1]).addClass('ui-controlgroup-last');
|
3415
|
+
}
|
3416
|
+
flipClasses($(this).find('.ui-btn'));
|
3417
|
+
flipClasses($(this).find('.ui-btn-inner'));
|
3418
|
+
if(o.shadow){
|
3419
|
+
$(this).addClass('ui-shadow');
|
3420
|
+
}
|
3421
|
+
});
|
3422
|
+
};
|
3423
|
+
})(jQuery);
|
3424
|
+
|
3425
|
+
/*
|
3426
|
+
* jQuery Mobile Framework : "fieldcontain" plugin - simple class additions to make form row separators
|
3427
|
+
* Copyright (c) jQuery Project
|
3428
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3429
|
+
* http://jquery.org/license
|
3430
|
+
*/
|
3431
|
+
(function($, undefined ) {
|
3432
|
+
$.fn.fieldcontain = function(options){
|
3433
|
+
return $(this).addClass('ui-field-contain ui-body ui-br');
|
3434
|
+
};
|
3435
|
+
})(jQuery);
|
3436
|
+
|
3437
|
+
/*
|
3438
|
+
* jQuery Mobile Framework : "listview" plugin
|
3439
|
+
* Copyright (c) jQuery Project
|
3440
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3441
|
+
* http://jquery.org/license
|
3442
|
+
*/
|
3443
|
+
(function($, undefined ) {
|
3444
|
+
|
3445
|
+
$.widget( "mobile.listview", $.mobile.widget, {
|
3446
|
+
options: {
|
3447
|
+
theme: "c",
|
3448
|
+
countTheme: "c",
|
3449
|
+
headerTheme: "b",
|
3450
|
+
dividerTheme: "b",
|
3451
|
+
splitIcon: "arrow-r",
|
3452
|
+
splitTheme: "b",
|
3453
|
+
inset: false
|
3454
|
+
},
|
3455
|
+
|
3456
|
+
_create: function() {
|
3457
|
+
var $list = this.element,
|
3458
|
+
o = this.options;
|
3459
|
+
|
3460
|
+
// create listview markup
|
3461
|
+
$list
|
3462
|
+
.addClass( "ui-listview" )
|
3463
|
+
.attr( "role", "listbox" )
|
3464
|
+
|
3465
|
+
if ( o.inset ) {
|
3466
|
+
$list.addClass( "ui-listview-inset ui-corner-all ui-shadow" );
|
3467
|
+
}
|
3468
|
+
|
3469
|
+
$list.delegate( ".ui-li", "focusin", function() {
|
3470
|
+
$( this ).attr( "tabindex", "0" );
|
3471
|
+
});
|
3472
|
+
|
3473
|
+
this._itemApply( $list, $list );
|
3474
|
+
|
3475
|
+
this.refresh( true );
|
3476
|
+
|
3477
|
+
//keyboard events for menu items
|
3478
|
+
$list.keydown(function( e ) {
|
3479
|
+
var target = $( e.target ),
|
3480
|
+
li = target.closest( "li" );
|
3481
|
+
|
3482
|
+
// switch logic based on which key was pressed
|
3483
|
+
switch ( e.keyCode ) {
|
3484
|
+
// up or left arrow keys
|
3485
|
+
case 38:
|
3486
|
+
var prev = li.prev();
|
3487
|
+
|
3488
|
+
// if there's a previous option, focus it
|
3489
|
+
if ( prev.length ) {
|
3490
|
+
target
|
3491
|
+
.blur()
|
3492
|
+
.attr( "tabindex", "-1" );
|
3493
|
+
|
3494
|
+
prev.find( "a" ).first().focus();
|
3495
|
+
}
|
3496
|
+
|
3497
|
+
return false;
|
3498
|
+
break;
|
3499
|
+
|
3500
|
+
// down or right arrow keys
|
3501
|
+
case 40:
|
3502
|
+
var next = li.next();
|
3503
|
+
|
3504
|
+
// if there's a next option, focus it
|
3505
|
+
if ( next.length ) {
|
3506
|
+
target
|
3507
|
+
.blur()
|
3508
|
+
.attr( "tabindex", "-1" );
|
3509
|
+
|
3510
|
+
next.find( "a" ).first().focus();
|
3511
|
+
}
|
3512
|
+
|
3513
|
+
return false;
|
3514
|
+
break;
|
3515
|
+
|
3516
|
+
case 39:
|
3517
|
+
var a = li.find( "a.ui-li-link-alt" );
|
3518
|
+
|
3519
|
+
if ( a.length ) {
|
3520
|
+
target.blur();
|
3521
|
+
a.first().focus();
|
3522
|
+
}
|
3523
|
+
|
3524
|
+
return false;
|
3525
|
+
break;
|
3526
|
+
|
3527
|
+
case 37:
|
3528
|
+
var a = li.find( "a.ui-link-inherit" );
|
3529
|
+
|
3530
|
+
if ( a.length ) {
|
3531
|
+
target.blur();
|
3532
|
+
a.first().focus();
|
3533
|
+
}
|
3534
|
+
|
3535
|
+
return false;
|
3536
|
+
break;
|
3537
|
+
|
3538
|
+
// if enter or space is pressed, trigger click
|
3539
|
+
case 13:
|
3540
|
+
case 32:
|
3541
|
+
target.trigger( "click" );
|
3542
|
+
|
3543
|
+
return false;
|
3544
|
+
break;
|
3545
|
+
}
|
3546
|
+
});
|
3547
|
+
|
3548
|
+
// tapping the whole LI triggers click on the first link
|
3549
|
+
$list.delegate( "li", "click", function(event) {
|
3550
|
+
if ( !$( event.target ).closest( "a" ).length ) {
|
3551
|
+
$( this ).find( "a" ).first().trigger( "click" );
|
3552
|
+
return false;
|
3553
|
+
}
|
3554
|
+
});
|
3555
|
+
},
|
3556
|
+
|
3557
|
+
_itemApply: function( $list, item ) {
|
3558
|
+
// TODO class has to be defined in markup
|
3559
|
+
item.find( ".ui-li-count" )
|
3560
|
+
.addClass( "ui-btn-up-" + ($list.data( "counttheme" ) || this.options.countTheme) + " ui-btn-corner-all" );
|
3561
|
+
|
3562
|
+
item.find( "h1, h2, h3, h4, h5, h6" ).addClass( "ui-li-heading" );
|
3563
|
+
|
3564
|
+
item.find( "p, dl" ).addClass( "ui-li-desc" );
|
3565
|
+
|
3566
|
+
item.find( "img" ).addClass( "ui-li-thumb" ).each(function() {
|
3567
|
+
$( this ).closest( "li" )
|
3568
|
+
.addClass( $(this).is( ".ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" );
|
3569
|
+
});
|
3570
|
+
|
3571
|
+
var aside = item.find( ".ui-li-aside" );
|
3572
|
+
|
3573
|
+
if ( aside.length ) {
|
3574
|
+
aside.each(function(i, el) {
|
3575
|
+
$(el).prependTo( $(el).parent() ); //shift aside to front for css float
|
3576
|
+
});
|
3577
|
+
}
|
3578
|
+
|
3579
|
+
if ( $.support.cssPseudoElement || !$.nodeName( item[0], "ol" ) ) {
|
3580
|
+
return;
|
3581
|
+
}
|
3582
|
+
},
|
3583
|
+
|
3584
|
+
_removeCorners: function(li){
|
3585
|
+
li
|
3586
|
+
.add( li.find(".ui-btn-inner, .ui-li-link-alt, .ui-li-thumb") )
|
3587
|
+
.removeClass( "ui-corner-top ui-corner-bottom ui-corner-br ui-corner-bl ui-corner-tr ui-corner-tl" );
|
3588
|
+
},
|
3589
|
+
|
3590
|
+
refresh: function( create ) {
|
3591
|
+
this._createSubPages();
|
3592
|
+
|
3593
|
+
var o = this.options,
|
3594
|
+
$list = this.element,
|
3595
|
+
self = this,
|
3596
|
+
dividertheme = $list.data( "dividertheme" ) || o.dividerTheme,
|
3597
|
+
li = $list.children( "li" ),
|
3598
|
+
counter = $.support.cssPseudoElement || !$.nodeName( $list[0], "ol" ) ? 0 : 1;
|
3599
|
+
|
3600
|
+
if ( counter ) {
|
3601
|
+
$list.find( ".ui-li-dec" ).remove();
|
3602
|
+
}
|
3603
|
+
|
3604
|
+
li.attr({ "role": "option", "tabindex": "-1" });
|
3605
|
+
|
3606
|
+
li.first().attr( "tabindex", "0" );
|
3607
|
+
|
3608
|
+
li.each(function( pos ) {
|
3609
|
+
var item = $( this ),
|
3610
|
+
itemClass = "ui-li";
|
3611
|
+
|
3612
|
+
// If we're creating the element, we update it regardless
|
3613
|
+
if ( !create && item.hasClass( "ui-li" ) ) {
|
3614
|
+
return;
|
3615
|
+
}
|
3616
|
+
|
3617
|
+
var a = item.find( "a" );
|
3618
|
+
|
3619
|
+
if ( a.length ) {
|
3620
|
+
item
|
3621
|
+
.buttonMarkup({
|
3622
|
+
wrapperEls: "div",
|
3623
|
+
shadow: false,
|
3624
|
+
corners: false,
|
3625
|
+
iconpos: "right",
|
3626
|
+
icon: a.length > 1 ? false : item.data("icon") || "arrow-r",
|
3627
|
+
theme: o.theme
|
3628
|
+
});
|
3629
|
+
|
3630
|
+
a.first().addClass( "ui-link-inherit" );
|
3631
|
+
|
3632
|
+
if ( a.length > 1 ) {
|
3633
|
+
itemClass += " ui-li-has-alt";
|
3634
|
+
|
3635
|
+
var last = a.last(),
|
3636
|
+
splittheme = $list.data( "splittheme" ) || last.data( "theme" ) || o.splitTheme;
|
3637
|
+
|
3638
|
+
last
|
3639
|
+
.attr( "title", last.text() )
|
3640
|
+
.addClass( "ui-li-link-alt" )
|
3641
|
+
.empty()
|
3642
|
+
.buttonMarkup({
|
3643
|
+
shadow: false,
|
3644
|
+
corners: false,
|
3645
|
+
theme: o.theme,
|
3646
|
+
icon: false,
|
3647
|
+
iconpos: false
|
3648
|
+
})
|
3649
|
+
.find( ".ui-btn-inner" )
|
3650
|
+
.append( $( "<span>" ).buttonMarkup({
|
3651
|
+
shadow: true,
|
3652
|
+
corners: true,
|
3653
|
+
theme: splittheme,
|
3654
|
+
iconpos: "notext",
|
3655
|
+
icon: $list.data( "spliticon" ) || last.data( "icon" ) || o.splitIcon
|
3656
|
+
} ) );
|
3657
|
+
}
|
3658
|
+
|
3659
|
+
} else if ( item.data( "role" ) === "list-divider" ) {
|
3660
|
+
itemClass += " ui-li-divider ui-btn ui-bar-" + dividertheme;
|
3661
|
+
item.attr( "role", "heading" );
|
3662
|
+
|
3663
|
+
//reset counter when a divider heading is encountered
|
3664
|
+
if ( counter ) {
|
3665
|
+
counter = 1;
|
3666
|
+
}
|
3667
|
+
|
3668
|
+
} else {
|
3669
|
+
itemClass += " ui-li-static ui-btn-up-" + o.theme;
|
3670
|
+
}
|
3671
|
+
|
3672
|
+
|
3673
|
+
if( o.inset ){
|
3674
|
+
if ( pos === 0 ) {
|
3675
|
+
itemClass += " ui-corner-top";
|
3676
|
+
|
3677
|
+
item
|
3678
|
+
.add( item.find( ".ui-btn-inner" ) )
|
3679
|
+
.find( ".ui-li-link-alt" )
|
3680
|
+
.addClass( "ui-corner-tr" )
|
3681
|
+
.end()
|
3682
|
+
.find( ".ui-li-thumb" )
|
3683
|
+
.addClass( "ui-corner-tl" );
|
3684
|
+
|
3685
|
+
self._removeCorners( item.next() );
|
3686
|
+
|
3687
|
+
} else if ( pos === li.length - 1 ) {
|
3688
|
+
itemClass += " ui-corner-bottom";
|
3689
|
+
|
3690
|
+
item
|
3691
|
+
.add( item.find( ".ui-btn-inner" ) )
|
3692
|
+
.find( ".ui-li-link-alt" )
|
3693
|
+
.addClass( "ui-corner-br" )
|
3694
|
+
.end()
|
3695
|
+
.find( ".ui-li-thumb" )
|
3696
|
+
.addClass( "ui-corner-bl" );
|
3697
|
+
|
3698
|
+
self._removeCorners( item.prev() );
|
3699
|
+
}
|
3700
|
+
}
|
3701
|
+
|
3702
|
+
|
3703
|
+
if ( counter && itemClass.indexOf( "ui-li-divider" ) < 0 ) {
|
3704
|
+
item
|
3705
|
+
.find( ".ui-link-inherit" ).first()
|
3706
|
+
.addClass( "ui-li-jsnumbering" )
|
3707
|
+
.prepend( "<span class='ui-li-dec'>" + (counter++) + ". </span>" );
|
3708
|
+
}
|
3709
|
+
|
3710
|
+
item.addClass( itemClass );
|
3711
|
+
|
3712
|
+
if ( !create ) {
|
3713
|
+
self._itemApply( $list, item );
|
3714
|
+
}
|
3715
|
+
});
|
3716
|
+
},
|
3717
|
+
|
3718
|
+
//create a string for ID/subpage url creation
|
3719
|
+
_idStringEscape: function( str ){
|
3720
|
+
return str.replace(/[^a-zA-Z0-9]/g, '-');
|
3721
|
+
},
|
3722
|
+
|
3723
|
+
_createSubPages: function() {
|
3724
|
+
var parentList = this.element,
|
3725
|
+
parentPage = parentList.closest( ".ui-page" ),
|
3726
|
+
parentId = parentPage.attr( "id" ),
|
3727
|
+
o = this.options,
|
3728
|
+
self = this,
|
3729
|
+
persistentFooterID = parentPage.find( "[data-role='footer']" ).data( "id" );
|
3730
|
+
|
3731
|
+
$( parentList.find( "ul, ol" ).toArray().reverse() ).each(function( i ) {
|
3732
|
+
var list = $( this ),
|
3733
|
+
parent = list.parent(),
|
3734
|
+
title = parent.contents()[ 0 ].nodeValue.split("\n")[0],
|
3735
|
+
id = parentId + "&" + $.mobile.subPageUrlKey + "=" + self._idStringEscape(title + " " + i),
|
3736
|
+
theme = list.data( "theme" ) || o.theme,
|
3737
|
+
countTheme = list.data( "counttheme" ) || parentList.data( "counttheme" ) || o.countTheme,
|
3738
|
+
newPage = list.wrap( "<div data-role='page'><div data-role='content'></div></div>" )
|
3739
|
+
.parent()
|
3740
|
+
.before( "<div data-role='header' data-theme='" + o.headerTheme + "'><div class='ui-title'>" + title + "</div></div>" )
|
3741
|
+
.after( persistentFooterID ? $( "<div>", { "data-role": "footer", "data-id": persistentFooterID, "class": "ui-footer-duplicate" } ) : "" )
|
3742
|
+
.parent()
|
3743
|
+
.attr({
|
3744
|
+
id: id,
|
3745
|
+
"data-theme": theme,
|
3746
|
+
"data-count-theme": countTheme
|
3747
|
+
})
|
3748
|
+
.appendTo( $.mobile.pageContainer );
|
3749
|
+
|
3750
|
+
|
3751
|
+
|
3752
|
+
newPage.page();
|
3753
|
+
|
3754
|
+
parent.html( "<a href='#" + id + "'>" + title + "</a>" );
|
3755
|
+
}).listview();
|
3756
|
+
}
|
3757
|
+
});
|
3758
|
+
|
3759
|
+
})( jQuery );
|
3760
|
+
|
3761
|
+
|
3762
|
+
/*
|
3763
|
+
* jQuery Mobile Framework : "listview" filter extension
|
3764
|
+
* Copyright (c) jQuery Project
|
3765
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3766
|
+
* http://jquery.org/license
|
3767
|
+
*/
|
3768
|
+
(function($, undefined ) {
|
3769
|
+
|
3770
|
+
$.mobile.listview.prototype.options.filter = false;
|
3771
|
+
|
3772
|
+
$( "[data-role='listview']" ).live( "listviewcreate", function() {
|
3773
|
+
var list = $( this ),
|
3774
|
+
listview = list.data( "listview" );
|
3775
|
+
if ( !listview.options.filter ) {
|
3776
|
+
return;
|
3777
|
+
}
|
3778
|
+
|
3779
|
+
var wrapper = $( "<form>", { "class": "ui-listview-filter ui-bar-c", "role": "search" } ),
|
3780
|
+
|
3781
|
+
search = $( "<input>", {
|
3782
|
+
placeholder: "Filter results...",
|
3783
|
+
"data-type": "search"
|
3784
|
+
})
|
3785
|
+
.bind( "keyup change", function() {
|
3786
|
+
var val = this.value.toLowerCase();;
|
3787
|
+
list.children().show();
|
3788
|
+
if ( val ) {
|
3789
|
+
list.children().filter(function() {
|
3790
|
+
return $( this ).text().toLowerCase().indexOf( val ) === -1;
|
3791
|
+
}).hide();
|
3792
|
+
}
|
3793
|
+
|
3794
|
+
//listview._numberItems();
|
3795
|
+
})
|
3796
|
+
.appendTo( wrapper )
|
3797
|
+
.textinput();
|
3798
|
+
|
3799
|
+
wrapper.insertBefore( list );
|
3800
|
+
});
|
3801
|
+
|
3802
|
+
})( jQuery );
|
3803
|
+
|
3804
|
+
|
3805
|
+
/*
|
3806
|
+
* jQuery Mobile Framework : "dialog" plugin.
|
3807
|
+
* Copyright (c) jQuery Project
|
3808
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
|
3809
|
+
* Note: Code is in draft form and is subject to change
|
3810
|
+
*/
|
3811
|
+
(function($, undefined ) {
|
3812
|
+
$.widget( "mobile.dialog", $.mobile.widget, {
|
3813
|
+
options: {},
|
3814
|
+
_create: function(){
|
3815
|
+
var self = this,
|
3816
|
+
$el = self.element,
|
3817
|
+
$prevPage = $.mobile.activePage,
|
3818
|
+
$closeBtn = $('<a href="#" data-icon="delete" data-iconpos="notext">Close</a>');
|
3819
|
+
|
3820
|
+
$el.delegate("a, form", "click submit", function(e){
|
3821
|
+
if( e.type == "click" && ( $(e.target).closest('[data-back]')[0] || this==$closeBtn[0] ) ){
|
3822
|
+
self.close();
|
3823
|
+
return false;
|
3824
|
+
}
|
3825
|
+
//otherwise, assume we're headed somewhere new. set activepage to dialog so the transition will work
|
3826
|
+
$.mobile.activePage = self.element;
|
3827
|
+
});
|
3828
|
+
|
3829
|
+
this.element
|
3830
|
+
.bind("pageshow",function(){
|
3831
|
+
return false;
|
3832
|
+
})
|
3833
|
+
//add ARIA role
|
3834
|
+
.attr("role","dialog")
|
3835
|
+
.addClass('ui-page ui-dialog ui-body-a')
|
3836
|
+
.find('[data-role=header]')
|
3837
|
+
.addClass('ui-corner-top ui-overlay-shadow')
|
3838
|
+
.prepend( $closeBtn )
|
3839
|
+
.end()
|
3840
|
+
.find('.ui-content:not([class*="ui-body-"])')
|
3841
|
+
.addClass('ui-body-c')
|
3842
|
+
.end()
|
3843
|
+
.find('.ui-content,[data-role=footer]')
|
3844
|
+
.last()
|
3845
|
+
.addClass('ui-corner-bottom ui-overlay-shadow');
|
3846
|
+
|
3847
|
+
$(window).bind('hashchange',function(){
|
3848
|
+
if( $el.is('.ui-page-active') ){
|
3849
|
+
self.close();
|
3850
|
+
$el.bind('pagehide',function(){
|
3851
|
+
$.mobile.updateHash( $prevPage.attr('id'), true);
|
3852
|
+
});
|
3853
|
+
}
|
3854
|
+
});
|
3855
|
+
|
3856
|
+
},
|
3857
|
+
|
3858
|
+
close: function(){
|
3859
|
+
$.mobile.changePage([this.element, $.mobile.activePage], undefined, true, true );
|
3860
|
+
}
|
3861
|
+
});
|
3862
|
+
})( jQuery );
|
3863
|
+
|
3864
|
+
/*
|
3865
|
+
* jQuery Mobile Framework : "navbar" plugin
|
3866
|
+
* Copyright (c) jQuery Project
|
3867
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3868
|
+
* http://jquery.org/license
|
3869
|
+
*/
|
3870
|
+
(function($, undefined ) {
|
3871
|
+
$.widget( "mobile.navbar", $.mobile.widget, {
|
3872
|
+
options: {
|
3873
|
+
iconpos: 'top',
|
3874
|
+
grid: null
|
3875
|
+
},
|
3876
|
+
_create: function(){
|
3877
|
+
var $navbar = this.element,
|
3878
|
+
$navbtns = $navbar.find("a"),
|
3879
|
+
iconpos = $navbtns.filter('[data-icon]').length ? this.options.iconpos : undefined;
|
3880
|
+
|
3881
|
+
$navbar
|
3882
|
+
.addClass('ui-navbar')
|
3883
|
+
.attr("role","navigation")
|
3884
|
+
.find("ul")
|
3885
|
+
.grid({grid: this.options.grid });
|
3886
|
+
|
3887
|
+
if( !iconpos ){
|
3888
|
+
$navbar.addClass("ui-navbar-noicons");
|
3889
|
+
}
|
3890
|
+
|
3891
|
+
$navbtns
|
3892
|
+
.buttonMarkup({
|
3893
|
+
corners: false,
|
3894
|
+
shadow: false,
|
3895
|
+
iconpos: iconpos
|
3896
|
+
});
|
3897
|
+
|
3898
|
+
$navbar.delegate("a", "click",function(event){
|
3899
|
+
$navbtns.removeClass("ui-btn-active");
|
3900
|
+
});
|
3901
|
+
}
|
3902
|
+
});
|
3903
|
+
})( jQuery );
|
3904
|
+
|
3905
|
+
/*
|
3906
|
+
* jQuery Mobile Framework : plugin for creating CSS grids
|
3907
|
+
* Copyright (c) jQuery Project
|
3908
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
3909
|
+
* http://jquery.org/license
|
3910
|
+
*/
|
3911
|
+
(function($, undefined ) {
|
3912
|
+
$.fn.grid = function(options){
|
3913
|
+
return $(this).each(function(){
|
3914
|
+
var o = $.extend({
|
3915
|
+
grid: null
|
3916
|
+
},options);
|
3917
|
+
|
3918
|
+
|
3919
|
+
var $kids = $(this).children(),
|
3920
|
+
gridCols = {a: 2, b:3, c:4, d:5},
|
3921
|
+
grid = o.grid,
|
3922
|
+
iterator;
|
3923
|
+
|
3924
|
+
if( !grid ){
|
3925
|
+
if( $kids.length <= 5 ){
|
3926
|
+
for(var letter in gridCols){
|
3927
|
+
if(gridCols[letter] == $kids.length){ grid = letter; }
|
3928
|
+
}
|
3929
|
+
}
|
3930
|
+
else{
|
3931
|
+
grid = 'a';
|
3932
|
+
}
|
3933
|
+
}
|
3934
|
+
iterator = gridCols[grid];
|
3935
|
+
|
3936
|
+
$(this).addClass('ui-grid-' + grid);
|
3937
|
+
|
3938
|
+
$kids.filter(':nth-child(' + iterator + 'n+1)').addClass('ui-block-a');
|
3939
|
+
$kids.filter(':nth-child(' + iterator + 'n+2)').addClass('ui-block-b');
|
3940
|
+
|
3941
|
+
if(iterator > 2){
|
3942
|
+
$kids.filter(':nth-child(3n+3)').addClass('ui-block-c');
|
3943
|
+
}
|
3944
|
+
if(iterator> 3){
|
3945
|
+
$kids.filter(':nth-child(4n+4)').addClass('ui-block-d');
|
3946
|
+
}
|
3947
|
+
if(iterator > 4){
|
3948
|
+
$kids.filter(':nth-child(5n+5)').addClass('ui-block-e');
|
3949
|
+
}
|
3950
|
+
|
3951
|
+
});
|
3952
|
+
};
|
3953
|
+
})(jQuery);
|
3954
|
+
|
3955
|
+
|
3956
|
+
|
3957
|
+
//quick & dirty theme switcher, written to potentially work as a bookmarklet
|
3958
|
+
(function($){
|
3959
|
+
$.themeswitcher = function(){
|
3960
|
+
var
|
3961
|
+
themesDir = '/stylesheets/compiled/jquery/mobile/',
|
3962
|
+
//themesDir = 'http://jquerymobile.com/test/themes/',themesDir = 'http://jquerymobile.com/test/themes/',
|
3963
|
+
themes = ['default','valencia'],
|
3964
|
+
currentPage = $.mobile.activePage,
|
3965
|
+
menuPage = $(
|
3966
|
+
'<div data-role=\'dialog\' data-theme=\'a\'>' +
|
3967
|
+
'<div data-role=\'header\' data-theme=\'b\'>' +
|
3968
|
+
'<div class=\'ui-title\'>Switch Theme:</div>'+
|
3969
|
+
'</div>'+
|
3970
|
+
'<div data-role=\'content\' data-theme=\'c\'><ul data-role=\'listview\' data-inset=\'true\'></ul></div>'+
|
3971
|
+
'</div>' )
|
3972
|
+
.appendTo( $.mobile.pageContainer ),
|
3973
|
+
menu = menuPage.find('ul');
|
3974
|
+
|
3975
|
+
//menu items
|
3976
|
+
$.each(themes, function( i ){
|
3977
|
+
$('<li><a href=\'#\'>' + themes[ i ].charAt(0).toUpperCase() + themes[ i ].substr(1) + '</a></li>')
|
3978
|
+
.click(function(){
|
3979
|
+
addTheme( themes[i] );
|
3980
|
+
})
|
3981
|
+
.appendTo(menu);
|
3982
|
+
});
|
3983
|
+
|
3984
|
+
//remover, adder
|
3985
|
+
function addTheme(theme){
|
3986
|
+
$('head').append( '<link rel=\'stylesheet\' href=\''+ themesDir + theme +'.css\' />' );
|
3987
|
+
}
|
3988
|
+
|
3989
|
+
//create page, listview
|
3990
|
+
menuPage.page();
|
3991
|
+
|
3992
|
+
//change page now
|
3993
|
+
$.mobile.changePage([currentPage, menuPage], 'pop', false);
|
3994
|
+
};
|
3995
|
+
})(jQuery);
|