]>
git.proxmox.com Git - proxmox-widget-toolkit.git/blob - Utils.js
2 Ext
. ns ( 'Proxmox.Setup' );
4 if (! Ext
. isDefined ( Proxmox
. Setup
. auth_cookie_name
)) {
5 throw "Proxmox library not initialized" ;
8 // avoid errors related to Accessible Rich Internet Applications
9 // (access for people with disabilities)
10 // TODO reenable after all components are upgraded
11 Ext
. enableAria
= false ;
12 Ext
. enableAriaButtons
= false ;
13 Ext
. enableAriaPanels
= false ;
15 // avoid errors when running without development tools
16 if (! Ext
. isDefined ( Ext
. global
. console
)) {
23 Ext
. Ajax
. defaultHeaders
= {
24 'Accept' : 'application/json'
27 Ext
. Ajax
. on ( 'beforerequest' , function ( conn
, options
) {
28 if ( Proxmox
. CSRFPreventionToken
) {
29 if (! options
. headers
) {
32 options
. headers
. CSRFPreventionToken
= Proxmox
. CSRFPreventionToken
;
36 Ext
. define ( 'Proxmox.Utils' , { utilities
: {
38 // this singleton contains miscellaneous utilities
40 yesText
: gettext ( 'Yes' ),
41 noText
: gettext ( 'No' ),
42 enabledText
: gettext ( 'Enabled' ),
43 disabledText
: gettext ( 'Disabled' ),
44 noneText
: gettext ( 'none' ),
45 errorText
: gettext ( 'Error' ),
46 unknownText
: gettext ( 'Unknown' ),
47 defaultText
: gettext ( 'Default' ),
48 daysText
: gettext ( 'days' ),
49 dayText
: gettext ( 'day' ),
50 runningText
: gettext ( 'running' ),
51 stoppedText
: gettext ( 'stopped' ),
52 neverText
: gettext ( 'never' ),
53 totalText
: gettext ( 'Total' ),
54 usedText
: gettext ( 'Used' ),
55 directoryText
: gettext ( 'Directory' ),
56 stateText
: gettext ( 'State' ),
57 groupText
: gettext ( 'Group' ),
60 zh_CN
: 'Chinese (Simplified)' ,
61 zh_TW
: 'Chinese (Traditional)' ,
65 eu
: 'Euskera (Basque)' ,
71 nb
: 'Norwegian (Bokmal)' ,
72 nn
: 'Norwegian (Nynorsk)' ,
73 fa
: 'Persian (Farsi)' ,
75 pt_BR
: 'Portuguese (Brazil)' ,
82 render_language : function ( value
) {
84 return Proxmox
. Utils
. defaultText
+ ' (English)' ;
86 var text
= Proxmox
. Utils
. language_map
[ value
];
88 return text
+ ' (' + value
+ ')' ;
93 language_array : function () {
94 var data
= [[ '__default__' , Proxmox
. Utils
. render_language ( '' )]];
95 Ext
. Object
. each ( Proxmox
. Utils
. language_map
, function ( key
, value
) {
96 data
. push ([ key
, Proxmox
. Utils
. render_language ( value
)]);
102 bond_mode_gettext_map
: {
103 '802.3ad' : 'LACP (802.3ad)' ,
104 'lacp-balance-slb' : 'LACP (balance-slb)' ,
105 'lacp-balance-tcp' : 'LACP (balance-tcp)' ,
108 render_bond_mode : function ( value
) {
109 var val
= Proxmox
. Utils
. bond_mode_gettext_map
[ value
];
116 bond_mode_array : function ( modes
) {
117 return modes
. map ( mode
=> [ mode
, Proxmox
. Utils
. render_bond_mode ( mode
)]);
120 getNoSubKeyHtml : function ( url
) {
121 // url http://www.proxmox.com/products/proxmox-ve/subscription-service-plans
122 return Ext
. String
. format ( 'You do not have a valid subscription for this server. Please visit <a target="_blank" href="{0}">www.proxmox.com</a> to get a list of available options.' , url
|| 'https://www.proxmox.com' );
125 format_boolean_with_default : function ( value
) {
126 if ( Ext
. isDefined ( value
) && value
!== '__default__' ) {
127 return value
? Proxmox
. Utils
. yesText
: Proxmox
. Utils
. noText
;
129 return Proxmox
. Utils
. defaultText
;
132 format_boolean : function ( value
) {
133 return value
? Proxmox
. Utils
. yesText
: Proxmox
. Utils
. noText
;
136 format_neg_boolean : function ( value
) {
137 return ! value
? Proxmox
. Utils
. yesText
: Proxmox
. Utils
. noText
;
140 format_enabled_toggle : function ( value
) {
141 return value
? Proxmox
. Utils
. enabledText
: Proxmox
. Utils
. disabledText
;
144 format_expire : function ( date
) {
146 return Proxmox
. Utils
. neverText
;
148 return Ext
. Date
. format ( date
, "Y-m-d" );
151 format_duration_long : function ( ut
) {
153 var days
= Math
. floor ( ut
/ 86400 );
155 var hours
= Math
. floor ( ut
/ 3600 );
157 var mins
= Math
. floor ( ut
/ 60 );
160 var hours_str
= '00' + hours
. toString ();
161 hours_str
= hours_str
. substr ( hours_str
. length
- 2 );
162 var mins_str
= "00" + mins
. toString ();
163 mins_str
= mins_str
. substr ( mins_str
. length
- 2 );
164 var ut_str
= "00" + ut
. toString ();
165 ut_str
= ut_str
. substr ( ut_str
. length
- 2 );
168 var ds
= days
> 1 ? Proxmox
. Utils
. daysText
: Proxmox
. Utils
. dayText
;
169 return days
. toString () + ' ' + ds
+ ' ' +
170 hours_str
+ ':' + mins_str
+ ':' + ut_str
;
172 return hours_str
+ ':' + mins_str
+ ':' + ut_str
;
176 format_subscription_level : function ( level
) {
179 } else if ( level
=== 'b' ) {
181 } else if ( level
=== 's' ) {
183 } else if ( level
=== 'p' ) {
186 return Proxmox
. Utils
. noneText
;
190 compute_min_label_width : function ( text
, width
) {
192 if ( width
=== undefined ) { width
= 100 ; }
194 var tm
= new Ext
. util
. TextMetrics ();
195 var min
= tm
. getWidth ( text
+ ':' );
197 return min
< width
? width
: min
;
200 setAuthData : function ( data
) {
201 Proxmox
. CSRFPreventionToken
= data
. CSRFPreventionToken
;
202 Proxmox
. UserName
= data
. username
;
203 Proxmox
. LoggedOut
= data
. LoggedOut
;
204 // creates a session cookie (expire = null)
205 // that way the cookie gets deleted after the browser window is closed
206 Ext
. util
. Cookies
. set ( Proxmox
. Setup
. auth_cookie_name
, data
. ticket
, null , '/' , null , true );
210 if ( Proxmox
. LoggedOut
) {
213 return ( Proxmox
. UserName
!== '' ) && Ext
. util
. Cookies
. get ( Proxmox
. Setup
. auth_cookie_name
);
216 authClear : function () {
217 if ( Proxmox
. LoggedOut
) {
220 Ext
. util
. Cookies
. clear ( Proxmox
. Setup
. auth_cookie_name
);
223 // comp.setLoading() is buggy in ExtJS 4.0.7, so we
224 // use el.mask() instead
225 setErrorMask : function ( comp
, msg
) {
234 el
. mask ( gettext ( "Loading..." ));
241 monStoreErrors : function ( me
, store
, clearMaskBeforeLoad
) {
242 if ( clearMaskBeforeLoad
) {
243 me
. mon ( store
, 'beforeload' , function ( s
, operation
, eOpts
) {
244 Proxmox
. Utils
. setErrorMask ( me
, false );
247 me
. mon ( store
, 'beforeload' , function ( s
, operation
, eOpts
) {
249 me
. loadCount
= 0 ; // make sure it is numeric
250 Proxmox
. Utils
. setErrorMask ( me
, true );
255 // only works with 'proxmox' proxy
256 me
. mon ( store
. proxy
, 'afterload' , function ( proxy
, request
, success
) {
260 Proxmox
. Utils
. setErrorMask ( me
, false );
265 /*jslint nomen: true */
266 var operation
= request
. _operation
;
267 var error
= operation
. getError ();
268 if ( error
. statusText
) {
269 msg
= error
. statusText
+ ' (' + error
. status
+ ')' ;
271 msg
= gettext ( 'Connection error' );
273 Proxmox
. Utils
. setErrorMask ( me
, msg
);
277 extractRequestError : function ( result
, verbose
) {
278 var msg
= gettext ( 'Successful' );
280 if (! result
. success
) {
281 msg
= gettext ( "Unknown error" );
282 if ( result
. message
) {
283 msg
= result
. message
;
285 msg
+= ' (' + result
. status
+ ')' ;
288 if ( verbose
&& Ext
. isObject ( result
. errors
)) {
290 Ext
. Object
. each ( result
. errors
, function ( prop
, desc
) {
291 msg
+= "<br><b>" + Ext
. htmlEncode ( prop
) + "</b>: " +
292 Ext
. htmlEncode ( desc
);
301 API2Request : function ( reqOpts
) {
303 var newopts
= Ext
. apply ({
304 waitMsg
: gettext ( 'Please wait...' )
307 if (! newopts
. url
. match ( /^\/api2/ )) {
308 newopts
. url
= '/api2/extjs' + newopts
. url
;
310 delete newopts
. callback
;
312 var createWrapper = function ( successFn
, callbackFn
, failureFn
) {
314 success : function ( response
, options
) {
315 if ( options
. waitMsgTarget
) {
316 if ( Proxmox
. Utils
. toolkit
=== 'touch' ) {
317 options
. waitMsgTarget
. setMasked ( false );
319 options
. waitMsgTarget
. setLoading ( false );
322 var result
= Ext
. decode ( response
. responseText
);
323 response
. result
= result
;
324 if (! result
. success
) {
325 response
. htmlStatus
= Proxmox
. Utils
. extractRequestError ( result
, true );
326 Ext
. callback ( callbackFn
, options
. scope
, [ options
, false , response
]);
327 Ext
. callback ( failureFn
, options
. scope
, [ response
, options
]);
330 Ext
. callback ( callbackFn
, options
. scope
, [ options
, true , response
]);
331 Ext
. callback ( successFn
, options
. scope
, [ response
, options
]);
333 failure : function ( response
, options
) {
334 if ( options
. waitMsgTarget
) {
335 if ( Proxmox
. Utils
. toolkit
=== 'touch' ) {
336 options
. waitMsgTarget
. setMasked ( false );
338 options
. waitMsgTarget
. setLoading ( false );
341 response
. result
= {};
343 response
. result
= Ext
. decode ( response
. responseText
);
345 var msg
= gettext ( 'Connection error' ) + ' - server offline?' ;
346 if ( response
. aborted
) {
347 msg
= gettext ( 'Connection error' ) + ' - aborted.' ;
348 } else if ( response
. timedout
) {
349 msg
= gettext ( 'Connection error' ) + ' - Timeout.' ;
350 } else if ( response
. status
&& response
. statusText
) {
351 msg
= gettext ( 'Connection error' ) + ' ' + response
. status
+ ': ' + response
. statusText
;
353 response
. htmlStatus
= msg
;
354 Ext
. callback ( callbackFn
, options
. scope
, [ options
, false , response
]);
355 Ext
. callback ( failureFn
, options
. scope
, [ response
, options
]);
360 createWrapper ( reqOpts
. success
, reqOpts
. callback
, reqOpts
. failure
);
362 var target
= newopts
. waitMsgTarget
;
364 if ( Proxmox
. Utils
. toolkit
=== 'touch' ) {
365 target
. setMasked ({ xtype
: 'loadmask' , message
: newopts
. waitMsg
} );
367 // Note: ExtJS bug - this does not work when component is not rendered
368 target
. setLoading ( newopts
. waitMsg
);
371 Ext
. Ajax
. request ( newopts
);
374 checked_command : function ( orig_cmd
) {
375 Proxmox
. Utils
. API2Request ({
376 url
: '/nodes/localhost/subscription' ,
379 failure : function ( response
, opts
) {
380 Ext
. Msg
. alert ( gettext ( 'Error' ), response
. htmlStatus
);
382 success : function ( response
, opts
) {
383 var data
= response
. result
. data
;
385 if ( data
. status
!== 'Active' ) {
387 title
: gettext ( 'No valid subscription' ),
388 icon
: Ext
. Msg
. WARNING
,
389 msg
: Proxmox
. Utils
. getNoSubKeyHtml ( data
. url
),
391 callback : function ( btn
) {
405 assemble_field_data : function ( values
, data
) {
406 if ( Ext
. isObject ( data
)) {
407 Ext
. Object
. each ( data
, function ( name
, val
) {
408 if ( values
. hasOwnProperty ( name
)) {
409 var bucket
= values
[ name
];
410 if (! Ext
. isArray ( bucket
)) {
411 bucket
= values
[ name
] = [ bucket
];
413 if ( Ext
. isArray ( val
)) {
414 values
[ name
] = bucket
. concat ( val
);
425 dialog_title : function ( subject
, create
, isAdd
) {
428 return gettext ( 'Add' ) + ': ' + subject
;
430 return gettext ( 'Create' ) + ': ' + subject
;
433 return gettext ( 'Edit' ) + ': ' + subject
;
437 network_iface_types
: {
438 eth
: gettext ( "Network Device" ),
439 bridge
: 'Linux Bridge' ,
442 OVSBridge
: 'OVS Bridge' ,
445 OVSIntPort
: 'OVS IntPort'
448 render_network_iface_type : function ( value
) {
449 return Proxmox
. Utils
. network_iface_types
[ value
] ||
450 Proxmox
. Utils
. unknownText
;
454 acmenewcert
: [ 'SRV' , gettext ( 'Order Certificate' ) ],
455 acmeregister
: [ 'ACME Account' , gettext ( 'Register' ) ],
456 acmedeactivate
: [ 'ACME Account' , gettext ( 'Deactivate' ) ],
457 acmeupdate
: [ 'ACME Account' , gettext ( 'Update' ) ],
458 acmerefresh
: [ 'ACME Account' , gettext ( 'Refresh' ) ],
459 acmerenew
: [ 'SRV' , gettext ( 'Renew Certificate' ) ],
460 acmerevoke
: [ 'SRV' , gettext ( 'Revoke Certificate' ) ],
461 'move_volume' : [ 'CT' , gettext ( 'Move Volume' ) ],
462 clustercreate
: [ '' , gettext ( 'Create Cluster' ) ],
463 clusterjoin
: [ '' , gettext ( 'Join Cluster' ) ],
464 diskinit
: [ 'Disk' , gettext ( 'Initialize Disk with GPT' ) ],
465 vncproxy
: [ 'VM/CT' , gettext ( 'Console' ) ],
466 spiceproxy
: [ 'VM/CT' , gettext ( 'Console' ) + ' (Spice)' ],
467 vncshell
: [ '' , gettext ( 'Shell' ) ],
468 spiceshell
: [ '' , gettext ( 'Shell' ) + ' (Spice)' ],
469 qmsnapshot
: [ 'VM' , gettext ( 'Snapshot' ) ],
470 qmrollback
: [ 'VM' , gettext ( 'Rollback' ) ],
471 qmdelsnapshot
: [ 'VM' , gettext ( 'Delete Snapshot' ) ],
472 qmcreate
: [ 'VM' , gettext ( 'Create' ) ],
473 qmrestore
: [ 'VM' , gettext ( 'Restore' ) ],
474 qmdestroy
: [ 'VM' , gettext ( 'Destroy' ) ],
475 qmigrate
: [ 'VM' , gettext ( 'Migrate' ) ],
476 qmclone
: [ 'VM' , gettext ( 'Clone' ) ],
477 qmmove
: [ 'VM' , gettext ( 'Move disk' ) ],
478 qmtemplate
: [ 'VM' , gettext ( 'Convert to template' ) ],
479 qmstart
: [ 'VM' , gettext ( 'Start' ) ],
480 qmstop
: [ 'VM' , gettext ( 'Stop' ) ],
481 qmreset
: [ 'VM' , gettext ( 'Reset' ) ],
482 qmshutdown
: [ 'VM' , gettext ( 'Shutdown' ) ],
483 qmsuspend
: [ 'VM' , gettext ( 'Hibernate' ) ],
484 qmpause
: [ 'VM' , gettext ( 'Pause' ) ],
485 qmresume
: [ 'VM' , gettext ( 'Resume' ) ],
486 qmconfig
: [ 'VM' , gettext ( 'Configure' ) ],
487 vzsnapshot
: [ 'CT' , gettext ( 'Snapshot' ) ],
488 vzrollback
: [ 'CT' , gettext ( 'Rollback' ) ],
489 vzdelsnapshot
: [ 'CT' , gettext ( 'Delete Snapshot' ) ],
490 vzcreate
: [ 'CT' , gettext ( 'Create' ) ],
491 vzrestore
: [ 'CT' , gettext ( 'Restore' ) ],
492 vzdestroy
: [ 'CT' , gettext ( 'Destroy' ) ],
493 vzmigrate
: [ 'CT' , gettext ( 'Migrate' ) ],
494 vzclone
: [ 'CT' , gettext ( 'Clone' ) ],
495 vztemplate
: [ 'CT' , gettext ( 'Convert to template' ) ],
496 vzstart
: [ 'CT' , gettext ( 'Start' ) ],
497 vzstop
: [ 'CT' , gettext ( 'Stop' ) ],
498 vzmount
: [ 'CT' , gettext ( 'Mount' ) ],
499 vzumount
: [ 'CT' , gettext ( 'Unmount' ) ],
500 vzshutdown
: [ 'CT' , gettext ( 'Shutdown' ) ],
501 vzsuspend
: [ 'CT' , gettext ( 'Suspend' ) ],
502 vzresume
: [ 'CT' , gettext ( 'Resume' ) ],
503 hamigrate
: [ 'HA' , gettext ( 'Migrate' ) ],
504 hastart
: [ 'HA' , gettext ( 'Start' ) ],
505 hastop
: [ 'HA' , gettext ( 'Stop' ) ],
506 srvstart
: [ 'SRV' , gettext ( 'Start' ) ],
507 srvstop
: [ 'SRV' , gettext ( 'Stop' ) ],
508 srvrestart
: [ 'SRV' , gettext ( 'Restart' ) ],
509 srvreload
: [ 'SRV' , gettext ( 'Reload' ) ],
510 cephcreatemgr
: [ 'Ceph Manager' , gettext ( 'Create' ) ],
511 cephdestroymgr
: [ 'Ceph Manager' , gettext ( 'Destroy' ) ],
512 cephcreatemon
: [ 'Ceph Monitor' , gettext ( 'Create' ) ],
513 cephdestroymon
: [ 'Ceph Monitor' , gettext ( 'Destroy' ) ],
514 cephcreateosd
: [ 'Ceph OSD' , gettext ( 'Create' ) ],
515 cephdestroyosd
: [ 'Ceph OSD' , gettext ( 'Destroy' ) ],
516 cephcreatepool
: [ 'Ceph Pool' , gettext ( 'Create' ) ],
517 cephdestroypool
: [ 'Ceph Pool' , gettext ( 'Destroy' ) ],
518 cephfscreate
: [ 'CephFS' , gettext ( 'Create' ) ],
519 cephcreatemds
: [ 'Ceph Metadata Server' , gettext ( 'Create' ) ],
520 cephdestroymds
: [ 'Ceph Metadata Server' , gettext ( 'Destroy' ) ],
521 imgcopy
: [ '' , gettext ( 'Copy data' ) ],
522 imgdel
: [ '' , gettext ( 'Erase data' ) ],
523 unknownimgdel
: [ '' , gettext ( 'Destroy image from unknown guest' ) ],
524 download
: [ '' , gettext ( 'Download' ) ],
525 vzdump
: [ 'VM/CT' , gettext ( 'Backup' ) ],
526 aptupdate
: [ '' , gettext ( 'Update package database' ) ],
527 startall
: [ '' , gettext ( 'Start all VMs and Containers' ) ],
528 stopall
: [ '' , gettext ( 'Stop all VMs and Containers' ) ],
529 migrateall
: [ '' , gettext ( 'Migrate all VMs and Containers' ) ],
530 dircreate
: [ gettext ( 'Directory Storage' ), gettext ( 'Create' ) ],
531 lvmcreate
: [ gettext ( 'LVM Storage' ), gettext ( 'Create' ) ],
532 lvmthincreate
: [ gettext ( 'LVM-Thin Storage' ), gettext ( 'Create' ) ],
533 zfscreate
: [ gettext ( 'ZFS Storage' ), gettext ( 'Create' ) ]
536 format_task_description : function ( type
, id
) {
537 var farray
= Proxmox
. Utils
. task_desc_table
[ type
];
546 var prefix
= farray
[ 0 ];
549 return prefix
+ ' ' + id
+ ' - ' + text
;
554 format_size : function ( size
) {
555 /*jslint confusion: true */
557 var units
= [ '' , 'Ki' , 'Mi' , 'Gi' , 'Ti' , 'Pi' , 'Ei' , 'Zi' , 'Yi' ];
560 while ( size
>= 1024 && (( num
++)+ 1 ) < units
. length
) {
564 return size
. toFixed (( num
> 0 )? 2 : 0 ) + " " + units
[ num
] + "B" ;
567 render_upid : function ( value
, metaData
, record
) {
568 var type
= record
. data
. type
;
569 var id
= record
. data
. id
;
571 return Proxmox
. Utils
. format_task_description ( type
, id
);
574 render_uptime : function ( value
) {
578 if ( uptime
=== undefined ) {
586 return Proxmox
. Utils
. format_duration_long ( uptime
);
589 parse_task_upid : function ( upid
) {
592 var res
= upid
. match ( /^UPID:(\S+):([0-9A-Fa-f]{8}):([0-9A-Fa-f]{8,9}):([0-9A-Fa-f]{8}):([^:\s]+):([^:\s]*):([^:\s]+):$/ );
594 throw "unable to parse upid '" + upid
+ "'" ;
597 task
. pid
= parseInt ( res
[ 2 ], 16 );
598 task
. pstart
= parseInt ( res
[ 3 ], 16 );
599 task
. starttime
= parseInt ( res
[ 4 ], 16 );
604 task
. desc
= Proxmox
. Utils
. format_task_description ( task
. type
, task
. id
);
609 render_timestamp : function ( value
, metaData
, record
, rowIndex
, colIndex
, store
) {
610 var servertime
= new Date ( value
* 1000 );
611 return Ext
. Date
. format ( servertime
, 'Y-m-d H:i:s' );
614 get_help_info : function ( section
) {
616 if ( typeof proxmoxOnlineHelpInfo
!== 'undefined' ) {
617 helpMap
= proxmoxOnlineHelpInfo
;
618 } else if ( typeof pveOnlineHelpInfo
!== 'undefined' ) {
619 // be backward compatible with older pve-doc-generators
620 helpMap
= pveOnlineHelpInfo
;
622 throw "no global OnlineHelpInfo map declared" ;
625 return helpMap
[ section
];
628 get_help_link : function ( section
) {
629 var info
= Proxmox
. Utils
. get_help_info ( section
);
634 return window
. location
. origin
+ info
. link
;
637 openXtermJsViewer : function ( vmtype
, vmid
, nodename
, vmname
, cmd
) {
638 var url
= Ext
. Object
. toQueryString ({
639 console
: vmtype
, // kvm, lxc, upgrade or shell
647 var nw
= window
. open ( "?" + url
, '_blank' , 'toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420' );
656 constructor : function () {
658 Ext
. apply ( me
, me
. utilities
);
660 var IPV4_OCTET
= "(?:25[0-5]|(?:[1-9]|1[0-9]|2[0-4])?[0-9])" ;
661 var IPV4_REGEXP
= "(?:(?:" + IPV4_OCTET
+ " \\ .){3}" + IPV4_OCTET
+ ")" ;
662 var IPV6_H16
= "(?:[0-9a-fA-F]{1,4})" ;
663 var IPV6_LS32
= "(?:(?:" + IPV6_H16
+ ":" + IPV6_H16
+ ")|" + IPV4_REGEXP
+ ")" ;
664 var IPV4_CIDR_MASK
= "([0-9]{1,2})" ;
665 var IPV6_CIDR_MASK
= "([0-9]{1,3})" ;
668 me
. IP4_match
= new RegExp ( "^(?:" + IPV4_REGEXP
+ ")$" );
669 me
. IP4_cidr_match
= new RegExp ( "^(?:" + IPV4_REGEXP
+ ")\/" + IPV4_CIDR_MASK
+ "$" );
671 var IPV6_REGEXP
= "(?:" +
672 "(?:(?:" + "(?:" + IPV6_H16
+ ":){6})" + IPV6_LS32
+ ")|" +
673 "(?:(?:" + "::" + "(?:" + IPV6_H16
+ ":){5})" + IPV6_LS32
+ ")|" +
674 "(?:(?:(?:" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){4})" + IPV6_LS32
+ ")|" +
675 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,1}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){3})" + IPV6_LS32
+ ")|" +
676 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,2}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){2})" + IPV6_LS32
+ ")|" +
677 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,3}" + IPV6_H16
+ ")?::" + "(?:" + IPV6_H16
+ ":){1})" + IPV6_LS32
+ ")|" +
678 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,4}" + IPV6_H16
+ ")?::" + ")" + IPV6_LS32
+ ")|" +
679 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,5}" + IPV6_H16
+ ")?::" + ")" + IPV6_H16
+ ")|" +
680 "(?:(?:(?:(?:" + IPV6_H16
+ ":){0,7}" + IPV6_H16
+ ")?::" + ")" + ")" +
683 me
. IP6_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ ")$" );
684 me
. IP6_cidr_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ ")\/" + IPV6_CIDR_MASK
+ "$" );
685 me
. IP6_bracket_match
= new RegExp ( "^ \\ [(" + IPV6_REGEXP
+ ") \\ ]" );
687 me
. IP64_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ ")$" );
688 me
. IP64_cidr_match
= new RegExp ( "^(?:" + IPV6_REGEXP
+ "\/" + IPV6_CIDR_MASK
+ ")|(?:" + IPV4_REGEXP
+ "\/" + IPV4_CIDR_MASK
+ ")$" );
690 var DnsName_REGEXP
= "(?:(([a-zA-Z0-9]([a-zA-Z0-9 \\ -]*[a-zA-Z0-9])?) \\ .)*([A-Za-z0-9]([A-Za-z0-9 \\ -]*[A-Za-z0-9])?))" ;
691 me
. DnsName_match
= new RegExp ( "^" + DnsName_REGEXP
+ "$" );
693 me
. HostPort_match
= new RegExp ( "^(" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ")(: \\ d+)?$" );
694 me
. HostPortBrackets_match
= new RegExp ( "^ \\ [(?:" + IPV6_REGEXP
+ "|" + IPV4_REGEXP
+ "|" + DnsName_REGEXP
+ ") \\ ](: \\ d+)?$" );
695 me
. IP6_dotnotation_match
= new RegExp ( "^" + IPV6_REGEXP
+ "( \\ . \\ d+)?$" );