compass-jquery-plugin 0.3.2.6 → 0.3.2.7.nil
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -1
- data/VERSION.yml +2 -2
- data/lib/handle_js_files.rb +21 -2
- data/templates/dynatree/jquery.dynatree.js +23 -20
- data/templates/dynatree/jquery.dynatree.min.js +38 -38
- data/templates/dynatree/jquery/dynatree/aero.scss +1 -1
- data/templates/dynatree/jquery/dynatree/aqua.scss +1 -1
- data/templates/dynatree/jquery/dynatree/crystal.scss +1 -1
- data/templates/dynatree/jquery/dynatree/xp.scss +2 -2
- data/templates/ical/jquery/ical.scss +10 -10
- data/templates/jqgrid/i18n/jqgrid/locale-lt.js +134 -0
- data/templates/jqgrid/i18n/jqgrid/locale-lt.min.js +7 -0
- data/templates/jqgrid/jquery.jqGrid.js +155 -65
- data/templates/jqgrid/jquery.jqGrid.min.js +396 -393
- data/templates/jqgrid/manifest.rb +2 -0
- data/templates/jqtouch/jquery.jqtouch.js +166 -195
- data/templates/jqtouch/jquery.jqtouch.min.js +1 -1
- 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 +12 -7
- data/templates/jqtouch/jquery/touch/jqtouch.scss +11 -13
- data/templates/jquery/history.adapter.jquery.js +54 -67
- data/templates/jquery/history.adapter.jquery.min.js +2 -2
- data/templates/jquery/history.html4.js +587 -680
- data/templates/jquery/history.html4.min.js +8 -18
- data/templates/jquery/history.js +1670 -1289
- data/templates/jquery/history.min.js +25 -21
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-tj.js +23 -0
- data/templates/jquery/i18n/jquery.ui/datepicker-tj.min.js +2 -0
- data/templates/jquery/jquery-ui.js +97 -61
- data/templates/jquery/jquery-ui.min.js +175 -175
- data/templates/jquery/jquery.dst.js +86 -151
- data/templates/jquery/jquery/ui/_theme.scss +13 -13
- data/templates/jquery/json2.js +214 -214
- data/templates/jquery/manifest.rb +2 -0
- data/templates/mobile/jquery.mobile.js +324 -225
- data/templates/mobile/jquery.mobile.min.js +4 -4
- data/templates/mobile/jquery/mobile/_base.scss +60 -48
- data/templates/mobile/jquery/mobile/default.scss +57 -80
- 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 +61 -73
- 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/manifest.rb +0 -8
- data/templates/ribbon/jquery/ribbon/office.scss +12 -12
- data/templates/ribbon/jquery/ribbon/windows7.scss +12 -12
- data/templates/tiny_mce/manifest.rb +16 -0
- data/templates/tiny_mce/tiny_mce/jquery.tinymce.js +1 -1
- data/templates/tiny_mce/tiny_mce/langs/de.js +1 -0
- data/templates/tiny_mce/tiny_mce/langs/en.js +1 -222
- data/templates/tiny_mce/tiny_mce/plugins/advhr/css/advhr.css +1 -5
- data/templates/tiny_mce/tiny_mce/plugins/advhr/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advhr/editor_plugin_src.js +1 -57
- data/templates/tiny_mce/tiny_mce/plugins/advhr/js/rule.js +1 -43
- data/templates/tiny_mce/tiny_mce/plugins/advhr/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/advhr/langs/en_dlg.js +1 -7
- data/templates/tiny_mce/tiny_mce/plugins/advhr/rule.htm +1 -58
- data/templates/tiny_mce/tiny_mce/plugins/advimage/css/advimage.css +1 -13
- data/templates/tiny_mce/tiny_mce/plugins/advimage/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advimage/editor_plugin_src.js +1 -50
- data/templates/tiny_mce/tiny_mce/plugins/advimage/image.htm +1 -235
- data/templates/tiny_mce/tiny_mce/plugins/advimage/js/image.js +1 -445
- data/templates/tiny_mce/tiny_mce/plugins/advimage/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/advimage/langs/en_dlg.js +1 -45
- data/templates/tiny_mce/tiny_mce/plugins/advlink/css/advlink.css +1 -8
- data/templates/tiny_mce/tiny_mce/plugins/advlink/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advlink/editor_plugin_src.js +1 -61
- data/templates/tiny_mce/tiny_mce/plugins/advlink/js/advlink.js +1 -525
- data/templates/tiny_mce/tiny_mce/plugins/advlink/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/advlink/langs/en_dlg.js +1 -54
- data/templates/tiny_mce/tiny_mce/plugins/advlink/link.htm +1 -338
- data/templates/tiny_mce/tiny_mce/plugins/advlist/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/advlist/editor_plugin_src.js +1 -154
- data/templates/tiny_mce/tiny_mce/plugins/autoresize/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/autoresize/editor_plugin_src.js +1 -119
- data/templates/tiny_mce/tiny_mce/plugins/autosave/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/autosave/editor_plugin_src.js +1 -431
- data/templates/tiny_mce/tiny_mce/plugins/autosave/langs/en.js +1 -4
- data/templates/tiny_mce/tiny_mce/plugins/bbcode/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/bbcode/editor_plugin_src.js +1 -120
- data/templates/tiny_mce/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/contextmenu/editor_plugin_src.js +1 -154
- data/templates/tiny_mce/tiny_mce/plugins/directionality/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/directionality/editor_plugin_src.js +1 -82
- data/templates/tiny_mce/tiny_mce/plugins/emotions/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/emotions/editor_plugin_src.js +1 -43
- data/templates/tiny_mce/tiny_mce/plugins/emotions/emotions.htm +1 -41
- data/templates/tiny_mce/tiny_mce/plugins/emotions/js/emotions.js +1 -22
- data/templates/tiny_mce/tiny_mce/plugins/emotions/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/emotions/langs/en_dlg.js +1 -20
- data/templates/tiny_mce/tiny_mce/plugins/example/dialog.htm +1 -22
- data/templates/tiny_mce/tiny_mce/plugins/example/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/example/editor_plugin_src.js +1 -84
- data/templates/tiny_mce/tiny_mce/plugins/example/js/dialog.js +1 -19
- data/templates/tiny_mce/tiny_mce/plugins/example/langs/en.js +1 -3
- data/templates/tiny_mce/tiny_mce/plugins/example/langs/en_dlg.js +1 -3
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/css/fullpage.css +1 -182
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/editor_plugin_src.js +1 -166
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/fullpage.htm +1 -571
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/js/fullpage.js +1 -492
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/fullpage/langs/en_dlg.js +1 -85
- data/templates/tiny_mce/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/fullscreen/editor_plugin_src.js +1 -159
- data/templates/tiny_mce/tiny_mce/plugins/fullscreen/fullscreen.htm +1 -109
- data/templates/tiny_mce/tiny_mce/plugins/iespell/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/iespell/editor_plugin_src.js +1 -54
- data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +1 -696
- data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +1 -90
- data/templates/tiny_mce/tiny_mce/plugins/inlinepopups/template.htm +1 -387
- data/templates/tiny_mce/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +1 -83
- data/templates/tiny_mce/tiny_mce/plugins/layer/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/layer/editor_plugin_src.js +1 -214
- data/templates/tiny_mce/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +1 -139
- data/templates/tiny_mce/tiny_mce/plugins/media/css/media.css +1 -17
- data/templates/tiny_mce/tiny_mce/plugins/media/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/media/editor_plugin_src.js +1 -770
- data/templates/tiny_mce/tiny_mce/plugins/media/js/embed.js +1 -73
- data/templates/tiny_mce/tiny_mce/plugins/media/js/media.js +1 -340
- data/templates/tiny_mce/tiny_mce/plugins/media/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/media/langs/en_dlg.js +1 -109
- data/templates/tiny_mce/tiny_mce/plugins/media/media.htm +1 -812
- data/templates/tiny_mce/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +1 -53
- data/templates/tiny_mce/tiny_mce/plugins/noneditable/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/noneditable/editor_plugin_src.js +1 -90
- data/templates/tiny_mce/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/pagebreak/editor_plugin_src.js +1 -74
- data/templates/tiny_mce/tiny_mce/plugins/paste/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/paste/editor_plugin_src.js +1 -899
- data/templates/tiny_mce/tiny_mce/plugins/paste/js/pastetext.js +1 -36
- data/templates/tiny_mce/tiny_mce/plugins/paste/js/pasteword.js +1 -51
- data/templates/tiny_mce/tiny_mce/plugins/paste/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/paste/langs/en_dlg.js +1 -5
- data/templates/tiny_mce/tiny_mce/plugins/paste/pastetext.htm +1 -27
- data/templates/tiny_mce/tiny_mce/plugins/paste/pasteword.htm +1 -21
- data/templates/tiny_mce/tiny_mce/plugins/preview/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/preview/editor_plugin_src.js +1 -53
- data/templates/tiny_mce/tiny_mce/plugins/preview/example.html +17 -16
- data/templates/tiny_mce/tiny_mce/plugins/preview/jscripts/embed.js +1 -73
- data/templates/tiny_mce/tiny_mce/plugins/preview/preview.html +10 -9
- data/templates/tiny_mce/tiny_mce/plugins/print/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/print/editor_plugin_src.js +1 -34
- data/templates/tiny_mce/tiny_mce/plugins/save/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/save/editor_plugin_src.js +1 -101
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/css/searchreplace.css +1 -6
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/editor_plugin_src.js +1 -61
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/js/searchreplace.js +1 -140
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/langs/en_dlg.js +1 -16
- data/templates/tiny_mce/tiny_mce/plugins/searchreplace/searchreplace.htm +1 -100
- data/templates/tiny_mce/tiny_mce/plugins/spellchecker/css/content.css +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/spellchecker/editor_plugin_src.js +1 -415
- data/templates/tiny_mce/tiny_mce/plugins/style/css/props.css +1 -13
- data/templates/tiny_mce/tiny_mce/plugins/style/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/style/editor_plugin_src.js +1 -55
- data/templates/tiny_mce/tiny_mce/plugins/style/js/props.js +1 -635
- data/templates/tiny_mce/tiny_mce/plugins/style/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/style/langs/en_dlg.js +1 -70
- data/templates/tiny_mce/tiny_mce/plugins/style/props.htm +1 -838
- data/templates/tiny_mce/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/tabfocus/editor_plugin_src.js +1 -114
- data/templates/tiny_mce/tiny_mce/plugins/table/cell.htm +1 -178
- data/templates/tiny_mce/tiny_mce/plugins/table/css/cell.css +1 -17
- data/templates/tiny_mce/tiny_mce/plugins/table/css/row.css +1 -25
- data/templates/tiny_mce/tiny_mce/plugins/table/css/table.css +1 -13
- data/templates/tiny_mce/tiny_mce/plugins/table/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/table/editor_plugin_src.js +1 -1183
- data/templates/tiny_mce/tiny_mce/plugins/table/js/cell.js +1 -284
- data/templates/tiny_mce/tiny_mce/plugins/table/js/merge_cells.js +1 -27
- data/templates/tiny_mce/tiny_mce/plugins/table/js/row.js +1 -232
- data/templates/tiny_mce/tiny_mce/plugins/table/js/table.js +1 -450
- data/templates/tiny_mce/tiny_mce/plugins/table/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/table/langs/en_dlg.js +1 -74
- data/templates/tiny_mce/tiny_mce/plugins/table/merge_cells.htm +1 -32
- data/templates/tiny_mce/tiny_mce/plugins/table/row.htm +1 -157
- data/templates/tiny_mce/tiny_mce/plugins/table/table.htm +1 -188
- data/templates/tiny_mce/tiny_mce/plugins/template/blank.htm +1 -12
- data/templates/tiny_mce/tiny_mce/plugins/template/css/template.css +1 -23
- data/templates/tiny_mce/tiny_mce/plugins/template/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/template/editor_plugin_src.js +1 -159
- data/templates/tiny_mce/tiny_mce/plugins/template/js/template.js +1 -106
- data/templates/tiny_mce/tiny_mce/plugins/template/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/template/langs/en_dlg.js +1 -15
- data/templates/tiny_mce/tiny_mce/plugins/template/template.htm +1 -31
- data/templates/tiny_mce/tiny_mce/plugins/visualchars/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/visualchars/editor_plugin_src.js +1 -83
- data/templates/tiny_mce/tiny_mce/plugins/wordcount/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/wordcount/editor_plugin_src.js +1 -114
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/abbr.htm +1 -142
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/acronym.htm +1 -142
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/attributes.htm +1 -149
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/cite.htm +1 -142
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/css/attributes.css +1 -11
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/css/popup.css +1 -9
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/del.htm +1 -162
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -1
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +1 -132
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/ins.htm +1 -162
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/abbr.js +1 -28
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/acronym.js +1 -28
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/attributes.js +1 -125
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/cite.js +1 -28
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/del.js +1 -53
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/element_common.js +1 -229
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/js/ins.js +1 -53
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +1 -32
- data/templates/tiny_mce/tiny_mce/themes/advanced/about.htm +1 -52
- data/templates/tiny_mce/tiny_mce/themes/advanced/anchor.htm +1 -26
- data/templates/tiny_mce/tiny_mce/themes/advanced/charmap.htm +1 -51
- data/templates/tiny_mce/tiny_mce/themes/advanced/color_picker.htm +1 -74
- data/templates/tiny_mce/tiny_mce/themes/advanced/editor_template.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/advanced/editor_template_src.js +1 -1328
- data/templates/tiny_mce/tiny_mce/themes/advanced/image.htm +1 -80
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/about.js +1 -73
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/anchor.js +1 -42
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/charmap.js +1 -354
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/color_picker.js +1 -329
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/image.js +1 -247
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/link.js +1 -153
- data/templates/tiny_mce/tiny_mce/themes/advanced/js/source_editor.js +1 -56
- data/templates/tiny_mce/tiny_mce/themes/advanced/langs/de.js +1 -0
- data/templates/tiny_mce/tiny_mce/themes/advanced/langs/de_dlg.js +1 -0
- data/templates/tiny_mce/tiny_mce/themes/advanced/langs/en.js +1 -68
- data/templates/tiny_mce/tiny_mce/themes/advanced/langs/en_dlg.js +1 -54
- data/templates/tiny_mce/tiny_mce/themes/advanced/link.htm +1 -57
- data/templates/tiny_mce/tiny_mce/themes/advanced/shortcuts.htm +1 -47
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/content.css +1 -47
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/dialog.css +1 -117
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/default/ui.css +1 -213
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/highcontrast/content.css +1 -23
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +1 -105
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/highcontrast/ui.css +1 -101
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/content.css +1 -46
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/dialog.css +1 -116
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/ui.css +1 -215
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +1 -8
- data/templates/tiny_mce/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +1 -5
- data/templates/tiny_mce/tiny_mce/themes/advanced/source_editor.htm +1 -25
- data/templates/tiny_mce/tiny_mce/themes/simple/editor_template.js +1 -1
- data/templates/tiny_mce/tiny_mce/themes/simple/editor_template_src.js +1 -84
- data/templates/tiny_mce/tiny_mce/themes/simple/langs/de.js +1 -0
- data/templates/tiny_mce/tiny_mce/themes/simple/langs/en.js +1 -11
- data/templates/tiny_mce/tiny_mce/themes/simple/skins/default/content.css +1 -25
- data/templates/tiny_mce/tiny_mce/themes/simple/skins/default/ui.css +1 -32
- data/templates/tiny_mce/tiny_mce/themes/simple/skins/o2k7/content.css +1 -17
- data/templates/tiny_mce/tiny_mce/themes/simple/skins/o2k7/ui.css +1 -35
- data/templates/tiny_mce/tiny_mce/tiny_mce.js +1 -1
- data/templates/tiny_mce/tiny_mce/tiny_mce_popup.js +1 -5
- data/templates/tiny_mce/tiny_mce/utils/editable_selects.js +1 -70
- data/templates/tiny_mce/tiny_mce/utils/form_utils.js +1 -207
- data/templates/tiny_mce/tiny_mce/utils/mctabs.js +1 -162
- data/templates/tiny_mce/tiny_mce/utils/validate.js +1 -252
- metadata +32 -17
- 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/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
@@ -1,21 +1,11 @@
|
|
1
1
|
/*
|
2
2
|
New BSD License <http://creativecommons.org/licenses/BSD/>
|
3
|
-
Public Domain
|
4
|
-
@author Benjamin Arthur Lupton <contact@balupton.com>
|
5
|
-
@author James Padolsey <https://gist.github.com/527683>
|
6
|
-
Public Domain
|
7
|
-
@author Benjamin Arthur Lupton <contact@balupton.com>
|
8
3
|
*/
|
9
|
-
(function(h){
|
10
|
-
function(){
|
11
|
-
[];
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
return false}
|
17
|
-
b.getHashByIndex(-3),"Hash -4",b.getHashByIndex(-4),"Hash -5",b.getHashByIndex(-5),"Hash -6",b.getHashByIndex(-6),"Hash -7",b.getHashByIndex(-7));var d=b.discardedState(currentState);if(d){a.debug("forwardState:",a.contractState(d.forwardState),"backState:",a.contractState(d.backState));if(b.getHashByIndex(-2)===a.contractState(d.forwardState)){a.debug("_History.onHashChange: go backwards");a.back(false)}else{a.debug("_History.onHashChange: go forwards");a.forward(false)}a.busy(false);return false}a.debug("_History.onHashChange: success hashchange");
|
18
|
-
a.pushState(currentState.data,currentState.title,currentState.url,false);return true};a.Adapter.bind(h,"hashchange",b.onHashChange);a.pushState=function(c,d,f,j){a.debug("History.pushState",this,arguments);if(a.extractHashFromUrl(f))throw Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(j!==false&&a.busy()){a.debug("History.pushState: we must wait",arguments);a.pushQueue({scope:a,callback:a.pushState,args:arguments,queue:j});return false}a.busy(true);var e=
|
19
|
-
a.createStateObject(c,d,f),g=a.contractState(e);a.getState();var k=a.getStateHash(),l=unescape(a.getHash());b.storeState(e);b.recycleState(e);if(i.title!==e.title){i.title=e.title;try{i.getElementsByTagName("title")[0].innerHTML=e.title}catch(m){}}a.debug("History.pushState: details","newStateHash:",g,"oldStateHash:",k,"html4Hash:",l);if(g===k){a.debug("History.pushState: no change",g);return false}if(g!==l){a.debug("History.pushState: update hash",g);a.setHash(g,false);return false}b.saveState(e);
|
20
|
-
a.debug("History.pushState: trigger popstate");a.Adapter.trigger(h,"statechange");a.busy(false);return true};a.replaceState=function(c,d,f,j){a.debug("History.replaceState",this,arguments);if(a.extractHashFromUrl(f))throw Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(j!==false&&a.busy()){a.debug("History.replaceState: we must wait",arguments);a.pushQueue({scope:a,callback:a.replaceState,args:arguments,queue:j});return false}a.busy(true);var e=a.createStateObject(c,
|
21
|
-
d,f),g=a.getState(),k=b.getStateByIndex(-2);b.discardState(g,e,k);a.pushState(e.data,e.title,e.url,false);return true};if(!i.location.hash||i.location.hash==="#")a.Adapter.onDomLoad(function(){a.debug("Internet Explorer Initial State Change Fix");var c=a.createStateObject({},"",i.location.href);a.pushState(c.data,c.title,c.url)});else if(!a.emulated.hashChange){a.debug("Firefox Initial State Change Fix");a.Adapter.onDomLoad(function(){b.onHashChange()})}}};a.initHtml4()})(window);
|
4
|
+
(function(h){var i=h.document,a=h.History=h.History||{};if(typeof a.initHtml4!=="undefined")throw Error("History.js HTML4 Support has already been loaded...");a.initHtml4=function(){if(typeof a.initHtml4.initialized!=="undefined")return false;else a.initHtml4.initialized=true;a.savedHashes=[];a.isLastHash=function(b){var c=a.getHashByIndex();return b===c};a.saveHash=function(b){if(a.isLastHash(b))return false;a.savedHashes.push(b);return true};a.getHashByIndex=function(b){var c=null;return c=typeof b===
|
5
|
+
"undefined"?a.savedHashes[a.savedHashes.length-1]:b<0?a.savedHashes[a.savedHashes.length+b]:a.savedHashes[b]};a.discardedHashes={};a.discardedStates={};a.discardState=function(b,c,e){var f=a.getHashByState(b);a.discardedStates[f]={discardedState:b,backState:e,forwardState:c};return true};a.discardHash=function(b,c,e){a.discardedHashes[b]={discardedHash:b,backState:e,forwardState:c};return true};a.discardedState=function(b){b=a.getHashByState(b);return a.discardedStates[b]||false};a.discardedHash=
|
6
|
+
function(b){return a.discardedHashes[b]||false};a.recycleState=function(b){var c=a.getHashByState(b);a.discardedState(b)&&delete a.discardedStates[c];return true};if(a.emulated.hashChange){a.hashChangeInit=function(){a.checkerFunction=null;var b="";if(a.isInternetExplorer()){var c=i.createElement("iframe");c.setAttribute("id","historyjs-iframe");c.style.display="none";i.body.appendChild(c);c.contentWindow.document.open();c.contentWindow.document.close();var e="",f=false;a.checkerFunction=function(){if(f)return false;
|
7
|
+
f=true;var d=a.getHash()||"",g=a.unescapeHash(c.contentWindow.document.location.hash)||"";if(d!==b){b=d;if(g!==d){e=d;c.contentWindow.document.open();c.contentWindow.document.close();c.contentWindow.document.location.hash=a.escapeHash(d)}a.Adapter.trigger(h,"hashchange")}else if(g!==e){e=g;a.setHash(g,false)}f=false;return true}}else a.checkerFunction=function(){var d=a.getHash();if(d!==b){b=d;a.Adapter.trigger(h,"hashchange")}return true};setInterval(a.checkerFunction,a.options.hashChangeInterval);
|
8
|
+
return true};a.Adapter.onDomLoad(a.hashChangeInit)}if(a.emulated.pushState){a.onHashChange=function(b){var c=a.getHashByUrl(b&&b.newURL||i.location.href);b=null;if(a.isLastHash(c)){a.busy(false);return false}a.doubleCheckComplete();a.saveHash(c);b=a.extractState(c||i.location.href);if(!b){a.Adapter.trigger(h,"anchorchange");a.busy(false);return false}if(a.isLastSavedState(b)){a.busy(false);return false}a.getHashByState(b);if(c=a.discardedState(b)){a.getHashByIndex(-2)===a.getHashByState(c.forwardState)?
|
9
|
+
a.back(false):a.forward(false);a.busy(false);return false}a.pushState(b.data,b.title,b.url,false);return true};a.Adapter.bind(h,"hashchange",a.onHashChange);a.pushState=function(b,c,e,f){if(a.getHashByUrl(e))throw Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(f!==false&&a.busy()){a.pushQueue({scope:a,callback:a.pushState,args:arguments,queue:f});return false}a.busy(true);var d=a.createStateObject(b,c,e),g=a.getHashByState(d),j=a.getState(false);j=a.getHashByState(j);
|
10
|
+
var k=a.getHash();a.storeState(d);a.expectedStateId=d.id;a.recycleState(d);a.setTitle(d);if(g===j){a.busy(false);return false}if(g!==k&&g!==a.getShortUrl(i.location.href)){a.setHash(g,false);return false}a.saveState(d);a.Adapter.trigger(h,"statechange");a.busy(false);return true};a.replaceState=function(b,c,e,f){if(a.getHashByUrl(e))throw Error("History.js does not support states with fragement-identifiers (hashes/anchors).");if(f!==false&&a.busy()){a.pushQueue({scope:a,callback:a.replaceState,args:arguments,
|
11
|
+
queue:f});return false}a.busy(true);var d=a.createStateObject(b,c,e),g=a.getState(false),j=a.getStateByIndex(-2);a.discardState(g,d,j);a.pushState(d.data,d.title,d.url,false);return true};a.saveState(a.storeState(a.createStateObject({},"",i.location.href)));a.getHash()&&!a.emulated.hashChange&&a.Adapter.onDomLoad(function(){a.Adapter.trigger(h,"hashchange")})}};a.init()})(window);
|
data/templates/jquery/history.js
CHANGED
@@ -1,1297 +1,1678 @@
|
|
1
1
|
/**
|
2
|
-
* History.js
|
2
|
+
* History.js Core
|
3
3
|
* @author Benjamin Arthur Lupton <contact@balupton.com>
|
4
4
|
* @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
|
5
5
|
* @license New BSD License <http://creativecommons.org/licenses/BSD/>
|
6
6
|
*/
|
7
7
|
|
8
|
-
(function(window,
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
8
|
+
(function(window,undefined){
|
9
|
+
"use strict";
|
10
|
+
|
11
|
+
// --------------------------------------------------------------------------
|
12
|
+
// Initialise
|
13
|
+
|
14
|
+
// Localise Globals
|
15
|
+
var
|
16
|
+
console = window.console||undefined, // Prevent a JSLint complain
|
17
|
+
document = window.document, // Make sure we are using the correct document
|
18
|
+
navigator = window.navigator, // Make sure we are using the correct navigator
|
19
|
+
History = window.History = window.History||{}, // Public History Object
|
20
|
+
history = window.history; // Old History Object
|
21
|
+
|
22
|
+
// Check Existence
|
23
|
+
if ( typeof History.init !== 'undefined' ) {
|
24
|
+
throw new Error('History.js Core has already been loaded...');
|
25
|
+
}
|
26
|
+
|
27
|
+
// Initialise History
|
28
|
+
History.init = function(){
|
29
|
+
// Check Load Status of Adapter
|
30
|
+
if ( typeof History.Adapter === 'undefined' ) {
|
31
|
+
return false;
|
32
|
+
}
|
33
|
+
|
34
|
+
// Check Load Status of Core
|
35
|
+
if ( typeof History.initCore !== 'undefined' ) {
|
36
|
+
History.initCore();
|
37
|
+
}
|
38
|
+
|
39
|
+
// Check Load Status of HTML4 Support
|
40
|
+
if ( typeof History.initHtml4 !== 'undefined' ) {
|
41
|
+
History.initHtml4();
|
42
|
+
}
|
43
|
+
|
44
|
+
// Return true
|
45
|
+
return true;
|
46
|
+
};
|
47
|
+
|
48
|
+
// --------------------------------------------------------------------------
|
49
|
+
// Initialise Core
|
50
|
+
|
51
|
+
// Initialise Core
|
52
|
+
History.initCore = function(){
|
53
|
+
// Initialise
|
54
|
+
if ( typeof History.initCore.initialized !== 'undefined' ) {
|
55
|
+
// Already Loaded
|
56
|
+
return false;
|
57
|
+
}
|
58
|
+
else {
|
59
|
+
History.initCore.initialized = true;
|
60
|
+
}
|
61
|
+
|
62
|
+
// ----------------------------------------------------------------------
|
63
|
+
// Options
|
64
|
+
|
65
|
+
/**
|
66
|
+
* History.options
|
67
|
+
* Configurable options
|
68
|
+
*/
|
69
|
+
History.options = History.options||{};
|
70
|
+
|
71
|
+
/**
|
72
|
+
* History.options.hashChangeInterval
|
73
|
+
* How long should the interval be before hashchange checks
|
74
|
+
*/
|
75
|
+
History.options.hashChangeInterval = History.options.hashChangeInterval || 100;
|
76
|
+
|
77
|
+
/**
|
78
|
+
* History.options.safariPollInterval
|
79
|
+
* How long should the interval be before safari poll checks
|
80
|
+
*/
|
81
|
+
History.options.safariPollInterval = History.options.safariPollInterval || 500;
|
82
|
+
|
83
|
+
/**
|
84
|
+
* History.options.doubleCheckInterval
|
85
|
+
* How long should the interval be before we perform a double check
|
86
|
+
*/
|
87
|
+
History.options.doubleCheckInterval = History.options.doubleCheckInterval || 500;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* History.options.busyDelay
|
91
|
+
* How long should we wait between busy events
|
92
|
+
*/
|
93
|
+
History.options.busyDelay = History.options.busyDelay || 250;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* History.options.debug
|
97
|
+
* If true will enable debug messages to be logged
|
98
|
+
*/
|
99
|
+
History.options.debug = History.options.debug || false;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* History.options.initialTitle
|
103
|
+
* What is the title of the initial state
|
104
|
+
*/
|
105
|
+
History.options.initialTitle = History.options.initialTitle || document.title;
|
106
|
+
|
107
|
+
|
108
|
+
// ----------------------------------------------------------------------
|
109
|
+
// Debug
|
110
|
+
|
111
|
+
/**
|
112
|
+
* History.debug(message,...)
|
113
|
+
* Logs the passed arguments if debug enabled
|
114
|
+
*/
|
115
|
+
History.debug = function(){
|
116
|
+
if ( (History.options.debug||false) ) {
|
117
|
+
History.log.apply(History,arguments);
|
118
|
+
}
|
119
|
+
};
|
120
|
+
|
121
|
+
/**
|
122
|
+
* History.log(message,...)
|
123
|
+
* Logs the passed arguments
|
124
|
+
*/
|
125
|
+
History.log = function(){
|
126
|
+
// Prepare
|
127
|
+
var
|
128
|
+
consoleExists = (typeof console !== 'undefined' && typeof console.log !== 'undefined' && typeof console.log.apply !== 'undefined'),
|
129
|
+
textarea = document.getElementById('log'),
|
130
|
+
message,
|
131
|
+
i,n
|
132
|
+
;
|
133
|
+
|
134
|
+
// Write to Console
|
135
|
+
if ( consoleExists ) {
|
136
|
+
var args = Array.prototype.slice.call(arguments);
|
137
|
+
message = args.shift();
|
138
|
+
if ( typeof console.debug !== 'undefined' ) {
|
139
|
+
console.debug.apply(console,[message,args]);
|
140
|
+
}
|
141
|
+
else {
|
142
|
+
console.log.apply(console,[message,args]);
|
143
|
+
}
|
144
|
+
}
|
145
|
+
else {
|
146
|
+
message = ("\n"+arguments[0]+"\n");
|
147
|
+
}
|
148
|
+
|
149
|
+
// Write to log
|
150
|
+
for ( i=1,n=arguments.length; i<n; ++i ) {
|
151
|
+
var arg = arguments[i];
|
152
|
+
if ( typeof arg === 'object' && typeof JSON !== 'undefined' ) {
|
153
|
+
try {
|
154
|
+
arg = JSON.stringify(arg);
|
155
|
+
}
|
156
|
+
catch ( Exception ) {
|
157
|
+
// Recursive Object
|
158
|
+
}
|
159
|
+
}
|
160
|
+
message += "\n"+arg+"\n";
|
161
|
+
}
|
162
|
+
|
163
|
+
// Textarea
|
164
|
+
if ( textarea ) {
|
165
|
+
textarea.value += message+"\n-----\n";
|
166
|
+
textarea.scrollTop = textarea.scrollHeight - textarea.clientHeight;
|
167
|
+
}
|
168
|
+
// No Textarea, No Console
|
169
|
+
else if ( !consoleExists ) {
|
170
|
+
alert(message);
|
171
|
+
}
|
172
|
+
|
173
|
+
// Return true
|
174
|
+
return true;
|
175
|
+
};
|
176
|
+
|
177
|
+
// ----------------------------------------------------------------------
|
178
|
+
// Emulated Status
|
179
|
+
|
180
|
+
/**
|
181
|
+
* History.getInternetExplorerMajorVersion()
|
182
|
+
* Get's the major version of Internet Explorer
|
183
|
+
* @return {integer}
|
184
|
+
* @license Public Domain
|
185
|
+
* @author Benjamin Arthur Lupton <contact@balupton.com>
|
186
|
+
* @author James Padolsey <https://gist.github.com/527683>
|
187
|
+
*/
|
188
|
+
History.getInternetExplorerMajorVersion = function(){
|
189
|
+
var result = History.getInternetExplorerMajorVersion.cached =
|
190
|
+
(typeof History.getInternetExplorerMajorVersion.cached !== 'undefined')
|
191
|
+
? History.getInternetExplorerMajorVersion.cached
|
192
|
+
: (function(){
|
193
|
+
var v = 3,
|
194
|
+
div = document.createElement('div'),
|
195
|
+
all = div.getElementsByTagName('i');
|
196
|
+
while ( (div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->') && all[0] ) {}
|
197
|
+
return (v > 4) ? v : false;
|
198
|
+
})()
|
199
|
+
;
|
200
|
+
return result;
|
201
|
+
};
|
202
|
+
|
203
|
+
/**
|
204
|
+
* History.isInternetExplorer()
|
205
|
+
* Are we using Internet Explorer?
|
206
|
+
* @return {boolean}
|
207
|
+
* @license Public Domain
|
208
|
+
* @author Benjamin Arthur Lupton <contact@balupton.com>
|
209
|
+
*/
|
210
|
+
History.isInternetExplorer = function(){
|
211
|
+
var result =
|
212
|
+
History.isInternetExplorer.cached =
|
213
|
+
(typeof History.isInternetExplorer.cached !== 'undefined')
|
214
|
+
? History.isInternetExplorer.cached
|
215
|
+
: Boolean(History.getInternetExplorerMajorVersion())
|
216
|
+
;
|
217
|
+
return result;
|
218
|
+
};
|
219
|
+
|
220
|
+
/**
|
221
|
+
* History.emulated
|
222
|
+
* Which features require emulating?
|
223
|
+
*/
|
224
|
+
History.emulated = {
|
225
|
+
pushState: !Boolean(
|
226
|
+
window.history && window.history.pushState && window.history.replaceState
|
227
|
+
&& !(/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i).test(navigator.userAgent) /* disable for versions of iOS before version 4.3 (8F190) */
|
228
|
+
),
|
229
|
+
hashChange: Boolean(
|
230
|
+
!(('onhashchange' in window) || ('onhashchange' in document))
|
231
|
+
||
|
232
|
+
(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8)
|
233
|
+
)
|
234
|
+
};
|
235
|
+
|
236
|
+
/**
|
237
|
+
* History.bugs
|
238
|
+
* Which bugs are present
|
239
|
+
*/
|
240
|
+
History.bugs = {
|
241
|
+
/**
|
242
|
+
* Safari 5 and Safari iOS 4 fail to return to the correct state once a hash is replaced by a `replaceState` call
|
243
|
+
* https://bugs.webkit.org/show_bug.cgi?id=56249
|
244
|
+
*/
|
245
|
+
setHash: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2][0-9]|3[0-3])/.test(navigator.userAgent)),
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Safari 5 and Safari iOS 4 sometimes fail to apply the state change under busy conditions
|
249
|
+
* https://bugs.webkit.org/show_bug.cgi?id=42940
|
250
|
+
*/
|
251
|
+
safariPoll: Boolean(!History.emulated.pushState && navigator.vendor === 'Apple Computer, Inc.' && /AppleWebKit\/5([0-2][0-9]|3[0-3])/.test(navigator.userAgent)),
|
252
|
+
|
253
|
+
/**
|
254
|
+
* MSIE 6 and 7 sometimes do not apply a hash even it was told to (requiring a second call to the apply function)
|
255
|
+
*/
|
256
|
+
ieDoubleCheck: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 8),
|
257
|
+
|
258
|
+
/**
|
259
|
+
* MSIE 6 requires the entire hash to be encoded for the hashes to trigger the onHashChange event
|
260
|
+
*/
|
261
|
+
hashEscape: Boolean(History.isInternetExplorer() && History.getInternetExplorerMajorVersion() < 7)
|
262
|
+
};
|
263
|
+
|
264
|
+
/**
|
265
|
+
* History.isEmptyObject(obj)
|
266
|
+
* Checks to see if the Object is Empty
|
267
|
+
* @param {Object} obj
|
268
|
+
* @return {boolean}
|
269
|
+
*/
|
270
|
+
History.isEmptyObject = function(obj) {
|
271
|
+
for ( var name in obj ) {
|
272
|
+
return false;
|
273
|
+
}
|
274
|
+
return true;
|
275
|
+
};
|
276
|
+
|
277
|
+
/**
|
278
|
+
* History.cloneObject(obj)
|
279
|
+
* Clones a object
|
280
|
+
* @param {Object} obj
|
281
|
+
* @return {Object}
|
282
|
+
*/
|
283
|
+
History.cloneObject = function(obj) {
|
284
|
+
var hash,newObj;
|
285
|
+
if ( obj ) {
|
286
|
+
hash = JSON.stringify(obj);
|
287
|
+
newObj = JSON.parse(hash);
|
288
|
+
}
|
289
|
+
else {
|
290
|
+
newObj = {};
|
291
|
+
}
|
292
|
+
return newObj;
|
293
|
+
};
|
294
|
+
|
295
|
+
// ----------------------------------------------------------------------
|
296
|
+
// URL Helpers
|
297
|
+
|
298
|
+
/**
|
299
|
+
* History.getRootUrl()
|
300
|
+
* Turns "http://mysite.com/dir/page.html?asd" into "http://mysite.com"
|
301
|
+
* @return {String} rootUrl
|
302
|
+
*/
|
303
|
+
History.getRootUrl = function(){
|
304
|
+
// Create
|
305
|
+
var rootUrl = document.location.protocol+'//'+(document.location.hostname||document.location.host);
|
306
|
+
if ( document.location.port||false ) {
|
307
|
+
rootUrl += ':'+document.location.port;
|
308
|
+
}
|
309
|
+
rootUrl += '/';
|
310
|
+
|
311
|
+
// Return
|
312
|
+
return rootUrl;
|
313
|
+
};
|
314
|
+
|
315
|
+
/**
|
316
|
+
* History.getBaseHref()
|
317
|
+
* Fetches the `href` attribute of the `<base href="...">` element if it exists
|
318
|
+
* @return {String} baseHref
|
319
|
+
*/
|
320
|
+
History.getBaseHref = function(){
|
321
|
+
// Create
|
322
|
+
var
|
323
|
+
baseElements = document.getElementsByTagName('base'),
|
324
|
+
baseElement = null,
|
325
|
+
baseHref = '';
|
326
|
+
|
327
|
+
// Test for Base Element
|
328
|
+
if ( baseElements.length === 1 ) {
|
329
|
+
// Prepare for Base Element
|
330
|
+
baseElement = baseElements[0];
|
331
|
+
baseHref = baseElement.href.replace(/[^\/]+$/,'');
|
332
|
+
}
|
333
|
+
|
334
|
+
// Adjust trailing slash
|
335
|
+
baseHref = baseHref.replace(/\/+$/,'');
|
336
|
+
if ( baseHref ) baseHref += '/';
|
337
|
+
|
338
|
+
// Return
|
339
|
+
return baseHref;
|
340
|
+
};
|
341
|
+
|
342
|
+
/**
|
343
|
+
* History.getBaseUrl()
|
344
|
+
* Fetches the baseHref or basePageUrl or rootUrl (whichever one exists first)
|
345
|
+
* @return {String} baseUrl
|
346
|
+
*/
|
347
|
+
History.getBaseUrl = function(){
|
348
|
+
// Create
|
349
|
+
var baseUrl = History.getBaseHref()||History.getBasePageUrl()||History.getRootUrl();
|
350
|
+
|
351
|
+
// Return
|
352
|
+
return baseUrl;
|
353
|
+
};
|
354
|
+
|
355
|
+
/**
|
356
|
+
* History.getPageUrl()
|
357
|
+
* Fetches the URL of the current page
|
358
|
+
* @return {String} pageUrl
|
359
|
+
*/
|
360
|
+
History.getPageUrl = function(){
|
361
|
+
// Fetch
|
362
|
+
var
|
363
|
+
State = History.getState(),
|
364
|
+
stateUrl = State.url||document.location.href;
|
365
|
+
|
366
|
+
// Create
|
367
|
+
var pageUrl = stateUrl.replace(/\/+$/,'').replace(/[^\/]+$/,function(part,index,string){
|
368
|
+
return (/\./).test(part) ? part : part+'/';
|
369
|
+
});
|
370
|
+
|
371
|
+
// Return
|
372
|
+
return pageUrl;
|
373
|
+
};
|
374
|
+
|
375
|
+
/**
|
376
|
+
* History.getBasePageUrl()
|
377
|
+
* Fetches the Url of the directory of the current page
|
378
|
+
* @return {String} basePageUrl
|
379
|
+
*/
|
380
|
+
History.getBasePageUrl = function(){
|
381
|
+
// Create
|
382
|
+
var basePageUrl = document.location.href.replace(/[#\?].*/,'').replace(/[^\/]+$/,function(part,index,string){
|
383
|
+
return (/\./).test(part) ? '' : part;
|
384
|
+
}).replace(/\/+$/,'')+'/';
|
385
|
+
|
386
|
+
// Return
|
387
|
+
return basePageUrl;
|
388
|
+
};
|
389
|
+
|
390
|
+
/**
|
391
|
+
* History.getFullUrl(url)
|
392
|
+
* Ensures that we have an absolute URL and not a relative URL
|
393
|
+
* @param {string} url
|
394
|
+
* @return {string} fullUrl
|
395
|
+
*/
|
396
|
+
History.getFullUrl = function(url){
|
397
|
+
// Prepare
|
398
|
+
var fullUrl = url, firstChar = url.substring(0,1);
|
399
|
+
|
400
|
+
// Check
|
401
|
+
if ( /[a-z]+\:\/\//.test(url) ) {
|
402
|
+
// Full URL
|
403
|
+
}
|
404
|
+
else if ( firstChar === '/' ) {
|
405
|
+
// Root URL
|
406
|
+
fullUrl = History.getRootUrl()+url.replace(/^\/+/,'');
|
407
|
+
}
|
408
|
+
else if ( firstChar === '#' ) {
|
409
|
+
// Anchor URL
|
410
|
+
fullUrl = History.getPageUrl().replace(/#.*/,'')+url;
|
411
|
+
}
|
412
|
+
else if ( firstChar === '?' ) {
|
413
|
+
// Query URL
|
414
|
+
fullUrl = History.getPageUrl().replace(/[\?#].*/,'')+url;
|
415
|
+
}
|
416
|
+
else {
|
417
|
+
// Relative URL
|
418
|
+
fullUrl = History.getBaseUrl()+url;
|
419
|
+
}
|
420
|
+
|
421
|
+
// Return
|
422
|
+
return fullUrl.replace(/\#$/,'');
|
423
|
+
};
|
424
|
+
|
425
|
+
/**
|
426
|
+
* History.getShortUrl(url)
|
427
|
+
* Ensures that we have a relative URL and not a absolute URL
|
428
|
+
* @param {string} url
|
429
|
+
* @return {string} url
|
430
|
+
*/
|
431
|
+
History.getShortUrl = function(url){
|
432
|
+
// Prepare
|
433
|
+
var shortUrl, rootUrl = History.getRootUrl(); // History.getBaseHref()||History.getBasePageUrl()
|
434
|
+
|
435
|
+
// Adjust
|
436
|
+
shortUrl = url.replace(rootUrl,'/');
|
437
|
+
|
438
|
+
// Return
|
439
|
+
return shortUrl.replace(/\#$/,'');
|
440
|
+
};
|
441
|
+
|
442
|
+
// ----------------------------------------------------------------------
|
443
|
+
// State Storage
|
444
|
+
|
445
|
+
/**
|
446
|
+
* History.idToState
|
447
|
+
* 1-1: State ID to State Object
|
448
|
+
*/
|
449
|
+
History.idToState = {};
|
450
|
+
|
451
|
+
/**
|
452
|
+
* History.stateToId
|
453
|
+
* 1-1: State String to State ID
|
454
|
+
*/
|
455
|
+
History.stateToId = {};
|
456
|
+
|
457
|
+
/**
|
458
|
+
* History.urlToId
|
459
|
+
* 1-1: State URL to State ID
|
460
|
+
*/
|
461
|
+
History.urlToId = {};
|
462
|
+
|
463
|
+
/**
|
464
|
+
* History.storedStates
|
465
|
+
* Store the states in an array
|
466
|
+
*/
|
467
|
+
History.storedStates = [];
|
468
|
+
|
469
|
+
/**
|
470
|
+
* History.savedStates
|
471
|
+
* Saved the states in an array
|
472
|
+
*/
|
473
|
+
History.savedStates = [];
|
474
|
+
|
475
|
+
/**
|
476
|
+
* History.getState()
|
477
|
+
* Get an object containing the data, title and url of the current state
|
478
|
+
* @return {Object} State
|
479
|
+
*/
|
480
|
+
History.getState = function(friendly){
|
481
|
+
// Prepare
|
482
|
+
if ( typeof friendly === 'undefined' ) { friendly = true; }
|
483
|
+
|
484
|
+
// Fetch
|
485
|
+
var State = History.getLastSavedState()||History.createStateObject();
|
486
|
+
|
487
|
+
// Adjust
|
488
|
+
if ( friendly ) {
|
489
|
+
State = History.cloneObject(State);
|
490
|
+
State.url = State.cleanUrl||State.url;
|
491
|
+
}
|
492
|
+
|
493
|
+
// Return
|
494
|
+
return State;
|
495
|
+
};
|
496
|
+
|
497
|
+
/**
|
498
|
+
* History.getIdByState(State)
|
499
|
+
* Gets a ID for a State
|
500
|
+
* @param {State} newState
|
501
|
+
* @return {String} id
|
502
|
+
*/
|
503
|
+
History.getIdByState = function(newState){
|
504
|
+
|
505
|
+
// Fetch ID
|
506
|
+
var id = History.extractId(newState.url);
|
507
|
+
if ( !id ) {
|
508
|
+
// Find ID via State String
|
509
|
+
var str = History.getStateString(newState);
|
510
|
+
if ( typeof History.stateToId[str] !== 'undefined' ) {
|
511
|
+
id = History.stateToId[str];
|
512
|
+
}
|
513
|
+
else {
|
514
|
+
// Generate a new ID
|
515
|
+
while ( true ) {
|
516
|
+
id = String(Math.floor(Math.random()*1000));
|
517
|
+
if ( typeof History.idToState[id] === 'undefined' ) {
|
518
|
+
break;
|
519
|
+
}
|
520
|
+
}
|
521
|
+
|
522
|
+
// Apply the new State to the ID
|
523
|
+
History.stateToId[str] = id;
|
524
|
+
History.idToState[id] = newState;
|
525
|
+
}
|
526
|
+
}
|
527
|
+
|
528
|
+
// Return ID
|
529
|
+
return id;
|
530
|
+
};
|
531
|
+
|
532
|
+
/**
|
533
|
+
* History.normalizeState(State)
|
534
|
+
* Expands a State Object
|
535
|
+
* @param {object} State
|
536
|
+
* @return {object}
|
537
|
+
*/
|
538
|
+
History.normalizeState = function(oldState){
|
539
|
+
// Prepare
|
540
|
+
if ( !oldState || (typeof oldState !== 'object') ) {
|
541
|
+
oldState = {};
|
542
|
+
}
|
543
|
+
|
544
|
+
// Check
|
545
|
+
if ( typeof oldState.normalized !== 'undefined' ) {
|
546
|
+
return oldState;
|
547
|
+
}
|
548
|
+
|
549
|
+
// Adjust
|
550
|
+
if ( !oldState.data || (typeof oldState.data !== 'object') ) {
|
551
|
+
oldState.data = {};
|
552
|
+
}
|
553
|
+
|
554
|
+
// ----------------------------------------------------------------------
|
555
|
+
|
556
|
+
// Create
|
557
|
+
var newState = {};
|
558
|
+
newState.normalized = true;
|
559
|
+
newState.title = oldState.title||'';
|
560
|
+
newState.url = History.getFullUrl(oldState.url||document.location.href);
|
561
|
+
newState.hash = History.getShortUrl(newState.url);
|
562
|
+
newState.data = History.cloneObject(oldState.data);
|
563
|
+
|
564
|
+
// Fetch ID
|
565
|
+
newState.id = History.getIdByState(newState);
|
566
|
+
|
567
|
+
// ----------------------------------------------------------------------
|
568
|
+
|
569
|
+
// Check to see if we have more than just a url
|
570
|
+
var dataNotEmpty = !History.isEmptyObject(newState.data);
|
571
|
+
|
572
|
+
// Apply
|
573
|
+
if ( newState.title || dataNotEmpty ) {
|
574
|
+
// Add ID to Hash
|
575
|
+
newState.hash = History.getShortUrl(newState.url).replace(/\&_suid.*/,'');
|
576
|
+
if ( !/\?/.test(newState.hash) ) {
|
577
|
+
newState.hash += '?';
|
578
|
+
}
|
579
|
+
newState.hash += '&_suid='+newState.id;
|
580
|
+
}
|
581
|
+
|
582
|
+
// Create the Hashed URL
|
583
|
+
newState.hashedUrl = History.getFullUrl(newState.hash);
|
584
|
+
newState.cleanUrl = newState.url.replace(/\&_suid.*/,'');
|
585
|
+
|
586
|
+
// ----------------------------------------------------------------------
|
587
|
+
|
588
|
+
// Update the URL if we have a duplicate
|
589
|
+
if ( History.hasUrlDuplicate(newState) ) {
|
590
|
+
newState.url = newState.hashedUrl;
|
591
|
+
}
|
592
|
+
|
593
|
+
// ----------------------------------------------------------------------
|
594
|
+
|
595
|
+
// Return
|
596
|
+
return newState;
|
597
|
+
};
|
598
|
+
|
599
|
+
/**
|
600
|
+
* History.createStateObject(data,title,url)
|
601
|
+
* Creates a object based on the data, title and url state params
|
602
|
+
* @param {object} data
|
603
|
+
* @param {string} title
|
604
|
+
* @param {string} url
|
605
|
+
* @return {object}
|
606
|
+
*/
|
607
|
+
History.createStateObject = function(data,title,url){
|
608
|
+
// Hashify
|
609
|
+
var State = {
|
610
|
+
'data': data,
|
611
|
+
'title': title,
|
612
|
+
'url': url
|
613
|
+
};
|
614
|
+
|
615
|
+
// Expand the State
|
616
|
+
State = History.normalizeState(State);
|
617
|
+
|
618
|
+
// Return object
|
619
|
+
return State;
|
620
|
+
};
|
621
|
+
|
622
|
+
/**
|
623
|
+
* History.getStateById(id)
|
624
|
+
* Get a state by it's UID
|
625
|
+
* @param {String} id
|
626
|
+
*/
|
627
|
+
History.getStateById = function(id){
|
628
|
+
id = String(id);
|
629
|
+
var State = History.idToState[id]||undefined;
|
630
|
+
return State;
|
631
|
+
};
|
632
|
+
|
633
|
+
/**
|
634
|
+
* Get a State's String
|
635
|
+
* @param {State} passedState
|
636
|
+
*/
|
637
|
+
History.getStateString = function(passedState){
|
638
|
+
// Prepare
|
639
|
+
var State = History.normalizeState(passedState);
|
640
|
+
|
641
|
+
// Clean
|
642
|
+
var cleanedState = {
|
643
|
+
data: State.data,
|
644
|
+
title: passedState.title,
|
645
|
+
url: passedState.url
|
646
|
+
};
|
647
|
+
|
648
|
+
// Fetch
|
649
|
+
var str = JSON.stringify(cleanedState);
|
650
|
+
|
651
|
+
// Return
|
652
|
+
return str;
|
653
|
+
};
|
654
|
+
|
655
|
+
/**
|
656
|
+
* Get a State's ID
|
657
|
+
* @param {State} passedState
|
658
|
+
* @return {String} id
|
659
|
+
*/
|
660
|
+
History.getStateId = function(passedState){
|
661
|
+
// Prepare
|
662
|
+
var State = History.normalizeState(passedState);
|
663
|
+
|
664
|
+
// Fetch
|
665
|
+
var id = State.id;
|
666
|
+
|
667
|
+
// Return
|
668
|
+
return id;
|
669
|
+
};
|
670
|
+
|
671
|
+
/**
|
672
|
+
* History.getHashByState(State)
|
673
|
+
* Creates a Hash for the State Object
|
674
|
+
* @param {State} passedState
|
675
|
+
* @return {String} hash
|
676
|
+
*/
|
677
|
+
History.getHashByState = function(passedState){
|
678
|
+
// Prepare
|
679
|
+
var hash, State = History.normalizeState(passedState);
|
680
|
+
|
681
|
+
// Fetch
|
682
|
+
hash = State.hash;
|
683
|
+
|
684
|
+
// Return
|
685
|
+
return hash;
|
686
|
+
};
|
687
|
+
|
688
|
+
/**
|
689
|
+
* History.extractId(url_or_hash)
|
690
|
+
* Get a State ID by it's URL or Hash
|
691
|
+
* @param {string} url_or_hash
|
692
|
+
* @return {string} id
|
693
|
+
*/
|
694
|
+
History.extractId = function ( url_or_hash ) {
|
695
|
+
// Prepare
|
696
|
+
var id;
|
697
|
+
|
698
|
+
// Extract
|
699
|
+
var parts,url;
|
700
|
+
parts = /(.*)\&_suid=([0-9]+)$/.exec(url_or_hash);
|
701
|
+
url = parts ? (parts[1]||url_or_hash) : url_or_hash;
|
702
|
+
id = parts ? String(parts[2]||'') : '';
|
703
|
+
|
704
|
+
// Return
|
705
|
+
return id||false;
|
706
|
+
};
|
707
|
+
|
708
|
+
/**
|
709
|
+
* History.extractState
|
710
|
+
* Get a State by it's URL or Hash
|
711
|
+
*/
|
712
|
+
History.extractState = function(url_or_hash,create){
|
713
|
+
// Prepare
|
714
|
+
var State = null;
|
715
|
+
create = create||false;
|
716
|
+
|
717
|
+
// Fetch SUID
|
718
|
+
var id = History.extractId(url_or_hash);
|
719
|
+
if ( id ) {
|
720
|
+
State = History.getStateById(id);
|
721
|
+
}
|
722
|
+
|
723
|
+
// Fetch SUID returned no State
|
724
|
+
if ( !State ) {
|
725
|
+
// Fetch URL
|
726
|
+
var url = History.getFullUrl(url_or_hash);
|
727
|
+
|
728
|
+
// Check URL
|
729
|
+
id = History.getIdByUrl(url)||false;
|
730
|
+
if ( id ) {
|
731
|
+
State = History.getStateById(id);
|
732
|
+
}
|
733
|
+
// Create State
|
734
|
+
else if ( create && /\//.test(url_or_hash) ) {
|
735
|
+
State = History.createStateObject(null,null,url.replace(/\&_suid.*/,''));
|
736
|
+
}
|
737
|
+
}
|
738
|
+
|
739
|
+
// Return
|
740
|
+
return State;
|
741
|
+
};
|
742
|
+
|
743
|
+
/**
|
744
|
+
* History.getIdByUrl()
|
745
|
+
* Get a State ID by a State URL
|
746
|
+
*/
|
747
|
+
History.getIdByUrl = function(url){
|
748
|
+
var id = History.urlToId[url]||false;
|
749
|
+
return id;
|
750
|
+
};
|
751
|
+
|
752
|
+
/**
|
753
|
+
* History.getLastSavedState()
|
754
|
+
* Get an object containing the data, title and url of the current state
|
755
|
+
* @return {Object} State
|
756
|
+
*/
|
757
|
+
History.getLastSavedState = function(){
|
758
|
+
return History.savedStates[History.savedStates.length-1]||undefined;
|
759
|
+
};
|
760
|
+
|
761
|
+
/**
|
762
|
+
* History.getLastStoredState()
|
763
|
+
* Get an object containing the data, title and url of the current state
|
764
|
+
* @return {Object} State
|
765
|
+
*/
|
766
|
+
History.getLastStoredState = function(){
|
767
|
+
return History.storedStates[History.storedStates.length-1]||undefined;
|
768
|
+
};
|
769
|
+
|
770
|
+
/**
|
771
|
+
* History.hasUrlDuplicate
|
772
|
+
* Checks if a Url will have a url conflict
|
773
|
+
* @param {Object} newState
|
774
|
+
* @return {Boolean} hasDuplicate
|
775
|
+
*/
|
776
|
+
History.hasUrlDuplicate = function(newState) {
|
777
|
+
// Prepare
|
778
|
+
var hasDuplicate = false;
|
779
|
+
|
780
|
+
// Fetch
|
781
|
+
var oldState = History.extractState(newState.url);
|
782
|
+
|
783
|
+
// Check
|
784
|
+
hasDuplicate = oldState && oldState.id !== newState.id;
|
785
|
+
|
786
|
+
// Return
|
787
|
+
return hasDuplicate;
|
788
|
+
};
|
789
|
+
|
790
|
+
/**
|
791
|
+
* History.storeState
|
792
|
+
* Store a State
|
793
|
+
* @param {Object} newState
|
794
|
+
* @return {Object} newState
|
795
|
+
*/
|
796
|
+
History.storeState = function(newState){
|
797
|
+
// Store the State
|
798
|
+
History.urlToId[newState.url] = newState.id;
|
799
|
+
|
800
|
+
// Push the State
|
801
|
+
History.storedStates.push(History.cloneObject(newState));
|
802
|
+
|
803
|
+
// Return newState
|
804
|
+
return newState;
|
805
|
+
};
|
806
|
+
|
807
|
+
/**
|
808
|
+
* History.isLastSavedState(newState)
|
809
|
+
* Tests to see if the state is the last state
|
810
|
+
* @param {Object} newState
|
811
|
+
* @return {boolean} isLast
|
812
|
+
*/
|
813
|
+
History.isLastSavedState = function(newState){
|
814
|
+
// Prepare
|
815
|
+
var isLast = false;
|
816
|
+
|
817
|
+
// Check
|
818
|
+
if ( History.savedStates.length ) {
|
819
|
+
var
|
820
|
+
newId = newState.id,
|
821
|
+
oldState = History.getLastSavedState(),
|
822
|
+
oldId = oldState.id;
|
823
|
+
|
824
|
+
// Check
|
825
|
+
isLast = (newId === oldId);
|
826
|
+
}
|
827
|
+
|
828
|
+
// Return
|
829
|
+
return isLast;
|
830
|
+
};
|
831
|
+
|
832
|
+
/**
|
833
|
+
* History.saveState
|
834
|
+
* Push a State
|
835
|
+
* @param {Object} newState
|
836
|
+
* @return {boolean} changed
|
837
|
+
*/
|
838
|
+
History.saveState = function(newState){
|
839
|
+
// Check Hash
|
840
|
+
if ( History.isLastSavedState(newState) ) {
|
841
|
+
return false;
|
842
|
+
}
|
843
|
+
|
844
|
+
// Push the State
|
845
|
+
History.savedStates.push(History.cloneObject(newState));
|
846
|
+
|
847
|
+
// Return true
|
848
|
+
return true;
|
849
|
+
};
|
850
|
+
|
851
|
+
/**
|
852
|
+
* History.getStateByIndex()
|
853
|
+
* Gets a state by the index
|
854
|
+
* @param {integer} index
|
855
|
+
* @return {Object}
|
856
|
+
*/
|
857
|
+
History.getStateByIndex = function(index){
|
858
|
+
// Prepare
|
859
|
+
var State = null;
|
860
|
+
|
861
|
+
// Handle
|
862
|
+
if ( typeof index === 'undefined' ) {
|
863
|
+
// Get the last inserted
|
864
|
+
State = History.savedStates[History.savedStates.length-1];
|
865
|
+
}
|
866
|
+
else if ( index < 0 ) {
|
867
|
+
// Get from the end
|
868
|
+
State = History.savedStates[History.savedStates.length+index];
|
869
|
+
}
|
870
|
+
else {
|
871
|
+
// Get from the beginning
|
872
|
+
State = History.savedStates[index];
|
873
|
+
}
|
874
|
+
|
875
|
+
// Return State
|
876
|
+
return State;
|
877
|
+
};
|
878
|
+
|
879
|
+
// ----------------------------------------------------------------------
|
880
|
+
// Hash Helpers
|
881
|
+
|
882
|
+
/**
|
883
|
+
* History.getHash()
|
884
|
+
* Gets the current document hash
|
885
|
+
* @return {string}
|
886
|
+
*/
|
887
|
+
History.getHash = function(){
|
888
|
+
var hash = History.unescapeHash(document.location.hash);
|
889
|
+
return hash;
|
890
|
+
};
|
891
|
+
|
892
|
+
/**
|
893
|
+
* History.unescapeHash()
|
894
|
+
* normalize and Unescape a Hash
|
895
|
+
* @return {string}
|
896
|
+
*/
|
897
|
+
History.unescapeHash = function(hash){
|
898
|
+
var result = History.normalizeHash(hash);
|
899
|
+
|
900
|
+
// Unescape hash
|
901
|
+
if ( /\%[^2][^5]/.test(result) ) {
|
902
|
+
result = window.unescape(result);
|
903
|
+
}
|
904
|
+
|
905
|
+
// Return result
|
906
|
+
return result;
|
907
|
+
};
|
908
|
+
|
909
|
+
/**
|
910
|
+
* History.normalizeHash()
|
911
|
+
* normalize a hash across browsers
|
912
|
+
* @return {string}
|
913
|
+
*/
|
914
|
+
History.normalizeHash = function(hash){
|
915
|
+
var result = hash.replace(/[^#]*#/,'').replace(/#.*/, '');
|
916
|
+
|
917
|
+
// Return result
|
918
|
+
return result;
|
919
|
+
};
|
920
|
+
|
921
|
+
/**
|
922
|
+
* History.setHash(hash)
|
923
|
+
* Sets the document hash
|
924
|
+
* @param {string} hash
|
925
|
+
* @return {History}
|
926
|
+
*/
|
927
|
+
History.setHash = function(hash,queue){
|
928
|
+
// Handle Queueing
|
929
|
+
if ( queue !== false && History.busy() ) {
|
930
|
+
// Wait + Push to Queue
|
931
|
+
//History.debug('History.setHash: we must wait', arguments);
|
932
|
+
History.pushQueue({
|
933
|
+
scope: History,
|
934
|
+
callback: History.setHash,
|
935
|
+
args: arguments,
|
936
|
+
queue: queue
|
937
|
+
});
|
938
|
+
return false;
|
939
|
+
}
|
940
|
+
|
941
|
+
// Log
|
942
|
+
//History.debug('History.setHash: called',hash);
|
943
|
+
|
944
|
+
// Prepare
|
945
|
+
var adjustedHash = History.escapeHash(hash);
|
946
|
+
|
947
|
+
// Make Busy + Continue
|
948
|
+
History.busy(true);
|
949
|
+
|
950
|
+
// Check if hash is a state
|
951
|
+
var State = History.extractState(hash,true);
|
952
|
+
if ( State && !History.emulated.pushState ) {
|
953
|
+
// Hash is a state so skip the setHash
|
954
|
+
//History.debug('History.setHash: Hash is a state so skipping the hash set with a direct pushState call',arguments);
|
955
|
+
|
956
|
+
// PushState
|
957
|
+
History.pushState(State.data,State.title,State.url,false);
|
958
|
+
}
|
959
|
+
else if ( document.location.hash !== adjustedHash ) {
|
960
|
+
// Hash is a proper hash, so apply it
|
961
|
+
|
962
|
+
// Handle browser bugs
|
963
|
+
if ( History.bugs.setHash ) {
|
964
|
+
// Fix Safari Bug https://bugs.webkit.org/show_bug.cgi?id=56249
|
965
|
+
|
966
|
+
// Fetch the base page
|
967
|
+
var pageUrl = History.getPageUrl();
|
968
|
+
|
969
|
+
// Safari hash apply
|
970
|
+
History.pushState(null,null,pageUrl+'#'+adjustedHash,false);
|
971
|
+
}
|
972
|
+
else {
|
973
|
+
// Normal hash apply
|
974
|
+
document.location.hash = adjustedHash;
|
975
|
+
}
|
976
|
+
}
|
977
|
+
|
978
|
+
// Chain
|
979
|
+
return History;
|
980
|
+
};
|
981
|
+
|
982
|
+
/**
|
983
|
+
* History.escape()
|
984
|
+
* normalize and Escape a Hash
|
985
|
+
* @return {string}
|
986
|
+
*/
|
987
|
+
History.escapeHash = function(hash){
|
988
|
+
var result = History.normalizeHash(hash);
|
989
|
+
|
990
|
+
// Escape hash
|
991
|
+
result = window.escape(result);
|
992
|
+
|
993
|
+
// IE6 Escape Bug
|
994
|
+
if ( !History.bugs.hashEscape ) {
|
995
|
+
// Restore common parts
|
996
|
+
result = result
|
997
|
+
.replace('%21','!')
|
998
|
+
.replace('%26','&')
|
999
|
+
.replace('%3D','=')
|
1000
|
+
.replace('%3F','?');
|
1001
|
+
}
|
1002
|
+
|
1003
|
+
// Return result
|
1004
|
+
return result;
|
1005
|
+
};
|
1006
|
+
|
1007
|
+
/**
|
1008
|
+
* History.getHashByUrl(url)
|
1009
|
+
* Extracts the Hash from a URL
|
1010
|
+
* @param {string} url
|
1011
|
+
* @return {string} url
|
1012
|
+
*/
|
1013
|
+
History.getHashByUrl = function(url){
|
1014
|
+
// Extract the hash
|
1015
|
+
var hash = String(url)
|
1016
|
+
.replace(/([^#]*)#?([^#]*)#?(.*)/, '$2')
|
1017
|
+
;
|
1018
|
+
|
1019
|
+
// Unescape hash
|
1020
|
+
hash = History.unescapeHash(hash);
|
1021
|
+
|
1022
|
+
// Return hash
|
1023
|
+
return hash;
|
1024
|
+
};
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* History.isTraditionalAnchor(url)
|
1028
|
+
* Checks to see if the url is a traditional anchor
|
1029
|
+
* @param {string} url
|
1030
|
+
* @return {boolean}
|
1031
|
+
*/
|
1032
|
+
History.isTraditionalAnchor = function(url){
|
1033
|
+
var
|
1034
|
+
hash = History.getHashByUrl(url),
|
1035
|
+
el = document.getElementById(hash),
|
1036
|
+
isTraditionalAnchor = typeof el !== 'undefined';
|
1037
|
+
|
1038
|
+
// Return isTraditionalAnchor
|
1039
|
+
return isTraditionalAnchor;
|
1040
|
+
};
|
1041
|
+
|
1042
|
+
/**
|
1043
|
+
* History.setTitle(title)
|
1044
|
+
* Applies the title to the document
|
1045
|
+
* @param {State} newState
|
1046
|
+
* @return {Boolean}
|
1047
|
+
*/
|
1048
|
+
History.setTitle = function(newState){
|
1049
|
+
// Prepare
|
1050
|
+
var title = newState.title;
|
1051
|
+
|
1052
|
+
// Initial
|
1053
|
+
if ( !title ) {
|
1054
|
+
var firstState = History.getStateByIndex(0);
|
1055
|
+
if ( firstState && firstState.url === newState.url ) {
|
1056
|
+
title = firstState.title||History.options.initialTitle;
|
1057
|
+
}
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
// Apply
|
1061
|
+
try {
|
1062
|
+
document.getElementsByTagName('title')[0].innerHTML = title.replace('<','<').replace('>','>').replace(' & ',' & ');
|
1063
|
+
}
|
1064
|
+
catch ( Exception ) { }
|
1065
|
+
document.title = title;
|
1066
|
+
|
1067
|
+
// Chain
|
1068
|
+
return History;
|
1069
|
+
};
|
1070
|
+
|
1071
|
+
// ----------------------------------------------------------------------
|
1072
|
+
// Queueing
|
1073
|
+
|
1074
|
+
/**
|
1075
|
+
* History.queues
|
1076
|
+
* The list of queues to use
|
1077
|
+
* First In, First Out
|
1078
|
+
*/
|
1079
|
+
History.queues = [];
|
1080
|
+
|
1081
|
+
/**
|
1082
|
+
* History.busy(value)
|
1083
|
+
* @param {boolean} value [optional]
|
1084
|
+
* @return {boolean} busy
|
1085
|
+
*/
|
1086
|
+
History.busy = function(value){
|
1087
|
+
// Apply
|
1088
|
+
if ( typeof value !== 'undefined' ) {
|
1089
|
+
//History.debug('History.busy: changing ['+(History.busy.flag||false)+'] to ['+(value||false)+']', History.queues.length);
|
1090
|
+
History.busy.flag = value;
|
1091
|
+
}
|
1092
|
+
// Default
|
1093
|
+
else if ( typeof History.busy.flag === 'undefined' ) {
|
1094
|
+
History.busy.flag = false;
|
1095
|
+
}
|
1096
|
+
|
1097
|
+
// Queue
|
1098
|
+
if ( !History.busy.flag ) {
|
1099
|
+
// Execute the next item in the queue
|
1100
|
+
clearTimeout(History.busy.timeout);
|
1101
|
+
var fireNext = function(){
|
1102
|
+
if ( History.busy.flag ) return;
|
1103
|
+
for ( var i=History.queues.length-1; i >= 0; --i ) {
|
1104
|
+
var queue = History.queues[i];
|
1105
|
+
if ( queue.length === 0 ) continue;
|
1106
|
+
var item = queue.shift();
|
1107
|
+
History.fireQueueItem(item);
|
1108
|
+
History.busy.timeout = setTimeout(fireNext,History.options.busyDelay);
|
1109
|
+
}
|
1110
|
+
};
|
1111
|
+
History.busy.timeout = setTimeout(fireNext,History.options.busyDelay);
|
1112
|
+
}
|
1113
|
+
|
1114
|
+
// Return
|
1115
|
+
return History.busy.flag;
|
1116
|
+
};
|
1117
|
+
|
1118
|
+
/**
|
1119
|
+
* History.fireQueueItem(item)
|
1120
|
+
* Fire a Queue Item
|
1121
|
+
* @param {Object} item
|
1122
|
+
* @return {Mixed} result
|
1123
|
+
*/
|
1124
|
+
History.fireQueueItem = function(item){
|
1125
|
+
return item.callback.apply(item.scope||History,item.args||[]);
|
1126
|
+
};
|
1127
|
+
|
1128
|
+
/**
|
1129
|
+
* History.pushQueue(callback,args)
|
1130
|
+
* Add an item to the queue
|
1131
|
+
* @param {Object} item [scope,callback,args,queue]
|
1132
|
+
*/
|
1133
|
+
History.pushQueue = function(item){
|
1134
|
+
// Prepare the queue
|
1135
|
+
History.queues[item.queue||0] = History.queues[item.queue||0]||[];
|
1136
|
+
|
1137
|
+
// Add to the queue
|
1138
|
+
History.queues[item.queue||0].push(item);
|
1139
|
+
|
1140
|
+
// Chain
|
1141
|
+
return History;
|
1142
|
+
};
|
1143
|
+
|
1144
|
+
/**
|
1145
|
+
* History.queue (item,queue), (func,queue), (func), (item)
|
1146
|
+
* Either firs the item now if not busy, or adds it to the queue
|
1147
|
+
*/
|
1148
|
+
History.queue = function(item,queue){
|
1149
|
+
// Prepare
|
1150
|
+
if ( typeof item === 'function' ) {
|
1151
|
+
item = {
|
1152
|
+
callback: item
|
1153
|
+
};
|
1154
|
+
}
|
1155
|
+
if ( typeof queue !== 'undefined' ) {
|
1156
|
+
item.queue = queue;
|
1157
|
+
}
|
1158
|
+
|
1159
|
+
// Handle
|
1160
|
+
if ( History.busy() ) {
|
1161
|
+
History.pushQueue(item);
|
1162
|
+
} else {
|
1163
|
+
History.fireQueueItem(item);
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
// Chain
|
1167
|
+
return History;
|
1168
|
+
};
|
1169
|
+
|
1170
|
+
/**
|
1171
|
+
* History.clearQueue()
|
1172
|
+
* Clears the Queue
|
1173
|
+
*/
|
1174
|
+
History.clearQueue = function(){
|
1175
|
+
History.busy.flag = false;
|
1176
|
+
History.queues = [];
|
1177
|
+
return History;
|
1178
|
+
};
|
1179
|
+
|
1180
|
+
|
1181
|
+
// ----------------------------------------------------------------------
|
1182
|
+
// IE Bug Fix
|
1183
|
+
|
1184
|
+
/**
|
1185
|
+
* History.stateChanged
|
1186
|
+
* States whether or not the state has changed since the last double check was initialised
|
1187
|
+
*/
|
1188
|
+
History.stateChanged = false;
|
1189
|
+
|
1190
|
+
/**
|
1191
|
+
* History.doubleChecker
|
1192
|
+
* Contains the timeout used for the double checks
|
1193
|
+
*/
|
1194
|
+
History.doubleChecker = false;
|
1195
|
+
|
1196
|
+
/**
|
1197
|
+
* History.doubleCheckComplete()
|
1198
|
+
* Complete a double check
|
1199
|
+
* @return {History}
|
1200
|
+
*/
|
1201
|
+
History.doubleCheckComplete = function(){
|
1202
|
+
// Update
|
1203
|
+
History.stateChanged = true;
|
1204
|
+
|
1205
|
+
// Clear
|
1206
|
+
History.doubleCheckClear();
|
1207
|
+
|
1208
|
+
// Chain
|
1209
|
+
return History;
|
1210
|
+
};
|
1211
|
+
|
1212
|
+
/**
|
1213
|
+
* History.doubleCheckClear()
|
1214
|
+
* Clear a double check
|
1215
|
+
* @return {History}
|
1216
|
+
*/
|
1217
|
+
History.doubleCheckClear = function(){
|
1218
|
+
// Clear
|
1219
|
+
if ( History.doubleChecker ) {
|
1220
|
+
clearTimeout(History.doubleChecker);
|
1221
|
+
History.doubleChecker = false;
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
// Chain
|
1225
|
+
return History;
|
1226
|
+
};
|
1227
|
+
|
1228
|
+
/**
|
1229
|
+
* History.doubleCheck()
|
1230
|
+
* Create a double check
|
1231
|
+
* @return {History}
|
1232
|
+
*/
|
1233
|
+
History.doubleCheck = function(tryAgain){
|
1234
|
+
// Reset
|
1235
|
+
History.stateChanged = false;
|
1236
|
+
History.doubleCheckClear();
|
1237
|
+
|
1238
|
+
// Fix IE6,IE7 bug where calling history.back or history.forward does not actually change the hash (whereas doing it manually does)
|
1239
|
+
// Fix Safari 5 bug where sometimes the state does not change: https://bugs.webkit.org/show_bug.cgi?id=42940
|
1240
|
+
if ( History.bugs.ieDoubleCheck ) {
|
1241
|
+
// Apply Check
|
1242
|
+
History.doubleChecker = setTimeout(
|
1243
|
+
function(){
|
1244
|
+
History.doubleCheckClear();
|
1245
|
+
if ( !History.stateChanged ) {
|
1246
|
+
//History.debug('History.doubleCheck: State has not yet changed, trying again', arguments);
|
1247
|
+
// Re-Attempt
|
1248
|
+
tryAgain();
|
1249
|
+
}
|
1250
|
+
return true;
|
1251
|
+
},
|
1252
|
+
History.options.doubleCheckInterval
|
1253
|
+
);
|
1254
|
+
}
|
1255
|
+
|
1256
|
+
// Chain
|
1257
|
+
return History;
|
1258
|
+
};
|
1259
|
+
|
1260
|
+
// ----------------------------------------------------------------------
|
1261
|
+
// Safari Bug Fix
|
1262
|
+
|
1263
|
+
/**
|
1264
|
+
* History.safariStatePoll()
|
1265
|
+
* Poll the current state
|
1266
|
+
* @return {History}
|
1267
|
+
*/
|
1268
|
+
History.safariStatePoll = function(){
|
1269
|
+
// Poll the URL
|
1270
|
+
|
1271
|
+
// Get the Last State which has the new URL
|
1272
|
+
var
|
1273
|
+
urlState = History.extractState(document.location.href),
|
1274
|
+
newState;
|
1275
|
+
|
1276
|
+
// Check for a difference
|
1277
|
+
if ( !History.isLastSavedState(urlState) ) {
|
1278
|
+
newState = urlState;
|
1279
|
+
}
|
1280
|
+
else {
|
1281
|
+
return;
|
1282
|
+
}
|
1283
|
+
|
1284
|
+
// Check if we have a state with that url
|
1285
|
+
// If not create it
|
1286
|
+
if ( !newState ) {
|
1287
|
+
//History.debug('History.safariStatePoll: new');
|
1288
|
+
newState = History.createStateObject();
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
// Apply the New State
|
1292
|
+
//History.debug('History.safariStatePoll: trigger');
|
1293
|
+
History.Adapter.trigger(window,'popstate');
|
1294
|
+
|
1295
|
+
// Chain
|
1296
|
+
return History;
|
1297
|
+
};
|
1298
|
+
|
1299
|
+
// ----------------------------------------------------------------------
|
1300
|
+
// State Aliases
|
1301
|
+
|
1302
|
+
/**
|
1303
|
+
* History.back(queue)
|
1304
|
+
* Send the browser history back one item
|
1305
|
+
* @param {Integer} queue [optional]
|
1306
|
+
*/
|
1307
|
+
History.back = function(queue){
|
1308
|
+
//History.debug('History.back: called', arguments);
|
1309
|
+
|
1310
|
+
// Handle Queueing
|
1311
|
+
if ( queue !== false && History.busy() ) {
|
1312
|
+
// Wait + Push to Queue
|
1313
|
+
//History.debug('History.back: we must wait', arguments);
|
1314
|
+
History.pushQueue({
|
1315
|
+
scope: History,
|
1316
|
+
callback: History.back,
|
1317
|
+
args: arguments,
|
1318
|
+
queue: queue
|
1319
|
+
});
|
1320
|
+
return false;
|
1321
|
+
}
|
1322
|
+
|
1323
|
+
// Make Busy + Continue
|
1324
|
+
History.busy(true);
|
1325
|
+
|
1326
|
+
// Fix certain browser bugs that prevent the state from changing
|
1327
|
+
History.doubleCheck(function(){
|
1328
|
+
History.back(false);
|
1329
|
+
});
|
1330
|
+
|
1331
|
+
// Go back
|
1332
|
+
history.go(-1);
|
1333
|
+
|
1334
|
+
// End back closure
|
1335
|
+
return true;
|
1336
|
+
};
|
1337
|
+
|
1338
|
+
/**
|
1339
|
+
* History.forward(queue)
|
1340
|
+
* Send the browser history forward one item
|
1341
|
+
* @param {Integer} queue [optional]
|
1342
|
+
*/
|
1343
|
+
History.forward = function(queue){
|
1344
|
+
//History.debug('History.forward: called', arguments);
|
1345
|
+
|
1346
|
+
// Handle Queueing
|
1347
|
+
if ( queue !== false && History.busy() ) {
|
1348
|
+
// Wait + Push to Queue
|
1349
|
+
//History.debug('History.forward: we must wait', arguments);
|
1350
|
+
History.pushQueue({
|
1351
|
+
scope: History,
|
1352
|
+
callback: History.forward,
|
1353
|
+
args: arguments,
|
1354
|
+
queue: queue
|
1355
|
+
});
|
1356
|
+
return false;
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
// Make Busy + Continue
|
1360
|
+
History.busy(true);
|
1361
|
+
|
1362
|
+
// Fix certain browser bugs that prevent the state from changing
|
1363
|
+
History.doubleCheck(function(){
|
1364
|
+
History.forward(false);
|
1365
|
+
});
|
1366
|
+
|
1367
|
+
// Go forward
|
1368
|
+
history.go(1);
|
1369
|
+
|
1370
|
+
// End forward closure
|
1371
|
+
return true;
|
1372
|
+
};
|
1373
|
+
|
1374
|
+
/**
|
1375
|
+
* History.go(index,queue)
|
1376
|
+
* Send the browser history back or forward index times
|
1377
|
+
* @param {Integer} queue [optional]
|
1378
|
+
*/
|
1379
|
+
History.go = function(index,queue){
|
1380
|
+
//History.debug('History.go: called', arguments);
|
1381
|
+
|
1382
|
+
// Prepare
|
1383
|
+
var i;
|
1384
|
+
|
1385
|
+
// Handle
|
1386
|
+
if ( index > 0 ) {
|
1387
|
+
// Forward
|
1388
|
+
for ( i=1; i<=index; ++i ) {
|
1389
|
+
History.forward(queue);
|
1390
|
+
}
|
1391
|
+
}
|
1392
|
+
else if ( index < 0 ) {
|
1393
|
+
// Backward
|
1394
|
+
for ( i=-1; i>=index; --i ) {
|
1395
|
+
History.back(queue);
|
1396
|
+
}
|
1397
|
+
}
|
1398
|
+
else {
|
1399
|
+
throw new Error('History.go: History.go requires a positive or negative integer passed.');
|
1400
|
+
}
|
1401
|
+
|
1402
|
+
// Chain
|
1403
|
+
return History;
|
1404
|
+
};
|
1405
|
+
|
1406
|
+
|
1407
|
+
// ----------------------------------------------------------------------
|
1408
|
+
// HTML5 State Support
|
1409
|
+
|
1410
|
+
if ( History.emulated.pushState ) {
|
1411
|
+
/*
|
1412
|
+
* Provide Skeleton for HTML4 Browsers
|
1413
|
+
*/
|
1414
|
+
|
1415
|
+
// Prepare
|
1416
|
+
var emptyFunction = function(){};
|
1417
|
+
History.pushState = History.pushState||emptyFunction;
|
1418
|
+
History.replaceState = History.replaceState||emptyFunction;
|
1419
|
+
}
|
1420
|
+
else {
|
1421
|
+
/*
|
1422
|
+
* Use native HTML5 History API Implementation
|
1423
|
+
*/
|
1424
|
+
|
1425
|
+
/**
|
1426
|
+
* History.onPopState(event,extra)
|
1427
|
+
* Refresh the Current State
|
1428
|
+
*/
|
1429
|
+
History.onPopState = function(event){
|
1430
|
+
// Reset the double check
|
1431
|
+
History.doubleCheckComplete();
|
1432
|
+
|
1433
|
+
// Check for a Hash, and handle apporiatly
|
1434
|
+
var currentHash = History.getHash();
|
1435
|
+
if ( currentHash ) {
|
1436
|
+
// Expand Hash
|
1437
|
+
var currentState = History.extractState(currentHash||document.location.href,true);
|
1438
|
+
if ( currentState ) {
|
1439
|
+
// We were able to parse it, it must be a State!
|
1440
|
+
// Let's forward to replaceState
|
1441
|
+
//History.debug('History.onPopState: state anchor', currentHash, currentState);
|
1442
|
+
History.replaceState(currentState.data, currentState.title, currentState.url, false);
|
1443
|
+
}
|
1444
|
+
else {
|
1445
|
+
// Traditional Anchor
|
1446
|
+
//History.debug('History.onPopState: traditional anchor', currentHash);
|
1447
|
+
History.Adapter.trigger(window,'anchorchange');
|
1448
|
+
History.busy(false);
|
1449
|
+
}
|
1450
|
+
|
1451
|
+
// We don't care for hashes
|
1452
|
+
History.expectedStateId = false;
|
1453
|
+
return false;
|
1454
|
+
}
|
1455
|
+
|
1456
|
+
// Prepare
|
1457
|
+
var newState = null;
|
1458
|
+
|
1459
|
+
// Prepare
|
1460
|
+
event = event||{};
|
1461
|
+
if ( typeof event.state === 'undefined' ) {
|
1462
|
+
// jQuery
|
1463
|
+
if ( typeof event.originalEvent !== 'undefined' && typeof event.originalEvent.state !== 'undefined' ) {
|
1464
|
+
event.state = event.originalEvent.state||false;
|
1465
|
+
}
|
1466
|
+
// MooTools
|
1467
|
+
else if ( typeof event.event !== 'undefined' && typeof event.event.state !== 'undefined' ) {
|
1468
|
+
event.state = event.event.state||false;
|
1469
|
+
}
|
1470
|
+
}
|
1471
|
+
|
1472
|
+
// Ensure
|
1473
|
+
event.state = (event.state||false);
|
1474
|
+
|
1475
|
+
// Fetch State
|
1476
|
+
if ( event.state ) {
|
1477
|
+
// Vanilla: Back/forward button was used
|
1478
|
+
newState = History.getStateById(event.state);
|
1479
|
+
}
|
1480
|
+
else if ( History.expectedStateId ) {
|
1481
|
+
// Vanilla: A new state was pushed, and popstate was called manually
|
1482
|
+
newState = History.getStateById(History.expectedStateId);
|
1483
|
+
}
|
1484
|
+
else {
|
1485
|
+
// Initial State
|
1486
|
+
newState = History.extractState(document.location.href);
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
// Clean
|
1490
|
+
History.expectedStateId = false;
|
1491
|
+
|
1492
|
+
// Check if we are the same state
|
1493
|
+
if ( History.isLastSavedState(newState) ) {
|
1494
|
+
// There has been no change (just the page's hash has finally propagated)
|
1495
|
+
//History.debug('History.onPopState: no change', newState, History.savedStates);
|
1496
|
+
History.busy(false);
|
1497
|
+
return false;
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
// Store the State
|
1501
|
+
History.storeState(newState);
|
1502
|
+
History.saveState(newState);
|
1503
|
+
|
1504
|
+
// Force update of the title
|
1505
|
+
History.setTitle(newState);
|
1506
|
+
|
1507
|
+
// Fire Our Event
|
1508
|
+
History.Adapter.trigger(window,'statechange');
|
1509
|
+
History.busy(false);
|
1510
|
+
|
1511
|
+
// Return true
|
1512
|
+
return true;
|
1513
|
+
};
|
1514
|
+
History.Adapter.bind(window,'popstate',History.onPopState);
|
1515
|
+
|
1516
|
+
/**
|
1517
|
+
* History.pushState(data,title,url)
|
1518
|
+
* Add a new State to the history object, become it, and trigger onpopstate
|
1519
|
+
* We have to trigger for HTML4 compatibility
|
1520
|
+
* @param {object} data
|
1521
|
+
* @param {string} title
|
1522
|
+
* @param {string} url
|
1523
|
+
* @return {true}
|
1524
|
+
*/
|
1525
|
+
History.pushState = function(data,title,url,queue){
|
1526
|
+
//History.debug('History.pushState: called', arguments);
|
1527
|
+
|
1528
|
+
// Check the State
|
1529
|
+
if ( History.getHashByUrl(url) && History.emulated.pushState ) {
|
1530
|
+
throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
|
1531
|
+
}
|
1532
|
+
|
1533
|
+
// Handle Queueing
|
1534
|
+
if ( queue !== false && History.busy() ) {
|
1535
|
+
// Wait + Push to Queue
|
1536
|
+
//History.debug('History.pushState: we must wait', arguments);
|
1537
|
+
History.pushQueue({
|
1538
|
+
scope: History,
|
1539
|
+
callback: History.pushState,
|
1540
|
+
args: arguments,
|
1541
|
+
queue: queue
|
1542
|
+
});
|
1543
|
+
return false;
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
// Make Busy + Continue
|
1547
|
+
History.busy(true);
|
1548
|
+
|
1549
|
+
// Create the newState
|
1550
|
+
var newState = History.createStateObject(data,title,url);
|
1551
|
+
|
1552
|
+
// Check it
|
1553
|
+
if ( History.isLastSavedState(newState) ) {
|
1554
|
+
// Won't be a change
|
1555
|
+
History.busy(false);
|
1556
|
+
}
|
1557
|
+
else {
|
1558
|
+
// Store the newState
|
1559
|
+
History.storeState(newState);
|
1560
|
+
History.expectedStateId = newState.id;
|
1561
|
+
|
1562
|
+
// Push the newState
|
1563
|
+
var pushUrl =
|
1564
|
+
(History.bugs.safariPoll && History.hasUrlDuplicate(newState))
|
1565
|
+
? newState.hashedUrl
|
1566
|
+
: newState.url;
|
1567
|
+
history.pushState(newState.id,newState.title,pushUrl);
|
1568
|
+
|
1569
|
+
// Fire HTML5 Event
|
1570
|
+
History.Adapter.trigger(window,'popstate');
|
1571
|
+
}
|
1572
|
+
|
1573
|
+
// End pushState closure
|
1574
|
+
return true;
|
1575
|
+
};
|
1576
|
+
|
1577
|
+
/**
|
1578
|
+
* History.replaceState(data,title,url)
|
1579
|
+
* Replace the State and trigger onpopstate
|
1580
|
+
* We have to trigger for HTML4 compatibility
|
1581
|
+
* @param {object} data
|
1582
|
+
* @param {string} title
|
1583
|
+
* @param {string} url
|
1584
|
+
* @return {true}
|
1585
|
+
*/
|
1586
|
+
History.replaceState = function(data,title,url,queue){
|
1587
|
+
//History.debug('History.replaceState: called', arguments);
|
1588
|
+
|
1589
|
+
// Check the State
|
1590
|
+
if ( History.getHashByUrl(url) && History.emulated.pushState ) {
|
1591
|
+
throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
|
1592
|
+
}
|
1593
|
+
|
1594
|
+
// Handle Queueing
|
1595
|
+
if ( queue !== false && History.busy() ) {
|
1596
|
+
// Wait + Push to Queue
|
1597
|
+
//History.debug('History.replaceState: we must wait', arguments);
|
1598
|
+
History.pushQueue({
|
1599
|
+
scope: History,
|
1600
|
+
callback: History.replaceState,
|
1601
|
+
args: arguments,
|
1602
|
+
queue: queue
|
1603
|
+
});
|
1604
|
+
return false;
|
1605
|
+
}
|
1606
|
+
|
1607
|
+
// Make Busy + Continue
|
1608
|
+
History.busy(true);
|
1609
|
+
|
1610
|
+
// Create the newState
|
1611
|
+
var newState = History.createStateObject(data,title,url);
|
1612
|
+
|
1613
|
+
// Check it
|
1614
|
+
if ( History.isLastSavedState(newState) ) {
|
1615
|
+
// Won't be a change
|
1616
|
+
History.busy(false);
|
1617
|
+
}
|
1618
|
+
else {
|
1619
|
+
// Store the newState
|
1620
|
+
History.storeState(newState);
|
1621
|
+
History.expectedStateId = newState.id;
|
1622
|
+
|
1623
|
+
// Push the newState
|
1624
|
+
var pushUrl =
|
1625
|
+
(History.bugs.safariPoll && History.hasUrlDuplicate(newState))
|
1626
|
+
? newState.hashedUrl
|
1627
|
+
: newState.url;
|
1628
|
+
history.replaceState(newState.id,newState.title,pushUrl);
|
1629
|
+
|
1630
|
+
// Fire HTML5 Event
|
1631
|
+
History.Adapter.trigger(window,'popstate');
|
1632
|
+
}
|
1633
|
+
|
1634
|
+
// End replaceState closure
|
1635
|
+
return true;
|
1636
|
+
};
|
1637
|
+
|
1638
|
+
/**
|
1639
|
+
* Create the initial State
|
1640
|
+
*/
|
1641
|
+
History.saveState(History.storeState(History.createStateObject({},'',document.location.href)));
|
1642
|
+
|
1643
|
+
/**
|
1644
|
+
* Setup Safari Fix
|
1645
|
+
*/
|
1646
|
+
if ( History.bugs.safariPoll ) {
|
1647
|
+
setInterval(History.safariStatePoll, History.options.safariPollInterval);
|
1648
|
+
}
|
1649
|
+
|
1650
|
+
/**
|
1651
|
+
* Ensure Cross Browser Compatibility
|
1652
|
+
*/
|
1653
|
+
if ( navigator.vendor === 'Apple Computer, Inc.' || (navigator.appCodeName||'') === 'Mozilla' ) {
|
1654
|
+
/**
|
1655
|
+
* Fix Safari HashChange Issue
|
1656
|
+
*/
|
1657
|
+
|
1658
|
+
// Setup Alias
|
1659
|
+
History.Adapter.bind(window,'hashchange',function(){
|
1660
|
+
History.Adapter.trigger(window,'popstate');
|
1661
|
+
});
|
1662
|
+
|
1663
|
+
// Initialise Alias
|
1664
|
+
if ( History.getHash() ) {
|
1665
|
+
History.Adapter.onDomLoad(function(){
|
1666
|
+
History.Adapter.trigger(window,'hashchange');
|
1667
|
+
});
|
1668
|
+
}
|
1669
|
+
}
|
1670
|
+
|
1671
|
+
} // !History.emulated.pushState
|
1672
|
+
|
1673
|
+
}; // History.initCore
|
1674
|
+
|
1675
|
+
// Try and Initialise History
|
1676
|
+
History.init();
|
1296
1677
|
|
1297
1678
|
})(window);
|