gnopaste

Name
Anonymous
Scriptlanguage
PHP
Tabwidth
4
Date
11/19/2008 06:49:20 pm
IP
77.177.233.117

The user was too lazy to give a description

  1. $(window).load(function () {
  2.     if($("#uploadtable").length>0){
  3.     var swfutotalul = 0;
  4.     var swfutotalfinished = 0;
  5.     var swfu;
  6.     function calcfilesize( s ){
  7.         s = Math.round(s / 1024);
  8.         tp = " kb"
  9.         if( s > 1024 ){
  10.             s = Math.round( s / 1024 );
  11.             tp = " Mb";
  12.         }
  13.         return s+tp;
  14.     }
  15.     function calctotalul(){
  16.         var file = swfu.getFile();
  17.         var completesize = 0;
  18.         while( file !== null){
  19.             completesize += file.size;
  20.             file = swfu.getFile(file.index+1);
  21.         }
  22.         return completesize;
  23.     }
  24.     function fileDialogComplete(numsel, numnewqueue, numtotalqueue){
  25.         $("#uploadtable").removeClass("hidden");
  26.         swfu.setButtonText("<span class='theFont'>+ Weitere Bilder</span>");
  27.         $("#uploadbt").removeClass("hidden");
  28.         
  29.     };
  30.     function fileQueueError(file, error, message){
  31.         alert("Fehler beim Hinzuf&uuml;gen der Datei"+file.name+": "+message);
  32.     }
  33.     
  34.     function dateiaufnahme(file){
  35.         $("#uploadtable").find("tbody").append("<tr><td><div class='vertprogress'></div>"+file.name+"</td><td>"+calcfilesize(file.size)+"</td><td><img src='modules/fgallery/supportfiles/images/dec_delete.png' class='remove' id='"+file.id+"'/></tr>");
  36.         $(".remove").bind("click",function(){
  37.             swfu.cancelUpload($(this).attr("id"));
  38.             $(this).parent().parent().css({"background-color":"#fdd98b"}).fadeOut();
  39.             $(".uldesc").html("Insgesamt hast du "+calcfilesize(calctotalul())+" ausgew&auml;hlt.");
  40.         });
  41.         $(".uldesc").html("Insgesamt hast du "+calcfilesize(calctotalul())+" ausgew&auml;hlt.");
  42.     }
  43.     
  44.     function uploadComplete(f){
  45.         alert("BA");
  46.         swfutotalfinished += f.size;
  47.         var nextfile = swfu.getFile(f.index+1)
  48.         if( nextfile !== null){
  49.             swfu.startUpload(nextfile.id);
  50.         }
  51.         $("#uploadtable tbody").find("tr:eq("+f.index+")").css({"background-color":"#68B17B"}).find(".remove").hide();
  52.         updatestatics(f,1,1);
  53.     }
  54.     function uploadProgress(f, bc, bt){
  55.         updatestatics(f, bc,bt);
  56.     }
  57.     function  ulerror(f, ec, message){
  58.         alert(message);
  59.     }
  60.     
  61.     function updatestatics(f,bc,bt){
  62.         fpercent = bc / bt;
  63.         calcheight = 32*fpercent;
  64.         $("#uploadtable tbody").find("tr:eq("+f.index+")").find(".vertprogress").height(calcheight);
  65.         
  66.         tpercent = ( (swfutotalfinished + bc) / swfutotalul );
  67.         $(".totalul").width(tpercent*460);
  68.         
  69.         $(".uldesc").html("Bereits "+(swfutotalfinished + bc)+" von insgesamt "+swfutotalul+" Byte hochgeladen. ("+Math.round(tpercent * 100)+"%)");
  70.         if(Math.round(tpercent * 100) == 100){
  71.             allUploadsFinished();
  72.         }        
  73.     }
  74.     
  75.     function debug_function(b){
  76.         alert(b);
  77.     }
  78.     function ulsuccess(a,b){
  79.         alert("bla "+b);
  80.     }
  81.     
  82.     swfu = new SWFUpload({
  83.         upload_url : "../admin.php?ajaxaction=upload&directory=Rihanna",
  84.         flash_url : "modules/fgallery/swfupload/swfupload.swf",
  85.         file_types : "*.jpg;*.jpeg;*.png",
  86.         file_types_description : "All Files",
  87.         file_size_limit : "5 MB",
  88.         button_placeholder_id: "swfuploader",
  89.         button_text: '<span class="theFont">Bilder suchen</span>',
  90.         button_width: "150",
  91.         button_height: "20",
  92.         button_text_style: ".theFont { font-size: 18px; color: #6666A6; cursor: pointer;}",
  93.         button_text_left_padding: 5,
  94.         button_text_top_padding: 4,
  95.         file_queued_handler : dateiaufnahme,
  96.         file_queue_error_handler : fileQueueError,
  97.         upload_error_handler : ulerror,
  98.         upload_complete_handler : uploadComplete,
  99.         upload_success_handler : ulsuccess,
  100.         upload_progress_handler : uploadProgress,
  101.         file_dialog_complete_handler : fileDialogComplete,
  102.         debug_handler : debug_function
  103.      });
  104.     $("#uploadbt").click(function(){
  105.         swfu.setButtonDimensions(0,0);
  106.         $(this).hide();
  107.         $(".totalul").removeClass("hidden");
  108.         swfutotalul = calctotalul();
  109.         swfu.startUpload();
  110.     });
  111.     
  112.     function allUploadsFinished(){
  113. //        $("#uploadtable").slideUp();
  114.     }
  115. }    
  116. });
submitter » gnopaster | imprint « imprint     
» Terms of use «
» digital bit dot ch - t4c's new home «