/[drupal]/contributions/modules/video_upload/video_upload.js
ViewVC logotype

Contents of /contributions/modules/video_upload/video_upload.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Fri Jun 13 18:15:14 2008 UTC (17 months, 1 week ago) by jhedstrom
Branch: MAIN
CVS Tags: DRUPAL-6--1-4, DRUPAL-6--1-5, DRUPAL-6--1-0, DRUPAL-6--1-1, DRUPAL-6--1-2, DRUPAL-6--1-3, HEAD
Branch point for: DRUPAL-6--1, DRUPAL-7--1
Changes since 1.3: +2 -6 lines
File MIME type: text/javascript
Starting the port to 6.x.
1 // $Id: video_upload.js,v 1.3 2008/05/26 17:05:36 jhedstrom Exp $
2
3 /**
4 * @file
5 * jquery for Video Upload module
6 */
7
8 /**
9 * Attach validation behavior to the form
10 */
11 Drupal.behaviors.videoUploadValidateAccept = function() {
12 /**
13 * Client-side validation of the input (if type = file) accept
14 * attribute
15 */
16 $("input[@type='file'].video-upload").change(function() {
17 Drupal.videoUploadValidateFile(this)
18 });
19 }
20
21 /**
22 * Attempt to validate file type based on the attach attribute of the
23 * file tag
24 */
25 Drupal.videoUploadValidateFile = function(file) {
26 $('.video-upload-js-error').remove();
27 if (file.accept.length > 1){
28 acc = new RegExp('\\.(' + (file.accept ? file.accept : '') + ')$','gi');
29 if (!acc.test(file.value)) {
30 alert('The file ' + file.value + ' does not appear to be a video file.\n'
31 + 'Please use a video file with one of these extensions: \n' + file.accept.replace(/\|/g, ', ')
32 );
33 file.value = '';
34 return false;
35 }
36 }
37 return true;
38 };

  ViewVC Help
Powered by ViewVC 1.1.2