").append( jQuery.parseHTML( responseText ) ).find( selector ) :
-
- // Otherwise use the full result
- responseText );
-
- }).complete( callback && function( jqXHR, status ) {
- self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
- });
- }
-
- return this;
-};
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
- jQuery.fn[ type ] = function( fn ){
- return this.on( type, fn );
- };
-});
-
-jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
-
- return jQuery.ajax({
- url: url,
- type: method,
- dataType: type,
- data: data,
- success: callback
- });
- };
-});
-
-jQuery.extend({
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {},
-
- ajaxSettings: {
- url: ajaxLocation,
- type: "GET",
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
- global: true,
- processData: true,
- async: true,
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- throws: false,
- traditional: false,
- headers: {},
- */
-
- accepts: {
- "*": allTypes,
- 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"
- },
-
- // Data converters
- // Keys separate source (or catchall "*") and destination types with a single space
- converters: {
-
- // Convert anything to text
- "* text": window.String,
-
- // Text to html (true = no transformation)
- "text html": true,
-
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
-
- // Parse text as xml
- "text xml": jQuery.parseXML
- },
-
- // For options that shouldn't be deep extended:
- // you can add your own custom options here if
- // and when you create one that shouldn't be
- // deep extended (see ajaxExtend)
- flatOptions: {
- url: true,
- context: true
- }
- },
-
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function( target, settings ) {
- return settings ?
-
- // Building a settings object
- ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
-
- // Extending ajaxSettings
- ajaxExtend( jQuery.ajaxSettings, target );
- },
-
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
-
- // Main method
- ajax: function( url, options ) {
-
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
-
- // Force options to be an object
- options = options || {};
-
- var transport,
- // URL without anti-cache param
- cacheURL,
- // Response headers
- responseHeadersString,
- responseHeaders,
- // timeout handle
- timeoutTimer,
- // Cross-domain detection vars
- parts,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events is callbackContext if it is a DOM node or jQuery collection
- globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?
- jQuery( callbackContext ) :
- jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks("once memory"),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // The jqXHR state
- state = 0,
- // Default abort message
- strAbort = "canceled",
- // Fake xhr
- jqXHR = {
- readyState: 0,
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while ( (match = rheaders.exec( responseHeadersString )) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match == null ? null : match;
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- var lname = name.toLowerCase();
- if ( !state ) {
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Status-dependent callbacks
- statusCode: function( map ) {
- var code;
- if ( map ) {
- if ( state < 2 ) {
- for ( code in map ) {
- // Lazy-add the new callback in a way that preserves old ones
- statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
- }
- } else {
- // Execute the appropriate callbacks
- jqXHR.always( map[ jqXHR.status ] );
- }
- }
- return this;
- },
-
- // Cancel the request
- abort: function( statusText ) {
- var finalText = statusText || strAbort;
- if ( transport ) {
- transport.abort( finalText );
- }
- done( 0, finalText );
- return this;
- }
- };
-
- // Attach deferreds
- deferred.promise( jqXHR ).complete = completeDeferred.add;
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
-
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
- // Handle falsy url in the settings object (#10093: consistency with old signature)
- // We also use the url parameter if available
- s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
- // Alias method option to type as per ticket #12004
- s.type = options.method || options.type || s.method || s.type;
-
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""];
-
- // A cross-domain request is in order when we have a protocol:host:port mismatch
- if ( s.crossDomain == null ) {
- parts = rurl.exec( s.url.toLowerCase() );
- s.crossDomain = !!( parts &&
- ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
- );
- }
-
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
-
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
- // If request was aborted inside a prefilter, stop there
- if ( state === 2 ) {
- return jqXHR;
- }
-
- // We can fire global events as of now if asked to
- fireGlobals = s.global;
-
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger("ajaxStart");
- }
-
- // Uppercase the type
- s.type = s.type.toUpperCase();
-
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
-
- // Save the URL in case we're toying with the If-Modified-Since
- // and/or If-None-Match header later on
- cacheURL = s.url;
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // If data is available, append data to url
- if ( s.data ) {
- cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
-
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
- s.url = rts.test( cacheURL ) ?
-
- // If there is already a '_' parameter, set its value
- cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) :
-
- // Otherwise add one to the end
- cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++;
- }
- }
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- if ( jQuery.lastModified[ cacheURL ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
- }
- if ( jQuery.etag[ cacheURL ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
- }
- }
-
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
-
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
-
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
-
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already and return
- return jqXHR.abort();
- }
-
- // aborting is no longer a cancellation
- strAbort = "abort";
-
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
-
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
-
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
-
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout(function() {
- jqXHR.abort("timeout");
- }, s.timeout );
- }
-
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch ( e ) {
- // Propagate exception as error if not done
- if ( state < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- throw e;
- }
- }
- }
-
- // Callback for when everything is done
- function done( status, nativeStatusText, responses, headers ) {
- var isSuccess, success, error, response, modified,
- statusText = nativeStatusText;
-
- // Called once
- if ( state === 2 ) {
- return;
- }
-
- // State is "done" now
- state = 2;
-
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- clearTimeout( timeoutTimer );
- }
-
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
-
- // Cache response headers
- responseHeadersString = headers || "";
-
- // Set readyState
- jqXHR.readyState = status > 0 ? 4 : 0;
-
- // Get response data
- if ( responses ) {
- response = ajaxHandleResponses( s, jqXHR, responses );
- }
-
- // If successful, handle type chaining
- if ( status >= 200 && status < 300 || status === 304 ) {
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- modified = jqXHR.getResponseHeader("Last-Modified");
- if ( modified ) {
- jQuery.lastModified[ cacheURL ] = modified;
- }
- modified = jqXHR.getResponseHeader("etag");
- if ( modified ) {
- jQuery.etag[ cacheURL ] = modified;
- }
- }
-
- // If not modified
- if ( status === 304 ) {
- isSuccess = true;
- statusText = "notmodified";
-
- // If we have data
- } else {
- isSuccess = ajaxConvert( s, response );
- statusText = isSuccess.state;
- success = isSuccess.data;
- error = isSuccess.error;
- isSuccess = !error;
- }
- } else {
- // We extract error from statusText
- // then normalize statusText and status for non-aborts
- error = statusText;
- if ( status || !statusText ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
-
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = ( nativeStatusText || statusText ) + "";
-
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
-
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
-
- if ( fireGlobals ) {
- globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
- [ jqXHR, s, isSuccess ? success : error ] );
- }
-
- // Complete
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger("ajaxStop");
- }
- }
- }
-
- return jqXHR;
- },
-
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- }
-});
-
-/* Handles responses to an ajax request:
- * - sets all responseXXX fields accordingly
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
-function ajaxHandleResponses( s, jqXHR, responses ) {
-
- var ct, type, finalDataType, firstDataType,
- contents = s.contents,
- dataTypes = s.dataTypes,
- responseFields = s.responseFields;
-
- // Fill responseXXX fields
- for ( type in responseFields ) {
- if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
- }
- }
-
- // Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
- }
- }
-
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
-
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
-
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
-}
-
-// Chain conversions given the request and the original response
-function ajaxConvert( s, response ) {
-
- var conv, conv2, current, tmp,
- converters = {},
- i = 0,
- // Work with a copy of dataTypes in case we need to modify it for conversion
- dataTypes = s.dataTypes.slice(),
- prev = dataTypes[ 0 ];
-
- // Apply the dataFilter if provided
- if ( s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
-
- // Create converters map with lowercased keys
- if ( dataTypes[ 1 ] ) {
- for ( conv in s.converters ) {
- converters[ conv.toLowerCase() ] = s.converters[ conv ];
- }
- }
-
- // Convert to each sequential dataType, tolerating list modification
- for ( ; (current = dataTypes[++i]); ) {
-
- // There's only work to do if current dataType is non-auto
- if ( current !== "*" ) {
-
- // Convert response if prev dataType is non-auto and differs from current
- if ( prev !== "*" && prev !== current ) {
-
- // Seek a direct converter
- conv = converters[ prev + " " + current ] || converters[ "* " + current ];
-
- // If none found, seek a pair
- if ( !conv ) {
- for ( conv2 in converters ) {
-
- // If conv2 outputs current
- tmp = conv2.split(" ");
- if ( tmp[ 1 ] === current ) {
-
- // If prev can be converted to accepted input
- conv = converters[ prev + " " + tmp[ 0 ] ] ||
- converters[ "* " + tmp[ 0 ] ];
- if ( conv ) {
- // Condense equivalence converters
- if ( conv === true ) {
- conv = converters[ conv2 ];
-
- // Otherwise, insert the intermediate dataType
- } else if ( converters[ conv2 ] !== true ) {
- current = tmp[ 0 ];
- dataTypes.splice( i--, 0, current );
- }
-
- break;
- }
- }
- }
- }
-
- // Apply converter (if not an equivalence)
- if ( conv !== true ) {
-
- // Unless errors are allowed to bubble, catch and return them
- if ( conv && s["throws"] ) {
- response = conv( response );
- } else {
- try {
- response = conv( response );
- } catch ( e ) {
- return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
- }
- }
- }
- }
-
- // Update prev for next iteration
- prev = current;
- }
- }
-
- return { state: "success", data: response };
-}
-// Install script dataType
-jQuery.ajaxSetup({
- accepts: {
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /(?:java|ecma)script/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
-});
-
-// Handle cache's special case and global
-jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- s.global = false;
- }
-});
-
-// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
-
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
-
- var script,
- head = document.head || jQuery("head")[0] || document.documentElement;
-
- return {
-
- send: function( _, callback ) {
-
- script = document.createElement("script");
-
- script.async = true;
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( script.parentNode ) {
- script.parentNode.removeChild( script );
- }
-
- // Dereference the script
- script = null;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
- }
- }
- };
-
- // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending
- // Use native DOM manipulation to avoid our domManip AJAX trickery
- head.insertBefore( script, head.firstChild );
- },
-
- abort: function() {
- if ( script ) {
- script.onload( undefined, true );
- }
- }
- };
- }
-});
-var oldCallbacks = [],
- rjsonp = /(=)\?(?=&|$)|\?\?/;
-
-// Default jsonp settings
-jQuery.ajaxSetup({
- jsonp: "callback",
- jsonpCallback: function() {
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) );
- this[ callback ] = true;
- return callback;
- }
-});
-
-// Detect, normalize options and install callbacks for jsonp requests
-jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-
- var callbackName, overwritten, responseContainer,
- jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
- "url" :
- typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data"
- );
-
- // Handle iff the expected data type is "jsonp" or we have a parameter to set
- if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
-
- // Get callback name, remembering preexisting value associated with it
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
- s.jsonpCallback() :
- s.jsonpCallback;
-
- // Insert callback into url or form data
- if ( jsonProp ) {
- s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
- } else if ( s.jsonp !== false ) {
- s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
- }
-
- // Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
- if ( !responseContainer ) {
- jQuery.error( callbackName + " was not called" );
- }
- return responseContainer[ 0 ];
- };
-
- // force json dataType
- s.dataTypes[ 0 ] = "json";
-
- // Install callback
- overwritten = window[ callbackName ];
- window[ callbackName ] = function() {
- responseContainer = arguments;
- };
-
- // Clean-up function (fires after converters)
- jqXHR.always(function() {
- // Restore preexisting value
- window[ callbackName ] = overwritten;
-
- // Save back as free
- if ( s[ callbackName ] ) {
- // make sure that re-using the options doesn't screw things around
- s.jsonpCallback = originalSettings.jsonpCallback;
-
- // save the callback name for future use
- oldCallbacks.push( callbackName );
- }
-
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
- overwritten( responseContainer[ 0 ] );
- }
-
- responseContainer = overwritten = undefined;
- });
-
- // Delegate to script
- return "script";
- }
-});
-var xhrCallbacks, xhrSupported,
- xhrId = 0,
- // #5280: Internet Explorer will keep connections alive if we don't abort on unload
- xhrOnUnloadAbort = window.ActiveXObject && function() {
- // Abort all pending requests
- var key;
- for ( key in xhrCallbacks ) {
- xhrCallbacks[ key ]( undefined, true );
- }
- };
-
-// Functions to create xhrs
-function createStandardXHR() {
- try {
- return new window.XMLHttpRequest();
- } catch( e ) {}
-}
-
-function createActiveXHR() {
- try {
- return new window.ActiveXObject("Microsoft.XMLHTTP");
- } catch( e ) {}
-}
-
-// Create the request object
-// (This is still attached to ajaxSettings for backward compatibility)
-jQuery.ajaxSettings.xhr = window.ActiveXObject ?
- /* Microsoft failed to properly
- * implement the XMLHttpRequest in IE7 (can't request local files),
- * so we use the ActiveXObject when it is available
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
- * we need a fallback.
- */
- function() {
- return !this.isLocal && createStandardXHR() || createActiveXHR();
- } :
- // For all other browsers, use the standard XMLHttpRequest object
- createStandardXHR;
-
-// Determine support properties
-xhrSupported = jQuery.ajaxSettings.xhr();
-jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
-xhrSupported = jQuery.support.ajax = !!xhrSupported;
-
-// Create transport if the browser can provide an xhr
-if ( xhrSupported ) {
-
- jQuery.ajaxTransport(function( s ) {
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( !s.crossDomain || jQuery.support.cors ) {
-
- var callback;
-
- return {
- send: function( headers, complete ) {
-
- // Get a new xhr
- var handle, i,
- xhr = s.xhr();
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if ( s.username ) {
- xhr.open( s.type, s.url, s.async, s.username, s.password );
- } else {
- xhr.open( s.type, s.url, s.async );
- }
-
- // Apply custom fields if provided
- if ( s.xhrFields ) {
- for ( i in s.xhrFields ) {
- xhr[ i ] = s.xhrFields[ i ];
- }
- }
-
- // Override mime type if needed
- if ( s.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( s.mimeType );
- }
-
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers["X-Requested-With"] = "XMLHttpRequest";
- }
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- } catch( err ) {}
-
- // Do send the request
- // This may raise an exception which is actually
- // handled in jQuery.ajax (so no try/catch here)
- xhr.send( ( s.hasContent && s.data ) || null );
-
- // Listener
- callback = function( _, isAbort ) {
-
- var status,
- statusText,
- responseHeaders,
- responses,
- xml;
-
- // Firefox throws exceptions when accessing properties
- // of an xhr when a network error occurred
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
- try {
-
- // Was never called and is aborted or complete
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
-
- // Only called once
- callback = undefined;
-
- // Do not keep as active anymore
- if ( handle ) {
- xhr.onreadystatechange = jQuery.noop;
- if ( xhrOnUnloadAbort ) {
- delete xhrCallbacks[ handle ];
- }
- }
-
- // If it's an abort
- if ( isAbort ) {
- // Abort it manually if needed
- if ( xhr.readyState !== 4 ) {
- xhr.abort();
- }
- } else {
- responses = {};
- status = xhr.status;
- xml = xhr.responseXML;
- responseHeaders = xhr.getAllResponseHeaders();
-
- // Construct response list
- if ( xml && xml.documentElement /* #4958 */ ) {
- responses.xml = xml;
- }
-
- // When requesting binary data, IE6-9 will throw an exception
- // on any attempt to access responseText (#11426)
- if ( typeof xhr.responseText === "string" ) {
- responses.text = xhr.responseText;
- }
-
- // Firefox throws an exception when accessing
- // statusText for faulty cross-domain requests
- try {
- statusText = xhr.statusText;
- } catch( e ) {
- // We normalize with Webkit giving an empty statusText
- statusText = "";
- }
-
- // Filter status for non standard behaviors
-
- // If the request is local and we have data: assume a success
- // (success with no data won't get notified, that's the best we
- // can do given current implementations)
- if ( !status && s.isLocal && !s.crossDomain ) {
- status = responses.text ? 200 : 404;
- // IE - #1450: sometimes returns 1223 when it should be 204
- } else if ( status === 1223 ) {
- status = 204;
- }
- }
- }
- } catch( firefoxAccessException ) {
- if ( !isAbort ) {
- complete( -1, firefoxAccessException );
- }
- }
-
- // Call complete if needed
- if ( responses ) {
- complete( status, statusText, responses, responseHeaders );
- }
- };
-
- if ( !s.async ) {
- // if we're in sync mode we fire the callback
- callback();
- } else if ( xhr.readyState === 4 ) {
- // (IE6 & IE7) if it's in cache and has been
- // retrieved directly we need to fire the callback
- setTimeout( callback );
- } else {
- handle = ++xhrId;
- if ( xhrOnUnloadAbort ) {
- // Create the active xhrs callbacks list if needed
- // and attach the unload handler
- if ( !xhrCallbacks ) {
- xhrCallbacks = {};
- jQuery( window ).unload( xhrOnUnloadAbort );
- }
- // Add to list of active xhrs callbacks
- xhrCallbacks[ handle ] = callback;
- }
- xhr.onreadystatechange = callback;
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback( undefined, true );
- }
- }
- };
- }
- });
-}
-var fxNow, timerId,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
- rrun = /queueHooks$/,
- animationPrefilters = [ defaultPrefilter ],
- tweeners = {
- "*": [function( prop, value ) {
- var end, unit,
- tween = this.createTween( prop, value ),
- parts = rfxnum.exec( value ),
- target = tween.cur(),
- start = +target || 0,
- scale = 1,
- maxIterations = 20;
-
- if ( parts ) {
- end = +parts[2];
- unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
-
- // We need to compute starting value
- if ( unit !== "px" && start ) {
- // Iteratively approximate from a nonzero starting point
- // Prefer the current property, because this process will be trivial if it uses the same units
- // Fallback to end or a simple constant
- start = jQuery.css( tween.elem, prop, true ) || end || 1;
-
- do {
- // If previous iteration zeroed out, double until we get *something*
- // Use a string for doubling factor so we don't accidentally see scale as unchanged below
- scale = scale || ".5";
-
- // Adjust and apply
- start = start / scale;
- jQuery.style( tween.elem, prop, start + unit );
-
- // Update scale, tolerating zero or NaN from tween.cur()
- // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
- } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
- }
-
- tween.unit = unit;
- tween.start = start;
- // If a +=/-= token was provided, we're doing a relative animation
- tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
- }
- return tween;
- }]
- };
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
- setTimeout(function() {
- fxNow = undefined;
- });
- return ( fxNow = jQuery.now() );
-}
-
-function createTweens( animation, props ) {
- jQuery.each( props, function( prop, value ) {
- var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
- index = 0,
- length = collection.length;
- for ( ; index < length; index++ ) {
- if ( collection[ index ].call( animation, prop, value ) ) {
-
- // we're done with this property
- return;
- }
- }
- });
-}
-
-function Animation( elem, properties, options ) {
- var result,
- stopped,
- index = 0,
- length = animationPrefilters.length,
- deferred = jQuery.Deferred().always( function() {
- // don't match elem in the :animated selector
- delete tick.elem;
- }),
- tick = function() {
- if ( stopped ) {
- return false;
- }
- var currentTime = fxNow || createFxNow(),
- remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
- // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
- temp = remaining / animation.duration || 0,
- percent = 1 - temp,
- index = 0,
- length = animation.tweens.length;
-
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( percent );
- }
-
- deferred.notifyWith( elem, [ animation, percent, remaining ]);
-
- if ( percent < 1 && length ) {
- return remaining;
- } else {
- deferred.resolveWith( elem, [ animation ] );
- return false;
- }
- },
- animation = deferred.promise({
- elem: elem,
- props: jQuery.extend( {}, properties ),
- opts: jQuery.extend( true, { specialEasing: {} }, options ),
- originalProperties: properties,
- originalOptions: options,
- startTime: fxNow || createFxNow(),
- duration: options.duration,
- tweens: [],
- createTween: function( prop, end ) {
- var tween = jQuery.Tween( elem, animation.opts, prop, end,
- animation.opts.specialEasing[ prop ] || animation.opts.easing );
- animation.tweens.push( tween );
- return tween;
- },
- stop: function( gotoEnd ) {
- var index = 0,
- // if we are going to the end, we want to run all the tweens
- // otherwise we skip this part
- length = gotoEnd ? animation.tweens.length : 0;
- if ( stopped ) {
- return this;
- }
- stopped = true;
- for ( ; index < length ; index++ ) {
- animation.tweens[ index ].run( 1 );
- }
-
- // resolve when we played the last frame
- // otherwise, reject
- if ( gotoEnd ) {
- deferred.resolveWith( elem, [ animation, gotoEnd ] );
- } else {
- deferred.rejectWith( elem, [ animation, gotoEnd ] );
- }
- return this;
- }
- }),
- props = animation.props;
-
- propFilter( props, animation.opts.specialEasing );
-
- for ( ; index < length ; index++ ) {
- result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
- if ( result ) {
- return result;
- }
- }
-
- createTweens( animation, props );
-
- if ( jQuery.isFunction( animation.opts.start ) ) {
- animation.opts.start.call( elem, animation );
- }
-
- jQuery.fx.timer(
- jQuery.extend( tick, {
- elem: elem,
- anim: animation,
- queue: animation.opts.queue
- })
- );
-
- // attach callbacks from options
- return animation.progress( animation.opts.progress )
- .done( animation.opts.done, animation.opts.complete )
- .fail( animation.opts.fail )
- .always( animation.opts.always );
-}
-
-function propFilter( props, specialEasing ) {
- var index, name, easing, value, hooks;
-
- // camelCase, specialEasing and expand cssHook pass
- for ( index in props ) {
- name = jQuery.camelCase( index );
- easing = specialEasing[ name ];
- value = props[ index ];
- if ( jQuery.isArray( value ) ) {
- easing = value[ 1 ];
- value = props[ index ] = value[ 0 ];
- }
-
- if ( index !== name ) {
- props[ name ] = value;
- delete props[ index ];
- }
-
- hooks = jQuery.cssHooks[ name ];
- if ( hooks && "expand" in hooks ) {
- value = hooks.expand( value );
- delete props[ name ];
-
- // not quite $.extend, this wont overwrite keys already present.
- // also - reusing 'index' from above because we have the correct "name"
- for ( index in value ) {
- if ( !( index in props ) ) {
- props[ index ] = value[ index ];
- specialEasing[ index ] = easing;
- }
- }
- } else {
- specialEasing[ name ] = easing;
- }
- }
-}
-
-jQuery.Animation = jQuery.extend( Animation, {
-
- tweener: function( props, callback ) {
- if ( jQuery.isFunction( props ) ) {
- callback = props;
- props = [ "*" ];
- } else {
- props = props.split(" ");
- }
-
- var prop,
- index = 0,
- length = props.length;
-
- for ( ; index < length ; index++ ) {
- prop = props[ index ];
- tweeners[ prop ] = tweeners[ prop ] || [];
- tweeners[ prop ].unshift( callback );
- }
- },
-
- prefilter: function( callback, prepend ) {
- if ( prepend ) {
- animationPrefilters.unshift( callback );
- } else {
- animationPrefilters.push( callback );
- }
- }
-});
-
-function defaultPrefilter( elem, props, opts ) {
- /*jshint validthis:true */
- var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
- anim = this,
- style = elem.style,
- orig = {},
- handled = [],
- hidden = elem.nodeType && isHidden( elem );
-
- // handle queue: false promises
- if ( !opts.queue ) {
- hooks = jQuery._queueHooks( elem, "fx" );
- if ( hooks.unqueued == null ) {
- hooks.unqueued = 0;
- oldfire = hooks.empty.fire;
- hooks.empty.fire = function() {
- if ( !hooks.unqueued ) {
- oldfire();
- }
- };
- }
- hooks.unqueued++;
-
- anim.always(function() {
- // doing this makes sure that the complete handler will be called
- // before this completes
- anim.always(function() {
- hooks.unqueued--;
- if ( !jQuery.queue( elem, "fx" ).length ) {
- hooks.empty.fire();
- }
- });
- });
- }
-
- // height/width overflow pass
- if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
-
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- if ( jQuery.css( elem, "display" ) === "inline" &&
- jQuery.css( elem, "float" ) === "none" ) {
-
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
- style.display = "inline-block";
-
- } else {
- style.zoom = 1;
- }
- }
- }
-
- if ( opts.overflow ) {
- style.overflow = "hidden";
- if ( !jQuery.support.shrinkWrapBlocks ) {
- anim.done(function() {
- style.overflow = opts.overflow[ 0 ];
- style.overflowX = opts.overflow[ 1 ];
- style.overflowY = opts.overflow[ 2 ];
- });
- }
- }
-
-
- // show/hide pass
- for ( index in props ) {
- value = props[ index ];
- if ( rfxtypes.exec( value ) ) {
- delete props[ index ];
- toggle = toggle || value === "toggle";
- if ( value === ( hidden ? "hide" : "show" ) ) {
- continue;
- }
- handled.push( index );
- }
- }
-
- length = handled.length;
- if ( length ) {
- dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
- if ( "hidden" in dataShow ) {
- hidden = dataShow.hidden;
- }
-
- // store state if its toggle - enables .stop().toggle() to "reverse"
- if ( toggle ) {
- dataShow.hidden = !hidden;
- }
- if ( hidden ) {
- jQuery( elem ).show();
- } else {
- anim.done(function() {
- jQuery( elem ).hide();
- });
- }
- anim.done(function() {
- var prop;
- jQuery._removeData( elem, "fxshow" );
- for ( prop in orig ) {
- jQuery.style( elem, prop, orig[ prop ] );
- }
- });
- for ( index = 0 ; index < length ; index++ ) {
- prop = handled[ index ];
- tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
- orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
-
- if ( !( prop in dataShow ) ) {
- dataShow[ prop ] = tween.start;
- if ( hidden ) {
- tween.end = tween.start;
- tween.start = prop === "width" || prop === "height" ? 1 : 0;
- }
- }
- }
- }
-}
-
-function Tween( elem, options, prop, end, easing ) {
- return new Tween.prototype.init( elem, options, prop, end, easing );
-}
-jQuery.Tween = Tween;
-
-Tween.prototype = {
- constructor: Tween,
- init: function( elem, options, prop, end, easing, unit ) {
- this.elem = elem;
- this.prop = prop;
- this.easing = easing || "swing";
- this.options = options;
- this.start = this.now = this.cur();
- this.end = end;
- this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
- },
- cur: function() {
- var hooks = Tween.propHooks[ this.prop ];
-
- return hooks && hooks.get ?
- hooks.get( this ) :
- Tween.propHooks._default.get( this );
- },
- run: function( percent ) {
- var eased,
- hooks = Tween.propHooks[ this.prop ];
-
- if ( this.options.duration ) {
- this.pos = eased = jQuery.easing[ this.easing ](
- percent, this.options.duration * percent, 0, 1, this.options.duration
- );
- } else {
- this.pos = eased = percent;
- }
- this.now = ( this.end - this.start ) * eased + this.start;
-
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
-
- if ( hooks && hooks.set ) {
- hooks.set( this );
- } else {
- Tween.propHooks._default.set( this );
- }
- return this;
- }
-};
-
-Tween.prototype.init.prototype = Tween.prototype;
-
-Tween.propHooks = {
- _default: {
- get: function( tween ) {
- var result;
-
- if ( tween.elem[ tween.prop ] != null &&
- (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
- return tween.elem[ tween.prop ];
- }
-
- // passing a non empty string as a 3rd parameter to .css will automatically
- // attempt a parseFloat and fallback to a string if the parse fails
- // so, simple values such as "10px" are parsed to Float.
- // complex values such as "rotate(1rad)" are returned as is.
- result = jQuery.css( tween.elem, tween.prop, "auto" );
- // Empty strings, null, undefined and "auto" are converted to 0.
- return !result || result === "auto" ? 0 : result;
- },
- set: function( tween ) {
- // use step hook for back compat - use cssHook if its there - use .style if its
- // available and use plain properties where available
- if ( jQuery.fx.step[ tween.prop ] ) {
- jQuery.fx.step[ tween.prop ]( tween );
- } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
- jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
- } else {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
- }
-};
-
-// Remove in 2.0 - this supports IE8's panic based approach
-// to setting things on disconnected nodes
-
-Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
- set: function( tween ) {
- if ( tween.elem.nodeType && tween.elem.parentNode ) {
- tween.elem[ tween.prop ] = tween.now;
- }
- }
-};
-
-jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
- var cssFn = jQuery.fn[ name ];
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return speed == null || typeof speed === "boolean" ?
- cssFn.apply( this, arguments ) :
- this.animate( genFx( name, true ), speed, easing, callback );
- };
-});
-
-jQuery.fn.extend({
- fadeTo: function( speed, to, easing, callback ) {
-
- // show any hidden elements after setting opacity to 0
- return this.filter( isHidden ).css( "opacity", 0 ).show()
-
- // animate to the value specified
- .end().animate({ opacity: to }, speed, easing, callback );
- },
- animate: function( prop, speed, easing, callback ) {
- var empty = jQuery.isEmptyObject( prop ),
- optall = jQuery.speed( speed, easing, callback ),
- doAnimation = function() {
- // Operate on a copy of prop so per-property easing won't be lost
- var anim = Animation( this, jQuery.extend( {}, prop ), optall );
- doAnimation.finish = function() {
- anim.stop( true );
- };
- // Empty animations, or finishing resolves immediately
- if ( empty || jQuery._data( this, "finish" ) ) {
- anim.stop( true );
- }
- };
- doAnimation.finish = doAnimation;
-
- return empty || optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
- stop: function( type, clearQueue, gotoEnd ) {
- var stopQueue = function( hooks ) {
- var stop = hooks.stop;
- delete hooks.stop;
- stop( gotoEnd );
- };
-
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
-
- return this.each(function() {
- var dequeue = true,
- index = type != null && type + "queueHooks",
- timers = jQuery.timers,
- data = jQuery._data( this );
-
- if ( index ) {
- if ( data[ index ] && data[ index ].stop ) {
- stopQueue( data[ index ] );
- }
- } else {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
- stopQueue( data[ index ] );
- }
- }
- }
-
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- timers[ index ].anim.stop( gotoEnd );
- dequeue = false;
- timers.splice( index, 1 );
- }
- }
-
- // start the next in the queue if the last step wasn't forced
- // timers currently will call their complete callbacks, which will dequeue
- // but only if they were gotoEnd
- if ( dequeue || !gotoEnd ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- finish: function( type ) {
- if ( type !== false ) {
- type = type || "fx";
- }
- return this.each(function() {
- var index,
- data = jQuery._data( this ),
- queue = data[ type + "queue" ],
- hooks = data[ type + "queueHooks" ],
- timers = jQuery.timers,
- length = queue ? queue.length : 0;
-
- // enable finishing flag on private data
- data.finish = true;
-
- // empty the queue first
- jQuery.queue( this, type, [] );
-
- if ( hooks && hooks.cur && hooks.cur.finish ) {
- hooks.cur.finish.call( this );
- }
-
- // look for any active animations, and finish them
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
- timers[ index ].anim.stop( true );
- timers.splice( index, 1 );
- }
- }
-
- // look for any animations in the old queue and finish them
- for ( index = 0; index < length; index++ ) {
- if ( queue[ index ] && queue[ index ].finish ) {
- queue[ index ].finish.call( this );
- }
- }
-
- // turn off finishing flag
- delete data.finish;
- });
- }
-});
-
-// Generate parameters to create a standard animation
-function genFx( type, includeWidth ) {
- var which,
- attrs = { height: type },
- i = 0;
-
- // if we include width, step value is 1 to do all cssExpand values,
- // if we don't include width, step value is 2 to skip over Left and Right
- includeWidth = includeWidth? 1 : 0;
- for( ; i < 4 ; i += 2 - includeWidth ) {
- which = cssExpand[ i ];
- attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
- }
-
- if ( includeWidth ) {
- attrs.opacity = attrs.width = type;
- }
-
- return attrs;
-}
-
-// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx("show"),
- slideUp: genFx("hide"),
- slideToggle: genFx("toggle"),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
-}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
-});
-
-jQuery.speed = function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
-
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
-
- // normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
-
- // Queueing
- opt.old = opt.complete;
-
- opt.complete = function() {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
-
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- }
- };
-
- return opt;
-};
-
-jQuery.easing = {
- linear: function( p ) {
- return p;
- },
- swing: function( p ) {
- return 0.5 - Math.cos( p*Math.PI ) / 2;
- }
-};
-
-jQuery.timers = [];
-jQuery.fx = Tween.prototype.init;
-jQuery.fx.tick = function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
-
- fxNow = jQuery.now();
-
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- if ( !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
-
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- fxNow = undefined;
-};
-
-jQuery.fx.timer = function( timer ) {
- if ( timer() && jQuery.timers.push( timer ) ) {
- jQuery.fx.start();
- }
-};
-
-jQuery.fx.interval = 13;
-
-jQuery.fx.start = function() {
- if ( !timerId ) {
- timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
- }
-};
-
-jQuery.fx.stop = function() {
- clearInterval( timerId );
- timerId = null;
-};
-
-jQuery.fx.speeds = {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
-};
-
-// Back Compat <1.8 extension point
-jQuery.fx.step = {};
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
-}
-jQuery.fn.offset = function( options ) {
- if ( arguments.length ) {
- return options === undefined ?
- this :
- this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- var docElem, win,
- box = { top: 0, left: 0 },
- elem = this[ 0 ],
- doc = elem && elem.ownerDocument;
-
- if ( !doc ) {
- return;
- }
-
- docElem = doc.documentElement;
-
- // Make sure it's not a disconnected DOM node
- if ( !jQuery.contains( docElem, elem ) ) {
- return box;
- }
-
- // If we don't have gBCR, just use 0,0 rather than error
- // BlackBerry 5, iOS 3 (original iPhone)
- if ( typeof elem.getBoundingClientRect !== "undefined" ) {
- box = elem.getBoundingClientRect();
- }
- win = getWindow( doc );
- return {
- top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
- left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
- };
-};
-
-jQuery.offset = {
-
- setOffset: function( elem, options, i ) {
- var position = jQuery.css( elem, "position" );
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.css( elem, "top" ),
- curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
- props = {}, curPosition = {}, curTop, curLeft;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-
-jQuery.fn.extend({
-
- position: function() {
- if ( !this[ 0 ] ) {
- return;
- }
-
- var offsetParent, offset,
- parentOffset = { top: 0, left: 0 },
- elem = this[ 0 ];
-
- // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent
- if ( jQuery.css( elem, "position" ) === "fixed" ) {
- // we assume that getBoundingClientRect is available when computed position is fixed
- offset = elem.getBoundingClientRect();
- } else {
- // Get *real* offsetParent
- offsetParent = this.offsetParent();
-
- // Get correct offsets
- offset = this.offset();
- if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
- parentOffset = offsetParent.offset();
- }
-
- // Add offsetParent borders
- parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
- parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
- }
-
- // Subtract parent offsets and element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- return {
- top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
- left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true)
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || document.documentElement;
- while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent || document.documentElement;
- });
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
- var top = /Y/.test( prop );
-
- jQuery.fn[ method ] = function( val ) {
- return jQuery.access( this, function( elem, method, val ) {
- var win = getWindow( elem );
-
- if ( val === undefined ) {
- return win ? (prop in win) ? win[ prop ] :
- win.document.documentElement[ method ] :
- elem[ method ];
- }
-
- if ( win ) {
- win.scrollTo(
- !top ? val : jQuery( win ).scrollLeft(),
- top ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- elem[ method ] = val;
- }
- }, method, val, arguments.length, null );
- };
-});
-
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
-jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
- jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
- // margin is only for outerHeight, outerWidth
- jQuery.fn[ funcName ] = function( margin, value ) {
- var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
- extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
-
- return jQuery.access( this, function( elem, type, value ) {
- var doc;
-
- if ( jQuery.isWindow( elem ) ) {
- // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
- // isn't a whole lot we can do. See pull request at this URL for discussion:
- // https://github.com/jquery/jquery/pull/764
- return elem.document.documentElement[ "client" + name ];
- }
-
- // Get document width or height
- if ( elem.nodeType === 9 ) {
- doc = elem.documentElement;
-
- // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
- // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
- return Math.max(
- elem.body[ "scroll" + name ], doc[ "scroll" + name ],
- elem.body[ "offset" + name ], doc[ "offset" + name ],
- doc[ "client" + name ]
- );
- }
-
- return value === undefined ?
- // Get width or height on the element, requesting but not forcing parseFloat
- jQuery.css( elem, type, extra ) :
-
- // Set width or height on the element
- jQuery.style( elem, type, value, extra );
- }, type, chainable ? margin : undefined, chainable, null );
- };
- });
-});
-// Limit scope pollution from any deprecated API
-// (function() {
-
-// })();
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
-
-// Expose jQuery as an AMD module, but only for AMD loaders that
-// understand the issues with loading multiple versions of jQuery
-// in a page that all might call define(). The loader will indicate
-// they have special allowances for multiple jQuery versions by
-// specifying define.amd.jQuery = true. Register as a named module,
-// since jQuery can be concatenated with other files that may use define,
-// but not use a proper concatenation script that understands anonymous
-// AMD modules. A named AMD is safest and most robust way to register.
-// Lowercase jquery is used because AMD module names are derived from
-// file names, and jQuery is normally delivered in a lowercase file name.
-// Do this after creating the global so that if an AMD module wants to call
-// noConflict to hide this version of jQuery, it will work.
-if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
- define( "jquery", [], function () { return jQuery; } );
-}
-
-})( window );
\ No newline at end of file
diff --git a/erp_web/js/jquery-asDatepicker/demo/js/jquery.mobile.custom.js b/erp_web/js/jquery-asDatepicker/demo/js/jquery.mobile.custom.js
deleted file mode 100644
index e9bf052e..00000000
--- a/erp_web/js/jquery-asDatepicker/demo/js/jquery.mobile.custom.js
+++ /dev/null
@@ -1,1051 +0,0 @@
-/*
-* jQuery Mobile v1.4.5
-* http://jquerymobile.com
-*
-* Copyright 2010, 2014 jQuery Foundation, Inc. and other contributors
-* Released under the MIT license.
-* http://jquery.org/license
-*
-*/
-
-(function ( root, doc, factory ) {
- if ( typeof define === "function" && define.amd ) {
- // AMD. Register as an anonymous module.
- define( [ "jquery" ], function ( $ ) {
- factory( $, root, doc );
- return $.mobile;
- });
- } else {
- // Browser globals
- factory( root.jQuery, root, doc );
- }
-}( this, document, function ( jQuery, window, document, undefined ) { (function( $, undefined ) {
- $.extend( $.support, {
- orientation: "orientation" in window && "onorientationchange" in window
- });
- }( jQuery ));
-
-
- // throttled resize event
- (function( $ ) {
- $.event.special.throttledresize = {
- setup: function() {
- $( this ).bind( "resize", handler );
- },
- teardown: function() {
- $( this ).unbind( "resize", handler );
- }
- };
-
- var throttle = 250,
- handler = function() {
- curr = ( new Date() ).getTime();
- diff = curr - lastCall;
-
- if ( diff >= throttle ) {
-
- lastCall = curr;
- $( this ).trigger( "throttledresize" );
-
- } else {
-
- if ( heldCall ) {
- clearTimeout( heldCall );
- }
-
- // Promise a held call will still execute
- heldCall = setTimeout( handler, throttle - diff );
- }
- },
- lastCall = 0,
- heldCall,
- curr,
- diff;
- })( jQuery );
-
-
-(function( $, window ) {
- var win = $( window ),
- event_name = "orientationchange",
- get_orientation,
- last_orientation,
- initial_orientation_is_landscape,
- initial_orientation_is_default,
- portrait_map = { "0": true, "180": true },
- ww, wh, landscape_threshold;
-
- // It seems that some device/browser vendors use window.orientation values 0 and 180 to
- // denote the "default" orientation. For iOS devices, and most other smart-phones tested,
- // the default orientation is always "portrait", but in some Android and RIM based tablets,
- // the default orientation is "landscape". The following code attempts to use the window
- // dimensions to figure out what the current orientation is, and then makes adjustments
- // to the to the portrait_map if necessary, so that we can properly decode the
- // window.orientation value whenever get_orientation() is called.
- //
- // Note that we used to use a media query to figure out what the orientation the browser
- // thinks it is in:
- //
- // initial_orientation_is_landscape = $.mobile.media("all and (orientation: landscape)");
- //
- // but there was an iPhone/iPod Touch bug beginning with iOS 4.2, up through iOS 5.1,
- // where the browser *ALWAYS* applied the landscape media query. This bug does not
- // happen on iPad.
-
- if ( $.support.orientation ) {
-
- // Check the window width and height to figure out what the current orientation
- // of the device is at this moment. Note that we've initialized the portrait map
- // values to 0 and 180, *AND* we purposely check for landscape so that if we guess
- // wrong, , we default to the assumption that portrait is the default orientation.
- // We use a threshold check below because on some platforms like iOS, the iPhone
- // form-factor can report a larger width than height if the user turns on the
- // developer console. The actual threshold value is somewhat arbitrary, we just
- // need to make sure it is large enough to exclude the developer console case.
-
- ww = window.innerWidth || win.width();
- wh = window.innerHeight || win.height();
- landscape_threshold = 50;
-
- initial_orientation_is_landscape = ww > wh && ( ww - wh ) > landscape_threshold;
-
- // Now check to see if the current window.orientation is 0 or 180.
- initial_orientation_is_default = portrait_map[ window.orientation ];
-
- // If the initial orientation is landscape, but window.orientation reports 0 or 180, *OR*
- // if the initial orientation is portrait, but window.orientation reports 90 or -90, we
- // need to flip our portrait_map values because landscape is the default orientation for
- // this device/browser.
- if ( ( initial_orientation_is_landscape && initial_orientation_is_default ) || ( !initial_orientation_is_landscape && !initial_orientation_is_default ) ) {
- portrait_map = { "-90": true, "90": true };
- }
- }
-
- $.event.special.orientationchange = $.extend( {}, $.event.special.orientationchange, {
- setup: function() {
- // If the event is supported natively, return false so that jQuery
- // will bind to the event using DOM methods.
- if ( $.support.orientation && !$.event.special.orientationchange.disabled ) {
- return false;
- }
-
- // Get the current orientation to avoid initial double-triggering.
- last_orientation = get_orientation();
-
- // Because the orientationchange event doesn't exist, simulate the
- // event by testing window dimensions on resize.
- win.bind( "throttledresize", handler );
- },
- teardown: function() {
- // If the event is not supported natively, return false so that
- // jQuery will unbind the event using DOM methods.
- if ( $.support.orientation && !$.event.special.orientationchange.disabled ) {
- return false;
- }
-
- // Because the orientationchange event doesn't exist, unbind the
- // resize event handler.
- win.unbind( "throttledresize", handler );
- },
- add: function( handleObj ) {
- // Save a reference to the bound event handler.
- var old_handler = handleObj.handler;
-
- handleObj.handler = function( event ) {
- // Modify event object, adding the .orientation property.
- event.orientation = get_orientation();
-
- // Call the originally-bound event handler and return its result.
- return old_handler.apply( this, arguments );
- };
- }
- });
-
- // If the event is not supported natively, this handler will be bound to
- // the window resize event to simulate the orientationchange event.
- function handler() {
- // Get the current orientation.
- var orientation = get_orientation();
-
- if ( orientation !== last_orientation ) {
- // The orientation has changed, so trigger the orientationchange event.
- last_orientation = orientation;
- win.trigger( event_name );
- }
- }
-
- // Get the current page orientation. This method is exposed publicly, should it
- // be needed, as jQuery.event.special.orientationchange.orientation()
- $.event.special.orientationchange.orientation = get_orientation = function() {
- var isPortrait = true, elem = document.documentElement;
-
- // prefer window orientation to the calculation based on screensize as
- // the actual screen resize takes place before or after the orientation change event
- // has been fired depending on implementation (eg android 2.3 is before, iphone after).
- // More testing is required to determine if a more reliable method of determining the new screensize
- // is possible when orientationchange is fired. (eg, use media queries + element + opacity)
- if ( $.support.orientation ) {
- // if the window orientation registers as 0 or 180 degrees report
- // portrait, otherwise landscape
- isPortrait = portrait_map[ window.orientation ];
- } else {
- isPortrait = elem && elem.clientWidth / elem.clientHeight < 1.1;
- }
-
- return isPortrait ? "portrait" : "landscape";
- };
-
- $.fn[ event_name ] = function( fn ) {
- return fn ? this.bind( event_name, fn ) : this.trigger( event_name );
- };
-
- // jQuery < 1.8
- if ( $.attrFn ) {
- $.attrFn[ event_name ] = true;
- }
-
-}( jQuery, this ));
-
-
-// This plugin is an experiment for abstracting away the touch and mouse
-// events so that developers don't have to worry about which method of input
-// the device their document is loaded on supports.
-//
-// The idea here is to allow the developer to register listeners for the
-// basic mouse events, such as mousedown, mousemove, mouseup, and click,
-// and the plugin will take care of registering the correct listeners
-// behind the scenes to invoke the listener at the fastest possible time
-// for that device, while still retaining the order of event firing in
-// the traditional mouse environment, should multiple handlers be registered
-// on the same element for different events.
-//
-// The current version exposes the following virtual events to jQuery bind methods:
-// "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel"
-
-(function( $, window, document, undefined ) {
-
-var dataPropertyName = "virtualMouseBindings",
- touchTargetPropertyName = "virtualTouchID",
- virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ),
- touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ),
- mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [],
- mouseEventProps = $.event.props.concat( mouseHookProps ),
- activeDocHandlers = {},
- resetTimerID = 0,
- startX = 0,
- startY = 0,
- didScroll = false,
- clickBlockList = [],
- blockMouseTriggers = false,
- blockTouchTriggers = false,
- eventCaptureSupported = "addEventListener" in document,
- $document = $( document ),
- nextTouchID = 1,
- lastTouchID = 0, threshold,
- i;
-
-$.vmouse = {
- moveDistanceThreshold: 10,
- clickDistanceThreshold: 10,
- resetTimerDuration: 1500
-};
-
-function getNativeEvent( event ) {
-
- while ( event && typeof event.originalEvent !== "undefined" ) {
- event = event.originalEvent;
- }
- return event;
-}
-
-function createVirtualEvent( event, eventType ) {
-
- var t = event.type,
- oe, props, ne, prop, ct, touch, i, j, len;
-
- event = $.Event( event );
- event.type = eventType;
-
- oe = event.originalEvent;
- props = $.event.props;
-
- // addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280
- // https://github.com/jquery/jquery-mobile/issues/3280
- if ( t.search( /^(mouse|click)/ ) > -1 ) {
- props = mouseEventProps;
- }
-
- // copy original event properties over to the new event
- // this would happen if we could call $.event.fix instead of $.Event
- // but we don't have a way to force an event to be fixed multiple times
- if ( oe ) {
- for ( i = props.length, prop; i; ) {
- prop = props[ --i ];
- event[ prop ] = oe[ prop ];
- }
- }
-
- // make sure that if the mouse and click virtual events are generated
- // without a .which one is defined
- if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ) {
- event.which = 1;
- }
-
- if ( t.search(/^touch/) !== -1 ) {
- ne = getNativeEvent( oe );
- t = ne.touches;
- ct = ne.changedTouches;
- touch = ( t && t.length ) ? t[0] : ( ( ct && ct.length ) ? ct[ 0 ] : undefined );
-
- if ( touch ) {
- for ( j = 0, len = touchEventProps.length; j < len; j++) {
- prop = touchEventProps[ j ];
- event[ prop ] = touch[ prop ];
- }
- }
- }
-
- return event;
-}
-
-function getVirtualBindingFlags( element ) {
-
- var flags = {},
- b, k;
-
- while ( element ) {
-
- b = $.data( element, dataPropertyName );
-
- for ( k in b ) {
- if ( b[ k ] ) {
- flags[ k ] = flags.hasVirtualBinding = true;
- }
- }
- element = element.parentNode;
- }
- return flags;
-}
-
-function getClosestElementWithVirtualBinding( element, eventType ) {
- var b;
- while ( element ) {
-
- b = $.data( element, dataPropertyName );
-
- if ( b && ( !eventType || b[ eventType ] ) ) {
- return element;
- }
- element = element.parentNode;
- }
- return null;
-}
-
-function enableTouchBindings() {
- blockTouchTriggers = false;
-}
-
-function disableTouchBindings() {
- blockTouchTriggers = true;
-}
-
-function enableMouseBindings() {
- lastTouchID = 0;
- clickBlockList.length = 0;
- blockMouseTriggers = false;
-
- // When mouse bindings are enabled, our
- // touch bindings are disabled.
- disableTouchBindings();
-}
-
-function disableMouseBindings() {
- // When mouse bindings are disabled, our
- // touch bindings are enabled.
- enableTouchBindings();
-}
-
-function startResetTimer() {
- clearResetTimer();
- resetTimerID = setTimeout( function() {
- resetTimerID = 0;
- enableMouseBindings();
- }, $.vmouse.resetTimerDuration );
-}
-
-function clearResetTimer() {
- if ( resetTimerID ) {
- clearTimeout( resetTimerID );
- resetTimerID = 0;
- }
-}
-
-function triggerVirtualEvent( eventType, event, flags ) {
- var ve;
-
- if ( ( flags && flags[ eventType ] ) ||
- ( !flags && getClosestElementWithVirtualBinding( event.target, eventType ) ) ) {
-
- ve = createVirtualEvent( event, eventType );
-
- $( event.target).trigger( ve );
- }
-
- return ve;
-}
-
-function mouseEventCallback( event ) {
- var touchID = $.data( event.target, touchTargetPropertyName ),
- ve;
-
- if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ) {
- ve = triggerVirtualEvent( "v" + event.type, event );
- if ( ve ) {
- if ( ve.isDefaultPrevented() ) {
- event.preventDefault();
- }
- if ( ve.isPropagationStopped() ) {
- event.stopPropagation();
- }
- if ( ve.isImmediatePropagationStopped() ) {
- event.stopImmediatePropagation();
- }
- }
- }
-}
-
-function handleTouchStart( event ) {
-
- var touches = getNativeEvent( event ).touches,
- target, flags, t;
-
- if ( touches && touches.length === 1 ) {
-
- target = event.target;
- flags = getVirtualBindingFlags( target );
-
- if ( flags.hasVirtualBinding ) {
-
- lastTouchID = nextTouchID++;
- $.data( target, touchTargetPropertyName, lastTouchID );
-
- clearResetTimer();
-
- disableMouseBindings();
- didScroll = false;
-
- t = getNativeEvent( event ).touches[ 0 ];
- startX = t.pageX;
- startY = t.pageY;
-
- triggerVirtualEvent( "vmouseover", event, flags );
- triggerVirtualEvent( "vmousedown", event, flags );
- }
- }
-}
-
-function handleScroll( event ) {
- if ( blockTouchTriggers ) {
- return;
- }
-
- if ( !didScroll ) {
- triggerVirtualEvent( "vmousecancel", event, getVirtualBindingFlags( event.target ) );
- }
-
- didScroll = true;
- startResetTimer();
-}
-
-function handleTouchMove( event ) {
- if ( blockTouchTriggers ) {
- return;
- }
-
- var t = getNativeEvent( event ).touches[ 0 ],
- didCancel = didScroll,
- moveThreshold = $.vmouse.moveDistanceThreshold,
- flags = getVirtualBindingFlags( event.target );
-
- didScroll = didScroll ||
- ( Math.abs( t.pageX - startX ) > moveThreshold ||
- Math.abs( t.pageY - startY ) > moveThreshold );
-
- if ( didScroll && !didCancel ) {
- triggerVirtualEvent( "vmousecancel", event, flags );
- }
-
- triggerVirtualEvent( "vmousemove", event, flags );
- startResetTimer();
-}
-
-function handleTouchEnd( event ) {
- if ( blockTouchTriggers ) {
- return;
- }
-
- disableTouchBindings();
-
- var flags = getVirtualBindingFlags( event.target ),
- ve, t;
- triggerVirtualEvent( "vmouseup", event, flags );
-
- if ( !didScroll ) {
- ve = triggerVirtualEvent( "vclick", event, flags );
- if ( ve && ve.isDefaultPrevented() ) {
- // The target of the mouse events that follow the touchend
- // event don't necessarily match the target used during the
- // touch. This means we need to rely on coordinates for blocking
- // any click that is generated.
- t = getNativeEvent( event ).changedTouches[ 0 ];
- clickBlockList.push({
- touchID: lastTouchID,
- x: t.clientX,
- y: t.clientY
- });
-
- // Prevent any mouse events that follow from triggering
- // virtual event notifications.
- blockMouseTriggers = true;
- }
- }
- triggerVirtualEvent( "vmouseout", event, flags);
- didScroll = false;
-
- startResetTimer();
-}
-
-function hasVirtualBindings( ele ) {
- var bindings = $.data( ele, dataPropertyName ),
- k;
-
- if ( bindings ) {
- for ( k in bindings ) {
- if ( bindings[ k ] ) {
- return true;
- }
- }
- }
- return false;
-}
-
-function dummyMouseHandler() {}
-
-function getSpecialEventObject( eventType ) {
- var realType = eventType.substr( 1 );
-
- return {
- setup: function(/* data, namespace */) {
- // If this is the first virtual mouse binding for this element,
- // add a bindings object to its data.
-
- if ( !hasVirtualBindings( this ) ) {
- $.data( this, dataPropertyName, {} );
- }
-
- // If setup is called, we know it is the first binding for this
- // eventType, so initialize the count for the eventType to zero.
- var bindings = $.data( this, dataPropertyName );
- bindings[ eventType ] = true;
-
- // If this is the first virtual mouse event for this type,
- // register a global handler on the document.
-
- activeDocHandlers[ eventType ] = ( activeDocHandlers[ eventType ] || 0 ) + 1;
-
- if ( activeDocHandlers[ eventType ] === 1 ) {
- $document.bind( realType, mouseEventCallback );
- }
-
- // Some browsers, like Opera Mini, won't dispatch mouse/click events
- // for elements unless they actually have handlers registered on them.
- // To get around this, we register dummy handlers on the elements.
-
- $( this ).bind( realType, dummyMouseHandler );
-
- // For now, if event capture is not supported, we rely on mouse handlers.
- if ( eventCaptureSupported ) {
- // If this is the first virtual mouse binding for the document,
- // register our touchstart handler on the document.
-
- activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1;
-
- if ( activeDocHandlers[ "touchstart" ] === 1 ) {
- $document.bind( "touchstart", handleTouchStart )
- .bind( "touchend", handleTouchEnd )
-
- // On touch platforms, touching the screen and then dragging your finger
- // causes the window content to scroll after some distance threshold is
- // exceeded. On these platforms, a scroll prevents a click event from being
- // dispatched, and on some platforms, even the touchend is suppressed. To
- // mimic the suppression of the click event, we need to watch for a scroll
- // event. Unfortunately, some platforms like iOS don't dispatch scroll
- // events until *AFTER* the user lifts their finger (touchend). This means
- // we need to watch both scroll and touchmove events to figure out whether
- // or not a scroll happenens before the touchend event is fired.
-
- .bind( "touchmove", handleTouchMove )
- .bind( "scroll", handleScroll );
- }
- }
- },
-
- teardown: function(/* data, namespace */) {
- // If this is the last virtual binding for this eventType,
- // remove its global handler from the document.
-
- --activeDocHandlers[ eventType ];
-
- if ( !activeDocHandlers[ eventType ] ) {
- $document.unbind( realType, mouseEventCallback );
- }
-
- if ( eventCaptureSupported ) {
- // If this is the last virtual mouse binding in existence,
- // remove our document touchstart listener.
-
- --activeDocHandlers[ "touchstart" ];
-
- if ( !activeDocHandlers[ "touchstart" ] ) {
- $document.unbind( "touchstart", handleTouchStart )
- .unbind( "touchmove", handleTouchMove )
- .unbind( "touchend", handleTouchEnd )
- .unbind( "scroll", handleScroll );
- }
- }
-
- var $this = $( this ),
- bindings = $.data( this, dataPropertyName );
-
- // teardown may be called when an element was
- // removed from the DOM. If this is the case,
- // jQuery core may have already stripped the element
- // of any data bindings so we need to check it before
- // using it.
- if ( bindings ) {
- bindings[ eventType ] = false;
- }
-
- // Unregister the dummy event handler.
-
- $this.unbind( realType, dummyMouseHandler );
-
- // If this is the last virtual mouse binding on the
- // element, remove the binding data from the element.
-
- if ( !hasVirtualBindings( this ) ) {
- $this.removeData( dataPropertyName );
- }
- }
- };
-}
-
-// Expose our custom events to the jQuery bind/unbind mechanism.
-
-for ( i = 0; i < virtualEventNames.length; i++ ) {
- $.event.special[ virtualEventNames[ i ] ] = getSpecialEventObject( virtualEventNames[ i ] );
-}
-
-// Add a capture click handler to block clicks.
-// Note that we require event capture support for this so if the device
-// doesn't support it, we punt for now and rely solely on mouse events.
-if ( eventCaptureSupported ) {
- document.addEventListener( "click", function( e ) {
- var cnt = clickBlockList.length,
- target = e.target,
- x, y, ele, i, o, touchID;
-
- if ( cnt ) {
- x = e.clientX;
- y = e.clientY;
- threshold = $.vmouse.clickDistanceThreshold;
-
- // The idea here is to run through the clickBlockList to see if
- // the current click event is in the proximity of one of our
- // vclick events that had preventDefault() called on it. If we find
- // one, then we block the click.
- //
- // Why do we have to rely on proximity?
- //
- // Because the target of the touch event that triggered the vclick
- // can be different from the target of the click event synthesized
- // by the browser. The target of a mouse/click event that is synthesized
- // from a touch event seems to be implementation specific. For example,
- // some browsers will fire mouse/click events for a link that is near
- // a touch event, even though the target of the touchstart/touchend event
- // says the user touched outside the link. Also, it seems that with most
- // browsers, the target of the mouse/click event is not calculated until the
- // time it is dispatched, so if you replace an element that you touched
- // with another element, the target of the mouse/click will be the new
- // element underneath that point.
- //
- // Aside from proximity, we also check to see if the target and any
- // of its ancestors were the ones that blocked a click. This is necessary
- // because of the strange mouse/click target calculation done in the
- // Android 2.1 browser, where if you click on an element, and there is a
- // mouse/click handler on one of its ancestors, the target will be the
- // innermost child of the touched element, even if that child is no where
- // near the point of touch.
-
- ele = target;
-
- while ( ele ) {
- for ( i = 0; i < cnt; i++ ) {
- o = clickBlockList[ i ];
- touchID = 0;
-
- if ( ( ele === target && Math.abs( o.x - x ) < threshold && Math.abs( o.y - y ) < threshold ) ||
- $.data( ele, touchTargetPropertyName ) === o.touchID ) {
- // XXX: We may want to consider removing matches from the block list
- // instead of waiting for the reset timer to fire.
- e.preventDefault();
- e.stopPropagation();
- return;
- }
- }
- ele = ele.parentNode;
- }
- }
- }, true);
-}
-})( jQuery, window, document );
-
-(function( $ ) {
- $.mobile = {};
-}( jQuery ));
-
- (function( $, undefined ) {
- var support = {
- touch: "ontouchend" in document
- };
-
- $.mobile.support = $.mobile.support || {};
- $.extend( $.support, support );
- $.extend( $.mobile.support, support );
- }( jQuery ));
-
-
-(function( $, window, undefined ) {
- var $document = $( document ),
- supportTouch = $.mobile.support.touch,
- scrollEvent = "touchmove scroll",
- touchStartEvent = supportTouch ? "touchstart" : "mousedown",
- touchStopEvent = supportTouch ? "touchend" : "mouseup",
- touchMoveEvent = supportTouch ? "touchmove" : "mousemove";
-
- // setup new event shortcuts
- $.each( ( "touchstart touchmove touchend " +
- "tap taphold " +
- "swipe swipeleft swiperight " +
- "scrollstart scrollstop" ).split( " " ), function( i, name ) {
-
- $.fn[ name ] = function( fn ) {
- return fn ? this.bind( name, fn ) : this.trigger( name );
- };
-
- // jQuery < 1.8
- if ( $.attrFn ) {
- $.attrFn[ name ] = true;
- }
- });
-
- function triggerCustomEvent( obj, eventType, event, bubble ) {
- var originalType = event.type;
- event.type = eventType;
- if ( bubble ) {
- $.event.trigger( event, undefined, obj );
- } else {
- $.event.dispatch.call( obj, event );
- }
- event.type = originalType;
- }
-
- // also handles scrollstop
- $.event.special.scrollstart = {
-
- enabled: true,
- setup: function() {
-
- var thisObject = this,
- $this = $( thisObject ),
- scrolling,
- timer;
-
- function trigger( event, state ) {
- scrolling = state;
- triggerCustomEvent( thisObject, scrolling ? "scrollstart" : "scrollstop", event );
- }
-
- // iPhone triggers scroll after a small delay; use touchmove instead
- $this.bind( scrollEvent, function( event ) {
-
- if ( !$.event.special.scrollstart.enabled ) {
- return;
- }
-
- if ( !scrolling ) {
- trigger( event, true );
- }
-
- clearTimeout( timer );
- timer = setTimeout( function() {
- trigger( event, false );
- }, 50 );
- });
- },
- teardown: function() {
- $( this ).unbind( scrollEvent );
- }
- };
-
- // also handles taphold
- $.event.special.tap = {
- tapholdThreshold: 750,
- emitTapOnTaphold: true,
- setup: function() {
- var thisObject = this,
- $this = $( thisObject ),
- isTaphold = false;
-
- $this.bind( "vmousedown", function( event ) {
- isTaphold = false;
- if ( event.which && event.which !== 1 ) {
- return false;
- }
-
- var origTarget = event.target,
- timer;
-
- function clearTapTimer() {
- clearTimeout( timer );
- }
-
- function clearTapHandlers() {
- clearTapTimer();
-
- $this.unbind( "vclick", clickHandler )
- .unbind( "vmouseup", clearTapTimer );
- $document.unbind( "vmousecancel", clearTapHandlers );
- }
-
- function clickHandler( event ) {
- clearTapHandlers();
-
- // ONLY trigger a 'tap' event if the start target is
- // the same as the stop target.
- if ( !isTaphold && origTarget === event.target ) {
- triggerCustomEvent( thisObject, "tap", event );
- } else if ( isTaphold ) {
- event.preventDefault();
- }
- }
-
- $this.bind( "vmouseup", clearTapTimer )
- .bind( "vclick", clickHandler );
- $document.bind( "vmousecancel", clearTapHandlers );
-
- timer = setTimeout( function() {
- if ( !$.event.special.tap.emitTapOnTaphold ) {
- isTaphold = true;
- }
- triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) );
- }, $.event.special.tap.tapholdThreshold );
- });
- },
- teardown: function() {
- $( this ).unbind( "vmousedown" ).unbind( "vclick" ).unbind( "vmouseup" );
- $document.unbind( "vmousecancel" );
- }
- };
-
- // Also handles swipeleft, swiperight
- $.event.special.swipe = {
-
- // More than this horizontal displacement, and we will suppress scrolling.
- scrollSupressionThreshold: 30,
-
- // More time than this, and it isn't a swipe.
- durationThreshold: 1000,
-
- // Swipe horizontal displacement must be more than this.
- horizontalDistanceThreshold: 30,
-
- // Swipe vertical displacement must be less than this.
- verticalDistanceThreshold: 30,
-
- getLocation: function ( event ) {
- var winPageX = window.pageXOffset,
- winPageY = window.pageYOffset,
- x = event.clientX,
- y = event.clientY;
-
- if ( event.pageY === 0 && Math.floor( y ) > Math.floor( event.pageY ) ||
- event.pageX === 0 && Math.floor( x ) > Math.floor( event.pageX ) ) {
-
- // iOS4 clientX/clientY have the value that should have been
- // in pageX/pageY. While pageX/page/ have the value 0
- x = x - winPageX;
- y = y - winPageY;
- } else if ( y < ( event.pageY - winPageY) || x < ( event.pageX - winPageX ) ) {
-
- // Some Android browsers have totally bogus values for clientX/Y
- // when scrolling/zooming a page. Detectable since clientX/clientY
- // should never be smaller than pageX/pageY minus page scroll
- x = event.pageX - winPageX;
- y = event.pageY - winPageY;
- }
-
- return {
- x: x,
- y: y
- };
- },
-
- start: function( event ) {
- var data = event.originalEvent.touches ?
- event.originalEvent.touches[ 0 ] : event,
- location = $.event.special.swipe.getLocation( data );
- return {
- time: ( new Date() ).getTime(),
- coords: [ location.x, location.y ],
- origin: $( event.target )
- };
- },
-
- stop: function( event ) {
- var data = event.originalEvent.touches ?
- event.originalEvent.touches[ 0 ] : event,
- location = $.event.special.swipe.getLocation( data );
- return {
- time: ( new Date() ).getTime(),
- coords: [ location.x, location.y ]
- };
- },
-
- handleSwipe: function( start, stop, thisObject, origTarget ) {
- if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
- Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
- Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
- var direction = start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight";
-
- triggerCustomEvent( thisObject, "swipe", $.Event( "swipe", { target: origTarget, swipestart: start, swipestop: stop }), true );
- triggerCustomEvent( thisObject, direction,$.Event( direction, { target: origTarget, swipestart: start, swipestop: stop } ), true );
- return true;
- }
- return false;
-
- },
-
- // This serves as a flag to ensure that at most one swipe event event is
- // in work at any given time
- eventInProgress: false,
-
- setup: function() {
- var events,
- thisObject = this,
- $this = $( thisObject ),
- context = {};
-
- // Retrieve the events data for this element and add the swipe context
- events = $.data( this, "mobile-events" );
- if ( !events ) {
- events = { length: 0 };
- $.data( this, "mobile-events", events );
- }
- events.length++;
- events.swipe = context;
-
- context.start = function( event ) {
-
- // Bail if we're already working on a swipe event
- if ( $.event.special.swipe.eventInProgress ) {
- return;
- }
- $.event.special.swipe.eventInProgress = true;
-
- var stop,
- start = $.event.special.swipe.start( event ),
- origTarget = event.target,
- emitted = false;
-
- context.move = function( event ) {
- if ( !start || event.isDefaultPrevented() ) {
- return;
- }
-
- stop = $.event.special.swipe.stop( event );
- if ( !emitted ) {
- emitted = $.event.special.swipe.handleSwipe( start, stop, thisObject, origTarget );
- if ( emitted ) {
-
- // Reset the context to make way for the next swipe event
- $.event.special.swipe.eventInProgress = false;
- }
- }
- // prevent scrolling
- if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) {
- event.preventDefault();
- }
- };
-
- context.stop = function() {
- emitted = true;
-
- // Reset the context to make way for the next swipe event
- $.event.special.swipe.eventInProgress = false;
- $document.off( touchMoveEvent, context.move );
- context.move = null;
- };
-
- $document.on( touchMoveEvent, context.move )
- .one( touchStopEvent, context.stop );
- };
- $this.on( touchStartEvent, context.start );
- },
-
- teardown: function() {
- var events, context;
-
- events = $.data( this, "mobile-events" );
- if ( events ) {
- context = events.swipe;
- delete events.swipe;
- events.length--;
- if ( events.length === 0 ) {
- $.removeData( this, "mobile-events" );
- }
- }
-
- if ( context ) {
- if ( context.start ) {
- $( this ).off( touchStartEvent, context.start );
- }
- if ( context.move ) {
- $document.off( touchMoveEvent, context.move );
- }
- if ( context.stop ) {
- $document.off( touchStopEvent, context.stop );
- }
- }
- }
- };
- $.each({
- scrollstop: "scrollstart",
- taphold: "tap",
- swipeleft: "swipe.left",
- swiperight: "swipe.right"
- }, function( event, sourceEvent ) {
-
- $.event.special[ event ] = {
- setup: function() {
- $( this ).bind( sourceEvent, $.noop );
- },
- teardown: function() {
- $( this ).unbind( sourceEvent );
- }
- };
- });
-
-})( jQuery, this );
-
-
-}));
diff --git a/erp_web/js/jquery-asDatepicker/demo/js/jquery.mobile.custom.min.js b/erp_web/js/jquery-asDatepicker/demo/js/jquery.mobile.custom.min.js
deleted file mode 100644
index bf14ddf6..00000000
--- a/erp_web/js/jquery-asDatepicker/demo/js/jquery.mobile.custom.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */
-
-(function(e,t,n){typeof define=="function"&&define.amd?define(["jquery"],function(r){return n(r,e,t),r.mobile}):n(e.jQuery,e,t)})(this,document,function(e,t,n,r){(function(e,n){e.extend(e.support,{orientation:"orientation"in t&&"onorientationchange"in t})})(e),function(e){e.event.special.throttledresize={setup:function(){e(this).bind("resize",n)},teardown:function(){e(this).unbind("resize",n)}};var t=250,n=function(){s=(new Date).getTime(),o=s-r,o>=t?(r=s,e(this).trigger("throttledresize")):(i&&clearTimeout(i),i=setTimeout(n,t-o))},r=0,i,s,o}(e),function(e,t){function p(){var e=s();e!==o&&(o=e,r.trigger(i))}var r=e(t),i="orientationchange",s,o,u,a,f={0:!0,180:!0},l,c,h;if(e.support.orientation){l=t.innerWidth||r.width(),c=t.innerHeight||r.height(),h=50,u=l>c&&l-c>h,a=f[t.orientation];if(u&&a||!u&&!a)f={"-90":!0,90:!0}}e.event.special.orientationchange=e.extend({},e.event.special.orientationchange,{setup:function(){if(e.support.orientation&&!e.event.special.orientationchange.disabled)return!1;o=s(),r.bind("throttledresize",p)},teardown:function(){if(e.support.orientation&&!e.event.special.orientationchange.disabled)return!1;r.unbind("throttledresize",p)},add:function(e){var t=e.handler;e.handler=function(e){return e.orientation=s(),t.apply(this,arguments)}}}),e.event.special.orientationchange.orientation=s=function(){var r=!0,i=n.documentElement;return e.support.orientation?r=f[t.orientation]:r=i&&i.clientWidth/i.clientHeight<1.1,r?"portrait":"landscape"},e.fn[i]=function(e){return e?this.bind(i,e):this.trigger(i)},e.attrFn&&(e.attrFn[i]=!0)}(e,this),function(e,t,n,r){function T(e){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d
i||Math.abs(n.pageY-p)>i,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0)),P("vmouseout",e,t),d=!1,_()}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],f=e.event.props.concat(a),l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(x=0;xMath.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(se.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};t=e.data(this,"mobile-events"),t||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)},r.on(u,s.start)},teardown:function(){var t,n;t=e.data(this,"mobile-events"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}})}(e,this)});
\ No newline at end of file
diff --git a/erp_web/js/jquery-asDatepicker/demo/js/jquery.toc.min.js b/erp_web/js/jquery-asDatepicker/demo/js/jquery.toc.min.js
deleted file mode 100644
index 675c789e..00000000
--- a/erp_web/js/jquery-asDatepicker/demo/js/jquery.toc.min.js
+++ /dev/null
@@ -1,8 +0,0 @@
-/*!
- * toc - jQuery Table of Contents Plugin
- * v0.1.2
- * http://projects.jga.me/toc/
- * copyright Greg Allen 2013
- * MIT License
-*/
-(function(t){t.fn.toc=function(e){var n,i=this,r=t.extend({},jQuery.fn.toc.defaults,e),o=t(r.container),a=t(r.selectors,o),l=[],h=r.prefix+"-active",s=function(e){if(r.smoothScrolling){e.preventDefault();var n=t(e.target).attr("href"),o=t(n);t("body,html").animate({scrollTop:o.offset().top},400,"swing",function(){location.hash=n})}t("li",i).removeClass(h),t(e.target).parent().addClass(h)},c=function(){n&&clearTimeout(n),n=setTimeout(function(){for(var e,n=t(window).scrollTop(),o=0,a=l.length;a>o;o++)if(l[o]>=n){t("li",i).removeClass(h),e=t("li:eq("+(o-1)+")",i).addClass(h),r.onHighlight(e);break}},50)};return r.highlightOnScroll&&(t(window).bind("scroll",c),c()),this.each(function(){var e=t(this),n=t("");a.each(function(i,o){var a=t(o);l.push(a.offset().top-r.highlightOffset),t(" ").attr("id",r.anchorName(i,o,r.prefix)).insertBefore(a);var h=t(" ").text(r.headerText(i,o,a)).attr("href","#"+r.anchorName(i,o,r.prefix)).bind("click",function(n){s(n),e.trigger("selected",t(this).attr("href"))}),c=t(" ").addClass(r.itemClass(i,o,a,r.prefix)).append(h);n.append(c)}),e.html(n)})},jQuery.fn.toc.defaults={container:"body",selectors:"h1,h2,h3",smoothScrolling:!0,prefix:"toc",onHighlight:function(){},highlightOnScroll:!0,highlightOffset:100,anchorName:function(t,e,n){return n+t},headerText:function(t,e,n){return n.text()},itemClass:function(t,e,n,i){return i+"-"+n[0].tagName.toLowerCase()}}})(jQuery);
\ No newline at end of file
diff --git a/erp_web/js/jquery-asDatepicker/demo/js/language.js b/erp_web/js/jquery-asDatepicker/demo/js/language.js
deleted file mode 100644
index fb7377e7..00000000
--- a/erp_web/js/jquery-asDatepicker/demo/js/language.js
+++ /dev/null
@@ -1,9 +0,0 @@
-jQuery(function($) {
- $.asDatepicker.localize("zh", {
- days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
- daysShort: ["日", "一", "二", "三", "四", "五", "六"],
- months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
- monthsShort: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],
- caption_format: 'yyyy年m月dd日'
- });
-})
\ No newline at end of file
diff --git a/erp_web/js/jquery-asDatepicker/demo/js/prism.js b/erp_web/js/jquery-asDatepicker/demo/js/prism.js
deleted file mode 100644
index 07e3e612..00000000
--- a/erp_web/js/jquery-asDatepicker/demo/js/prism.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Prism: Lightweight, robust, elegant syntax highlighting
- * MIT license http://www.opensource.org/licenses/mit-license.php/
- * @author Lea Verou http://lea.verou.me
- */(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(//g,">").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data));l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r){return n.stringify(t.tokenize(e,r))},tokenize:function(e,n){var r=t.Token,i=[e],s=n.rest;if(s){for(var o in s)n[o]=s[o];delete n.rest}e:for(var o in n){if(!n.hasOwnProperty(o)||!n[o])continue;var u=n[o],a=u.inside,f=!!u.lookbehind||0;u=u.pattern||u;for(var l=0;le.length)break e;if(c instanceof r)continue;u.lastIndex=0;var h=u.exec(c);if(h){f&&(f=h[1].length);var p=h.index-1+f,h=h[0].slice(f),d=h.length,v=p+d,m=c.slice(0,p+1),g=c.slice(v+1),y=[l,1];m&&y.push(m);var b=new r(o,a?t.tokenize(h,a):h);y.push(b);g&&y.push(g);Array.prototype.splice.apply(i,y)}}}return i},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(n.stringify).join("");var r={type:e.type,content:n.stringify(e.content),tag:"span",classes:["token",e.type],attributes:{}};r.type=="comment"&&(r.attributes.spellcheck="true");t.hooks.run("wrap",r);var i="";for(var s in r.attributes)i+=s+'="'+(r.attributes[s]||"")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'" '+i+">"+r.content+""+r.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
-Prism.languages.markup={comment:/<!--[\w\W]*?--(>|>)/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]+?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
-Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:/@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi,url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,property:/(\b|\B)[a-z-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
diff --git a/erp_web/js/jquery-asDatepicker/images/calendar-next-hover.png b/erp_web/js/jquery-asDatepicker/images/calendar-next-hover.png
deleted file mode 100644
index 365d8301..00000000
Binary files a/erp_web/js/jquery-asDatepicker/images/calendar-next-hover.png and /dev/null differ
diff --git a/erp_web/js/jquery-asDatepicker/images/calendar-next.png b/erp_web/js/jquery-asDatepicker/images/calendar-next.png
deleted file mode 100644
index 62ada918..00000000
Binary files a/erp_web/js/jquery-asDatepicker/images/calendar-next.png and /dev/null differ
diff --git a/erp_web/js/jquery-asDatepicker/images/calendar-prev-hover.png b/erp_web/js/jquery-asDatepicker/images/calendar-prev-hover.png
deleted file mode 100644
index 5d8406a6..00000000
Binary files a/erp_web/js/jquery-asDatepicker/images/calendar-prev-hover.png and /dev/null differ
diff --git a/erp_web/js/jquery-asDatepicker/images/calendar-prev.png b/erp_web/js/jquery-asDatepicker/images/calendar-prev.png
deleted file mode 100644
index dfc50167..00000000
Binary files a/erp_web/js/jquery-asDatepicker/images/calendar-prev.png and /dev/null differ
diff --git a/erp_web/js/jquery-asDatepicker/js/jquery-asDatepicker.js b/erp_web/js/jquery-asDatepicker/js/jquery-asDatepicker.js
deleted file mode 100644
index f2555bb6..00000000
--- a/erp_web/js/jquery-asDatepicker/js/jquery-asDatepicker.js
+++ /dev/null
@@ -1,2158 +0,0 @@
-/*
- * asDatepicker
- * https://www.sucaijiayuan.com
- * Copyright (c) 2014 amazingSurge
- * Licensed under the MIT license.
- *
- // 初始化日期范围选择控件
- var datepicker = function($this){
- var d = $this.val().split(' -- ');
- if ($.trim(d[0]) == '' || strToDate($.trim(d[0])) == 'Invalid Date'){
- d[0] = new Date().format("yyyy-MM-dd");
- }
- if ($.trim(d[1]) == '' || strToDate($.trim(d[1])) == 'Invalid Date'){
- d[1] = d[0];
- }
- $("#beginDate").val(d[0]);
- $("#endDate").val(d[1]);
- $this.inputmask('remove').inputmask({mask: "y-m-d -- y-m-d",
- alias:"yyyy/mm/dd", placeholder: "yyyy-MM-dd -- yyyy-MM-dd"})
- .asDatepicker('destroy').asDatepicker({mode:'range', date:d[0] + ' -- ' + d[1]})
- .unbind('blur').bind('blur', function(){
- datepicker($(this));
- });
- }
- datepicker($('#calendar2').val($("#beginDate").val() + ' -- ' + $("#endDate").val()));
-
- */
-(function($, document, window, undefined) {
- // Optional, but considered best practice by some
- "use strict";
-
- var pluginName = 'asDatepicker',
- defaults = {
- firstDayOfWeek: 0, // 0---6 === sunday---saturday
- mode: 'single', // single|range|multiple
- displayMode: 'dropdown', // dropdown|inline
- calendars: 1,
- date: 'today', // today|Date (yyyy-mm-dd)
- keyboard: true, // true | false
- rangeSeparator: '--',
- multipleSeparator: ',',
- multipleSize: 5,
-
- container: 'body',
- position: 'bottom', // top|right|bottom|left|rightTop|leftTop
- alwaysShow: false, // true or false
- onceClick: false, // true or false
-
- min: null, // min: '2012-12-1',//null|'today'|days|Date with (yyyy-mm-dd)
- max: null, // max: '2013-10-1',//null|'today'|days|Date with (yyyy-mm-dd)
-
- selectableDate: [], // ['2013-8-1', {from: '2013-8-5', to: '2013-8-10'}, {from: -30, to: 30}]],
-
- selectableYear: [], // [{from: 1980, to: 1985}, 1988, {from: 2000, to: 2010}, 2013],
- selectableMonth: [], // months from 0 - 11 (jan to dec) example: [0, {from: 3, to: 9}, 11],
- selectableDay: [], // days from 0 - 31,
-
- selectableDayOfWeek: [], // days of week 0-6 (su to sa) [0, {from: 2, to: 4}] , [] is default all
-
- lang: 'zh', //'chinese'
- views: ['days'], // ['days'], ['days', 'months', 'years']
- outputFormat: 'yyyy-mm-dd',
-
- mobileMode: false,
-
- namespace: 'calendar',
- tplInputWrapper: function() {
- return '
';
- },
- tplWrapper: function() {
- return '
';
- },
- tplContent: function() {
- return '' +
- '' +
- '
' +
- '
' +
- '
' +
- '
' +
- '
';
- },
- tplTitle: function() {
- return 'test
';
- },
- onInit: null,
- onReady: null,
- onRender: null,
- onChange: null,
- onBeforeShow: null,
- onShow: null,
- onBeforeHide: null,
- onHide: null
- };
-
- var $doc = $(document);
-
- var $win = $(window);
-
- var LABEL = {};
-
- var SHOWED = 0;
-
-
-
- var Plugin = $[pluginName] = function(element, options) {
- var self = this,
- data = $(element).data();
-
- this.$el = $(element);
-
- this.defaultOptions = $.extend(true, {}, defaults, options, data);
- this.options = $.extend(true, {}, defaults, options, data);
-
- $.each(data, function(option, value) {
- self.options[option] = self._parseHtmlString(option, value);
- self.defaultOptions[option] = self._parseHtmlString(option, value);
- });
-
- this.namespace = this.options.namespace;
-
- this.$inputWrap = this.$el.addClass(this.namespace + '-input').wrap(this.options.tplInputWrapper().replace(/namespace/g, this.namespace)).parent();
- this.$inputIcon = $(' ');
-
- this.$inputIcon.appendTo(this.$inputWrap);
-
- this.$container = $(this.options.container);
-
- this._trigger('init');
- this._init();
- };
-
- Plugin.LABEL = LABEL;
-
- Plugin.localize = function(lang, label) {
- LABEL[lang] = label;
- };
-
- Plugin.localize('en', {
- days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
- daysShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
- buttons: ['Cancel', 'Save']
- });
-
- Plugin.localize("zh", {
- days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"],
- daysShort: ["日", "一", "二", "三", "四", "五", "六"],
- months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
- monthsShort: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"],
- buttons: ['取消', '确定']
- });
-
- Plugin.prototype = {
- constructor: Plugin,
- _init: function() {
- this.mode = this.options.mode;
- this.format = this._parseFormat('yyyy-mm-dd');
- this.outputFormat = this._parseFormat(this.options.outputFormat || 'yyyy/mm/dd');
- this.focused = 0;
- this.flag = SHOWED++;
- this.pickerHide = false;
- this.selected = false;
- this.showed = false;
- this.bound = false;
- this.hasKeyboard = this.options.keyboard;
- this.map = {};
- this.views = [];
- this.isMobile = this.options.mobileMode; //with other judgements
-
- var wrapper = this.options.tplWrapper().replace(/namespace/g, this.namespace),
- content = this.options.tplContent().replace(/namespace/g, this.namespace),
- title = this.options.tplTitle().replace(/namespace/g, this.namespace),
- buttons = LABEL[this.options.lang].buttons;
- this.$picker = $(wrapper);
-
- //set model default property
- switch (this.mode) {
- case 'single':
- this.calendarsNum = 1;
- break;
- case 'range':
- this.calendarsNum = 2;
- break;
- case 'multiple':
- this.calendarsNum = this.isMobile ? 1 : this.options.calendars;
- this.options.views = ['days'];
- break;
- }
-
- //set base Views
- for (var i = 0; i < this.calendarsNum; i++) {
- this.$picker.append(content);
- this.views[i] = this.options.views[i] || 'days';
- }
-
- //check mobileMode
- if (this.isMobile) {
- var innerWidth = window.innerWidth;
- var innerHeight = window.innerHeight;
- var min = Math.min(innerWidth, innerHeight);
- this.$el.attr('readonly', 'readonly');
- this.$cover = $('
');
-
- this.$picker.append(title)
- .addClass(this.namespace + '_isMobile');
-
- this.$picker.css({
- 'font-size': Math.round(min * 0.04) + 'px'
- });
- }
-
- //make $wrapper can be focused
- this.$picker.attr('tabindex', '0');
-
- //init status in different display mode
- this._initStatus(this.options.displayMode);
- //init pointer
- this._initSections();
- //init default Date
- this._initDate();
-
- for (var j = 0; j < this.calendarsNum; j++) {
- this._manageViews(j);
- if (this.isMobile) {
- this.buttonCancels.eq(j).html(buttons[0]);
- this.buttonSaves.eq(j).html(buttons[1]);
- }
- }
-
- //init alwaysShow
- this._initShowHide(this.options.alwaysShow);
-
- this._setValue();
-
- this._trigger('ready');
- },
- _initStatus: function(displayMode) {
- if (displayMode === 'inline') {
- this.options.alwaysShow = true;
- // this.$el.after(this.$picker).addClass(this.namespace + '_hide');
- this.$picker.addClass(this.namespace + '_show');
-
- this.$picker.on({
- focus: $.proxy(this._focus, this),
- blur: $.proxy(this._blur, this)
- });
- } else if (displayMode === 'dropdown') {
- this.$el.on({
- focus: $.proxy(this._focus, this),
- blur: $.proxy(this._blur, this)
- });
- this.$inputIcon.on('click.inputIcon', $.proxy(this._toggle, this));
-
- this.$picker.appendTo(this.options.container);
- // this.$picker.addClass(this.namespace + '_absolute');
- }
- },
- _initSections: function() {
- this.calendars = this.$picker.find('.' + this.namespace + '-content');
- this.calendarPrevs = this.calendars.find('.' + this.namespace + '-prev');
- this.calendarCaptions = this.calendars.find('.' + this.namespace + '-caption');
- this.calendarNexts = this.calendars.find('.' + this.namespace + '-next');
- this.daypickers = this.calendars.find('.' + this.namespace + '-days');
- this.monthpickers = this.calendars.find('.' + this.namespace + '-months');
- this.yearpickers = this.calendars.find('.' + this.namespace + '-years');
- this.buttonCancels = this.calendars.find('.' + this.namespace + '-button-cancel');
- this.buttonSaves = this.calendars.find('.' + this.namespace + '-button-save');
- },
- _initShowHide: function(alwaysShow) {
- if (alwaysShow === true) {
- this.show();
- }
- },
- _initDate: function() {
- var date = this.options.date === 'today' ? new Date() : this._parseDate(this.options.date, this.format);
-
- this._date = {};
-
- if (this.options.date === 'today'){
- this._date.currentDate = [new Date(date)];
- }
- else if (this.options.mode == 'range'){
- var ds = this.options.date.split(' ' + this.options.rangeSeparator + ' ');
- ds[0] = this._parseDate(ds[0], this.format);
- ds[1] = this._parseDate(ds[1], this.format);
- this._date.currentDate = [new Date(ds[0]), new Date(ds[1])];
- }
-
- if (this.options.mode == 'range'){
- this._date.selectedDate = [this._date.currentDate[0], this._date.currentDate[1]];
- this._date.focusDate = this._date.currentDate[0];
- this._date.focusDate.setHours(0, 0, 0, 0);
- }
- else if (this.mode === 'multiple') {
- this._date.selectedDate = [];
- this._date.focusDate = new Date(date);
- this._date.focusDate.setHours(0, 0, 0, 0);
- } else {
- this._date.selectedDate = [new Date(date)];
- this._date.focusDate = [new Date(date)];
- }
-
- this._date.currentDay = [];
- this._date.currentMonth = [];
- this._date.currentYear = [];
-
- this._date.currentMonthDate = [];
- this._date.currentYearDate = [];
-
- this._date.selectedDay = [];
- this._date.selectedMonth = [];
- this._date.selectedYear = [];
-
- this._date.selectedMonthDate = [];
- this._date.selectedYearDate = [];
-
- this._date.cache = {};
- this._date.cache.currentDate = [];
- this._date.cache.selectedDate = [];
-
- for (var i = 0; i < this.calendarsNum; i++) {
- this._date.currentDate[i] = this._date.currentDate[i] || new Date(date);
- if (this.mode === 'multiple') {
- this._setDate(this._date.currentDate[i], 'month', this._date.currentDate[i].getMonth() + i);
- } else {
- this._date.selectedDate[i] = this._date.selectedDate[i] || new Date(date);
- this._date.selectedDate[i].setHours(0, 0, 0, 0);
-
- this._date.focusDate[i] = this._date.focusDate[i] || new Date(date);
- this._date.focusDate[i].setHours(0, 0, 0, 0);
- }
- this._updateDate(i);
- }
- },
- _manageViews: function(index) {
- switch (this.views[index]) {
- case 'days':
- this._generateDaypicker(index);
- this.calendars.eq(index).addClass(this.namespace + '_days')
- .removeClass(this.namespace + '_months')
- .removeClass(this.namespace + '_years');
- break;
- case 'months':
- this._generateMonthpicker(index);
- this.calendars.eq(index).removeClass(this.namespace + '_days')
- .addClass(this.namespace + '_months')
- .removeClass(this.namespace + '_years');
- break;
- case 'years':
- this._generateYearpicker(index);
- this.calendars.eq(index).removeClass(this.namespace + '_days')
- .removeClass(this.namespace + '_months')
- .addClass(this.namespace + '_years');
- break;
- }
- },
- _generateDaypicker: function(index) {
- this._generateHeader(index, LABEL[this.options.lang].months[this._date.currentMonth[index]] + ' ' + this._date.currentYear[index]);
- this.daypickers.eq(index).html(this._generateDays(index));
- },
- _generateMonthpicker: function(index) {
- this._generateHeader(index, this._date.currentYear[index]);
- this.monthpickers.eq(index).html(this._generateMonths(index));
- },
- _generateYearpicker: function(index) {
- this._generateHeader(index, this._date.currentYear[index] - 7 + ' ' + this.options.rangeSeparator + ' ' + (this._date.currentYear[index] + 4));
- this.yearpickers.eq(index).html(this._generateYears(index));
- },
- _generateHeader: function(index, caption) {
- this.calendarCaptions.eq(index).html(caption);
- this._judgeLock(index);
- },
- _generateDays: function(index) {
- var year = this._date.currentYear[index],
- month = this._date.currentMonth[index],
- day,
- daysInMonth = new Date(year, month + 1, 0).getDate(),
- firstDay = new Date(year, month, 1).getDay(),
- daysInPrevMonth = new Date(year, month, 0).getDate(),
- daysFromPrevMonth = firstDay - this.options.firstDayOfWeek,
- html = '',
- isUntouch, isActive, isInRange, rangeUntouch, content, className,
- status = [],
- dateArray = [];
-
- daysFromPrevMonth = daysFromPrevMonth < 0 ? 7 + daysFromPrevMonth : daysFromPrevMonth;
-
- for (var i = 0; i < 7; i++) {
- var pos = this.options.firstDayOfWeek + i > 6 ? this.options.firstDayOfWeek + i - 7 : this.options.firstDayOfWeek + i;
- html += '' + LABEL[this.options.lang].daysShort[pos] + ' ';
- }
-
- html += '
';
-
- for (var j = 0; j < 42; j++) {
- day = (j - daysFromPrevMonth + 1);
- isActive = false;
- isInRange = false;
- isUntouch = false;
- rangeUntouch = false;
- status = [isUntouch, isActive, isInRange, rangeUntouch];
- content = 0;
- className = '';
-
- if (j > 0 && j % 7 === 0) {
- html += '
';
- }
-
- if (j < daysFromPrevMonth) {
- //prev month days
- className = this.namespace + '_otherMonth';
- content = (daysInPrevMonth - daysFromPrevMonth + j + 1);
- dateArray[j] = new Date(year, month - 1, content, 0, 0, 0, 0);
- } else if (j > (daysInMonth + daysFromPrevMonth - 1)) {
- //next month days
- className = this.namespace + '_otherMonth';
- content = (day - daysInMonth);
- dateArray[j] = new Date(year, (month + 1), content, 0, 0, 0, 0);
- } else {
- //current month days
- dateArray[j] = new Date(year, month, day, 0, 0, 0, 0);
- content = day;
- if (this.hasKeyboard) {
- if (this.mode === 'multiple') {
- if (Date.parse(dateArray[j]) === Date.parse(this._date.focusDate)) {
- className += ' ' + this.namespace + '_focus';
- }
- } else {
- if (Date.parse(dateArray[j]) === Date.parse(this._date.focusDate[index])) {
- className += ' ' + this.namespace + '_focus';
- }
- }
- }
-
-
- }
- status = this._judgeStatus(index, 'days', this.mode, status, dateArray[j], this._date.selectedDate);
- className += this._renderStatus(status);
- html += '' + content + ' ';
- }
- html += '
';
- return html;
- },
- _generateMonths: function(index) {
- var year = this._date.currentYear[index],
- html = '',
- className,
- content = LABEL[this.options.lang].monthsShort,
- dateArray = [],
- focus = this._date.focusDate[index],
- isActive, isInRange, isUntouch, rangeUntouch,
- status = [];
-
- html += '';
- for (var i = 0; i < 12; i++) {
- isActive = false;
- isInRange = false;
- isUntouch = false;
- rangeUntouch = false;
- status = [isUntouch, isActive, isInRange, rangeUntouch];
- className = '';
-
- if (i > 0 && i % 3 === 0) {
- html += '
';
- }
- dateArray[i] = new Date(year, i, 1, 0, 0, 0, 0);
-
- if (this.hasKeyboard) {
- if (Date.parse(dateArray[i]) === Date.parse(new Date(focus.getFullYear(), focus.getMonth(), 1, 0, 0, 0, 0))) {
- className += ' ' + this.namespace + '_focus';
- }
- }
-
- status = this._judgeStatus(index, 'months', this.mode, status, dateArray[i], this._date.selectedMonthDate);
- className += this._renderStatus(status);
-
- html += '' + content[i] + ' ';
- }
- html += '
';
- return html;
- },
- _generateYears: function(index) {
- var year = this._date.currentYear[index],
- html = '',
- className,
- content = 0,
- dateArray = [],
- focus = this._date.focusDate[index],
- isActive, isInRange, isUntouch, rangeUntouch,
- status = [];
-
- html += '';
- for (var m = 0; m < 12; m++) {
- isActive = false;
- isInRange = false;
- isUntouch = false;
- rangeUntouch = false;
- status = [isUntouch, isActive, isInRange, rangeUntouch];
- className = '';
-
- content = year - 7 + m;
- if (m > 0 && m % 3 === 0) {
- html += '
';
- }
- dateArray[m] = new Date(content, 0, 1, 0, 0, 0, 0);
-
- if (this.hasKeyboard) {
- if (Date.parse(dateArray[m]) === Date.parse(new Date(focus.getFullYear(), 0, 1, 0, 0, 0, 0))) {
- className += ' ' + this.namespace + '_focus';
- }
- }
-
- status = this._judgeStatus(index, 'years', this.mode, status, dateArray[m], this._date.selectedYearDate);
- className += this._renderStatus(status);
-
- html += '' + content + ' ';
- }
- html += '
';
- return html;
- },
- _judgeLock: function(index) {
- var prevLock = false,
- nextLock = false,
- current, selected;
- switch (this.mode) {
- case 'range':
- if (index === 0) {
- switch (this.views[index]) {
- case 'days':
- current = Date.parse(this._date.currentDate[index]);
- selected = Date.parse(this._date.selectedMonthDate[1]);
- break;
- case 'months':
- current = Date.parse(this._date.currentYearDate[index]);
- selected = Date.parse(this._date.selectedYearDate[1]);
- break;
- case 'years':
- current = new Date(this._date.currentYearDate[index]).setFullYear(this._date.currentYear[index] + 4);
- selected = Date.parse(this._date.selectedYearDate[1]);
- break;
- }
- nextLock = !this._setPoint('<', nextLock, current, selected);
- } else {
- switch (this.views[index]) {
- case 'days':
- current = Date.parse(this._date.currentDate[index]);
- selected = Date.parse(this._date.selectedMonthDate[0]);
- break;
- case 'months':
- current = Date.parse(this._date.currentYearDate[index]);
- selected = Date.parse(this._date.selectedYearDate[0]);
- break;
- case 'years':
- current = new Date(this._date.currentYearDate[index]).setFullYear(this._date.currentYear[index] - 7);
- selected = Date.parse(this._date.selectedYearDate[0]);
- break;
- }
- prevLock = !this._setPoint('>', prevLock, current, selected);
- }
- break;
- case 'multiple':
- if (this.calendarsNum > 1) {
- if (index === 0) {
- nextLock = true;
- } else if (index === this.calendarsNum - 1) {
- prevLock = true;
- } else {
- prevLock = nextLock = true;
- }
- }
- break;
- }
- if (prevLock === true) {
- this.calendarPrevs.eq(index).addClass(this.namespace + '_blocked');
- } else {
- this.calendarPrevs.eq(index).removeClass(this.namespace + '_blocked');
- }
-
- if (nextLock === true) {
- this.calendarNexts.eq(index).addClass(this.namespace + '_blocked');
- } else {
- this.calendarNexts.eq(index).removeClass(this.namespace + '_blocked');
- }
- },
- _judgeSection: function(currentDate, startDate, endDate) {
- var status = true;
-
- if (currentDate < startDate || currentDate > endDate) {
- status = false;
- }
- return status;
- },
- _judgeSections: function(type, currentDate, dateArray, isDay) {
- var self = this,
- status = false;
- switch (type) {
- case 'date':
- if (isDay) {
- currentDate = Date.parse(currentDate);
- $.each(dateArray, function(i, date) {
- if (!status) {
- switch (date.length) {
- case undefined:
- if (currentDate === Date.parse(date)) {
- status = true;
- }
- break;
- case 2:
- status = self._judgeSection(currentDate, Date.parse(date[0]), Date.parse(date[1]));
- break;
- }
- }
- });
-
- } else {
- var min = Date.parse(currentDate[0]),
- max = Date.parse(currentDate[1]);
- $.each(dateArray, function(i, date) {
- if (!status) {
- switch (date.length) {
- case undefined:
- if (Date.parse(date) >= min && Date.parse(date) <= max) {
- status = true;
- }
- break;
- case 2:
- status = true;
- if (max < Date.parse(date[0]) || min > Date.parse(date[1])) {
- status = false;
- }
- break;
- }
- }
- });
- }
- break;
- case 'block':
- $.each(dateArray, function(i, date) {
- if (!status) {
- switch (date.length) {
- case undefined:
- if (currentDate === date) {
- status = true;
- }
- break;
- case 2:
- status = self._judgeSection(currentDate, date[0], date[1]);
- break;
- }
- }
- });
- break;
- case 'dayOfWeek':
- var curr = currentDate.getDay();
- $.each(dateArray, function(i, date) {
- if (!status) {
- switch (date.length) {
- case undefined:
- if (curr === date) {
- status = true;
- }
- break;
- case 2:
- status = self._judgeSection(curr, date[0], date[1]);
- break;
- }
- }
- });
- break;
- }
- return status;
- },
- _judgeStatus: function(index, view, mode, status, currentDate, selectedDate) {
- var untouch = status[0],
- active = status[1],
- inRange = status[2];
- untouch = !this._isSelectable(view, currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
-
- switch (mode) {
- case 'single':
- active = this._setPoint('=', active, Date.parse(currentDate), Date.parse(selectedDate[index]));
- break;
- case 'range':
- active = this._setPoint('=', active, Date.parse(currentDate), Date.parse(selectedDate[index]));
- inRange = this._setSection(inRange, currentDate, selectedDate[0], selectedDate[1]);
- if (index === 0) {
- untouch = this._setPoint('>', untouch, Date.parse(currentDate), Date.parse(selectedDate[1]));
- } else if (index === 1) {
- untouch = this._setPoint('<', untouch, Date.parse(currentDate), Date.parse(selectedDate[0]));
- }
- break;
- case 'multiple':
- for (var i = 0; i < this._date.selectedDate.length; i++) {
- if (Date.parse(currentDate) === selectedDate[i]) {
- active = true;
- }
- }
- break;
- }
- return status = [untouch, active, inRange];
- },
- _setPoint: function(type, status, currentDate, selectedDate) {
- var _status = status;
-
- switch (type) {
- case '=':
- if (currentDate === selectedDate) {
- _status = true;
- }
- break;
- case '<':
- if (currentDate < selectedDate) {
- _status = true;
- }
- break;
- case '>':
- if (currentDate > selectedDate) {
- _status = true;
- }
- break;
- }
- return _status;
- },
- _setSection: function(status, currentDate, startDate, endDate) {
- var _status = status,
- _current = Date.parse(currentDate),
- _start = Date.parse(startDate),
- _end = Date.parse(endDate);
- if (_current >= _start && _current <= _end) {
- _status = true;
- }
- return _status;
- },
- _isSelectable: function(view, y, m, d) {
- var isSelectable = true,
-
- min = this._parseDate(this.options.min, this.format),
- max = this._parseDate(this.options.max, this.format),
-
- selectableDate = this._parseDateArr(this.options.selectableDate, this.format),
-
- selectableYear = this._parseDateSection(this.options.selectableYear),
- selectableMonth = this._parseDateSection(this.options.selectableMonth),
- selectableDay = this._parseDateSection(this.options.selectableDay),
-
- selectableDayOfWeek = this._parseDateSection(this.options.selectableDayOfWeek);
-
- var _minDate, _maxDate, _curr, _isDay;
- switch (view) {
- case 'years':
- _minDate = new Date(y, 0, 1); //the first day in year
- _maxDate = new Date(y + 1, 0, 0); //the last day in year
- _curr = [_minDate, _maxDate];
- _isDay = false;
- break;
- case 'months':
- _minDate = new Date(y, m, 1); //the first day in month
- _maxDate = new Date(y, m + 1, 0); //the last day in month
- _curr = [_minDate, _maxDate];
- _isDay = false;
- break;
- case 'days':
- _minDate = _maxDate = _curr = new Date(y, m, d);
- _isDay = true;
- break;
- }
-
- if (min && min > _maxDate) {
- isSelectable = false;
- }
- if (max && max < _minDate) {
- isSelectable = false;
- }
-
- if (isSelectable && selectableDate.length > 0) {
- isSelectable = this._judgeSections('date', _curr, selectableDate, _isDay);
- }
-
- if (isSelectable && selectableYear.length > 0) {
- isSelectable = this._judgeSections('block', y, selectableYear);
- }
-
- if (view === 'months' || view === 'days') {
- if (isSelectable && selectableMonth.length > 0) {
- isSelectable = this._judgeSections('block', m, selectableMonth);
- }
- }
-
- if (view === 'days') {
- if (isSelectable && selectableDay.length > 0) {
- isSelectable = this._judgeSections('block', d, selectableDay);
- }
-
- if (isSelectable && selectableDayOfWeek.length > 0) {
- isSelectable = this._judgeSections('dayOfWeek', new Date(y, m, d), selectableDayOfWeek);
- }
- }
-
- return isSelectable;
- },
- _renderStatus: function(status) {
- var untouch = status[0],
- active = status[1],
- inRange = status[2],
- rangeUntouch = status[3],
- className = '';
- if (rangeUntouch === true) {
- className = ' ' + this.namespace + '_untouchable';
- } else {
- if (untouch === true) {
- className = ' ' + this.namespace + '_untouchable';
- }
- if (inRange === true) {
- className += ' ' + this.namespace + '_inRange';
- }
- }
- if (active === true) {
- className += ' ' + this.namespace + '_active';
- }
- return className;
- },
- _changeView: function(type, index) {
- switch (type) {
- case 'caption':
- if (this.options.mode !== 'multiple') {
- if (this.views[index] === 'days') {
- this.views[index] = 'months';
- } else if (this.views[index] === 'months') {
- this.views[index] = 'years';
- }
- }
- break;
- case 'content':
- if (this.views[index] === 'years') {
- this.views[index] = 'months';
- } else if (this.views[index] === 'months') {
- this.views[index] = 'days';
- }
- break;
- case 'higher':
- if (this.options.mode !== 'multiple') {
- if (this.views[index] === 'days') {
- this.views[index] = 'months';
- } else if (this.views[index] === 'months') {
- this.views[index] = 'years';
- }
- }
- break;
- case 'lower':
- if (this.options.mode !== 'multiple') {
- if (this.views[index] === 'years') {
- this.views[index] = 'months';
- } else if (this.views[index] === 'months') {
- this.views[index] = 'days';
- }
- }
- break;
-
- }
- },
- _setDate: function(obj, YTD, date) {
- if (typeof YTD === 'object') {
- for (var key in YTD) {
- switch (key) {
- case 'day':
- obj.setDate(YTD[key]);
- break;
- case 'month':
- obj.setMonth(YTD[key]);
- break;
- case 'year':
- obj.setYear(YTD[key]);
- break;
- }
- }
- } else {
- switch (YTD) {
- case 'day':
- obj.setDate(date);
- break;
- case 'month':
- obj.setMonth(date);
- break;
- case 'year':
- obj.setYear(date);
- break;
- }
- }
- },
- _formatDate: function(date, format) {
- date = new Date(date);
- var val = {
- d: date.getDate(),
- m: date.getMonth() + 1,
- yy: date.getFullYear().toString().substring(2),
- yyyy: date.getFullYear()
- };
- val.dd = (val.d < 10 ? '0' : '') + val.d;
- val.mm = (val.m < 10 ? '0' : '') + val.m;
- date = [];
- for (var i = 0, length = format.parts.length; i < length; i++) {
- date.push(val[format.parts[i]]);
- }
- return date.join(format.separator);
- },
- _stringSeparate: function(str, separator) {
- var re = new RegExp("[.\\" + separator + "\\s].*?"),
- _separator = str.match(re),
- parts = str.split(_separator);
- return parts;
- },
- _parseHtmlString: function(option, value) {
- var array = [],
- options = Plugin.defaults;
- if (typeof options[option] === 'object') {
- var parts = this._stringSeparate(value, ','),
- sub_parts;
- for (var i = 0; i < parts.length; i++) {
- sub_parts = this._stringSeparate(parts[i], '>');
- if (sub_parts.length > 1) {
- sub_parts = {
- 'from': sub_parts[0],
- 'to': sub_parts[1]
- };
- } else {
- sub_parts = sub_parts[0];
- }
- array.push(sub_parts);
- }
- return array;
- } else {
- return value;
- }
- },
- _parseFormat: function(format) {
- var separator = format.match(/[.\/\-\s].*?/),
- parts = format.split(/\W+/) || parts;
- if (!parts || parts.length === 0) {
- throw new Error('Invalid date format.');
- }
- return {
- separator: separator,
- parts: parts
- };
- },
- _parseDate: function(data, format) {
- if (data !== null) {
- var date = new Date(),
- day = date.getDate();
- switch (typeof(data)) {
- case 'string':
- if (data.length < 5) {
- date.setHours(0, 0, 0, 0);
- date.setDate(day + Number(data));
- } else {
- var parts = data.split(format.separator) || parts,
- val;
- date.setHours(0, 0, 0, 0);
- if (parts.length === format.parts.length) {
- for (var i = 0, length = format.parts.length; i < length; i++) {
- val = parseInt(parts[i], 10) || 1;
- if (val === '1') {
- return;
- }
- switch (format.parts[i]) {
- case 'dd':
- case 'd':
- date.setDate(val);
- break;
- case 'mm':
- case 'm':
- date.setMonth((val - 1), 1);
- break;
- case 'yy':
- date.setFullYear(2000 + val);
- break;
- case 'yyyy':
- date.setFullYear(val);
- break;
- }
- }
- }
- }
- break;
- case 'number':
- date.setHours(0, 0, 0, 0);
- date.setDate(day + data);
- break;
- }
- return date;
- } else {
- return null;
- }
- },
- _parseDateArr: function(arr, format) {
- var array = [],
- count = 0;
- for (var i = 0; i < arr.length; i++) {
- if (typeof(arr[i]) === 'string') {
- array[count++] = this._parseDate(arr[i], format);
- } else if (typeof(arr[i]) === 'object') {
- var obj = arr[i],
- from, to;
- for (var key in obj) {
- switch (key) {
- case 'from':
- from = obj[key];
- break;
- case 'to':
- to = obj[key];
- break;
- }
- }
- array[count++] = [this._parseDate(from, format), this._parseDate(to, format)];
- }
- }
- return array;
- },
- _parseDateSection: function(arr) {
- var array = [],
- count = 0;
- for (var i = 0; i < arr.length; i++) {
- if (typeof(arr[i]) === 'number') {
- array[count++] = arr[i];
- } else if (typeof(arr[i]) === 'string') {
- array[count++] = Number(arr[i]);
- } else if (typeof(arr[i]) === 'object') {
- var obj = arr[i],
- from, to;
- for (var key in obj) {
- switch (key) {
- case 'from':
- from = Number(obj[key]);
- break;
- case 'to':
- to = Number(obj[key]);
- break;
- }
- }
- array[count++] = [from, to];
- }
- }
- return array;
- },
- _updateDate: function(i) {
-
-// this._date.currentDate[i].setDate(1);
- this._date.currentDate[i].setHours(0, 0, 0, 0);
-
- this._date.currentDay[i] = this._date.currentDate[i].getDate();
- this._date.currentMonth[i] = this._date.currentDate[i].getMonth();
- this._date.currentYear[i] = this._date.currentDate[i].getFullYear();
-
- this._date.currentMonthDate[i] = new Date(this._date.currentYear[i], this._date.currentMonth[i], 1, 0, 0, 0, 0);
- this._date.currentYearDate[i] = new Date(this._date.currentYear[i], 0, 1, 0, 0, 0, 0);
-
- if (this.mode !== 'multiple') {
- this._date.selectedDay[i] = this._date.selectedDate[i].getDate();
- this._date.selectedMonth[i] = this._date.selectedDate[i].getMonth();
- this._date.selectedYear[i] = this._date.selectedDate[i].getFullYear();
-
- this._date.selectedMonthDate[i] = new Date(this._date.selectedYear[i], this._date.selectedMonth[i], 1, 0, 0, 0, 0);
- this._date.selectedYearDate[i] = new Date(this._date.selectedYear[i], 0, 1, 0, 0, 0, 0);
- }
- },
- _position: function() {
- var calendar_height = this.$picker.outerHeight(),
- calendar_width = this.$picker.outerWidth(),
- container_height = this.$container.height() || window.innerHeight,
- input_top = this.$el.offset().top,
- input_left = this.$el.offset().left,
- input_height = this.$el.outerHeight(),
- input_width = this.$el.outerWidth(),
- winWidth = window.innerWidth,
- winHeight = window.innerHeight,
- scroll_left = this.$container.scrollLeft() || 0,
- left,
- top,
- position = this.options.position;
-
- if (this.isMobile) {
- left = (winWidth - calendar_width) / 2;
- top = (winHeight - calendar_height) / 2;
- } else {
- switch (position) {
- case 'bottom':
- case 'right':
- case 'left':
- if ((input_top + input_height + calendar_height) > (container_height)) {
- if (position === 'bottom') {
- position = 'top';
- } else if (position = 'left') {
- position = 'leftTop';
- } else if (position = 'right') {
- position = 'rightTop';
- }
- }
- break;
- case 'top':
- case 'rightTop':
- case 'leftTop':
- if (input_top - calendar_height < 0) {
- if (position === 'top') {
- position = 'bottom';
- } else if (position = 'leftTop') {
- position = 'left';
- } else if (position = 'rightTop') {
- position = 'right';
- }
- }
- break;
- }
-
- switch (position) {
- case 'top':
- left = input_left + scroll_left;
- top = input_top - calendar_height;
- break;
- case 'right':
- left = input_left + input_width + scroll_left;
- top = input_top;
- break;
- case 'bottom':
- left = input_left + scroll_left;
- top = input_top + input_height;
- break;
- case 'left':
- left = input_left - calendar_width + scroll_left;
- top = input_top;
- break;
- case 'rightTop':
- left = input_left + input_width + scroll_left;
- top = input_top - calendar_height + input_height;
- break;
- case 'leftTop':
- left = input_left - calendar_width + scroll_left;
- top = input_top - calendar_height + input_height;
- break;
- }
- }
-
- this.$picker.css({
- "left": left,
- "top": top
- });
- },
- _toggle: function() {
- if (this.showed) {
- this.pickerHide = true;
- this._blur();
- } else {
- this._focus();
- }
- },
- _focus: function() {
- if (this.options.displayMode === 'dropdown' && this.showed === false) {
- this.show();
- }
- if (this.hasKeyboard) {
- this._keyboard.init(this);
- }
- },
- _blur: function() {
- if (this.options.displayMode === 'dropdown') {
- if (this.pickerHide === true) {
- this.hide();
- this.pickerHide = false;
- }
- }
- if (this.hasKeyboard) {
- this._keyboard.destroy(this);
- }
- },
- _trigger: function(eventType) {
- var data = arguments.length > 1 ? Array.prototype.slice.call(arguments, 1).push(this) : this;
- // event
- this.$el.trigger(pluginName + '::' + eventType, data);
-
- // callback
- eventType = eventType.replace(/\b\w+\b/g, function(word) {
- return word.substring(0, 1).toUpperCase() + word.substring(1);
- });
- var onFunction = 'on' + eventType;
- var method_arguments = arguments.length > 1 ? Array.prototype.slice.call(arguments, 1) : undefined;
- if (typeof this.options[onFunction] === 'function') {
- this.options[onFunction].apply(this, method_arguments);
- }
- },
- _click: function(e) {
- var $target = $(e.target);
-
- if ($target.closest(this.$inputIcon).length === 0 && $target.closest(this.$picker).length === 0 && $target.closest(this.$el).length === 0 && this.options.alwaysShow === false) {
- if (this.isMobile) {
- this.mobileCancel(0);
- } else {
- this.hide();
- }
- } else if ($target.closest(this.$el).length !== 1 && $target.closest(this.$picker).length === 1) {
- var _target = $(e.target).closest('div');
- var _targetSpan = $(e.target).closest('span');
-
- if (_target.parent('.' + this.namespace + '-header').length === 1) {
- var i = _target.parents('.' + this.namespace + '-content').index();
- switch (_target[0].className) {
- case this.namespace + '-caption':
- this._changeView('caption', i);
- this._manageViews(i);
- break;
- case this.namespace + '-prev':
- this.prev(i);
- break;
- case this.namespace + '-next':
- this.next(i);
- break;
- }
- }
-
- if (_targetSpan.length === 1) {
- var j = _targetSpan.parents('.' + this.namespace + '-content').index();
-
- if (!_targetSpan.hasClass(this.namespace + '_otherMonth') && !_targetSpan.hasClass(this.namespace + '_untouchable') && _targetSpan.parent('.' + this.namespace + '-head').length !== 1) {
-
- this._changeValue(_targetSpan, j);
- this._changeView('content', j);
- this._updateDate(j);
-
- switch (this.mode) {
- case 'single':
- if (this.views[j] === 'days') {
- this.selected = true;
- }
- this._manageViews(j);
- break;
- case 'range':
- this._manageViews(0);
- this._manageViews(1);
- break;
- case 'multiple':
- this._manageViews(j - 1);
- this._manageViews(j);
- this._manageViews(j + 1);
- break;
- }
- if (!this.isMobile) {
- this._setValue();
- }
- }
- }
-
- if (_target.parent('.' + this.namespace + '-buttons').length === 1) {
- var k = _target.parents('.' + this.namespace + '-content').index(),
- flag = _target[0].className === this.namespace + '-button-save' ? true : false;
-
- if (flag) {
- this.mobileEnter(k);
- } else {
- this.mobileCancel(k);
- }
- }
- if (!this.isMobile) {
- if (this.selected === true && this.options.alwaysShow === false && this.options.onceClick === true) {
- this.hide();
- } else {
- if (this.options.displayMode === 'dropdown') {
- this.$el.focus();
- }
- }
- }
- }
- e.preventDefault();
- },
- _changeValue: function(target, i) {
- var newVal = '',
- newDate = '',
- self = this;
- switch (this.views[i]) {
- case 'years':
- newVal = parseInt(target.text(), 10);
- this._date.currentDate[i].setYear(newVal);
- break;
- case 'months':
- newVal = Number(target.attr('class').match(/month\-([0-9]+)/)[1]);
- this._date.currentDate[i].setMonth(newVal);
- break;
- case 'days':
- newVal = parseInt(target.text(), 10);
- newDate = new Date(this._date.currentYear[i], this._date.currentMonth[i], newVal, 0, 0, 0, 0);
- switch (this.options.mode) {
- case 'single':
- case 'range':
- this._date.selectedDate[i] = newDate;
- break;
- case 'multiple':
- var date = Date.parse(newDate);
- if ($.inArray(date, this._date.selectedDate) > -1) {
- $.each(this._date.selectedDate, function(nr, data) {
- if (data === date) {
- self._date.selectedDate.splice(nr, 1);
- }
- });
- } else {
- if (this._date.selectedDate.length < this.options.multipleSize) {
- this._date.selectedDate.push(date);
- }
- }
- break;
- }
- break;
- }
- },
- _setValue: function() {
- switch (this.mode) {
- case 'single':
- var formated = this._formatDate(this._date.selectedDate[0], this.outputFormat);
- this.$el.val(formated);
- break;
- case 'range':
- var formatedStart = this._formatDate(this._date.selectedDate[0], this.outputFormat),
- formatedEnd = this._formatDate(this._date.selectedDate[1], this.outputFormat);
- this.$el.val(formatedStart + ' ' + this.options.rangeSeparator + ' ' + formatedEnd);
- break;
- case 'multiple':
- var val = '',
- _formated;
- for (var j = 0; j < this._date.selectedDate.length; j++) {
- _formated = this._formatDate(this._date.selectedDate[j], this.outputFormat);
- if (val.length === 0) {
- val += _formated;
- } else {
- val += (this.options.multipleSeparator + _formated);
- }
- }
- this.$el.val(val);
- break;
- }
- this._trigger('change', this.getDate('yyyy-mm-dd'), this.options.name, pluginName);
- this.oldValue = this.$el.val();
- },
- _prevent: function(e) {
- if (e.preventDefault) {
- e.preventDefault();
- } else {
- e.returnvalue = false;
- }
- },
- _removeEvents: function() {
- if (this.options.displayMode === 'inline') {
- this.picker.off('click.picke');
- } else {
- $doc.off('click.' + this.flag);
- }
-
- this.$el.off('focus');
- this.$el.off('blur');
- },
- prev: function(i, isTurning) {
- this.touchflag = false;
- var date = this._date.currentDate[i];
- switch (this.views[i]) {
- case 'days':
- var prevMonthDays;
- if (this.mode === 'multiple') {
- if (isTurning) {
- if (this.focused === 0) {
- for (var j = 0; j < this.calendarsNum; j++) {
- this._date.currentDate[j].setMonth(this._date.currentMonth[j] - 1);
- this._updateDate(j);
- this._manageViews(j);
- }
- } else {
- --this.focused;
- this._manageViews(i);
- this._manageViews(i - 1);
- }
- } else {
- prevMonthDays = new Date(date.getFullYear(), date.getMonth(), 0).getDate();
- if (this._date.focusDate.getDate() > prevMonthDays) {
- this._date.focusDate.setDate(prevMonthDays);
- }
- this._date.focusDate.setMonth(this._date.focusDate.getMonth() - 1);
- for (var k = 0; k < this.calendarsNum; k++) {
- this._date.currentDate[k].setMonth(this._date.currentMonth[k] - 1);
- this._updateDate(k);
- this._manageViews(k);
- }
- }
- } else {
- date.setMonth(this._date.currentMonth[i] - 1);
- if (this.hasKeyboard) {
- prevMonthDays = new Date(date.getFullYear(), date.getMonth(), 0).getDate();
- if (this._date.focusDate[i].getDate() > prevMonthDays) {
- this._date.focusDate[i].setDate(prevMonthDays);
- }
- this._date.focusDate[i] = new Date(date.getFullYear(), date.getMonth(), this._date.focusDate[i].getDate(), 0, 0, 0, 0);
- }
- }
- break;
- case 'months':
- date.setYear(this._date.currentYear[i] - 1);
- if (this.hasKeyboard) {
- this._date.focusDate[i] = new Date(date.getFullYear(), this._date.focusDate[i].getMonth(), this._date.focusDate[i].getDate(), 0, 0, 0, 0);
- }
- break;
- case 'years':
- date.setYear(this._date.currentYear[i] - 12);
- if (this.hasKeyboard && isTurning) {
- this._date.focusDate[i] = new Date(this._date.focusDate[i].getFullYear() - 12, this._date.focusDate[i].getMonth(), this._date.focusDate[i].getDate(), 0, 0, 0, 0);
- }
- break;
- }
- this._updateDate(i);
- this._manageViews(i);
- },
- next: function(i, isTurning) {
- this.touchflag = false;
- var date = this._date.currentDate[i];
- switch (this.views[i]) {
- case 'days':
- var nextMonthDays;
- if (this.mode === 'multiple') {
- if (isTurning) {
- if (this.focused === this.calendarsNum - 1) {
- for (var j = 0; j < this.calendarsNum; j++) {
- this._date.currentDate[j].setMonth(this._date.currentMonth[j] + 1);
- this._updateDate(j);
- this._manageViews(j);
- }
- } else {
- ++this.focused;
- this._manageViews(i);
- this._manageViews(i + 1);
- }
- } else {
- nextMonthDays = new Date(date.getFullYear(), date.getMonth() + 2, 0).getDate();
- if (this._date.focusDate.getDate() > nextMonthDays) {
- this._date.focusDate.setDate(nextMonthDays);
- }
- this._date.focusDate.setMonth(this._date.focusDate.getMonth() + 1);
- for (var k = 0; k < this.calendarsNum; k++) {
- this._date.currentDate[k].setMonth(this._date.currentMonth[k] + 1);
- this._updateDate(k);
- this._manageViews(k);
- }
- }
- } else {
- date.setMonth(this._date.currentMonth[i] + 1);
-
- if (this.hasKeyboard) {
- nextMonthDays = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
- if (this._date.focusDate[i].getDate() > nextMonthDays) {
- this._date.focusDate[i].setDate(nextMonthDays);
- }
- this._date.focusDate[i] = new Date(date.getFullYear(), date.getMonth(), this._date.focusDate[i].getDate(), 0, 0, 0, 0);
- }
- }
- break;
- case 'months':
- date.setYear(this._date.currentYear[i] + 1);
- if (this.hasKeyboard) {
- this._date.focusDate[i] = new Date(date.getFullYear(), this._date.focusDate[i].getMonth(), this._date.focusDate[i].getDate(), 0, 0, 0, 0);
- }
- break;
- case 'years':
- date.setYear(this._date.currentYear[i] + 12);
- if (this.hasKeyboard && isTurning) {
- this._date.focusDate[i] = new Date(this._date.focusDate[i].getFullYear() + 12, this._date.focusDate[i].getMonth(), this._date.focusDate[i].getDate(), 0, 0, 0, 0);
- }
- break;
- }
- this._updateDate(i);
- this._manageViews(i);
- },
- mobilePrev: function(index) {
- this.calendars.eq(index).removeClass(this.namespace + '_show');
- this.calendars.eq(index - 1).addClass(this.namespace + '_show');
- },
- mobileNext: function(index) {
- this.calendars.eq(index).removeClass(this.namespace + '_show');
- this.calendars.eq(index + 1).addClass(this.namespace + '_show');
- },
- mobileInteDate: function(index) {
- var self = this;
- if (this.mode === 'multiple') {
- if (this._date.selectedDate.length > 0) {
- self._date.currentDate[0] = new Date(this._date.selectedDate[0]);
- }
- } else {
- this._date.currentDate[index] = new Date(this._date.selectedDate[index]);
- }
-
- this.views[index] = 'days';
- this._updateDate(index);
- },
- mobileEnter: function(index) {
- if (this.mode === 'range' && index === 0) {
- this.mobileNext(index);
- this.views[index] = 'days';
- } else {
- this.mobileInteDate(index);
- this._setValue();
- this.hide();
- }
- this._manageViews(index);
- },
- mobileCancel: function(index) {
- if (index === 1) {
- this.mobilePrev(index);
- this.views[index] = 'days';
- } else {
- this.dateTransform(this._date.cache, this._date);
- this.mobileInteDate(index);
- this.hide();
- }
- this._manageViews(index);
- },
-
- dateTransform: function(fromDate, toDate) {
- var self = this;
- toDate.currentDate = [];
- toDate.selectedDate = [];
- $.each(fromDate.currentDate, function(n, v) {
- toDate.currentDate[n] = new Date(v);
- });
-
- $.each(fromDate.selectedDate, function(n, v) {
- var date = new Date(v);
- toDate.selectedDate[n] = self.mode === 'multiple' ? Date.parse(date) : date;
- });
- },
- show: function() {
- var self = this;
- if (this.isMobile) {
- this.dateTransform(this._date, this._date.cache);
- }
-
- if (this.options.displayMode === 'inline') {
- this._trigger('beforeShow');
- this.$picker.on('mouseDown.' + this.flag, function(e) {
- self._prevent(e);
- });
- this.$picker.on('click.' + this.flag, function(e) {
- self._click.call(self, e);
- });
- } else {
- if (this.showed === false) {
- this._trigger('beforeShow');
- this.$inputWrap.addClass(this.namespace + '_active');
- // this.$picker.removeClass(this.namespace + '_hide');
- this.$picker.addClass(this.namespace + '_show');
-
- if (this.isMobile) {
- this.calendars.eq(0).addClass(this.namespace + '_show');
- if (this.mode === 'range') {
- this.calendars.eq(1).removeClass(this.namespace + '_show');
- }
-
- $('body').append(this.$cover).css('overflow', 'hidden');
- //Prevent horizontal scroll for ios
- $doc.on('scrollstart.' + this.flag, function(e) {
- e.preventDefault();
- });
- $doc.on('tap.' + this.flag, function(e) {
- self._click.call(self, e);
- });
- var handle = function(e) {
- var startX = e.swipestart.coords[0],
- stopX = e.swipestop.coords[0];
-
- if (stopX > startX) {
- self.prev.call(self, 0);
- } else if (stopX < startX) {
- self.next.call(self, 0);
- }
-
- $doc.one('swipe.' + self.flag, handle);
- };
-
- $doc.one('swipe.' + this.flag, handle);
- } else {
- $doc.on('click.' + this.flag, function(e) {
- self._click.call(self, e);
- });
- }
-
-
- this._position();
- this.showed = true;
-
- $win.on('resize.' + this.flag, function() {
- self._position();
- });
- // this.$el.focus();
- this.$picker.on('mousedown.' + this.flag, function(e) {
- self._prevent(e);
- });
- }
- }
- this._trigger('show');
- return this;
- },
- hide: function() {
- if (this.showed === true) {
- this._trigger('beforeHide');
- this.selected = false;
- this.$inputWrap.removeClass(this.namespace + '_active');
- this.$picker.removeClass(this.namespace + '_show');
- this.showed = false;
- this.$picker.off('mousedown.' + this.flag);
- $doc.off('click.' + this.flag);
- $win.off('resize.' + this.flag);
- if (this.isMobile) {
- $('body').css('overflow', 'auto');
- this.$cover.remove();
- $doc.off('click.' + this.flag + ' tap.' + this.flag + ' scrollstart.' + this.flag + ' swipe.' + this.flag);
- }
-
- this.$el.blur();
- this._trigger('hide');
- }
- return this;
- },
- getWrap: function() {
- return this.picker;
- },
- getInput: function() {
- return this.$el;
- },
- getDate: function(format) {
- if (format === undefined) {
- return this._date.selectedDate;
- } else {
- var _format = this._parseFormat(format),
- formated = [];
- for (var i = 0; i < this._date.selectedDate.length; i++) {
- formated[i] = this._formatDate(this._date.selectedDate[i], _format);
- }
- return formated;
- }
- },
- multipleClear: function() {
- this._date.selectedDate = [];
- for (var i = 0; i < this.calendarsNum; i++) {
- this._manageViews(i);
- }
- this._setValue();
- },
-
- destroy: function() {
- this.$el.removeData('asDatepicker');
- this._removeEvents();
- this.$picker.remove();
- },
- update: function(_options) {
- if (typeof _options !== 'undefined') {
- for (var m in _options) {
- this.options[m] = _options[m];
- }
- }
- this._removeEvents();
- this.$picker.remove();
- this._init();
- },
- reset: function(_options) {
- for (var m in this.defaultOptions) {
- this.options[m] = this.defaultOptions[m];
- }
- if (typeof _options !== 'undefined') {
- for (var n in _options) {
- this.options[n] = _options[n];
- }
- }
- this._removeEvents();
- this.$picker.remove();
- this._init();
- },
-
-
- _keyboard: {
- init: function(self) {
- this.attach(self, this.gather(self));
- },
- destroy: function(self) {
- if (self.options.displayMode === 'dropdown') {
- self.$el.off('keydown.dropdown');
- } else {
- self.$picker.off('keydown.inline');
- }
- self.bound = false;
- },
- keys: function() {
- return {
- 'LEFT': 37,
- 'UP': 38,
- 'RIGHT': 39,
- 'DOWN': 40,
- 'ENTER': 13,
- 'ESC': 27,
- 'CTRL': 17,
- 'ALT': 18
- };
- },
- prevDate: function() {
- var i = this.focused,
- date = this.mode === 'multiple' ? this._date.focusDate : this._date.focusDate[i],
- hasLocked = this.mode === 'multiple' ? false : this.calendarPrevs.eq(this.focused).hasClass(this.namespace + '_blocked');
-
- switch (this.views[i]) {
- case 'days':
- if (Date.parse(date) === Date.parse(this._date.currentDate[i])) {
- if (!hasLocked) {
- date.setDate(date.getDate() - 1);
- this.prev(i, true);
- }
- } else {
- date.setDate(date.getDate() - 1);
- this._manageViews(i);
- }
- break;
- case 'months':
- if (date.getMonth() === 0) {
- if (!hasLocked) {
- date.setMonth(date.getMonth() - 1);
- this.prev(i);
- }
- } else {
- date.setMonth(date.getMonth() - 1);
- this._manageViews(i);
- }
- break;
- case 'years':
- if (date.getFullYear() === this._date.currentYear[i] - 7) {
- if (!hasLocked) {
- date.setFullYear(date.getFullYear() - 1);
- this.prev(i);
- }
- } else {
- date.setFullYear(date.getFullYear() - 1);
- this._manageViews(i);
- }
- break;
- }
- },
- nextDate: function() {
- var i = this.focused,
- date = this.mode === 'multiple' ? this._date.focusDate : this._date.focusDate[i],
- hasLocked = this.mode === 'multiple' ? false : this.calendarNexts.eq(this.focused).hasClass(this.namespace + '_blocked');
- switch (this.views[i]) {
- case 'days':
- if (Date.parse(date) === Date.parse(new Date(this._date.currentYear[i], this._date.currentMonth[i] + 1, 0))) {
- if (!hasLocked) {
- date.setDate(date.getDate() + 1);
- this.next(i, true);
- }
- } else {
- date.setDate(date.getDate() + 1);
- this._manageViews(i);
- }
- break;
- case 'months':
- if (date.getMonth() === 11) {
- if (!hasLocked) {
- date.setMonth(date.getMonth() + 1);
- this.next(i);
- }
- } else {
- date.setMonth(date.getMonth() + 1);
- this._manageViews(i);
- }
- break;
- case 'years':
- if (date.getFullYear() === this._date.currentYear[i] + 4) {
- if (!hasLocked) {
- date.setFullYear(date.getFullYear() + 1);
- this.next(i);
- }
- } else {
- date.setFullYear(date.getFullYear() + 1);
- this._manageViews(i);
- }
- break;
- }
- },
- upLine: function() {
- var i = this.focused,
- date = this.mode === 'multiple' ? this._date.focusDate : this._date.focusDate[i],
- hasLocked = this.mode === 'multiple' ? false : this.calendarPrevs.eq(this.focused).hasClass(this.namespace + '_blocked');
- switch (this.views[i]) {
- case 'days':
- if (new Date(date.getFullYear(), date.getMonth(), date.getDate() - 7).setDate(1) ===
- new Date(this._date.currentDate[i]).setMonth(this._date.currentMonth[i] - 1)) {
- if (!hasLocked) {
- date.setDate(date.getDate() - 7);
- this.prev(i, true);
- }
- } else {
- date.setDate(date.getDate() - 7);
- this._manageViews(i);
- }
- break;
- case 'months':
- if (date.getMonth() === 0 || date.getMonth() === 1 || date.getMonth() === 2) {
- if (!hasLocked) {
- date.setMonth(date.getMonth() - 3);
- this.prev(i);
- }
- } else {
- date.setMonth(date.getMonth() - 3);
- this._manageViews(i);
- }
- break;
- case 'years':
- if (date.getFullYear() < this._date.currentYear[i] - 4) {
- if (!hasLocked) {
- date.setFullYear(date.getFullYear() - 3);
- this.prev(i);
- }
- } else {
- date.setFullYear(date.getFullYear() - 3);
- this._manageViews(i);
- }
- break;
- }
- },
- downLine: function() {
- var i = this.focused,
- date = this.mode === 'multiple' ? this._date.focusDate : this._date.focusDate[i],
- hasLocked = this.mode === 'multiple' ? false : this.calendarNexts.eq(this.focused).hasClass(this.namespace + '_blocked');
- switch (this.views[i]) {
- case 'days':
- if (new Date(date.getFullYear(), date.getMonth(), date.getDate() + 7).setDate(1) ===
- new Date(this._date.currentDate[i]).setMonth(this._date.currentMonth[i] + 1)) {
- if (!hasLocked) {
- date.setDate(date.getDate() + 7);
- this.next(i, true);
- }
- } else {
- date.setDate(date.getDate() + 7);
- this._manageViews(i);
- }
- break;
- case 'months':
- if (date.getMonth() === 9 || date.getMonth() === 10 || date.getMonth() === 11) {
- if (!hasLocked) {
- date.setMonth(date.getMonth() + 3);
- this.next(i);
- }
- } else {
- date.setMonth(date.getMonth() + 3);
- this._manageViews(i);
- }
- break;
- case 'years':
- if (date.getFullYear() > this._date.currentYear[i] + 1) {
- if (!hasLocked) {
- date.setFullYear(date.getFullYear() + 3);
- this.next(i);
- }
- } else {
- date.setFullYear(date.getFullYear() + 3);
- this._manageViews(i);
- }
- break;
- }
- },
- prevPage: function() {
- if (this.mode === 'multiple') {
- this.prev(this.focused);
- } else {
- if (!this.calendarPrevs.eq(this.focused).hasClass(this.namespace + '_blocked')) {
- this.prev(this.focused, true);
- }
- }
- },
- nextPage: function() {
- if (this.mode === 'multiple') {
- this.next(this.focused);
- } else {
- if (!this.calendarNexts.eq(this.focused).hasClass(this.namespace + '_blocked')) {
- this.next(this.focused, true);
- }
- }
- },
- higherView: function() {
- if (this.mode !== 'multiple') {
- var i = this.focused;
- this._changeView('higher', i);
- this._manageViews(i);
- }
- },
- prevCalendar: function() {
- if (this.mode !== 'multiple') {
- var len = this.calendars.length;
- if (--this.focused < 0) {
- this.focused = len;
- }
- }
- },
- nextCalendar: function() {
- if (this.mode !== 'multiple') {
- var len = this.calendars.length;
- if (++this.focused >= len) {
- this.focused = 0;
- }
- }
- },
- updateValue: function(self) {
- var i = self.focused,
- date = self.mode === 'multiple' ? self._date.focusDate : self._date.focusDate[i];
- if (!self.calendars.eq(i).find('.' + self.namespace + '_focus').hasClass(self.namespace + '_untouchable')) {
- switch (self.views[i]) {
- case 'days':
- switch (self.options.mode) {
- case 'single':
- case 'range':
- self._date.selectedDate[i] = new Date(date);
- break;
- case 'multiple':
- var _date = Date.parse(new Date(date));
- if ($.inArray(_date, self._date.selectedDate) > -1) {
- $.each(self._date.selectedDate, function(nr, data) {
- if (data === _date) {
- self._date.selectedDate.splice(nr, 1);
- return false;
- }
- });
- } else {
- self._date.selectedDate.push(_date);
- }
- break;
- }
- break;
- case 'months':
- self._date.currentDate[i].setMonth(date.getMonth());
- self.views[i] = 'days';
- break;
- case 'years':
- self._date.currentDate[i].setFullYear(date.getFullYear());
- self.views[i] = 'months';
- break;
- }
- self._updateDate(i);
- if (self.mode === 'range') {
- self._manageViews(0);
- self._manageViews(1);
- } else if (self.mode === 'multiple') {
- self._manageViews(i - 1);
- self._manageViews(i);
- self._manageViews(i + 1);
- } else {
- self._manageViews(i);
- }
- self._setValue();
- }
- },
- enter: function() {
- var inputValue = this.$el.val(),
- self = this,
- judge;
- if (inputValue === this.oldValue || this.oldValue === '') {
- this._keyboard.updateValue(this);
- } else {
- var parts;
- switch (this.mode) {
- case 'single':
- var _date = Date.parse(inputValue);
- if (_date) {
- this._date.selectedDate[0] = new Date(_date);
- this._date.currentDate[0] = new Date(this._date.selectedDate[0]);
- this._updateDate(0);
- this._manageViews(0);
- }
- break;
- case 'range':
- parts = this._stringSeparate(inputValue, this.options.rangeSeparator);
- var from = Date.parse(parts[0]),
- to = Date.parse(parts[1]);
- if (parts.length === 2) {
- judge = true;
- if (from && to) {
- if (from > to) {
- judge = false;
- }
- } else {
- judge = false;
- }
- } else {
- judge = false;
- }
-
- if (judge === true) {
- this._date.selectedDate[0] = new Date(from);
- this._date.selectedDate[1] = new Date(to);
- for (var i = 0; i < 2; i++) {
- this._date.currentDate[i] = new Date(this._date.selectedDate[i]);
- this._updateDate(i);
- this._manageViews(i);
- }
- } else {
- this._keyboard.updateValue(this);
- }
- break;
- case 'multiple':
- parts = this._stringSeparate(inputValue, this.options.multipleSeparator);
- var _parts = [];
- judge = true;
- for (var j = 0; j < parts.length; j++) {
- _parts.push(Date.parse(parts[j]));
- if (!Date.parse(parts[j])) {
- judge = false;
- }
- }
- if (judge === true) {
- this._date.selectedDate = [];
- for (var k = 0; k < _parts.length; k++) {
- if ($.inArray(_parts[k], this._date.selectedDate) > -1) {
- $.each(this._date.selectedDate, function(nr, data) {
- if (data === _parts[k]) {
- self._date.selectedDate.splice(nr, 1);
- }
- });
- } else {
- this._date.selectedDate.push(_parts[k]);
- }
- }
- for (var m = 0; m < this.calendarsNum; m++) {
- this._updateDate(m);
- this._manageViews(m);
- }
- } else {
- this._keyboard.updateValue(this);
- }
- break;
- }
- }
- this._setValue();
- },
- esc: function() {
- this.$el.blur();
- this.hide();
- },
- tab: function() {
- this.pickerHide = true;
- },
- gather: function(self) {
- return {
- left: $.proxy(this.prevDate, self),
- up: $.proxy(this.upLine, self),
- right: $.proxy(this.nextDate, self),
- down: $.proxy(this.downLine, self),
- ctrl_left: $.proxy(this.prevPage, self),
- ctrl_up: $.proxy(this.higherView, self),
- ctrl_right: $.proxy(this.nextPage, self),
- // ctrl_down: $.proxy(this.lowerView, self),
- alt_left: $.proxy(this.prevCalendar, self),
- alt_right: $.proxy(this.nextCalendar, self),
- enter: $.proxy(this.enter, self),
- esc: $.proxy(this.esc, self)
- };
- },
- press: function(e) {
- var key = e.keyCode || e.which,
- map;
-
- if (e.ctrlKey) {
- e.preventDefault();
- map = this.map[17];
- } else if (e.altKey) {
- e.preventDefault();
- map = this.map[18];
- } else {
- map = this.map;
- }
- if (key === 9) {
- this._keyboard.tab.call(this);
- }
-
- if (key in map && typeof map[key] === 'function') {
- e.preventDefault();
- map[key].call(this);
- }
- },
- attach: function(self, map) {
- var key, _self = this;
- for (key in map) {
- if (map.hasOwnProperty(key)) {
- var uppercase = [],
- parts = self._stringSeparate(key, '_'),
- len = parts.length;
-
- if (len === 1) {
- uppercase[0] = parts[0].toUpperCase();
- self.map[this.keys()[uppercase[0]]] = map[key];
- } else {
- for (var i = 0; i < parts.length; i++) {
- uppercase[i] = parts[i].toUpperCase();
- if (i === 0) {
- if (self.map[this.keys()[uppercase[0]]] === undefined) {
- self.map[this.keys()[uppercase[0]]] = {};
- }
- } else {
- self.map[this.keys()[uppercase[0]]][this.keys()[uppercase[i]]] = map[key];
- }
- }
- }
- }
- }
- if (!self.bound) {
- self.bound = true;
- if (self.options.displayMode === 'dropdown') {
- self.$el.on('keydown.dropdown', function(e) {
- _self.press.call(self, e);
- });
- } else {
- self.$picker.on('keydown.inline', function(e) {
- _self.press.call(self, e);
- });
- }
- }
- }
- }
- };
- Plugin.defaults = defaults;
- $.fn[pluginName] = function(options) {
- if (typeof options === 'string') {
- var method = options;
- var method_arguments = Array.prototype.slice.call(arguments, 1);
- if (/^\_/.test(method)) {
- return false;
- } else if (/^(getWrap|getInput|getDate)$/.test(method)) {
- var api = this.first().data(pluginName);
- if (api && typeof api[method] === 'function') {
- return api[method].apply(api, method_arguments);
- }
- } else {
- return this.each(function() {
- var api = $.data(this, pluginName);
- if (api && typeof api[method] === 'function') {
- api[method].apply(api, method_arguments);
- }
- });
- }
- } else {
- return this.each(function() {
- if (!$.data(this, pluginName)) {
- $.data(this, pluginName, new Plugin(this, options));
- }
- });
- }
- };
-})(jQuery, document, window);
diff --git a/erp_web/js/jquery-asDatepicker/less/asDatepicker.less b/erp_web/js/jquery-asDatepicker/less/asDatepicker.less
deleted file mode 100644
index 7eaf405f..00000000
--- a/erp_web/js/jquery-asDatepicker/less/asDatepicker.less
+++ /dev/null
@@ -1,317 +0,0 @@
-//========================== core ==========================
-
-@namespace: calendar;
-
-@mobileWrapWidth: 80%;
-@mobileWrapHeight: 80%;
-
-@contentWidth: 210px;
-@contentHeight: 230px;
-
-
-.@{namespace} {
- &-content {
- display: inline-block;
- position: relative;
- vertical-align: middle;
- white-space: normal;
- width: @contentWidth;
- height: @contentHeight;
- background-color: white;
-
- &.@{namespace}_days {
- > .@{namespace}-days {
- display: block;
- }
- }
- &.@{namespace}_months {
- .@{namespace}-months {
- display: block;
- }
- }
- &.@{namespace}_years {
- .@{namespace}-years {
- display: block;
- }
- }
- }
-
- &-days, &-months, &-years, &-buttons {
- display: none;
- }
-
- &-row, &-head {
- display: table;
- width: 100%;
- > span {
- display: table-cell;
- text-align: center;
- vertical-align: middle;
- }
- }
-
- &-header {
- display: table;
- width: 100%;
- height: 15%;
- > div {
- display: table-cell;
- height: 100%;
- text-align: center;
- vertical-align: middle;
- cursor: pointer;
- }
- }
-
- &-prev, &-next {
- width: 20%;
- }
-
- &-caption {
- width: 60%;
- }
-
- &-days, &-months, &-years {
- height: 85%;
- }
-
- &-head {
- height: 13%;
- span {
- cursor: default;
- }
- }
- &-body {
- height: 87%;
- .@{namespace}-row {
- height: 100% / 6;
- }
- span {
- width: 14.28%;
- height: 100%;
- cursor: pointer;
- &.@{namespace}_otherMonth, &.@{namespace}_untouchable {
- cursor: default;
- }
- }
- }
-
- &-months, &-years {
- .@{namespace}-row {
- height: 25%;
- }
- span {
- height: 100%;
- width: 33.3%;
- cursor: pointer;
- &.@{namespace}_untouchable {
- cursor: default;
- }
- }
- }
-
- &_hide {
- display: none !important;
- }
-
- &_show {
- display: block !important;
- }
-
- &-wrap {
- white-space: nowrap;
- display: none;
- position: absolute;
-
- &, & *:focus { outline: none; }
-
- * {
- -webkit-box-sizing: border-box;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- }
- &.@{namespace}_isMobile {
- z-index: 99999;
- position: fixed;
- width: 80%;
- height: 80%;
- line-height: 1;
- .@{namespace} {
- &-title {
- width: 100%;
- text-align: center;
- position: absolute;
- top: -1.5em;
- left: 0;
- }
- &-content {
- display: none;
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0;
- left: 0;
- &.@{namespace}_show {
- display: block;
- }
- }
- &-header {
- height: 11%;
- }
- &-days, &-months, &-years {
- height: 78%;
- }
- &-buttons {
- display: table;
- height: 11%;
- width: 100%;
- > div {
- display: table-cell;
- width: 50%;
- height: 100%;
- text-align: center;
- vertical-align: middle;
- cursor: pointer;
- }
- }
- }
- }
- }
-
- &-cover {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background-color: black;
- opacity: 0.5;
- z-index: 9999;
- }
-}
-
-
-//========================== skin ==========================
-
-.@{namespace} {
- &-input {
- border: 1px solid green;
- }
- &-icon {
- background-color: gray;
- border: 1px solid green;
- }
- &_active {
- .@{namespace} {
- &-input {
- border: 1px solid red;
- }
- &-icon {
- border: 1px solid red;
- }
- }
- }
- &-content {
- background-color: white;
- border: 1px solid rgb(235, 235, 235);
- color: rgb(119, 119, 119);
- -webkit-border-radius: 3px;
- -moz-border-radius: 3px;
- border-radius: 3px;
- font-family: 'Proxima Nova';
- span {
- border: 1px dashed transparent;
- &.@{namespace}_active {
- background-color: rgb(50, 184, 226) !important;
- color: white !important;
- border: 1px solid rgba(0, 0, 0, 0.15) !important;
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15) inset;
- text-shadow: 0 2px 1px rgba(0, 0, 0, 0.15);
- }
- &.@{namespace}_otherMonth, &.@{namespace}_untouchable {
- color: rgb(200, 200, 200);
- background-color: inherit;
- &:hover, &:active, &.@{namespace}_active {
- background-color: inherit;
- color: rgb(200, 200, 200);
- }
- }
- &.@{namespace}_inRange {
- background-color: rgb(224, 244, 251);
- &:hover {
- background-color: inherit;
- }
- }
- &.@{namespace}_otherMonth.@{namespace}_inRange {
- &:hover {
- background-color: rgb(224, 244, 251);
- }
- }
- &.@{namespace}_focus {
- border: 1px solid rgba(0, 0, 0, 0.1);
- color: rgb(50, 184, 226);
- }
- }
- }
- &-header {
- border-bottom: 1px solid rgb(235, 235, 235);
- }
- &-prev, &-next {
- color: transparent;
- background-repeat: no-repeat;
- background-position: center;
- }
- &-prev {
- background-image: url('../images/calendar-prev.png');
- &.@{namespace}_blocked, &.@{namespace}_blocked:hover{
- background-image: none;
- cursor: auto;
- }
- &:hover {
- background-image: url('../images/calendar-prev-hover.png');
- }
- }
-
- &-next {
- background-image: url('../images/calendar-next.png');
- &.@{namespace}_blocked, &.@{namespace}_blocked:hover{
- background-image: none;
- cursor: auto;
- }
- &:hover {
- background-image: url('../images/calendar-next-hover.png');
- }
- }
- &-caption {
- color: rgb(105, 105, 105);
- &:hover {
- color: rgb(0, 0, 0);
- }
- &.@{namespace}_blocked, &.@{namespace}_blocked:hover {
- color: rgb(105, 105, 105);
- cursor: auto;
- }
- }
- &-head {
- background-color: rgb(246, 246, 246);
- padding-left: 6px;
- padding-right: 6px;
- span {
- -webkit-box-shadow: inset 0 1px 0 rgb(251, 251, 251);
- -moz-box-shadow: inset 0 1px 0 rgb(251, 251, 251);
- box-shadow: inset 0 1px 0 rgb(251, 251, 251);
- }
- }
- &-body, &-months, &-years {
- span {
- &:hover {
- background-color: rgb(224, 244, 251);
- }
- }
- padding: 6px;
- }
- &-buttons {
- border-top: 1px solid rgb(235, 235, 235);
- }
-
-}
\ No newline at end of file
diff --git a/erp_web/js/jquery-plugins/jquery.PrintArea.js b/erp_web/js/jquery-plugins/jquery.PrintArea.js
deleted file mode 100644
index 10f832d0..00000000
--- a/erp_web/js/jquery-plugins/jquery.PrintArea.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * Version 2.4.0 Copyright (C) 2013
- * Tested in IE 11, FF 28.0 and Chrome 33.0.1750.154
- * No official support for other browsers, but will TRY to accommodate challenges in other browsers.
- * Example:
- * Print Button: Print
- * Print Area : ... html ...
- * Javascript :
- * options are passed as json (example: {mode: "popup", popClose: false})
- *
- * {OPTIONS} | [type] | (default), values | Explanation
- * --------- | --------- | ---------------------- | -----------
- * @mode | [string] | (iframe),popup | printable window is either iframe or browser popup
- * @popHt | [number] | (500) | popup window height
- * @popWd | [number] | (400) | popup window width
- * @popX | [number] | (500) | popup window screen X position
- * @popY | [number] | (500) | popup window screen Y position
- * @popTitle | [string] | ('') | popup window title element
- * @popClose | [boolean] | (false),true | popup window close after printing
- * @extraCss | [string] | ('') | comma separated list of extra css to include
- * @retainAttr | [string[]] | ["id","class","style"] | string array of attributes to retain for the containment area. (ie: id, style, class)
- * @standard | [string] | strict, loose, (html5) | Only for popup. For html 4.01, strict or loose document standard, or html 5 standard
- * @extraHead | [string] | ('') | comma separated list of extra elements to be appended to the head tag
- */
-(function($) {
- var counter = 0;
- var modes = { iframe : "iframe", popup : "popup" };
- var standards = { strict : "strict", loose : "loose", html5 : "html5" };
- var defaults = { mode : modes.iframe,
- standard : standards.html5,
- popHt : 500,
- popWd : 400,
- popX : 200,
- popY : 200,
- popTitle : '',
- popClose : false,
- extraCss : '',
- extraHead : '',
- retainAttr : ["id","class","style"] };
-
- var settings = {};//global settings
-
- $.fn.printArea = function( options )
- {
- $.extend( settings, defaults, options );
-
- counter++;
- var idPrefix = "printArea_";
- $( "[id^=" + idPrefix + "]" ).remove();
-
- settings.id = idPrefix + counter;
-
- var $printSource = $(this);
-
- var PrintAreaWindow = PrintArea.getPrintWindow();
-
- PrintArea.write( PrintAreaWindow.doc, $printSource );
-
- setTimeout( function () { PrintArea.print( PrintAreaWindow ); }, 1000 );
- };
-
- var PrintArea = {
- print : function( PAWindow ) {
- var paWindow = PAWindow.win;
-
- $(PAWindow.doc).ready(function(){
- paWindow.focus();
- paWindow.print();
-
- if ( settings.mode == modes.popup && settings.popClose )
- setTimeout(function() { paWindow.close(); }, 2000);
- });
- },
- write : function ( PADocument, $ele ) {
- PADocument.open();
- PADocument.write( PrintArea.docType() + "" + PrintArea.getHead() + PrintArea.getBody( $ele ) + "" );
- PADocument.close();
- },
- docType : function() {
- if ( settings.mode == modes.iframe ) return "";
-
- if ( settings.standard == standards.html5 ) return "";
-
- var transitional = settings.standard == standards.loose ? " Transitional" : "";
- var dtd = settings.standard == standards.loose ? "loose" : "strict";
-
- return '';
- },
- getHead : function() {
- var extraHead = "";
- var links = "";
-
- if ( settings.extraHead ) settings.extraHead.replace( /([^,]+)/g, function(m){ extraHead += m });
-
- $(document).find("link")
- .filter(function(){ // Requirement: element MUST have rel="stylesheet" to be considered in print document
- var relAttr = $(this).attr("rel");
- return ($.type(relAttr) === 'undefined') == false && relAttr.toLowerCase() == 'stylesheet';
- })
- .filter(function(){ // Include if media is undefined, empty, print or all
- var mediaAttr = $(this).attr("media");
- return $.type(mediaAttr) === 'undefined' || mediaAttr == "" || mediaAttr.toLowerCase() == 'print' || mediaAttr.toLowerCase() == 'all'
- })
- .each(function(){
- links += ' ';
- });
- if ( settings.extraCss ) settings.extraCss.replace( /([^,\s]+)/g, function(m){ links += ' ' });
-
- return "" + settings.popTitle + " " + extraHead + links + "";
- },
- getBody : function ( elements ) {
- var htm = "";
- var attrs = settings.retainAttr;
- elements.each(function() {
- var ele = PrintArea.getFormData( $(this) );
-
- var attributes = ""
- for ( var x = 0; x < attrs.length; x++ )
- {
- var eleAttr = $(ele).attr( attrs[x] );
- if ( eleAttr ) attributes += (attributes.length > 0 ? " ":"") + attrs[x] + "='" + eleAttr + "'";
- }
-
- htm += '' + $(ele).html() + '
';
- });
-
- return "" + htm + "";
- },
- getFormData : function ( ele ) {
- var copy = ele.clone();
- var copiedInputs = $("input,select,textarea", copy);
- $("input,select,textarea", ele).each(function( i ){
- var typeInput = $(this).attr("type");
- if ($.type(typeInput) === 'undefined') typeInput = $(this).is("select") ? "select" : $(this).is("textarea") ? "textarea" : "";
- var copiedInput = copiedInputs.eq( i );
-
- if ( typeInput == "radio" || typeInput == "checkbox" ) copiedInput.attr( "checked", $(this).is(":checked") );
- else if ( typeInput == "text" ) copiedInput.attr( "value", $(this).val() );
- else if ( typeInput == "select" )
- $(this).find( "option" ).each( function( i ) {
- if ( $(this).is(":selected") ) $("option", copiedInput).eq( i ).attr( "selected", true );
- });
- else if ( typeInput == "textarea" ) copiedInput.text( $(this).val() );
- });
- return copy;
- },
- getPrintWindow : function () {
- switch ( settings.mode )
- {
- case modes.iframe :
- var f = new PrintArea.Iframe();
- return { win : f.contentWindow || f, doc : f.doc };
- case modes.popup :
- var p = new PrintArea.Popup();
- return { win : p, doc : p.doc };
- }
- },
- Iframe : function () {
- var frameId = settings.id;
- var iframeStyle = 'border:0;position:absolute;width:0px;height:0px;right:0px;top:0px;';
- var iframe;
-
- try
- {
- iframe = document.createElement('iframe');
- document.body.appendChild(iframe);
- $(iframe).attr({ style: iframeStyle, id: frameId, src: "#" + new Date().getTime() });
- iframe.doc = null;
- iframe.doc = iframe.contentDocument ? iframe.contentDocument : ( iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
- }
- catch( e ) { throw e + ". iframes may not be supported in this browser."; }
-
- if ( iframe.doc == null ) throw "Cannot find document.";
-
- return iframe;
- },
- Popup : function () {
- var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";
- windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt;
- windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=yes";
-
- var newWin = window.open( "", "_blank", windowAttr );
-
- newWin.doc = newWin.document;
-
- return newWin;
- }
- };
-})(jQuery);
\ No newline at end of file
diff --git a/erp_web/js/jquery-plugins/jquery.form.js b/erp_web/js/jquery-plugins/jquery.form.js
deleted file mode 100644
index f964d068..00000000
--- a/erp_web/js/jquery-plugins/jquery.form.js
+++ /dev/null
@@ -1,1277 +0,0 @@
-/*!
- * jQuery Form Plugin
- * version: 3.51.0-2014.06.20
- * Requires jQuery v1.5 or later
- * Copyright (c) 2014 M. Alsup
- * Examples and documentation at: http://malsup.com/jquery/form/
- * Project repository: https://github.com/malsup/form
- * Dual licensed under the MIT and GPL licenses.
- * https://github.com/malsup/form#copyright-and-license
- */
-/*global ActiveXObject */
-
-// AMD support
-(function (factory) {
- "use strict";
- if (typeof define === 'function' && define.amd) {
- // using AMD; register as anon module
- define(['jquery'], factory);
- } else {
- // no AMD; invoke directly
- factory( (typeof(jQuery) != 'undefined') ? jQuery : window.Zepto );
- }
-}
-
-(function($) {
-"use strict";
-
-/*
- Usage Note:
- -----------
- Do not use both ajaxSubmit and ajaxForm on the same form. These
- functions are mutually exclusive. Use ajaxSubmit if you want
- to bind your own submit handler to the form. For example,
-
- $(document).ready(function() {
- $('#myForm').on('submit', function(e) {
- e.preventDefault(); // <-- important
- $(this).ajaxSubmit({
- target: '#output'
- });
- });
- });
-
- Use ajaxForm when you want the plugin to manage all the event binding
- for you. For example,
-
- $(document).ready(function() {
- $('#myForm').ajaxForm({
- target: '#output'
- });
- });
-
- You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
- form does not have to exist when you invoke ajaxForm:
-
- $('#myForm').ajaxForm({
- delegation: true,
- target: '#output'
- });
-
- When using ajaxForm, the ajaxSubmit function will be invoked for you
- at the appropriate time.
-*/
-
-/**
- * Feature detection
- */
-var feature = {};
-feature.fileapi = $(" ").get(0).files !== undefined;
-feature.formdata = window.FormData !== undefined;
-
-var hasProp = !!$.fn.prop;
-
-// attr2 uses prop when it can but checks the return type for
-// an expected string. this accounts for the case where a form
-// contains inputs with names like "action" or "method"; in those
-// cases "prop" returns the element
-$.fn.attr2 = function() {
- if ( ! hasProp ) {
- return this.attr.apply(this, arguments);
- }
- var val = this.prop.apply(this, arguments);
- if ( ( val && val.jquery ) || typeof val === 'string' ) {
- return val;
- }
- return this.attr.apply(this, arguments);
-};
-
-/**
- * ajaxSubmit() provides a mechanism for immediately submitting
- * an HTML form using AJAX.
- */
-$.fn.ajaxSubmit = function(options) {
- /*jshint scripturl:true */
-
- // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
- if (!this.length) {
- log('ajaxSubmit: skipping submit process - no element selected');
- return this;
- }
-
- var method, action, url, $form = this;
-
- if (typeof options == 'function') {
- options = { success: options };
- }
- else if ( options === undefined ) {
- options = {};
- }
-
- method = options.type || this.attr2('method');
- action = options.url || this.attr2('action');
-
- url = (typeof action === 'string') ? $.trim(action) : '';
- url = url || window.location.href || '';
- if (url) {
- // clean url (don't include hash vaue)
- url = (url.match(/^([^#]+)/)||[])[1];
- }
-
- options = $.extend(true, {
- url: url,
- success: $.ajaxSettings.success,
- type: method || $.ajaxSettings.type,
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
- }, options);
-
- // hook for manipulating the form data before it is extracted;
- // convenient for use with rich editors like tinyMCE or FCKEditor
- var veto = {};
- this.trigger('form-pre-serialize', [this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
- return this;
- }
-
- // provide opportunity to alter form data before it is serialized
- if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSerialize callback');
- return this;
- }
-
- var traditional = options.traditional;
- if ( traditional === undefined ) {
- traditional = $.ajaxSettings.traditional;
- }
-
- var elements = [];
- var qx, a = this.formToArray(options.semantic, elements);
- if (options.data) {
- options.extraData = options.data;
- qx = $.param(options.data, traditional);
- }
-
- // give pre-submit callback an opportunity to abort the submit
- if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
- log('ajaxSubmit: submit aborted via beforeSubmit callback');
- return this;
- }
-
- // fire vetoable 'validate' event
- this.trigger('form-submit-validate', [a, this, options, veto]);
- if (veto.veto) {
- log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
- return this;
- }
-
- var q = $.param(a, traditional);
- if (qx) {
- q = ( q ? (q + '&' + qx) : qx );
- }
- if (options.type.toUpperCase() == 'GET') {
- options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
- options.data = null; // data is null for 'get'
- }
- else {
- options.data = q; // data is the query string for 'post'
- }
-
- var callbacks = [];
- if (options.resetForm) {
- callbacks.push(function() { $form.resetForm(); });
- }
- if (options.clearForm) {
- callbacks.push(function() { $form.clearForm(options.includeHidden); });
- }
-
- // perform a load on the target only if dataType is not provided
- if (!options.dataType && options.target) {
- var oldSuccess = options.success || function(){};
- callbacks.push(function(data) {
- var fn = options.replaceTarget ? 'replaceWith' : 'html';
- $(options.target)[fn](data).each(oldSuccess, arguments);
- });
- }
- else if (options.success) {
- callbacks.push(options.success);
- }
-
- options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
- var context = options.context || this ; // jQuery 1.4+ supports scope context
- for (var i=0, max=callbacks.length; i < max; i++) {
- callbacks[i].apply(context, [data, status, xhr || $form, $form]);
- }
- };
-
- if (options.error) {
- var oldError = options.error;
- options.error = function(xhr, status, error) {
- var context = options.context || this;
- oldError.apply(context, [xhr, status, error, $form]);
- };
- }
-
- if (options.complete) {
- var oldComplete = options.complete;
- options.complete = function(xhr, status) {
- var context = options.context || this;
- oldComplete.apply(context, [xhr, status, $form]);
- };
- }
-
- // are there files to upload?
-
- // [value] (issue #113), also see comment:
- // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
- var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; });
-
- var hasFileInputs = fileInputs.length > 0;
- var mp = 'multipart/form-data';
- var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
-
- var fileAPI = feature.fileapi && feature.formdata;
- log("fileAPI :" + fileAPI);
- var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
-
- var jqxhr;
-
- // options.iframe allows user to force iframe mode
- // 06-NOV-09: now defaulting to iframe mode if file input is detected
- if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
- // hack to fix Safari hang (thanks to Tim Molendijk for this)
- // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
- if (options.closeKeepAlive) {
- $.get(options.closeKeepAlive, function() {
- jqxhr = fileUploadIframe(a);
- });
- }
- else {
- jqxhr = fileUploadIframe(a);
- }
- }
- else if ((hasFileInputs || multipart) && fileAPI) {
- jqxhr = fileUploadXhr(a);
- }
- else {
- jqxhr = $.ajax(options);
- }
-
- $form.removeData('jqxhr').data('jqxhr', jqxhr);
-
- // clear element array
- for (var k=0; k < elements.length; k++) {
- elements[k] = null;
- }
-
- // fire 'notify' event
- this.trigger('form-submit-notify', [this, options]);
- return this;
-
- // utility fn for deep serialization
- function deepSerialize(extraData){
- var serialized = $.param(extraData, options.traditional).split('&');
- var len = serialized.length;
- var result = [];
- var i, part;
- for (i=0; i < len; i++) {
- // #252; undo param space replacement
- serialized[i] = serialized[i].replace(/\+/g,' ');
- part = serialized[i].split('=');
- // #278; use array instead of object storage, favoring array serializations
- result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
- }
- return result;
- }
-
- // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz)
- function fileUploadXhr(a) {
- var formdata = new FormData();
-
- for (var i=0; i < a.length; i++) {
- formdata.append(a[i].name, a[i].value);
- }
-
- if (options.extraData) {
- var serializedData = deepSerialize(options.extraData);
- for (i=0; i < serializedData.length; i++) {
- if (serializedData[i]) {
- formdata.append(serializedData[i][0], serializedData[i][1]);
- }
- }
- }
-
- options.data = null;
-
- var s = $.extend(true, {}, $.ajaxSettings, options, {
- contentType: false,
- processData: false,
- cache: false,
- type: method || 'POST'
- });
-
- if (options.uploadProgress) {
- // workaround because jqXHR does not expose upload property
- s.xhr = function() {
- var xhr = $.ajaxSettings.xhr();
- if (xhr.upload) {
- xhr.upload.addEventListener('progress', function(event) {
- var percent = 0;
- var position = event.loaded || event.position; /*event.position is deprecated*/
- var total = event.total;
- if (event.lengthComputable) {
- percent = Math.ceil(position / total * 100);
- }
- options.uploadProgress(event, position, total, percent);
- }, false);
- }
- return xhr;
- };
- }
-
- s.data = null;
- var beforeSend = s.beforeSend;
- s.beforeSend = function(xhr, o) {
- //Send FormData() provided by user
- if (options.formData) {
- o.data = options.formData;
- }
- else {
- o.data = formdata;
- }
- if(beforeSend) {
- beforeSend.call(this, xhr, o);
- }
- };
- return $.ajax(s);
- }
-
- // private function for handling file uploads (hat tip to YAHOO!)
- function fileUploadIframe(a) {
- var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
- var deferred = $.Deferred();
-
- // #341
- deferred.abort = function(status) {
- xhr.abort(status);
- };
-
- if (a) {
- // ensure that every serialized input is still enabled
- for (i=0; i < elements.length; i++) {
- el = $(elements[i]);
- if ( hasProp ) {
- el.prop('disabled', false);
- }
- else {
- el.removeAttr('disabled');
- }
- }
- }
-
- s = $.extend(true, {}, $.ajaxSettings, options);
- s.context = s.context || s;
- id = 'jqFormIO' + (new Date().getTime());
- if (s.iframeTarget) {
- $io = $(s.iframeTarget);
- n = $io.attr2('name');
- if (!n) {
- $io.attr2('name', id);
- }
- else {
- id = n;
- }
- }
- else {
- $io = $('');
- $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
- }
- io = $io[0];
-
-
- xhr = { // mock object
- aborted: 0,
- responseText: null,
- responseXML: null,
- status: 0,
- statusText: 'n/a',
- getAllResponseHeaders: function() {},
- getResponseHeader: function() {},
- setRequestHeader: function() {},
- abort: function(status) {
- var e = (status === 'timeout' ? 'timeout' : 'aborted');
- log('aborting upload... ' + e);
- this.aborted = 1;
-
- try { // #214, #257
- if (io.contentWindow.document.execCommand) {
- io.contentWindow.document.execCommand('Stop');
- }
- }
- catch(ignore) {}
-
- $io.attr('src', s.iframeSrc); // abort op in progress
- xhr.error = e;
- if (s.error) {
- s.error.call(s.context, xhr, e, status);
- }
- if (g) {
- $.event.trigger("ajaxError", [xhr, s, e]);
- }
- if (s.complete) {
- s.complete.call(s.context, xhr, e);
- }
- }
- };
-
- g = s.global;
- // trigger ajax global events so that activity/block indicators work like normal
- if (g && 0 === $.active++) {
- $.event.trigger("ajaxStart");
- }
- if (g) {
- $.event.trigger("ajaxSend", [xhr, s]);
- }
-
- if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
- if (s.global) {
- $.active--;
- }
- deferred.reject();
- return deferred;
- }
- if (xhr.aborted) {
- deferred.reject();
- return deferred;
- }
-
- // add submitting element to data if we know it
- sub = form.clk;
- if (sub) {
- n = sub.name;
- if (n && !sub.disabled) {
- s.extraData = s.extraData || {};
- s.extraData[n] = sub.value;
- if (sub.type == "image") {
- s.extraData[n+'.x'] = form.clk_x;
- s.extraData[n+'.y'] = form.clk_y;
- }
- }
- }
-
- var CLIENT_TIMEOUT_ABORT = 1;
- var SERVER_ABORT = 2;
-
- function getDoc(frame) {
- /* it looks like contentWindow or contentDocument do not
- * carry the protocol property in ie8, when running under ssl
- * frame.document is the only valid response document, since
- * the protocol is know but not on the other two objects. strange?
- * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
- */
-
- var doc = null;
-
- // IE8 cascading access check
- try {
- if (frame.contentWindow) {
- doc = frame.contentWindow.document;
- }
- } catch(err) {
- // IE8 access denied under ssl & missing protocol
- log('cannot get iframe.contentWindow document: ' + err);
- }
-
- if (doc) { // successful getting content
- return doc;
- }
-
- try { // simply checking may throw in ie8 under ssl or mismatched protocol
- doc = frame.contentDocument ? frame.contentDocument : frame.document;
- } catch(err) {
- // last attempt
- log('cannot get iframe.contentDocument: ' + err);
- doc = frame.document;
- }
- return doc;
- }
-
- // Rails CSRF hack (thanks to Yvan Barthelemy)
- var csrf_token = $('meta[name=csrf-token]').attr('content');
- var csrf_param = $('meta[name=csrf-param]').attr('content');
- if (csrf_param && csrf_token) {
- s.extraData = s.extraData || {};
- s.extraData[csrf_param] = csrf_token;
- }
-
- // take a breath so that pending repaints get some cpu time before the upload starts
- function doSubmit() {
- // make sure form attrs are set
- var t = $form.attr2('target'),
- a = $form.attr2('action'),
- mp = 'multipart/form-data',
- et = $form.attr('enctype') || $form.attr('encoding') || mp;
-
- // update form attrs in IE friendly way
- form.setAttribute('target',id);
- if (!method || /post/i.test(method) ) {
- form.setAttribute('method', 'POST');
- }
- if (a != s.url) {
- form.setAttribute('action', s.url);
- }
-
- // ie borks in some cases when setting encoding
- if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
- $form.attr({
- encoding: 'multipart/form-data',
- enctype: 'multipart/form-data'
- });
- }
-
- // support timout
- if (s.timeout) {
- timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
- }
-
- // look for server aborts
- function checkState() {
- try {
- var state = getDoc(io).readyState;
- log('state = ' + state);
- if (state && state.toLowerCase() == 'uninitialized') {
- setTimeout(checkState,50);
- }
- }
- catch(e) {
- log('Server abort: ' , e, ' (', e.name, ')');
- cb(SERVER_ABORT);
- if (timeoutHandle) {
- clearTimeout(timeoutHandle);
- }
- timeoutHandle = undefined;
- }
- }
-
- // add "extra" data to form if provided in options
- var extraInputs = [];
- try {
- if (s.extraData) {
- for (var n in s.extraData) {
- if (s.extraData.hasOwnProperty(n)) {
- // if using the $.param format that allows for multiple values with the same name
- if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
- extraInputs.push(
- $(' ').val(s.extraData[n].value)
- .appendTo(form)[0]);
- } else {
- extraInputs.push(
- $(' ').val(s.extraData[n])
- .appendTo(form)[0]);
- }
- }
- }
- }
-
- if (!s.iframeTarget) {
- // add iframe to doc and submit the form
- $io.appendTo('body');
- }
- if (io.attachEvent) {
- io.attachEvent('onload', cb);
- }
- else {
- io.addEventListener('load', cb, false);
- }
- setTimeout(checkState,15);
-
- try {
- form.submit();
- } catch(err) {
- // just in case form has element with name/id of 'submit'
- var submitFn = document.createElement('form').submit;
- submitFn.apply(form);
- }
- }
- finally {
- // reset attrs and remove "extra" input elements
- form.setAttribute('action',a);
- form.setAttribute('enctype', et); // #380
- if(t) {
- form.setAttribute('target', t);
- } else {
- $form.removeAttr('target');
- }
- $(extraInputs).remove();
- }
- }
-
- if (s.forceSync) {
- doSubmit();
- }
- else {
- setTimeout(doSubmit, 10); // this lets dom updates render
- }
-
- var data, doc, domCheckCount = 50, callbackProcessed;
-
- function cb(e) {
- if (xhr.aborted || callbackProcessed) {
- return;
- }
-
- doc = getDoc(io);
- if(!doc) {
- log('cannot access response document');
- e = SERVER_ABORT;
- }
- if (e === CLIENT_TIMEOUT_ABORT && xhr) {
- xhr.abort('timeout');
- deferred.reject(xhr, 'timeout');
- return;
- }
- else if (e == SERVER_ABORT && xhr) {
- xhr.abort('server abort');
- deferred.reject(xhr, 'error', 'server abort');
- return;
- }
-
- if (!doc || doc.location.href == s.iframeSrc) {
- // response not received yet
- if (!timedOut) {
- return;
- }
- }
- if (io.detachEvent) {
- io.detachEvent('onload', cb);
- }
- else {
- io.removeEventListener('load', cb, false);
- }
-
- var status = 'success', errMsg;
- try {
- if (timedOut) {
- throw 'timeout';
- }
-
- var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
- log('isXml='+isXml);
- if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
- if (--domCheckCount) {
- // in some browsers (Opera) the iframe DOM is not always traversable when
- // the onload callback fires, so we loop a bit to accommodate
- log('requeing onLoad callback, DOM not available');
- setTimeout(cb, 250);
- return;
- }
- // let this fall through because server response could be an empty document
- //log('Could not access iframe DOM after mutiple tries.');
- //throw 'DOMException: not available';
- }
-
- //log('response detected');
- var docRoot = doc.body ? doc.body : doc.documentElement;
- xhr.responseText = docRoot ? docRoot.innerHTML : null;
- xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
- if (isXml) {
- s.dataType = 'xml';
- }
- xhr.getResponseHeader = function(header){
- var headers = {'content-type': s.dataType};
- return headers[header.toLowerCase()];
- };
- // support for XHR 'status' & 'statusText' emulation :
- if (docRoot) {
- xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
- xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
- }
-
- var dt = (s.dataType || '').toLowerCase();
- var scr = /(json|script|text)/.test(dt);
- if (scr || s.textarea) {
- // see if user embedded response in textarea
- var ta = doc.getElementsByTagName('textarea')[0];
- if (ta) {
- xhr.responseText = ta.value;
- // support for XHR 'status' & 'statusText' emulation :
- xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
- xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
- }
- else if (scr) {
- // account for browsers injecting pre around json response
- var pre = doc.getElementsByTagName('pre')[0];
- var b = doc.getElementsByTagName('body')[0];
- if (pre) {
- xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
- }
- else if (b) {
- xhr.responseText = b.textContent ? b.textContent : b.innerText;
- }
- }
- }
- else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
- xhr.responseXML = toXml(xhr.responseText);
- }
-
- try {
- data = httpData(xhr, dt, s);
- }
- catch (err) {
- status = 'parsererror';
- xhr.error = errMsg = (err || status);
- }
- }
- catch (err) {
- log('error caught: ',err);
- status = 'error';
- xhr.error = errMsg = (err || status);
- }
-
- if (xhr.aborted) {
- log('upload aborted');
- status = null;
- }
-
- if (xhr.status) { // we've set xhr.status
- status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
- }
-
- // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
- if (status === 'success') {
- if (s.success) {
- s.success.call(s.context, data, 'success', xhr);
- }
- deferred.resolve(xhr.responseText, 'success', xhr);
- if (g) {
- $.event.trigger("ajaxSuccess", [xhr, s]);
- }
- }
- else if (status) {
- if (errMsg === undefined) {
- errMsg = xhr.statusText;
- }
- if (s.error) {
- s.error.call(s.context, xhr, status, errMsg);
- }
- deferred.reject(xhr, 'error', errMsg);
- if (g) {
- $.event.trigger("ajaxError", [xhr, s, errMsg]);
- }
- }
-
- if (g) {
- $.event.trigger("ajaxComplete", [xhr, s]);
- }
-
- if (g && ! --$.active) {
- $.event.trigger("ajaxStop");
- }
-
- if (s.complete) {
- s.complete.call(s.context, xhr, status);
- }
-
- callbackProcessed = true;
- if (s.timeout) {
- clearTimeout(timeoutHandle);
- }
-
- // clean up
- setTimeout(function() {
- if (!s.iframeTarget) {
- $io.remove();
- }
- else { //adding else to clean up existing iframe response.
- $io.attr('src', s.iframeSrc);
- }
- xhr.responseXML = null;
- }, 100);
- }
-
- var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
- if (window.ActiveXObject) {
- doc = new ActiveXObject('Microsoft.XMLDOM');
- doc.async = 'false';
- doc.loadXML(s);
- }
- else {
- doc = (new DOMParser()).parseFromString(s, 'text/xml');
- }
- return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
- };
- var parseJSON = $.parseJSON || function(s) {
- /*jslint evil:true */
- return window['eval']('(' + s + ')');
- };
-
- var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
-
- var ct = xhr.getResponseHeader('content-type') || '',
- xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
- data = xml ? xhr.responseXML : xhr.responseText;
-
- if (xml && data.documentElement.nodeName === 'parsererror') {
- if ($.error) {
- $.error('parsererror');
- }
- }
- if (s && s.dataFilter) {
- data = s.dataFilter(data, type);
- }
- if (typeof data === 'string') {
- if (type === 'json' || !type && ct.indexOf('json') >= 0) {
- data = parseJSON(data);
- } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
- $.globalEval(data);
- }
- }
- return data;
- };
-
- return deferred;
- }
-};
-
-/**
- * ajaxForm() provides a mechanism for fully automating form submission.
- *
- * The advantages of using this method instead of ajaxSubmit() are:
- *
- * 1: This method will include coordinates for elements (if the element
- * is used to submit the form).
- * 2. This method will include the submit element's name/value data (for the element that was
- * used to submit the form).
- * 3. This method binds the submit() method to the form for you.
- *
- * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
- * passes the options argument along after properly binding events for submit elements and
- * the form itself.
- */
-$.fn.ajaxForm = function(options) {
- options = options || {};
- options.delegation = options.delegation && $.isFunction($.fn.on);
-
- // in jQuery 1.3+ we can fix mistakes with the ready state
- if (!options.delegation && this.length === 0) {
- var o = { s: this.selector, c: this.context };
- if (!$.isReady && o.s) {
- log('DOM not ready, queuing ajaxForm');
- $(function() {
- $(o.s,o.c).ajaxForm(options);
- });
- return this;
- }
- // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
- log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
- return this;
- }
-
- if ( options.delegation ) {
- $(document)
- .off('submit.form-plugin', this.selector, doAjaxSubmit)
- .off('click.form-plugin', this.selector, captureSubmittingElement)
- .on('submit.form-plugin', this.selector, options, doAjaxSubmit)
- .on('click.form-plugin', this.selector, options, captureSubmittingElement);
- return this;
- }
-
- return this.ajaxFormUnbind()
- .bind('submit.form-plugin', options, doAjaxSubmit)
- .bind('click.form-plugin', options, captureSubmittingElement);
-};
-
-// private event handlers
-function doAjaxSubmit(e) {
- /*jshint validthis:true */
- var options = e.data;
- if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
- e.preventDefault();
- $(e.target).ajaxSubmit(options); // #365
- }
-}
-
-function captureSubmittingElement(e) {
- /*jshint validthis:true */
- var target = e.target;
- var $el = $(target);
- if (!($el.is("[type=submit],[type=image]"))) {
- // is this a child element of the submit el? (ex: a span within a button)
- var t = $el.closest('[type=submit]');
- if (t.length === 0) {
- return;
- }
- target = t[0];
- }
- var form = this;
- form.clk = target;
- if (target.type == 'image') {
- if (e.offsetX !== undefined) {
- form.clk_x = e.offsetX;
- form.clk_y = e.offsetY;
- } else if (typeof $.fn.offset == 'function') {
- var offset = $el.offset();
- form.clk_x = e.pageX - offset.left;
- form.clk_y = e.pageY - offset.top;
- } else {
- form.clk_x = e.pageX - target.offsetLeft;
- form.clk_y = e.pageY - target.offsetTop;
- }
- }
- // clear form vars
- setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
-}
-
-
-// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
-$.fn.ajaxFormUnbind = function() {
- return this.unbind('submit.form-plugin click.form-plugin');
-};
-
-/**
- * formToArray() gathers form element data into an array of objects that can
- * be passed to any of the following ajax functions: $.get, $.post, or load.
- * Each object in the array has both a 'name' and 'value' property. An example of
- * an array for a simple login form might be:
- *
- * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
- *
- * It is this array that is passed to pre-submit callback functions provided to the
- * ajaxSubmit() and ajaxForm() methods.
- */
-$.fn.formToArray = function(semantic, elements) {
- var a = [];
- if (this.length === 0) {
- return a;
- }
-
- var form = this[0];
- var formId = this.attr('id');
- var els = semantic ? form.getElementsByTagName('*') : form.elements;
- var els2;
-
- if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390
- els = $(els).get(); // convert to standard array
- }
-
- // #386; account for inputs outside the form which use the 'form' attribute
- if ( formId ) {
- els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet
- if ( els2.length ) {
- els = (els || []).concat(els2);
- }
- }
-
- if (!els || !els.length) {
- return a;
- }
-
- var i,j,n,v,el,max,jmax;
- for(i=0, max=els.length; i < max; i++) {
- el = els[i];
- n = el.name;
- if (!n || el.disabled) {
- continue;
- }
-
- if (semantic && form.clk && el.type == "image") {
- // handle image inputs on the fly when semantic == true
- if(form.clk == el) {
- a.push({name: n, value: $(el).val(), type: el.type });
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- continue;
- }
-
- v = $.fieldValue(el, true);
- if (v && v.constructor == Array) {
- if (elements) {
- elements.push(el);
- }
- for(j=0, jmax=v.length; j < jmax; j++) {
- a.push({name: n, value: v[j]});
- }
- }
- else if (feature.fileapi && el.type == 'file') {
- if (elements) {
- elements.push(el);
- }
- var files = el.files;
- if (files.length) {
- for (j=0; j < files.length; j++) {
- a.push({name: n, value: files[j], type: el.type});
- }
- }
- else {
- // #180
- a.push({ name: n, value: '', type: el.type });
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- if (elements) {
- elements.push(el);
- }
- a.push({name: n, value: v, type: el.type, required: el.required});
- }
- }
-
- if (!semantic && form.clk) {
- // input type=='image' are not found in elements array! handle it here
- var $input = $(form.clk), input = $input[0];
- n = input.name;
- if (n && !input.disabled && input.type == 'image') {
- a.push({name: n, value: $input.val()});
- a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
- }
- }
- return a;
-};
-
-/**
- * Serializes form data into a 'submittable' string. This method will return a string
- * in the format: name1=value1&name2=value2
- */
-$.fn.formSerialize = function(semantic) {
- //hand off to jQuery.param for proper encoding
- return $.param(this.formToArray(semantic));
-};
-
-/**
- * Serializes all field elements in the jQuery object into a query string.
- * This method will return a string in the format: name1=value1&name2=value2
- */
-$.fn.fieldSerialize = function(successful) {
- var a = [];
- this.each(function() {
- var n = this.name;
- if (!n) {
- return;
- }
- var v = $.fieldValue(this, successful);
- if (v && v.constructor == Array) {
- for (var i=0,max=v.length; i < max; i++) {
- a.push({name: n, value: v[i]});
- }
- }
- else if (v !== null && typeof v != 'undefined') {
- a.push({name: this.name, value: v});
- }
- });
- //hand off to jQuery.param for proper encoding
- return $.param(a);
-};
-
-/**
- * Returns the value(s) of the element in the matched set. For example, consider the following form:
- *
- *
- *
- * var v = $('input[type=text]').fieldValue();
- * // if no values are entered into the text inputs
- * v == ['','']
- * // if values entered into the text inputs are 'foo' and 'bar'
- * v == ['foo','bar']
- *
- * var v = $('input[type=checkbox]').fieldValue();
- * // if neither checkbox is checked
- * v === undefined
- * // if both checkboxes are checked
- * v == ['B1', 'B2']
- *
- * var v = $('input[type=radio]').fieldValue();
- * // if neither radio is checked
- * v === undefined
- * // if first radio is checked
- * v == ['C1']
- *
- * The successful argument controls whether or not the field element must be 'successful'
- * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
- * The default value of the successful argument is true. If this value is false the value(s)
- * for each element is returned.
- *
- * Note: This method *always* returns an array. If no valid value can be determined the
- * array will be empty, otherwise it will contain one or more values.
- */
-$.fn.fieldValue = function(successful) {
- for (var val=[], i=0, max=this.length; i < max; i++) {
- var el = this[i];
- var v = $.fieldValue(el, successful);
- if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
- continue;
- }
- if (v.constructor == Array) {
- $.merge(val, v);
- }
- else {
- val.push(v);
- }
- }
- return val;
-};
-
-/**
- * Returns the value of the field element.
- */
-$.fieldValue = function(el, successful) {
- var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
- if (successful === undefined) {
- successful = true;
- }
-
- if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
- (t == 'checkbox' || t == 'radio') && !el.checked ||
- (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
- tag == 'select' && el.selectedIndex == -1)) {
- return null;
- }
-
- if (tag == 'select') {
- var index = el.selectedIndex;
- if (index < 0) {
- return null;
- }
- var a = [], ops = el.options;
- var one = (t == 'select-one');
- var max = (one ? index+1 : ops.length);
- for(var i=(one ? index : 0); i < max; i++) {
- var op = ops[i];
- if (op.selected) {
- var v = op.value;
- if (!v) { // extra pain for IE...
- v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value;
- }
- if (one) {
- return v;
- }
- a.push(v);
- }
- }
- return a;
- }
- return $(el).val();
-};
-
-/**
- * Clears the form data. Takes the following actions on the form's input fields:
- * - input text fields will have their 'value' property set to the empty string
- * - select elements will have their 'selectedIndex' property set to -1
- * - checkbox and radio inputs will have their 'checked' property set to false
- * - inputs of type submit, button, reset, and hidden will *not* be effected
- * - button elements will *not* be effected
- */
-$.fn.clearForm = function(includeHidden) {
- return this.each(function() {
- $('input,select,textarea', this).clearFields(includeHidden);
- });
-};
-
-/**
- * Clears the selected form elements.
- */
-$.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
- var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
- return this.each(function() {
- var t = this.type, tag = this.tagName.toLowerCase();
- if (re.test(t) || tag == 'textarea') {
- this.value = '';
- }
- else if (t == 'checkbox' || t == 'radio') {
- this.checked = false;
- }
- else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- else if (t == "file") {
- if (/MSIE/.test(navigator.userAgent)) {
- $(this).replaceWith($(this).clone(true));
- } else {
- $(this).val('');
- }
- }
- else if (includeHidden) {
- // includeHidden can be the value true, or it can be a selector string
- // indicating a special test; for example:
- // $('#myForm').clearForm('.special:hidden')
- // the above would clean hidden inputs that have the class of 'special'
- if ( (includeHidden === true && /hidden/.test(t)) ||
- (typeof includeHidden == 'string' && $(this).is(includeHidden)) ) {
- this.value = '';
- }
- }
- });
-};
-
-/**
- * Resets the form data. Causes all form elements to be reset to their original value.
- */
-$.fn.resetForm = function() {
- return this.each(function() {
- // guard against an input with the name of 'reset'
- // note that IE reports the reset function as an 'object'
- if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
- this.reset();
- }
- });
-};
-
-/**
- * Enables or disables any matching elements.
- */
-$.fn.enable = function(b) {
- if (b === undefined) {
- b = true;
- }
- return this.each(function() {
- this.disabled = !b;
- });
-};
-
-/**
- * Checks/unchecks any matching checkboxes or radio buttons and
- * selects/deselects and matching option elements.
- */
-$.fn.selected = function(select) {
- if (select === undefined) {
- select = true;
- }
- return this.each(function() {
- var t = this.type;
- if (t == 'checkbox' || t == 'radio') {
- this.checked = select;
- }
- else if (this.tagName.toLowerCase() == 'option') {
- var $sel = $(this).parent('select');
- if (select && $sel[0] && $sel[0].type == 'select-one') {
- // deselect all other options
- $sel.find('option').selected(false);
- }
- this.selected = select;
- }
- });
-};
-
-// expose debug var
-$.fn.ajaxSubmit.debug = false;
-
-// helper fn for console logging
-function log() {
- if (!$.fn.ajaxSubmit.debug) {
- return;
- }
- var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
- if (window.console && window.console.log) {
- window.console.log(msg);
- }
- else if (window.opera && window.opera.postError) {
- window.opera.postError(msg);
- }
-}
-
-}));
diff --git a/erp_web/js/jquery-plugins/jquery.inputmask.js b/erp_web/js/jquery-plugins/jquery.inputmask.js
deleted file mode 100644
index 2cbc8d44..00000000
--- a/erp_web/js/jquery-plugins/jquery.inputmask.js
+++ /dev/null
@@ -1,2604 +0,0 @@
-/*!
-* jquery.inputmask.bundle.js
-* http://github.com/RobinHerbots/jquery.inputmask
-* Copyright (c) 2010 - 2015 Robin Herbots
-* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.2.3-5
-* @jishenghua 新增money千分位格式别名,举例如下:
-* $(".moneyMask").inputmask({alias:"money"}); // 金额数据格式(初始化完成表单后调用)
-* $('.moneyMask').inputmask('remove'); // 金额数据格式化恢复(表单提交之前调用)
-*/
-!function($) {
- function Inputmask(alias, options) {
- return this instanceof Inputmask ? ("object" == typeof alias ? options = alias : (options = options || {},
- options.alias = alias), this.el = void 0, this.opts = $.extend(!0, {}, this.defaults, options),
- this.noMasksCache = options && void 0 !== options.definitions, this.userOptions = options || {},
- void resolveAlias(this.opts.alias, options, this.opts)) : new Inputmask(alias, options);
- }
- function isInputEventSupported(eventName) {
- var el = document.createElement("input"), evName = "on" + eventName, isSupported = evName in el;
- return isSupported || (el.setAttribute(evName, "return;"), isSupported = "function" == typeof el[evName]),
- el = null, isSupported;
- }
- function isInputTypeSupported(inputType) {
- var isSupported = "text" === inputType || "tel" === inputType || "password" === inputType;
- if (!isSupported) {
- var el = document.createElement("input");
- el.setAttribute("type", inputType), isSupported = "text" === el.type, el = null;
- }
- return isSupported;
- }
- function resolveAlias(aliasStr, options, opts) {
- var aliasDefinition = opts.aliases[aliasStr];
- return aliasDefinition ? (aliasDefinition.alias && resolveAlias(aliasDefinition.alias, void 0, opts),
- $.extend(!0, opts, aliasDefinition), $.extend(!0, opts, options), !0) : (null === opts.mask && (opts.mask = aliasStr),
- !1);
- }
- function importAttributeOptions(npt, opts, userOptions) {
- function importOption(option) {
- var optionData = npt.getAttribute("data-inputmask-" + option.toLowerCase());
- null !== optionData && (optionData = "boolean" == typeof optionData ? optionData : optionData.toString(),
- "string" == typeof optionData && 0 === option.indexOf("on") && (optionData = eval("(" + optionData + ")")),
- "mask" === option && 0 === optionData.indexOf("[") ? (userOptions[option] = optionData.replace(/[\s[\]]/g, "").split(","),
- userOptions[option][0] = userOptions[option][0].replace("'", ""), userOptions[option][userOptions[option].length - 1] = userOptions[option][userOptions[option].length - 1].replace("'", "")) : userOptions[option] = optionData);
- }
- var attrOptions = npt.getAttribute("data-inputmask");
- if (attrOptions && "" !== attrOptions) try {
- attrOptions = attrOptions.replace(new RegExp("'", "g"), '"');
- var dataoptions = $.parseJSON("{" + attrOptions + "}");
- $.extend(!0, userOptions, dataoptions);
- } catch (ex) {}
- for (var option in opts) importOption(option);
- if (userOptions.alias) {
- resolveAlias(userOptions.alias, userOptions, opts);
- for (option in opts) importOption(option);
- }
- return $.extend(!0, opts, userOptions), opts;
- }
- function generateMaskSet(opts, nocache) {
- function analyseMask(mask) {
- function MaskToken(isGroup, isOptional, isQuantifier, isAlternator) {
- this.matches = [], this.isGroup = isGroup || !1, this.isOptional = isOptional || !1,
- this.isQuantifier = isQuantifier || !1, this.isAlternator = isAlternator || !1,
- this.quantifier = {
- min: 1,
- max: 1
- };
- }
- function insertTestDefinition(mtoken, element, position) {
- var maskdef = opts.definitions[element];
- position = void 0 !== position ? position : mtoken.matches.length;
- var prevMatch = mtoken.matches[position - 1];
- if (maskdef && !escaped) {
- maskdef.placeholder = $.isFunction(maskdef.placeholder) ? maskdef.placeholder(opts) : maskdef.placeholder;
- for (var prevalidators = maskdef.prevalidator, prevalidatorsL = prevalidators ? prevalidators.length : 0, i = 1; i < maskdef.cardinality; i++) {
- var prevalidator = prevalidatorsL >= i ? prevalidators[i - 1] : [], validator = prevalidator.validator, cardinality = prevalidator.cardinality;
- mtoken.matches.splice(position++, 0, {
- fn: validator ? "string" == typeof validator ? new RegExp(validator) : new function() {
- this.test = validator;
- }() : new RegExp("."),
- cardinality: cardinality ? cardinality : 1,
- optionality: mtoken.isOptional,
- newBlockMarker: void 0 === prevMatch || prevMatch.def !== (maskdef.definitionSymbol || element),
- casing: maskdef.casing,
- def: maskdef.definitionSymbol || element,
- placeholder: maskdef.placeholder,
- mask: element
- }), prevMatch = mtoken.matches[position - 1];
- }
- mtoken.matches.splice(position++, 0, {
- fn: maskdef.validator ? "string" == typeof maskdef.validator ? new RegExp(maskdef.validator) : new function() {
- this.test = maskdef.validator;
- }() : new RegExp("."),
- cardinality: maskdef.cardinality,
- optionality: mtoken.isOptional,
- newBlockMarker: void 0 === prevMatch || prevMatch.def !== (maskdef.definitionSymbol || element),
- casing: maskdef.casing,
- def: maskdef.definitionSymbol || element,
- placeholder: maskdef.placeholder,
- mask: element
- });
- } else mtoken.matches.splice(position++, 0, {
- fn: null,
- cardinality: 0,
- optionality: mtoken.isOptional,
- newBlockMarker: void 0 === prevMatch || prevMatch.def !== element,
- casing: null,
- def: element,
- placeholder: void 0,
- mask: element
- }), escaped = !1;
- }
- function verifyGroupMarker(lastMatch, isOpenGroup) {
- lastMatch.isGroup && (lastMatch.isGroup = !1, insertTestDefinition(lastMatch, opts.groupmarker.start, 0),
- isOpenGroup !== !0 && insertTestDefinition(lastMatch, opts.groupmarker.end));
- }
- function maskCurrentToken(m, currentToken, lastMatch, extraCondition) {
- currentToken.matches.length > 0 && (void 0 === extraCondition || extraCondition) && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
- verifyGroupMarker(lastMatch)), insertTestDefinition(currentToken, m);
- }
- function defaultCase() {
- if (openenings.length > 0) {
- if (currentOpeningToken = openenings[openenings.length - 1], maskCurrentToken(m, currentOpeningToken, lastMatch, !currentOpeningToken.isAlternator),
- currentOpeningToken.isAlternator) {
- alternator = openenings.pop();
- for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
- openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
- currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
- }
- } else maskCurrentToken(m, currentToken, lastMatch);
- }
- function reverseTokens(maskToken) {
- function reverseStatic(st) {
- return st === opts.optionalmarker.start ? st = opts.optionalmarker.end : st === opts.optionalmarker.end ? st = opts.optionalmarker.start : st === opts.groupmarker.start ? st = opts.groupmarker.end : st === opts.groupmarker.end && (st = opts.groupmarker.start),
- st;
- }
- maskToken.matches = maskToken.matches.reverse();
- for (var match in maskToken.matches) {
- var intMatch = parseInt(match);
- if (maskToken.matches[match].isQuantifier && maskToken.matches[intMatch + 1] && maskToken.matches[intMatch + 1].isGroup) {
- var qt = maskToken.matches[match];
- maskToken.matches.splice(match, 1), maskToken.matches.splice(intMatch + 1, 0, qt);
- }
- void 0 !== maskToken.matches[match].matches ? maskToken.matches[match] = reverseTokens(maskToken.matches[match]) : maskToken.matches[match] = reverseStatic(maskToken.matches[match]);
- }
- return maskToken;
- }
- for (var match, m, openingToken, currentOpeningToken, alternator, lastMatch, groupToken, tokenizer = /(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g, escaped = !1, currentToken = new MaskToken(), openenings = [], maskTokens = []; match = tokenizer.exec(mask); ) if (m = match[0],
- escaped) defaultCase(); else switch (m.charAt(0)) {
- case opts.escapeChar:
- escaped = !0;
- break;
-
- case opts.optionalmarker.end:
- case opts.groupmarker.end:
- if (openingToken = openenings.pop(), void 0 !== openingToken) if (openenings.length > 0) {
- if (currentOpeningToken = openenings[openenings.length - 1], currentOpeningToken.matches.push(openingToken),
- currentOpeningToken.isAlternator) {
- alternator = openenings.pop();
- for (var mndx = 0; mndx < alternator.matches.length; mndx++) alternator.matches[mndx].isGroup = !1;
- openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
- currentOpeningToken.matches.push(alternator)) : currentToken.matches.push(alternator);
- }
- } else currentToken.matches.push(openingToken); else defaultCase();
- break;
-
- case opts.optionalmarker.start:
- openenings.push(new MaskToken(!1, !0));
- break;
-
- case opts.groupmarker.start:
- openenings.push(new MaskToken(!0));
- break;
-
- case opts.quantifiermarker.start:
- var quantifier = new MaskToken(!1, !1, !0);
- m = m.replace(/[{}]/g, "");
- var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
- if (("*" === mq1 || "+" === mq1) && (mq0 = "*" === mq1 ? 0 : 1), quantifier.quantifier = {
- min: mq0,
- max: mq1
- }, openenings.length > 0) {
- var matches = openenings[openenings.length - 1].matches;
- match = matches.pop(), match.isGroup || (groupToken = new MaskToken(!0), groupToken.matches.push(match),
- match = groupToken), matches.push(match), matches.push(quantifier);
- } else match = currentToken.matches.pop(), match.isGroup || (groupToken = new MaskToken(!0),
- groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match),
- currentToken.matches.push(quantifier);
- break;
-
- case opts.alternatormarker:
- openenings.length > 0 ? (currentOpeningToken = openenings[openenings.length - 1],
- lastMatch = currentOpeningToken.matches.pop()) : lastMatch = currentToken.matches.pop(),
- lastMatch.isAlternator ? openenings.push(lastMatch) : (alternator = new MaskToken(!1, !1, !1, !0),
- alternator.matches.push(lastMatch), openenings.push(alternator));
- break;
-
- default:
- defaultCase();
- }
- for (;openenings.length > 0; ) openingToken = openenings.pop(), verifyGroupMarker(openingToken, !0),
- currentToken.matches.push(openingToken);
- return currentToken.matches.length > 0 && (lastMatch = currentToken.matches[currentToken.matches.length - 1],
- verifyGroupMarker(lastMatch), maskTokens.push(currentToken)), opts.numericInput && reverseTokens(maskTokens[0]),
- maskTokens;
- }
- function generateMask(mask, metadata) {
- if (null === mask || "" === mask) return void 0;
- if (1 === mask.length && opts.greedy === !1 && 0 !== opts.repeat && (opts.placeholder = ""),
- opts.repeat > 0 || "*" === opts.repeat || "+" === opts.repeat) {
- var repeatStart = "*" === opts.repeat ? 0 : "+" === opts.repeat ? 1 : opts.repeat;
- mask = opts.groupmarker.start + mask + opts.groupmarker.end + opts.quantifiermarker.start + repeatStart + "," + opts.repeat + opts.quantifiermarker.end;
- }
- var masksetDefinition;
- return void 0 === Inputmask.prototype.masksCache[mask] || nocache === !0 ? (masksetDefinition = {
- mask: mask,
- maskToken: analyseMask(mask),
- validPositions: {},
- _buffer: void 0,
- buffer: void 0,
- tests: {},
- metadata: metadata
- }, nocache !== !0 && (Inputmask.prototype.masksCache[opts.numericInput ? mask.split("").reverse().join("") : mask] = masksetDefinition)) : masksetDefinition = $.extend(!0, {}, Inputmask.prototype.masksCache[mask]),
- masksetDefinition;
- }
- function preProcessMask(mask) {
- return mask = mask.toString();
- }
- var ms;
- if ($.isFunction(opts.mask) && (opts.mask = opts.mask(opts)), $.isArray(opts.mask)) {
- if (opts.mask.length > 1) {
- opts.keepStatic = null === opts.keepStatic ? !0 : opts.keepStatic;
- var altMask = "(";
- return $.each(opts.numericInput ? opts.mask.reverse() : opts.mask, function(ndx, msk) {
- altMask.length > 1 && (altMask += ")|("), altMask += preProcessMask(void 0 === msk.mask || $.isFunction(msk.mask) ? msk : msk.mask);
- }), altMask += ")", generateMask(altMask, opts.mask);
- }
- opts.mask = opts.mask.pop();
- }
- return opts.mask && (ms = void 0 === opts.mask.mask || $.isFunction(opts.mask.mask) ? generateMask(preProcessMask(opts.mask), opts.mask) : generateMask(preProcessMask(opts.mask.mask), opts.mask)),
- ms;
- }
- function maskScope(actionObj, maskset, opts) {
- function getMaskTemplate(baseOnInput, minimalPos, includeInput) {
- minimalPos = minimalPos || 0;
- var ndxIntlzr, test, testPos, maskTemplate = [], pos = 0;
- do {
- if (baseOnInput === !0 && getMaskSet().validPositions[pos]) {
- var validPos = getMaskSet().validPositions[pos];
- test = validPos.match, ndxIntlzr = validPos.locator.slice(), maskTemplate.push(includeInput === !0 ? validPos.input : getPlaceholder(pos, test));
- } else testPos = getTestTemplate(pos, ndxIntlzr, pos - 1), test = testPos.match,
- ndxIntlzr = testPos.locator.slice(), maskTemplate.push(getPlaceholder(pos, test));
- pos++;
- } while ((void 0 === maxLength || maxLength > pos - 1) && null !== test.fn || null === test.fn && "" !== test.def || minimalPos >= pos);
- return maskTemplate.pop(), maskTemplate;
- }
- function getMaskSet() {
- return maskset;
- }
- function resetMaskSet(soft) {
- var maskset = getMaskSet();
- maskset.buffer = void 0, maskset.tests = {}, soft !== !0 && (maskset._buffer = void 0,
- maskset.validPositions = {}, maskset.p = 0);
- }
- function getLastValidPosition(closestTo, strict) {
- var maskset = getMaskSet(), lastValidPosition = -1, valids = maskset.validPositions;
- void 0 === closestTo && (closestTo = -1);
- var before = lastValidPosition, after = lastValidPosition;
- for (var posNdx in valids) {
- var psNdx = parseInt(posNdx);
- valids[psNdx] && (strict || null !== valids[psNdx].match.fn) && (closestTo >= psNdx && (before = psNdx),
- psNdx >= closestTo && (after = psNdx));
- }
- return lastValidPosition = -1 !== before && closestTo - before > 1 || closestTo > after ? before : after;
- }
- function setValidPosition(pos, validTest, fromSetValid) {
- if (opts.insertMode && void 0 !== getMaskSet().validPositions[pos] && void 0 === fromSetValid) {
- var i, positionsClone = $.extend(!0, {}, getMaskSet().validPositions), lvp = getLastValidPosition();
- for (i = pos; lvp >= i; i++) delete getMaskSet().validPositions[i];
- getMaskSet().validPositions[pos] = validTest;
- var j, valid = !0, vps = getMaskSet().validPositions;
- for (i = j = pos; lvp >= i; i++) {
- var t = positionsClone[i];
- if (void 0 !== t) for (var posMatch = j, prevPosMatch = -1; posMatch < getMaskLength() && (null == t.match.fn && vps[i] && (vps[i].match.optionalQuantifier === !0 || vps[i].match.optionality === !0) || null != t.match.fn); ) {
- if (null === t.match.fn || !opts.keepStatic && vps[i] && (void 0 !== vps[i + 1] && getTests(i + 1, vps[i].locator.slice(), i).length > 1 || void 0 !== vps[i].alternation) ? posMatch++ : posMatch = seekNext(j),
- positionCanMatchDefinition(posMatch, t.match.def)) {
- valid = isValid(posMatch, t.input, !0, !0) !== !1, j = posMatch;
- break;
- }
- if (valid = null == t.match.fn, prevPosMatch === posMatch) break;
- prevPosMatch = posMatch;
- }
- if (!valid) break;
- }
- if (!valid) return getMaskSet().validPositions = $.extend(!0, {}, positionsClone),
- !1;
- } else getMaskSet().validPositions[pos] = validTest;
- return !0;
- }
- function stripValidPositions(start, end, nocheck, strict) {
- var i, startPos = start;
- for (getMaskSet().p = start, i = startPos; end > i; i++) void 0 !== getMaskSet().validPositions[i] && (nocheck === !0 || opts.canClearPosition(getMaskSet(), i, getLastValidPosition(), strict, opts) !== !1) && delete getMaskSet().validPositions[i];
- for (resetMaskSet(!0), i = startPos + 1; i <= getLastValidPosition(); ) {
- for (;void 0 !== getMaskSet().validPositions[startPos]; ) startPos++;
- var s = getMaskSet().validPositions[startPos];
- startPos > i && (i = startPos + 1);
- var t = getMaskSet().validPositions[i];
- void 0 !== t && isMask(i) && void 0 === s ? (positionCanMatchDefinition(startPos, t.match.def) && isValid(startPos, t.input, !0) !== !1 && (delete getMaskSet().validPositions[i],
- i++), startPos++) : i++;
- }
- var lvp = getLastValidPosition(), ml = getMaskLength();
- for (strict !== !0 && nocheck !== !0 && void 0 !== getMaskSet().validPositions[lvp] && getMaskSet().validPositions[lvp].input === opts.radixPoint && delete getMaskSet().validPositions[lvp],
- i = lvp + 1; ml >= i; i++) getMaskSet().validPositions[i] && delete getMaskSet().validPositions[i];
- resetMaskSet(!0);
- }
- function getTestTemplate(pos, ndxIntlzr, tstPs) {
- var testPos = getMaskSet().validPositions[pos];
- if (void 0 === testPos) for (var testPositions = getTests(pos, ndxIntlzr, tstPs), lvp = getLastValidPosition(), lvTest = getMaskSet().validPositions[lvp] || getTests(0)[0], lvTestAltArr = void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation].toString().split(",") : [], ndx = 0; ndx < testPositions.length && (testPos = testPositions[ndx],
- !(testPos.match && (opts.greedy && testPos.match.optionalQuantifier !== !0 || (testPos.match.optionality === !1 || testPos.match.newBlockMarker === !1) && testPos.match.optionalQuantifier !== !0) && (void 0 === lvTest.alternation || lvTest.alternation !== testPos.alternation || void 0 !== testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAltArr)))); ndx++) ;
- return testPos;
- }
- function getTest(pos) {
- return getMaskSet().validPositions[pos] ? getMaskSet().validPositions[pos].match : getTests(pos)[0].match;
- }
- function positionCanMatchDefinition(pos, def) {
- for (var valid = !1, tests = getTests(pos), tndx = 0; tndx < tests.length; tndx++) if (tests[tndx].match && tests[tndx].match.def === def) {
- valid = !0;
- break;
- }
- return valid;
- }
- function getTests(pos, ndxIntlzr, tstPs, cacheable) {
- function resolveTestFromToken(maskToken, ndxInitializer, loopNdx, quantifierRecurse) {
- function handleMatch(match, loopNdx, quantifierRecurse) {
- if (testPos > 1e4) throw "Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. " + getMaskSet().mask;
- if (testPos === pos && void 0 === match.matches) return matches.push({
- match: match,
- locator: loopNdx.reverse()
- }), !0;
- if (void 0 !== match.matches) {
- if (match.isGroup && quantifierRecurse !== match) {
- if (match = handleMatch(maskToken.matches[$.inArray(match, maskToken.matches) + 1], loopNdx)) return !0;
- } else if (match.isOptional) {
- var optionalToken = match;
- if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) {
- if (latestMatch = matches[matches.length - 1].match, isFirstMatch = 0 === $.inArray(latestMatch, optionalToken.matches),
- !isFirstMatch) return !0;
- insertStop = !0, testPos = pos;
- }
- } else if (match.isAlternator) {
- var maltMatches, alternateToken = match, malternateMatches = [], currentMatches = matches.slice(), loopNdxCnt = loopNdx.length, altIndex = ndxInitializer.length > 0 ? ndxInitializer.shift() : -1;
- if (-1 === altIndex || "string" == typeof altIndex) {
- var currentPos = testPos, ndxInitializerClone = ndxInitializer.slice(), altIndexArr = [];
- "string" == typeof altIndex && (altIndexArr = altIndex.split(","));
- for (var amndx = 0; amndx < alternateToken.matches.length; amndx++) {
- if (matches = [], match = handleMatch(alternateToken.matches[amndx], [ amndx ].concat(loopNdx), quantifierRecurse) || match,
- match !== !0 && void 0 !== match && altIndexArr[altIndexArr.length - 1] < alternateToken.matches.length) {
- var ntndx = maskToken.matches.indexOf(match) + 1;
- maskToken.matches.length > ntndx && (match = handleMatch(maskToken.matches[ntndx], [ ntndx ].concat(loopNdx.slice(1, loopNdx.length)), quantifierRecurse),
- match && (altIndexArr.push(ntndx.toString()), $.each(matches, function(ndx, lmnt) {
- lmnt.alternation = loopNdx.length - 1;
- })));
- }
- maltMatches = matches.slice(), testPos = currentPos, matches = [];
- for (var i = 0; i < ndxInitializerClone.length; i++) ndxInitializer[i] = ndxInitializerClone[i];
- for (var ndx1 = 0; ndx1 < maltMatches.length; ndx1++) {
- var altMatch = maltMatches[ndx1];
- altMatch.alternation = altMatch.alternation || loopNdxCnt;
- for (var ndx2 = 0; ndx2 < malternateMatches.length; ndx2++) {
- var altMatch2 = malternateMatches[ndx2];
- if (altMatch.match.mask === altMatch2.match.mask && ("string" != typeof altIndex || -1 !== $.inArray(altMatch.locator[altMatch.alternation].toString(), altIndexArr))) {
- maltMatches.splice(ndx1, 1), ndx1--, altMatch2.locator[altMatch.alternation] = altMatch2.locator[altMatch.alternation] + "," + altMatch.locator[altMatch.alternation],
- altMatch2.alternation = altMatch.alternation;
- break;
- }
- }
- }
- malternateMatches = malternateMatches.concat(maltMatches);
- }
- "string" == typeof altIndex && (malternateMatches = $.map(malternateMatches, function(lmnt, ndx) {
- if (isFinite(ndx)) {
- var mamatch, alternation = lmnt.alternation, altLocArr = lmnt.locator[alternation].toString().split(",");
- lmnt.locator[alternation] = void 0, lmnt.alternation = void 0;
- for (var alndx = 0; alndx < altLocArr.length; alndx++) mamatch = -1 !== $.inArray(altLocArr[alndx], altIndexArr),
- mamatch && (void 0 !== lmnt.locator[alternation] ? (lmnt.locator[alternation] += ",",
- lmnt.locator[alternation] += altLocArr[alndx]) : lmnt.locator[alternation] = parseInt(altLocArr[alndx]),
- lmnt.alternation = alternation);
- if (void 0 !== lmnt.locator[alternation]) return lmnt;
- }
- })), matches = currentMatches.concat(malternateMatches), testPos = pos, insertStop = matches.length > 0;
- } else match = alternateToken.matches[altIndex] ? handleMatch(alternateToken.matches[altIndex], [ altIndex ].concat(loopNdx), quantifierRecurse) : !1;
- if (match) return !0;
- } else if (match.isQuantifier && quantifierRecurse !== maskToken.matches[$.inArray(match, maskToken.matches) - 1]) for (var qt = match, qndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; qndx < (isNaN(qt.quantifier.max) ? qndx + 1 : qt.quantifier.max) && pos >= testPos; qndx++) {
- var tokenGroup = maskToken.matches[$.inArray(qt, maskToken.matches) - 1];
- if (match = handleMatch(tokenGroup, [ qndx ].concat(loopNdx), tokenGroup)) {
- if (latestMatch = matches[matches.length - 1].match, latestMatch.optionalQuantifier = qndx > qt.quantifier.min - 1,
- isFirstMatch = 0 === $.inArray(latestMatch, tokenGroup.matches)) {
- if (qndx > qt.quantifier.min - 1) {
- insertStop = !0, testPos = pos;
- break;
- }
- return !0;
- }
- return !0;
- }
- } else if (match = resolveTestFromToken(match, ndxInitializer, loopNdx, quantifierRecurse)) return !0;
- } else testPos++;
- }
- for (var tndx = ndxInitializer.length > 0 ? ndxInitializer.shift() : 0; tndx < maskToken.matches.length; tndx++) if (maskToken.matches[tndx].isQuantifier !== !0) {
- var match = handleMatch(maskToken.matches[tndx], [ tndx ].concat(loopNdx), quantifierRecurse);
- if (match && testPos === pos) return match;
- if (testPos > pos) break;
- }
- }
- var latestMatch, isFirstMatch, maskTokens = getMaskSet().maskToken, testPos = ndxIntlzr ? tstPs : 0, ndxInitializer = ndxIntlzr || [ 0 ], matches = [], insertStop = !1;
- if (cacheable === !0 && getMaskSet().tests[pos]) return getMaskSet().tests[pos];
- if (void 0 === ndxIntlzr) {
- for (var test, previousPos = pos - 1; void 0 === (test = getMaskSet().validPositions[previousPos]) && previousPos > -1 && (!getMaskSet().tests[previousPos] || void 0 === (test = getMaskSet().tests[previousPos][0])); ) previousPos--;
- void 0 !== test && previousPos > -1 && (testPos = previousPos, ndxInitializer = test.locator.slice());
- }
- for (var mtndx = ndxInitializer.shift(); mtndx < maskTokens.length; mtndx++) {
- var match = resolveTestFromToken(maskTokens[mtndx], ndxInitializer, [ mtndx ]);
- if (match && testPos === pos || testPos > pos) break;
- }
- return (0 === matches.length || insertStop) && matches.push({
- match: {
- fn: null,
- cardinality: 0,
- optionality: !0,
- casing: null,
- def: ""
- },
- locator: []
- }), getMaskSet().tests[pos] = $.extend(!0, [], matches), getMaskSet().tests[pos];
- }
- function getBufferTemplate() {
- return void 0 === getMaskSet()._buffer && (getMaskSet()._buffer = getMaskTemplate(!1, 1)),
- getMaskSet()._buffer;
- }
- function getBuffer() {
- return void 0 === getMaskSet().buffer && (getMaskSet().buffer = getMaskTemplate(!0, getLastValidPosition(), !0)),
- getMaskSet().buffer;
- }
- function refreshFromBuffer(start, end, buffer) {
- var i;
- if (buffer = buffer || getBuffer().slice(), start === !0) resetMaskSet(), start = 0,
- end = buffer.length; else for (i = start; end > i; i++) delete getMaskSet().validPositions[i],
- delete getMaskSet().tests[i];
- for (i = start; end > i; i++) resetMaskSet(!0), buffer[i] !== opts.skipOptionalPartCharacter && isValid(i, buffer[i], !0, !0);
- }
- function casing(elem, test) {
- switch (test.casing) {
- case "upper":
- elem = elem.toUpperCase();
- break;
-
- case "lower":
- elem = elem.toLowerCase();
- }
- return elem;
- }
- function checkAlternationMatch(altArr1, altArr2) {
- for (var altArrC = opts.greedy ? altArr2 : altArr2.slice(0, 1), isMatch = !1, alndx = 0; alndx < altArr1.length; alndx++) if (-1 !== $.inArray(altArr1[alndx], altArrC)) {
- isMatch = !0;
- break;
- }
- return isMatch;
- }
- function isValid(pos, c, strict, fromSetValid) {
- function _isValid(position, c, strict, fromSetValid) {
- var rslt = !1;
- return $.each(getTests(position), function(ndx, tst) {
- for (var test = tst.match, loopend = c ? 1 : 0, chrs = "", i = test.cardinality; i > loopend; i--) chrs += getBufferElement(position - (i - 1));
- if (c && (chrs += c), rslt = null != test.fn ? test.fn.test(chrs, getMaskSet(), position, strict, opts) : c !== test.def && c !== opts.skipOptionalPartCharacter || "" === test.def ? !1 : {
- c: test.def,
- pos: position
- }, rslt !== !1) {
- var elem = void 0 !== rslt.c ? rslt.c : c;
- elem = elem === opts.skipOptionalPartCharacter && null === test.fn ? test.def : elem;
- var validatedPos = position, possibleModifiedBuffer = getBuffer();
- if (void 0 !== rslt.remove && ($.isArray(rslt.remove) || (rslt.remove = [ rslt.remove ]),
- $.each(rslt.remove.sort(function(a, b) {
- return b - a;
- }), function(ndx, lmnt) {
- stripValidPositions(lmnt, lmnt + 1, !0);
- })), void 0 !== rslt.insert && ($.isArray(rslt.insert) || (rslt.insert = [ rslt.insert ]),
- $.each(rslt.insert.sort(function(a, b) {
- return a - b;
- }), function(ndx, lmnt) {
- isValid(lmnt.pos, lmnt.c, !0);
- })), rslt.refreshFromBuffer) {
- var refresh = rslt.refreshFromBuffer;
- if (strict = !0, refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, possibleModifiedBuffer),
- void 0 === rslt.pos && void 0 === rslt.c) return rslt.pos = getLastValidPosition(),
- !1;
- if (validatedPos = void 0 !== rslt.pos ? rslt.pos : position, validatedPos !== position) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
- !1;
- } else if (rslt !== !0 && void 0 !== rslt.pos && rslt.pos !== position && (validatedPos = rslt.pos,
- refreshFromBuffer(position, validatedPos), validatedPos !== position)) return rslt = $.extend(rslt, isValid(validatedPos, elem, !0)),
- !1;
- return rslt !== !0 && void 0 === rslt.pos && void 0 === rslt.c ? !1 : (ndx > 0 && resetMaskSet(!0),
- setValidPosition(validatedPos, $.extend({}, tst, {
- input: casing(elem, test)
- }), fromSetValid) || (rslt = !1), !1);
- }
- }), rslt;
- }
- function alternate(pos, c, strict, fromSetValid) {
- for (var lastAlt, alternation, isValidRslt, altPos, i, validPos, validPsClone = $.extend(!0, {}, getMaskSet().validPositions), lAlt = getLastValidPosition(); lAlt >= 0 && (altPos = getMaskSet().validPositions[lAlt],
- !altPos || void 0 === altPos.alternation || (lastAlt = lAlt, alternation = getMaskSet().validPositions[lastAlt].alternation,
- getTestTemplate(lastAlt).locator[altPos.alternation] === altPos.locator[altPos.alternation])); lAlt--) ;
- if (void 0 !== alternation) {
- lastAlt = parseInt(lastAlt);
- for (var decisionPos in getMaskSet().validPositions) if (decisionPos = parseInt(decisionPos),
- altPos = getMaskSet().validPositions[decisionPos], decisionPos >= lastAlt && void 0 !== altPos.alternation) {
- var altNdxs = getMaskSet().validPositions[lastAlt].locator[alternation].toString().split(","), decisionTaker = altPos.locator[alternation] || altNdxs[0];
- decisionTaker.length > 0 && (decisionTaker = decisionTaker.split(",")[0]);
- for (var mndx = 0; mndx < altNdxs.length; mndx++) if (decisionTaker < altNdxs[mndx]) {
- for (var possibilityPos, possibilities, dp = decisionPos; dp >= 0; dp--) if (possibilityPos = getMaskSet().validPositions[dp],
- void 0 !== possibilityPos) {
- possibilities = possibilityPos.locator[alternation], possibilityPos.locator[alternation] = parseInt(altNdxs[mndx]);
- break;
- }
- if (decisionTaker !== possibilityPos.locator[alternation]) {
- var validInputs = [], staticInputsBeforePos = 0;
- for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i],
- validPos && (null != validPos.match.fn ? validInputs.push(validPos.input) : pos > i && staticInputsBeforePos++),
- delete getMaskSet().validPositions[i], delete getMaskSet().tests[i];
- for (resetMaskSet(!0), opts.keepStatic = !opts.keepStatic, isValidRslt = !0; validInputs.length > 0; ) {
- var input = validInputs.shift();
- if (input !== opts.skipOptionalPartCharacter && !(isValidRslt = isValid(getLastValidPosition() + 1, input, !1, !0))) break;
- }
- if (possibilityPos.alternation = alternation, possibilityPos.locator[alternation] = possibilities,
- isValidRslt) {
- var targetLvp = getLastValidPosition(pos) + 1, staticInputsBeforePosAlternate = 0;
- for (i = decisionPos + 1; i < getLastValidPosition() + 1; i++) validPos = getMaskSet().validPositions[i],
- validPos && null == validPos.match.fn && pos > i && staticInputsBeforePosAlternate++;
- pos += staticInputsBeforePosAlternate - staticInputsBeforePos, isValidRslt = isValid(pos > targetLvp ? targetLvp : pos, c, strict, fromSetValid);
- }
- if (opts.keepStatic = !opts.keepStatic, isValidRslt) return isValidRslt;
- resetMaskSet(), getMaskSet().validPositions = $.extend(!0, {}, validPsClone);
- }
- }
- break;
- }
- }
- return !1;
- }
- function trackbackAlternations(originalPos, newPos) {
- for (var vp = getMaskSet().validPositions[newPos], targetLocator = vp.locator, tll = targetLocator.length, ps = originalPos; newPos > ps; ps++) if (!isMask(ps)) {
- var tests = getTests(ps), bestMatch = tests[0], equality = -1;
- $.each(tests, function(ndx, tst) {
- for (var i = 0; tll > i; i++) tst.locator[i] && checkAlternationMatch(tst.locator[i].toString().split(","), targetLocator[i].toString().split(",")) && i > equality && (equality = i,
- bestMatch = tst);
- }), setValidPosition(ps, $.extend({}, bestMatch, {
- input: bestMatch.match.def
- }), !0);
- }
- }
- strict = strict === !0;
- for (var buffer = getBuffer(), pndx = pos - 1; pndx > -1 && !getMaskSet().validPositions[pndx]; pndx--) ;
- for (pndx++; pos > pndx; pndx++) void 0 === getMaskSet().validPositions[pndx] && ((!isMask(pndx) || buffer[pndx] !== getPlaceholder(pndx)) && getTests(pndx).length > 1 || buffer[pndx] === opts.radixPoint || "0" === buffer[pndx] && $.inArray(opts.radixPoint, buffer) < pndx) && _isValid(pndx, buffer[pndx], !0);
- var maskPos = pos, result = !1, positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
- if (maskPos < getMaskLength() && (getBuffer(), result = _isValid(maskPos, c, strict, fromSetValid),
- (!strict || fromSetValid) && result === !1)) {
- var currentPosValid = getMaskSet().validPositions[maskPos];
- if (!currentPosValid || null !== currentPosValid.match.fn || currentPosValid.match.def !== c && c !== opts.skipOptionalPartCharacter) {
- if ((opts.insertMode || void 0 === getMaskSet().validPositions[seekNext(maskPos)]) && !isMask(maskPos)) for (var nPos = maskPos + 1, snPos = seekNext(maskPos); snPos >= nPos; nPos++) if (result = _isValid(nPos, c, strict, fromSetValid),
- result !== !1) {
- trackbackAlternations(maskPos, nPos), maskPos = nPos;
- break;
- }
- } else result = {
- caret: seekNext(maskPos)
- };
- }
- if (result === !1 && opts.keepStatic && isComplete(buffer) && (result = alternate(pos, c, strict, fromSetValid)),
- result === !0 && (result = {
- pos: maskPos
- }), $.isFunction(opts.postValidation) && result !== !1 && !strict) {
- resetMaskSet(!0);
- var postValidResult = opts.postValidation(getBuffer(), opts);
- if (postValidResult) {
- if (postValidResult.refreshFromBuffer) {
- var refresh = postValidResult.refreshFromBuffer;
- refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, postValidResult.buffer),
- resetMaskSet(!0), result = postValidResult;
- }
- } else resetMaskSet(!0), getMaskSet().validPositions = $.extend(!0, {}, positionsClone),
- result = !1;
- }
- return result;
- }
- function isMask(pos) {
- var test = getTest(pos);
- if (null != test.fn) return test.fn;
- if (pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
- for (var tests = getTests(pos), staticAlternations = !0, i = 0; i < tests.length; i++) if ("" !== tests[i].match.def && (void 0 === tests[i].alternation || tests[i].locator[tests[i].alternation].length > 1)) {
- staticAlternations = !1;
- break;
- }
- return staticAlternations;
- }
- return !1;
- }
- function getMaskLength() {
- var maskLength;
- maxLength = void 0 !== el ? el.maxLength : void 0, -1 === maxLength && (maxLength = void 0);
- var pos, lvp = getLastValidPosition(), testPos = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 !== testPos ? testPos.locator.slice() : void 0;
- for (pos = lvp + 1; void 0 === testPos || null !== testPos.match.fn || null === testPos.match.fn && "" !== testPos.match.def; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
- ndxIntlzr = testPos.locator.slice();
- var lastTest = getTest(pos - 1);
- return maskLength = "" !== lastTest.def ? pos : pos - 1, void 0 === maxLength || maxLength > maskLength ? maskLength : maxLength;
- }
- function seekNext(pos, newBlock) {
- var maskL = getMaskLength();
- if (pos >= maskL) return maskL;
- for (var position = pos; ++position < maskL && (newBlock === !0 && (getTest(position).newBlockMarker !== !0 || !isMask(position)) || newBlock !== !0 && !isMask(position) && (opts.nojumps !== !0 || opts.nojumpsThreshold > position)); ) ;
- return position;
- }
- function seekPrevious(pos, newBlock) {
- var position = pos;
- if (0 >= position) return 0;
- for (;--position > 0 && (newBlock === !0 && getTest(position).newBlockMarker !== !0 || newBlock !== !0 && !isMask(position)); ) ;
- return position;
- }
- function getBufferElement(position) {
- return void 0 === getMaskSet().validPositions[position] ? getPlaceholder(position) : getMaskSet().validPositions[position].input;
- }
- function writeBuffer(input, buffer, caretPos, event, triggerInputEvent) {
- if (event && $.isFunction(opts.onBeforeWrite)) {
- var result = opts.onBeforeWrite.call(input, event, buffer, caretPos, opts);
- if (result) {
- if (result.refreshFromBuffer) {
- var refresh = result.refreshFromBuffer;
- refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, result.buffer || buffer),
- resetMaskSet(!0), buffer = getBuffer();
- }
- void 0 !== caretPos && (caretPos = void 0 !== result.caret ? result.caret : caretPos);
- }
- }
- input.inputmask._valueSet(buffer.join("")), void 0 === caretPos || void 0 !== event && "blur" === event.type || caret(input, caretPos),
- triggerInputEvent === !0 && (skipInputEvent = !0, $(input).trigger("input"));
- }
- function getPlaceholder(pos, test) {
- if (test = test || getTest(pos), void 0 !== test.placeholder) return test.placeholder;
- if (null === test.fn) {
- if (pos > -1 && !opts.keepStatic && void 0 === getMaskSet().validPositions[pos]) {
- for (var prevTest, tests = getTests(pos), hasAlternations = !1, i = 0; i < tests.length; i++) {
- if (prevTest && "" !== tests[i].match.def && tests[i].match.def !== prevTest.match.def && (void 0 === tests[i].alternation || tests[i].alternation === prevTest.alternation)) {
- hasAlternations = !0;
- break;
- }
- tests[i].match.optionality !== !0 && tests[i].match.optionalQuantifier !== !0 && (prevTest = tests[i]);
- }
- if (hasAlternations) return opts.placeholder.charAt(pos % opts.placeholder.length);
- }
- return test.def;
- }
- return opts.placeholder.charAt(pos % opts.placeholder.length);
- }
- function checkVal(input, writeOut, strict, nptvl) {
- function isTemplateMatch() {
- var isMatch = !1, charCodeNdx = getBufferTemplate().slice(initialNdx, seekNext(initialNdx)).join("").indexOf(charCodes);
- if (-1 !== charCodeNdx && !isMask(initialNdx)) {
- isMatch = !0;
- for (var bufferTemplateArr = getBufferTemplate().slice(initialNdx, initialNdx + charCodeNdx), i = 0; i < bufferTemplateArr.length; i++) if (" " !== bufferTemplateArr[i]) {
- isMatch = !1;
- break;
- }
- }
- return isMatch;
- }
- var inputValue = nptvl.slice(), charCodes = "", initialNdx = 0;
- if (resetMaskSet(), getMaskSet().p = seekNext(-1), !strict) if (opts.autoUnmask !== !0) {
- var staticInput = getBufferTemplate().slice(0, seekNext(-1)).join(""), matches = inputValue.join("").match(new RegExp("^" + Inputmask.escapeRegex(staticInput), "g"));
- matches && matches.length > 0 && (inputValue.splice(0, matches.length * staticInput.length),
- initialNdx = seekNext(initialNdx));
- } else initialNdx = seekNext(initialNdx);
- $.each(inputValue, function(ndx, charCode) {
- var keypress = $.Event("keypress");
- keypress.which = charCode.charCodeAt(0), charCodes += charCode;
- var lvp = getLastValidPosition(void 0, !0), lvTest = getMaskSet().validPositions[lvp], nextTest = getTestTemplate(lvp + 1, lvTest ? lvTest.locator.slice() : void 0, lvp);
- if (!isTemplateMatch() || strict || opts.autoUnmask) {
- var pos = strict ? ndx : null == nextTest.match.fn && nextTest.match.optionality && lvp + 1 < getMaskSet().p ? lvp + 1 : getMaskSet().p;
- keypressEvent.call(input, keypress, !0, !1, strict, pos), initialNdx = pos + 1,
- charCodes = "";
- } else keypressEvent.call(input, keypress, !0, !1, !0, lvp + 1);
- }), writeOut && writeBuffer(input, getBuffer(), document.activeElement === input ? seekNext(getLastValidPosition(0)) : void 0, $.Event("checkval"));
- }
- function unmaskedvalue(input) {
- if (input && void 0 === input.inputmask) return input.value;
- var umValue = [], vps = getMaskSet().validPositions;
- for (var pndx in vps) vps[pndx].match && null != vps[pndx].match.fn && umValue.push(vps[pndx].input);
- var unmaskedValue = 0 === umValue.length ? null : (isRTL ? umValue.reverse() : umValue).join("");
- if (null !== unmaskedValue) {
- var bufferValue = (isRTL ? getBuffer().slice().reverse() : getBuffer()).join("");
- $.isFunction(opts.onUnMask) && (unmaskedValue = opts.onUnMask.call(input, bufferValue, unmaskedValue, opts) || unmaskedValue);
- }
- return unmaskedValue;
- }
- function caret(input, begin, end) {
- function translatePosition(pos) {
- if (isRTL && "number" == typeof pos && (!opts.greedy || "" !== opts.placeholder)) {
- var bffrLght = getBuffer().join("").length;
- pos = bffrLght - pos;
- }
- return pos;
- }
- var range;
- if ("number" != typeof begin) return input.setSelectionRange ? (begin = input.selectionStart,
- end = input.selectionEnd) : window.getSelection ? (range = window.getSelection().getRangeAt(0),
- (range.commonAncestorContainer.parentNode === input || range.commonAncestorContainer === input) && (begin = range.startOffset,
- end = range.endOffset)) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
- begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
- {
- begin: translatePosition(begin),
- end: translatePosition(end)
- };
- begin = translatePosition(begin), end = translatePosition(end), end = "number" == typeof end ? end : begin;
- var scrollCalc = (input.ownerDocument.defaultView || window).getComputedStyle(input, null).fontSize.replace("px", "") * end;
- if (input.scrollLeft = scrollCalc > input.scrollWidth ? scrollCalc : 0, androidchrome || opts.insertMode !== !1 || begin !== end || end++,
- input.setSelectionRange) input.selectionStart = begin, input.selectionEnd = end; else if (window.getSelection) {
- if (range = document.createRange(), void 0 === input.firstChild) {
- var textNode = document.createTextNode("");
- input.appendChild(textNode);
- }
- range.setStart(input.firstChild, begin < input.inputmask._valueGet().length ? begin : input.inputmask._valueGet().length),
- range.setEnd(input.firstChild, end < input.inputmask._valueGet().length ? end : input.inputmask._valueGet().length),
- range.collapse(!0);
- var sel = window.getSelection();
- sel.removeAllRanges(), sel.addRange(range);
- } else input.createTextRange && (range = input.createTextRange(), range.collapse(!0),
- range.moveEnd("character", end), range.moveStart("character", begin), range.select());
- }
- function determineLastRequiredPosition(returnDefinition) {
- var pos, testPos, buffer = getBuffer(), bl = buffer.length, lvp = getLastValidPosition(), positions = {}, lvTest = getMaskSet().validPositions[lvp], ndxIntlzr = void 0 !== lvTest ? lvTest.locator.slice() : void 0;
- for (pos = lvp + 1; pos < buffer.length; pos++) testPos = getTestTemplate(pos, ndxIntlzr, pos - 1),
- ndxIntlzr = testPos.locator.slice(), positions[pos] = $.extend(!0, {}, testPos);
- var lvTestAlt = lvTest && void 0 !== lvTest.alternation ? lvTest.locator[lvTest.alternation] : void 0;
- for (pos = bl - 1; pos > lvp && (testPos = positions[pos], (testPos.match.optionality || testPos.match.optionalQuantifier || lvTestAlt && (lvTestAlt !== positions[pos].locator[lvTest.alternation] && null != testPos.match.fn || null === testPos.match.fn && testPos.locator[lvTest.alternation] && checkAlternationMatch(testPos.locator[lvTest.alternation].toString().split(","), lvTestAlt.toString().split(",")) && "" !== getTests(pos)[0].def)) && buffer[pos] === getPlaceholder(pos, testPos.match)); pos--) bl--;
- return returnDefinition ? {
- l: bl,
- def: positions[bl] ? positions[bl].match : void 0
- } : bl;
- }
- function clearOptionalTail(buffer) {
- for (var rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
- return buffer.splice(rl, lmib + 1 - rl), buffer;
- }
- function isComplete(buffer) {
- if ($.isFunction(opts.isComplete)) return opts.isComplete.call(el, buffer, opts);
- if ("*" === opts.repeat) return void 0;
- var complete = !1, lrp = determineLastRequiredPosition(!0), aml = seekPrevious(lrp.l);
- if (void 0 === lrp.def || lrp.def.newBlockMarker || lrp.def.optionality || lrp.def.optionalQuantifier) {
- complete = !0;
- for (var i = 0; aml >= i; i++) {
- var test = getTestTemplate(i).match;
- if (null !== test.fn && void 0 === getMaskSet().validPositions[i] && test.optionality !== !0 && test.optionalQuantifier !== !0 || null === test.fn && buffer[i] !== getPlaceholder(i, test)) {
- complete = !1;
- break;
- }
- }
- }
- return complete;
- }
- function isSelection(begin, end) {
- return isRTL ? begin - end > 1 || begin - end === 1 && opts.insertMode : end - begin > 1 || end - begin === 1 && opts.insertMode;
- }
- function wrapEventRuler(eventHandler) {
- return function(e) {
- var inComposition = !1;
- if (void 0 === this.inputmask) {
- var imOpts = $.data(this, "_inputmask_opts");
- imOpts ? new Inputmask(imOpts).mask(this) : $(this).off(".inputmask");
- } else {
- if ("setvalue" === e.type || !(this.disabled || this.readOnly && !("keydown" === e.type && e.ctrlKey && 67 === e.keyCode || opts.tabThrough === !1 && e.keyCode === Inputmask.keyCode.TAB))) {
- switch (e.type) {
- case "input":
- if (skipInputEvent === !0 || inComposition === !0) return skipInputEvent = !1, e.preventDefault();
- break;
-
- case "keydown":
- skipKeyPressEvent = !1, inComposition = !1;
- break;
-
- case "keypress":
- if (skipKeyPressEvent === !0) return e.preventDefault();
- skipKeyPressEvent = !0;
- break;
-
- case "compositionstart":
- inComposition = !0;
- break;
-
- case "compositionupdate":
- skipInputEvent = !0;
- break;
-
- case "compositionend":
- inComposition = !1;
- }
- return eventHandler.apply(this, arguments);
- }
- e.preventDefault();
- }
- };
- }
- function patchValueProperty(npt) {
- function patchValhook(type) {
- if ($.valHooks && void 0 === $.valHooks[type] || $.valHooks[type].inputmaskpatch !== !0) {
- var valhookGet = $.valHooks[type] && $.valHooks[type].get ? $.valHooks[type].get : function(elem) {
- return elem.value;
- }, valhookSet = $.valHooks[type] && $.valHooks[type].set ? $.valHooks[type].set : function(elem, value) {
- return elem.value = value, elem;
- };
- $.valHooks[type] = {
- get: function(elem) {
- if (elem.inputmask) {
- if (elem.inputmask.opts.autoUnmask) return elem.inputmask.unmaskedvalue();
- var result = valhookGet(elem), maskset = elem.inputmask.maskset, bufferTemplate = maskset._buffer;
- return bufferTemplate = bufferTemplate ? bufferTemplate.join("") : "", result !== bufferTemplate ? result : "";
- }
- return valhookGet(elem);
- },
- set: function(elem, value) {
- var result, $elem = $(elem);
- return result = valhookSet(elem, value), elem.inputmask && $elem.trigger("setvalue.inputmask"),
- result;
- },
- inputmaskpatch: !0
- };
- }
- }
- function getter() {
- return this.inputmask ? this.inputmask.opts.autoUnmask ? this.inputmask.unmaskedvalue() : valueGet.call(this) !== getBufferTemplate().join("") ? document.activeElement === this && opts.clearMaskOnLostFocus ? (isRTL ? clearOptionalTail(getBuffer()).reverse() : clearOptionalTail(getBuffer())).join("") : valueGet.call(this) : "" : valueGet.call(this);
- }
- function setter(value) {
- valueSet.call(this, value), this.inputmask && $(this).trigger("setvalue.inputmask");
- }
- function installNativeValueSetFallback(npt) {
- $(npt).on("mouseenter.inputmask", wrapEventRuler(function(event) {
- var $input = $(this), input = this, value = input.inputmask._valueGet();
- "" !== value && value !== getBuffer().join("") && $input.trigger("setvalue.inputmask");
- }));
- }
- var valueGet, valueSet;
- npt.inputmask.__valueGet || (Object.getOwnPropertyDescriptor && void 0 === npt.value ? (valueGet = function() {
- return this.textContent;
- }, valueSet = function(value) {
- this.textContent = value;
- }, Object.defineProperty(npt, "value", {
- get: getter,
- set: setter
- })) : document.__lookupGetter__ && npt.__lookupGetter__("value") ? (valueGet = npt.__lookupGetter__("value"),
- valueSet = npt.__lookupSetter__("value"), npt.__defineGetter__("value", getter),
- npt.__defineSetter__("value", setter)) : (valueGet = function() {
- return npt.value;
- }, valueSet = function(value) {
- npt.value = value;
- }, patchValhook(npt.type), installNativeValueSetFallback(npt)), npt.inputmask.__valueGet = valueGet,
- npt.inputmask._valueGet = function(overruleRTL) {
- return isRTL && overruleRTL !== !0 ? valueGet.call(this.el).split("").reverse().join("") : valueGet.call(this.el);
- }, npt.inputmask.__valueSet = valueSet, npt.inputmask._valueSet = function(value, overruleRTL) {
- valueSet.call(this.el, overruleRTL !== !0 && isRTL && null !== value && void 0 !== value ? value.split("").reverse().join("") : value);
- });
- }
- function handleRemove(input, k, pos, strict) {
- function generalize() {
- if (opts.keepStatic) {
- resetMaskSet(!0);
- var lastAlt, validInputs = [], positionsClone = $.extend(!0, {}, getMaskSet().validPositions);
- for (lastAlt = getLastValidPosition(); lastAlt >= 0; lastAlt--) {
- var validPos = getMaskSet().validPositions[lastAlt];
- if (validPos && (null != validPos.match.fn && validInputs.push(validPos.input),
- delete getMaskSet().validPositions[lastAlt], void 0 !== validPos.alternation && validPos.locator[validPos.alternation] === getTestTemplate(lastAlt).locator[validPos.alternation])) break;
- }
- if (lastAlt > -1) for (;validInputs.length > 0; ) {
- getMaskSet().p = seekNext(getLastValidPosition());
- var keypress = $.Event("keypress");
- keypress.which = validInputs.pop().charCodeAt(0), keypressEvent.call(input, keypress, !0, !1, !1, getMaskSet().p);
- } else getMaskSet().validPositions = $.extend(!0, {}, positionsClone);
- }
- }
- if ((opts.numericInput || isRTL) && (k === Inputmask.keyCode.BACKSPACE ? k = Inputmask.keyCode.DELETE : k === Inputmask.keyCode.DELETE && (k = Inputmask.keyCode.BACKSPACE),
- isRTL)) {
- var pend = pos.end;
- pos.end = pos.begin, pos.begin = pend;
- }
- k === Inputmask.keyCode.BACKSPACE && (pos.end - pos.begin < 1 || opts.insertMode === !1) ? (pos.begin = seekPrevious(pos.begin),
- void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.begin--) : k === Inputmask.keyCode.DELETE && pos.begin === pos.end && (pos.end = isMask(pos.end) ? pos.end + 1 : seekNext(pos.end) + 1,
- void 0 === getMaskSet().validPositions[pos.begin] || getMaskSet().validPositions[pos.begin].input !== opts.groupSeparator && getMaskSet().validPositions[pos.begin].input !== opts.radixPoint || pos.end++),
- stripValidPositions(pos.begin, pos.end, !1, strict), strict !== !0 && generalize();
- var lvp = getLastValidPosition(pos.begin);
- lvp < pos.begin ? (-1 === lvp && resetMaskSet(), getMaskSet().p = seekNext(lvp)) : strict !== !0 && (getMaskSet().p = pos.begin);
- }
- function keydownEvent(e) {
- var input = this, $input = $(input), k = e.keyCode, pos = caret(input);
- k === Inputmask.keyCode.BACKSPACE || k === Inputmask.keyCode.DELETE || iphone && 127 === k || e.ctrlKey && 88 === k && !isInputEventSupported("cut") ? (e.preventDefault(),
- 88 === k && (undoValue = getBuffer().join("")), handleRemove(input, k, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")),
- input.inputmask._valueGet() === getBufferTemplate().join("") ? $input.trigger("cleared") : isComplete(getBuffer()) === !0 && $input.trigger("complete"),
- opts.showTooltip && $input.prop("title", getMaskSet().mask)) : k === Inputmask.keyCode.END || k === Inputmask.keyCode.PAGE_DOWN ? setTimeout(function() {
- var caretPos = seekNext(getLastValidPosition());
- opts.insertMode || caretPos !== getMaskLength() || e.shiftKey || caretPos--, caret(input, e.shiftKey ? pos.begin : caretPos, caretPos);
- }, 0) : k === Inputmask.keyCode.HOME && !e.shiftKey || k === Inputmask.keyCode.PAGE_UP ? caret(input, 0, e.shiftKey ? pos.begin : 0) : (opts.undoOnEscape && k === Inputmask.keyCode.ESCAPE || 90 === k && e.ctrlKey) && e.altKey !== !0 ? (checkVal(input, !0, !1, undoValue.split("")),
- $input.trigger("click")) : k !== Inputmask.keyCode.INSERT || e.shiftKey || e.ctrlKey ? opts.tabThrough === !0 && k === Inputmask.keyCode.TAB ? (e.shiftKey === !0 ? (null === getTest(pos.begin).fn && (pos.begin = seekNext(pos.begin)),
- pos.end = seekPrevious(pos.begin, !0), pos.begin = seekPrevious(pos.end, !0)) : (pos.begin = seekNext(pos.begin, !0),
- pos.end = seekNext(pos.begin, !0), pos.end < getMaskLength() && pos.end--), pos.begin < getMaskLength() && (e.preventDefault(),
- caret(input, pos.begin, pos.end))) : opts.insertMode !== !1 || e.shiftKey || (k === Inputmask.keyCode.RIGHT ? setTimeout(function() {
- var caretPos = caret(input);
- caret(input, caretPos.begin);
- }, 0) : k === Inputmask.keyCode.LEFT && setTimeout(function() {
- var caretPos = caret(input);
- caret(input, isRTL ? caretPos.begin + 1 : caretPos.begin - 1);
- }, 0)) : (opts.insertMode = !opts.insertMode, caret(input, opts.insertMode || pos.begin !== getMaskLength() ? pos.begin : pos.begin - 1)),
- opts.onKeyDown(e, getBuffer(), caret(input).begin, opts), ignorable = -1 !== $.inArray(k, opts.ignorables);
- }
- function keypressEvent(e, checkval, writeOut, strict, ndx) {
- var input = this, $input = $(input), k = e.which || e.charCode || e.keyCode;
- if (!(checkval === !0 || e.ctrlKey && e.altKey) && (e.ctrlKey || e.metaKey || ignorable)) return k === Inputmask.keyCode.ENTER && undoValue !== getBuffer().join("") && setTimeout(function() {
- $input.trigger("change"), undoValue = getBuffer().join("");
- }, 0), !0;
- if (k) {
- 46 === k && e.shiftKey === !1 && "," === opts.radixPoint && (k = 44);
- var forwardPosition, pos = checkval ? {
- begin: ndx,
- end: ndx
- } : caret(input), c = String.fromCharCode(k), isSlctn = isSelection(pos.begin, pos.end);
- isSlctn && (getMaskSet().undoPositions = $.extend(!0, {}, getMaskSet().validPositions),
- handleRemove(input, Inputmask.keyCode.DELETE, pos, !0), pos.begin = getMaskSet().p,
- opts.insertMode || (opts.insertMode = !opts.insertMode, setValidPosition(pos.begin, strict),
- opts.insertMode = !opts.insertMode), isSlctn = !opts.multi), getMaskSet().writeOutBuffer = !0;
- var p = isRTL && !isSlctn ? pos.end : pos.begin, valResult = isValid(p, c, strict);
- if (valResult !== !1) {
- if (valResult !== !0 && (p = void 0 !== valResult.pos ? valResult.pos : p, c = void 0 !== valResult.c ? valResult.c : c),
- resetMaskSet(!0), void 0 !== valResult.caret) forwardPosition = valResult.caret; else {
- var vps = getMaskSet().validPositions;
- forwardPosition = !opts.keepStatic && (void 0 !== vps[p + 1] && getTests(p + 1, vps[p].locator.slice(), p).length > 1 || void 0 !== vps[p].alternation) ? p + 1 : seekNext(p);
- }
- getMaskSet().p = forwardPosition;
- }
- if (writeOut !== !1) {
- var self = this;
- if (setTimeout(function() {
- opts.onKeyValidation.call(self, valResult, opts);
- }, 0), getMaskSet().writeOutBuffer && valResult !== !1) {
- var buffer = getBuffer();
- writeBuffer(input, buffer, checkval ? void 0 : opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition, e, checkval !== !0),
- checkval !== !0 && setTimeout(function() {
- isComplete(buffer) === !0 && $input.trigger("complete");
- }, 0);
- } else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
- } else isSlctn && (getMaskSet().buffer = void 0, getMaskSet().validPositions = getMaskSet().undoPositions);
- if (opts.showTooltip && $input.prop("title", getMaskSet().mask), checkval && $.isFunction(opts.onBeforeWrite)) {
- var result = opts.onBeforeWrite(e, getBuffer(), forwardPosition, opts);
- if (result && result.refreshFromBuffer) {
- var refresh = result.refreshFromBuffer;
- refreshFromBuffer(refresh === !0 ? refresh : refresh.start, refresh.end, result.buffer),
- resetMaskSet(!0), result.caret && (getMaskSet().p = result.caret);
- }
- }
- if (e.preventDefault(), checkval) return valResult;
- }
- }
- function pasteEvent(e) {
- var input = this, $input = $(input), inputValue = input.inputmask._valueGet(!0), caretPos = caret(input);
- if ("propertychange" === e.type && input.inputmask._valueGet().length <= getMaskLength()) return !0;
- if ("paste" === e.type) {
- var valueBeforeCaret = inputValue.substr(0, caretPos.begin), valueAfterCaret = inputValue.substr(caretPos.end, inputValue.length);
- valueBeforeCaret === getBufferTemplate().slice(0, caretPos.begin).join("") && (valueBeforeCaret = ""),
- valueAfterCaret === getBufferTemplate().slice(caretPos.end).join("") && (valueAfterCaret = ""),
- window.clipboardData && window.clipboardData.getData ? inputValue = valueBeforeCaret + window.clipboardData.getData("Text") + valueAfterCaret : e.originalEvent && e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData && (inputValue = valueBeforeCaret + e.originalEvent.clipboardData.getData("text/plain") + valueAfterCaret);
- }
- var pasteValue = inputValue;
- if ($.isFunction(opts.onBeforePaste)) {
- if (pasteValue = opts.onBeforePaste.call(input, inputValue, opts), pasteValue === !1) return e.preventDefault(),
- !1;
- pasteValue || (pasteValue = inputValue);
- }
- return checkVal(input, !1, !1, isRTL ? pasteValue.split("").reverse() : pasteValue.toString().split("")),
- writeBuffer(input, getBuffer(), void 0, e, !0), $input.trigger("click"), isComplete(getBuffer()) === !0 && $input.trigger("complete"),
- !1;
- }
- function inputFallBackEvent(e) {
- var input = this;
- checkVal(input, !0, !1, input.inputmask._valueGet().split("")), isComplete(getBuffer()) === !0 && $(input).trigger("complete"),
- e.preventDefault();
- }
- function compositionStartEvent(e) {
- var input = this;
- undoValue = getBuffer().join(""), ("" === compositionData || 0 !== e.originalEvent.data.indexOf(compositionData)) && (compositionCaretPos = caret(input));
- }
- function compositionUpdateEvent(e) {
- var input = this, caretPos = caret(input);
- 0 === e.originalEvent.data.indexOf(compositionData) && (resetMaskSet(), caretPos = compositionCaretPos);
- var newData = e.originalEvent.data;
- caret(input, caretPos.begin, caretPos.end);
- for (var i = 0; i < newData.length; i++) {
- var keypress = $.Event("keypress");
- keypress.which = newData.charCodeAt(i), skipKeyPressEvent = !1, ignorable = !1,
- keypressEvent.call(input, keypress);
- }
- setTimeout(function() {
- var forwardPosition = getMaskSet().p;
- writeBuffer(input, getBuffer(), opts.numericInput ? seekPrevious(forwardPosition) : forwardPosition);
- }, 0), compositionData = e.originalEvent.data;
- }
- function compositionEndEvent(e) {}
- function setValueEvent(e) {
- var input = this, value = input.inputmask._valueGet();
- checkVal(input, !0, !1, ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(input, value, opts) || value : value).split("")),
- undoValue = getBuffer().join(""), (opts.clearMaskOnLostFocus || opts.clearIncomplete) && input.inputmask._valueGet() === getBufferTemplate().join("") && input.inputmask._valueSet("");
- }
- function focusEvent(e) {
- var input = this, nptValue = input.inputmask._valueGet();
- opts.showMaskOnFocus && (!opts.showMaskOnHover || opts.showMaskOnHover && "" === nptValue) ? input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer(), seekNext(getLastValidPosition())) : mouseEnter === !1 && caret(input, seekNext(getLastValidPosition())),
- opts.positionCaretOnTab === !0 && setTimeout(function() {
- caret(input, seekNext(getLastValidPosition()));
- }, 0), undoValue = getBuffer().join("");
- }
- function mouseleaveEvent(e) {
- var input = this;
- if (mouseEnter = !1, opts.clearMaskOnLostFocus) {
- var buffer = getBuffer().slice(), nptValue = input.inputmask._valueGet();
- document.activeElement !== input && nptValue !== input.getAttribute("placeholder") && "" !== nptValue && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer),
- writeBuffer(input, buffer));
- }
- }
- function clickEvent(e) {
- function doRadixFocus(clickPos) {
- if (opts.radixFocus && "" !== opts.radixPoint) {
- var vps = getMaskSet().validPositions;
- if (void 0 === vps[clickPos] || vps[clickPos].input === getPlaceholder(clickPos)) {
- if (clickPos < seekNext(-1)) return !0;
- var radixPos = $.inArray(opts.radixPoint, getBuffer());
- if (-1 !== radixPos) {
- for (var vp in vps) if (vp > radixPos && vps[vp].input !== getPlaceholder(vp)) return !1;
- return !0;
- }
- }
- }
- return !1;
- }
- var input = this;
- if (document.activeElement === input) {
- var selectedCaret = caret(input);
- if (selectedCaret.begin === selectedCaret.end) if (doRadixFocus(selectedCaret.begin)) caret(input, $.inArray(opts.radixPoint, getBuffer())); else {
- var clickPosition = selectedCaret.begin, lvclickPosition = getLastValidPosition(clickPosition), lastPosition = seekNext(lvclickPosition);
- lastPosition > clickPosition ? caret(input, isMask(clickPosition) || isMask(clickPosition - 1) ? clickPosition : seekNext(clickPosition)) : caret(input, opts.numericInput ? 0 : lastPosition);
- }
- }
- }
- function dblclickEvent(e) {
- var input = this;
- setTimeout(function() {
- caret(input, 0, seekNext(getLastValidPosition()));
- }, 0);
- }
- function cutEvent(e) {
- skipInputEvent = !0;
- var input = this, $input = $(input), pos = caret(input);
- if (isRTL) {
- var clipboardData = window.clipboardData || e.originalEvent.clipboardData, clipData = clipboardData.getData("text").split("").reverse().join("");
- clipboardData.setData("text", clipData);
- }
- handleRemove(input, Inputmask.keyCode.DELETE, pos), writeBuffer(input, getBuffer(), getMaskSet().p, e, undoValue !== getBuffer().join("")),
- input.inputmask._valueGet() === getBufferTemplate().join("") && $input.trigger("cleared"),
- opts.showTooltip && (input.title = getMaskSet().mask);
- }
- function blurEvent(e) {
- var $input = $(this), input = this;
- if (input.inputmask) {
- var nptValue = input.inputmask._valueGet(), buffer = getBuffer().slice();
- undoValue !== buffer.join("") && setTimeout(function() {
- $input.trigger("change"), undoValue = buffer.join("");
- }, 0), "" !== nptValue && (opts.clearMaskOnLostFocus && (-1 === getLastValidPosition() && nptValue === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)),
- isComplete(buffer) === !1 && (setTimeout(function() {
- $input.trigger("incomplete");
- }, 0), opts.clearIncomplete && (resetMaskSet(), buffer = opts.clearMaskOnLostFocus ? [] : getBufferTemplate().slice())),
- writeBuffer(input, buffer, void 0, e));
- }
- }
- function mouseenterEvent(e) {
- var input = this;
- mouseEnter = !0, document.activeElement !== input && opts.showMaskOnHover && input.inputmask._valueGet() !== getBuffer().join("") && writeBuffer(input, getBuffer());
- }
- function mask(elem) {
- el = elem, $el = $(el), opts.showTooltip && (el.title = getMaskSet().mask), ("rtl" === el.dir || opts.rightAlign) && (el.style.textAlign = "right"),
- ("rtl" === el.dir || opts.numericInput) && (el.dir = "ltr", el.removeAttribute("dir"),
- el.inputmask.isRTL = !0, isRTL = !0), $el.off(".inputmask"), patchValueProperty(el),
- ("INPUT" === el.tagName && isInputTypeSupported(el.getAttribute("type")) || el.isContentEditable) && ($(el.form).on("submit", function() {
- undoValue !== getBuffer().join("") && $el.trigger("change"), opts.clearMaskOnLostFocus && -1 === getLastValidPosition() && el.inputmask._valueGet && el.inputmask._valueGet() === getBufferTemplate().join("") && el.inputmask._valueSet(""),
- opts.removeMaskOnSubmit && (el.inputmask._valueSet(el.inputmask.unmaskedvalue(), !0),
- setTimeout(function() {
- writeBuffer(el, getBuffer());
- }, 0));
- }).on("reset", function() {
- setTimeout(function() {
- $el.trigger("setvalue.inputmask");
- }, 0);
- }), $el.on("mouseenter.inputmask", wrapEventRuler(mouseenterEvent)).on("blur.inputmask", wrapEventRuler(blurEvent)).on("focus.inputmask", wrapEventRuler(focusEvent)).on("mouseleave.inputmask", wrapEventRuler(mouseleaveEvent)).on("click.inputmask", wrapEventRuler(clickEvent)).on("dblclick.inputmask", wrapEventRuler(dblclickEvent)).on(PasteEventType + ".inputmask dragdrop.inputmask drop.inputmask", wrapEventRuler(pasteEvent)).on("cut.inputmask", wrapEventRuler(cutEvent)).on("complete.inputmask", wrapEventRuler(opts.oncomplete)).on("incomplete.inputmask", wrapEventRuler(opts.onincomplete)).on("cleared.inputmask", wrapEventRuler(opts.oncleared)).on("keydown.inputmask", wrapEventRuler(keydownEvent)).on("keypress.inputmask", wrapEventRuler(keypressEvent)),
- androidfirefox || $el.on("compositionstart.inputmask", wrapEventRuler(compositionStartEvent)).on("compositionupdate.inputmask", wrapEventRuler(compositionUpdateEvent)).on("compositionend.inputmask", wrapEventRuler(compositionEndEvent)),
- "paste" === PasteEventType && $el.on("input.inputmask", wrapEventRuler(inputFallBackEvent))),
- $el.on("setvalue.inputmask", wrapEventRuler(setValueEvent));
- var initialValue = $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask.call(el, el.inputmask._valueGet(), opts) || el.inputmask._valueGet() : el.inputmask._valueGet();
- checkVal(el, !0, !1, initialValue.split(""));
- var buffer = getBuffer().slice();
- undoValue = buffer.join("");
- var activeElement;
- try {
- activeElement = document.activeElement;
- } catch (e) {}
- isComplete(buffer) === !1 && opts.clearIncomplete && resetMaskSet(), opts.clearMaskOnLostFocus && (buffer.join("") === getBufferTemplate().join("") ? buffer = [] : clearOptionalTail(buffer)),
- writeBuffer(el, buffer), activeElement === el && caret(el, seekNext(getLastValidPosition()));
- }
- var undoValue, compositionCaretPos, compositionData, el, $el, maxLength, valueBuffer, isRTL = !1, skipKeyPressEvent = !1, skipInputEvent = !1, ignorable = !1, mouseEnter = !0;
- if (void 0 !== actionObj) switch (actionObj.action) {
- case "isComplete":
- return el = actionObj.el, isComplete(getBuffer());
-
- case "unmaskedvalue":
- return el = actionObj.el, void 0 !== el && void 0 !== el.inputmask ? (maskset = el.inputmask.maskset,
- opts = el.inputmask.opts, isRTL = el.inputmask.isRTL, valueBuffer = isRTL ? el.inputmask._valueGet().split("").reverse().join("") : el.inputmask._valueGet()) : valueBuffer = actionObj.value,
- opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(valueBuffer, opts) || valueBuffer : valueBuffer).split(""),
- checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite(void 0, getBuffer(), 0, opts),
- unmaskedvalue(el);
-
- case "mask":
- el = actionObj.el, maskset = el.inputmask.maskset, opts = el.inputmask.opts, isRTL = el.inputmask.isRTL,
- undoValue = getBuffer().join(""), mask(el);
- break;
-
- case "format":
- return opts.numericInput && (isRTL = !0), valueBuffer = ($.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(actionObj.value, opts) || actionObj.value : actionObj.value).split(""),
- checkVal(void 0, !1, !1, isRTL ? valueBuffer.reverse() : valueBuffer), $.isFunction(opts.onBeforeWrite) && opts.onBeforeWrite(void 0, getBuffer(), 0, opts),
- actionObj.metadata ? {
- value: isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join(""),
- metadata: maskScope({
- action: "getmetadata"
- }, maskset, opts)
- } : isRTL ? getBuffer().slice().reverse().join("") : getBuffer().join("");
-
- case "isValid":
- opts.numericInput && (isRTL = !0), valueBuffer = actionObj.value.split(""), checkVal(void 0, !1, !0, isRTL ? valueBuffer.reverse() : valueBuffer);
- for (var buffer = getBuffer(), rl = determineLastRequiredPosition(), lmib = buffer.length - 1; lmib > rl && !isMask(lmib); lmib--) ;
- return buffer.splice(rl, lmib + 1 - rl), isComplete(buffer) && actionObj.value === buffer.join("");
-
- case "getemptymask":
- return getBufferTemplate();
-
- case "remove":
- el = actionObj.el, $el = $(el), maskset = el.inputmask.maskset, opts = el.inputmask.opts,
- el.inputmask._valueSet(unmaskedvalue(el)), $el.off(".inputmask");
- var valueProperty;
- Object.getOwnPropertyDescriptor && (valueProperty = Object.getOwnPropertyDescriptor(el, "value")),
- valueProperty && valueProperty.get ? el.inputmask.__valueGet && Object.defineProperty(el, "value", {
- get: el.inputmask.__valueGet,
- set: el.inputmask.__valueSet
- }) : document.__lookupGetter__ && el.__lookupGetter__("value") && el.inputmask.__valueGet && (el.__defineGetter__("value", el.inputmask.__valueGet),
- el.__defineSetter__("value", el.inputmask.__valueSet)), el.inputmask = void 0;
- break;
-
- case "getmetadata":
- if ($.isArray(maskset.metadata)) {
- for (var alternation, lvp = getLastValidPosition(), firstAlt = lvp; firstAlt >= 0; firstAlt--) if (getMaskSet().validPositions[firstAlt] && void 0 !== getMaskSet().validPositions[firstAlt].alternation) {
- alternation = getMaskSet().validPositions[firstAlt].alternation;
- break;
- }
- return void 0 !== alternation ? maskset.metadata[getMaskSet().validPositions[lvp].locator[alternation]] : maskset.metadata[0];
- }
- return maskset.metadata;
- }
- }
- Inputmask.prototype = {
- defaults: {
- placeholder: "_",
- optionalmarker: {
- start: "[",
- end: "]"
- },
- quantifiermarker: {
- start: "{",
- end: "}"
- },
- groupmarker: {
- start: "(",
- end: ")"
- },
- alternatormarker: "|",
- escapeChar: "\\",
- mask: null,
- oncomplete: $.noop,
- onincomplete: $.noop,
- oncleared: $.noop,
- repeat: 0,
- greedy: !0,
- autoUnmask: !1,
- removeMaskOnSubmit: !1,
- clearMaskOnLostFocus: !0,
- insertMode: !0,
- clearIncomplete: !1,
- aliases: {},
- alias: null,
- onKeyDown: $.noop,
- onBeforeMask: null,
- onBeforePaste: function(pastedValue, opts) {
- return $.isFunction(opts.onBeforeMask) ? opts.onBeforeMask(pastedValue, opts) : pastedValue;
- },
- onBeforeWrite: null,
- onUnMask: null,
- showMaskOnFocus: !0,
- showMaskOnHover: !0,
- onKeyValidation: $.noop,
- skipOptionalPartCharacter: " ",
- showTooltip: !1,
- numericInput: !1,
- rightAlign: !1,
- undoOnEscape: !0,
- radixPoint: "",
- groupSeparator: "",
- radixFocus: !1,
- nojumps: !1,
- nojumpsThreshold: 0,
- keepStatic: null,
- positionCaretOnTab: !1,
- tabThrough: !1,
- supportsInputType: [],
- definitions: {
- "9": {
- validator: "[0-9]",
- cardinality: 1,
- definitionSymbol: "*"
- },
- a: {
- validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
- cardinality: 1,
- definitionSymbol: "*"
- },
- "*": {
- validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
- cardinality: 1
- }
- },
- ignorables: [ 8, 9, 13, 19, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 46, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123 ],
- isComplete: null,
- canClearPosition: $.noop,
- postValidation: null
- },
- masksCache: {},
- mask: function(el) {
- var scopedOpts = $.extend(!0, {}, this.opts);
- importAttributeOptions(el, scopedOpts, $.extend(!0, {}, this.userOptions));
- var maskset = generateMaskSet(scopedOpts, this.noMasksCache);
- return void 0 !== maskset && (void 0 !== el.inputmask && el.inputmask.remove(),
- el.inputmask = new Inputmask(), el.inputmask.opts = scopedOpts, el.inputmask.noMasksCache = this.noMasksCache,
- el.inputmask.userOptions = $.extend(!0, {}, this.userOptions), el.inputmask.el = el,
- el.inputmask.maskset = maskset, el.inputmask.isRTL = !1, $.data(el, "_inputmask_opts", scopedOpts),
- maskScope({
- action: "mask",
- el: el
- })), el.inputmask || this;
- },
- option: function(options) {
- return "string" == typeof options ? this.opts[options] : "object" == typeof options ? ($.extend(this.opts, options),
- $.extend(this.userOptions, options), this.el && (void 0 !== options.mask || void 0 !== options.alias ? this.mask(this.el) : ($.data(this.el, "_inputmask_opts", this.opts),
- maskScope({
- action: "mask",
- el: this.el
- }))), this) : void 0;
- },
- unmaskedvalue: function(value) {
- return maskScope({
- action: "unmaskedvalue",
- el: this.el,
- value: value
- }, this.el && this.el.inputmask ? this.el.inputmask.maskset : generateMaskSet(this.opts, this.noMasksCache), this.opts);
- },
- remove: function() {
- return this.el ? (maskScope({
- action: "remove",
- el: this.el
- }), this.el.inputmask = void 0, this.el) : void 0;
- },
- getemptymask: function() {
- return maskScope({
- action: "getemptymask"
- }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
- },
- hasMaskedValue: function() {
- return !this.opts.autoUnmask;
- },
- isComplete: function() {
- return maskScope({
- action: "isComplete",
- el: this.el
- }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
- },
- getmetadata: function() {
- return maskScope({
- action: "getmetadata"
- }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
- },
- isValid: function(value) {
- return maskScope({
- action: "isValid",
- value: value
- }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
- },
- format: function(value, metadata) {
- return maskScope({
- action: "format",
- value: value,
- metadata: metadata
- }, this.maskset || generateMaskSet(this.opts, this.noMasksCache), this.opts);
- }
- }, Inputmask.extendDefaults = function(options) {
- $.extend(Inputmask.prototype.defaults, options);
- }, Inputmask.extendDefinitions = function(definition) {
- $.extend(Inputmask.prototype.defaults.definitions, definition);
- }, Inputmask.extendAliases = function(alias) {
- $.extend(Inputmask.prototype.defaults.aliases, alias);
- }, Inputmask.format = function(value, options, metadata) {
- return Inputmask(options).format(value, metadata);
- }, Inputmask.unmask = function(value, options) {
- return Inputmask(options).unmaskedvalue(value);
- }, Inputmask.isValid = function(value, options) {
- return Inputmask(options).isValid(value);
- }, Inputmask.escapeRegex = function(str) {
- var specials = [ "/", ".", "*", "+", "?", "|", "(", ")", "[", "]", "{", "}", "\\", "$", "^" ];
- return str.replace(new RegExp("(\\" + specials.join("|\\") + ")", "gim"), "\\$1");
- }, Inputmask.keyCode = {
- ALT: 18,
- BACKSPACE: 8,
- CAPS_LOCK: 20,
- COMMA: 188,
- COMMAND: 91,
- COMMAND_LEFT: 91,
- COMMAND_RIGHT: 93,
- CONTROL: 17,
- DELETE: 46,
- DOWN: 40,
- END: 35,
- ENTER: 13,
- ESCAPE: 27,
- HOME: 36,
- INSERT: 45,
- LEFT: 37,
- MENU: 93,
- NUMPAD_ADD: 107,
- NUMPAD_DECIMAL: 110,
- NUMPAD_DIVIDE: 111,
- NUMPAD_ENTER: 108,
- NUMPAD_MULTIPLY: 106,
- NUMPAD_SUBTRACT: 109,
- PAGE_DOWN: 34,
- PAGE_UP: 33,
- PERIOD: 190,
- RIGHT: 39,
- SHIFT: 16,
- SPACE: 32,
- TAB: 9,
- UP: 38,
- WINDOWS: 91
- };
- var ua = navigator.userAgent, iphone = null !== ua.match(new RegExp("iphone", "i")), androidchrome = null !== ua.match(new RegExp("android.*chrome.*", "i")), androidfirefox = null !== ua.match(new RegExp("android.*firefox.*", "i")), PasteEventType = isInputEventSupported("paste") ? "paste" : isInputEventSupported("input") ? "input" : "propertychange";
- return window.Inputmask = Inputmask, Inputmask;
-}(jQuery), function($, Inputmask) {
- return void 0 === $.fn.inputmask && ($.fn.inputmask = function(fn, options) {
- var nptmask, input;
- if (options = options || {}, "string" == typeof fn) switch (fn) {
- case "mask":
- return nptmask = new Inputmask(options), this.each(function() {
- nptmask.mask(this);
- });
-
- case "unmaskedvalue":
- return input = this.jquery && this.length > 0 ? this[0] : this, input.inputmask ? input.inputmask.unmaskedvalue() : $(input).val();
-
- case "remove":
- return this.each(function() {
- this.inputmask && this.inputmask.remove();
- });
-
- case "getemptymask":
- return input = this.jquery && this.length > 0 ? this[0] : this, input.inputmask ? input.inputmask.getemptymask() : "";
-
- case "hasMaskedValue":
- return input = this.jquery && this.length > 0 ? this[0] : this, input.inputmask ? input.inputmask.hasMaskedValue() : !1;
-
- case "isComplete":
- return input = this.jquery && this.length > 0 ? this[0] : this, input.inputmask ? input.inputmask.isComplete() : !0;
-
- case "getmetadata":
- return input = this.jquery && this.length > 0 ? this[0] : this, input.inputmask ? input.inputmask.getmetadata() : void 0;
-
- case "setvalue":
- input = this.jquery && this.length > 0 ? this[0] : this, $(input).val(options),
- void 0 !== input.inputmask && $(input).triggerHandler("setvalue.inputmask");
- break;
-
- case "option":
- if ("string" != typeof options) return this.each(function() {
- return void 0 !== this.inputmask ? this.inputmask.option(options) : void 0;
- });
- if (input = this.jquery && this.length > 0 ? this[0] : this, void 0 !== input.inputmask) return input.inputmask.option(options);
- break;
-
- default:
- return options.alias = fn, nptmask = new Inputmask(options), this.each(function() {
- nptmask.mask(this);
- });
- } else {
- if ("object" == typeof fn) return nptmask = new Inputmask(fn), void 0 === fn.mask && void 0 === fn.alias ? this.each(function() {
- return void 0 !== this.inputmask ? this.inputmask.option(fn) : void nptmask.mask(this);
- }) : this.each(function() {
- nptmask.mask(this);
- });
- if (void 0 === fn) return this.each(function() {
- nptmask = new Inputmask(options), nptmask.mask(this);
- });
- }
- }), $.fn.inputmask;
-}(jQuery, Inputmask), function($, Inputmask) {
- return Inputmask.extendDefinitions({
- h: {
- validator: "[01][0-9]|2[0-3]",
- cardinality: 2,
- prevalidator: [ {
- validator: "[0-2]",
- cardinality: 1
- } ]
- },
- s: {
- validator: "[0-5][0-9]",
- cardinality: 2,
- prevalidator: [ {
- validator: "[0-5]",
- cardinality: 1
- } ]
- },
- d: {
- validator: "0[1-9]|[12][0-9]|3[01]",
- cardinality: 2,
- prevalidator: [ {
- validator: "[0-3]",
- cardinality: 1
- } ]
- },
- m: {
- validator: "0[1-9]|1[012]",
- cardinality: 2,
- prevalidator: [ {
- validator: "[01]",
- cardinality: 1
- } ]
- },
- y: {
- validator: "(19|20)\\d{2}",
- cardinality: 4,
- prevalidator: [ {
- validator: "[12]",
- cardinality: 1
- }, {
- validator: "(19|20)",
- cardinality: 2
- }, {
- validator: "(19|20)\\d",
- cardinality: 3
- } ]
- }
- }), Inputmask.extendAliases({
- "dd/mm/yyyy": {
- mask: "1/2/y",
- placeholder: "dd/mm/yyyy",
- regex: {
- val1pre: new RegExp("[0-3]"),
- val1: new RegExp("0[1-9]|[12][0-9]|3[01]"),
- val2pre: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[1-9]|[12][0-9]|3[01])" + escapedSeparator + "[01])");
- },
- val2: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[1-9]|[12][0-9])" + escapedSeparator + "(0[1-9]|1[012]))|(30" + escapedSeparator + "(0[13-9]|1[012]))|(31" + escapedSeparator + "(0[13578]|1[02]))");
- }
- },
- leapday: "29/02/",
- separator: "/",
- yearrange: {
- minyear: 1900,
- maxyear: 2099
- },
- isInYearRange: function(chrs, minyear, maxyear) {
- if (isNaN(chrs)) return !1;
- var enteredyear = parseInt(chrs.concat(minyear.toString().slice(chrs.length))), enteredyear2 = parseInt(chrs.concat(maxyear.toString().slice(chrs.length)));
- return (isNaN(enteredyear) ? !1 : enteredyear >= minyear && maxyear >= enteredyear) || (isNaN(enteredyear2) ? !1 : enteredyear2 >= minyear && maxyear >= enteredyear2);
- },
- determinebaseyear: function(minyear, maxyear, hint) {
- var currentyear = new Date().getFullYear();
- if (minyear > currentyear) return minyear;
- if (currentyear > maxyear) {
- for (var maxYearPrefix = maxyear.toString().slice(0, 2), maxYearPostfix = maxyear.toString().slice(2, 4); maxYearPrefix + hint > maxyear; ) maxYearPrefix--;
- var maxxYear = maxYearPrefix + maxYearPostfix;
- return minyear > maxxYear ? minyear : maxxYear;
- }
- return currentyear;
- },
- onKeyDown: function(e, buffer, caretPos, opts) {
- var $input = $(this);
- if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
- var today = new Date();
- $input.val(today.getDate().toString() + (today.getMonth() + 1).toString() + today.getFullYear().toString()),
- $input.trigger("setvalue.inputmask");
- }
- },
- getFrontValue: function(mask, buffer, opts) {
- for (var start = 0, length = 0, i = 0; i < mask.length && "2" !== mask.charAt(i); i++) {
- var definition = opts.definitions[mask.charAt(i)];
- definition ? (start += length, length = definition.cardinality) : length++;
- }
- return buffer.join("").substr(start, length);
- },
- definitions: {
- "1": {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.regex.val1.test(chrs);
- return strict || isValid || chrs.charAt(1) !== opts.separator && -1 === "-./".indexOf(chrs.charAt(1)) || !(isValid = opts.regex.val1.test("0" + chrs.charAt(0))) ? isValid : (maskset.buffer[pos - 1] = "0",
- {
- refreshFromBuffer: {
- start: pos - 1,
- end: pos
- },
- pos: pos,
- c: chrs.charAt(0)
- });
- },
- cardinality: 2,
- prevalidator: [ {
- validator: function(chrs, maskset, pos, strict, opts) {
- var pchrs = chrs;
- isNaN(maskset.buffer[pos + 1]) || (pchrs += maskset.buffer[pos + 1]);
- var isValid = 1 === pchrs.length ? opts.regex.val1pre.test(pchrs) : opts.regex.val1.test(pchrs);
- if (!strict && !isValid) {
- if (isValid = opts.regex.val1.test(chrs + "0")) return maskset.buffer[pos] = chrs,
- maskset.buffer[++pos] = "0", {
- pos: pos,
- c: "0"
- };
- if (isValid = opts.regex.val1.test("0" + chrs)) return maskset.buffer[pos] = "0",
- pos++, {
- pos: pos
- };
- }
- return isValid;
- },
- cardinality: 1
- } ]
- },
- "2": {
- validator: function(chrs, maskset, pos, strict, opts) {
- var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
- -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
- var isValid = opts.regex.val2(opts.separator).test(frontValue + chrs);
- if (!strict && !isValid && (chrs.charAt(1) === opts.separator || -1 !== "-./".indexOf(chrs.charAt(1))) && (isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
- {
- refreshFromBuffer: {
- start: pos - 1,
- end: pos
- },
- pos: pos,
- c: chrs.charAt(0)
- };
- if (opts.mask.indexOf("2") === opts.mask.length - 1 && isValid) {
- var dayMonthValue = maskset.buffer.join("").substr(4, 4) + chrs;
- if (dayMonthValue !== opts.leapday) return !0;
- var year = parseInt(maskset.buffer.join("").substr(0, 4), 10);
- return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
- }
- return isValid;
- },
- cardinality: 2,
- prevalidator: [ {
- validator: function(chrs, maskset, pos, strict, opts) {
- isNaN(maskset.buffer[pos + 1]) || (chrs += maskset.buffer[pos + 1]);
- var frontValue = opts.getFrontValue(maskset.mask, maskset.buffer, opts);
- -1 !== frontValue.indexOf(opts.placeholder[0]) && (frontValue = "01" + opts.separator);
- var isValid = 1 === chrs.length ? opts.regex.val2pre(opts.separator).test(frontValue + chrs) : opts.regex.val2(opts.separator).test(frontValue + chrs);
- return strict || isValid || !(isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
- pos++, {
- pos: pos
- });
- },
- cardinality: 1
- } ]
- },
- y: {
- validator: function(chrs, maskset, pos, strict, opts) {
- if (opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
- var dayMonthValue = maskset.buffer.join("").substr(0, 6);
- if (dayMonthValue !== opts.leapday) return !0;
- var year = parseInt(chrs, 10);
- return year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
- }
- return !1;
- },
- cardinality: 4,
- prevalidator: [ {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
- if (!strict && !isValid) {
- var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 1);
- if (isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
- {
- pos: pos
- };
- if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs + "0").toString().slice(0, 2),
- isValid = opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(0),
- maskset.buffer[pos++] = yearPrefix.charAt(1), {
- pos: pos
- };
- }
- return isValid;
- },
- cardinality: 1
- }, {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
- if (!strict && !isValid) {
- var yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2);
- if (isValid = opts.isInYearRange(chrs[0] + yearPrefix[1] + chrs[1], opts.yearrange.minyear, opts.yearrange.maxyear)) return maskset.buffer[pos++] = yearPrefix.charAt(1),
- {
- pos: pos
- };
- if (yearPrefix = opts.determinebaseyear(opts.yearrange.minyear, opts.yearrange.maxyear, chrs).toString().slice(0, 2),
- opts.isInYearRange(yearPrefix + chrs, opts.yearrange.minyear, opts.yearrange.maxyear)) {
- var dayMonthValue = maskset.buffer.join("").substr(0, 6);
- if (dayMonthValue !== opts.leapday) isValid = !0; else {
- var year = parseInt(chrs, 10);
- isValid = year % 4 === 0 ? year % 100 === 0 ? year % 400 === 0 ? !0 : !1 : !0 : !1;
- }
- } else isValid = !1;
- if (isValid) return maskset.buffer[pos - 1] = yearPrefix.charAt(0), maskset.buffer[pos++] = yearPrefix.charAt(1),
- maskset.buffer[pos++] = chrs.charAt(0), {
- refreshFromBuffer: {
- start: pos - 3,
- end: pos
- },
- pos: pos
- };
- }
- return isValid;
- },
- cardinality: 2
- }, {
- validator: function(chrs, maskset, pos, strict, opts) {
- return opts.isInYearRange(chrs, opts.yearrange.minyear, opts.yearrange.maxyear);
- },
- cardinality: 3
- } ]
- }
- },
- insertMode: !1,
- autoUnmask: !1
- },
- "mm/dd/yyyy": {
- placeholder: "mm/dd/yyyy",
- alias: "dd/mm/yyyy",
- regex: {
- val2pre: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
- },
- val2: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
- },
- val1pre: new RegExp("[01]"),
- val1: new RegExp("0[1-9]|1[012]")
- },
- leapday: "02/29/",
- onKeyDown: function(e, buffer, caretPos, opts) {
- var $input = $(this);
- if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
- var today = new Date();
- $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()),
- $input.trigger("setvalue.inputmask");
- }
- }
- },
- "yyyy/mm/dd": {
- mask: "y/1/2",
- placeholder: "yyyy/mm/dd",
- alias: "mm/dd/yyyy",
- leapday: "/02/29",
- onKeyDown: function(e, buffer, caretPos, opts) {
- var $input = $(this);
- if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
- var today = new Date();
- $input.val(today.getFullYear().toString() + (today.getMonth() + 1).toString() + today.getDate().toString()),
- $input.trigger("setvalue.inputmask");
- }
- }
- },
- "dd.mm.yyyy": {
- mask: "1.2.y",
- placeholder: "dd.mm.yyyy",
- leapday: "29.02.",
- separator: ".",
- alias: "dd/mm/yyyy"
- },
- "dd-mm-yyyy": {
- mask: "1-2-y",
- placeholder: "dd-mm-yyyy",
- leapday: "29-02-",
- separator: "-",
- alias: "dd/mm/yyyy"
- },
- "mm.dd.yyyy": {
- mask: "1.2.y",
- placeholder: "mm.dd.yyyy",
- leapday: "02.29.",
- separator: ".",
- alias: "mm/dd/yyyy"
- },
- "mm-dd-yyyy": {
- mask: "1-2-y",
- placeholder: "mm-dd-yyyy",
- leapday: "02-29-",
- separator: "-",
- alias: "mm/dd/yyyy"
- },
- "yyyy.mm.dd": {
- mask: "y.1.2",
- placeholder: "yyyy.mm.dd",
- leapday: ".02.29",
- separator: ".",
- alias: "yyyy/mm/dd"
- },
- "yyyy-mm-dd": {
- mask: "y-1-2",
- placeholder: "yyyy-mm-dd",
- leapday: "-02-29",
- separator: "-",
- alias: "yyyy/mm/dd"
- },
- datetime: {
- mask: "1/2/y h:s",
- placeholder: "dd/mm/yyyy hh:mm",
- alias: "dd/mm/yyyy",
- regex: {
- hrspre: new RegExp("[012]"),
- hrs24: new RegExp("2[0-4]|1[3-9]"),
- hrs: new RegExp("[01][0-9]|2[0-4]"),
- ampm: new RegExp("^[a|p|A|P][m|M]"),
- mspre: new RegExp("[0-5]"),
- ms: new RegExp("[0-5][0-9]")
- },
- timeseparator: ":",
- hourFormat: "24",
- definitions: {
- h: {
- validator: function(chrs, maskset, pos, strict, opts) {
- if ("24" === opts.hourFormat && 24 === parseInt(chrs, 10)) return maskset.buffer[pos - 1] = "0",
- maskset.buffer[pos] = "0", {
- refreshFromBuffer: {
- start: pos - 1,
- end: pos
- },
- c: "0"
- };
- var isValid = opts.regex.hrs.test(chrs);
- if (!strict && !isValid && (chrs.charAt(1) === opts.timeseparator || -1 !== "-.:".indexOf(chrs.charAt(1))) && (isValid = opts.regex.hrs.test("0" + chrs.charAt(0)))) return maskset.buffer[pos - 1] = "0",
- maskset.buffer[pos] = chrs.charAt(0), pos++, {
- refreshFromBuffer: {
- start: pos - 2,
- end: pos
- },
- pos: pos,
- c: opts.timeseparator
- };
- if (isValid && "24" !== opts.hourFormat && opts.regex.hrs24.test(chrs)) {
- var tmp = parseInt(chrs, 10);
- return 24 === tmp ? (maskset.buffer[pos + 5] = "a", maskset.buffer[pos + 6] = "m") : (maskset.buffer[pos + 5] = "p",
- maskset.buffer[pos + 6] = "m"), tmp -= 12, 10 > tmp ? (maskset.buffer[pos] = tmp.toString(),
- maskset.buffer[pos - 1] = "0") : (maskset.buffer[pos] = tmp.toString().charAt(1),
- maskset.buffer[pos - 1] = tmp.toString().charAt(0)), {
- refreshFromBuffer: {
- start: pos - 1,
- end: pos + 6
- },
- c: maskset.buffer[pos]
- };
- }
- return isValid;
- },
- cardinality: 2,
- prevalidator: [ {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.regex.hrspre.test(chrs);
- return strict || isValid || !(isValid = opts.regex.hrs.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
- pos++, {
- pos: pos
- });
- },
- cardinality: 1
- } ]
- },
- s: {
- validator: "[0-5][0-9]",
- cardinality: 2,
- prevalidator: [ {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.regex.mspre.test(chrs);
- return strict || isValid || !(isValid = opts.regex.ms.test("0" + chrs)) ? isValid : (maskset.buffer[pos] = "0",
- pos++, {
- pos: pos
- });
- },
- cardinality: 1
- } ]
- },
- t: {
- validator: function(chrs, maskset, pos, strict, opts) {
- return opts.regex.ampm.test(chrs + "m");
- },
- casing: "lower",
- cardinality: 1
- }
- },
- insertMode: !1,
- autoUnmask: !1
- },
- datetime12: {
- mask: "1/2/y h:s t\\m",
- placeholder: "dd/mm/yyyy hh:mm xm",
- alias: "datetime",
- hourFormat: "12"
- },
- "mm/dd/yyyy hh:mm xm": {
- mask: "1/2/y h:s t\\m",
- placeholder: "mm/dd/yyyy hh:mm xm",
- alias: "datetime12",
- regex: {
- val2pre: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[13-9]|1[012])" + escapedSeparator + "[0-3])|(02" + escapedSeparator + "[0-2])");
- },
- val2: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[13-9]|1[012])" + escapedSeparator + "30)|((0[13578]|1[02])" + escapedSeparator + "31)");
- },
- val1pre: new RegExp("[01]"),
- val1: new RegExp("0[1-9]|1[012]")
- },
- leapday: "02/29/",
- onKeyDown: function(e, buffer, caretPos, opts) {
- var $input = $(this);
- if (e.ctrlKey && e.keyCode === Inputmask.keyCode.RIGHT) {
- var today = new Date();
- $input.val((today.getMonth() + 1).toString() + today.getDate().toString() + today.getFullYear().toString()),
- $input.trigger("setvalue.inputmask");
- }
- }
- },
- "hh:mm t": {
- mask: "h:s t\\m",
- placeholder: "hh:mm xm",
- alias: "datetime",
- hourFormat: "12"
- },
- "h:s t": {
- mask: "h:s t\\m",
- placeholder: "hh:mm xm",
- alias: "datetime",
- hourFormat: "12"
- },
- "hh:mm:ss": {
- mask: "h:s:s",
- placeholder: "hh:mm:ss",
- alias: "datetime",
- autoUnmask: !1
- },
- "hh:mm": {
- mask: "h:s",
- placeholder: "hh:mm",
- alias: "datetime",
- autoUnmask: !1
- },
- date: {
- alias: "dd/mm/yyyy"
- },
- "mm/yyyy": {
- mask: "1/y",
- placeholder: "mm/yyyy",
- leapday: "donotuse",
- separator: "/",
- alias: "mm/dd/yyyy"
- },
- shamsi: {
- regex: {
- val2pre: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "[0-3])");
- },
- val2: function(separator) {
- var escapedSeparator = Inputmask.escapeRegex.call(this, separator);
- return new RegExp("((0[1-9]|1[012])" + escapedSeparator + "(0[1-9]|[12][0-9]))|((0[1-9]|1[012])" + escapedSeparator + "30)|((0[1-6])" + escapedSeparator + "31)");
- },
- val1pre: new RegExp("[01]"),
- val1: new RegExp("0[1-9]|1[012]")
- },
- yearrange: {
- minyear: 1300,
- maxyear: 1499
- },
- mask: "y/1/2",
- leapday: "/12/30",
- placeholder: "yyyy/mm/dd",
- alias: "mm/dd/yyyy",
- clearIncomplete: !0
- }
- }), Inputmask;
-}(jQuery, Inputmask), function($, Inputmask) {
- return Inputmask.extendDefinitions({
- A: {
- validator: "[A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
- cardinality: 1,
- casing: "upper"
- },
- "&": {
- validator: "[0-9A-Za-z\u0410-\u044f\u0401\u0451\xc0-\xff\xb5]",
- cardinality: 1,
- casing: "upper"
- },
- "#": {
- validator: "[0-9A-Fa-f]",
- cardinality: 1,
- casing: "upper"
- }
- }), Inputmask.extendAliases({
- url: {
- mask: "ir",
- placeholder: "",
- separator: "",
- defaultPrefix: "http://",
- regex: {
- urlpre1: new RegExp("[fh]"),
- urlpre2: new RegExp("(ft|ht)"),
- urlpre3: new RegExp("(ftp|htt)"),
- urlpre4: new RegExp("(ftp:|http|ftps)"),
- urlpre5: new RegExp("(ftp:/|ftps:|http:|https)"),
- urlpre6: new RegExp("(ftp://|ftps:/|http:/|https:)"),
- urlpre7: new RegExp("(ftp://|ftps://|http://|https:/)"),
- urlpre8: new RegExp("(ftp://|ftps://|http://|https://)")
- },
- definitions: {
- i: {
- validator: function(chrs, maskset, pos, strict, opts) {
- return !0;
- },
- cardinality: 8,
- prevalidator: function() {
- for (var result = [], prefixLimit = 8, i = 0; prefixLimit > i; i++) result[i] = function() {
- var j = i;
- return {
- validator: function(chrs, maskset, pos, strict, opts) {
- if (opts.regex["urlpre" + (j + 1)]) {
- var k, tmp = chrs;
- j + 1 - chrs.length > 0 && (tmp = maskset.buffer.join("").substring(0, j + 1 - chrs.length) + "" + tmp);
- var isValid = opts.regex["urlpre" + (j + 1)].test(tmp);
- if (!strict && !isValid) {
- for (pos -= j, k = 0; k < opts.defaultPrefix.length; k++) maskset.buffer[pos] = opts.defaultPrefix[k],
- pos++;
- for (k = 0; k < tmp.length - 1; k++) maskset.buffer[pos] = tmp[k], pos++;
- return {
- pos: pos
- };
- }
- return isValid;
- }
- return !1;
- },
- cardinality: j
- };
- }();
- return result;
- }()
- },
- r: {
- validator: ".",
- cardinality: 50
- }
- },
- insertMode: !1,
- autoUnmask: !1
- },
- ip: {
- mask: "i[i[i]].i[i[i]].i[i[i]].i[i[i]]",
- definitions: {
- i: {
- validator: function(chrs, maskset, pos, strict, opts) {
- return pos - 1 > -1 && "." !== maskset.buffer[pos - 1] ? (chrs = maskset.buffer[pos - 1] + chrs,
- chrs = pos - 2 > -1 && "." !== maskset.buffer[pos - 2] ? maskset.buffer[pos - 2] + chrs : "0" + chrs) : chrs = "00" + chrs,
- new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(chrs);
- },
- cardinality: 1
- }
- }
- },
- email: {
- mask: "*{1,64}[.*{1,64}][.*{1,64}][.*{1,64}]@*{1,64}[.*{2,64}][.*{2,6}][.*{1,2}]",
- greedy: !1,
- onBeforePaste: function(pastedValue, opts) {
- return pastedValue = pastedValue.toLowerCase(), pastedValue.replace("mailto:", "");
- },
- definitions: {
- "*": {
- validator: "[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",
- cardinality: 1,
- casing: "lower"
- }
- }
- },
- mac: {
- mask: "##:##:##:##:##:##"
- }
- }), Inputmask;
-}(jQuery, Inputmask), function($, Inputmask) {
- return Inputmask.extendAliases({
- numeric: {
- mask: function(opts) {
- function autoEscape(txt) {
- for (var escapedTxt = "", i = 0; i < txt.length; i++) escapedTxt += opts.definitions[txt.charAt(i)] ? "\\" + txt.charAt(i) : txt.charAt(i);
- return escapedTxt;
- }
- if (0 !== opts.repeat && isNaN(opts.integerDigits) && (opts.integerDigits = opts.repeat),
- opts.repeat = 0, opts.groupSeparator === opts.radixPoint && ("." === opts.radixPoint ? opts.groupSeparator = "," : "," === opts.radixPoint ? opts.groupSeparator = "." : opts.groupSeparator = ""),
- " " === opts.groupSeparator && (opts.skipOptionalPartCharacter = void 0), opts.autoGroup = opts.autoGroup && "" !== opts.groupSeparator,
- opts.autoGroup && ("string" == typeof opts.groupSize && isFinite(opts.groupSize) && (opts.groupSize = parseInt(opts.groupSize)),
- isFinite(opts.integerDigits))) {
- var seps = Math.floor(opts.integerDigits / opts.groupSize), mod = opts.integerDigits % opts.groupSize;
- opts.integerDigits = parseInt(opts.integerDigits) + (0 === mod ? seps - 1 : seps),
- opts.integerDigits < 1 && (opts.integerDigits = "*");
- }
- opts.placeholder.length > 1 && (opts.placeholder = opts.placeholder.charAt(0)),
- opts.radixFocus = opts.radixFocus && "" !== opts.placeholder && opts.integerOptional === !0,
- opts.definitions[";"] = opts.definitions["~"], opts.definitions[";"].definitionSymbol = "~",
- opts.numericInput === !0 && (opts.radixFocus = !1, opts.digitsOptional = !1, isNaN(opts.digits) && (opts.digits = 2),
- opts.decimalProtect = !1);
- var mask = autoEscape(opts.prefix);
- return mask += "[+]", mask += opts.integerOptional === !0 ? "~{1," + opts.integerDigits + "}" : "~{" + opts.integerDigits + "}",
- void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0) && (mask += opts.digitsOptional ? "[" + (opts.decimalProtect ? ":" : opts.radixPoint) + ";{1," + opts.digits + "}]" : (opts.decimalProtect ? ":" : opts.radixPoint) + ";{" + opts.digits + "}"),
- "" !== opts.negationSymbol.back && (mask += "[-]"), mask += autoEscape(opts.suffix),
- opts.greedy = !1, mask;
- },
- placeholder: "",
- greedy: !1,
- digits: "*",
- digitsOptional: !0,
- radixPoint: ".",
- radixFocus: !0,
- groupSize: 3,
- groupSeparator: "",
- autoGroup: !1,
- allowPlus: !0,
- allowMinus: !0,
- negationSymbol: {
- front: "-",
- back: ""
- },
- integerDigits: "+",
- integerOptional: !0,
- prefix: "",
- suffix: "",
- rightAlign: !0,
- decimalProtect: !0,
- min: null,
- max: null,
- step: 1,
- insertMode: !0,
- autoUnmask: !1,
- unmaskAsNumber: !1,
- postFormat: function(buffer, pos, reformatOnly, opts) {
- opts.numericInput === !0 && (buffer = buffer.reverse(), isFinite(pos) && (pos = buffer.join("").length - pos - 1));
- var i, l, suffixStripped = !1;
- buffer.length >= opts.suffix.length && buffer.join("").indexOf(opts.suffix) === buffer.length - opts.suffix.length && (buffer.length = buffer.length - opts.suffix.length,
- suffixStripped = !0), pos = pos >= buffer.length ? buffer.length - 1 : pos < opts.prefix.length ? opts.prefix.length : pos;
- var needsRefresh = !1, charAtPos = buffer[pos];
- if ("" === opts.groupSeparator || opts.numericInput !== !0 && -1 !== $.inArray(opts.radixPoint, buffer) && pos > $.inArray(opts.radixPoint, buffer) || new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]").test(charAtPos)) {
- if (suffixStripped) for (i = 0, l = opts.suffix.length; l > i; i++) buffer.push(opts.suffix.charAt(i));
- return {
- pos: pos
- };
- }
- var cbuf = buffer.slice();
- charAtPos === opts.groupSeparator && (cbuf.splice(pos--, 1), charAtPos = cbuf[pos]),
- reformatOnly ? charAtPos !== opts.radixPoint && (cbuf[pos] = "?") : cbuf.splice(pos, 0, "?");
- var bufVal = cbuf.join(""), bufValOrigin = bufVal;
- if (bufVal.length > 0 && opts.autoGroup || reformatOnly && -1 !== bufVal.indexOf(opts.groupSeparator)) {
- var escapedGroupSeparator = Inputmask.escapeRegex(opts.groupSeparator);
- needsRefresh = 0 === bufVal.indexOf(opts.groupSeparator), bufVal = bufVal.replace(new RegExp(escapedGroupSeparator, "g"), "");
- var radixSplit = bufVal.split(opts.radixPoint);
- if (bufVal = "" === opts.radixPoint ? bufVal : radixSplit[0], bufVal !== opts.prefix + "?0" && bufVal.length >= opts.groupSize + opts.prefix.length) for (var reg = new RegExp("([-+]?[\\d?]+)([\\d?]{" + opts.groupSize + "})"); reg.test(bufVal); ) bufVal = bufVal.replace(reg, "$1" + opts.groupSeparator + "$2"),
- bufVal = bufVal.replace(opts.groupSeparator + opts.groupSeparator, opts.groupSeparator);
- "" !== opts.radixPoint && radixSplit.length > 1 && (bufVal += opts.radixPoint + radixSplit[1]);
- }
- for (needsRefresh = bufValOrigin !== bufVal, buffer.length = bufVal.length, i = 0,
- l = bufVal.length; l > i; i++) buffer[i] = bufVal.charAt(i);
- var newPos = $.inArray("?", buffer);
- if (-1 === newPos && charAtPos === opts.radixPoint && (newPos = $.inArray(opts.radixPoint, buffer)),
- reformatOnly ? buffer[newPos] = charAtPos : buffer.splice(newPos, 1), !needsRefresh && suffixStripped) for (i = 0,
- l = opts.suffix.length; l > i; i++) buffer.push(opts.suffix.charAt(i));
- return newPos = opts.numericInput && isFinite(pos) ? buffer.join("").length - newPos - 1 : newPos,
- opts.numericInput && (buffer = buffer.reverse(), $.inArray(opts.radixPoint, buffer) < newPos && buffer.join("").length - opts.suffix.length !== newPos && (newPos -= 1)),
- {
- pos: newPos,
- refreshFromBuffer: needsRefresh,
- buffer: buffer
- };
- },
- onBeforeWrite: function(e, buffer, caretPos, opts) {
- if (e && ("blur" === e.type || "checkval" === e.type)) {
- var maskedValue = buffer.join(""), processValue = maskedValue.replace(opts.prefix, "");
- if (processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
- "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
- isFinite(processValue) && isFinite(opts.min) && parseFloat(processValue) < parseFloat(opts.min)) return $.extend(!0, {
- refreshFromBuffer: !0,
- buffer: (opts.prefix + opts.min).split("")
- }, opts.postFormat((opts.prefix + opts.min).split(""), 0, !0, opts));
- if (opts.numericInput !== !0) {
- var tmpBufSplit = "" !== opts.radixPoint ? buffer.join("").split(opts.radixPoint) : [ buffer.join("") ], matchRslt = tmpBufSplit[0].match(opts.regex.integerPart(opts)), matchRsltDigits = 2 === tmpBufSplit.length ? tmpBufSplit[1].match(opts.regex.integerNPart(opts)) : void 0;
- if (matchRslt) {
- matchRslt[0] !== opts.negationSymbol.front + "0" && matchRslt[0] !== opts.negationSymbol.front && "+" !== matchRslt[0] || void 0 !== matchRsltDigits && !matchRsltDigits[0].match(/^0+$/) || buffer.splice(matchRslt.index, 1);
- var radixPosition = $.inArray(opts.radixPoint, buffer);
- if (-1 !== radixPosition) {
- if (isFinite(opts.digits) && !opts.digitsOptional) {
- for (var i = 1; i <= opts.digits; i++) (void 0 === buffer[radixPosition + i] || buffer[radixPosition + i] === opts.placeholder.charAt(0)) && (buffer[radixPosition + i] = "0");
- return {
- refreshFromBuffer: maskedValue !== buffer.join(""),
- buffer: buffer
- };
- }
- if (radixPosition === buffer.length - opts.suffix.length - 1) return buffer.splice(radixPosition, 1),
- {
- refreshFromBuffer: !0,
- buffer: buffer
- };
- }
- }
- }
- }
- if (opts.autoGroup) {
- var rslt = opts.postFormat(buffer, opts.numericInput ? caretPos : caretPos - 1, !0, opts);
- return rslt.caret = caretPos <= opts.prefix.length ? rslt.pos : rslt.pos + 1, rslt;
- }
- },
- regex: {
- integerPart: function(opts) {
- return new RegExp("[" + Inputmask.escapeRegex(opts.negationSymbol.front) + "+]?\\d+");
- },
- integerNPart: function(opts) {
- return new RegExp("[\\d" + Inputmask.escapeRegex(opts.groupSeparator) + "]+");
- }
- },
- signHandler: function(chrs, maskset, pos, strict, opts) {
- if (!strict && opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) {
- var matchRslt = maskset.buffer.join("").match(opts.regex.integerPart(opts));
- if (matchRslt && matchRslt[0].length > 0) return maskset.buffer[matchRslt.index] === ("-" === chrs ? "+" : opts.negationSymbol.front) ? "-" === chrs ? "" !== opts.negationSymbol.back ? {
- pos: matchRslt.index,
- c: opts.negationSymbol.front,
- remove: matchRslt.index,
- caret: pos,
- insert: {
- pos: maskset.buffer.length - opts.suffix.length - 1,
- c: opts.negationSymbol.back
- }
- } : {
- pos: matchRslt.index,
- c: opts.negationSymbol.front,
- remove: matchRslt.index,
- caret: pos
- } : "" !== opts.negationSymbol.back ? {
- pos: matchRslt.index,
- c: "+",
- remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ],
- caret: pos
- } : {
- pos: matchRslt.index,
- c: "+",
- remove: matchRslt.index,
- caret: pos
- } : maskset.buffer[matchRslt.index] === ("-" === chrs ? opts.negationSymbol.front : "+") ? "-" === chrs && "" !== opts.negationSymbol.back ? {
- remove: [ matchRslt.index, maskset.buffer.length - opts.suffix.length - 1 ],
- caret: pos - 1
- } : {
- remove: matchRslt.index,
- caret: pos - 1
- } : "-" === chrs ? "" !== opts.negationSymbol.back ? {
- pos: matchRslt.index,
- c: opts.negationSymbol.front,
- caret: pos + 1,
- insert: {
- pos: maskset.buffer.length - opts.suffix.length,
- c: opts.negationSymbol.back
- }
- } : {
- pos: matchRslt.index,
- c: opts.negationSymbol.front,
- caret: pos + 1
- } : {
- pos: matchRslt.index,
- c: chrs,
- caret: pos + 1
- };
- }
- return !1;
- },
- radixHandler: function(chrs, maskset, pos, strict, opts) {
- if (!strict && (-1 !== $.inArray(chrs, [ ",", "." ]) && (chrs = opts.radixPoint),
- chrs === opts.radixPoint && void 0 !== opts.digits && (isNaN(opts.digits) || parseInt(opts.digits) > 0))) {
- var radixPos = $.inArray(opts.radixPoint, maskset.buffer), integerValue = maskset.buffer.join("").match(opts.regex.integerPart(opts));
- if (-1 !== radixPos && maskset.validPositions[radixPos]) return maskset.validPositions[radixPos - 1] ? {
- caret: radixPos + 1
- } : {
- pos: integerValue.index,
- c: integerValue[0],
- caret: radixPos + 1
- };
- if (!integerValue || "0" === integerValue[0] && integerValue.index + 1 !== pos) return maskset.buffer[integerValue ? integerValue.index : pos] = "0",
- {
- pos: (integerValue ? integerValue.index : pos) + 1,
- c: opts.radixPoint
- };
- }
- return !1;
- },
- leadingZeroHandler: function(chrs, maskset, pos, strict, opts) {
- if (opts.numericInput === !0) {
- if ("0" === maskset.buffer[maskset.buffer.length - opts.prefix.length - 1]) return {
- pos: pos,
- remove: maskset.buffer.length - opts.prefix.length - 1
- };
- } else {
- var matchRslt = maskset.buffer.join("").match(opts.regex.integerNPart(opts)), radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
- if (matchRslt && !strict && (-1 === radixPosition || radixPosition >= pos)) if (0 === matchRslt[0].indexOf("0")) {
- pos < opts.prefix.length && (pos = matchRslt.index);
- var _radixPosition = $.inArray(opts.radixPoint, maskset._buffer), digitsMatch = maskset._buffer && maskset.buffer.slice(radixPosition).join("") === maskset._buffer.slice(_radixPosition).join("") || 0 === parseInt(maskset.buffer.slice(radixPosition + 1).join("")), integerMatch = maskset._buffer && maskset.buffer.slice(matchRslt.index, radixPosition).join("") === maskset._buffer.slice(opts.prefix.length, _radixPosition).join("") || "0" === maskset.buffer.slice(matchRslt.index, radixPosition).join("");
- if (-1 === radixPosition || digitsMatch && integerMatch) return maskset.buffer.splice(matchRslt.index, 1),
- pos = pos > matchRslt.index ? pos - 1 : matchRslt.index, {
- pos: pos,
- remove: matchRslt.index
- };
- if (matchRslt.index + 1 === pos || "0" === chrs) return maskset.buffer.splice(matchRslt.index, 1),
- pos = matchRslt.index, {
- pos: pos,
- remove: matchRslt.index
- };
- } else if ("0" === chrs && pos <= matchRslt.index && matchRslt[0] !== opts.groupSeparator) return !1;
- }
- return !0;
- },
- postValidation: function(buffer, opts) {
- var isValid = !0, maskedValue = buffer.join(""), processValue = maskedValue.replace(opts.prefix, "");
- return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
- "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
- processValue = processValue.replace(new RegExp("^" + Inputmask.escapeRegex(opts.negationSymbol.front)), "-"),
- processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.negationSymbol.back) + "$"), ""),
- processValue = processValue === opts.negationSymbol.front ? processValue + "0" : processValue,
- isFinite(processValue) && (null !== opts.max && isFinite(opts.max) && (isValid = parseFloat(processValue) <= parseFloat(opts.max)),
- isValid && null !== opts.min && isFinite(opts.min) && (0 >= processValue || processValue.toString().length >= opts.min.toString().length) && (isValid = parseFloat(processValue) >= parseFloat(opts.min),
- isValid || (isValid = $.extend(!0, {
- refreshFromBuffer: !0,
- buffer: (opts.prefix + opts.min).split("")
- }, opts.postFormat((opts.prefix + opts.min).split(""), 0, !0, opts)), isValid.refreshFromBuffer = !0))),
- isValid;
- },
- definitions: {
- "~": {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
- if (!isValid && (isValid = opts.radixHandler(chrs, maskset, pos, strict, opts),
- !isValid && (isValid = strict ? new RegExp("[0-9" + Inputmask.escapeRegex(opts.groupSeparator) + "]").test(chrs) : new RegExp("[0-9]").test(chrs),
- isValid === !0 && (isValid = opts.leadingZeroHandler(chrs, maskset, pos, strict, opts),
- isValid === !0)))) {
- var radixPosition = $.inArray(opts.radixPoint, maskset.buffer);
- isValid = -1 !== radixPosition && opts.digitsOptional === !1 && opts.numericInput !== !0 && pos > radixPosition && !strict ? {
- pos: pos,
- remove: pos
- } : {
- pos: pos
- };
- }
- return isValid;
- },
- cardinality: 1,
- prevalidator: null
- },
- "+": {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
- return !isValid && (strict && opts.allowMinus && chrs === opts.negationSymbol.front || opts.allowMinus && "-" === chrs || opts.allowPlus && "+" === chrs) && (isValid = "-" === chrs ? "" !== opts.negationSymbol.back ? {
- pos: pos,
- c: "-" === chrs ? opts.negationSymbol.front : "+",
- caret: pos + 1,
- insert: {
- pos: maskset.buffer.length,
- c: opts.negationSymbol.back
- }
- } : {
- pos: pos,
- c: "-" === chrs ? opts.negationSymbol.front : "+",
- caret: pos + 1
- } : !0), isValid;
- },
- cardinality: 1,
- prevalidator: null,
- placeholder: ""
- },
- "-": {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
- return !isValid && strict && opts.allowMinus && chrs === opts.negationSymbol.back && (isValid = !0),
- isValid;
- },
- cardinality: 1,
- prevalidator: null,
- placeholder: ""
- },
- ":": {
- validator: function(chrs, maskset, pos, strict, opts) {
- var isValid = opts.signHandler(chrs, maskset, pos, strict, opts);
- if (!isValid) {
- var radix = "[" + Inputmask.escapeRegex(opts.radixPoint) + ",\\.]";
- isValid = new RegExp(radix).test(chrs), isValid && maskset.validPositions[pos] && maskset.validPositions[pos].match.placeholder === opts.radixPoint && (isValid = {
- caret: pos + 1
- });
- }
- return isValid ? {
- c: opts.radixPoint
- } : isValid;
- },
- cardinality: 1,
- prevalidator: null,
- placeholder: function(opts) {
- return opts.radixPoint;
- }
- }
- },
- onUnMask: function(maskedValue, unmaskedValue, opts) {
- var processValue = maskedValue.replace(opts.prefix, "");
- return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
- opts.unmaskAsNumber ? ("" !== opts.radixPoint && -1 !== processValue.indexOf(opts.radixPoint) && (processValue = processValue.replace(Inputmask.escapeRegex.call(this, opts.radixPoint), ".")),
- Number(processValue)) : processValue;
- },
- isComplete: function(buffer, opts) {
- var maskedValue = buffer.join(""), bufClone = buffer.slice();
- if (opts.postFormat(bufClone, 0, !0, opts), bufClone.join("") !== maskedValue) return !1;
- var processValue = maskedValue.replace(opts.prefix, "");
- return processValue = processValue.replace(opts.suffix, ""), processValue = processValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""),
- "," === opts.radixPoint && (processValue = processValue.replace(Inputmask.escapeRegex(opts.radixPoint), ".")),
- isFinite(processValue);
- },
- onBeforeMask: function(initialValue, opts) {
- if ("" !== opts.radixPoint && isFinite(initialValue)) initialValue = initialValue.toString().replace(".", opts.radixPoint); else {
- var kommaMatches = initialValue.match(/,/g), dotMatches = initialValue.match(/\./g);
- dotMatches && kommaMatches ? dotMatches.length > kommaMatches.length ? (initialValue = initialValue.replace(/\./g, ""),
- initialValue = initialValue.replace(",", opts.radixPoint)) : kommaMatches.length > dotMatches.length ? (initialValue = initialValue.replace(/,/g, ""),
- initialValue = initialValue.replace(".", opts.radixPoint)) : initialValue = initialValue.indexOf(".") < initialValue.indexOf(",") ? initialValue.replace(/\./g, "") : initialValue = initialValue.replace(/,/g, "") : initialValue = initialValue.replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "");
- }
- if (0 === opts.digits && (-1 !== initialValue.indexOf(".") ? initialValue = initialValue.substring(0, initialValue.indexOf(".")) : -1 !== initialValue.indexOf(",") && (initialValue = initialValue.substring(0, initialValue.indexOf(",")))),
- "" !== opts.radixPoint && isFinite(opts.digits) && -1 !== initialValue.indexOf(opts.radixPoint)) {
- var valueParts = initialValue.split(opts.radixPoint), decPart = valueParts[1].match(new RegExp("\\d*"))[0];
- if (parseInt(opts.digits) < decPart.toString().length) {
- var digitsFactor = Math.pow(10, parseInt(opts.digits));
- initialValue = initialValue.replace(Inputmask.escapeRegex(opts.radixPoint), "."),
- initialValue = Math.round(parseFloat(initialValue) * digitsFactor) / digitsFactor,
- initialValue = initialValue.toString().replace(".", opts.radixPoint);
- }
- }
- return initialValue.toString();
- },
- canClearPosition: function(maskset, position, lvp, strict, opts) {
- var positionInput = maskset.validPositions[position].input, canClear = positionInput !== opts.radixPoint || null !== maskset.validPositions[position].match.fn && opts.decimalProtect === !1 || isFinite(positionInput) || position === lvp || positionInput === opts.groupSeparator || positionInput === opts.negationSymbol.front || positionInput === opts.negationSymbol.back;
- if (canClear && isFinite(positionInput)) {
- var matchRslt, radixPos = $.inArray(opts.radixPoint, maskset.buffer), radixInjection = !1;
- if (void 0 === maskset.validPositions[radixPos] && (maskset.validPositions[radixPos] = {
- input: opts.radixPoint
- }, radixInjection = !0), !strict && maskset.buffer) {
- matchRslt = maskset.buffer.join("").substr(0, position).match(opts.regex.integerNPart(opts));
- var pos = position + 1, isNull = null == matchRslt || 0 === parseInt(matchRslt[0].replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), ""));
- if (isNull) for (;maskset.validPositions[pos] && (maskset.validPositions[pos].input === opts.groupSeparator || "0" === maskset.validPositions[pos].input); ) delete maskset.validPositions[pos],
- pos++;
- }
- var buffer = [];
- for (var vp in maskset.validPositions) void 0 !== maskset.validPositions[vp].input && buffer.push(maskset.validPositions[vp].input);
- if (radixInjection && delete maskset.validPositions[radixPos], radixPos > 0) {
- var bufVal = buffer.join("");
- if (matchRslt = bufVal.match(opts.regex.integerNPart(opts))) if (radixPos >= position) if (0 === matchRslt[0].indexOf("0")) canClear = matchRslt.index !== position || "0" === opts.placeholder; else {
- var intPart = parseInt(matchRslt[0].replace(new RegExp(Inputmask.escapeRegex(opts.groupSeparator), "g"), "")), radixPart = parseInt(bufVal.split(opts.radixPoint)[1]);
- 10 > intPart && maskset.validPositions[position] && ("0" !== opts.placeholder || radixPart > 0) && (maskset.validPositions[position].input = "0",
- maskset.p = opts.prefix.length + 1, canClear = !1);
- } else 0 === matchRslt[0].indexOf("0") && 3 === bufVal.length && (maskset.validPositions = {},
- canClear = !1);
- }
- }
- return canClear;
- },
- onKeyDown: function(e, buffer, caretPos, opts) {
- var $input = $(this);
- if (e.ctrlKey) switch (e.keyCode) {
- case Inputmask.keyCode.UP:
- $input.val(parseFloat(this.inputmask.unmaskedvalue()) + parseInt(opts.step)), $input.trigger("setvalue.inputmask");
- break;
-
- case Inputmask.keyCode.DOWN:
- $input.val(parseFloat(this.inputmask.unmaskedvalue()) - parseInt(opts.step)), $input.trigger("setvalue.inputmask");
- }
- }
- },
- currency: {
- prefix: "$ ",
- groupSeparator: ",",
- alias: "numeric",
- placeholder: "0",
- autoGroup: !0,
- digits: 2,
- digitsOptional: !1,
- clearMaskOnLostFocus: !1
- },
- // jishenghua 2015-10-14
- money: {
- prefix: "",
- groupSeparator: ",",
- alias: "numeric",
- placeholder: "0",
- autoGroup: !0,
- digits: 2,
- digitsOptional: !1,
- clearMaskOnLostFocus: !1
- },
- decimal: {
- alias: "numeric"
- },
- integer: {
- alias: "numeric",
- digits: 0,
- radixPoint: ""
- },
- percentage: {
- alias: "numeric",
- digits: 2,
- radixPoint: ".",
- placeholder: "0",
- autoGroup: !1,
- min: 0,
- max: 100,
- suffix: " %",
- allowPlus: !1,
- allowMinus: !1
- }
- }), Inputmask;
-}(jQuery, Inputmask), function($, Inputmask) {
- return Inputmask.extendAliases({
- phone: {
- url: "phone-codes/phone-codes.js",
- countrycode: "",
- mask: function(opts) {
- opts.definitions["#"] = opts.definitions[9];
- var maskList = [];
- return $.ajax({
- url: opts.url,
- async: !1,
- dataType: "json",
- success: function(response) {
- maskList = response;
- },
- error: function(xhr, ajaxOptions, thrownError) {
- alert(thrownError + " - " + opts.url);
- }
- }), maskList = maskList.sort(function(a, b) {
- return (a.mask || a) < (b.mask || b) ? -1 : 1;
- });
- },
- keepStatic: !1,
- nojumps: !0,
- nojumpsThreshold: 1,
- onBeforeMask: function(value, opts) {
- var processedValue = value.replace(/^0/g, "");
- return (processedValue.indexOf(opts.countrycode) > 1 || -1 === processedValue.indexOf(opts.countrycode)) && (processedValue = "+" + opts.countrycode + processedValue),
- processedValue;
- }
- },
- phonebe: {
- alias: "phone",
- url: "phone-codes/phone-be.js",
- countrycode: "32",
- nojumpsThreshold: 4
- }
- }), Inputmask;
-}(jQuery, Inputmask), function($, Inputmask) {
- return Inputmask.extendAliases({
- Regex: {
- mask: "r",
- greedy: !1,
- repeat: "*",
- regex: null,
- regexTokens: null,
- tokenizer: /\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,
- quantifierFilter: /[0-9]+[^,]/,
- isComplete: function(buffer, opts) {
- return new RegExp(opts.regex).test(buffer.join(""));
- },
- definitions: {
- r: {
- validator: function(chrs, maskset, pos, strict, opts) {
- function RegexToken(isGroup, isQuantifier) {
- this.matches = [], this.isGroup = isGroup || !1, this.isQuantifier = isQuantifier || !1,
- this.quantifier = {
- min: 1,
- max: 1
- }, this.repeaterPart = void 0;
- }
- function analyseRegex() {
- var match, m, currentToken = new RegexToken(), opengroups = [];
- for (opts.regexTokens = []; match = opts.tokenizer.exec(opts.regex); ) switch (m = match[0],
- m.charAt(0)) {
- case "(":
- opengroups.push(new RegexToken(!0));
- break;
-
- case ")":
- groupToken = opengroups.pop(), opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(groupToken) : currentToken.matches.push(groupToken);
- break;
-
- case "{":
- case "+":
- case "*":
- var quantifierToken = new RegexToken(!1, !0);
- m = m.replace(/[{}]/g, "");
- var mq = m.split(","), mq0 = isNaN(mq[0]) ? mq[0] : parseInt(mq[0]), mq1 = 1 === mq.length ? mq0 : isNaN(mq[1]) ? mq[1] : parseInt(mq[1]);
- if (quantifierToken.quantifier = {
- min: mq0,
- max: mq1
- }, opengroups.length > 0) {
- var matches = opengroups[opengroups.length - 1].matches;
- match = matches.pop(), match.isGroup || (groupToken = new RegexToken(!0), groupToken.matches.push(match),
- match = groupToken), matches.push(match), matches.push(quantifierToken);
- } else match = currentToken.matches.pop(), match.isGroup || (groupToken = new RegexToken(!0),
- groupToken.matches.push(match), match = groupToken), currentToken.matches.push(match),
- currentToken.matches.push(quantifierToken);
- break;
-
- default:
- opengroups.length > 0 ? opengroups[opengroups.length - 1].matches.push(m) : currentToken.matches.push(m);
- }
- currentToken.matches.length > 0 && opts.regexTokens.push(currentToken);
- }
- function validateRegexToken(token, fromGroup) {
- var isvalid = !1;
- fromGroup && (regexPart += "(", openGroupCount++);
- for (var mndx = 0; mndx < token.matches.length; mndx++) {
- var matchToken = token.matches[mndx];
- if (matchToken.isGroup === !0) isvalid = validateRegexToken(matchToken, !0); else if (matchToken.isQuantifier === !0) {
- var crrntndx = $.inArray(matchToken, token.matches), matchGroup = token.matches[crrntndx - 1], regexPartBak = regexPart;
- if (isNaN(matchToken.quantifier.max)) {
- for (;matchToken.repeaterPart && matchToken.repeaterPart !== regexPart && matchToken.repeaterPart.length > regexPart.length && !(isvalid = validateRegexToken(matchGroup, !0)); ) ;
- isvalid = isvalid || validateRegexToken(matchGroup, !0), isvalid && (matchToken.repeaterPart = regexPart),
- regexPart = regexPartBak + matchToken.quantifier.max;
- } else {
- for (var i = 0, qm = matchToken.quantifier.max - 1; qm > i && !(isvalid = validateRegexToken(matchGroup, !0)); i++) ;
- regexPart = regexPartBak + "{" + matchToken.quantifier.min + "," + matchToken.quantifier.max + "}";
- }
- } else if (void 0 !== matchToken.matches) for (var k = 0; k < matchToken.length && !(isvalid = validateRegexToken(matchToken[k], fromGroup)); k++) ; else {
- var testExp;
- if ("[" == matchToken.charAt(0)) {
- testExp = regexPart, testExp += matchToken;
- for (var j = 0; openGroupCount > j; j++) testExp += ")";
- var exp = new RegExp("^(" + testExp + ")$");
- isvalid = exp.test(bufferStr);
- } else for (var l = 0, tl = matchToken.length; tl > l; l++) if ("\\" !== matchToken.charAt(l)) {
- testExp = regexPart, testExp += matchToken.substr(0, l + 1), testExp = testExp.replace(/\|$/, "");
- for (var j = 0; openGroupCount > j; j++) testExp += ")";
- var exp = new RegExp("^(" + testExp + ")$");
- if (isvalid = exp.test(bufferStr)) break;
- }
- regexPart += matchToken;
- }
- if (isvalid) break;
- }
- return fromGroup && (regexPart += ")", openGroupCount--), isvalid;
- }
- var groupToken, cbuffer = maskset.buffer.slice(), regexPart = "", isValid = !1, openGroupCount = 0;
- null === opts.regexTokens && analyseRegex(), cbuffer.splice(pos, 0, chrs);
- for (var bufferStr = cbuffer.join(""), i = 0; i < opts.regexTokens.length; i++) {
- var regexToken = opts.regexTokens[i];
- if (isValid = validateRegexToken(regexToken, regexToken.isGroup)) break;
- }
- return isValid;
- },
- cardinality: 1
- }
- }
- }
- }), Inputmask;
-}(jQuery, Inputmask);
\ No newline at end of file
diff --git a/erp_web/js/jquery-plugins/jquery.resizeEnd.js b/erp_web/js/jquery-plugins/jquery.resizeEnd.js
deleted file mode 100644
index 7a5e664f..00000000
--- a/erp_web/js/jquery-plugins/jquery.resizeEnd.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// Generated by CoffeeScript 1.6.3
-(function($, window, document) {
- var ResizeEnd, defaults, plugin;
- plugin = 'resizeEnd';
- defaults = {
- delay: 250
- };
- ResizeEnd = function(element, options, callback) {
- if (typeof options === 'function') {
- callback = options;
- options = {};
- }
- callback = callback || null;
- this.element = element;
- this.settings = $.extend({}, defaults, options);
- this._defaults = defaults;
- this._name = plugin;
- this._timeout = false;
- this._callback = callback;
- return this.init();
- };
- ResizeEnd.prototype = {
- init: function() {
- var $el, _this;
- _this = this;
- $el = $(this.element);
- return $el.on('resize', function() {
- return _this.initResize();
- });
- },
- getUTCDate: function(d) {
- var curdate;
- d = d || new Date();
- curdate = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds(), d.getUTCMilliseconds());
- return curdate;
- },
- initResize: function() {
- var _this;
- _this = this;
- _this.controlTime = _this.getUTCDate();
- if (_this._timeout === false) {
- _this._timeout = true;
- return setTimeout(function() {
- return _this.runCallback(_this);
- }, _this.settings.delay);
- }
- },
- runCallback: function(_this) {
- var nowTime;
- nowTime = _this.getUTCDate();
- if (nowTime - _this.controlTime < _this.settings.delay) {
- return setTimeout(function() {
- return _this.runCallback(_this);
- }, _this.settings.delay);
- } else {
- _this._timeout = false;
- return _this._callback();
- }
- }
- };
- return $.fn[plugin] = function(options, callback) {
- return this.each(function() {
- if (!$.data(this, 'plugin_' + plugin)) {
- return $.data(this, 'plugin_' + plugin, new ResizeEnd(this, options, callback));
- }
- });
- };
-})(jQuery, window, document);
diff --git a/erp_web/js/jquery-plugins/jquery.slimscroll.js b/erp_web/js/jquery-plugins/jquery.slimscroll.js
deleted file mode 100644
index 10518f5d..00000000
--- a/erp_web/js/jquery-plugins/jquery.slimscroll.js
+++ /dev/null
@@ -1,476 +0,0 @@
-/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
- * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
- * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
- *
- * Version: 1.3.8
- *
- */
-(function($) {
-
- $.fn.extend({
- slimScroll: function(options) {
-
- var defaults = {
-
- // width in pixels of the visible scroll area
- width : 'auto',
-
- // height in pixels of the visible scroll area
- height : '250px',
-
- // width in pixels of the scrollbar and rail
- size : '7px',
-
- // scrollbar color, accepts any hex/color value
- color: '#000',
-
- // scrollbar position - left/right
- position : 'right',
-
- // distance in pixels between the side edge and the scrollbar
- distance : '1px',
-
- // default scroll position on load - top / bottom / $('selector')
- start : 'top',
-
- // sets scrollbar opacity
- opacity : .4,
-
- // enables always-on mode for the scrollbar
- alwaysVisible : false,
-
- // check if we should hide the scrollbar when user is hovering over
- disableFadeOut : false,
-
- // sets visibility of the rail
- railVisible : false,
-
- // sets rail color
- railColor : '#333',
-
- // sets rail opacity
- railOpacity : .2,
-
- // whether we should use jQuery UI Draggable to enable bar dragging
- railDraggable : true,
-
- // defautlt CSS class of the slimscroll rail
- railClass : 'slimScrollRail',
-
- // defautlt CSS class of the slimscroll bar
- barClass : 'slimScrollBar',
-
- // defautlt CSS class of the slimscroll wrapper
- wrapperClass : 'slimScrollDiv',
-
- // check if mousewheel should scroll the window if we reach top/bottom
- allowPageScroll : false,
-
- // scroll amount applied to each mouse wheel step
- wheelStep : 20,
-
- // scroll amount applied when user is using gestures
- touchScrollStep : 200,
-
- // sets border radius
- borderRadius: '7px',
-
- // sets border radius of the rail
- railBorderRadius : '7px'
- };
-
- var o = $.extend(defaults, options);
-
- // do it for every element that matches selector
- this.each(function(){
-
- var isOverPanel, isOverBar, isDragg, queueHide, touchDif,
- barHeight, percentScroll, lastScroll,
- divS = '
',
- minBarHeight = 30,
- releaseScroll = false;
-
- // used in event handlers and for better minification
- var me = $(this);
-
- // ensure we are not binding it again
- if (me.parent().hasClass(o.wrapperClass))
- {
- // start from last bar position
- var offset = me.scrollTop();
-
- // find bar and rail
- bar = me.siblings('.' + o.barClass);
- rail = me.siblings('.' + o.railClass);
-
- getBarHeight();
-
- // check if we should scroll existing instance
- if ($.isPlainObject(options))
- {
- // Pass height: auto to an existing slimscroll object to force a resize after contents have changed
- if ( 'height' in options && options.height == 'auto' ) {
- me.parent().css('height', 'auto');
- me.css('height', 'auto');
- var height = me.parent().parent().height();
- me.parent().css('height', height);
- me.css('height', height);
- } else if ('height' in options) {
- var h = options.height;
- me.parent().css('height', h);
- me.css('height', h);
- }
-
- if ('scrollTo' in options)
- {
- // jump to a static point
- offset = parseInt(o.scrollTo);
- }
- else if ('scrollBy' in options)
- {
- // jump by value pixels
- offset += parseInt(o.scrollBy);
- }
- else if ('destroy' in options)
- {
- // remove slimscroll elements
- bar.remove();
- rail.remove();
- me.unwrap();
- return;
- }
-
- // scroll content by the given offset
- scrollContent(offset, false, true);
- }
-
- return;
- }
- else if ($.isPlainObject(options))
- {
- if ('destroy' in options)
- {
- return;
- }
- }
-
- // optionally set height to the parent's height
- o.height = (o.height == 'auto') ? me.parent().height() : o.height;
-
- // wrap content
- var wrapper = $(divS)
- .addClass(o.wrapperClass)
- .css({
- position: 'relative',
- overflow: 'hidden',
- width: o.width,
- height: o.height
- });
-
- // update style for the div
- me.css({
- overflow: 'hidden',
- width: o.width,
- height: o.height
- });
-
- // create scrollbar rail
- var rail = $(divS)
- .addClass(o.railClass)
- .css({
- width: o.size,
- height: '100%',
- position: 'absolute',
- top: 0,
- display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none',
- 'border-radius': o.railBorderRadius,
- background: o.railColor,
- opacity: o.railOpacity,
- zIndex: 90
- });
-
- // create scrollbar
- var bar = $(divS)
- .addClass(o.barClass)
- .css({
- background: o.color,
- width: o.size,
- position: 'absolute',
- top: 0,
- opacity: o.opacity,
- display: o.alwaysVisible ? 'block' : 'none',
- 'border-radius' : o.borderRadius,
- BorderRadius: o.borderRadius,
- MozBorderRadius: o.borderRadius,
- WebkitBorderRadius: o.borderRadius,
- zIndex: 99
- });
-
- // set position
- var posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance };
- rail.css(posCss);
- bar.css(posCss);
-
- // wrap it
- me.wrap(wrapper);
-
- // append to parent div
- me.parent().append(bar);
- me.parent().append(rail);
-
- // make it draggable and no longer dependent on the jqueryUI
- if (o.railDraggable){
- bar.bind("mousedown", function(e) {
- var $doc = $(document);
- isDragg = true;
- t = parseFloat(bar.css('top'));
- pageY = e.pageY;
-
- $doc.bind("mousemove.slimscroll", function(e){
- currTop = t + e.pageY - pageY;
- bar.css('top', currTop);
- scrollContent(0, bar.position().top, false);// scroll content
- });
-
- $doc.bind("mouseup.slimscroll", function(e) {
- isDragg = false;hideBar();
- $doc.unbind('.slimscroll');
- });
- return false;
- }).bind("selectstart.slimscroll", function(e){
- e.stopPropagation();
- e.preventDefault();
- return false;
- });
- }
-
- // on rail over
- rail.hover(function(){
- showBar();
- }, function(){
- hideBar();
- });
-
- // on bar over
- bar.hover(function(){
- isOverBar = true;
- }, function(){
- isOverBar = false;
- });
-
- // show on parent mouseover
- me.hover(function(){
- isOverPanel = true;
- showBar();
- hideBar();
- }, function(){
- isOverPanel = false;
- hideBar();
- });
-
- // support for mobile
- me.bind('touchstart', function(e,b){
- if (e.originalEvent.touches.length)
- {
- // record where touch started
- touchDif = e.originalEvent.touches[0].pageY;
- }
- });
-
- me.bind('touchmove', function(e){
- // prevent scrolling the page if necessary
- if(!releaseScroll)
- {
- e.originalEvent.preventDefault();
- }
- if (e.originalEvent.touches.length)
- {
- // see how far user swiped
- var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep;
- // scroll content
- scrollContent(diff, true);
- touchDif = e.originalEvent.touches[0].pageY;
- }
- });
-
- // set up initial height
- getBarHeight();
-
- // check start position
- if (o.start === 'bottom')
- {
- // scroll content to bottom
- bar.css({ top: me.outerHeight() - bar.outerHeight() });
- scrollContent(0, true);
- }
- else if (o.start !== 'top')
- {
- // assume jQuery selector
- scrollContent($(o.start).position().top, null, true);
-
- // make sure bar stays hidden
- if (!o.alwaysVisible) { bar.hide(); }
- }
-
- // attach scroll events
- attachWheel(this);
-
- function _onWheel(e)
- {
- // use mouse wheel only when mouse is over
- if (!isOverPanel) { return; }
-
- var e = e || window.event;
-
- var delta = 0;
- if (e.wheelDelta) { delta = -e.wheelDelta/120; }
- if (e.detail) { delta = e.detail / 3; }
-
- var target = e.target || e.srcTarget || e.srcElement;
- if ($(target).closest('.' + o.wrapperClass).is(me.parent())) {
- // scroll content
- scrollContent(delta, true);
- }
-
- // stop window scroll
- if (e.preventDefault && !releaseScroll) { e.preventDefault(); }
- if (!releaseScroll) { e.returnValue = false; }
- }
-
- function scrollContent(y, isWheel, isJump)
- {
- releaseScroll = false;
- var delta = y;
- var maxTop = me.outerHeight() - bar.outerHeight();
-
- if (isWheel)
- {
- // move bar with mouse wheel
- delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight();
-
- // move bar, make sure it doesn't go out
- delta = Math.min(Math.max(delta, 0), maxTop);
-
- // if scrolling down, make sure a fractional change to the
- // scroll position isn't rounded away when the scrollbar's CSS is set
- // this flooring of delta would happened automatically when
- // bar.css is set below, but we floor here for clarity
- delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta);
-
- // scroll the scrollbar
- bar.css({ top: delta + 'px' });
- }
-
- // calculate actual scroll amount
- percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight());
- delta = percentScroll * (me[0].scrollHeight - me.outerHeight());
-
- if (isJump)
- {
- delta = y;
- var offsetTop = delta / me[0].scrollHeight * me.outerHeight();
- offsetTop = Math.min(Math.max(offsetTop, 0), maxTop);
- bar.css({ top: offsetTop + 'px' });
- }
-
- // scroll content
- me.scrollTop(delta);
-
- // fire scrolling event
- me.trigger('slimscrolling', ~~delta);
-
- // ensure bar is visible
- showBar();
-
- // trigger hide when scroll is stopped
- hideBar();
- }
-
- function attachWheel(target)
- {
- if (window.addEventListener)
- {
- target.addEventListener('DOMMouseScroll', _onWheel, false );
- target.addEventListener('mousewheel', _onWheel, false );
- }
- else
- {
- document.attachEvent("onmousewheel", _onWheel)
- }
- }
-
- function getBarHeight()
- {
- // calculate scrollbar height and make sure it is not too small
- barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);
- bar.css({ height: barHeight + 'px' });
-
- // hide scrollbar if content is not long enough
- var display = barHeight == me.outerHeight() ? 'none' : 'block';
- bar.css({ display: display });
- }
-
- function showBar()
- {
- // recalculate bar height
- getBarHeight();
- clearTimeout(queueHide);
-
- // when bar reached top or bottom
- if (percentScroll == ~~percentScroll)
- {
- //release wheel
- releaseScroll = o.allowPageScroll;
-
- // publish approporiate event
- if (lastScroll != percentScroll)
- {
- var msg = (~~percentScroll == 0) ? 'top' : 'bottom';
- me.trigger('slimscroll', msg);
- }
- }
- else
- {
- releaseScroll = false;
- }
- lastScroll = percentScroll;
-
- // show only when required
- if(barHeight >= me.outerHeight()) {
- //allow window scroll
- releaseScroll = true;
- return;
- }
- bar.stop(true,true).fadeIn('fast');
- if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); }
- }
-
- function hideBar()
- {
- // only hide when options allow it
- if (!o.alwaysVisible)
- {
- queueHide = setTimeout(function(){
- if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg)
- {
- bar.fadeOut('slow');
- rail.fadeOut('slow');
- }
- }, 1000);
- }
- }
-
- hideBar(); // jishenghua 初始化完成滚动条自动隐藏
-
- });
-
- // maintain chainability
- return this;
- }
- });
-
- $.fn.extend({
- slimscroll: $.fn.slimScroll
- });
-
-})(jQuery);
diff --git a/erp_web/js/jquery-timeago/i18n/jquery.timeago.zh_CN.js b/erp_web/js/jquery-timeago/i18n/jquery.timeago.zh_CN.js
deleted file mode 100644
index 13c4f6c7..00000000
--- a/erp_web/js/jquery-timeago/i18n/jquery.timeago.zh_CN.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module==="object"&&typeof module.exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(a){a.timeago.settings.strings={prefixAgo:null,prefixFromNow:null,suffixAgo:"之前",suffixFromNow:"之后",seconds:"不到1分钟",minute:"大约1分钟",minutes:"%d分钟",hour:"大约1小时",hours:"大约%d小时",day:"1天",days:"%d天",month:"大约1个月",months:"%d月",year:"大约1年",years:"%d年",numbers:[],wordSeparator:""}}));
\ No newline at end of file
diff --git a/erp_web/js/jquery-timeago/jquery.timeago.js b/erp_web/js/jquery-timeago/jquery.timeago.js
deleted file mode 100644
index 85158e7d..00000000
--- a/erp_web/js/jquery-timeago/jquery.timeago.js
+++ /dev/null
@@ -1 +0,0 @@
-(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof module==="object"&&typeof module.exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(d){d.timeago=function(h){if(h instanceof Date){return a(h)}else{if(typeof h==="string"){return a(d.timeago.parse(h))}else{if(typeof h==="number"){return a(new Date(h))}else{return a(d.timeago.datetime(h))}}}};var g=d.timeago;d.extend(d.timeago,{settings:{refreshMillis:60000,allowPast:true,allowFuture:false,localeTitle:false,cutoff:0,autoDispose:true,strings:{prefixAgo:null,prefixFromNow:null,suffixAgo:"ago",suffixFromNow:"from now",inPast:"any moment now",seconds:"less than a minute",minute:"about a minute",minutes:"%d minutes",hour:"about an hour",hours:"about %d hours",day:"a day",days:"%d days",month:"about a month",months:"%d months",year:"about a year",years:"%d years",wordSeparator:" ",numbers:[]}},inWords:function(n){if(!this.settings.allowPast&&!this.settings.allowFuture){throw"timeago allowPast and allowFuture settings can not both be set to false."}var o=this.settings.strings;var k=o.prefixAgo;var s=o.suffixAgo;if(this.settings.allowFuture){if(n<0){k=o.prefixFromNow;s=o.suffixFromNow}}if(!this.settings.allowPast&&n>=0){return this.settings.strings.inPast}var q=Math.abs(n)/1000;var h=q/60;var p=h/60;var r=p/24;var l=r/365;function j(t,v){var u=d.isFunction(t)?t(v,n):t;var w=(o.numbers&&o.numbers[v])||v;return u.replace(/%d/i,w)}var m=q<45&&j(o.seconds,Math.round(q))||q<90&&j(o.minute,1)||h<45&&j(o.minutes,Math.round(h))||h<90&&j(o.hour,1)||p<24&&j(o.hours,Math.round(p))||p<42&&j(o.day,1)||r<30&&j(o.days,Math.round(r))||r<45&&j(o.month,1)||r<365&&j(o.months,Math.round(r/30))||l<1.5&&j(o.year,1)||j(o.years,Math.round(l));var i=o.wordSeparator||"";if(o.wordSeparator===undefined){i=" "}return d.trim([k,m,s].join(i))},parse:function(i){var h=d.trim(i);h=h.replace(/\.\d+/,"");h=h.replace(/-/,"/").replace(/-/,"/");h=h.replace(/T/," ").replace(/Z/," UTC");h=h.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2");h=h.replace(/([\+\-]\d\d)$/," $100");return new Date(h)},datetime:function(i){var h=g.isTime(i)?d(i).attr("datetime"):d(i).attr("title");return g.parse(h)},isTime:function(h){return d(h).get(0).tagName.toLowerCase()==="time"}});var e={init:function(){e.dispose.call(this);var i=d.proxy(c,this);i();var h=g.settings;if(h.refreshMillis>0){this._timeagoInterval=setInterval(i,h.refreshMillis)}},update:function(i){var h=(i instanceof Date)?i:g.parse(i);d(this).data("timeago",{datetime:h});if(g.settings.localeTitle){d(this).attr("title",h.toLocaleString())}c.apply(this)},updateFromDOM:function(){d(this).data("timeago",{datetime:g.parse(g.isTime(this)?d(this).attr("datetime"):d(this).attr("title"))});c.apply(this)},dispose:function(){if(this._timeagoInterval){window.clearInterval(this._timeagoInterval);this._timeagoInterval=null}}};d.fn.timeago=function(j,h){var i=j?e[j]:e.init;if(!i){throw new Error("Unknown function name '"+j+"' for timeago")}this.each(function(){i.call(this,h)});return this};function c(){var h=g.settings;if(h.autoDispose&&!d.contains(document.documentElement,this)){d(this).timeago("dispose");return this}var i=b(this);if(!isNaN(i.datetime)){if(h.cutoff===0||Math.abs(f(i.datetime))0){d(this).text(d(this).attr("title"))}}}return this}function b(h){h=d(h);if(!h.data("timeago")){h.data("timeago",{datetime:g.datetime(h)});var i=d.trim(h.text());if(g.settings.localeTitle){h.attr("title",h.data("timeago").datetime.toLocaleString())}else{if(i.length>0&&!(g.isTime(h)&&h.attr("title"))){h.attr("title",i)}}}return h.data("timeago")}function a(h){return g.inWords(f(h))}function f(h){return(new Date().getTime()-h.getTime())}document.createElement("abbr");document.createElement("time")}));
\ No newline at end of file
diff --git a/erp_web/js/json2.js b/erp_web/js/json2.js
deleted file mode 100644
index f0891924..00000000
--- a/erp_web/js/json2.js
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- json2.js
- 2012-10-08
-
- Public Domain.
-
- NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-
- See http://www.JSON.org/js.html
-
-
- This code should be minified before deployment.
- See http://javascript.crockford.com/jsmin.html
-
- USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
- NOT CONTROL.
-
-
- This file creates a global JSON object containing two methods: stringify
- and parse.
-
- JSON.stringify(value, replacer, space)
- value any JavaScript value, usually an object or array.
-
- replacer an optional parameter that determines how object
- values are stringified for objects. It can be a
- function or an array of strings.
-
- space an optional parameter that specifies the indentation
- of nested structures. If it is omitted, the text will
- be packed without extra whitespace. If it is a number,
- it will specify the number of spaces to indent at each
- level. If it is a string (such as '\t' or ' '),
- it contains the characters used to indent at each level.
-
- This method produces a JSON text from a JavaScript value.
-
- When an object value is found, if the object contains a toJSON
- method, its toJSON method will be called and the result will be
- stringified. A toJSON method does not serialize: it returns the
- value represented by the name/value pair that should be serialized,
- or undefined if nothing should be serialized. The toJSON method
- will be passed the key associated with the value, and this will be
- bound to the value
-
- For example, this would serialize Dates as ISO strings.
-
- Date.prototype.toJSON = function (key) {
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- return this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z';
- };
-
- You can provide an optional replacer method. It will be passed the
- key and value of each member, with this bound to the containing
- object. The value that is returned from your method will be
- serialized. If your method returns undefined, then the member will
- be excluded from the serialization.
-
- If the replacer parameter is an array of strings, then it will be
- used to select the members to be serialized. It filters the results
- such that only members with keys listed in the replacer array are
- stringified.
-
- Values that do not have JSON representations, such as undefined or
- functions, will not be serialized. Such values in objects will be
- dropped; in arrays they will be replaced with null. You can use
- a replacer function to replace those with JSON values.
- JSON.stringify(undefined) returns undefined.
-
- The optional space parameter produces a stringification of the
- value that is filled with line breaks and indentation to make it
- easier to read.
-
- If the space parameter is a non-empty string, then that string will
- be used for indentation. If the space parameter is a number, then
- the indentation will be that many spaces.
-
- Example:
-
- text = JSON.stringify(['e', {pluribus: 'unum'}]);
- // text is '["e",{"pluribus":"unum"}]'
-
-
- text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
- // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
-
- text = JSON.stringify([new Date()], function (key, value) {
- return this[key] instanceof Date ?
- 'Date(' + this[key] + ')' : value;
- });
- // text is '["Date(---current time---)"]'
-
-
- JSON.parse(text, reviver)
- This method parses a JSON text to produce an object or array.
- It can throw a SyntaxError exception.
-
- The optional reviver parameter is a function that can filter and
- transform the results. It receives each of the keys and values,
- and its return value is used instead of the original value.
- If it returns what it received, then the structure is not modified.
- If it returns undefined then the member is deleted.
-
- Example:
-
- // Parse the text. Values that look like ISO date strings will
- // be converted to Date objects.
-
- myData = JSON.parse(text, function (key, value) {
- var a;
- if (typeof value === 'string') {
- a =
-/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
- if (a) {
- return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
- +a[5], +a[6]));
- }
- }
- return value;
- });
-
- myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
- var d;
- if (typeof value === 'string' &&
- value.slice(0, 5) === 'Date(' &&
- value.slice(-1) === ')') {
- d = new Date(value.slice(5, -1));
- if (d) {
- return d;
- }
- }
- return value;
- });
-
-
- This is a reference implementation. You are free to copy, modify, or
- redistribute.
-*/
-
-/*jslint evil: true, regexp: true */
-
-/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
- call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
- getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
- lastIndex, length, parse, prototype, push, replace, slice, stringify,
- test, toJSON, toString, valueOf
-*/
-
-
-// Create a JSON object only if one does not already exist. We create the
-// methods in a closure to avoid creating global variables.
-
-if (typeof JSON !== 'object') {
- JSON = {};
-}
-
-(function () {
- 'use strict';
-
- function f(n) {
- // Format integers to have at least two digits.
- return n < 10 ? '0' + n : n;
- }
-
- if (typeof Date.prototype.toJSON !== 'function') {
-
- Date.prototype.toJSON = function (key) {
-
- return isFinite(this.valueOf())
- ? this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z'
- : null;
- };
-
- String.prototype.toJSON =
- Number.prototype.toJSON =
- Boolean.prototype.toJSON = function (key) {
- return this.valueOf();
- };
- }
-
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- gap,
- indent,
- meta = { // table of character substitutions
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '"' : '\\"',
- '\\': '\\\\'
- },
- rep;
-
-
- function quote(string) {
-
-// If the string contains no control characters, no quote characters, and no
-// backslash characters, then we can safely slap some quotes around it.
-// Otherwise we must also replace the offending characters with safe escape
-// sequences.
-
- escapable.lastIndex = 0;
- return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
- var c = meta[a];
- return typeof c === 'string'
- ? c
- : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- }) + '"' : '"' + string + '"';
- }
-
-
- function str(key, holder) {
-
-// Produce a string from holder[key].
-
- var i, // The loop counter.
- k, // The member key.
- v, // The member value.
- length,
- mind = gap,
- partial,
- value = holder[key];
-
-// If the value has a toJSON method, call it to obtain a replacement value.
-
- if (value && typeof value === 'object' &&
- typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
-
-// If we were called with a replacer function, then call the replacer to
-// obtain a replacement value.
-
- if (typeof rep === 'function') {
- value = rep.call(holder, key, value);
- }
-
-// What happens next depends on the value's type.
-
- switch (typeof value) {
- case 'string':
- return quote(value);
-
- case 'number':
-
-// JSON numbers must be finite. Encode non-finite numbers as null.
-
- return isFinite(value) ? String(value) : 'null';
-
- case 'boolean':
- case 'null':
-
-// If the value is a boolean or null, convert it to a string. Note:
-// typeof null does not produce 'null'. The case is included here in
-// the remote chance that this gets fixed someday.
-
- return String(value);
-
-// If the type is 'object', we might be dealing with an object or an array or
-// null.
-
- case 'object':
-
-// Due to a specification blunder in ECMAScript, typeof null is 'object',
-// so watch out for that case.
-
- if (!value) {
- return 'null';
- }
-
-// Make an array to hold the partial results of stringifying this object value.
-
- gap += indent;
- partial = [];
-
-// Is the value an array?
-
- if (Object.prototype.toString.apply(value) === '[object Array]') {
-
-// The value is an array. Stringify every element. Use null as a placeholder
-// for non-JSON values.
-
- length = value.length;
- for (i = 0; i < length; i += 1) {
- partial[i] = str(i, value) || 'null';
- }
-
-// Join all of the elements together, separated with commas, and wrap them in
-// brackets.
-
- v = partial.length === 0
- ? '[]'
- : gap
- ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
- : '[' + partial.join(',') + ']';
- gap = mind;
- return v;
- }
-
-// If the replacer is an array, use it to select the members to be stringified.
-
- if (rep && typeof rep === 'object') {
- length = rep.length;
- for (i = 0; i < length; i += 1) {
- if (typeof rep[i] === 'string') {
- k = rep[i];
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- } else {
-
-// Otherwise, iterate through all of the keys in the object.
-
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = str(k, value);
- if (v) {
- partial.push(quote(k) + (gap ? ': ' : ':') + v);
- }
- }
- }
- }
-
-// Join all of the member texts together, separated with commas,
-// and wrap them in braces.
-
- v = partial.length === 0
- ? '{}'
- : gap
- ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
- : '{' + partial.join(',') + '}';
- gap = mind;
- return v;
- }
- }
-
-// If the JSON object does not yet have a stringify method, give it one.
-
- if (typeof JSON.stringify !== 'function') {
- JSON.stringify = function (value, replacer, space) {
-
-// The stringify method takes a value and an optional replacer, and an optional
-// space parameter, and returns a JSON text. The replacer can be a function
-// that can replace values, or an array of strings that will select the keys.
-// A default replacer method can be provided. Use of the space parameter can
-// produce text that is more easily readable.
-
- var i;
- gap = '';
- indent = '';
-
-// If the space parameter is a number, make an indent string containing that
-// many spaces.
-
- if (typeof space === 'number') {
- for (i = 0; i < space; i += 1) {
- indent += ' ';
- }
-
-// If the space parameter is a string, it will be used as the indent string.
-
- } else if (typeof space === 'string') {
- indent = space;
- }
-
-// If there is a replacer, it must be a function or an array.
-// Otherwise, throw an error.
-
- rep = replacer;
- if (replacer && typeof replacer !== 'function' &&
- (typeof replacer !== 'object' ||
- typeof replacer.length !== 'number')) {
- throw new Error('JSON.stringify');
- }
-
-// Make a fake root object containing our value under the key of ''.
-// Return the result of stringifying the value.
-
- return str('', {'': value});
- };
- }
-
-
-// If the JSON object does not yet have a parse method, give it one.
-
- if (typeof JSON.parse !== 'function') {
- JSON.parse = function (text, reviver) {
-
-// The parse method takes a text and an optional reviver function, and returns
-// a JavaScript value if the text is a valid JSON text.
-
- var j;
-
- function walk(holder, key) {
-
-// The walk method is used to recursively walk the resulting structure so
-// that modifications can be made.
-
- var k, v, value = holder[key];
- if (value && typeof value === 'object') {
- for (k in value) {
- if (Object.prototype.hasOwnProperty.call(value, k)) {
- v = walk(value, k);
- if (v !== undefined) {
- value[k] = v;
- } else {
- delete value[k];
- }
- }
- }
- }
- return reviver.call(holder, key, value);
- }
-
-
-// Parsing happens in four stages. In the first stage, we replace certain
-// Unicode characters with escape sequences. JavaScript handles many characters
-// incorrectly, either silently deleting them, or treating them as line endings.
-
- text = String(text);
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' +
- ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
-
-// In the second stage, we run the text against regular expressions that look
-// for non-JSON patterns. We are especially concerned with '()' and 'new'
-// because they can cause invocation, and '=' because it can cause mutation.
-// But just to be safe, we want to reject all unexpected forms.
-
-// We split the second stage into 4 regexp operations in order to work around
-// crippling inefficiencies in IE's and Safari's regexp engines. First we
-// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
-// replace all simple value tokens with ']' characters. Third, we delete all
-// open brackets that follow a colon or comma or that begin the text. Finally,
-// we look to see that the remaining characters are only whitespace or ']' or
-// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
-
- if (/^[\],:{}\s]*$/
- .test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
- .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
- .replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
-
-// In the third stage we use the eval function to compile the text into a
-// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
-// in JavaScript: it can begin a block or an object literal. We wrap the text
-// in parens to eliminate the ambiguity.
-
- j = eval('(' + text + ')');
-
-// In the optional fourth stage, we recursively walk the new structure, passing
-// each name/value pair to a reviver function for possible transformation.
-
- return typeof reviver === 'function'
- ? walk({'': j}, '')
- : j;
- }
-
-// If the text is not JSON parseable, then a SyntaxError is thrown.
-
- throw new SyntaxError('JSON.parse');
- };
- }
-}());
\ No newline at end of file
diff --git a/erp_web/js/my97/WdatePicker.js b/erp_web/js/my97/WdatePicker.js
deleted file mode 100644
index 3f21bf4f..00000000
--- a/erp_web/js/my97/WdatePicker.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * My97 DatePicker 4.8
- * License: http://www.my97.net/license.asp
- */
-var $dp,WdatePicker;(function(){var l={
-$langList:[
-{name:"en",charset:"UTF-8"},
-{name:"zh_CN",charset:"UTF-8"},
-{name:"zh_TW",charset:"UTF-8"}
-],
-$skinList:[
-{name:"default",charset:"gb2312"},
-{name:"whyGreen",charset:"gb2312"},
-{name:"blue",charset:"gb2312"},
-{name:"green",charset:"gb2312"},
-{name:"simple",charset:"gb2312"},
-{name:"ext",charset:"gb2312"},
-{name:"blueFresh",charset:"gb2312"},
-{name:"twoer",charset:"gb2312"},
-{name:"YcloudRed",charset:"gb2312"}],
-$wdate:true,
-$crossFrame:false,
-$preLoad:false,
-$dpPath:"",
-doubleCalendar:false,
-enableKeyboard:true,
-enableInputMask:true,
-autoUpdateOnChanged:null,
-weekMethod:"MSExcel",
-position:{},
-lang:(window.lang || "auto"),
-skin:"twoer",//更改默认主题
-dateFmt:"yyyy-MM-dd",
-realDateFmt:"yyyy-MM-dd",
-realTimeFmt:"HH:mm:ss",
-realFullFmt:"%Date %Time",
-minDate:"0001-01-01 00:00:00",
-maxDate:"9999-12-31 23:59:59",
-minTime:"00:00:00",
-maxTime:"23:59:59",
-startDate:"",
-alwaysUseStartDate:false,
-yearOffset:1911,
-firstDayOfWeek:1,//星期的第一天,0:星期日 1:星期一 以此类推
-isShowWeek:false,
-highLineWeekDay:true,
-isShowClear:true,
-isShowToday:true,
-isShowOK:true,
-isShowOthers:true,
-readOnly:false,
-errDealMode:0,
-autoPickDate:null,
-qsEnabled:true,
-autoShowQS:false,
-hmsMenuCfg:{H:[1,6],m:[5,6],s:[15,4]},
-
-opposite:false,specialDates:null,specialDays:null,disabledDates:null,disabledDays:null,onpicking:null,onpicked:null,onclearing:null,oncleared:null,ychanging:null,ychanged:null,Mchanging:null,Mchanged:null,dchanging:null,dchanged:null,Hchanging:null,Hchanged:null,mchanging:null,mchanged:null,schanging:null,schanged:null,eCont:null,vel:null,elProp:"",errMsg:"",quickSel:[],has:{},getRealLang:function(){var d=l.$langList;for(var e=0;e0?1:0;var K=new Date(this.dt.y,this.dt.M,0).getDate();this.dt.d=Math.min(K+M,this.dt.d)}}}}if(this.dt.refresh()){return this.dt}}return""},show:function(){var K=E[z].getElementsByTagName("div"),J=100000;for(var e=0;eJ){J=L}}this.dd.style.zIndex=J+2;r(this.dd,"block");r(this.dd.firstChild,"")},unbind:function(e){e=this.$(e);if(e.initcfg){t(e,"onclick",function(){g(e.initcfg)});t(e,"onfocus",function(){g(e.initcfg)})}},hide:function(){r(this.dd,"none")},attachEvent:k};for(var d in w){E.$dp[d]=w[d]}$dp=E.$dp}function k(I,J,w,d){if(I.addEventListener){var e=J.replace(/on/,"");w._ieEmuEventHandler=function(K){return w(K)};I.addEventListener(e,w._ieEmuEventHandler,d)}else{I.attachEvent(J,w)}}function t(w,I,e){if(w.removeEventListener){var d=I.replace(/on/,"");e._ieEmuEventHandler=function(J){return e(J)};w.removeEventListener(d,e._ieEmuEventHandler,false)}else{w.detachEvent(I,e)}}function C(w,e,d){if(typeof w!=typeof e){return false}if(typeof w=="object"){if(!d){for(var I in w){if(typeof e[I]=="undefined"){return false}if(!C(w[I],e[I],true)){return false}}}return true}else{if(typeof w=="function"&&typeof e=="function"){return w.toString()==e.toString()}else{return w==e}}}function q(){var I,w,d=n[z][H]("script");for(var e=0;e0){I=I.substring(0,w+1)}if(I){break}}return I}function m(w,I,J){var d=n[z][H]("HEAD").item(0),e=n[z].createElement("link");if(d){e.href=w;e.rel="stylesheet";e.type="text/css";if(I){e.title=I}if(J){e.charset=J}d.appendChild(e)}}function p(I){I=I||E;var L=0,d=0;while(I!=E){var N=I.parent[z][H]("iframe");for(var J=0;JI.scrollTop||d.scrollLeft>I.scrollLeft))?d:I;return{top:J.scrollTop,left:J.scrollLeft}}function s(d){try{var w=d?(d.srcElement||d.target):null;if($dp.cal&&!$dp.eCont&&$dp.dd&&w!=$dp.el&&$dp.dd.style.display=="block"){$dp.cal.close()}}catch(d){}}function A(){$dp.status=2}var G,j;function g(M,d){if(!$dp){return}b();var J={};for(var L in M){J[L]=M[L]}for(var L in l){if(L.substring(0,1)!="$"&&J[L]===undefined){J[L]=l[L]}}if(d){if(!w()){j=j||setInterval(function(){if(E[z].readyState=="complete"){clearInterval(j)}g(null,true)},50);return}if($dp.status==0){$dp.status=1;J.el=i;a(J,true)}else{return}}else{if(J.eCont){J.eCont=$dp.$(J.eCont);J.el=i;J.autoPickDate=true;J.qsEnabled=false;a(J)}else{if(l.$preLoad&&$dp.status!=2){return}var I=N();if(n.event===I||I){J.srcEl=I.srcElement||I.target;I.cancelBubble=true}J.el=J.el=$dp.$(J.el||J.srcEl);if(J.el==null){alert("WdatePicker:el is null!\nexample:onclick=\"WdatePicker({el:this})\"");return;}try{if(!J.el||J.el.My97Mark===true||J.el.disabled||($dp.dd&&r($dp.dd)!="none"&&$dp.dd.style.left!="-970px")){if(J.el.My97Mark){J.el.My97Mark=false}return}}catch(K){}if(I&&J.el.nodeType==1&&!C(J.el.initcfg,M)){$dp.unbind(J.el);k(J.el,I.type=="focus"?"onclick":"onfocus",function(){g(M)});J.el.initcfg=M}a(J)}}function w(){if(h&&E!=n&&E[z].readyState!="complete"){return false}return true}function N(){if(f){try{func=N.caller;while(func!=null){var O=func.arguments[0];if(O&&(O+"").indexOf("Event")>=0){return O}func=func.caller}}catch(P){}return null}return event}}function c(e,d){return e.currentStyle?e.currentStyle[d]:document.defaultView.getComputedStyle(e,false)[d]}function r(e,d){if(e){if(d!=null){e.style.display=d}else{return c(e,"display")}}}function a(e,d){var K=e.el?e.el.nodeName:"INPUT";if(d||e.eCont||new RegExp(/input|textarea|div|span|p|a/ig).test(K)){e.elProp=K=="INPUT"?"value":"innerHTML"}else{return}if(e.lang=="auto"){e.lang=h?navigator.browserLanguage.toLowerCase():navigator.language.toLowerCase()}if(!e.eCont){for(var J in e){$dp[J]=e[J]}}if(!$dp.dd||e.eCont||($dp.dd&&(e.getRealLang().name!=$dp.dd.lang||e.skin!=$dp.dd.skin))){if(e.eCont){w(e.eCont,e)}else{$dp.dd=E[z].createElement("DIV");$dp.dd.style.cssText="position:absolute";E[z].body.appendChild($dp.dd);w($dp.dd,e);if(d){$dp.dd.style.left=$dp.dd.style.top="-970px"}else{$dp.show();I($dp)}}}else{if($dp.cal){$dp.show();$dp.cal.init();if(!$dp.eCont){I($dp)}}}function w(V,P){var O=E[z].domain,S=false,M='';V.innerHTML=M;var L=l.$langList,U=l.$skinList,T;try{T=V.lastChild.contentWindow[z]}catch(Q){S=true;V.removeChild(V.lastChild);var N=E[z].createElement("iframe");N.hideFocus=true;N.frameBorder=0;N.scrolling="no";N.src="javascript:(function(){var d=document;d.open();d.domain='"+O+"';})()";V.appendChild(N);setTimeout(function(){T=V.lastChild.contentWindow[z];R()},97);return}R();function R(){var Y=P.getRealLang();V.lang=Y.name;V.skin=P.skin;var X=["