Jquery plugins zzImgUr

5 bài đăng
16.02.2017 / 21:55
manhhung
Bài đăng: 458
Member

Bước 1: Đăng kí Client ID tại https://api.imgur.com/oauth2/addclient

Bước 2: thay id vừa lấy được vào đòng ClientID:..." trong đoạn js dưới.

JAVASCRIPT
  1. <script src="http://code.jquery.com/jquery-1.10.1.js" type="text/javascript"></script>
  2. <!-- zzImgUr plugin -->
  3. <script src="http://loto366.wap.sh/upload.js" type="text/javascript"></script>
  4. <style>
  5. .imgur_Zzbv,.imgur_Zzbv *{box-sizing:content-box;-moz-boxsizing:content-box;-webkit-box-sizing:content-box;margin:0;padding:0}
  6. .imgur_Zzbv input{-webkit-user-select:initial;-moz-user-select:initial;-ms-user-select:initial;user-select:initial}
  7. .imgur_Zzbv{border:1px solid #333;background:#FFF;height:auto}
  8. .imgur_Zzbv-iconError,.imgur_Zzbv-iconDevs,.imgur_Zzbv-delete,.imgur_Zzbv-remove,.imgur_Zzbv-iconSelect,.imgur_Zzbv-button div img,.imgur_Zzbv-iconComplete,.imgur_Zzbv-iconImage{display:inline-block;background:url(http://i.imgur.com/e9GpBzF.png) no-repeat center center;width:16px;height:16px;float:left;margin:7px}
  9. .imgur_Zzbv-iconDevs{background-position:0 0}
  10. .imgur_Zzbv-iconComplete{background-position:-32px -16px}
  11. .imgur_Zzbv-status img{margin:0}
  12. .imgur_Zzbv-iconError{background-position:0 -32px}
  13. .imgur_Zzbv-iconSelect{background-position:0 -16px}
  14. .imgur_Zzbv-iconUpload{background-position:-16px -16px}
  15. .imgur_Zzbv-button div img.imgur_Zzbv-iconReset{background-position:-16px 0}
  16. .imgur_Zzbv-iconImage{background-position:-16px -32px}
  17. .imgur_Zzbv-iconImage.imgur_Zzbv-iconUrl{background-position:-32px -32px}
  18. .imgur_Zzbv-mode{cursor:pointer;width:30px;height:30px;float:left;background-color:#FF475D}
  19. .imgur_Zzbv-mode.imgur_Zzbv-zzURL{background-color:#0B704C}
  20. .imgur_Zzbv-button div{cursor:pointer;background-color:#359BED;border:0;height:30px;display:none;padding:0 10px 0 0}
  21. .imgur_Zzbv-button .imgur_Zzbv-reset{background-color:#01686D}
  22. .imgur_Zzbv-delete,.imgur_Zzbv-remove{background-position:-32px 0;position:absolute;right:3px;top:3px;height:16px;width:16px;text-indent:-9999px;overflow:hidden;background-color:transparent;margin:0}
  23. .imgur_Zzbv-control{position:relative;height:30px;line-height:30px;overflow:hidden;background:#333;color:#FFF}
  24. .imgur_Zzbv-preview{overflow-y:auto;overflow-x:hidden}
  25. .imgur_Zzbv-li{background:#f2f2f2;list-style-type:none;position:relative;height:68px;border-top:1px solid #DDD;overflow:hidden}
  26. .imgur_Zzbv-li:first-child{border-top:0 none}
  27. .imgur_Zzbv-li:nth-child(2n){background:#E7E6E6}
  28. .imgur_Zzbv-li:hover{background:#007CEE;color:#FFF}
  29. .imgur_Zzbv-li.imgur_Zzbv-success{background:#FFFFA1}
  30. .imgur_Zzbv-image{width:100px;overflow:hidden;position:absolute;height:100%}
  31. .imgur_Zzbv-image img{max-width:100%;max-height:100%;position:absolute;top:0;right:0;bottom:0;left:0;margin:auto}
  32. .imgur_Zzbv-info{position:absolute;left:100px;top:0;right:0;height:100%}
  33. .imgur_Zzbv-info > *{white-space:nowrap}
  34. .imgur_Zzbv-dl{line-height:34px}
  35. .imgur_Zzbv-dl > div{height:34px}
  36. .imgur_Zzbv-dt{float:left;width:70px;font-weight:300;font-size:12px}
  37. .imgur_Zzbv input.imgur_Zzbv-input{width:calc(100% - 84px)!important;height:16px!important;line-height:16px!important;margin:8px 0!important;padding:0!important}
  38. .imgur_Zzbv-status{position:absolute;width:16px;height:16px;line-height:16px;left:5px;top:7px;display:none}
  39. .imgur_Zzbv-add{cursor:pointer;position:absolute;width:100px;height:30px;overflow:hidden;background:orange;left:30px;top:0;z-index:10}
  40. .imgur_Zzbv-upload-URL.imgur_Zzbv-add{background:#C100E6}
  41. .imgur_Zzbv-textSelect{font-size:12px;position:absolute;width:100%;left:30px;height:30px;line-height:30px}
  42. .imgur_Zzbv-choose{cursor:pointer;z-index:10;opacity:0;filter:alpha(opacity=0);-moz-opacity:0;font-size:300px;height:1000px;right:0;top:0;position:absolute}
  43. .imgur_Zzbv-length{position:absolute;width:50px;text-align:center;top:0;left:50%;margin-left:-25px;display:none}
  44. .imgur_Zzbv-button{position:absolute;width:90px;right:0;top:0;white-space:nowrap;z-index:10}
  45. .imgur_Zzbv-mode:hover,.imgur_Zzbv-button div:hover,.imgur_Zzbv-add:hover{background-color:#666}
  46. .imgur_Zzbv-devs-icon{position:absolute;right:0;top:0;line-height:16px}
  47. .imgur_Zzbv-tip{height:24px;font-size:13px;font-style:italic;line-height:26px}
  48. .imgur_Zzbv-tip img{vertical-align:middle;float:none;margin:-4px 0 0}
  49. .imgur_Zzbv-wrap-progress{background:#FFF;height:3px;border:0;position:absolute;bottom:0;left:-100px;right:0}
  50. .imgur_Zzbv-progress{height:3px;background:red;width:1px}
  51. .imgur_Zzbv-errorURL{color:red}
  52. .imgur_Zzbv input.imgur_Zzbv-imageURL{width:calc(100% - 11px)!important;border:0 none!important;box-shadow:0 0 0 1px #DDD!important;height:16px!important;line-height:16px!important;margin:0 0 0 1px !important}
  53. .imgur_Zzbv-mini .imgur_Zzbv-button,.imgur_Zzbv-mini .imgur_Zzbv-add{width:30px}
  54. .imgur_Zzbv-mini .imgur_Zzbv-info{left:10px}
  55. .imgur_Zzbv-mini .imgur_Zzbv-wrap-progress{left:-10px}
  56. .imgur_Zzbv-upload-URL,.imgur_Zzbv-mini .imgur_Zzbv-image{display:none}
  57.  
  58. </style>
  59. <script type="text/javascript">//<![CDATA[
  60. $(function(){
  61. $(".upload").zzImgUr({
  62. cliendID: "b06b8a437c0a212",
  63. mode: "file",
  64. format: "o,",
  65. css: {
  66. width: "100%"
  67. },
  68. max: 10,
  69. loading: "http://i.imgur.com/m3NXDa6.gif",
  70. lang: {
  71. noID: "Ứng dụng chưa đăng kí",
  72. addImage: "Chọn ảnh",
  73. addURL: "Thêm URL",
  74. reset: "Làm mới",
  75. upload: "Tải lên",
  76. choose: "Đã chọn",
  77. waitConnect: "Đang kết nối...",
  78. waitUpload: "Đang tải lên",
  79. noteURL: "Nhập URL ảnh vào đây: ",
  80. errContact: '<a href="http://devs.forumvi.com/t131-jq-plugin-jquery-plugin-zzimgur#831" rel="nofollow" target="_blank">Nhấn vào đây</a> để báo lỗi.',
  81. errURL: "URL khômg truy cập được.",
  82. errSize: "URL lỗi hoặc kích thước quá nhỏ.",
  83. errRepeat: "URL không hợp lệ hoặc đã được sử dụng."
  84. },
  85. success: function (firstVal, arrVal) {
  86. console.log(firstVal);
  87. console.log(arrVal);
  88. },
  89. input: function (arrInput) {
  90. console.log(arrInput);
  91. arrInput.click(function () {
  92. this.select();
  93. console.log(this);
  94. });
  95. },
  96. remove: function (firstVal, arrVal) {
  97. console.log(firstVal);
  98. console.log(arrVal);
  99. }
  100. });
  101. });//]]>
  102.  
  103. </script><div class="upload"></div>

share by: manhhung(adukawa)]

16.02.2017 / 22:50
TrieuLuan
Bài đăng: 453
Member
Happy New Year

Upload ảnh ko load à :v

17.02.2017 / 06:05
manhhung
Bài đăng: 458
Member

đúng rùi bạn ạ

17.02.2017 / 08:14
Jichan
Bài đăng: 1028
Member
Mệt cứ nói, đừng cố....

Code này cho chatbot...nhưng k biết thêm sao...

03.04.2017 / 23:37
b0ysh0ckhn
Bài đăng: 1146
Member
Nguyễn Minh Phương

code by (mạng) :D