看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: [Previous](@previous) | |
import Foundation | |
let originalList: [String] = ["a", "b", "c", "d", "e", "f", "g"] | |
let oldList: [String] = ["b", "c", "e", "g"] | |
let newList: [String] = ["a", "b", "d", "f", "g"] | |
func indexInOriginalList(forItem item: String) -> Int? { | |
return originalList.index(of: item) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Highcharts.chart('container', { | |
chart: { | |
type: 'spline' | |
}, | |
title: { | |
text: 'Solar Employment Growth by Sector, 2010-2016' | |
}, | |
subtitle: { | |
text: 'Source: thesolarfoundation.com' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"WorkMode": { | |
"value": "1" | |
}, | |
"WF": { | |
"extra": { | |
"Steps": "1", | |
"WF_ID": "750410", | |
"StepNum": "5" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var opt = { | |
api: "mtop.method", | |
param: { | |
friendid : "xxx" | |
} | |
}; | |
DA.alinkRequestMtopProxy(opt, function (resp) { | |
callback(resp.result); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $input = $('.search').val('query'); | |
var e = document.createEvent('HTMLEvents'); | |
e.initEvent('input', true, true); | |
$input[0].dispatchEvent(e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DA.loadPage = function(){ | |
var args = Array.from(arguments); | |
var gets = $.param(args[args.length-1]); | |
var basicPathName = location.pathname.match(/^\/\w+\//); | |
var subPathCache = ''; | |
for(var i=0,len=args.length-1; i<len; i++){ | |
subPathCache += args[i]; | |
} | |
var path = basicPathName + subPathCache + '?' + gets; | |
console.log(path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var escap = function(string) { | |
// If the string contains no control characters, replace the | |
// offending characterswith safe escape sequences. | |
var escapable = /[\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; | |
var meta = { // table of character substitutions | |
'\b' : '\\b', | |
'\t' : '\\t', | |
'\n' : '\\n', | |
'\f' : '\\f', | |
'\r' : '\\r', |