MINOR: jslint suggested improvements

This commit is contained in:
Julian Seidenberg 2012-08-06 18:14:34 +12:00
parent 782b07ec80
commit fd94ad19f4
1 changed files with 10 additions and 5 deletions

View File

@ -1,20 +1,26 @@
(function($){
"use strict";
$.entwine('ss', function($) {
$('.ss-gridfield .action.dms-delete').entwine({
onclick: function(e){
//work out how many pages are left attached to this document
var pagesCount = this.data('pages-count');
var pagesCountAfterDeletion = pagesCount - 1;
var addS = 's';
if (pagesCountAfterDeletion == 1) addS = '';
if (pagesCountAfterDeletion === 1) {
addS = '';
}
//display an appropriate message
var message = '';
if (this.hasClass('dms-delete-last-warning')) message = "Permanently delete this document?\n\nWarning: this document is attached only to this page, deleting it here will delete it permanently.";
if (this.hasClass('dms-delete-link-only')) message = "Unlink this document from this page?\n\nNote: it will remain attached to "+pagesCountAfterDeletion+" other page"+addS+".";
if (this.hasClass('dms-delete-last-warning')) {
message = "Permanently delete this document?\n\nWarning: this document is attached only to this page, deleting it here will delete it permanently.";
}
if (this.hasClass('dms-delete-link-only')) {
message = "Unlink this document from this page?\n\nNote: it will remain attached to "+pagesCountAfterDeletion+" other page"+addS+".";
}
if(!confirm(message)) {
e.preventDefault();
@ -26,7 +32,6 @@
}
});
});
}(jQuery));