├── .gitignore
├── README.md
├── adapters
└── angular
│ ├── adapter.js
│ ├── components
│ ├── modal.js
│ ├── user-card-form.html
│ └── user-card-form.js
│ └── directives.js
├── build
└── Gilgamesh.js
├── docs
└── pics
│ ├── Architecture.png
│ └── Explain-gm-import.png
├── index.html
├── libs
├── ajax.min.js
├── angular.min.js
├── jquery-1.11.1.min.js
├── jquery-only-alax.min.js
└── lodash.min.js
├── runner-angular.html
├── src
├── D.js
├── DataArray.js
├── DataObject.js
├── DataSource.js
├── Element.js
├── Gilgamesh.js
└── util.js
└── test
├── DataSource
├── action.js
├── define.js
└── get.js
└── data.json
/.gitignore:
--------------------------------------------------------------------------------
1 | ################################################
2 | ############### .gitignore ##################
3 | ################################################
4 | #
5 | # This file is only relevant if you are using git.
6 | #
7 | # Files which match the splat patterns below will
8 | # be ignored by git. This keeps random crap and
9 | # and sensitive credentials from being uploaded to
10 | # your repository. It allows you to configure your
11 | # app for your machine without accidentally
12 | # committing settings which will smash the local
13 | # settings of other developers on your team.
14 | #
15 | # Some reasonable defaults are included below,
16 | # but, of course, you should modify/extend/prune
17 | # to fit your needs!
18 | ################################################
19 |
20 |
21 |
22 |
23 | ################################################
24 | # Dependencies
25 | #
26 | # When releasing a production app, you may
27 | # consider including your node_modules and
28 | # bower_components directory in your git repo,
29 | # but during development, its best to exclude it,
30 | # since different developers may be working on
31 | # different kernels, where dependencies would
32 | # need to be recompiled anyway.
33 | #
34 | # More on that here about node_modules dir:
35 | # http://www.futurealoof.com/posts/nodemodules-in-git.html
36 | # (credit Mikeal Rogers, @mikeal)
37 | #
38 | # About bower_components dir, you can see this:
39 | # http://addyosmani.com/blog/checking-in-front-end-dependencies/
40 | # (credit Addy Osmani, @addyosmani)
41 | #
42 | ################################################
43 |
44 | node_modules
45 | bower_components
46 |
47 |
48 |
49 |
50 | ################################################
51 | # Sails.js / Waterline / Grunt
52 | #
53 | # Files generated by Sails and Grunt, or related
54 | # tasks and adapters.
55 | ################################################
56 | .tmp
57 | dump.rdb
58 |
59 |
60 |
61 |
62 |
63 | ################################################
64 | # Node.js / NPM
65 | #
66 | # Common files generated by Node, NPM, and the
67 | # related ecosystem.
68 | ################################################
69 | lib-cov
70 | *.seed
71 | *.log
72 | *.out
73 | *.pid
74 | npm-debug.log
75 |
76 |
77 |
78 |
79 |
80 | ################################################
81 | # Miscellaneous
82 | #
83 | # Common files generated by text editors,
84 | # operating systems, file systems, etc.
85 | ################################################
86 |
87 | *~
88 | *#
89 | .DS_STORE
90 | .netbeans
91 | nbproject
92 | .idea
93 | .node_history
94 | .editorconfig
95 | uploads
96 |
97 | modules
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Gilgamesh
2 |
3 | Gilgamesh is a collection of useful plugins and extensions of AngularJS( Polymer version is coming soon) to help you build modern web application.
4 | Run a local web server and browse to http://127.0.0.1/index.html to get start or checkout the [online demo](http://sskyy.github.io/Gilgamesh/).
5 |
6 | ## 1. Architecture
7 |
8 |
9 |
10 | ## 2. Usage
11 |
12 | ### 2.1 Data Source
13 |
14 | #### 2.1.1 Get a list
15 |
16 | ```
17 | D("user").get() //get user list
18 | D("user").get({name:"Gilgamesh"}) //get user list with parameters
19 | ```
20 |
21 | #### 2.1.2 Get a certain object
22 |
23 | ```
24 | //id can be replace by any name you defined as primary key
25 | D("user").get({id:1})
26 | D("user").get(1)
27 | ```
28 |
29 | #### 2.1.3 Create a new object and save it
30 |
31 | ```
32 | var newUser = D("user").new()
33 | newUser.name = "me"
34 | newUser.save()
35 | ```
36 |
37 | #### 2.1.4 Publish data with a name
38 |
39 | ```
40 | D("user").get(id).publish("global.user")
41 | D("user").receive("global.user")
42 | ```
43 |
44 | #### 2.1.5 Available data status and methods
45 |
46 | ```
47 | $$filled //is data filled from ajax data
48 | $$valid //need method validate implemented
49 | $$dirty //is data changed?
50 | $$empty //is data equal to undefined, null, or "".
51 | $$validating
52 | $$validated
53 | $$saving
54 | $$saved
55 | $$actions //map of current action status. example: {"saving":false,"saved":"true","deleting":true}
56 | ```
57 |
58 | ```
59 | .validate() //need to be validate manually
60 | .delete()
61 | .save()
62 | .watch("attribute", callback) //watch certain attribute
63 | .watch(callback) //watch object
64 | .notify() //manualy call watch callbacks
65 | ```
66 |
67 | #### 2.1.6 Execute actions
68 |
69 | Actions will generate `PUT` http request with url "/{id}/{action}". Example:
70 |
71 | ```
72 | D("user").get(id).action("doSomething")({/*parameters*/})
73 | ```
74 |
75 | Batch Actions example:
76 | ```
77 | D("user").get({name:"Gilgamesh"}.action("batchAction")(params).
78 |
79 | D("user").get({name:"Gilgamesh"}.filter("id",[ids]).action("batchAction")(params).
80 |
81 | //or you can use it via DataSource directly. The difference is that actions on
82 | //collection will change the status of current collection.
83 | D("user").action("batchAction")(params)
84 | ```
85 |
86 | #### 2.1.7 Overwrite an action
87 |
88 | ```
89 | D("user").action("doSomething",function( instanceOrCollections, params, dataSource ){
90 | //return setting to overwrite default ajax settings
91 | return {
92 | url : "/url",
93 | method : "POST",
94 | data : {}
95 | success : function( res ){
96 | dataSource.parse(res)
97 | }
98 | }
99 | })
100 | ```
101 |
102 |
103 | ### 2.2 Element
104 |
105 | #### 2.2.1 Use it with Data Source
106 |
107 |
108 |
109 | name :
110 | gender :
111 | save
112 |
113 |
114 | #### 2.2.2 Use template overwrite
115 |
116 | First, use `component` instead of `directive`:
117 |
118 | ```
119 | .component("userCardForm", function(){
120 | return {
121 | //require : "gmSource",
122 | priority : 98,
123 | template:
124 | ' '+
125 | ' '+
126 | ' '+
127 | '
'+
128 | ' save '
129 | link : function( $scope, $el, $attrs){
130 | console.log("watch $$saved")
131 | $scope.user.watch("$$saved", function( saved ){
132 | if( saved ){
133 | try{
134 | if($el.attr('onSubmit') ) (new Function( $el.attr('onSubmit')))()
135 | console.log( $el.attr('onSubmit'))
136 | console.log( "on submit", saved)
137 |
138 | }catch(e){
139 | console.log( e )
140 | }
141 | }
142 | })
143 | }
144 | }
145 | })
146 | ```
147 |
148 | Secondly, overwrite template with child element:
149 |
150 |
151 | name :
152 | gender :
153 |
save
154 |
saving : {{user.$$saving}}
155 |
saved : {{user.$$saved}}
156 |
157 |
158 | #### 2.2.3 Overwrite part of template
159 |
160 | As you may notice that a extra attribute `gm-role` was added to child element of directive `user-card-form`. We can do partial overwriting with `gm-tpl` set to `include`:
161 |
162 |
163 |
164 | only changed button
165 |
166 |
167 | What if you only want to exclude certain part? For instance, We can exlude the save button like:
168 |
169 |
170 |
171 | #### 2.2.4 Import child element from a directive
172 |
173 | Magic here, We can break the fence of html structure. Surpose we need to place the save button outside the `user-card-form` due to some insane reason, we simply do:
174 |
175 | save from outside
176 |
177 |
178 | `gm-import` is used to specify the id of which element you want to import from, and `gm-role` is used to identify the import part.
179 |
180 | #### 2.2.5 Import directive's scope
181 |
182 | In some cases interaction between directives requires a lot of api or event, and sharing scope would make it much easier. We cant still use `gm-import` to do that.
183 |
184 | {{user.name}}
185 |
186 |
187 | #### 2.2.6 Component extend
188 |
189 | Extending a exist component is easy:
190 |
191 | ```
192 | .component("userCardForm", function(){
193 | return {
194 | extend : "otherComponent",
195 | link : function( $scope, $el, $attrs){
196 | //parent link function will apply first
197 | }
198 | }
199 | })
200 | ```
201 |
202 | Waht happend in the background is that parent component link function will apply on the same scope and element. So public method or event listenner will be inherited.
203 |
204 | #### 2.2.7 Element event listener
205 |
206 | ```
207 | //HTML markup
208 |
209 |
210 |
211 | .component("userCardForm", function(){
212 | return {
213 | link : function( $scope, $el, $attrs){
214 | var e = new Event("submit")
215 | $el[0].dipatchEvent(e)
216 | }
217 | }
218 | })
219 | ```
220 |
221 | ## 3. Conventions
222 |
223 | ### 3.1 Expose api on element
224 |
225 | Api should be exposed on element.
226 |
227 | ### 3.2 Use gm-src on the right element
228 |
229 | We provided various ways like role-based element import for cases require scope or method sharing, please use it instead of lifting angular scope.
230 |
231 | ### 3.3 Invoke callbacks and trigger event like build-in element
232 |
233 | As title says, for example, implementing attribute `onSubmit` on a custom form would be the right way to invoke callback.
234 |
235 | ## 4. Demo
236 |
237 | ### 4.1 How to use a modal to wrap a form.
238 |
239 | **Directives**
240 |
241 | ```
242 | .component( "myModal", function(){
243 | return {
244 | link : function( $scope, $el, $attrs ){
245 | $el.css({/*your modal css*/})
246 |
247 | $el[0].open = function(){
248 | $el.show()
249 | }
250 |
251 | $el[0].hide = function(){
252 | console.log("closing")
253 | $el.hide()
254 | }
255 |
256 | $el.hide()
257 | }
258 | }
259 | })
260 | ```
261 |
262 | ```
263 | .component("userCardForm", function(){
264 | return {
265 | template:
266 | ''+
267 | ' '+
268 | ' '+
269 | '
'+
270 | 'save ',
271 | link : function( $scope, $el, $attrs){
272 | $scope.user.watch("$$saved", function( saved ){
273 | saved && $el.attr('onSubmit') ) && (new Function( $el.attr('onSubmit')))()
274 | })
275 | }
276 | }
277 | })
278 | ```
279 |
280 | **HTML**
281 |
282 | open modal
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 | save
292 |
293 |
294 |
295 |
296 | ### 4.2 A custom element explaining `gm-import`
297 |
298 |
299 |
300 | ## 5. Todo
301 |
302 | - [ ] Polymer support
303 | - [ ] React support
304 | - [x] Event system
--------------------------------------------------------------------------------
/adapters/angular/adapter.js:
--------------------------------------------------------------------------------
1 | (function(global){
2 |
3 | /*
4 | * tools
5 | */
6 |
7 | var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
8 | var FN_ARG_SPLIT = /,/;
9 | var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
10 | var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
11 |
12 | function annotate (fn) {
13 | var $inject = [];
14 | fn = fn.toString();
15 | var first = fn.replace(STRIP_COMMENTS, '');
16 | var second = first.match(FN_ARGS)[1];
17 | var third = second.split(FN_ARG_SPLIT);
18 | third.forEach(function (arg) {
19 | arg.replace(FN_ARG, function (all, underscore, name) {
20 | $inject.push(name);
21 | });
22 | });
23 | return $inject;
24 | }
25 |
26 | function replaceEmptyInnerHTML( $target, $source ){
27 | if( isEmptyInnerHTML($target) ){
28 | $target.innerHTML = $source.innerHTML
29 | }
30 | }
31 |
32 | function replaceSourceInnerHTML( $target, $source ){
33 | if( !isEmptyInnerHTML($source) ){
34 | $target.innerHTML = $source.innerHTML
35 | }
36 | }
37 |
38 | function isEmptyInnerHTML( el ){
39 | return /^\s*$/.test( el.innerHTML)
40 | }
41 |
42 | function replaceWith( toReplace, target){
43 | var parent = target.parentNode
44 | parent.replaceChild( toReplace, target)
45 | }
46 |
47 | function removeElement( el ){
48 | el.parentNode.removeChild(el)
49 | return el
50 | }
51 |
52 | function replaceInnerHTML( toReplace, target){
53 | target.innerHTML = toReplace.innerHTML
54 | }
55 |
56 | function mergeArray( target, source ){
57 | for( var i in source){
58 | if( target.indexOf( source[i]) == -1 ){
59 | target.push( source[i])
60 | }
61 | }
62 | return target
63 | }
64 |
65 | function mergeEl( target, source ){
66 | for( var i in source.attributes ){
67 | if( source.attributes[i].nodeName
68 | && target.getAttribute(source.attributes[i].nodeName) === null
69 | && source.attributes[i].nodeName !== "class"
70 | && source.attributes[i].nodeName !== "style" ){
71 |
72 |
73 | target.setAttribute(source.attributes[i].nodeName,source.attributes[i].value )
74 | }
75 | }
76 |
77 | target.className = mergeArray( target.className.split(" "), source.className.split(" ")).join(" ")
78 | return target
79 | }
80 |
81 | /*
82 | * compile overwrite
83 | */
84 |
85 | global._CACHE_ID = -1
86 | global._CACHE_ATTRIBUTE = "gm-child-cache-id"
87 | global._ORIGIN_ELEMENT_CACHE = {}
88 | global._GM_DIRECTIVE_NAMES = []
89 | global._CACHED_URL = {}
90 |
91 | angular.module("Gilgamesh",[])
92 | .config(["$compileProvider","$httpProvider",function( $compileProvider, $httpProvider){
93 |
94 | var $httpFactory = $httpProvider.$get[$httpProvider.$get.length -1]
95 |
96 | $httpProvider.$get[$httpProvider.$get.length -1] = function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector){
97 |
98 | var $http = $httpFactory($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector)
99 |
100 | var _get = $http.get
101 | $http.get = function(url, config){
102 | var promise = _get( url, config).then(function(res){
103 | var container
104 |
105 | if( !global._CACHED_URL[url] && /html?$/.test(url) ){
106 | container= $("
").append(res.data)[0]
107 |
108 | global._GM_DIRECTIVE_NAMES.forEach(function(name){
109 | angular.forEach( container.querySelectorAll("["+name.replace(/([A-Z])/g,"-$1").toLowerCase()+"]"), function( el ){
110 | if( el.getAttribute(global._CACHE_ATTRIBUTE) !== null ) return
111 | global._CACHE_ID++
112 | global._ORIGIN_ELEMENT_CACHE[global._CACHE_ID] = el
113 | el.setAttribute(global._CACHE_ATTRIBUTE,global._CACHE_ID)
114 | })
115 | })
116 |
117 | global._CACHED_URL[url] = container.innerHTML
118 | res.data = global._CACHED_URL[url]
119 | }
120 |
121 | return res
122 | })
123 |
124 | //overwrite
125 | promise.success = function( fn ){
126 | promise.then(function(response) {
127 | fn(response.data, response.status, response.headers, config);
128 | });
129 | return promise
130 | }
131 |
132 | promise.error = function( fn ){
133 | promise.then(null,function(response) {
134 | fn(response.data, response.status, response.headers, config);
135 | });
136 | return promise
137 | }
138 |
139 | return promise
140 | }
141 |
142 | return $http
143 | }
144 | }])
145 | .run(["$rootScope",function($rootScope){
146 | $rootScope.D = D
147 | $rootScope.E = E
148 | $rootScope.Ecall = function( id, method ){
149 | return E(id)[method]
150 | }
151 | }])
152 |
153 |
154 | /*
155 | * Directive overwrite
156 | */
157 |
158 | //gm directive map, used for extend
159 | var directives = {}
160 |
161 | var _module = angular.module
162 | angular.module = function(){
163 | var module = _module.apply( angular, arguments)
164 |
165 | module.component = function(name, directiveDef){
166 | var directiveDefArgs = annotate( directiveDef )
167 | global._GM_DIRECTIVE_NAMES.push(name)
168 |
169 |
170 | var replacedDirectiveDef = function(){
171 | var directive = directiveDef.apply( directiveDef, arguments)
172 |
173 | if( directive.template || directive.templateUrl ){
174 |
175 | //TODO add tag name support
176 | angular.forEach( document.querySelectorAll("["+name.replace(/([A-Z])/g,"-$1").toLowerCase()+"]"), function( el ){
177 | if( el.getAttribute(global._CACHE_ATTRIBUTE) !== null ) return
178 |
179 | global._CACHE_ID++
180 | global._ORIGIN_ELEMENT_CACHE[global._CACHE_ID] = el.cloneNode(true)
181 | el.setAttribute(global._CACHE_ATTRIBUTE,global._CACHE_ID)
182 | })
183 | }
184 |
185 | if( directive.compile ){
186 | directive.preCompile = directive.compile
187 | delete directive.compile
188 | }
189 | if( directive.transclude ) throw new Error("you cannot wrap a directive with transclude")
190 |
191 | //must init a scope
192 | if( !directive.scope ) directive.scope = true
193 | //deal with replace, we do manually replace
194 | directive._replace = directive.replace
195 | delete directive.replace
196 |
197 |
198 | directive.compile = function( $el ){
199 | var compilingImportEls = []
200 |
201 | //should only compile once and only compile with the one that has template
202 | if( $el[0].getAttribute("gm-tpl-overwrote") === null ) {
203 |
204 | if(directive.template || directive.templateUrl ){
205 | if( directive._replace){
206 | if( $el[0].childNodes.length >1 ){
207 | console.log("you have multiple child nodes in directive", name, "cannot replace")
208 | }else{
209 | mergeEl($el[0], $el[0].childNodes[0])
210 | $el[0].innerHTML = $el[0].childNodes[0].innerHTML
211 | }
212 | }
213 |
214 | var originEl = global._ORIGIN_ELEMENT_CACHE[$el[0].getAttribute(global._CACHE_ATTRIBUTE)]
215 | if( !originEl ){
216 | console.log("can't find",name,$el[0].getAttribute(global._CACHE_ATTRIBUTE))
217 | throw new Error("origin component's element not exist, can't replace template.")
218 | }else{
219 | //Caution!!! When using original element, must clone one to prevent origin template being overwrite
220 | originEl = originEl.cloneNode(true)
221 | }
222 | var compileElClone = $el[0].cloneNode(true)
223 | var totalOverwrite = !isEmptyInnerHTML(originEl)
224 |
225 | //only include particular child element
226 | if( originEl.getAttribute("gm-tpl-include") !== null ){
227 | totalOverwrite = false
228 | angular.forEach( originEl.childNodes, function( childEl ){
229 | if( !childEl.getAttribute ) return
230 | var roleEl = $el[0].querySelector("[gm-role="+ childEl.getAttribute("gm-role")+"]")
231 | if( roleEl ){
232 | replaceEmptyInnerHTML(childEl,roleEl )
233 | }
234 | $el[0].innerHTML = originEl.innerHTML
235 | })
236 | }
237 |
238 | //only overwrite particular element
239 | if( originEl.getAttribute('gm-tpl-partial') !==null ){
240 |
241 | totalOverwrite = false
242 | angular.forEach(originEl.childNodes,function(roleEl){
243 | //exclude text, comment and other node type
244 | if( !roleEl.getAttribute ) return
245 | var role = roleEl.getAttribute("gm-role")
246 |
247 | angular.forEach($el[0].querySelectorAll("[gm-role="+role+"]"),function( targetEl){
248 | replaceEmptyInnerHTML( roleEl, targetEl)
249 | mergeEl(roleEl,targetEl)
250 | replaceWith( roleEl, targetEl)
251 | })
252 | })
253 | }
254 |
255 |
256 | if( originEl.getAttribute('gm-tpl-exclude') !==null ){
257 | totalOverwrite = false
258 | $el[0].getAttribute('gm-tpl-exclude').split(",").forEach(function( roleToExclude){
259 |
260 | removeElement($el[0].querySelector("[gm-role="+roleToExclude+"]"))
261 | })
262 | }
263 |
264 | if( totalOverwrite ){
265 | $el[0].innerHTML = originEl.innerHTML
266 | }
267 | }
268 |
269 |
270 | //handle import with gm-role
271 | var id = $el[0].getAttribute("id")
272 | angular.forEach(document.querySelectorAll("[gm-import="+id+"]"),function(importEl){
273 | var tobeCompiledCloneEl
274 | var roleEl,roleName
275 |
276 | if( importEl.getAttribute("gm-from-role")!==null ){
277 | roleName = importEl.getAttribute("gm-from-role")
278 |
279 | roleEl = compileElClone.querySelector("[gm-role="+ roleName+"]")
280 | if( roleEl ){
281 |
282 | tobeCompiledCloneEl = roleEl.cloneNode(true)
283 | tobeCompiledCloneEl.setAttribute("gm-import",id)
284 | if( !isEmptyInnerHTML(importEl)){
285 | replaceInnerHTML(importEl, tobeCompiledCloneEl)
286 | }
287 |
288 | //attribute overwrite
289 | mergeEl(tobeCompiledCloneEl,importEl)
290 |
291 | }else{
292 | console.log("no such role",roleName,"in element", $el[0])
293 | }
294 |
295 | }else{
296 | tobeCompiledCloneEl = importEl.cloneNode(true)
297 | }
298 |
299 | $el[0].appendChild( tobeCompiledCloneEl )
300 | tobeCompiledCloneEl.setAttribute("gm-imported",importEl.getAttribute("gm-import"))
301 | tobeCompiledCloneEl.removeAttribute("gm-import")
302 |
303 |
304 | compilingImportEls.push([ importEl, tobeCompiledCloneEl ])
305 | })
306 |
307 | $el[0].setAttribute("gm-tpl-overwrote",true)
308 | }
309 |
310 | //---------------------
311 | return function link( $scope, $el, $attrs){
312 | //deal with imported elements
313 | if( compilingImportEls.length){
314 | window.setTimeout(function(){
315 | var resetEl
316 | while( resetEl = compilingImportEls.pop() ){
317 | replaceWith( resetEl[1],resetEl[0] )
318 | }
319 | },1)
320 | }
321 |
322 | //define magic attributes
323 | $scope.$$id = $el[0].id
324 |
325 | //deal with extend
326 | var ancestors = [],
327 | currentAncestor
328 | if( directive.extend ){
329 | if( !directives[directive.extend] ){
330 | console.log("parent gm directive not found", directive.extend)
331 | }else{
332 |
333 | currentAncestor = directive.extend
334 | while( currentAncestor ) {
335 | if( !directives[currentAncestor].ins){
336 | directives[currentAncestor].ins = angular.element(document).injector().invoke(directives[currentAncestor].def);
337 | }
338 | ancestors.push( directives[currentAncestor].ins )
339 | currentAncestor = directives[currentAncestor].ins.extend //string or undefined
340 | }
341 |
342 | //caution!!! we reused var currentAncestor
343 | while( currentAncestor = ancestors.pop()){
344 | currentAncestor.link.call(directive, $scope, $el, $attrs)
345 | }
346 | }
347 | }
348 |
349 | //deal with events
350 | if( $el[0].getAttribute("gm-linked") === null){
351 | angular.forEach( $el[0].attributes, function( attribute, i ){
352 | if( attribute.nodeName && /^(on|scope-on)-/.test(attribute.nodeName)){
353 | //Caution, we run callbacks on parent scope
354 | var event = attribute.nodeName.replace(/^(on|scope-on)-/,"")
355 | var handler = attribute.value
356 | $el[0].addEventListener(event, function(e){
357 | console.log("event",event,"apply ",attribute.nodeName)
358 | if( /^scope-on-/.test(attribute.nodeName) ){
359 | $scope.$parent.$eval(handler+"( $event)", {"$event":e})
360 | }else{
361 | (new Function('e',handler+".call(this,e)"))(e)
362 | }
363 | })
364 | }
365 | })
366 | }
367 |
368 | $el[0].getAttribute("gm-linked",true)
369 | return directive.link.call(directive, $scope, $el, $attrs)
370 | }
371 | }
372 |
373 | //trick angular to save the previous element
374 | directives[name].ins = directive
375 | return directive
376 | }
377 |
378 | //save it
379 | directives[name]= {
380 | def : directiveDef
381 | }
382 |
383 | replacedDirectiveDef.$inject = directiveDefArgs
384 | return module.directive( name, replacedDirectiveDef)
385 | }
386 |
387 | return module
388 | }
389 |
390 |
391 | //copy from angular source code
392 | function extend(dst) {
393 | var h = dst.$$hashKey;
394 | forEach(arguments, function(obj){
395 | if (obj !== dst) {
396 | forEach(obj, function(value, key){
397 | dst[key] = value;
398 | });
399 | }
400 | });
401 |
402 | setHashKey(dst,h);
403 | return dst;
404 | }
405 |
406 | function setHashKey(obj, h) {
407 | if (h) {
408 | obj.$$hashKey = h;
409 | }
410 | else {
411 | delete obj.$$hashKey;
412 | }
413 | }
414 |
415 |
416 |
417 |
418 | })(window||this)
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
--------------------------------------------------------------------------------
/adapters/angular/components/modal.js:
--------------------------------------------------------------------------------
1 | angular.module("demo")
2 | .component("modal",function(){
3 | return {
4 | restrict : "EA",
5 | link : function( $scope, $el){
6 | $el[0].open = function(){
7 | $el[0].style.display = "block"
8 | $el[0].dispatchEvent(new Event("open"))
9 | console.log("event fired")
10 | }
11 |
12 | $el[0].hide = function(){
13 | $el[0].style.display = "none"
14 | $el[0].dispatchEvent(new Event("hide"))
15 | }
16 |
17 | $el[0].hide()
18 | }
19 | }
20 | }).component("modalExtra",function(){
21 | return {
22 | restrict : "EA",
23 | extend : "modal",
24 | link : function($scope,$el){
25 | console.log($el[0])
26 | }
27 | }
28 | })
--------------------------------------------------------------------------------
/adapters/angular/components/user-card-form.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | save
6 | delete
7 | ally to
8 |
9 |
status:
10 |
11 |
12 | {{name}}:{{status}}
13 |
14 |
15 |
--------------------------------------------------------------------------------
/adapters/angular/components/user-card-form.js:
--------------------------------------------------------------------------------
1 | angular.module("demo",["Gilgamesh"])
2 | .component("userCardForm", function(){
3 | return {
4 | templateUrl : "/adapters/angular/components/user-card-form.html",
5 | link : function( $scope, $el){
6 |
7 | }
8 | }
9 | })
--------------------------------------------------------------------------------
/adapters/angular/directives.js:
--------------------------------------------------------------------------------
1 | angular.module("Gilgamesh")
2 | .component("gmData", function(){
3 | return {
4 | scope : true,
5 | priority:0,
6 | link : function( $scope, $el, $attrs){
7 | var tmp = $attrs['gmData'].split("as").map(function(r){ return r.replace(/\s/g,"")})
8 | var data = (new Function( "return " + tmp[0] ))()
9 | if( !data ){
10 | return console.log("failed to read data from dataSource as", tmp[1])
11 | }
12 | var alias = tmp[1]
13 | console.log("setting data", alias)
14 | $scope[alias] = data
15 | data.onStatus(function(v, o,obj){
16 | if( !$scope.$$phase ){
17 | $scope.$digest()
18 | }
19 | })
20 | }
21 | }
22 | })
23 | .directive("gmImport",function(){
24 | return {
25 | terminal : true,
26 | priority : 0
27 | }
28 | })
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/build/Gilgamesh.js:
--------------------------------------------------------------------------------
1 | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
65 |
66 |
67 |
68 | Gilgamesh
69 |
70 |
71 | Gilgamesh is a collection of useful plugins and extensions of AngularJS( Polymer version is coming soon)
72 | to help you build modern web application. This demo page only shows the magic of element extensions. For
73 | more information please visit
http://github.com/sskyy/Gilgamesh .
74 |
75 |
76 |
77 |
78 |
1. Original Component
79 |
80 | This is the basic component(directive) we will use to explain the features of Gilgamesh.
81 | You may notice that a new method named `component` is attached to angular. Consider it a `directive` decorator
82 | which is compatible with the origin directive usage, but with more functionality.
83 |
84 |
85 | angular.module("demo",["Gilgamesh"])
86 | .component("userCardForm", function(){
87 | return {
88 | templateUrl : "/Gilgamesh/adapters/angular/components/user-card-form.html",
89 | link : function( $scope, $el){
90 | }
91 | }
92 | })
93 |
94 |
95 |
96 |
97 |
98 |
99 | save
100 | delete
101 | ally to
102 |
103 |
status:
104 |
105 |
106 | {{name}}:{{status}}
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
117 |
118 |
119 |
120 |
2. Total Overwrite
121 |
122 | Using `component` enables you to overwrite template at runtime with simply add write what you want as child element.
123 |
124 |
125 |
126 | name :
127 | gender :
128 |
save also
129 |
save : {{user.$$actions.save}}
130 |
131 |
132 |
133 |
134 | name :
135 | gender :
136 |
save also
137 |
save : {{user.$$actions.save}}
138 |
139 |
140 |
141 |
142 |
143 |
144 |
3. Partial overwrite
145 |
146 | Sometime total overwrite is too verbose when you only want to change a small part of the original template.
147 | `gm-tpl-partial` and `gm-role` can save you from that. First, add `gm-role` to the part of which may be overwrite just
148 | like we did in the example component template above. Then add `gm-tpl-partial` to the element and use `gm-role` to specify
149 | which part you want to overwrite in the child element.
150 |
151 |
152 |
153 | only changed button
154 |
155 |
156 |
157 |
158 | only changed button
159 |
160 |
161 |
162 |
163 |
164 |
4. Partial include
165 |
166 | The combination of `gm-tpl-include` and `gm-role` is used to include particular part of template.
167 |
168 |
169 |
172 |
173 |
178 |
179 |
180 |
181 |
182 |
5. Partial Exclude
183 |
184 | `gm-tpl-exclude` is used to exclude part of the template.
185 |
186 |
187 | open modal
188 |
189 |
190 |
193 |
194 |
195 |
196 |
197 |
open modal
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
6. Import Elements
208 |
209 | This feature brings the reusability of component to the next level by breaking down the boundary of component with `gm-import` and `gm-from-role`.
210 | You can now use part of a component anywhere. Take a look the examples below to see how we import part of the basic component.
211 |
212 |
213 |
6.1 Import Scope
214 |
215 | Use the basic component to change user name and check out the result here.
216 |
217 |
218 | user.name:{{user.name}}
219 |
220 |
221 |
user.name:{{user.name}}
222 |
223 |
224 |
225 |
6.2 Import Role-Element
226 |
227 | Click the save button of the basic component and check out the result here.
228 |
229 |
230 |
231 |
232 |
235 |
236 |
6.3 Import Overwrote Role-Element
237 |
238 | Imported element can be overwrote as well.
239 | Click the save button of the basic component and check out the result here.
240 |
241 |
242 |
243 |
STATUS:
244 |
245 |
246 | {{name}}==={{status}}
247 |
248 |
249 |
250 |
251 |
252 |
253 |
STATUS:
254 |
255 |
256 | {{name}}==={{status}}
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
7. Event Listener
266 |
267 | Dealing with element event has never been easier than using Gilgamesh. Let the code speak for itself, only remember if you want
268 | use a scope method on as event listener, use `scope-on-` instead of `on-`.
269 |
270 |
271 | angular.module("demo")
272 | .component("modal",function(){
273 | return {
274 | link : function( $scope, $el){
275 | $el[0].open = function(){
276 | $el[0].style.display = "block"
277 | $el[0].dispatchEvent(new Event("open"))
278 | console.log("event fired")
279 | }
280 |
281 | $el[0].hide = function(){
282 | $el[0].dispatchEvent(new Event("hide"))
283 | }
284 |
285 | $el[0].hide()
286 | }
287 | }
288 | })
289 |
290 |
291 | open modal and trigger open event
292 |
293 |
294 | This modal has a listener on open event.
295 |
296 |
297 |
298 |
299 | open modal and trigger open event
300 |
301 |
302 | This modal has a listener on open event.
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
8. Component Inherit
312 |
313 | Component's behavior and public method can be inherit easily like code below:
314 |
315 |
316 | angular.module("demo")
317 | .component("modalExtra",function(){
318 | return {
319 | extend : 'modal',
320 | link : function( $scope, $el){
321 | //will automatically inherit modal's open method
322 | }
323 | }
324 | })
325 |
326 |
327 | open modal-extra and trigger open event
328 |
333 |
334 |
335 | open modal-extra and trigger open event
336 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
375 |
376 |
--------------------------------------------------------------------------------
/libs/ajax.min.js:
--------------------------------------------------------------------------------
1 | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o)<[^<]*)*<\/script>/gi,scriptTypeRE=/^(?:text|application)\/javascript/i,xmlTypeRE=/^(?:text|application)\/xml/i,jsonType="application/json",htmlType="text/html",blankRE=/^\s*$/;var ajax=module.exports=function(options){var settings=extend({},options||{});for(key in ajax.settings)if(settings[key]===undefined)settings[key]=ajax.settings[key];ajaxStart(settings);if(!settings.crossDomain)settings.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(settings.url)&&RegExp.$2!=window.location.host;var dataType=settings.dataType,hasPlaceholder=/=\?/.test(settings.url);if(dataType=="jsonp"||hasPlaceholder){if(!hasPlaceholder)settings.url=appendQuery(settings.url,"callback=?");return ajax.JSONP(settings)}if(!settings.url)settings.url=window.location.toString();serializeData(settings);var mime=settings.accepts[dataType],baseHeaders={},protocol=/^([\w-]+:)\/\//.test(settings.url)?RegExp.$1:window.location.protocol,xhr=ajax.settings.xhr(),abortTimeout;if(!settings.crossDomain)baseHeaders["X-Requested-With"]="XMLHttpRequest";if(mime){baseHeaders["Accept"]=mime;if(mime.indexOf(",")>-1)mime=mime.split(",",2)[0];xhr.overrideMimeType&&xhr.overrideMimeType(mime)}if(settings.contentType||settings.data&&settings.type.toUpperCase()!="GET")baseHeaders["Content-Type"]=settings.contentType||"application/x-www-form-urlencoded";settings.headers=extend(baseHeaders,settings.headers||{});xhr.onreadystatechange=function(){if(xhr.readyState==4){clearTimeout(abortTimeout);var result,error=false;if(xhr.status>=200&&xhr.status<300||xhr.status==304||xhr.status==0&&protocol=="file:"){dataType=dataType||mimeToDataType(xhr.getResponseHeader("content-type"));result=xhr.responseText;try{if(dataType=="script")(1,eval)(result);else if(dataType=="xml")result=xhr.responseXML;else if(dataType=="json")result=blankRE.test(result)?null:JSON.parse(result)}catch(e){error=e}if(error)ajaxError(error,"parsererror",xhr,settings);else ajaxSuccess(result,xhr,settings)}else{ajaxError(null,"error",xhr,settings)}}};var async="async"in settings?settings.async:true;xhr.open(settings.type,settings.url,async);for(name in settings.headers)xhr.setRequestHeader(name,settings.headers[name]);if(ajaxBeforeSend(xhr,settings)===false){xhr.abort();return false}if(settings.timeout>0)abortTimeout=setTimeout(function(){xhr.onreadystatechange=empty;xhr.abort();ajaxError(null,"timeout",xhr,settings)},settings.timeout);xhr.send(settings.data?settings.data:null);return xhr};function triggerAndReturn(context,eventName,data){return true}function triggerGlobal(settings,context,eventName,data){if(settings.global)return triggerAndReturn(context||document,eventName,data)}ajax.active=0;function ajaxStart(settings){if(settings.global&&ajax.active++===0)triggerGlobal(settings,null,"ajaxStart")}function ajaxStop(settings){if(settings.global&&!--ajax.active)triggerGlobal(settings,null,"ajaxStop")}function ajaxBeforeSend(xhr,settings){var context=settings.context;if(settings.beforeSend.call(context,xhr,settings)===false||triggerGlobal(settings,context,"ajaxBeforeSend",[xhr,settings])===false)return false;triggerGlobal(settings,context,"ajaxSend",[xhr,settings])}function ajaxSuccess(data,xhr,settings){var context=settings.context,status="success";settings.success.call(context,data,status,xhr);triggerGlobal(settings,context,"ajaxSuccess",[xhr,settings,data]);ajaxComplete(status,xhr,settings)}function ajaxError(error,type,xhr,settings){var context=settings.context;settings.error.call(context,xhr,type,error);triggerGlobal(settings,context,"ajaxError",[xhr,settings,error]);ajaxComplete(type,xhr,settings)}function ajaxComplete(status,xhr,settings){var context=settings.context;settings.complete.call(context,xhr,status);triggerGlobal(settings,context,"ajaxComplete",[xhr,settings]);ajaxStop(settings)}function empty(){}ajax.JSONP=function(options){if(!("type"in options))return ajax(options);var callbackName="jsonp"+ ++jsonpID,script=document.createElement("script"),abort=function(){if(callbackName in window)window[callbackName]=empty;ajaxComplete("abort",xhr,options)},xhr={abort:abort},abortTimeout,head=document.getElementsByTagName("head")[0]||document.documentElement;if(options.error)script.onerror=function(){xhr.abort();options.error()};window[callbackName]=function(data){clearTimeout(abortTimeout);delete window[callbackName];ajaxSuccess(data,xhr,options)};serializeData(options);script.src=options.url.replace(/=\?/,"="+callbackName);head.insertBefore(script,head.firstChild);if(options.timeout>0)abortTimeout=setTimeout(function(){xhr.abort();ajaxComplete("timeout",xhr,options)},options.timeout);return xhr};ajax.settings={type:"GET",beforeSend:empty,success:empty,error:empty,complete:empty,context:null,global:true,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript",json:jsonType,xml:"application/xml, text/xml",html:htmlType,text:"text/plain"},crossDomain:false,timeout:0};function mimeToDataType(mime){return mime&&(mime==htmlType?"html":mime==jsonType?"json":scriptTypeRE.test(mime)?"script":xmlTypeRE.test(mime)&&"xml")||"text"}function appendQuery(url,query){return(url+"&"+query).replace(/[&?]{1,2}/,"?")}function serializeData(options){if(type(options.data)==="object")options.data=param(options.data);if(options.data&&(!options.type||options.type.toUpperCase()=="GET"))options.url=appendQuery(options.url,options.data)}ajax.get=function(url,success){return ajax({url:url,success:success})};ajax.post=function(url,data,success,dataType){if(type(data)==="function")dataType=dataType||success,success=data,data=null;return ajax({type:"POST",url:url,data:data,success:success,dataType:dataType})};ajax.getJSON=function(url,success){return ajax({url:url,success:success,dataType:"json"})};var escape=encodeURIComponent;function serialize(params,obj,traditional,scope){var array=type(obj)==="array";for(var key in obj){var value=obj[key];if(scope)key=traditional?scope:scope+"["+(array?"":key)+"]";if(!scope&&array)params.add(value.name,value.value);else if(traditional?type(value)==="array":type(value)==="object")serialize(params,value,traditional,key);else params.add(key,value)}}function param(obj,traditional){var params=[];params.add=function(k,v){this.push(escape(k)+"="+escape(v))};serialize(params,obj,traditional);return params.join("&").replace("%20","+")}function extend(target){var slice=Array.prototype.slice;slice.call(arguments,1).forEach(function(source){for(key in source)if(source[key]!==undefined)target[key]=source[key]});return target}},{"type-of":2}],2:[function(require,module,exports){var toString=Object.prototype.toString;module.exports=function(val){switch(toString.call(val)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}if(val===null)return"null";if(val===undefined)return"undefined";if(val&&val.nodeType===1)return"element";if(val===Object(val))return"object";return typeof val}},{}]},{},[1]);
--------------------------------------------------------------------------------
/libs/jquery-only-alax.min.js:
--------------------------------------------------------------------------------
1 | /*! jQuery v3.0.0-pre -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/getStyles,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-dimensions,-offset,-deprecated,-event,-event/ajax,-event/alias,-event/support,-wrap | (c) jQuery Foundation | jquery.org/license */
2 | !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="3.0.0-pre -css,-css/addGetHookIf,-css/curCSS,-css/defaultDisplay,-css/hiddenVisibleSelectors,-css/support,-css/swap,-css/var/cssExpand,-css/var/getStyles,-css/var/isHidden,-css/var/rmargin,-css/var/rnumnonpx,-effects,-effects/Tween,-effects/animatedSelector,-dimensions,-offset,-deprecated,-event,-event/ajax,-event/alias,-event/support,-wrap",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!k.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b=d.createElement("script");b.text=a,d.head.appendChild(b).parentNode.removeChild(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d=0,e=a.length,f=s(a);if(c){if(f){for(;e>d;d++)if(b.apply(a[d],c)===!1)break}else for(d in a)if(b.apply(a[d],c)===!1)break}else if(f){for(;e>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e=0,g=a.length,h=s(a),i=[];if(h)for(;g>e;e++)d=b(a[e],e,c),null!=d&&i.push(d);else for(e in a)d=b(a[e],e,c),null!=d&&i.push(d);return f.apply([],i)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,ab=/'|\\/g,bb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),cb=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},db=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(eb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k&&11!==k)return[];if(p&&!e){if(11!==k&&(f=$.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ab,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=_.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(Q,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",db,!1):e.attachEvent&&e.attachEvent("onunload",db)),p=!f(g),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(g.getElementsByClassName),c.getById=ib(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(bb,cb);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(bb,cb);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(g.querySelectorAll))&&(ib(function(a){o.appendChild(a).innerHTML=" ",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ib(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(bb,cb),a[3]=(a[3]||a[4]||a[5]||"").replace(bb,cb),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(bb,cb).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return a=a.replace(bb,cb),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return V.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(bb,cb).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=ub(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(bb,cb),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(bb,cb),_.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,_.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML=" ","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML=" ",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return h.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,A=n.fn.init=function(a,b){var c,e;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return e=d.getElementById(c[2]),e&&(this.length=1,this[0]=e),this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?void 0!==y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(d);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?h.call(n(a),this[0]):h.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h&&(h=[],f=0),this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1)for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function I(){d.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===d.readyState?setTimeout(n.ready):(d.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)J(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+K.uid++}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/[A-Z]/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c
3 | }catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d;if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(d=n.camelCase(a),c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthx",l.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var S=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,T=/<([\w:]+)/,U=/<|?\w+;/,V=/<(?:script|style|link)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X=/^$|\/(?:java|ecma)script/i,Y=/^true\/(.*)/,Z=/^\s*\s*$/g,$={option:[1,""," "],thead:[1,""],col:[2,""],tr:[2,""],td:[3,""],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function ab(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function bb(a){var b=Y.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function cb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function db(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function eb(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function fb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&R.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=eb(h),f=eb(a),d=0,e=f.length;e>d;d++)fb(f[d],g[d]);if(b)if(c)for(f=f||eb(a),g=g||eb(h),d=0,e=f.length;e>d;d++)db(f[d],g[d]);else db(a,h);return g=eb(h,"script"),g.length>0&&cb(g,!i&&eb(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(U.test(e)){f=f||k.appendChild(b.createElement("div")),g=(T.exec(e)||["",""])[1].toLowerCase(),h=$[g]||$._default,f.innerHTML=h[1]+e.replace(S,"<$1>$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=eb(k.appendChild(e),"script"),i&&cb(f),c)){j=0;while(e=f[j++])X.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=_(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=_(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(eb(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&cb(eb(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(eb(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!V.test(a)&&!$[(T.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(S,"<$1>$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(eb(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(eb(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=f.apply([],a);var c,d,e,g,h,i,j=0,k=this.length,m=this,o=k-1,p=a[0],q=n.isFunction(p);if(q||k>1&&"string"==typeof p&&!l.checkClone&&W.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(k&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(e=n.map(eb(c,"script"),ab),g=e.length;k>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(e,eb(h,"script"))),b.call(this[j],h,j);if(g)for(i=e[e.length-1].ownerDocument,n.map(e,bb),j=0;g>j;j++)h=e[j],X.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(Z,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),f=e.length-1,h=0;f>=h;h++)c=h===f?this:this.clone(!0),n(e[h])[b](c),g.apply(d,c.get());return this.pushStack(d)}});var gb=d.documentElement;n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",l.checkOn=""!==a.value,l.optSelected=c.selected,b.disabled=!0,l.optDisabled=!c.disabled,a=d.createElement("input"),a.value="t",a.type="radio",l.radioValue="t"===a.value}();var hb,ib,jb=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?ib:hb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),ib={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=jb[b]||n.find.attr;jb[b]=function(a,b,d){var e,f;return d||(f=jb[b],jb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,jb[b]=f),e}});var kb=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||kb.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(lb," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(lb," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(void 0===a||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(lb," ").indexOf(b)>=0)return!0;return!1}});var mb=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(mb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){return n.trim(a.value)}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(l.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var nb=a.location,ob=n.now(),pb=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return(!c||c.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+b),c};var qb=/#.*$/,rb=/([?&])_=[^&]*/,sb=/^(.*?):[ \t]*([^\r\n]*)$/gm,tb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,ub=/^(?:GET|HEAD)$/,vb=/^\/\//,wb={},xb={},yb="*/".concat("*"),zb=d.createElement("a");zb.href=nb.href;function Ab(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Bb(a,b,c,d){var e={},f=a===xb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Cb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function Db(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Eb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:nb.href,type:"GET",isLocal:tb.test(nb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":yb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Cb(Cb(a,n.ajaxSettings),b):Cb(n.ajaxSettings,a)},ajaxPrefilter:Ab(wb),ajaxTransport:Ab(xb),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,e,f,g,h,i,j,k,l=n.ajaxSetup({},b),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!g){g={};while(b=sb.exec(f))g[b[1].toLowerCase()]=b[2]}b=g[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>u)for(b in a)r[b]=[r[b],a[b]];else w.always(a[w.status]);return this},abort:function(a){var b=a||v;return c&&c.abort(b),y(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((a||l.url||nb.href)+"").replace(qb,"").replace(vb,nb.protocol+"//"),l.type=b.method||b.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(E)||[""],null==l.crossDomain){i=d.createElement("a");try{i.href=l.url,i.href=i.href,l.crossDomain=zb.protocol+"//"+zb.host!=i.protocol+"//"+i.host}catch(x){l.crossDomain=!0}}if(l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Bb(wb,l,b,w),2===u)return w;j=n.event&&l.global,j&&0===n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!ub.test(l.type),e=l.url,l.hasContent||(l.data&&(e=l.url+=(pb.test(e)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=rb.test(e)?e.replace(rb,"$1_="+ob++):e+(pb.test(e)?"&":"?")+"_="+ob++)),l.ifModified&&(n.lastModified[e]&&w.setRequestHeader("If-Modified-Since",n.lastModified[e]),n.etag[e]&&w.setRequestHeader("If-None-Match",n.etag[e])),(l.data&&l.hasContent&&l.contentType!==!1||b.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+yb+"; q=0.01":""):l.accepts["*"]);for(k in l.headers)w.setRequestHeader(k,l.headers[k]);if(l.beforeSend&&(l.beforeSend.call(m,w,l)===!1||2===u))return w.abort();v="abort";for(k in{success:1,error:1,complete:1})w[k](l[k]);if(c=Bb(xb,l,b,w)){if(w.readyState=1,j&&o.trigger("ajaxSend",[w,l]),2===u)return w;l.async&&l.timeout>0&&(h=setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,c.send(s,y)}catch(x){if(!(2>u))throw x;y(-1,x)}}else y(-1,"No Transport");function y(a,b,d,g){var i,k,s,t,v,x=b;2!==u&&(u=2,h&&clearTimeout(h),c=void 0,f=g||"",w.readyState=a>0?4:0,i=a>=200&&300>a||304===a,d&&(t=Db(l,w,d)),t=Eb(l,t,w,i),i?(l.ifModified&&(v=w.getResponseHeader("Last-Modified"),v&&(n.lastModified[e]=v),v=w.getResponseHeader("etag"),v&&(n.etag[e]=v)),204===a||"HEAD"===l.type?x="nocontent":304===a?x="notmodified":(x=t.state,k=t.data,s=t.error,i=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),w.status=a,w.statusText=(b||x)+"",i?p.resolveWith(m,[k,x,w]):p.rejectWith(m,[w,x,s]),w.statusCode(r),r=void 0,j&&o.trigger(i?"ajaxSuccess":"ajaxError",[w,l,i?k:s]),q.fireWith(m,[w,x]),j&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})};var Fb=/%20/g,Gb=/\[\]$/,Hb=/\r?\n/g,Ib=/^(?:submit|button|image|reset|file)$/i,Jb=/^(?:input|select|textarea|keygen)/i;function Kb(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||Gb.test(a)?d(a,e):Kb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Kb(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Kb(c,a[c],b,e);return d.join("&").replace(Fb,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Jb.test(this.nodeName)&&!Ib.test(a)&&(this.checked||!R.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(Hb,"\r\n")}}):{name:b.name,value:c.replace(Hb,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Lb=0,Mb={},Nb={0:200,1223:204},Ob=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Mb)Mb[a]()}),l.cors=!!Ob&&"withCredentials"in Ob,l.ajax=Ob=!!Ob,n.ajaxTransport(function(a){var b;return l.cors||Ob&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Lb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Mb[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Nb[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Mb[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("-->
7 |
8 |
9 |
10 |
37 |
38 |
39 |
40 |
41 |
1. Original Directive
42 |
43 |
44 |
45 |
46 |
2. Total overwrite
47 |
48 | name :
49 | gender :
50 |
save also
51 |
save : {{user.$$actions.save}}
52 |
53 |
54 |
55 |
56 |
3. Only change save button
57 |
58 | only changed button
59 |
60 |
61 |
62 |
63 |
4. Only include status
64 |
67 |
68 |
69 |
70 |
71 |
5. Exclude save button in modal
72 |
open modal
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
6. Import elements
84 |
85 |
6.1 Import button
86 |
save for 1
87 |
88 |
6.2 Import scope
89 |
saving:{{user.$$actions.save}}
90 |
91 |
6.3 Import role
92 |
93 |
94 |
6.4 Import role with custom children
95 |
96 |
saving @ {{user.$$actions.save}}
97 |
98 |
99 |
100 |
101 |
102 |
7. Event listener
103 |
104 | open modal and trigger open event
105 |
106 |
107 |
108 | This modal has a listener on open event.
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |