compass-jquery-plugin 0.3.2.3 → 0.3.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +54 -37
- data/VERSION.yml +1 -1
- data/lib/handle_attributes.rb +4 -4
- data/lib/handle_js_files.rb +5 -5
- data/lib/jqtouch_theme.rb +2 -2
- data/lib/jquery/dynatree.rb +2 -2
- data/lib/jquery/emulators.rb +1 -1
- data/lib/jquery/flash_messages.rb +6 -6
- data/lib/jquery/graphics.rb +5 -0
- data/lib/jquery/gridify/assertions.rb +1 -1
- data/lib/jquery/gridify/grid.rb +76 -59
- data/lib/jquery/gridify/grid_column.rb +73 -67
- data/lib/jquery/gridify/grid_finder.rb +79 -79
- data/lib/jquery/gridify/grid_options.rb +154 -149
- data/lib/jquery/gridify/grid_view.rb +143 -143
- data/lib/jquery/gridify.rb +25 -25
- data/lib/jquery/ical/calendar.rb +2 -2
- data/lib/jquery/ical/event.rb +48 -44
- data/lib/jquery/ical/helpers/ui_event_helper.rb +3 -3
- data/lib/jquery/jqgrid/jqgrid.rb +58 -58
- data/lib/jquery/jqgrid.rb +1 -1
- data/lib/jquery/jqtouch.rb +1 -1
- data/lib/jquery/jquery.rb +117 -117
- data/lib/jquery/jquery_auto_complete.rb +9 -9
- data/lib/jquery/jquery_json_response.rb +12 -12
- data/lib/jquery/jquery_selector_assertions.rb +55 -53
- data/lib/jquery/jstree.rb +2 -2
- data/lib/jquery/mobile.rb +1 -1
- data/lib/jquery/ribbon.rb +2 -2
- data/lib/jquery/secret_sauce/controller/ui_dialog_controls.rb +5 -5
- data/lib/jquery/secret_sauce/controller/ui_grid_controls.rb +5 -5
- data/lib/jquery/secret_sauce/helpers/ui_dialog_helper.rb +1 -1
- data/lib/jquery/secret_sauce/helpers/ui_form_helper.rb +39 -39
- data/lib/jquery/secret_sauce/helpers/ui_grid_helper.rb +74 -74
- data/lib/jquery/secret_sauce/model/find_for_grid.rb +21 -21
- data/lib/jquery/secret_sauce.rb +1 -1
- data/lib/jquery/tools.rb +1 -1
- data/lib/jquery_mobile_theme.rb +2 -2
- data/lib/jquery_ui_theme.rb +12 -12
- data/templates/dynatree/config/initializers/dynatree.rb +3 -3
- data/templates/dynatree/jquery/dynatree/aero.scss +16 -16
- data/templates/dynatree/jquery/dynatree/aqua.scss +16 -16
- data/templates/dynatree/jquery/dynatree/crystal.scss +16 -16
- data/templates/dynatree/jquery/dynatree/xp.scss +17 -17
- data/templates/dynatree/jquery.dynatree.js +2926 -2912
- data/templates/emulators/config/initializers/emulators.rb +6 -6
- data/templates/graphics/config/initializers/graphics.rb +5 -0
- data/templates/graphics/jquery/ganttView.scss +89 -0
- data/templates/graphics/jquery.ganttView.js +1669 -0
- data/templates/graphics/jquery.ganttView.min.js +70 -0
- data/templates/{jquery → graphics}/jquery.sparkline.js +466 -438
- data/templates/{jquery → graphics}/jquery.sparkline.min.js +0 -0
- data/templates/graphics/manifest.rb +9 -0
- data/templates/jqgrid/config/initializers/jqgrid.rb +1 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ar.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-bg.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-bg1251.js +135 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cat.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-cn.js +137 -131
- data/templates/jqgrid/i18n/jqgrid/locale-cs.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-da.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-de.js +138 -132
- data/templates/jqgrid/i18n/jqgrid/locale-el.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-en.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-es.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-fa.js +19 -16
- data/templates/jqgrid/i18n/jqgrid/locale-fi.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-fr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-gl.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-he.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-hu.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-is.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-it.js +8 -1
- data/templates/jqgrid/i18n/jqgrid/locale-ja.js +139 -136
- data/templates/jqgrid/i18n/jqgrid/locale-nl.js +4 -1
- data/templates/jqgrid/i18n/jqgrid/locale-no.js +14 -1
- data/templates/jqgrid/i18n/jqgrid/locale-pl.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt-br.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-pt.js +130 -124
- data/templates/jqgrid/i18n/jqgrid/locale-ro.js +144 -138
- data/templates/jqgrid/i18n/jqgrid/locale-ru.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sk.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-sr.js +133 -127
- data/templates/jqgrid/i18n/jqgrid/locale-sv.js +132 -126
- data/templates/jqgrid/i18n/jqgrid/locale-tr.js +131 -125
- data/templates/jqgrid/i18n/jqgrid/locale-ua.js +132 -126
- data/templates/jqgrid/jquery.jqGrid.js +12735 -10444
- data/templates/jqgrid/jquery.jqGrid.min.js +477 -469
- data/templates/jqgrid/public/stylesheets/ellipsis-xbl.xml +12 -10
- data/templates/jqtouch/config/initializers/jqtouch.rb +3 -3
- data/templates/jqtouch/jquery/touch/jqtouch.scss +1 -1
- data/templates/jqtouch/jquery.jqtouch.js +10025 -10043
- data/templates/jquery/config/initializers/jquery.rb +2 -4
- data/templates/jquery/history.adapter.jquery.js +71 -0
- data/templates/jquery/history.adapter.jquery.min.js +4 -0
- data/templates/jquery/history.html4.js +690 -0
- data/templates/jquery/history.html4.min.js +21 -0
- data/templates/jquery/history.js +1297 -0
- data/templates/jquery/history.min.js +29 -0
- data/templates/jquery/i18n/jquery.ui/datepicker-af.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ar-DZ.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-ar.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-az.js +19 -19
- data/templates/jquery/i18n/jquery.ui/datepicker-bg.js +8 -8
- data/templates/jquery/i18n/jquery.ui/datepicker-bs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ca.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-cs.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-da.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-de.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-el.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-AU.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-GB.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-en-NZ.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-es.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-et.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-eu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fa.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-fi.js +15 -15
- data/templates/jquery/i18n/jquery.ui/datepicker-fo.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr-CH.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-fr.js +22 -22
- data/templates/jquery/i18n/jquery.ui/datepicker-gl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-he.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-hu.min.js +1 -1
- data/templates/jquery/i18n/jquery.ui/datepicker-hy.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-id.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-is.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-it.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ja.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ko.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-kz.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-lv.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ml.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ms.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-nl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-no.js +16 -16
- data/templates/jquery/i18n/jquery.ui/datepicker-no.min.js +2 -2
- data/templates/jquery/i18n/jquery.ui/datepicker-pl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt-BR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-pt.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-rm.js +18 -18
- data/templates/jquery/i18n/jquery.ui/datepicker-ro.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-ru.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sl.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sq.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr-SR.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-sv.js +14 -14
- data/templates/jquery/i18n/jquery.ui/datepicker-ta.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-th.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-tr.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-uk.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-vi.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-CN.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-HK.js +20 -20
- data/templates/jquery/i18n/jquery.ui/datepicker-zh-TW.js +20 -20
- data/templates/jquery/{partials → jquery/ui}/_flash_messages.scss +0 -0
- data/templates/jquery/jquery/ui/_theme.scss +14 -13
- data/templates/jquery/jquery/ui/contextMenu/configure.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/cut.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/exit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/paste.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/rename.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/show.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/trash.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu.scss +16 -10
- data/templates/jquery/jquery-ui.js +11839 -23066
- data/templates/jquery/jquery-ui.min.js +401 -795
- data/templates/jquery/jquery.bgiframe.js +27 -25
- data/templates/jquery/jquery.contextMenu.js +209 -196
- data/templates/jquery/jquery.cookie.js +3 -1
- data/templates/jquery/jquery.dotimeout.js +236 -228
- data/templates/jquery/jquery.dst.js +154 -151
- data/templates/jquery/jquery.farbtastic.js +293 -293
- data/templates/jquery/jquery.flashMessages.js +26 -0
- data/templates/jquery/jquery.flashMessages.min.js +1 -0
- data/templates/jquery/jquery.form.js +803 -786
- data/templates/jquery/jquery.haml.js +248 -247
- data/templates/jquery/jquery.hotkeys.js +89 -89
- data/templates/jquery/jquery.js +8141 -8106
- data/templates/jquery/jquery.layout.js +2451 -2415
- data/templates/jquery/jquery.min.js +167 -166
- data/templates/jquery/jquery.mousewheel.js +62 -54
- data/templates/jquery/jquery.offline.js +171 -171
- data/templates/jquery/jquery.pngFix.js +76 -76
- data/templates/jquery/jquery.replacetext.js +83 -83
- data/templates/jquery/jquery.themeswitchertool.js +202 -177
- data/templates/jquery/jquery.tmpl.js +478 -473
- data/templates/jquery/jquery.tmplPlus.js +82 -81
- data/templates/jquery/jrails.js +178 -175
- data/templates/jquery/json.js +77 -7
- data/templates/jquery/json2.js +480 -0
- data/templates/jquery/json2.min.js +7 -0
- data/templates/jquery/lib/tasks/haml.rake +2 -2
- data/templates/jquery/manifest.rb +21 -17
- data/templates/jstree/jquery.jstree.js +5967 -4536
- data/templates/mobile/config/initializers/mobile.rb +1 -1
- data/templates/mobile/jquery/mobile/_base.scss +944 -927
- data/templates/mobile/jquery/mobile/default.scss +61 -48
- data/templates/mobile/jquery/mobile/valencia.scss +56 -42
- data/templates/mobile/jquery.mobile.js +4461 -4347
- data/templates/mobile/jquery.mobile.min.js +11 -2
- data/templates/mobile/lib/tasks/jquery.mobile.rake +12 -12
- data/templates/ribbon/config/initializers/ribbon.rb +2 -2
- data/templates/ribbon/jquery.ribbon.js +50 -29
- data/templates/secret_sauce/secret_sauce.js +8 -8
- data/templates/tools/flowplayer.js +945 -1
- data/templates/tools/jquery.tools.js +4645 -4335
- data/templates/tools/jquery.tools.min.js +37 -37
- data/templates/tools/lib/tasks/jquery.tools.rake +4 -4
- data/templates/tools/swfobject.js +813 -773
- metadata +33 -21
- data/templates/jquery/haml.js +0 -506
- data/templates/jquery/haml.min.js +0 -5
- data/templates/jquery/jquery/ui/contextMenu/door.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_copy.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_delete.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_edit.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_new.png +0 -0
- data/templates/jquery/jquery/ui/contextMenu/page_white_paste.png +0 -0
- data/templates/jquery/jquery.compat-1.3.js +0 -291
- data/templates/jquery/jquery.compat-1.3.min.js +0 -6
- data/templates/jquery/jquery.flash_messages.js +0 -5
- data/templates/jquery/jquery.flash_messages.min.js +0 -1
- data/templates/jquery/jquery.history.js +0 -194
- data/templates/jquery/jquery.history.min.js +0 -5
@@ -18,10 +18,9 @@ ActionView::Helpers::PrototypeHelper::JQUERY_VAR = 'jQuery'
|
|
18
18
|
#ActionView::Helpers::AssetTagHelper::reset_javascript_include_default
|
19
19
|
|
20
20
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery => ['jquery.min']
|
21
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery_ui => ['jquery.min', 'jquery.cookie.min', 'jquery.form.min', 'jquery.layout.min', 'jquery-ui.min']
|
21
|
+
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jquery_ui => ['jquery.min', 'jquery.cookie.min', 'jquery.form.min', 'jquery.layout.min', 'jquery-ui.min', 'jquery.flashMessages.min']
|
22
22
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jrails => ['jrails.min']
|
23
23
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :jhaml => ['jquery.haml.min']
|
24
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :haml_js => ['haml-js.min']
|
25
24
|
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :contextMenu => ['compiled/jquery/ui/contextMenu.css']
|
26
25
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :contextMenu => ['jquery.contextMenu.min']
|
27
26
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :cookie => ['jquery.cookie.min']
|
@@ -30,14 +29,13 @@ ActionView::Helpers::AssetTagHelper.register_javascript_expansion :dst => ['jque
|
|
30
29
|
ActionView::Helpers::AssetTagHelper.register_stylesheet_expansion :farbtastic => ['compiled/jquery/ui/farbtastic.css']
|
31
30
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :farbtastic => ['jquery.farbtastic.min']
|
32
31
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :form => ['jquery.form.min']
|
33
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :history => ['jquery.history.min']
|
32
|
+
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :history => ['history.adapter.jquery.min', 'history.min', 'history.html4.min']
|
34
33
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :hotkeys => ['jquery.hotkeys.min']
|
35
34
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :layout => ['jquery.layout.min']
|
36
35
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :mousewheel => ['jquery.mousewheel.min']
|
37
36
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :offline => ['json.min', 'jquery.offline.min']
|
38
37
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :pngFix => ['jquery.pngFix.min']
|
39
38
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :replaceText => ['jquery.replaceText.min']
|
40
|
-
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :sparklines => ['jquery.sparkline.min']
|
41
39
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :themeSwitcher => ['jquery.themeswitchertool.min']
|
42
40
|
ActionView::Helpers::AssetTagHelper.register_javascript_expansion :tmpl => ['jquery.tmpl.min', 'jquery.tmplPlus.min']
|
43
41
|
|
@@ -0,0 +1,71 @@
|
|
1
|
+
/**
|
2
|
+
* History.js jQuery Adapter
|
3
|
+
* @author Benjamin Arthur Lupton
|
4
|
+
* @copyright 2010-2011 Benjamin Arthur Lupton
|
5
|
+
* @license New BSD License - http://creativecommons.org/licenses/BSD/
|
6
|
+
*/
|
7
|
+
|
8
|
+
(function($,window,undefined){
|
9
|
+
|
10
|
+
// --------------------------------------------------------------------------
|
11
|
+
// Initialise
|
12
|
+
|
13
|
+
// History Object
|
14
|
+
window.History = window.History||{};
|
15
|
+
|
16
|
+
// Localise Globals
|
17
|
+
var
|
18
|
+
History = window.History||{},
|
19
|
+
history = window.history;
|
20
|
+
|
21
|
+
// Check Existence of Adapter
|
22
|
+
if ( typeof History.Adapter !== 'undefined' ) {
|
23
|
+
throw new Error('History.js Adapter has already been loaded...');
|
24
|
+
}
|
25
|
+
|
26
|
+
// Add the Adapter
|
27
|
+
History.Adapter = {
|
28
|
+
|
29
|
+
/**
|
30
|
+
* History.Adapter.bind(el,event,callback)
|
31
|
+
* @param {element} el
|
32
|
+
* @param {string} event
|
33
|
+
* @param {Function} callback
|
34
|
+
* @return {element}
|
35
|
+
*/
|
36
|
+
bind: function(el,event,callback){
|
37
|
+
return $(el).bind(event,callback);
|
38
|
+
},
|
39
|
+
|
40
|
+
/**
|
41
|
+
* History.Adapter.trigger(el,event)
|
42
|
+
* @param {element} el
|
43
|
+
* @param {string} event
|
44
|
+
* @return {element}
|
45
|
+
*/
|
46
|
+
trigger: function(el,event){
|
47
|
+
return $(el).trigger(event);
|
48
|
+
},
|
49
|
+
|
50
|
+
/**
|
51
|
+
* History.Adapter.trigger(el,event,data)
|
52
|
+
* @param {Function} callback
|
53
|
+
* @return {true}
|
54
|
+
*/
|
55
|
+
onDomLoad: function(callback) {
|
56
|
+
jQuery(callback);
|
57
|
+
}
|
58
|
+
|
59
|
+
};
|
60
|
+
|
61
|
+
// Check Load Status of HTML5 Support
|
62
|
+
if ( typeof History.initHtml5 !== 'undefined' ) {
|
63
|
+
History.initHtml5();
|
64
|
+
}
|
65
|
+
|
66
|
+
// Check Load Status of HTML4 Support
|
67
|
+
if ( typeof History.initHtml4 !== 'undefined' ) {
|
68
|
+
History.initHtml4();
|
69
|
+
}
|
70
|
+
|
71
|
+
})(jQuery,window);
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/*
|
2
|
+
New BSD License - http://creativecommons.org/licenses/BSD/
|
3
|
+
*/
|
4
|
+
(function(e,c){c.History=c.History||{};var a=c.History||{};if(typeof a.Adapter!=="undefined")throw Error("History.js Adapter has already been loaded...");a.Adapter={bind:function(b,d,f){return e(b).bind(d,f)},trigger:function(b,d){return e(b).trigger(d)},onDomLoad:function(b){jQuery(b)}};typeof a.initHtml5!=="undefined"&&a.initHtml5();typeof a.initHtml4!=="undefined"&&a.initHtml4()})(jQuery,window);
|
@@ -0,0 +1,690 @@
|
|
1
|
+
/**
|
2
|
+
* History.js HTML4 Support
|
3
|
+
* Depends on the HTML5 Support
|
4
|
+
* @author Benjamin Arthur Lupton <contact@balupton.com>
|
5
|
+
* @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
|
6
|
+
* @license New BSD License <http://creativecommons.org/licenses/BSD/>
|
7
|
+
*/
|
8
|
+
|
9
|
+
(function(window,undefined){
|
10
|
+
|
11
|
+
// --------------------------------------------------------------------------
|
12
|
+
// Initialise
|
13
|
+
|
14
|
+
// History Object
|
15
|
+
window.History = window.History||{};
|
16
|
+
window._History = window._History||{};
|
17
|
+
|
18
|
+
// Localise Globals
|
19
|
+
var
|
20
|
+
document = window.document, // Make sure we are using the correct document
|
21
|
+
_History = window._History, // Private History Object
|
22
|
+
History = window.History; // Public History Object
|
23
|
+
|
24
|
+
// Check Existence of History.js
|
25
|
+
if ( typeof History.initHtml4 !== 'undefined' ) {
|
26
|
+
throw new Error('History.js HTML4 Support has already been loaded...');
|
27
|
+
}
|
28
|
+
|
29
|
+
// Initialise HTML4 Support
|
30
|
+
History.initHtml4 = function(){
|
31
|
+
|
32
|
+
// ----------------------------------------------------------------------
|
33
|
+
// Check Status
|
34
|
+
|
35
|
+
if ( typeof History.initHtml5 === 'undefined' || typeof History.Adapter === 'undefined' ) {
|
36
|
+
return false;
|
37
|
+
}
|
38
|
+
|
39
|
+
// ----------------------------------------------------------------------
|
40
|
+
// Emulated Status
|
41
|
+
|
42
|
+
/**
|
43
|
+
* _History.getInternetExplorerMajorVersion()
|
44
|
+
* Get's the major version of Internet Explorer
|
45
|
+
* @return {integer}
|
46
|
+
* @license Public Domain
|
47
|
+
* @author Benjamin Arthur Lupton <contact@balupton.com>
|
48
|
+
* @author James Padolsey <https://gist.github.com/527683>
|
49
|
+
*/
|
50
|
+
_History.getInternetExplorerMajorVersion = function(){
|
51
|
+
var result = _History.getInternetExplorerMajorVersion.cached =
|
52
|
+
(typeof _History.getInternetExplorerMajorVersion.cached !== 'undefined')
|
53
|
+
? _History.getInternetExplorerMajorVersion.cached
|
54
|
+
: (function(){
|
55
|
+
var undef,
|
56
|
+
v = 3,
|
57
|
+
div = document.createElement('div'),
|
58
|
+
all = div.getElementsByTagName('i');
|
59
|
+
while (
|
60
|
+
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',
|
61
|
+
all[0]
|
62
|
+
);
|
63
|
+
return v > 4 ? v : undef;
|
64
|
+
})()
|
65
|
+
;
|
66
|
+
return result;
|
67
|
+
};
|
68
|
+
|
69
|
+
/**
|
70
|
+
* _History.isInternetExplorer()
|
71
|
+
* Are we using Internet Explorer?
|
72
|
+
* @return {boolean}
|
73
|
+
* @license Public Domain
|
74
|
+
* @author Benjamin Arthur Lupton <contact@balupton.com>
|
75
|
+
*/
|
76
|
+
_History.isInternetExplorer = function(){
|
77
|
+
var result = _History.isInternetExplorer.cached =
|
78
|
+
(typeof _History.isInternetExplorer.cached !== 'undefined')
|
79
|
+
? _History.isInternetExplorer.cached
|
80
|
+
: (_History.getInternetExplorerMajorVersion() !== 0)
|
81
|
+
;
|
82
|
+
return result;
|
83
|
+
};
|
84
|
+
|
85
|
+
/**
|
86
|
+
* History.emulated
|
87
|
+
* Which features require emulating?
|
88
|
+
*/
|
89
|
+
History.emulated.hashChange = Boolean(
|
90
|
+
!('onhashchange' in window || 'onhashchange' in document)
|
91
|
+
||
|
92
|
+
(_History.isInternetExplorer() && _History.getInternetExplorerMajorVersion() < 8)
|
93
|
+
);
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
// ----------------------------------------------------------------------
|
98
|
+
// Hash Storage
|
99
|
+
|
100
|
+
/**
|
101
|
+
* _History.savedHashes
|
102
|
+
* Store the hashes in an array
|
103
|
+
*/
|
104
|
+
_History.savedHashes = [];
|
105
|
+
|
106
|
+
/**
|
107
|
+
* _History.isLastHash(newHash)
|
108
|
+
* Checks if the hash is the last hash
|
109
|
+
* @param {string} newHash
|
110
|
+
* @return {boolean} true
|
111
|
+
*/
|
112
|
+
_History.isLastHash = function(newHash){
|
113
|
+
// Prepare
|
114
|
+
var oldHash = _History.getHashByIndex();
|
115
|
+
|
116
|
+
// Check
|
117
|
+
var isLast = newHash === oldHash;
|
118
|
+
|
119
|
+
// Return isLast
|
120
|
+
return isLast;
|
121
|
+
};
|
122
|
+
|
123
|
+
/**
|
124
|
+
* _History.saveHash(newHash)
|
125
|
+
* Push a Hash
|
126
|
+
* @param {string} newHash
|
127
|
+
* @return {boolean} true
|
128
|
+
*/
|
129
|
+
_History.saveHash = function(newHash){
|
130
|
+
// Check Hash
|
131
|
+
if ( _History.isLastHash(newHash) ) {
|
132
|
+
return false;
|
133
|
+
}
|
134
|
+
|
135
|
+
// Push the Hash
|
136
|
+
_History.savedHashes.push(newHash);
|
137
|
+
|
138
|
+
// Return true
|
139
|
+
return true;
|
140
|
+
};
|
141
|
+
|
142
|
+
/**
|
143
|
+
* _History.getHashByIndex()
|
144
|
+
* Gets a hash by the index
|
145
|
+
* @param {integer} index
|
146
|
+
* @return {string}
|
147
|
+
*/
|
148
|
+
_History.getHashByIndex = function(index){
|
149
|
+
// Prepare
|
150
|
+
var hash = null;
|
151
|
+
|
152
|
+
// Handle
|
153
|
+
if ( typeof index === 'undefined' ) {
|
154
|
+
// Get the last inserted
|
155
|
+
hash = _History.savedHashes[_History.savedHashes.length-1];
|
156
|
+
}
|
157
|
+
else if ( index < 0 ) {
|
158
|
+
// Get from the end
|
159
|
+
hash = _History.savedHashes[_History.savedHashes.length+index];
|
160
|
+
}
|
161
|
+
else {
|
162
|
+
// Get from the beginning
|
163
|
+
hash = _History.savedHashes[index];
|
164
|
+
}
|
165
|
+
|
166
|
+
// Return hash
|
167
|
+
return hash;
|
168
|
+
};
|
169
|
+
|
170
|
+
/**
|
171
|
+
* _History.stateHashExists
|
172
|
+
* Checks if the State Hash Exists
|
173
|
+
* @param {string} stateHash
|
174
|
+
* @return {boolean} exists
|
175
|
+
*/
|
176
|
+
_History.stateHashExists = function(stateHash){
|
177
|
+
// Prepare
|
178
|
+
var exists = typeof _History.statesByHash[stateHash] !== 'undefined';
|
179
|
+
|
180
|
+
// Return exists
|
181
|
+
return exists;
|
182
|
+
};
|
183
|
+
|
184
|
+
// ----------------------------------------------------------------------
|
185
|
+
// Discarded States
|
186
|
+
|
187
|
+
/**
|
188
|
+
* _History.discardedHashes
|
189
|
+
* A hashed array of discarded hashes
|
190
|
+
*/
|
191
|
+
_History.discardedHashes = {};
|
192
|
+
|
193
|
+
/**
|
194
|
+
* _History.discardedStates
|
195
|
+
* A hashed array of discarded states
|
196
|
+
*/
|
197
|
+
_History.discardedStates = {};
|
198
|
+
|
199
|
+
/**
|
200
|
+
* _History.discardState(State)
|
201
|
+
* Discards the state by ignoring it through History
|
202
|
+
* @param {object} State
|
203
|
+
* @return {true}
|
204
|
+
*/
|
205
|
+
_History.discardState = function(discardedState,forwardState,backState){
|
206
|
+
History.debug('History.discardState',this,arguments);
|
207
|
+
// Prepare
|
208
|
+
var discardedStateHash = History.contractState(discardedState);
|
209
|
+
|
210
|
+
// Create Discard Object
|
211
|
+
var discardObject = {
|
212
|
+
'discardedState': discardedState,
|
213
|
+
'backState': backState,
|
214
|
+
'forwardState': forwardState
|
215
|
+
};
|
216
|
+
|
217
|
+
// Add to DiscardedStates
|
218
|
+
_History.discardedStates[discardedStateHash] = discardObject;
|
219
|
+
|
220
|
+
// Return true
|
221
|
+
return true;
|
222
|
+
};
|
223
|
+
|
224
|
+
/**
|
225
|
+
* _History.discardHash(hash)
|
226
|
+
* Discards the hash by ignoring it through History
|
227
|
+
* @param {string} hash
|
228
|
+
* @return {true}
|
229
|
+
*/
|
230
|
+
_History.discardHash = function(discardedHash,forwardState,backState){
|
231
|
+
History.debug('History.discardState',this,arguments);
|
232
|
+
// Create Discard Object
|
233
|
+
var discardObject = {
|
234
|
+
'discardedHash': discardedHash,
|
235
|
+
'backState': backState,
|
236
|
+
'forwardState': forwardState
|
237
|
+
};
|
238
|
+
|
239
|
+
// Add to discardedHash
|
240
|
+
_History.discardedHashes[discardedHash] = discardObject;
|
241
|
+
|
242
|
+
// Return true
|
243
|
+
return true;
|
244
|
+
};
|
245
|
+
|
246
|
+
/**
|
247
|
+
* _History.discardState(State)
|
248
|
+
* Checks to see if the state is discarded
|
249
|
+
* @param {object} State
|
250
|
+
* @return {bool}
|
251
|
+
*/
|
252
|
+
_History.discardedState = function(State){
|
253
|
+
// Prepare
|
254
|
+
var StateHash = History.contractState(State);
|
255
|
+
|
256
|
+
// Check
|
257
|
+
var discarded = _History.discardedStates[StateHash]||false;
|
258
|
+
|
259
|
+
// Return true
|
260
|
+
return discarded;
|
261
|
+
};
|
262
|
+
|
263
|
+
/**
|
264
|
+
* _History.discardedHash(hash)
|
265
|
+
* Checks to see if the state is discarded
|
266
|
+
* @param {string} State
|
267
|
+
* @return {bool}
|
268
|
+
*/
|
269
|
+
_History.discardedHash = function(hash){
|
270
|
+
// Check
|
271
|
+
var discarded = _History.discardedHashes[hash]||false;
|
272
|
+
|
273
|
+
// Return true
|
274
|
+
return discarded;
|
275
|
+
};
|
276
|
+
|
277
|
+
/**
|
278
|
+
* _History.recycleState(State)
|
279
|
+
* Allows a discarded state to be used again
|
280
|
+
* @param {object} data
|
281
|
+
* @param {string} title
|
282
|
+
* @param {string} url
|
283
|
+
* @return {true}
|
284
|
+
*/
|
285
|
+
_History.recycleState = function(State){
|
286
|
+
History.debug('History.recycleState',this,arguments);
|
287
|
+
// Prepare
|
288
|
+
var StateHash = History.contractState(State);
|
289
|
+
|
290
|
+
// Remove from DiscardedStates
|
291
|
+
if ( _History.discardedState(State) ) {
|
292
|
+
delete _History.discardedStates[StateHash];
|
293
|
+
}
|
294
|
+
|
295
|
+
// Return true
|
296
|
+
return true;
|
297
|
+
};
|
298
|
+
|
299
|
+
// ----------------------------------------------------------------------
|
300
|
+
// HTML4 HashChange Support
|
301
|
+
|
302
|
+
if ( History.emulated.hashChange ) {
|
303
|
+
/*
|
304
|
+
* We must emulate the HTML4 HashChange Support by manually checking for hash changes
|
305
|
+
*/
|
306
|
+
|
307
|
+
History.Adapter.onDomLoad(function(){
|
308
|
+
// Define our Checker Function
|
309
|
+
_History.checkerFunction = null;
|
310
|
+
|
311
|
+
// Handle depending on the browser
|
312
|
+
if ( _History.isInternetExplorer() ) {
|
313
|
+
// IE6 and IE7
|
314
|
+
// We need to use an iframe to emulate the back and forward buttons
|
315
|
+
|
316
|
+
// Create iFrame
|
317
|
+
var
|
318
|
+
iframeId = 'historyjs-iframe',
|
319
|
+
iframe = document.createElement('iframe');
|
320
|
+
|
321
|
+
// Adjust iFarme
|
322
|
+
iframe.setAttribute('id', iframeId);
|
323
|
+
iframe.style.display = 'none';
|
324
|
+
|
325
|
+
// Append iFrame
|
326
|
+
document.body.appendChild(iframe);
|
327
|
+
|
328
|
+
// Create initial history entry
|
329
|
+
iframe.contentWindow.document.open();
|
330
|
+
iframe.contentWindow.document.close();
|
331
|
+
|
332
|
+
// Define some variables that will help in our checker function
|
333
|
+
var
|
334
|
+
lastDocumentHash = null,
|
335
|
+
lastIframeHash = null,
|
336
|
+
checkerRunning = false;
|
337
|
+
|
338
|
+
// Define the checker function
|
339
|
+
_History.checkerFunction = function(){
|
340
|
+
// Check Running
|
341
|
+
if ( checkerRunning ) {
|
342
|
+
History.debug('hashchange.checker: checker is running');
|
343
|
+
return false;
|
344
|
+
}
|
345
|
+
|
346
|
+
// Update Running
|
347
|
+
checkerRunning = true;
|
348
|
+
|
349
|
+
// Fetch
|
350
|
+
var
|
351
|
+
documentHash = History.getHash(),
|
352
|
+
iframeHash = _History.unescapeHash(iframe.contentWindow.document.location.hash);
|
353
|
+
|
354
|
+
// The Document Hash has changed (application caused)
|
355
|
+
if ( documentHash !== lastDocumentHash ) {
|
356
|
+
// Equalise
|
357
|
+
lastDocumentHash = documentHash;
|
358
|
+
|
359
|
+
// Create a history entry in the iframe
|
360
|
+
if ( iframeHash !== documentHash ) {
|
361
|
+
History.debug('hashchange.checker: iframe hash change', 'documentHash (new):', documentHash, 'iframeHash (old):', iframeHash);
|
362
|
+
|
363
|
+
// Equalise
|
364
|
+
lastIframeHash = iframeHash = documentHash;
|
365
|
+
|
366
|
+
// Create History Entry
|
367
|
+
iframe.contentWindow.document.open();
|
368
|
+
iframe.contentWindow.document.close();
|
369
|
+
|
370
|
+
// Update the iframe's hash
|
371
|
+
iframe.contentWindow.document.location.hash = _History.escapeHash(documentHash);
|
372
|
+
}
|
373
|
+
|
374
|
+
// Trigger Hashchange Event
|
375
|
+
History.Adapter.trigger(window,'hashchange');
|
376
|
+
}
|
377
|
+
|
378
|
+
// The iFrame Hash has changed (back button caused)
|
379
|
+
else if ( iframeHash !== lastIframeHash ) {
|
380
|
+
History.debug('hashchange.checker: iframe hash out of sync', 'iframeHash (new):', iframeHash, 'documentHash (old):', documentHash);
|
381
|
+
|
382
|
+
// Equalise
|
383
|
+
lastIframeHash = iframeHash;
|
384
|
+
|
385
|
+
// Update the Hash
|
386
|
+
History.setHash(iframeHash,false);
|
387
|
+
}
|
388
|
+
|
389
|
+
// Reset Running
|
390
|
+
checkerRunning = false;
|
391
|
+
|
392
|
+
// Return true
|
393
|
+
return true;
|
394
|
+
};
|
395
|
+
}
|
396
|
+
else {
|
397
|
+
// We are not IE
|
398
|
+
// Firefox 1 or 2, Opera
|
399
|
+
|
400
|
+
// Define some variables that will help in our checker function
|
401
|
+
var
|
402
|
+
lastDocumentHash = null;
|
403
|
+
|
404
|
+
// Define the checker function
|
405
|
+
_History.checkerFunction = function(){
|
406
|
+
// Prepare
|
407
|
+
var documentHash = History.getHash();
|
408
|
+
|
409
|
+
// The Document Hash has changed (application caused)
|
410
|
+
if ( documentHash !== lastDocumentHash ) {
|
411
|
+
// Equalise
|
412
|
+
lastDocumentHash = documentHash;
|
413
|
+
|
414
|
+
// Trigger Hashchange Event
|
415
|
+
History.Adapter.trigger(window,'hashchange');
|
416
|
+
}
|
417
|
+
|
418
|
+
// Return true
|
419
|
+
return true;
|
420
|
+
};
|
421
|
+
}
|
422
|
+
|
423
|
+
// Apply the checker function
|
424
|
+
setInterval(_History.checkerFunction, History.options.hashChangeCheckerDelay);
|
425
|
+
|
426
|
+
// End onDomLoad closure
|
427
|
+
return true;
|
428
|
+
});
|
429
|
+
|
430
|
+
}
|
431
|
+
|
432
|
+
// ----------------------------------------------------------------------
|
433
|
+
// HTML5 State Support
|
434
|
+
|
435
|
+
if ( History.emulated.pushState ) {
|
436
|
+
/*
|
437
|
+
* We must emulate the HTML5 State Management by using HTML4 HashChange
|
438
|
+
*/
|
439
|
+
|
440
|
+
/**
|
441
|
+
* _History.onHashChange(event)
|
442
|
+
* Trigger HTML5's window.onpopstate via HTML4 HashChange Support
|
443
|
+
*/
|
444
|
+
_History.onHashChange = function(event){
|
445
|
+
History.debug('_History.onHashChange',this,arguments);
|
446
|
+
// Prepare
|
447
|
+
var
|
448
|
+
currentUrl = (event && event.newURL) || document.location.href;
|
449
|
+
currentHash = unescape(History.extractHashFromUrl(currentUrl)),
|
450
|
+
currentState = null,
|
451
|
+
currentStateHash = null,
|
452
|
+
currentStateHashExits = null;
|
453
|
+
|
454
|
+
// Check if we are the same state
|
455
|
+
if ( _History.isLastHash(currentHash) ) {
|
456
|
+
// There has been no change (just the page's hash has finally propagated)
|
457
|
+
History.debug('_History.onHashChange: no change');
|
458
|
+
History.busy(false);
|
459
|
+
return false;
|
460
|
+
}
|
461
|
+
|
462
|
+
// Store our location for use in detecting back/forward direction
|
463
|
+
_History.saveHash(currentHash);
|
464
|
+
|
465
|
+
// Expand Hash
|
466
|
+
currentState = History.expandHash(currentHash);
|
467
|
+
if ( !currentState ) {
|
468
|
+
// Traditional Anchor Hash
|
469
|
+
History.debug('_History.onHashChange: traditional anchor');
|
470
|
+
History.Adapter.trigger(window,'anchorchange');
|
471
|
+
History.busy(false);
|
472
|
+
return false;
|
473
|
+
}
|
474
|
+
|
475
|
+
// Check if we are the same state
|
476
|
+
if ( _History.isLastState(currentState) ) {
|
477
|
+
// There has been no change (just the page's hash has finally propagated)
|
478
|
+
History.debug('_History.onHashChange: no change');
|
479
|
+
History.busy(false);
|
480
|
+
return false;
|
481
|
+
}
|
482
|
+
|
483
|
+
// Create the state Hash
|
484
|
+
currentStateHash = History.contractState(currentState);
|
485
|
+
|
486
|
+
// Log
|
487
|
+
History.debug('_History.onHashChange: ',
|
488
|
+
'currentStateHash',
|
489
|
+
currentStateHash,
|
490
|
+
'Hash -1',
|
491
|
+
_History.getHashByIndex(-1),
|
492
|
+
'Hash -2',
|
493
|
+
_History.getHashByIndex(-2),
|
494
|
+
'Hash -3',
|
495
|
+
_History.getHashByIndex(-3),
|
496
|
+
'Hash -4',
|
497
|
+
_History.getHashByIndex(-4),
|
498
|
+
'Hash -5',
|
499
|
+
_History.getHashByIndex(-5),
|
500
|
+
'Hash -6',
|
501
|
+
_History.getHashByIndex(-6),
|
502
|
+
'Hash -7',
|
503
|
+
_History.getHashByIndex(-7)
|
504
|
+
);
|
505
|
+
|
506
|
+
// Check if we are DiscardedState
|
507
|
+
var discardObject = _History.discardedState(currentState);
|
508
|
+
if ( discardObject ) {
|
509
|
+
History.debug('forwardState:',History.contractState(discardObject.forwardState),'backState:',History.contractState(discardObject.backState));
|
510
|
+
// Ignore this state as it has been discarded and go back to the state before it
|
511
|
+
if ( _History.getHashByIndex(-2) === History.contractState(discardObject.forwardState) ) {
|
512
|
+
// We are going backwards
|
513
|
+
History.debug('_History.onHashChange: go backwards');
|
514
|
+
History.back(false);
|
515
|
+
} else {
|
516
|
+
// We are going forwards
|
517
|
+
History.debug('_History.onHashChange: go forwards');
|
518
|
+
History.forward(false);
|
519
|
+
}
|
520
|
+
History.busy(false);
|
521
|
+
return false;
|
522
|
+
}
|
523
|
+
|
524
|
+
// Push the new HTML5 State
|
525
|
+
History.debug('_History.onHashChange: success hashchange');
|
526
|
+
History.pushState(currentState.data,currentState.title,currentState.url,false);
|
527
|
+
|
528
|
+
// End onHashChange closure
|
529
|
+
return true;
|
530
|
+
};
|
531
|
+
History.Adapter.bind(window,'hashchange',_History.onHashChange);
|
532
|
+
|
533
|
+
/**
|
534
|
+
* History.pushState(data,title,url)
|
535
|
+
* Add a new State to the history object, become it, and trigger onpopstate
|
536
|
+
* We have to trigger for HTML4 compatibility
|
537
|
+
* @param {object} data
|
538
|
+
* @param {string} title
|
539
|
+
* @param {string} url
|
540
|
+
* @return {true}
|
541
|
+
*/
|
542
|
+
History.pushState = function(data,title,url,queue){
|
543
|
+
History.debug('History.pushState',this,arguments);
|
544
|
+
|
545
|
+
// Check the State
|
546
|
+
if ( History.extractHashFromUrl(url) ) {
|
547
|
+
throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
|
548
|
+
}
|
549
|
+
|
550
|
+
// Handle Queueing
|
551
|
+
if ( queue !== false && History.busy() ) {
|
552
|
+
// Wait + Push to Queue
|
553
|
+
History.debug('History.pushState: we must wait', arguments);
|
554
|
+
History.pushQueue({
|
555
|
+
scope: History,
|
556
|
+
callback: History.pushState,
|
557
|
+
args: arguments,
|
558
|
+
queue: queue
|
559
|
+
});
|
560
|
+
return false;
|
561
|
+
}
|
562
|
+
|
563
|
+
// Make Busy
|
564
|
+
History.busy(true);
|
565
|
+
|
566
|
+
// Fetch the State Object
|
567
|
+
var
|
568
|
+
newState = History.createStateObject(data,title,url),
|
569
|
+
newStateHash = History.contractState(newState),
|
570
|
+
oldState = History.getState(),
|
571
|
+
oldStateHash = History.getStateHash(),
|
572
|
+
html4Hash = unescape(History.getHash());
|
573
|
+
|
574
|
+
// Store the newState
|
575
|
+
_History.storeState(newState);
|
576
|
+
|
577
|
+
// Recycle the State
|
578
|
+
_History.recycleState(newState);
|
579
|
+
|
580
|
+
// Force update of the title
|
581
|
+
if ( document.title !== newState.title ) {
|
582
|
+
document.title = newState.title
|
583
|
+
try {
|
584
|
+
document.getElementsByTagName('title')[0].innerHTML = newState.title;
|
585
|
+
}
|
586
|
+
catch ( Exception ) { }
|
587
|
+
}
|
588
|
+
|
589
|
+
History.debug(
|
590
|
+
'History.pushState: details',
|
591
|
+
'newStateHash:', newStateHash,
|
592
|
+
'oldStateHash:', oldStateHash,
|
593
|
+
'html4Hash:', html4Hash
|
594
|
+
);
|
595
|
+
|
596
|
+
// Check if we are the same State
|
597
|
+
if ( newStateHash === oldStateHash ) {
|
598
|
+
History.debug('History.pushState: no change', newStateHash);
|
599
|
+
return false;
|
600
|
+
}
|
601
|
+
|
602
|
+
// Update HTML4 Hash
|
603
|
+
if ( newStateHash !== html4Hash ) {
|
604
|
+
History.debug('History.pushState: update hash', newStateHash);
|
605
|
+
History.setHash(newStateHash,false);
|
606
|
+
return false;
|
607
|
+
}
|
608
|
+
|
609
|
+
// Update HTML5 State
|
610
|
+
_History.saveState(newState);
|
611
|
+
|
612
|
+
// Fire HTML5 Event
|
613
|
+
History.debug('History.pushState: trigger popstate');
|
614
|
+
History.Adapter.trigger(window,'statechange');
|
615
|
+
History.busy(false);
|
616
|
+
|
617
|
+
// End pushState closure
|
618
|
+
return true;
|
619
|
+
};
|
620
|
+
|
621
|
+
/**
|
622
|
+
* History.replaceState(data,title,url)
|
623
|
+
* Replace the State and trigger onpopstate
|
624
|
+
* We have to trigger for HTML4 compatibility
|
625
|
+
* @param {object} data
|
626
|
+
* @param {string} title
|
627
|
+
* @param {string} url
|
628
|
+
* @return {true}
|
629
|
+
*/
|
630
|
+
History.replaceState = function(data,title,url,queue){
|
631
|
+
History.debug('History.replaceState',this,arguments);
|
632
|
+
// Check the State
|
633
|
+
if ( History.extractHashFromUrl(url) ) {
|
634
|
+
throw new Error('History.js does not support states with fragement-identifiers (hashes/anchors).');
|
635
|
+
}
|
636
|
+
|
637
|
+
// Handle Queueing
|
638
|
+
if ( queue !== false && History.busy() ) {
|
639
|
+
// Wait + Push to Queue
|
640
|
+
History.debug('History.replaceState: we must wait', arguments);
|
641
|
+
History.pushQueue({
|
642
|
+
scope: History,
|
643
|
+
callback: History.replaceState,
|
644
|
+
args: arguments,
|
645
|
+
queue: queue
|
646
|
+
});
|
647
|
+
return false;
|
648
|
+
}
|
649
|
+
|
650
|
+
// Make Busy
|
651
|
+
History.busy(true);
|
652
|
+
|
653
|
+
// Fetch the State Objects
|
654
|
+
var
|
655
|
+
newState = History.createStateObject(data,title,url),
|
656
|
+
oldState = History.getState(),
|
657
|
+
previousState = _History.getStateByIndex(-2)
|
658
|
+
|
659
|
+
// Discard Old State
|
660
|
+
_History.discardState(oldState,newState,previousState);
|
661
|
+
|
662
|
+
// Alias to PushState
|
663
|
+
History.pushState(newState.data,newState.title,newState.url,false);
|
664
|
+
|
665
|
+
// End replaceState closure
|
666
|
+
return true;
|
667
|
+
};
|
668
|
+
|
669
|
+
/**
|
670
|
+
* Ensure initial state is handled correctly
|
671
|
+
**/
|
672
|
+
if ( !document.location.hash || document.location.hash === '#' ) {
|
673
|
+
History.Adapter.onDomLoad(function(){
|
674
|
+
History.debug('Internet Explorer Initial State Change Fix');
|
675
|
+
var currentState = History.createStateObject({},'',document.location.href);
|
676
|
+
History.pushState(currentState.data,currentState.title,currentState.url);
|
677
|
+
});
|
678
|
+
} else if ( !History.emulated.hashChange ) {
|
679
|
+
History.debug('Firefox Initial State Change Fix');
|
680
|
+
History.Adapter.onDomLoad(function(){
|
681
|
+
_History.onHashChange();
|
682
|
+
});
|
683
|
+
}
|
684
|
+
}
|
685
|
+
}
|
686
|
+
|
687
|
+
// Try Load HTML4 Support
|
688
|
+
History.initHtml4();
|
689
|
+
|
690
|
+
})(window);
|