Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 1.66 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. unction fact(n){return n>1?n*fact(n-1):1;}
  2. RichPostor.prototype._init_idisk=function(){
  3.         var gl=this._option.bavl;
  4. try{this._option.userInfo.user.power.idisk=true;}catch(e){}
  5.         var allowed={
  6.                 "深圳大学":5,
  7.                 "2012":5
  8.                 };
  9.         if (gl>=allowed[this._data_postor.kw]) {
  10.                         this._option.open_idisk=true;
  11.                         this._option.power_idisk=true;
  12.                         this._option.upload_max_length=(gl>8?3:(gl>6?2:(gl>4?1:0)));
  13.                         this._option.upload_max_size=fact(gl)*256-25*1024;
  14.                         this._editor.addPlugin("idisk", new TED.EditorPlugins.IdiskPlugin(this._option.power_idisk, this._data_postor.fid, this._option.upload_max_length, this._option.upload_max_size));
  15.             this._editor.on("idisk_upload_complete", function(e) {
  16.                 var h = this.getPostorDataObj("files");
  17.                 h = h || [];
  18.                 h.push({name: e.name,size: e.size,bucket: e.bucket,md5: e.md5,fileid: e.fileid});
  19.                 this.setPostorDataObj("files", h)
  20.             }, this);
  21.             this._editor.on("idisk_remove_file", function(l) {
  22.                 var k = this.getPostorDataObj("files");
  23.                 if (!k) {
  24.                     return
  25.                 }
  26.                 for (var h = 0, e = k.length; h < e; h++) {
  27.                     if (k[h]["bucket"] === l) {
  28.                         k.splice(h, 1);
  29.                         if (k.length === 0) {
  30.                             this.setPostorData("files", undefined)
  31.                         } else {
  32.                             this.setPostorDataObj("files", k)
  33.                         }
  34.                         return
  35.                     }
  36.                 }
  37.             }, this)
  38.         }
  39. }
  40.  
  41. rich_postor._init_idisk()