diff options
Diffstat (limited to 'module/web/media/default/js/funktions.js')
-rw-r--r-- | module/web/media/default/js/funktions.js | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/module/web/media/default/js/funktions.js b/module/web/media/default/js/funktions.js index 6240d32ad..8d9d332b3 100644 --- a/module/web/media/default/js/funktions.js +++ b/module/web/media/default/js/funktions.js @@ -1,41 +1,42 @@ // JavaScript Document
-function HumanFileSize(size)
-{
- var filesizename = new Array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
- var loga = Math.log(size)/Math.log(1024);
- var i = Math.floor(loga);
- var a = Math.pow(1024, i);
- return (size == 0) ? "0 B" : (Math.round( size / a , 2) + " " + filesizename[i]);
+function HumanFileSize(size) {
+ var filesizename = new Array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
+ var loga = Math.log(size) / Math.log(1024);
+ var i = Math.floor(loga);
+ var a = Math.pow(1024, i);
+ return (size == 0) ? "0 B" : (Math.round(size / a, 2) + " " + filesizename[i]);
}
function parseUri() {
- var oldString = $("add_links").value;
- var regxp= new RegExp('(ht|f)tp(s?):\/\/[a-zA-Z0-9\-\.\/\?=]+[<| |\"|\'|\r|\n|\t]{1}', 'g');
- var resu=oldString.match(regxp);
- if (resu == null) return;
- var res="";
- for(var i=0; i < resu.length; i++){
- // remove the last char, if ...
- if (resu[i].indexOf(" ") != -1){
- res = res + resu[i].replace(" ","\n");
- } else if (resu[i].indexOf("\t") != -1){
- res = res + resu[i].replace("\t","\n");
- } else if (resu[i].indexOf("\r") != -1){
- res = res + resu[i].replace("\r","\n");
- } else if (resu[i].indexOf("\"") != -1){
- res = res + resu[i].replace("\"","\n");
- } else if (resu[i].indexOf("<") != -1){
- res = res + resu[i].replace("<","\n");
- } else {
- res = res + "\n" + resu[i].replace("'","\n");
- }
+ var oldString = $("add_links").value;
+ var regxp = new RegExp('(ht|f)tp(s?):\/\/[a-zA-Z0-9\-\.\/\?=_&%#]+[<| |\"|\'|\r|\n|\t]{1}', 'g');
+ var resu = oldString.match(regxp);
+ if (resu == null) return;
+ var res = "";
+ for (var i = 0; i < resu.length; i++) {
+ // remove the last char, if ...
+ if (resu[i].indexOf(" ") != -1) {
+ res = res + resu[i].replace(" ", " \n");
+ } else if (resu[i].indexOf("\t") != -1) {
+ res = res + resu[i].replace("\t", " \n");
+ } else if (resu[i].indexOf("\r") != -1) {
+ res = res + resu[i].replace("\r", " \n");
+ } else if (resu[i].indexOf("\"") != -1) {
+ res = res + resu[i].replace("\"", " \n");
+ } else if (resu[i].indexOf("<") != -1) {
+ res = res + resu[i].replace("<", " \n");
+ } else if (resu[i].indexOf("'") != -1) {
+ res = res + resu[i].replace("'", " \n");
+ } else {
+ res = res + resu[i].replace("\n", " \n");
}
- $("add_links").value = res;
+ }
+ $("add_links").value = res;
}
Array.prototype.remove = function(from, to) {
- var rest = this.slice((to || from) + 1 || this.length);
- this.length = from < 0 ? this.length + from : from;
- if (this.length == 0) return [];
- return this.push.apply(this, rest);
+ var rest = this.slice((to || from) + 1 || this.length);
+ this.length = from < 0 ? this.length + from : from;
+ if (this.length == 0) return [];
+ return this.push.apply(this, rest);
};
\ No newline at end of file |