Merge branch 'master' into filesystem
This commit is contained in:
commit
4d2669f6b3
|
@ -4,14 +4,15 @@ var FileList={
|
||||||
$('#fileList').empty().html(fileListHtml);
|
$('#fileList').empty().html(fileListHtml);
|
||||||
},
|
},
|
||||||
addFile:function(name,size,lastModified,loading,hidden){
|
addFile:function(name,size,lastModified,loading,hidden){
|
||||||
var img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png');
|
var basename, extension, simpleSize, sizeColor, lastModifiedTime, modifiedColor,
|
||||||
var html='<tr data-type="file" data-size="'+size+'" data-permissions="'+$('#permissions').val()+'">';
|
img=(loading)?OC.imagePath('core', 'loading.gif'):OC.imagePath('core', 'filetypes/file.png'),
|
||||||
|
html='<tr data-type="file" data-size="'+size+'" data-permissions="'+$('#permissions').val()+'">';
|
||||||
if(name.indexOf('.')!=-1){
|
if(name.indexOf('.')!=-1){
|
||||||
var basename=name.substr(0,name.lastIndexOf('.'));
|
basename=name.substr(0,name.lastIndexOf('.'));
|
||||||
var extension=name.substr(name.lastIndexOf('.'));
|
extension=name.substr(name.lastIndexOf('.'));
|
||||||
}else{
|
}else{
|
||||||
var basename=name;
|
basename=name;
|
||||||
var extension=false;
|
extension=false;
|
||||||
}
|
}
|
||||||
html+='<td class="filename" style="background-image:url('+img+')"><input type="checkbox" />';
|
html+='<td class="filename" style="background-image:url('+img+')"><input type="checkbox" />';
|
||||||
html+='<a class="name" href="download.php?file='+$('#dir').val().replace(/</, '<').replace(/>/, '>')+'/'+name+'"><span class="nametext">'+basename;
|
html+='<a class="name" href="download.php?file='+$('#dir').val().replace(/</, '<').replace(/>/, '>')+'/'+name+'"><span class="nametext">'+basename;
|
||||||
|
@ -41,10 +42,11 @@ var FileList={
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addDir:function(name,size,lastModified,hidden){
|
addDir:function(name,size,lastModified,hidden){
|
||||||
|
var html, td, link_elem, sizeColor, lastModifiedTime, modifiedColor;
|
||||||
html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name, "data-permissions": $('#permissions').val()});
|
html = $('<tr></tr>').attr({ "data-type": "dir", "data-size": size, "data-file": name, "data-permissions": $('#permissions').val()});
|
||||||
td = $('<td></td>').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' });
|
td = $('<td></td>').attr({"class": "filename", "style": 'background-image:url('+OC.imagePath('core', 'filetypes/folder.png')+')' });
|
||||||
td.append('<input type="checkbox" />');
|
td.append('<input type="checkbox" />');
|
||||||
var link_elem = $('<a></a>').attr({ "class": "name", "href": OC.linkTo('files', 'index.php')+"&dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') });
|
link_elem = $('<a></a>').attr({ "class": "name", "href": OC.linkTo('files', 'index.php')+"&dir="+ encodeURIComponent($('#dir').val()+'/'+name).replace(/%2F/g, '/') });
|
||||||
link_elem.append($('<span></span>').addClass('nametext').text(name));
|
link_elem.append($('<span></span>').addClass('nametext').text(name));
|
||||||
link_elem.append($('<span></span>').attr({'class': 'uploadtext', 'currentUploads': 0}));
|
link_elem.append($('<span></span>').attr({'class': 'uploadtext', 'currentUploads': 0}));
|
||||||
td.append(link_elem);
|
td.append(link_elem);
|
||||||
|
@ -71,7 +73,7 @@ var FileList={
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refresh:function(data) {
|
refresh:function(data) {
|
||||||
result = jQuery.parseJSON(data.responseText);
|
var result = jQuery.parseJSON(data.responseText);
|
||||||
if(typeof(result.data.breadcrumb) != 'undefined'){
|
if(typeof(result.data.breadcrumb) != 'undefined'){
|
||||||
updateBreadcrumb(result.data.breadcrumb);
|
updateBreadcrumb(result.data.breadcrumb);
|
||||||
}
|
}
|
||||||
|
@ -88,14 +90,13 @@ var FileList={
|
||||||
},
|
},
|
||||||
insertElement:function(name,type,element){
|
insertElement:function(name,type,element){
|
||||||
//find the correct spot to insert the file or folder
|
//find the correct spot to insert the file or folder
|
||||||
var fileElements=$('tr[data-file][data-type="'+type+'"]:visible');
|
var pos, fileElements=$('tr[data-file][data-type="'+type+'"]:visible');
|
||||||
var pos;
|
|
||||||
if(name.localeCompare($(fileElements[0]).attr('data-file'))<0){
|
if(name.localeCompare($(fileElements[0]).attr('data-file'))<0){
|
||||||
pos=-1;
|
pos=-1;
|
||||||
}else if(name.localeCompare($(fileElements[fileElements.length-1]).attr('data-file'))>0){
|
}else if(name.localeCompare($(fileElements[fileElements.length-1]).attr('data-file'))>0){
|
||||||
pos=fileElements.length-1;
|
pos=fileElements.length-1;
|
||||||
}else{
|
}else{
|
||||||
for(var pos=0;pos<fileElements.length-1;pos++){
|
for(pos=0;pos<fileElements.length-1;pos++){
|
||||||
if(name.localeCompare($(fileElements[pos]).attr('data-file'))>0 && name.localeCompare($(fileElements[pos+1]).attr('data-file'))<0){
|
if(name.localeCompare($(fileElements[pos]).attr('data-file'))>0 && name.localeCompare($(fileElements[pos+1]).attr('data-file'))<0){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -116,9 +117,9 @@ var FileList={
|
||||||
$('.file_upload_filename').removeClass('highlight');
|
$('.file_upload_filename').removeClass('highlight');
|
||||||
},
|
},
|
||||||
loadingDone:function(name){
|
loadingDone:function(name){
|
||||||
var tr=$('tr').filterAttr('data-file',name);
|
var mime, tr=$('tr').filterAttr('data-file',name);
|
||||||
tr.data('loading',false);
|
tr.data('loading',false);
|
||||||
var mime=tr.data('mime');
|
mime=tr.data('mime');
|
||||||
tr.attr('data-mime',mime);
|
tr.attr('data-mime',mime);
|
||||||
getMimeIcon(mime,function(path){
|
getMimeIcon(mime,function(path){
|
||||||
tr.find('td.filename').attr('style','background-image:url('+path+')');
|
tr.find('td.filename').attr('style','background-image:url('+path+')');
|
||||||
|
@ -129,14 +130,15 @@ var FileList={
|
||||||
return $('tr').filterAttr('data-file',name).data('loading');
|
return $('tr').filterAttr('data-file',name).data('loading');
|
||||||
},
|
},
|
||||||
rename:function(name){
|
rename:function(name){
|
||||||
var tr=$('tr').filterAttr('data-file',name);
|
var tr, td, input, form;
|
||||||
|
tr=$('tr').filterAttr('data-file',name);
|
||||||
tr.data('renaming',true);
|
tr.data('renaming',true);
|
||||||
var td=tr.children('td.filename');
|
td=tr.children('td.filename');
|
||||||
var input=$('<input class="filename"></input>').val(name);
|
input=$('<input class="filename"></input>').val(name);
|
||||||
var form=$('<form></form>')
|
form=$('<form></form>');
|
||||||
form.append(input);
|
form.append(input);
|
||||||
td.children('a.name').text('');
|
td.children('a.name').text('');
|
||||||
td.children('a.name').append(form)
|
td.children('a.name').append(form);
|
||||||
input.focus();
|
input.focus();
|
||||||
form.submit(function(event){
|
form.submit(function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -317,7 +319,7 @@ var FileList={
|
||||||
FileList.finishDelete(null, true);
|
FileList.finishDelete(null, true);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#notification').hide();
|
$('#notification').hide();
|
||||||
|
@ -363,7 +365,7 @@ $(document).ready(function(){
|
||||||
FileList.finishDelete(null, true);
|
FileList.finishDelete(null, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
FileList.useUndo=('onbeforeunload' in window)
|
FileList.useUndo=(window.onbeforeunload)?true:false;
|
||||||
$(window).bind('beforeunload', function (){
|
$(window).bind('beforeunload', function (){
|
||||||
if (FileList.lastAction) {
|
if (FileList.lastAction) {
|
||||||
FileList.lastAction();
|
FileList.lastAction();
|
||||||
|
|
127
core/js/js.js
127
core/js/js.js
|
@ -4,21 +4,20 @@
|
||||||
* @param text the string to translate
|
* @param text the string to translate
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
var OC;
|
|
||||||
|
|
||||||
function t(app,text){
|
function t(app,text){
|
||||||
if( !( app in t.cache )){
|
if( !( t.cache[app] )){
|
||||||
$.ajax(OC.filePath('core','ajax','translations.php'),{
|
$.ajax(OC.filePath('core','ajax','translations.php'),{
|
||||||
async:false,//todo a proper sollution for this without sync ajax calls
|
async:false,//todo a proper sollution for this without sync ajax calls
|
||||||
data:{'app': app},
|
data:{'app': app},
|
||||||
type:'POST',
|
type:'POST',
|
||||||
success:function(jsondata){
|
success:function(jsondata){
|
||||||
t.cache[app] = jsondata.data;
|
t.cache[app] = jsondata.data;
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Bad answer ...
|
// Bad answer ...
|
||||||
if( !( app in t.cache )){
|
if( !( t.cache[app] )){
|
||||||
t.cache[app] = [];
|
t.cache[app] = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +40,7 @@ function fileDownloadPath(dir, file) {
|
||||||
return OC.filePath('files', 'ajax', 'download.php')+encodeURIComponent('?files='+encodeURIComponent(file)+'&dir='+encodeURIComponent(dir));
|
return OC.filePath('files', 'ajax', 'download.php')+encodeURIComponent('?files='+encodeURIComponent(file)+'&dir='+encodeURIComponent(dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
OC={
|
var OC={
|
||||||
PERMISSION_CREATE:4,
|
PERMISSION_CREATE:4,
|
||||||
PERMISSION_READ:1,
|
PERMISSION_READ:1,
|
||||||
PERMISSION_UPDATE:2,
|
PERMISSION_UPDATE:2,
|
||||||
|
@ -68,9 +67,9 @@ OC={
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
filePath:function(app,type,file){
|
filePath:function(app,type,file){
|
||||||
var isCore=OC.coreApps.indexOf(app)!=-1;
|
var isCore=OC.coreApps.indexOf(app)!==-1,
|
||||||
var link=OC.webroot;
|
link=OC.webroot;
|
||||||
if((file.substring(file.length-3) == 'php' || file.substring(file.length-3) == 'css') && !isCore){
|
if((file.substring(file.length-3) === 'php' || file.substring(file.length-3) === 'css') && !isCore){
|
||||||
link+='/?app=' + app;
|
link+='/?app=' + app;
|
||||||
if (file != 'index.php') {
|
if (file != 'index.php') {
|
||||||
link+='&getfile=';
|
link+='&getfile=';
|
||||||
|
@ -79,20 +78,21 @@ OC={
|
||||||
}
|
}
|
||||||
link+= file;
|
link+= file;
|
||||||
}
|
}
|
||||||
}else if(file.substring(file.length-3) != 'php' && !isCore){
|
}else if(file.substring(file.length-3) !== 'php' && !isCore){
|
||||||
link=OC.appswebroots[app];
|
link=OC.appswebroots[app];
|
||||||
if(type){
|
if(type){
|
||||||
link+= '/'+type+'/';
|
link+= '/'+type+'/';
|
||||||
}
|
}
|
||||||
if(link.substring(link.length-1) != '/')
|
if(link.substring(link.length-1) !== '/'){
|
||||||
link+='/';
|
link+='/';
|
||||||
|
}
|
||||||
link+=file;
|
link+=file;
|
||||||
}else{
|
}else{
|
||||||
link+='/';
|
link+='/';
|
||||||
if(!isCore){
|
if(!isCore){
|
||||||
link+='apps/';
|
link+='apps/';
|
||||||
}
|
}
|
||||||
if (app != '') {
|
if (app !== '') {
|
||||||
app+='/';
|
app+='/';
|
||||||
link+=app;
|
link+=app;
|
||||||
}
|
}
|
||||||
|
@ -126,12 +126,12 @@ OC={
|
||||||
* if the script is already loaded, the event handeler will be called directly
|
* if the script is already loaded, the event handeler will be called directly
|
||||||
*/
|
*/
|
||||||
addScript:function(app,script,ready){
|
addScript:function(app,script,ready){
|
||||||
var path=OC.filePath(app,'js',script+'.js');
|
var deferred, path=OC.filePath(app,'js',script+'.js');
|
||||||
if(!OC.addScript.loaded[path]){
|
if(!OC.addScript.loaded[path]){
|
||||||
if(ready){
|
if(ready){
|
||||||
var deferred=$.getScript(path,ready);
|
deferred=$.getScript(path,ready);
|
||||||
}else{
|
}else{
|
||||||
var deferred=$.getScript(path);
|
deferred=$.getScript(path);
|
||||||
}
|
}
|
||||||
OC.addScript.loaded[path]=deferred;
|
OC.addScript.loaded[path]=deferred;
|
||||||
}else{
|
}else{
|
||||||
|
@ -148,9 +148,9 @@ OC={
|
||||||
*/
|
*/
|
||||||
addStyle:function(app,style){
|
addStyle:function(app,style){
|
||||||
var path=OC.filePath(app,'css',style+'.css');
|
var path=OC.filePath(app,'css',style+'.css');
|
||||||
if(OC.addStyle.loaded.indexOf(path)==-1){
|
if(OC.addStyle.loaded.indexOf(path)===-1){
|
||||||
OC.addStyle.loaded.push(path);
|
OC.addStyle.loaded.push(path);
|
||||||
var style=$('<link rel="stylesheet" type="text/css" href="'+path+'"/>');
|
style=$('<link rel="stylesheet" type="text/css" href="'+path+'"/>');
|
||||||
$('head').append(style);
|
$('head').append(style);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -158,7 +158,7 @@ OC={
|
||||||
return path.replace(/\\/g,'/').replace( /.*\//, '' );
|
return path.replace(/\\/g,'/').replace( /.*\//, '' );
|
||||||
},
|
},
|
||||||
dirname: function(path) {
|
dirname: function(path) {
|
||||||
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');;
|
return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* do a search query and display the results
|
* do a search query and display the results
|
||||||
|
@ -175,10 +175,9 @@ OC={
|
||||||
},
|
},
|
||||||
dialogs:OCdialogs,
|
dialogs:OCdialogs,
|
||||||
mtime2date:function(mtime) {
|
mtime2date:function(mtime) {
|
||||||
mtime = parseInt(mtime);
|
mtime = parseInt(mtime,10);
|
||||||
var date = new Date(1000*mtime);
|
var date = new Date(1000*mtime);
|
||||||
var ret = date.getDate()+'.'+(date.getMonth()+1)+'.'+date.getFullYear()+', '+date.getHours()+':'+date.getMinutes();
|
return date.getDate()+'.'+(date.getMonth()+1)+'.'+date.getFullYear()+', '+date.getHours()+':'+date.getMinutes();
|
||||||
return ret;
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Opens a popup with the setting for an app.
|
* Opens a popup with the setting for an app.
|
||||||
|
@ -285,33 +284,33 @@ OC.Breadcrumb={
|
||||||
OC.Breadcrumb.container.find('div.crumb').remove();
|
OC.Breadcrumb.container.find('div.crumb').remove();
|
||||||
OC.Breadcrumb.crumbs=[];
|
OC.Breadcrumb.crumbs=[];
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
if(typeof localStorage !='undefined' && localStorage != null){
|
if(typeof localStorage !=='undefined' && localStorage !== null){
|
||||||
//user and instance awere localstorage
|
//user and instance aware localstorage
|
||||||
OC.localStorage={
|
OC.localStorage={
|
||||||
namespace:'oc_'+OC.currentUser+'_'+OC.webroot+'_',
|
namespace:'oc_'+OC.currentUser+'_'+OC.webroot+'_',
|
||||||
hasItem:function(name){
|
hasItem:function(name){
|
||||||
return OC.localStorage.getItem(name)!=null;
|
return OC.localStorage.getItem(name)!==null;
|
||||||
},
|
},
|
||||||
setItem:function(name,item){
|
setItem:function(name,item){
|
||||||
return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item));
|
return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item));
|
||||||
},
|
},
|
||||||
getItem:function(name){
|
getItem:function(name){
|
||||||
if(localStorage.getItem(OC.localStorage.namespace+name)==null){return null;}
|
if(localStorage.getItem(OC.localStorage.namespace+name)===null){return null;}
|
||||||
return JSON.parse(localStorage.getItem(OC.localStorage.namespace+name));
|
return JSON.parse(localStorage.getItem(OC.localStorage.namespace+name));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}else{
|
}else{
|
||||||
//dummy localstorage
|
//dummy localstorage
|
||||||
OC.localStorage={
|
OC.localStorage={
|
||||||
hasItem:function(name){
|
hasItem:function(){
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
setItem:function(name,item){
|
setItem:function(){
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
getItem:function(name){
|
getItem:function(){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -323,8 +322,9 @@ if(typeof localStorage !='undefined' && localStorage != null){
|
||||||
if (!Array.prototype.filter) {
|
if (!Array.prototype.filter) {
|
||||||
Array.prototype.filter = function(fun /*, thisp*/) {
|
Array.prototype.filter = function(fun /*, thisp*/) {
|
||||||
var len = this.length >>> 0;
|
var len = this.length >>> 0;
|
||||||
if (typeof fun != "function")
|
if (typeof fun !== "function"){
|
||||||
throw new TypeError();
|
throw new TypeError();
|
||||||
|
}
|
||||||
|
|
||||||
var res = [];
|
var res = [];
|
||||||
var thisp = arguments[1];
|
var thisp = arguments[1];
|
||||||
|
@ -347,18 +347,17 @@ if (!Array.prototype.indexOf){
|
||||||
var len = this.length;
|
var len = this.length;
|
||||||
|
|
||||||
var from = Number(arguments[1]) || 0;
|
var from = Number(arguments[1]) || 0;
|
||||||
from = (from < 0)
|
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
||||||
? Math.ceil(from)
|
if (from < 0){
|
||||||
: Math.floor(from);
|
|
||||||
if (from < 0)
|
|
||||||
from += len;
|
from += len;
|
||||||
|
}
|
||||||
|
|
||||||
for (; from < len; from++)
|
for (; from < len; from++)
|
||||||
{
|
{
|
||||||
if (from in this &&
|
if (from in this && this[from] === elt){
|
||||||
this[from] === elt)
|
|
||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -378,16 +377,16 @@ SVGSupport.checkMimeType=function(){
|
||||||
$.each(headerParts,function(i,text){
|
$.each(headerParts,function(i,text){
|
||||||
if(text){
|
if(text){
|
||||||
var parts=text.split(':',2);
|
var parts=text.split(':',2);
|
||||||
if(parts.length==2){
|
if(parts.length===2){
|
||||||
var value=parts[1].trim();
|
var value=parts[1].trim();
|
||||||
if(value[0]=='"'){
|
if(value[0]==='"'){
|
||||||
value=value.substr(1,value.length-2);
|
value=value.substr(1,value.length-2);
|
||||||
}
|
}
|
||||||
headers[parts[0]]=value;
|
headers[parts[0]]=value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if(headers["Content-Type"]!='image/svg+xml'){
|
if(headers["Content-Type"]!=='image/svg+xml'){
|
||||||
replaceSVG();
|
replaceSVG();
|
||||||
SVGSupport.checkMimeType.correct=false;
|
SVGSupport.checkMimeType.correct=false;
|
||||||
}
|
}
|
||||||
|
@ -444,28 +443,30 @@ function object(o) {
|
||||||
* Fills height of window. (more precise than height: 100%;)
|
* Fills height of window. (more precise than height: 100%;)
|
||||||
*/
|
*/
|
||||||
function fillHeight(selector) {
|
function fillHeight(selector) {
|
||||||
if (selector.length == 0) {
|
if (selector.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var height = parseFloat($(window).height())-selector.offset().top;
|
var height = parseFloat($(window).height())-selector.offset().top;
|
||||||
selector.css('height', height + 'px');
|
selector.css('height', height + 'px');
|
||||||
if(selector.outerHeight() > selector.height())
|
if(selector.outerHeight() > selector.height()){
|
||||||
selector.css('height', height-(selector.outerHeight()-selector.height()) + 'px');
|
selector.css('height', height-(selector.outerHeight()-selector.height()) + 'px');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills height and width of window. (more precise than height: 100%; or width: 100%;)
|
* Fills height and width of window. (more precise than height: 100%; or width: 100%;)
|
||||||
*/
|
*/
|
||||||
function fillWindow(selector) {
|
function fillWindow(selector) {
|
||||||
if (selector.length == 0) {
|
if (selector.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fillHeight(selector);
|
fillHeight(selector);
|
||||||
var width = parseFloat($(window).width())-selector.offset().left;
|
var width = parseFloat($(window).width())-selector.offset().left;
|
||||||
selector.css('width', width + 'px');
|
selector.css('width', width + 'px');
|
||||||
if(selector.outerWidth() > selector.width())
|
if(selector.outerWidth() > selector.width()){
|
||||||
selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px');
|
selector.css('width', width-(selector.outerWidth()-selector.width()) + 'px');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
|
@ -485,26 +486,26 @@ $(document).ready(function(){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
$('#searchbox').keyup(function(event){
|
$('#searchbox').keyup(function(event){
|
||||||
if(event.keyCode==13){//enter
|
if(event.keyCode===13){//enter
|
||||||
if(OC.search.currentResult>-1){
|
if(OC.search.currentResult>-1){
|
||||||
var result=$('#searchresults tr.result a')[OC.search.currentResult];
|
var result=$('#searchresults tr.result a')[OC.search.currentResult];
|
||||||
window.location = $(result).attr('href');
|
window.location = $(result).attr('href');
|
||||||
}
|
}
|
||||||
}else if(event.keyCode==38){//up
|
}else if(event.keyCode===38){//up
|
||||||
if(OC.search.currentResult>0){
|
if(OC.search.currentResult>0){
|
||||||
OC.search.currentResult--;
|
OC.search.currentResult--;
|
||||||
OC.search.renderCurrent();
|
OC.search.renderCurrent();
|
||||||
}
|
}
|
||||||
}else if(event.keyCode==40){//down
|
}else if(event.keyCode===40){//down
|
||||||
if(OC.search.lastResults.length>OC.search.currentResult+1){
|
if(OC.search.lastResults.length>OC.search.currentResult+1){
|
||||||
OC.search.currentResult++;
|
OC.search.currentResult++;
|
||||||
OC.search.renderCurrent();
|
OC.search.renderCurrent();
|
||||||
}
|
}
|
||||||
}else if(event.keyCode==27){//esc
|
}else if(event.keyCode===27){//esc
|
||||||
OC.search.hide();
|
OC.search.hide();
|
||||||
}else{
|
}else{
|
||||||
var query=$('#searchbox').val();
|
var query=$('#searchbox').val();
|
||||||
if(OC.search.lastQuery!=query){
|
if(OC.search.lastQuery!==query){
|
||||||
OC.search.lastQuery=query;
|
OC.search.lastQuery=query;
|
||||||
OC.search.currentResult=-1;
|
OC.search.currentResult=-1;
|
||||||
if(query.length>2){
|
if(query.length>2){
|
||||||
|
@ -524,10 +525,10 @@ $(document).ready(function(){
|
||||||
//use infield labels
|
//use infield labels
|
||||||
$("label.infield").inFieldLabels();
|
$("label.infield").inFieldLabels();
|
||||||
|
|
||||||
checkShowCredentials = function() {
|
var checkShowCredentials = function() {
|
||||||
var empty = false;
|
var empty = false;
|
||||||
$('input#user, input#password').each(function() {
|
$('input#user, input#password').each(function() {
|
||||||
if ($(this).val() == '') {
|
if ($(this).val() === '') {
|
||||||
empty = true;
|
empty = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -540,14 +541,14 @@ $(document).ready(function(){
|
||||||
$('#remember_login').show();
|
$('#remember_login').show();
|
||||||
$('#remember_login+label').fadeIn();
|
$('#remember_login+label').fadeIn();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
// hide log in button etc. when form fields not filled
|
// hide log in button etc. when form fields not filled
|
||||||
// commented out due to some browsers having issues with it
|
// commented out due to some browsers having issues with it
|
||||||
// checkShowCredentials();
|
// checkShowCredentials();
|
||||||
// $('input#user, input#password').keyup(checkShowCredentials);
|
// $('input#user, input#password').keyup(checkShowCredentials);
|
||||||
|
|
||||||
$('#settings #expand').keydown(function(event) {
|
$('#settings #expand').keydown(function(event) {
|
||||||
if (event.which == 13 || event.which == 32) {
|
if (event.which === 13 || event.which === 32) {
|
||||||
$('#expand').click()
|
$('#expand').click()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -558,8 +559,8 @@ $(document).ready(function(){
|
||||||
$('#settings #expanddiv').click(function(event){
|
$('#settings #expanddiv').click(function(event){
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
$(window).click(function(){//hide the settings menu when clicking oustide it
|
$(window).click(function(){//hide the settings menu when clicking outside it
|
||||||
if($('body').attr("id")=="body-user"){
|
if($('body').attr("id")==="body-user"){
|
||||||
$('#settings #expanddiv').slideUp();
|
$('#settings #expanddiv').slideUp();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -586,13 +587,15 @@ if (!Array.prototype.map){
|
||||||
Array.prototype.map = function(fun /*, thisp */){
|
Array.prototype.map = function(fun /*, thisp */){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (this === void 0 || this === null)
|
if (this === void 0 || this === null){
|
||||||
throw new TypeError();
|
throw new TypeError();
|
||||||
|
}
|
||||||
|
|
||||||
var t = Object(this);
|
var t = Object(this);
|
||||||
var len = t.length >>> 0;
|
var len = t.length >>> 0;
|
||||||
if (typeof fun !== "function")
|
if (typeof fun !== "function"){
|
||||||
throw new TypeError();
|
throw new TypeError();
|
||||||
|
}
|
||||||
|
|
||||||
var res = new Array(len);
|
var res = new Array(len);
|
||||||
var thisp = arguments[1];
|
var thisp = arguments[1];
|
||||||
|
@ -614,13 +617,13 @@ $.fn.filterAttr = function(attr_name, attr_value) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function humanFileSize(size) {
|
function humanFileSize(size) {
|
||||||
humanList = ['B', 'kB', 'MB', 'GB', 'TB'];
|
var humanList = ['B', 'kB', 'MB', 'GB', 'TB'];
|
||||||
// Calculate Log with base 1024: size = 1024 ** order
|
// Calculate Log with base 1024: size = 1024 ** order
|
||||||
order = Math.floor(Math.log(size) / Math.log(1024));
|
var order = Math.floor(Math.log(size) / Math.log(1024));
|
||||||
// Stay in range of the byte sizes that are defined
|
// Stay in range of the byte sizes that are defined
|
||||||
order = Math.min(humanList.length - 1, order);
|
order = Math.min(humanList.length - 1, order);
|
||||||
readableFormat = humanList[order];
|
var readableFormat = humanList[order];
|
||||||
relativeSize = (size / Math.pow(1024, order)).toFixed(1);
|
var relativeSize = (size / Math.pow(1024, order)).toFixed(1);
|
||||||
if(relativeSize.substr(relativeSize.length-2,2)=='.0'){
|
if(relativeSize.substr(relativeSize.length-2,2)=='.0'){
|
||||||
relativeSize=relativeSize.substr(0,relativeSize.length-2);
|
relativeSize=relativeSize.substr(0,relativeSize.length-2);
|
||||||
}
|
}
|
||||||
|
@ -628,7 +631,7 @@ function humanFileSize(size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function simpleFileSize(bytes) {
|
function simpleFileSize(bytes) {
|
||||||
mbytes = Math.round(bytes/(1024*1024/10))/10;
|
var mbytes = Math.round(bytes/(1024*1024/10))/10;
|
||||||
if(bytes == 0) { return '0'; }
|
if(bytes == 0) { return '0'; }
|
||||||
else if(mbytes < 0.1) { return '< 0.1'; }
|
else if(mbytes < 0.1) { return '< 0.1'; }
|
||||||
else if(mbytes > 1000) { return '> 1000'; }
|
else if(mbytes > 1000) { return '> 1000'; }
|
||||||
|
@ -660,7 +663,7 @@ OC.get=function(name) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return context[tail];
|
return context[tail];
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set a variable by name
|
* set a variable by name
|
||||||
|
@ -679,4 +682,4 @@ OC.set=function(name, value) {
|
||||||
context = context[namespaces[i]];
|
context = context[namespaces[i]];
|
||||||
}
|
}
|
||||||
context[tail]=value;
|
context[tail]=value;
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in New Issue