1
- /*! jquery.atwho - v1.4.0 %>
2
- * Copyright (c) 2016 chord.luo <[email protected] >;
3
- * homepage: http://ichord.github.com/At.js
4
- * Licensed MIT
5
- */
6
- ( function ( root , factory ) {
7
- if ( typeof define === 'function' && define . amd ) {
8
- // AMD. Register as an anonymous module unless amdModuleId is set
9
- define ( [ "jquery" ] , function ( a0 ) {
10
- return ( factory ( a0 ) ) ;
11
- } ) ;
12
- } else if ( typeof exports === 'object' ) {
13
- // Node. Does not work with strict CommonJS, but
14
- // only CommonJS-like environments that support module.exports,
15
- // like Node.
16
- module . exports = factory ( require ( "jquery" ) ) ;
17
- } else {
18
- factory ( jQuery ) ;
19
- }
20
- } ( this , function ( jquery ) {
21
-
22
- var $ , Api , App , Controller , DEFAULT_CALLBACKS , EditableController , KEY_CODE , Model , TextareaController , View ,
23
- slice = [ ] . slice ,
24
- extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ,
25
- hasProp = { } . hasOwnProperty ;
26
-
27
- $ = jquery ;
1
+ ( function ( factory ) {
2
+ if ( typeof define === 'function' && define . amd ) {
3
+ define ( [ 'jquery' ] , factory ) ;
4
+ } else if ( typeof exports === 'object' ) {
5
+ factory ( require ( 'jquery' ) ) ;
6
+ } else {
7
+ factory ( jQuery ) ;
8
+ }
9
+ } ( function ( $ ) {
10
+ var App ;
28
11
29
12
App = ( function ( ) {
30
13
function App ( inputor ) {
@@ -45,7 +28,7 @@ App = (function() {
45
28
} ;
46
29
47
30
App . prototype . setupRootElement = function ( iframe , asRoot ) {
48
- var error ;
31
+ var error , error1 ;
49
32
if ( asRoot == null ) {
50
33
asRoot = false ;
51
34
}
@@ -58,8 +41,8 @@ App = (function() {
58
41
this . window = this . document . defaultView || this . document . parentWindow ;
59
42
try {
60
43
this . iframe = this . window . frameElement ;
61
- } catch ( _error ) {
62
- error = _error ;
44
+ } catch ( error1 ) {
45
+ error = error1 ;
63
46
this . iframe = null ;
64
47
if ( $ . fn . atwho . debug ) {
65
48
throw new Error ( "iframe auto-discovery is failed.\nPlease use `setIframe` to set the target iframe manually.\n" + error ) ;
@@ -269,13 +252,16 @@ App = (function() {
269
252
270
253
} ) ( ) ;
271
254
255
+ var Controller ,
256
+ slice = [ ] . slice ;
257
+
272
258
Controller = ( function ( ) {
273
259
Controller . prototype . uid = function ( ) {
274
260
return ( Math . random ( ) . toString ( 16 ) + "000000000" ) . substr ( 2 , 8 ) + ( new Date ( ) . getTime ( ) ) ;
275
261
} ;
276
262
277
- function Controller ( app1 , at1 ) {
278
- this . app = app1 ;
263
+ function Controller ( app , at1 ) {
264
+ this . app = app ;
279
265
this . at = at1 ;
280
266
this . $inputor = this . app . $inputor ;
281
267
this . id = this . $inputor [ 0 ] . id || this . uid ( ) ;
@@ -305,12 +291,12 @@ Controller = (function() {
305
291
} ;
306
292
307
293
Controller . prototype . callDefault = function ( ) {
308
- var args , error , funcName ;
294
+ var args , error , error1 , funcName ;
309
295
funcName = arguments [ 0 ] , args = 2 <= arguments . length ? slice . call ( arguments , 1 ) : [ ] ;
310
296
try {
311
297
return DEFAULT_CALLBACKS [ funcName ] . apply ( this , args ) ;
312
- } catch ( _error ) {
313
- error = _error ;
298
+ } catch ( error1 ) {
299
+ error = error1 ;
314
300
return $ . error ( error + " Or maybe At.js doesn't have function " + funcName ) ;
315
301
}
316
302
} ;
@@ -331,11 +317,11 @@ Controller = (function() {
331
317
} ;
332
318
333
319
Controller . prototype . getOpt = function ( at , default_value ) {
334
- var e ;
320
+ var e , error1 ;
335
321
try {
336
322
return this . setting [ at ] ;
337
- } catch ( _error ) {
338
- e = _error ;
323
+ } catch ( error1 ) {
324
+ e = error1 ;
339
325
return null ;
340
326
}
341
327
} ;
@@ -452,6 +438,10 @@ Controller = (function() {
452
438
453
439
} ) ( ) ;
454
440
441
+ var TextareaController ,
442
+ extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ,
443
+ hasProp = { } . hasOwnProperty ;
444
+
455
445
TextareaController = ( function ( superClass ) {
456
446
extend ( TextareaController , superClass ) ;
457
447
@@ -530,6 +520,10 @@ TextareaController = (function(superClass) {
530
520
531
521
} ) ( Controller ) ;
532
522
523
+ var EditableController ,
524
+ extend = function ( child , parent ) { for ( var key in parent ) { if ( hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ,
525
+ hasProp = { } . hasOwnProperty ;
526
+
533
527
EditableController = ( function ( superClass ) {
534
528
extend ( EditableController , superClass ) ;
535
529
@@ -726,6 +720,8 @@ EditableController = (function(superClass) {
726
720
727
721
} ) ( Controller ) ;
728
722
723
+ var Model ;
724
+
729
725
Model = ( function ( ) {
730
726
function Model ( context ) {
731
727
this . context = context ;
@@ -790,6 +786,8 @@ Model = (function() {
790
786
791
787
} ) ( ) ;
792
788
789
+ var View ;
790
+
793
791
View = ( function ( ) {
794
792
function View ( context ) {
795
793
this . context = context ;
@@ -986,6 +984,8 @@ View = (function() {
986
984
987
985
} ) ( ) ;
988
986
987
+ var DEFAULT_CALLBACKS , KEY_CODE ;
988
+
989
989
KEY_CODE = {
990
990
DOWN : 40 ,
991
991
UP : 38 ,
@@ -1055,7 +1055,7 @@ DEFAULT_CALLBACKS = {
1055
1055
} ) ;
1056
1056
} ,
1057
1057
tplEval : function ( tpl , map ) {
1058
- var error , template ;
1058
+ var error , error1 , template ;
1059
1059
template = tpl ;
1060
1060
try {
1061
1061
if ( typeof tpl !== 'string' ) {
@@ -1064,8 +1064,8 @@ DEFAULT_CALLBACKS = {
1064
1064
return template . replace ( / \$ \{ ( [ ^ \} ] * ) \} / g, function ( tag , key , pos ) {
1065
1065
return map [ key ] ;
1066
1066
} ) ;
1067
- } catch ( _error ) {
1068
- error = _error ;
1067
+ } catch ( error1 ) {
1068
+ error = error1 ;
1069
1069
return "" ;
1070
1070
}
1071
1071
} ,
@@ -1088,6 +1088,8 @@ DEFAULT_CALLBACKS = {
1088
1088
afterMatchFailed : function ( at , el ) { }
1089
1089
} ;
1090
1090
1091
+ var Api ;
1092
+
1091
1093
Api = {
1092
1094
load : function ( at , data ) {
1093
1095
var c ;
@@ -1174,4 +1176,5 @@ $.fn.atwho["default"] = {
1174
1176
$ . fn . atwho . debug = false ;
1175
1177
1176
1178
1177
- } ) ) ;
1179
+ $ . fn . Jquery . atwho = Jquery . atwho ;
1180
+ } ) ) ;
0 commit comments