You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
6.9 KiB

1 year ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /**
  2. * Theme: Codefox Admin Template
  3. * Author: Coderthemes
  4. * Email: coderthemes@gmail.com
  5. * File Uploads
  6. */
  7. $(document).ready(function(){
  8. 'use-strict';
  9. //Example single
  10. $('#filer_input_single').filer({
  11. extensions: ['jpg', 'jpeg', 'png', 'gif', 'psd'],
  12. changeInput: true,
  13. showThumbs: true,
  14. addMore: false
  15. });
  16. //Example 2
  17. $('#filer_input').filer({
  18. limit: 3,
  19. maxSize: 3,
  20. extensions: ['jpg', 'jpeg', 'png', 'gif', 'psd'],
  21. changeInput: true,
  22. showThumbs: true,
  23. addMore: true
  24. });
  25. //Example 1
  26. $("#filer_input1").filer({
  27. limit: null,
  28. maxSize: null,
  29. extensions: null,
  30. changeInput: '<div class="jFiler-input-dragDrop"><div class="jFiler-input-inner"><div class="jFiler-input-icon"><i class="icon-jfi-cloud-up-o"></i></div><div class="jFiler-input-text"><h3>Drag & Drop files here</h3> <span style="display:inline-block; margin: 15px 0">or</span></div><a class="jFiler-input-choose-btn btn btn-primary waves-effect waves-light">Browse Files</a></div></div>',
  31. showThumbs: true,
  32. theme: "dragdropbox",
  33. templates: {
  34. box: '<ul class="jFiler-items-list jFiler-items-grid"></ul>',
  35. item: '<li class="jFiler-item">\
  36. <div class="jFiler-item-container">\
  37. <div class="jFiler-item-inner">\
  38. <div class="jFiler-item-thumb">\
  39. <div class="jFiler-item-status"></div>\
  40. <div class="jFiler-item-info">\
  41. <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\
  42. <span class="jFiler-item-others">{{fi-size2}}</span>\
  43. </div>\
  44. {{fi-image}}\
  45. </div>\
  46. <div class="jFiler-item-assets jFiler-row">\
  47. <ul class="list-inline pull-left">\
  48. <li>{{fi-progressBar}}</li>\
  49. </ul>\
  50. <ul class="list-inline pull-right">\
  51. <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\
  52. </ul>\
  53. </div>\
  54. </div>\
  55. </div>\
  56. </li>',
  57. itemAppend: '<li class="jFiler-item">\
  58. <div class="jFiler-item-container">\
  59. <div class="jFiler-item-inner">\
  60. <div class="jFiler-item-thumb">\
  61. <div class="jFiler-item-status"></div>\
  62. <div class="jFiler-item-info">\
  63. <span class="jFiler-item-title"><b title="{{fi-name}}">{{fi-name | limitTo: 25}}</b></span>\
  64. <span class="jFiler-item-others">{{fi-size2}}</span>\
  65. </div>\
  66. {{fi-image}}\
  67. </div>\
  68. <div class="jFiler-item-assets jFiler-row">\
  69. <ul class="list-inline pull-left">\
  70. <li><span class="jFiler-item-others">{{fi-icon}}</span></li>\
  71. </ul>\
  72. <ul class="list-inline pull-right">\
  73. <li><a class="icon-jfi-trash jFiler-item-trash-action"></a></li>\
  74. </ul>\
  75. </div>\
  76. </div>\
  77. </div>\
  78. </li>',
  79. progressBar: '<div class="bar"></div>',
  80. itemAppendToEnd: false,
  81. removeConfirmation: true,
  82. _selectors: {
  83. list: '.jFiler-items-list',
  84. item: '.jFiler-item',
  85. progressBar: '.bar',
  86. remove: '.jFiler-item-trash-action'
  87. }
  88. },
  89. dragDrop: {
  90. dragEnter: null,
  91. dragLeave: null,
  92. drop: null,
  93. },
  94. uploadFile: {
  95. url: "../plugins/jquery.filer/php/upload.php",
  96. data: null,
  97. type: 'POST',
  98. enctype: 'multipart/form-data',
  99. beforeSend: function(){},
  100. success: function(data, el){
  101. var parent = el.find(".jFiler-jProgressBar").parent();
  102. el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
  103. $("<div class=\"jFiler-item-others text-success\"><i class=\"icon-jfi-check-circle\"></i> Success</div>").hide().appendTo(parent).fadeIn("slow");
  104. });
  105. },
  106. error: function(el){
  107. var parent = el.find(".jFiler-jProgressBar").parent();
  108. el.find(".jFiler-jProgressBar").fadeOut("slow", function(){
  109. $("<div class=\"jFiler-item-others text-error\"><i class=\"icon-jfi-minus-circle\"></i> Error</div>").hide().appendTo(parent).fadeIn("slow");
  110. });
  111. },
  112. statusCode: null,
  113. onProgress: null,
  114. onComplete: null
  115. },
  116. files: [
  117. {
  118. name: "Desert.jpg",
  119. size: 145,
  120. type: "image/jpg",
  121. file: "../files/assets/images/file-upload/Desert.jpg"
  122. },
  123. {
  124. name: "overflow.jpg",
  125. size: 145,
  126. type: "image/jpg",
  127. file: "../files/assets/images/file-upload/Desert.jpg"
  128. }
  129. ],
  130. addMore: false,
  131. clipBoardPaste: true,
  132. excludeName: null,
  133. beforeRender: null,
  134. afterRender: null,
  135. beforeShow: null,
  136. beforeSelect: null,
  137. onSelect: null,
  138. afterShow: null,
  139. onRemove: function(itemEl, file, id, listEl, boxEl, newInputEl, inputEl){
  140. var file = file.name;
  141. $.post('../plugins/jquery.filer/php/remove_file.php', {file: file});
  142. },
  143. onEmpty: null,
  144. options: null,
  145. captions: {
  146. button: "Choose Files",
  147. feedback: "Choose files To Upload",
  148. feedback2: "files were chosen",
  149. drop: "Drop file here to Upload",
  150. removeConfirmation: "Are you sure you want to remove this file?",
  151. errors: {
  152. filesLimit: "Only {{fi-limit}} files are allowed to be uploaded.",
  153. filesType: "Only Images are allowed to be uploaded.",
  154. filesSize: "{{fi-name}} is too large! Please upload file up to {{fi-maxSize}} MB.",
  155. filesSizeAll: "Files you've choosed are too large! Please upload files up to {{fi-maxSize}} MB."
  156. }
  157. }
  158. });
  159. });