Browse Source

Changed link id to hash

tags/v1.3
Teknikode 5 years ago
parent
commit
371299b25d
2 changed files with 14 additions and 3 deletions
  1. 12
    1
      templates/default/js/common.js
  2. 2
    2
      upload/main.php

+ 12
- 1
templates/default/js/common.js View File

@@ -102,4 +102,15 @@ function removeAmp(code)
{
code = code.replace(/&/g, '&');
return code;
}
}

String.prototype.hashCode = function() {
var hash = 0, i, chr, len;
if (this.length == 0) return hash;
for (i = 0, len = this.length; i < len; i++) {
chr = this.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
};

+ 2
- 2
upload/main.php View File

@@ -55,7 +55,7 @@ Dropzone.options.TeknikUpload = {
this.on("success", function(file, responseText) {
obj = JSON.parse(responseText);
var name = obj.results.file.name;
var short_name = encodeURIComponent(file.name.split(".")[0]);
var short_name = file.name.split(".")[0].hashcode();
$("#upload-links").css('display', 'inline', 'important');
$("#upload-links").prepend(' \
<div class="row link_'+short_name+'"> \
@@ -73,7 +73,7 @@ Dropzone.options.TeknikUpload = {
linkUploadDelete('.generate-delete-link-'+short_name+'');
});
this.on("removedfile", function(file) {
var name = encodeURIComponent(file.name.split(".")[0]);
var name = file.name.split(".")[0].hashcode();
$('.link_'+name).remove();
});
this.on("reset", function(file, responseText) {

Loading…
Cancel
Save