PageSourceSearch

https://upload.cc/js/app.js?v=2.11

js upload.cc collected 2026-10-02 02:28:58 UTC 40,941 bytes, 856 lines download raw bytes

1  var selecting = false;
2  var item_selected_amount = 0;
3  var full_options = false;
4  var preview_bar_item_info = {};
5  var domain_url = "https://upload.cc/";
6  var upload_history_count = 0;
7  var upload_history = new Array();
8  var default_share_link = "";
9  var direct_share_link = "";
10  var is_ad_show = false;
11  var is_modal_ad_show = false;
12  if(navigator.userAgent.indexOf("Mac OS X") > -1) {
13    $(".ctrl-key").html("Command");
14  } else {
15    $(".ctrl-key").html("Ctrl");
16  }
17  $(".addon-icon").on('click', function(event) {
18    event.stopPropagation();
19  });
20  $(".menu-icon").on('click', function(event) {
21    event.stopPropagation();
22    show_menu();
23  });
24  $(document).on('click', '.search_image', function(event){
25    show_search_bar();
26  });
27  $(document).on('click', '.copy_file_link', function(event){
28    copy_file_link();
29  });
30  $(document).on('click', '.share_file', function(event){
31    share_file();
32  });
33  $(document).on('click', '.delete_file', function(event){
34    delete_file();
35  });
36  $(document).on('click', '.modal-wrapper', function(event){
37    if(!$(event.target).closest('.modal-body').length) {
38      close_modal();
39    }
40  });
41  $(document).on('touchend', '.modal-wrapper', function(event){
42    if(!$(event.target).closest('.modal-body').length) {
43      close_modal();
44    }
45  });
46  $(document).on('click', '.side-right-main-wrapper, .select_image', function(event){
47    $("#uploaded_file").removeAttr("capture");
48    $("#uploaded_file").click();
49  });
50  $(document).on('click', '.fab', function(event){
51    $("#uploaded_file").attr("capture", "camera");
52    $("#uploaded_file").click();
53  });
54  $("html, .menu-item").on('click', function() {
55    hide_menu();
56  });
57  $("html").on('touchend', function() {
58    if(!$(event.target).closest('.menu-body').length) {
59      hide_menu();
60    }
61  });
62  $(".search-input").each(function() {
63    var default_value = this.value;
64    $(this).focus(function() {
65        if(this.value == default_value) {
66            this.value = '';
67        }
68    });
69    $(this).blur(function() {
70        if(this.value == '') {
71            this.value = default_value;
72        }
73    });
74  });
75  $(document).on('keyup', '.search-input', function(){
76    //console.log(upload_history);
77    var search_value = $(this).val();
78    //console.log(search_value);
79    search_history(search_value);
80  });
81  $(document).on('click', '.switcher', function(event){
82    switch_switcher();
83  });
84
85$('html').on('click', '.item-wrapper', function(event) {
86    if($(this).hasClass('item-selected') && !$(event.target).closest('svg').length) {
87      item_selected_amount -= 1;
88      if(item_selected_amount == 0) {
89        end_selection();
90      }
91      $(this).attr('data-is-selected', '0');
92      $('#item-selected-amount').html(item_selected_amount);
93      $(this).removeClass('item-selected');
94    } else if ( selecting || event.ctrlKey || event.metaKey || $('.side-right').css("display") == "none") {
95      if($(this).attr('data-is-selected') == "0") {
96        item_selected_amount += 1;
97      }
98      selecting = true;
99      $(this).addClass('item-selected');
100      $(this).attr('data-is-selected', '1');
101      $('#item-selected-amount').html(item_selected_amount);
102      hide_item_option();
103      $('#selection-header-wrapper').addClass('display-block');
104    } else if (selecting == false) {
105      item_selected_amount = 0;
106      $('.item-wrapper').removeClass('item-selected');
107      $('.item-wrapper').attr('data-is-selected', '0');
108      $(this).addClass('item-selected');
109      item_selected_amount += 1;
110      $(this).attr('data-is-selected', '1');
111      if($('.side-right').css("display") == "block") {
112          show_preview($(this));
113      }
114    }
115    //console.log("selecting "+selecting);
116    //console.log("no "+item_selected_amount);
117    //console.log("data-is-selected "+$(this).attr('data-is-selected'));
118  });
119
120  $("#ajax_form").on('click', '#submit', function(event){
121    $("#ajax_form").submit();
122  });
123
124  function request_delete_file(selecting) {
125      show_modal_loading();
126      var delete_key = [];
127      var i = $('div[data-is-selected="1"]');
128      if(selecting === undefined) {
129        for(var j = 0; j < i.length; j++){
130          delete_key[j] = {'path': i[j].dataset.url, 'key': i[j].dataset.delete};
131        }
132      } else {
133        delete_key[0] = {'path': preview_bar_item_info.url, 'key': preview_bar_item_info.delete};
134      }
135      //console.log(delete_key);
136      delete_key = JSON.stringify(delete_key);
137      $.ajax({
138        url: './delete',
139        type: 'POST',
140        data: {key: delete_key},
141        cache: false,
142        dataType: 'json',
143        success: function(response) {
144          //console.log(response);
145          //var result = JSON.parse(response);
146          if(response.code == 100) {
147            if(response.total_success > 0) {
148              remove_history(response.success_image);
149              /*for(var i = 0; i < response.success_image.length; i++) {
150                remove_history(response.success_image[i]);
151              }*/
152              show_snackbar(1, "圖片成功刪除");
153            } else {
154              show_snackbar(0, "刪除失敗,請重新再試");
155            }
156          } else if(response.code == 101 || response.code == 102) {
157            show_snackbar(0, response.content);
158          }
159        },
160        error: function(response) {
161          //console.log(response);
162          show_snackbar(0, "刪除失敗,請重新再試");
163        },
164        complete: function() {
165          end_selection();
166          list_history(0);
167          close_modal_loading();
168        }
169      });
170  }
171
172  function remove_history(success_image) {
173    if (typeof localStorage !== 'undefined') {
174        if (!(localStorage.getItem('user_upload_history') == null)) {
175            var upload_history = new Array();
176            upload_history = JSON.parse(localStorage.getItem('user_upload_history'));
177            for(var i = 0; i < success_image.length; i++) {
178              if (preview_bar_item_info.url == success_image[i].url) {
179                hide_preview();
180              }
181              upload_history = upload_history.filter(function(image) {
182                return image.url !== success_image[i].url;
183              });
184            }
185            if(upload_history.length == 0) {
186              localStorage.clear();
187            } else {
188              localStorage.setItem('user_upload_history', JSON.stringify(upload_history));
189            }
190            //console.log(upload_history);
191            //var remove_index = upload_history.findIndex(img => img.value === 200);
192            //upload_history.push({name: success_image.name, url: success_image.url, thumbnail: success_image.thumbnail, delete: success_image.delete});
193            //localStorage.setItem('user_upload_history', JSON.stringify(upload_history));
194        }
195    }
196  }
197
198  function copy_file_link(selecting){
199    var file_link = "";
200    if(selecting === undefined) {
201      var i = $('div[data-is-selected="1"]');
202      for(var j = 0; j < i.length; j++){
203        file_link += "[img]"+domain_url+i[j].dataset.url+"[/img]\n";
204      }
205    } else {
206      file_link = "[img]"+domain_url+preview_bar_item_info.url+"[/img]";
207    }
208    /**var temp = $("<input>");
209    $("body").append(temp);
210    temp.val(file_link).select();
211    document.execCommand("copy");
212    temp.remove();**/
213    Clipboard.copy(file_link);
214    show_snackbar(1, "已複製到剪貼板");
215    //console.log("copy_file_link: "+file_link);
216  }
217
218  window.Clipboard = (function(window, document, navigator) {
219      var textArea,
220          copy;
221
222      function isOS() {
223          return navigator.userAgent.match(/ipad|iphone/i);
224      }
225
226      function createTextArea(text) {
227          textArea = document.createElement('textArea');
228          textArea.value = text;
229          document.body.appendChild(textArea);
230      }
231
232      function selectText() {
233          var range,
234              selection;
235
236          if (isOS()) {
237              range = document.createRange();
238              range.selectNodeContents(textArea);
239              selection = window.getSelection();
240              selection.removeAllRanges();
241              selection.addRange(range);
242              textArea.setSelectionRange(0, 999999);
243          } else {
244              textArea.select();
245          }
246      }
247
248      function copyToClipboard() {        
249          document.execCommand('copy');
250          document.body.removeChild(textArea);
251      }
252
253      copy = function(text) {
254          createTextArea(text);
255          selectText();
256          copyToClipboard();
257      };
258
259      return {
260          copy: copy
261      };
262  })(window, document, navigator);
263
264  function getShareNotice() {
265    var slogan = [
266      "\u559c\u6b61 \u0055\u0070\u006c\u006f\u0061\u0064\u002e\u0063\u0063 \u55ce\u003f",
267      "\u8003\u616e\u8d0a\u52a9 \u0055\u0070\u006c\u006f\u0061\u0064\u002e\u0063\u0063 \u55ce\u003f",
268      "\u652f\u6301\u6211\u5011\u767c\u5c55\u66f4\u591a\u529f\u80fd",
269      "\u5496\u5561\u80fd\u7dad\u6301\u6211\u5011\u71df\u904b",
270      "\u5496\u5561\u80fd\u7d66\u6211\u5011\u52d5\u529b"
271    ];
272    var min = 0;
273    var max = 4;
274    var randomIndex = Math.floor(Math.random() * (max - min + 1)) + min;
275    var share_notice = '<div class="share_notice"><div>'+slogan[randomIndex]+'<a target="_blank" href="https://www.buymeacoffee.com/uploadcc"><span style="background: #f99920; color: #ffffff; padding: 2px 6px; border-radius: 6px; margin-left: 4px;">\u8acb\u6211\u5011\u559d\u5496\u5561</span></a></div><div>\u71df\u904b\u975e\u5e38\u8271\u8f9b\u002c\u6bcf\u6b21\u4e0a\u50b3\u5b8c\u5e6b\u500b\u5fd9\u53ef\u4ee5\u55ce?</div></div>';
276    return share_notice;
277  }
278
279  function share_file(selecting){
280    var share_link = "";
281    if(selecting === undefined) {
282      var i = $('div[data-is-selected="1"]');
283      for(var j = 0; j < i.length; j++){
284        share_link += "[img]"+domain_url+i[j].dataset.url+"[/img]\n";
285      }
286    } else {
287      share_link = "[img]"+domain_url+preview_bar_item_info.url+"[/img]";
288    }
289    var title = "分享連結";
290    var share_notice = getShareNotice();
291    var content = '<textarea class="textarea" type="text" style="font-size: 16px;" onclick="this.focus();this.select()" readonly="readonly">'+share_link+'</textarea>'+share_notice;
292    show_modal(1, title, content);
293    //console.log("share_file: "+share_link);
294  }
295
296  function delete_file(selecting){
297    var i = $('div[data-is-selected="1"]');
298    /*var file_id = [];
299    for(var j = 0; j < i.length; j++){
300      file_id[j] = "[img]"+domain_url+i[j].dataset.url+"[img]";
301    }*/
302    var title = "刪除圖片";
303    var content = "確定刪除此圖片?";
304    //alert(e.parentNode.parentNode.getAttribute('data-value'));
305    show_modal(2, title, content, selecting);
306    //console.log("delete_file: "+i.attr('data-name'));
307  }
308
309  function show_modal(m_type, title, content, selecting) {
310    close_modal_loading();
311    close_modal();
312    $("#modal-inside-title").html(title);
313    $("#modal-inside-content").html(content);
314    if(m_type == 1) {
315      default_share_link = $("textarea").val();
316      direct_share_link = default_share_link.replace(/\[img\]/g, "").replace(/\[\/img\]/g, "");
317      var direct_share_link_br = direct_share_link.replace(/\n/g, "%0A");
318      var direct_share_first_link = direct_share_link.split('\n', 1);
319      var share_fb = 'https://www.facebook.com/dialog/feed?app_id=102602126488517&link='+encodeURI(direct_share_first_link)+'&picture='+encodeURI(direct_share_first_link)+'&name=UploadCC&caption='+encodeURI("upload.cc")+'&description='+encodeURI("Shared by Upload.cc")+'&redirect_uri='+encodeURI("https://facebook.com")+'&display=page';
320      var share_tt = 'https://twitter.com/intent/tweet?text='+direct_share_link_br;
321      var share_wt = 'whatsapp://send?text='+direct_share_link_br;
322      var share_tg = 'tg://msg?text='+direct_share_link_br;
323      //$("textarea").val(old_share_link.replace(/\[img\]/g, "").replace(/\[\/img\]/g, " ").split(" ", 1));
324      //$("textarea").val(old_share_link.replace(/\[img\]/g, "").replace(/\[\/img\]/g, " ").split(" ", 1));
325      $('#modal-footer').html('<div class="share-icon-wrapper"><a class="wrapper-left"><div class="switcher-title">直鏈</div></a><a class="wrapper-left"><div class="switcher"><div class="switcher-background"><div class="switcher-button"></div></div></div></a><a href="'+share_tg+'" class="wrapper-right"><div class="modal-icon"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M9.78,18.65L10.06,14.42L17.74,7.5C18.08,7.19 17.67,7.04 17.22,7.31L7.74,13.3L3.64,12C2.76,11.75 2.75,11.14 3.84,10.7L19.81,4.54C20.54,4.21 21.24,4.72 20.96,5.84L18.24,18.65C18.05,19.56 17.5,19.78 16.74,19.36L12.6,16.3L10.61,18.23C10.38,18.46 10.19,18.65 9.78,18.65Z"></path></g></svg></div></a><a href="'+share_wt+'" class="wrapper-right"><div class="modal-icon"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M16.75,13.96C17,14.09 17.16,14.16 17.21,14.26C17.27,14.37 17.25,14.87 17,15.44C16.8,16 15.76,16.54 15.3,16.56C14.84,16.58 14.83,16.92 12.34,15.83C9.85,14.74 8.35,12.08 8.23,11.91C8.11,11.74 7.27,10.53 7.31,9.3C7.36,8.08 8,7.5 8.26,7.26C8.5,7 8.77,6.97 8.94,7H9.41C9.56,7 9.77,6.94 9.96,7.45L10.65,9.32C10.71,9.45 10.75,9.6 10.66,9.76L10.39,10.17L10,10.59C9.88,10.71 9.74,10.84 9.88,11.09C10,11.35 10.5,12.18 11.2,12.87C12.11,13.75 12.91,14.04 13.15,14.17C13.39,14.31 13.54,14.29 13.69,14.13L14.5,13.19C14.69,12.94 14.85,13 15.08,13.08L16.75,13.96M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C10.03,22 8.2,21.43 6.65,20.45L2,22L3.55,17.35C2.57,15.8 2,13.97 2,12A10,10 0 0,1 12,2M12,4A8,8 0 0,0 4,12C4,13.72 4.54,15.31 5.46,16.61L4.5,19.5L7.39,18.54C8.69,19.46 10.28,20 12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4Z"></path></g></svg></div></a><a href="'+share_tt+'" target="_blank" class="wrapper-right"><div class="modal-icon"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M22.46,6C21.69,6.35 20.86,6.58 20,6.69C20.88,6.16 21.56,5.32 21.88,4.31C21.05,4.81 20.13,5.16 19.16,5.36C18.37,4.5 17.26,4 16,4C13.65,4 11.73,5.92 11.73,8.29C11.73,8.63 11.77,8.96 11.84,9.27C8.28,9.09 5.11,7.38 3,4.79C2.63,5.42 2.42,6.16 2.42,6.94C2.42,8.43 3.17,9.75 4.33,10.5C3.62,10.5 2.96,10.3 2.38,10C2.38,10 2.38,10 2.38,10.03C2.38,12.11 3.86,13.85 5.82,14.24C5.46,14.34 5.08,14.39 4.69,14.39C4.42,14.39 4.15,14.36 3.89,14.31C4.43,16 6,17.26 7.89,17.29C6.43,18.45 4.58,19.13 2.56,19.13C2.22,19.13 1.88,19.11 1.54,19.07C3.44,20.29 5.7,21 8.12,21C16,21 20.33,14.46 20.33,8.79C20.33,8.6 20.33,8.42 20.32,8.23C21.16,7.63 21.88,6.87 22.46,6Z"></path></g></svg></div></a><a href="'+share_fb+'" target="_blank" class="wrapper-right"><div class="modal-icon"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M17,2V2H17V6H15C14.31,6 14,6.81 14,7.5V10H14L17,10V14H14V22H10V14H7V10H10V6A4,4 0 0,1 14,2H17Z"></path></g></svg></div></a></div>');
326      $('.modal-ga').addClass('display-block');
327      $('#modal-wrapper').addClass("display-block");
328      if(is_modal_ad_show == false) {
329        is_modal_ad_show = true;
330        $("#modal-ga-320-50").html('<ins class="adsbygoogle" style="display:inline-block;width:320px;height:50px" data-ad-client="ca-pub-8339573058985265" data-ad-slot="8498389070"></ins>');
331        (adsbygoogle = window.adsbygoogle || []).push({});
332      }
333      if(is_ad_show == false && $('.side-right').css("display") == "block") {
334        is_ad_show = true;
335        $("#modal-ga-300-250").html('<ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-8339573058985265" data-ad-slot="3009610677"></ins>');
336        $("#modal-ga-468-60-top").html('<ins class="adsbygoogle" style="display:inline-block;width:468px;height:60px;background:#fff" data-ad-client="ca-pub-8339573058985265" data-ad-slot="7579411079"></ins>');
337        $("#modal-ga-468-60-bottom").html('<ins class="adsbygoogle" style="display:inline-block;width:468px;height:60px;background:#fff" data-ad-client="ca-pub-8339573058985265" data-ad-slot="1532877476"></ins>');
338        (adsbygoogle = window.adsbygoogle || []).push({});
339        (adsbygoogle = window.adsbygoogle || []).push({});
340        (adsbygoogle = window.adsbygoogle || []).push({});
341      }
342      return;
343
344    } else if(m_type == 2) {
345      $('#modal-footer').html('<a class="button-touch-target" href="#" onclick="close_modal();"><div class="button-flat" fit>取消</div></a><a class="button-touch-target" href="#" onclick="request_delete_file('+selecting+');"><div class="button-flat">確定</div></a>');
346    } else if(m_type == 3) {
347      $('#modal-footer').html('<a class="button-touch-target" href="#" onclick="close_modal();"><div class="button-flat" fit>取消</div></a><a class="button-touch-target" href="#" onclick="clear_history();"><div class="button-flat">確定</div></a>');
348    } else {
349      $('#modal-footer').html('<a class="button-touch-target" href="#" onclick="close_modal();"><div class="button-flat" fit>關閉</div></a>');
350    }
351    $('#modal-wrapper').addClass("display-block");
352  }
353
354  function close_modal() {
355    $('#modal-wrapper').removeClass('display-block');
356    $('.modal-ga').removeClass('display-block');
357  }
358
359  function show_modal_loading() {
360    close_snackbar();
361    close_modal();
362    close_modal_loading();
363    $(".modal-loading-inside-content-loader").html('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=" class="loading" />');
364    setTimeout(function(){ 
365      $(".loading").attr("src", "images/loading.png");
366    }, 10);
367    $('#modal-loading-wrapper').addClass('display-block');
368  }
369
370  function close_modal_loading() {
371    $('#modal-loading-wrapper').removeClass('display-block');
372  }
373
374  function show_snackbar(dismiss, content) {
375    close_snackbar();
376    $("#snackbar-content").html(content);
377    $('#snackbar').addClass("display-block");
378    if(dismiss == 1) {
379      setTimeout(function(){ close_snackbar(); }, 3000);
380    }
381  }
382
383  function close_snackbar() {
384    $('#snackbar').removeClass("display-block");
385  }
386
387  function show_item_option() {
388    $('.item-wrapper .wrapper-right').removeClass("display-none");
389  }
390
391  function hide_item_option() {
392    $('.item-wrapper .wrapper-right').addClass("display-none");
393  }
394
395  function show_preview(i) {
396    preview_bar_item_info = {name: i.attr('data-name'), url: i.attr('data-url'), delete: i.attr('data-delete')};
397    $('.preview-bar-title').html(i.attr('data-name'));
398    $('.preview-image').attr('src', "images/loading.gif");
399    $('.preview').addClass("display-block");
400    var image = new Image(); 
401            image.onload = function() { 
402                //setTimeout(function(){ 
403                  $('.preview-image').attr('src', i.attr('data-url')); 
404                //}, 500);
405                   
406            }
407            /*img.onerror = function() { 
408                setTimeout(function(){ 
409                  $('.preview-image').attr('src', image.attr('data-url')); 
410                }, 500);
411            }*/
412            image.src = "images/loading.gif";
413            //console.log(preview_bar_item_info);
414  }
415
416  function hide_preview() {
417    $('.preview').removeClass("display-block");
418  }
419
420  function end_selection() {
421    show_item_option();
422    $('#selection-header-wrapper').removeClass('display-block');
423    $('.item-wrapper').removeClass('item-selected');
424    $('.item-wrapper').attr('data-is-selected', '0');
425    selecting = false;
426    item_selected_amount = 0;
427  }
428
429  function show_menu() {
430    if($("#menu-body").hasClass('display-block')) {
431      $("#menu-body").removeClass('display-block');
432    } else {
433      $("#menu-body").addClass('display-block');
434    }
435  }
436
437  //var old_share_link = "";
438  function switch_switcher() {
439    if($(".switcher-button").hasClass('switcher-button-switched')) {
440      $("textarea").val(default_share_link);
441      $(".switcher-button").removeClass("switcher-button-switched");
442      $(".switcher-background").removeClass("switcher-background-switched");
443    } else {
444      //old_share_link = $("textarea").val();
445      //$("textarea").val(old_share_link.replace(/\[img\]/g, "").replace(/\[\/img\]/g, " "));
446      //$("textarea").val(old_share_link.replace(/\[img\]/g, "").replace(/\[\/img\]/g, " ").split(" ", 1));
447      $("textarea").val(direct_share_link);
448      $(".switcher-button").addClass("switcher-button-switched");
449      $(".switcher-background").addClass("switcher-background-switched");
450    }
451  }
452
453  function show_search_bar() {
454    $(".search-input").val("")
455    $('#search-header-wrapper').addClass("display-block");
456    $('.search-input').focus();
457  }
458
459  function close_search_bar() {
460    $('#search-header-wrapper').removeClass("display-block");
461    list_history(0);
462  }
463
464  function reset_search_input() {
465    $(".search-input").val("");
466    $(".search-input").focus();
467    search_history("");
468  }
469
470  function hide_menu() {
471    $("#menu-body").removeClass('display-block');
472  }
473
474  function disable_click() {
475    enable_click();
476    $('html').addClass('disable-click');
477    $('.button-flat').addClass('disable-button-flat');
478  }
479
480  function enable_click() {
481    $('html').removeClass('disable-click');
482    $('.button-flat').removeClass('disable-button-flat');
483  }
484
485/**var nextItem = 1;
486
487
488
489function load_more() {
490  var item ="";
491  for (var i = 0; i < Math.round($('.side-left-content').height()/72)+2; i++) {
492    item += '<div class="item" data-name="5695982_1473765728.jpg" data-url="i/1.jpg" data-delete="1-delete-key" data-is-selected="0"> <table> <tr> <td class="item-icon"> <img src="i/1.jpg"/> </td> <td class="item-name"><div class="item-name-content">5695982_1473765728.jpg</div></td> <td class="item-options"> <div class="item-options-wrapper"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="copy_file_link"> <g> <path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path> </g> </svg><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="share_file"> <g> <path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"></path> </g> </svg><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="delete_file"> <g> <path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path> </g> </svg> </div> </div> </td> </tr> </table> </div>';
493    nextItem++;
494  }
495  $('.side-left-content').append(item);
496}
497
498$('.side-left-content').scroll(function(event){
499if ($(this).scrollTop() + $(this).height() >= $(this).prop('scrollHeight')) {
500    load_more();
501  }
502    //console.log($(this).scrollTop());
503  });
504
505// Initially load some items.
506
507load_more();**/
508
509$('html').on('dragover', function(event){
510  event.preventDefault();
511  if($("#modal-loading-wrapper").hasClass('display-block')) {
512    return;
513  }
514  $('.dragover-wrapper').addClass('visibility-visible');
515});
516
517$('html').on('dragleave', function(event){
518if($(event.target).hasClass("file_input_hidden")) {
519      $('.dragover-wrapper').removeClass('visibility-visible');
520  }
521});
522
523$(document).on('click', '#uploaded_file', function(event){
524  if($(".dragover-wrapper").hasClass("visibility-visible")) {
525      event.preventDefault();
526      $('.dragover-wrapper').removeClass('visibility-visible');
527  }
528});
529
530/*$('html').on('drop', function(event){
531  event.preventDefault();
532  //console.log(event.dataTransfer.files.length);
533});*/
534/**$('html').on('drop', function(event){
535  event.preventDefault();
536  $('.dragover-wrapper').removeClass('display-block');
537  show_modal("上傳", "圖片正在上傳中,請稍等.........");
538  setTimeout(function(){ 
539     close_modal();
540     show_modal("分享連結", '<textarea class="textarea" type="text" style="font-size: 16px;" onclick="this.focus();this.select()" readonly="readonly">https://upload.cc/i/Aas35g.jpg</textarea>');
541  }, 2000);
542  var dataTransfer =  event.originalEvent.dataTransfer;
543  //console.log(dataTransfer.files)
544});**/
545if(document.documentMode || /Edge/.test(navigator.userAgent)) {
546  window.addEventListener('load', function() {
547      var body = document.getElementsByTagName('body')[0];
548      body.addEventListener('drop', function( event ) {
549        event.preventDefault();
550        upload(2, event);
551      }, false);
552  }, false);
553}
554
555var pu;
556function upload(upload_mode, upload_item) {
557  show_modal_loading();
558  var ajax_url = './image_upload';
559  var form_data = new FormData();
560  if(upload_mode == 3) {
561    ajax_url = './screen_upload';
562    form_data.append('image', upload_item);
563  } else if(upload_mode == 4) {
564    ajax_url = './screen_upload_j';
565    form_data.append('image', upload_item);
566  } else {
567    $("#uploaded_file").attr('disabled','disabled');
568    $('.dragover-wrapper').removeClass('visibility-visible');
569    //form_data = new FormData();
570    if(upload_mode == 1) {
571      var upload_file = document.getElementById('uploaded_file').files.length;
572      for(var i = 0; i < upload_file; i++) {
573        form_data.append('uploaded_file[]', document.getElementById('uploaded_file').files[i]);
574        //console.log('nonie');
575      }
576    } else {
577      for(var i = 0; i < upload_item.dataTransfer.files.length; i++) {
578        form_data.append('uploaded_file[]', upload_item.dataTransfer.files[i]);
579      }
580    }
581  }
582  //show_modal("上傳", "圖片正在上傳中,請稍等.........");
583  //disable_click();
584  $.ajax({
585    url: ajax_url, 
586    dataType: 'json', 
587    cache: false,
588    contentType: false,
589    processData: false,
590    data: form_data,                         
591    type: 'post',
592    success: function(response) {
593      //console.log(response);
594      //var result = JSON.parse(response);
595      if(response.code == 100) {
596        if(response.total_error > 0) {
597          show_snackbar(0, response.total_error+" 張圖片上傳失敗");
598        }
599        if(response.total_success > 0) {
600          if(upload_mode == 3) {
601            pu = upload_item;
602          }
603          var share_link = "";
604          for(var i = 0; i < response.success_image.length; i++) {
605            insert_history(response.success_image[i]);
606            share_link += "[img]"+domain_url+response.success_image[i].url+"[/img]\n";
607          }
608          list_history(0);
609          var title = "分享連結";
610          var share_notice = getShareNotice();
611          var content = '<textarea class="textarea" type="text" style="font-size: 16px;" onclick="this.focus();this.select()" readonly="readonly">'+share_link+'</textarea>'+getShareNotice();
612          show_modal(1, title, content);
613          return;
614        }
615      } else if(response.code == 105) {
616        show_snackbar(0, response.content);
617      }
618      //close_modal_loading();
619      //close_modal();
620      //show_snackbar(0, response+" 張圖片上傳失敗");
621    },
622    error: function(response) {
623      //console.log(response);
624      //close_modal();
625      show_snackbar(0, "上傳失敗,請重新再試");
626    },
627    complete: function() {
628      document.getElementById("upload_form").reset();
629      $("#uploaded_file").removeAttr('disabled');
630      close_modal_loading();
631      //enable_click();
632    }
633   });
634  }
635
636
637  function show_no_history() {
638      $(".side-left-content").html("");
639      $(".side-left-main").html('<table><tr><td><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"></path></g></svg></td></tr><tr><td>沒有記錄</td></tr></table>');
640      $('.side-left-main-wrapper').removeClass("display-none");
641  }
642
643  function show_not_found() {
644    $(".side-left-content").html("");
645      $(".side-left-main").html('<table><tr><td><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=" class="loader" /></td></tr></table>');
646      $('.side-left-main-wrapper').removeClass("display-none");
647      setTimeout(function(){ 
648        $(".loader").attr("src", "images/loader.png");
649        setTimeout(function(){ 
650          $(".side-left-main").html('<table><tr><td><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g><path d="M11.99 2C6.47 2 2 6.47 2 12s4.47 10 9.99 10S22 17.53 22 12 17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm4.18-12.24l-1.06 1.06-1.06-1.06L13 8.82l1.06 1.06L13 10.94 14.06 12l1.06-1.06L16.18 12l1.06-1.06-1.06-1.06 1.06-1.06zM7.82 12l1.06-1.06L9.94 12 11 10.94 9.94 9.88 11 8.82 9.94 7.76 8.88 8.82 7.82 7.76 6.76 8.82l1.06 1.06-1.06 1.06zM12 14c-2.33 0-4.31 1.46-5.11 3.5h10.22c-.8-2.04-2.78-3.5-5.11-3.5z"></path></g></svg></td></tr><tr><td>沒有結果</td></tr></table>');
651        }, 300);
652      }, 10);
653  }
654
655  function insert_history(success_image) {
656    if (typeof localStorage !== 'undefined') {
657        if (localStorage.getItem('user_upload_history') == null) {
658            var upload_history = new Array();
659            upload_history[0] = {name: success_image.name+"", url: success_image.url, thumbnail: success_image.thumbnail, delete: success_image.delete};
660            localStorage.setItem('user_upload_history', JSON.stringify(upload_history));
661        } else {
662            var upload_history = new Array();
663            upload_history = JSON.parse(localStorage.getItem('user_upload_history'));
664            if(upload_history.length >= 1000) {
665              upload_history.shift();
666            }
667            upload_history.push({name: success_image.name+"", url: success_image.url, thumbnail: success_image.thumbnail, delete: success_image.delete});
668            localStorage.setItem('user_upload_history', JSON.stringify(upload_history));
669        }
670    }
671  }
672
673  $('.side-left-content').scroll(function(event){
674    if ($(this).scrollTop() + $(this).height() >= $(this).prop('scrollHeight')) {
675      if(upload_history_count > 0) {
676        get_history(1);
677      }
678    }
679    //console.log($(this).scrollTop());
680  });
681
682  function clear_history() {
683    //get_history();
684    upload_history = new Array();
685    localStorage.clear();
686    close_modal();
687    hide_preview();
688    list_history(0);
689  }
690  
691  function get_history(is_scroll) {
692    //console.log("get");
693    if (typeof localStorage !== 'undefined') {
694        if (localStorage.getItem('user_upload_history') == null) {
695          show_no_history();
696        } else {
697          var item = "";
698          //var upload_history = new Array();
699          if(is_scroll == 0) {
700            upload_history = JSON.parse(localStorage.getItem('user_upload_history'));
701          }
702          var count = 0;
703          var ads = 0;
704          //console.log(upload_history_count);
705          if($("#selection-header-wrapper").hasClass('display-block')) {
706            var item_wrapper_right_class = "wrapper-right display-none";
707          } else {
708            var item_wrapper_right_class = "wrapper-right";
709          }
710          for (var i = upload_history.length - (upload_history_count) - 1; i >= 0; i--) {
711            if (upload_history_count == 0) {
712              item += '<div class="item-wrapper" style="cursor:pointer;" onclick="javascript:window.open(\'https://www.buymeacoffee.com/uploadcc\',\'_blank\');event.stopPropagation();"><a class="wrapper-left"><div class="item-icon"><img src="https://upload.cc/images/coffee.jpg" /></div></a><div class="wrapper-main"><a><div class="wrapper-main-content">
712\u6309\u6b64\u8d0a\u52a9 \u0055\u0070\u006c\u006f\u0061\u0064\u002e\u0063\u0063</div></a></div></div>';
713            }
714            count++;
715            upload_history_count++;
716            item += '<div class="item-wrapper" data-name="'+upload_history[i].name+'" data-url="'+upload_history[i].url+'" data-delete="'+upload_history[i].delete+'" data-is-selected="0"><a class="wrapper-left"><div class="item-icon"><img src="'+upload_history[i].thumbnail+'" /></div></a><a class="'+item_wrapper_right_class+'"><div class="icon"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="delete_file"><g><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></g></svg></div></a><a class="'+item_wrapper_right_class+'"><div class="icon"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="share_file"><g><path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"></path></g></svg></div></a><a class="'+item_wrapper_right_class+'"><div class="icon"><svg viewBox="0 0 24 24" x="0px" y="0px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" class="copy_file_link"><g><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></g></svg></div></a><div class="wrapper-main"><a><div class="wrapper-main-content">'+upload_history[i].name+'</div></a></div></div>';
717            /**if(count % 6 == 0) {
718              item += '<div style="border-bottom: 1px solid #E8E9EC; text-align: center;"><ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px;vertical-align:bottom" data-ad-client="ca-pub-8339573058985265" data-ad-slot="3009610677"><\/ins></div>';
719              ads++;
720            }**/
721            if(count == 30) break;
722          }
723          $('.side-left-main-wrapper').addClass("display-none");
724          $('.side-left-content').append(item);
725          /**for(var i = 0; i < ads; i++) {
726            (adsbygoogle = window.adsbygoogle || []).push({});
727          }**/
728        }
729    } else {
730      show_no_history();
731    }
732  }
733
734  function list_history(is_search) {
735      if(is_search == 0) {
736        $("#search-header-wrapper").removeClass("display-block");
737      }
738      upload_history_count = 0;
739      end_selection();
740      $(".side-left-content").html("");
741      $(".side-left-main").html('<table><tr><td><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVQYV2NgYAAAAAMAAWgmWQ0AAAAASUVORK5CYII=" class="loader" /></td></tr></table>');
742      $('.side-left-main-wrapper').removeClass("display-none");
743      setTimeout(function(){ 
744        $(".loader").attr("src", "images/loader.png");
745        setTimeout(function(){ 
746          get_history(is_search);
747        }, 300);
748      }, 10);
749  }
750
751  function search_history(search_value) {
752    if (typeof localStorage !== 'undefined') {
753      if (localStorage.getItem('user_upload_history') == null) {
754        show_not_found();
755      } else {
756        upload_history = JSON.parse(localStorage.getItem('user_upload_history'));
757        upload_history = upload_history.filter(function(image) {
758          return image.name.toLowerCase().indexOf(search_value.toLowerCase()) > -1;
759        });
760        //console.log(upload_history);
761        if(upload_history.length > 0) {
762          list_history(1);
763        } else {
764          show_not_found();
765        }
766      }
767    } else {
768      show_not_found();
769    }
770  }
771
772$(window).load(function() {
773  setTimeout(function(){ 
774    get_history(0);
775  }, 300);
776    ! (function($) {
777  var defaults;
778  $.event.fix = (function(originalFix) {
779    return function(event) {
780      event = originalFix.apply(this, arguments);
781      if (event.type.indexOf('copy') === 0 || event.type.indexOf('paste') === 0) {
782        event.clipboardData = event.originalEvent.clipboardData;
783      }
784      return event;
785    };
786  })($.event.fix);
787  defaults = {
788    callback: $.noop,
789    matchType: /image.*/
790  };
791  return $.fn.pasteImageReader = function(options) {
792    if (typeof options === "function") {
793      options = {
794        callback: options
795      };
796    }
797    options = $.extend({}, defaults, options);
798    return this.each(function() {
799      var $this, element, total_error;
800      element = this;
801      $this = $(this);
802      total_error = 0;
803      return $this.bind('paste', function(event) {
804        var clipboardData, found;
805        found = false;
806        clipboardData = event.clipboardData;
807        var err;
808        err = -1 != navigator.userAgent.indexOf("Mac OS X") ? "\u5168\u5c4f\u622a\u5716\u003a \u0043\u0074\u0072\u006c \u002b \u0043\u006f\u006d\u006d\u0061\u006e\u0064 \u002b \u0053\u0068\u0069\u0066\u0074 \u002b \u0033\u003c\u0062\u0072 \u002f\u003e\u5340\u57df\u622a\u5716\u003a \u0043\u0074\u0072\u006c \u002b \u0043\u006f\u006d\u006d\u0061\u006e\u0064 \u002b \u0053\u0068\u0069\u0066\u0074 \u002b \u0034\u003c\u0062\u0072 \u002f\u003e\u8acb\u5148\u6309\u9375\u76e4\u4e0a\u7684\u622a\u5716\u5feb\u6377\u9375\uff0c\u7136\u5f8c\u5728\u672c\u7db2\u9801\u4e2d\u6309\u9375\u76e4\u4e0a\u7684 \u0043\u006f\u006d\u006d\u0061\u006e\u0064 \u002b \u0056 \u5373\u53ef\u81ea\u52d5\u4e0a\u50b3\u4f60\u7684\u87a2\u5e55\u622a\u5716\u3002\u003c\u0062\u0072 \u002f\u003e\u003c\u0062\u0072 \u002f\u003e\u5982\u4ecd\u7136\u51fa\u73fe\u9019\u554f\u984c\u8acb\u5230\u003c\u0062\u0072 \u002f\u003e\u0053\u0079\u0073\u0074\u0065\u006d \u0050\u0072\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065\u0073 \u0026\u0067\u0074\u003b \u004b\u0065\u0079\u0062\u006f\u0061\u0072\u0064 \u0026\u0067\u0074\u003b \u0053\u0068\u006f\u0072\u0074\u0063\u0075\u0074\u0073 \u4e2d\u7684 \u0053\u0063\u0072\u0065\u0065\u006e \u0053\u0068\u006f\u0074\u0073 \u52fe\u9078\u4ee5\u4e0a \u0032 \u7a2e\u622a\u5716\u65b9\u6cd5\u7684\u5feb\u6377\u9375\u3002" :
809            "\u8acb\u5148\u6309\u9375\u76e4\u7684 \u0050\u0072\u0069\u006e\u0074 \u0053\u0063\u0072\u0065\u0065\u006e \u6309\u9215\uff0c\u7136\u5f8c\u5728\u672c\u7db2\u9801\u4e2d\u6309\u9375\u76e4\u4e0a\u7684 \u0043\u0074\u0072\u006c \u002b \u0056 \u5373\u53ef\u81ea\u52d5\u4e0a\u50b3\u4f60\u7684\u87a2\u5e55\u622a\u5716\u3002";
810        if ("" == clipboardData.types) {
811          //console.log('error');
812          show_modal(0, "\u627e\u4e0d\u5230\u5716\u7247", err); 
813        } else {
814          return Array.prototype.forEach.call(clipboardData.types, function(type, i) {
815            var file, reader;
816            if (found) {
817              return;
818            }
819            if (type.match(options.matchType) || clipboardData.items[i].type.match(options.matchType)) {
820              file = clipboardData.items[i].getAsFile();
821              reader = new FileReader();
822              reader.onload = function(evt) {
823                if(evt.target.result.length*6/8 > 5242880) {total_error = 0; show_modal(0, "\u627e\u4e0d\u5230\u5716\u7247", err); return;}
824                return options.callback.call(element, {
825                  dataURL: evt.target.result,
826                  event: evt,
827                  file: file,
828                  name: file.name
829                });
830              };
831              try {
832                reader.readAsDataURL(file);
833              } catch (e) {
834                total_error = 0;
835                show_modal(0, "\u627e\u4e0d\u5230\u5716\u7247", err);
836                return;
837              }
838              return found = true;
839            } else {
840              total_error += 1;
841              //if(clipboardData.types.length) 
842              if(total_error == clipboardData.types.length) {
843                total_error = 0;
844                show_modal(0, "\u627e\u4e0d\u5230\u5716\u7247", err); 
845              }
846            }
847          });
848        } //end if
849      });
850    });
851  };
852})(jQuery), $("html").pasteImageReader(function(a) {
853        if(pu==a.dataURL) {close_modal(); show_snackbar(0, "\u8ACB\u52FF\u91CD\u8986\u4E0A\u50B3\u76F8\u540C\u7684\u622A\u5716"); return;}
854        upload(3, a.dataURL);
855    });
856});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.