/ajaxify

Ajaxify your entire website instantly with this simple drop-in script using the HTML5 History API with History.js and jQuery ScrollTo.

Primary LanguageJavaScript

Copyright Info

Ajaxify v1.0.1 - 30 September, 2012 https://github.com/browserstate/ajaxify

Adapted by LI, Yu (liyu@clustertech.com)

Enhancement

  • Integrated solution framework for turning static pages into ajaxify pages. The jquery history & scrollto plugin is integrated.
  • Compatible with require.js.
  • Configurable options. (see usage)
  • Events support.
  • Build-in progress indicator support. (And configurable).
  • Intensively tested and bugs fixed.

Dependency

  • jquery.js
  • underscore.js

Build in lib

(check versions in the lib dir)

  • jquery.history.js

Usage

normally:

    <script src="jquery.min.js"></script>
    <script src="underscore-min.js"></script>
    <script>
      var ctAjaxify = {
        options: {
          // ...options...
        }
      };
    </script>
    <script src="ctAjaxify.min.js"></script>
    // now you can bind events like
    //   window.ctAjaxify.on(<event>, function() { ... });

if you want to disable this, just

    <html disableAjaxify>

Events

Bind events as

   window.ctAjaxify.on('event', func)

Event lists

  • ajaxifyLoadingBegin
  • ajaxifyAjaxBeforeSend param: [jqXHR, settings]
  • ajaxifyBeforeUpdateContent param: [contentHtml]
  • ajaxifyAfterUpdateContent
  • ajaxifyBeforeInsertScript param: [$newScriptNode, $originScriptNode]
  • ajaxifyLoadingEnd
  • ajaxifyStateChangeComplete
  • ajaxifyAjaxError param: [jqXHR, textStatus, errorThrown]

License

Same as original, licensed under the New BSD License