Guest User

Untitled

a guest
Dec 10th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. function 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.  
  6. var allowed={
  7. //以下是个人默认的
  8. "黑山之起源":1,"黑山之起源":1,
  9. //下面的是申请使用的
  10. "世萌":9,//临时 -> 100
  11. "":1000
  12. };
  13.  
  14. if (gl>=allowed[this._data_postor.kw]) {
  15. this._option.open_idisk=true;
  16. this._option.power_idisk=true;
  17. this._option.upload_max_length=(gl>8?3:(gl>6?2:(gl>4?1:0)));
  18. this._option.upload_max_size=fact(Math.round(gl+3-Math.pow(allowed[this._data_postor.kw],0.8)))*256-25*1024;
  19. this._editor.addPlugin("idisk", new TED.EditorPlugins.IdiskPlugin(allowed[this._data_postor.kw]?true:false, this._data_postor.fid, this._option.upload_max_length, this._option.upload_max_size));
  20. this._editor.on("idisk_upload_complete", function(e) {
  21. var h = this.getPostorDataObj("files");
  22. h = h || [];
  23. h.push({name: e.name,size: e.size,bucket: e.bucket,md5: e.md5,fileid: e.fileid});
  24. this.setPostorDataObj("files", h)
  25. }, this);
  26. this._editor.on("idisk_remove_file", function(l) {
  27. var k = this.getPostorDataObj("files");
  28. if (!k) {
  29. return
  30. }
  31. for (var h = 0, e = k.length; h < e; h++) {
  32. if (k[h]["bucket"] === l) {
  33. k.splice(h, 1);
  34. if (k.length === 0) {
  35. this.setPostorData("files", undefined)
  36. } else {
  37. this.setPostorDataObj("files", k)
  38. }
  39. return
  40. }
  41. }
  42. }, this)
  43. }
  44. }
  45.  
  46. rich_postor._init_idisk()
Add Comment
Please, Sign In to add comment