示例#1
2
文件: mapState.js 项目: PyBulls/OTM2
    init: function () {
        setStateAndPushToApp(getStateFromCurrentUrl());

        History.Adapter.bind(window, 'statechange', function() {
            setStateAndPushToApp(History.getState().data || getStateFromCurrentUrl());
        });
// We use the "History" library for "pushState" etc. capabilities on IE9.
// If we drop IE9 support we should change "History" to "history" in this
// module, and replace the above "bind" call with:
//        window.onpopstate = function(event) {
//            setStateAndPushToApp(event.state || getStateFromCurrentUrl());
//        };
    },
示例#2
0
        init = function(){
            $.expr[':'].external = function (a) {
                var PATTERN_FOR_EXTERNAL_URLS = /^\w+:\/\//;
                var href = $(a).attr('href');
                return href !== undefined &&
                    href.search(PATTERN_FOR_EXTERNAL_URLS) !== -1;
            };
            $.expr[':'].internal = function (a) {
                return $(a).attr('href') !== undefined && !$.expr[':'].external(a);
            };

            History.options.debug = false;

            History.Adapter.bind(window,'statechange',function(){
                finch.call(History.getState().hash);
            });
        };