pjax.js revision d54d5f031b212b560ff1ce52c10079cefc92b8a4
EVT_ERROR = 'error',
EVT_LOAD = 'load',
EVT_NAVIGATE = 'navigate';
function PjaxPlugin() {
}
// -- Lifecycle Methods ----------------------------------------------------
initializer: function () {
this._bindUI();
},
destructor: function () {
// Destroy the controller, but only if we own it.
}
},
// -- Public Prototype Methods ---------------------------------------------
context: this,
on: {
failure: this._onIOFailure,
success: this._onIOSuccess
},
});
if (this.get('scrollToTop')) {
// Scroll to the top of the page. The timeout ensures that the
// scroll happens after navigation begins, so that the current
// scroll position will be restored if the user clicks the back
// button.
setTimeout(function () {
}, 1);
}
},
// -- Protected Prototype Methods ------------------------------------------
_bindUI: function () {
this.get('linkSelector'), this);
}
},
_getContent: function (responseText) {
var content = {},
if (contentSelector) {
} else {
}
if (titleSelector) {
if (titleNode) {
}
}
return content;
},
// -- Protected Event Handlers ---------------------------------------------
// Shared by both the 'error' and 'load' events.
_defCompleteFn: function (e) {
}
}
},
_defNavigateFn: function (e) {
},
});
},
});
},
_onLinkClick: function (e) {
// Allow the native behavior on middle/right-click, or when Ctrl or
// Command are pressed.
e.preventDefault();
this.fire(EVT_NAVIGATE, {
originEvent: e,
});
}
}, {
NAME: 'pjax',
NS : 'pjax',
ATTRS: {
value: null
},
controller: {
valueFn: function () {
var controller = new Y.Controller();
// Put our mark on the controller so we know we own it and can
// destroy it if the plugin is destroyed.
controller._pjaxOwner = this;
return controller;
}
},
linkSelector: {
writeOnce: 'initOnly'
},
scrollToTop: {
value: true
},
value: 'title'
}
}
});
}, '3.5.0', {
requires: [
'classnamemanager', 'controller', 'io-base', 'node-base',
'node-pluginhost', 'node-event-delegate', 'plugin'
]
});