Fix coding style complaints

This commit is contained in:
Victor Dubiniuk 2015-06-16 20:02:05 +03:00
parent a5ae82e870
commit 0606fc58a5
5 changed files with 23 additions and 18 deletions

View File

@ -5,7 +5,7 @@ $(document).ready(function(){
var documentsSettings = { var documentsSettings = {
save : function() { save : function() {
$('#docs_apply').attr('disabled', true); $('#docs_apply').attr('disabled', true);
var data = { var data = {
converter : $('[name="docs_converter"]:checked').val() converter : $('[name="docs_converter"]:checked').val()
}; };

View File

@ -14,8 +14,8 @@ $(document).ready(function(){
$('#documents-default-path').blur(documentsSettings.save); $('#documents-default-path').blur(documentsSettings.save);
$('#documents-default-path').keypress(function( event ) { $('#documents-default-path').keypress(function( event ) {
if (event.which == 13) { if (event.which == 13) {
event.preventDefault(); event.preventDefault();
documentsSettings.save(); documentsSettings.save();
} }
}); });
}); });

View File

@ -8,7 +8,7 @@ $(document).ready(function(){
$.post(OC.generateUrl('apps/documents/ajax/config/unstable'), data, documentsSettings.afterSave); $.post(OC.generateUrl('apps/documents/ajax/config/unstable'), data, documentsSettings.afterSave);
}, },
afterSave : function(){ afterSave : function(){
documentsMain.useUnstable = $('#webodf-unstable').attr('checked')==="checked" documentsMain.useUnstable = $('#webodf-unstable').attr('checked')==="checked";
} }
}; };
$('#webodf-unstable').change(documentsSettings.save); $('#webodf-unstable').change(documentsSettings.save);

View File

@ -13,21 +13,25 @@ var odfViewer = {
], ],
register : function(response){ register : function(response){
var i,
mimeRead,
mimeUpdate;
if (response && response.mimes){ if (response && response.mimes){
jQuery.each(response.mimes, function(i, mime){ jQuery.each(response.mimes, function(i, mime){
odfViewer.supportedMimesRead.push(mime); odfViewer.supportedMimesRead.push(mime);
odfViewer.supportedMimesUpdate.push(mime); odfViewer.supportedMimesUpdate.push(mime);
}); });
} }
for (var i = 0; i < odfViewer.supportedMimesRead.length; ++i) { for (i = 0; i < odfViewer.supportedMimesRead.length; ++i) {
var mime = odfViewer.supportedMimesRead[i]; mimeRead = odfViewer.supportedMimesRead[i];
OCA.Files.fileActions.register(mime, 'View', OC.PERMISSION_READ, '', odfViewer.onView); OCA.Files.fileActions.register(mimeRead, 'View', OC.PERMISSION_READ, '', odfViewer.onView);
OCA.Files.fileActions.setDefault(mime, 'View'); OCA.Files.fileActions.setDefault(mimeRead, 'View');
} }
for (var i = 0; i < odfViewer.supportedMimesUpdate.length; ++i) { for (i = 0; i < odfViewer.supportedMimesUpdate.length; ++i) {
var mime = odfViewer.supportedMimesUpdate[i]; mimeUpdate = odfViewer.supportedMimesUpdate[i];
OCA.Files.fileActions.register( OCA.Files.fileActions.register(
mime, mimeUpdate,
'Edit', 'Edit',
OC.PERMISSION_UPDATE, OC.PERMISSION_UPDATE,
OC.imagePath('core', 'actions/rename'), OC.imagePath('core', 'actions/rename'),
@ -39,7 +43,7 @@ var odfViewer = {
dispatch : function(filename){ dispatch : function(filename){
if (odfViewer.supportedMimesUpdate.indexOf(OCA.Files.fileActions.getCurrentMimeType()) !== -1 if (odfViewer.supportedMimesUpdate.indexOf(OCA.Files.fileActions.getCurrentMimeType()) !== -1
&& OCA.Files.fileActions.getCurrentPermissions() & OC.PERMISSION_UPDATE && OCA.Files.fileActions.getCurrentPermissions() & OC.PERMISSION_UPDATE
){ ){
odfViewer.onEdit(filename); odfViewer.onEdit(filename);
} else { } else {
@ -48,7 +52,8 @@ var odfViewer = {
}, },
onEdit : function(fileName, context){ onEdit : function(fileName, context){
var fileId = context.$file.attr('data-id'); var location,
fileId = context.$file.attr('data-id');
window.location = OC.linkTo('documents', 'index.php') + '#' + fileId; window.location = OC.linkTo('documents', 'index.php') + '#' + fileId;
}, },
@ -58,12 +63,13 @@ var odfViewer = {
if (odfViewer.isDocuments){ if (odfViewer.isDocuments){
//Documents view //Documents view
var location = filename; location = filename;
} else { } else {
//Public page, files app, etc //Public page, files app, etc
var dirName = $('#dir').val()!='/' ? $('#dir').val() + '/' : '/'; var dirName = $('#dir').val()!='/' ? $('#dir').val() + '/' : '/';
var location = OC.filePath('documents', 'ajax', 'download.php') + '?path=' + encodeURIComponent(dirName) + encodeURIComponent(filename) location = OC.filePath('documents', 'ajax', 'download.php') + '?path='
+ '&requesttoken=' + encodeURIComponent(oc_requesttoken); + encodeURIComponent(dirName) + encodeURIComponent(filename)
+ '&requesttoken=' + encodeURIComponent(oc_requesttoken);
OC.addStyle('documents', '3rdparty/webodf/wodotexteditor'); OC.addStyle('documents', '3rdparty/webodf/wodotexteditor');
} }

View File

@ -42,8 +42,7 @@ define("owncloud/widgets/ocToolbar",
ocClose.startup(); ocClose.startup();
}); });
return callback(ocToolbar); return callback(ocToolbar);
} };
;
// init // init
makeWidget(function (widget) { makeWidget(function (widget) {
return callback(widget); return callback(widget);