WebRoot/plugins/layui/modules/pjax.js

(开头部分) 26KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

//依赖layui.js

layui.define(['jquery'], function(exports) {
	var jQuery = layui.jquery;

	/*!
	 * Copyright 2012, Chris Wanstrath
	 * Released under the MIT License
	 * https://github.com/defunkt/jquery-pjax
	 */

	(function($) {

		// When called on a container with a selector, fetches the href with
		// ajax into the container or with the data-pjax attribute on the link
		// itself.
		//
		// Tries to make sure the back button and ctrl+click work the way
		// you'd expect.
		//
		// Exported as $.fn.pjax
		//
		// Accepts a jQuery ajax options object that may include these
		// pjax specific options:
		//
		//
		// container - Where to stick the response body. Usually a String selector.
		//             $(container).html(xhr.responseBody)
		//             (default: current jquery context)
		//      push - Whether to pushState the URL. Defaults to true (of course).
		//   replace - Want to use replaceState instead? That's cool.
		//
		// For convenience the second parameter can be either the container or
		// the options object.
		//
		// Returns the jQuery object
		function fnPjax(selector, container, options) {
			var context = this
			return this.on('click.pjax', selector, function(event) {
				var opts = $.extend({}, optionsFor(container, options))
				if(!opts.container)
					opts.container = $(this).attr('data-pjax') || context
				handleClick(event, opts)
			})
		}

		// Public: pjax on click handler
		//
		// Exported as $.pjax.click.
		//
		// event   - "click" jQuery.Event
		// options - pjax options
		//
		// Examples
		//
		//   $(document).on('click', 'a', $.pjax.click)
		//   // is the same as
		//   $(document).pjax('a')
		//
		//  $(document).on('click', 'a', function(event) {
后面还有 889 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。