From 02e0bbb71fbf2a5f13e6c375191e1dd1234d3834 Mon Sep 17 00:00:00 2001 From: Jamie Snape Date: Wed, 7 Oct 2015 15:50:52 -0400 Subject: [PATCH] Fix various ESLint errors --- core/public/js/admin/admin.index.js | 50 +++++----- core/public/js/admin/admin.migrate.js | 26 ++--- core/public/js/admin/admin.upgrade.js | 6 +- core/public/js/apikey/apikey.usertab.js | 10 +- core/public/js/browse/browse.index.js | 16 ++-- core/public/js/browse/browse.movecopy.js | 19 ++-- core/public/js/browse/browse.selectfolder.js | 18 ++-- core/public/js/browse/browse.selectitem.js | 34 +++---- core/public/js/common/common.browser.js | 48 +++++----- core/public/js/common/common.feed.js | 8 +- core/public/js/community/community.create.js | 8 +- core/public/js/community/community.index.js | 4 +- .../js/community/community.invitation.js | 16 ++-- core/public/js/community/community.manage.js | 96 +++++++++---------- .../js/community/community.selectgroup.js | 8 +- core/public/js/community/community.view.js | 12 +-- .../js/element/serversidefilechooser.js | 34 +++---- core/public/js/feed/feed.index.js | 6 +- core/public/js/folder/folder.createfolder.js | 28 +++--- core/public/js/folder/folder.view.js | 14 +-- core/public/js/import/import.index.js | 80 ++++++++-------- core/public/js/install/install.step2.js | 13 ++- core/public/js/item/item.editmetadata.js | 4 +- core/public/js/item/item.view.js | 66 ++++++------- .../js/jquery/jquery.autogrow-textarea.js | 6 +- core/public/js/jquery/jquery.checkboxrange.js | 30 +++--- core/public/js/layout/midas.dialog.js | 26 ++--- core/public/js/layout/midas.empty.js | 7 -- core/public/js/layout/midas.layout.js | 65 ++++++------- core/public/js/layout/midas.notice.js | 1 - core/public/js/rest/rest.index.js | 18 +--- core/public/js/search/search.index.js | 42 ++++---- core/public/js/share/share.dialog.js | 74 +++++++------- core/public/js/upload/upload.revision.js | 8 +- core/public/js/upload/upload.simpleupload.js | 9 +- core/public/js/user/user.emailregister.js | 4 +- core/public/js/user/user.login.js | 6 +- core/public/js/user/user.manage.js | 70 +++++++------- core/public/js/user/user.recoverpassword.js | 2 +- core/public/js/user/user.register.js | 6 +- core/public/js/user/user.settings.js | 6 +- core/public/js/user/user.userpage.js | 10 +- .../public/js/upload/upload.index.js | 2 +- .../public/js/admin/admin.index.js | 20 ++-- .../public/js/item/dicomserver.item.view.js | 6 +- .../public/js/login/googleauth.login.js | 2 +- .../public/js/common/common.notify.js | 2 + .../public/js/upload/upload.index.js | 2 +- .../mfa/public/js/config/config.usertab.js | 2 +- modules/mfa/public/js/login/login.dialog.js | 2 +- .../oauth/public/js/client/client.index.js | 14 +-- .../pvw/public/js/paraview/paraview.common.js | 4 +- .../pvw/public/js/paraview/paraview.volume.js | 14 +-- .../public/js/executable/executable.define.js | 27 +++--- .../public/js/job/job.init.js | 52 +++++----- .../public/js/job/job.manage.js | 6 +- .../public/js/job/job.view.js | 8 +- .../public/js/layout/remoteprocessing.js | 2 +- .../public/js/folder/folder.index.js | 6 +- .../solr/public/js/advanced/advanced.index.js | 24 ++--- .../statistics/public/js/index/index.index.js | 6 +- .../statistics/public/js/item/item.index.js | 18 ++-- .../public/js/producer/producer.edit.js | 6 +- .../public/js/producer/producer.view.js | 2 +- .../public/js/scalar/scalar.details.js | 6 +- modules/tracker/public/js/trend/trend.view.js | 14 +-- .../visualize/public/js/image/image.index.js | 2 +- .../visualize/public/js/media/media.index.js | 35 ++++--- .../public/js/paraview/paraview.dual.js | 8 +- .../public/js/paraview/paraview.slice.js | 5 +- .../public/js/paraview/paraview.surface.js | 3 +- .../public/js/paraview/paraview.volume.js | 5 +- .../public/js/wrapper/wrapper.index.js | 12 +-- 73 files changed, 646 insertions(+), 685 deletions(-) diff --git a/core/public/js/admin/admin.index.js b/core/public/js/admin/admin.index.js index 4cd222225..0e597ea17 100644 --- a/core/public/js/admin/admin.index.js +++ b/core/public/js/admin/admin.index.js @@ -20,9 +20,9 @@ midas.admin.initModulesConfigLinks = function () { /** On assetstore add response */ midas.admin.assetstoreAddCallback = function (responseText, statusText, xhr, $form) { 'use strict'; - $(".assetstoreLoading").hide(); + $('.assetstoreLoading').hide(); if (responseText.error) { - $(".addAssetstoreFormError").html('Error: ' + responseText.error).show(); + $('.addAssetstoreFormError').html('Error: ' + responseText.error).show(); } else if (responseText.msg) { $(document).trigger('hideCluetip'); @@ -41,25 +41,25 @@ midas.admin.assetstoreSubmit = function (formData, jqForm, options) { // Add the type is the one in the main page (because it's hidden in the assetstore add page) var assetstoretype = {}; assetstoretype.name = 'type'; - assetstoretype.value = $("#importassetstoretype").val(); + assetstoretype.value = $('#importassetstoretype').val(); formData.push(assetstoretype); - $(".assetstoreLoading").show(); - $(".addAssetstoreFormError").html('').hide(); + $('.assetstoreLoading').show(); + $('.addAssetstoreFormError').html('').hide(); }; // end assetstoreBeforeSubmit /** When the cancel is clicked in the new assetstore window */ midas.admin.newAssetstoreShow = function () { 'use strict'; var assetstoretype = $('select#importassetstoretype option:selected').val(); - $('#assetstoretype').find('option:selected').removeAttr("selected"); - $('#assetstoretype').find('option[value=' + assetstoretype + ']').attr("selected", "selected"); + $('#assetstoretype').find('option:selected').removeAttr('selected'); + $('#assetstoretype').find('option[value=' + assetstoretype + ']').attr('selected', 'selected'); }; // end function newAssetstoreShow /** When the cancel is clicked in the new assetstore window */ midas.admin.newAssetstoreHide = function () { 'use strict'; $(document).trigger('hideCluetip'); -}; // end function newAssetstoreHide +}; midas.admin.validateConfig = function (formData, jqForm, options) {}; @@ -70,7 +70,7 @@ midas.admin.successConfig = function (responseText, statusText, xhr, form) { jsonResponse = $.parseJSON(responseText); } catch (e) { - midas.createNotice("An error occured. Please check the logs.", 4000, 'error'); + midas.createNotice('An error occured. Please check the logs.', 4000, 'error'); return false; } if (jsonResponse === null) { @@ -87,15 +87,15 @@ midas.admin.successConfig = function (responseText, statusText, xhr, form) { $(document).ready(function () { 'use strict'; - midas.admin.tabs = $("#tabsGeneric").tabs({}); - $("#tabsGeneric").show(); + midas.admin.tabs = $('#tabsGeneric').tabs({}); + $('#tabsGeneric').show(); $('img.tabsLoading').hide(); $('.defaultAssetstoreLink').click(function () { $.post(json.global.webroot + '/assetstore/defaultassetstore', { - submitDefaultAssetstore: true, - element: $(this).attr('element') - }, + submitDefaultAssetstore: true, + element: $(this).attr('element') + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { @@ -126,9 +126,9 @@ $(document).ready(function () { midas.showDialogWithContent('Remove Assetstore', html, false); $('input.deleteAssetstoreYes').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); midas.ajaxSelectRequest = $.ajax({ - type: "POST", + type: 'POST', url: json.global.webroot + '/assetstore/delete', data: { assetstoreId: element @@ -144,7 +144,7 @@ $(document).ready(function () { }); }); $('input.deleteAssetstoreNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); @@ -163,7 +163,7 @@ $(document).ready(function () { $('input#assetstoreSubmit').unbind('click').click(function () { midas.ajaxSelectRequest = $.ajax({ - type: "POST", + type: 'POST', url: json.global.webroot + '/assetstore/edit', data: { assetstoreId: element, @@ -184,7 +184,7 @@ $(document).ready(function () { }); }); $('input.deleteAssetstoreNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); @@ -224,7 +224,7 @@ $(document).ready(function () { modulename: l, modulevalue: modulevalue }); - midas.createNotice("Dependancy: Enabling module " + l, 1500); + midas.createNotice('Dependancy: Enabling module ' + l, 1500); } $('input[module=' + l + ']').attr('checked', true); } @@ -248,7 +248,7 @@ $(document).ready(function () { $.each(moduleDependencies, function (i, l) { if (l != '') { found = true; - midas.createNotice("Dependency: The module " + l + " requires " + mainModule + ". You must disable it first.", 4000, 'warning'); + midas.createNotice('Dependency: The module ' + l + ' requires ' + mainModule + '. You must disable it first.', 4000, 'warning'); } }); if (found) { @@ -258,10 +258,10 @@ $(document).ready(function () { } $.post(json.global.webroot + '/admin/index', { - submitModule: true, - modulename: $(this).attr('module'), - modulevalue: modulevalue - }, + submitModule: true, + modulename: $(this).attr('module'), + modulevalue: modulevalue + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { diff --git a/core/public/js/admin/admin.migrate.js b/core/public/js/admin/admin.migrate.js index 1fad6e20e..615a09ef7 100644 --- a/core/public/js/admin/admin.migrate.js +++ b/core/public/js/admin/admin.migrate.js @@ -40,12 +40,12 @@ function startMigrate() { function migrateCallback(responseText, statusText, xhr, form) { 'use strict'; if (responseText.error) { - $(".viewNotice").html(responseText.error); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(300); + $('.viewNotice').html(responseText.error); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(300); } else if (responseText.message) { - $(".viewNotice").html(responseText.message); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(300); + $('.viewNotice').html(responseText.message); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(300); } } @@ -55,26 +55,26 @@ function assetstoreSubmit(formData, jqForm, options) { // Add the type is the one in the main page (because it's hidden in the assetstore add page) var assetstoretype = {}; assetstoretype.name = 'type'; - assetstoretype.value = $("#importassetstoretype").val(); + assetstoretype.value = $('#importassetstoretype').val(); formData.push(assetstoretype); - $(".assetstoreLoading").show(); + $('.assetstoreLoading').show(); } // end assetstoreBeforeSubmit /** On assetstore add success */ function assetstoreAddCallback(responseText, statusText, xhr, $form) { 'use strict'; - $(".assetstoreLoading").hide(); + $('.assetstoreLoading').hide(); if (responseText.error) { - $(".viewNotice").html(responseText.error); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(100); + $('.viewNotice').html(responseText.error); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(100); } else if (responseText.msg) { $(document).trigger('hideCluetip'); // It worked, we add the assetstore to the list and we select it by default if (responseText.assetstore_id) { - $("#assetstore").append($("").attr("value", responseText.assetstore_id).text(responseText.assetstore_name) - .attr("selected", "selected")); + $('#assetstore').append($('').attr('value', responseText.assetstore_id).text(responseText.assetstore_name) + .attr('selected', 'selected')); // Add to JSON var newassetstore = {}; @@ -84,8 +84,8 @@ function assetstoreAddCallback(responseText, statusText, xhr, $form) { assetstores.push(newassetstore); } - $(".viewNotice").html(responseText.msg); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(100); + $('.viewNotice').html(responseText.msg); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(100); } } // end assetstoreAddCallback diff --git a/core/public/js/admin/admin.upgrade.js b/core/public/js/admin/admin.upgrade.js index 226d7853f..b765a450a 100644 --- a/core/public/js/admin/admin.upgrade.js +++ b/core/public/js/admin/admin.upgrade.js @@ -9,9 +9,7 @@ $('#upgradeMIDAS').ajaxForm({ success: successUpgrade }); -function validateUpgrade(formData, jqForm, options) { - -} +function validateUpgrade(formData, jqForm, options) {} function successUpgrade(responseText, statusText, xhr, form) { 'use strict'; @@ -19,7 +17,7 @@ function successUpgrade(responseText, statusText, xhr, form) { try { jsonResponse = $.parseJSON(responseText); } catch (e) { - alert("An error occured. Please check the logs."); + alert('An error occured. Please check the logs.'); return false; } if (jsonResponse === null) { diff --git a/core/public/js/apikey/apikey.usertab.js b/core/public/js/apikey/apikey.usertab.js index ede99be6b..662d0e171 100644 --- a/core/public/js/apikey/apikey.usertab.js +++ b/core/public/js/apikey/apikey.usertab.js @@ -14,7 +14,7 @@ midas.apikey.successApiConfig = function (responseText, statusText, xhr, form) { jsonResponse = $.parseJSON(responseText); } catch (e) { - midas.createNotice("An error occured. Please check the logs.", 4000, 'error'); + midas.createNotice('An error occured. Please check the logs.', 4000, 'error'); return false; } if (jsonResponse === null) { @@ -40,10 +40,10 @@ $(document).ready(function () { $('a.deleteApiKeyLink').click(function () { var obj = $(this); $.post(json.global.webroot + '/apikey/usertab', { - deleteAPIKey: true, - element: $(this).attr('element'), - userId: $('#apiUserId').val() - }, + deleteAPIKey: true, + element: $(this).attr('element'), + userId: $('#apiUserId').val() + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { diff --git a/core/public/js/browse/browse.index.js b/core/public/js/browse/browse.index.js index 18b4544e0..6e27b42a9 100644 --- a/core/public/js/browse/browse.index.js +++ b/core/public/js/browse/browse.index.js @@ -6,30 +6,30 @@ var midas = midas || {}; $(document).ready( function () { 'use strict'; - $("#browseTable").treeTable(); - $("img.tableLoading").hide(); - $("table#browseTable").show(); + $('#browseTable').treeTable(); + $('img.tableLoading').hide(); + $('table#browseTable').show(); - $('div.feedThumbnail img').fadeTo("slow", 0.4); + $('div.feedThumbnail img').fadeTo('slow', 0.4); $('div.feedThumbnail img').mouseover( function () { - $(this).fadeTo("fast", 1); + $(this).fadeTo('fast', 1); }); $('div.feedThumbnail img').mouseout( function () { - $(this).fadeTo("fast", 0.4); + $(this).fadeTo('fast', 0.4); }); $('a.createCommunity').click( function () { if (json.global.logged) { - midas.loadDialog("createCommunity", "/community/create"); + midas.loadDialog('createCommunity', '/community/create'); midas.showDialog(json.community.createCommunity, false); } else { midas.createNotice(json.community.contentCreateLogin, 4000); - $("div.TopDynamicBar").show('blind'); + $('div.TopDynamicBar').show('blind'); midas.loadAjaxDynamicBar('login', '/user/login'); } }); diff --git a/core/public/js/browse/browse.movecopy.js b/core/public/js/browse/browse.movecopy.js index 9f58c39a3..23d2a5e3b 100644 --- a/core/public/js/browse/browse.movecopy.js +++ b/core/public/js/browse/browse.movecopy.js @@ -19,8 +19,8 @@ midas.browse.moveCopyCallbackSelect = function (node) { parent = null; var classNames = current[0].className.split(' '); for (var key in classNames) { - if (classNames[key].match("child-of-")) { - parent = $("#moveCopyTable #" + classNames[key].substring(9)); + if (classNames[key].match('child-of-')) { + parent = $('#moveCopyTable #' + classNames[key].substring(9)); } } if (parent !== null) { @@ -39,6 +39,7 @@ midas.browse.moveCopyCallbackSelect = function (node) { id: node.attr('element') }; $.post(json.global.webroot + '/browse/getmaxpolicy', params, function (retVal) { + 'use strict'; var resp = $.parseJSON(retVal); node.attr('policy', resp.policy); midas.browse.checkMoveDestinationValid(node, resp.policy); @@ -85,9 +86,9 @@ midas.browse.moveCopyCallbackCustomElements = function (node, elements, first) { var padding = parseInt(node.find('td:first').css('padding-left').slice(0, -2)); var html = ''; $.each(elements.folders, function (index, value) { - html += ""; - html += " " + trimName(value.name, padding) + ""; - html += ""; + html += ''; + html += ' ' + trimName(value.name, padding) + ''; + html += ''; i++; }); return html; @@ -100,15 +101,15 @@ $(document).ready(function () { return true; }); - $("#moveCopyTable").treeTable({ + $('#moveCopyTable').treeTable({ callbackSelect: midas.browse.moveCopyCallbackSelect, callbackCheckboxes: midas.browse.moveCopyCallbackCheckboxes, callbackDblClick: midas.browse.moveCopyCallbackDblClick, callbackCustomElements: midas.browse.moveCopyCallbackCustomElements, pageLength: 99999 // do not page this table (preserves old functionality) }); - $("img.tableLoading").hide(); - $("table#moveCopyTable").show(); + $('img.tableLoading').hide(); + $('table#moveCopyTable').show(); $('.uploadApplet').hide(); @@ -120,7 +121,7 @@ $(document).ready(function () { $('#destinationId').val(destValue); $('.destinationUpload').html(destHtml); $('.destinationId').val(destValue); - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); $('.uploadApplet').show(); return false; }); diff --git a/core/public/js/browse/browse.selectfolder.js b/core/public/js/browse/browse.selectfolder.js index 8a9c04eed..cfbeee58b 100644 --- a/core/public/js/browse/browse.selectfolder.js +++ b/core/public/js/browse/browse.selectfolder.js @@ -26,7 +26,7 @@ midas.browse.selectFolderToggleButton = function (on) { } }; -$("#moveTable").treeTable({ +$('#moveTable').treeTable({ callbackSelect: selectFolderCallbackSelect, callbackDblClick: selectFolderCallbackDblClick, callbackReloadNode: selectFolderCallbackReloadNode, @@ -34,8 +34,8 @@ $("#moveTable").treeTable({ callbackCustomElements: selectFolderCallbackCustomElements, pageLength: 99999 // do not page this table (preserves old functionality) }); -$("div.MainDialogContent img.tableLoading").hide(); -$("table#moveTable").show(); +$('div.MainDialogContent img.tableLoading').hide(); +$('table#moveTable').show(); if ($('div.MainDialogContent #selectElements') !== undefined) { $('div.MainDialogContent #selectElements').click(function () { @@ -51,7 +51,7 @@ if ($('div.MainDialogContent #selectElements') !== undefined) { $('#destinationId').val(folderId); $('.destinationUpload').html(folderName); $('.destinationId').val(folderId); - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); if (typeof folderSelectionCallback == 'function') { folderSelectionCallback(folderName, folderId); @@ -73,8 +73,8 @@ function selectFolderCallbackSelect(node) { parent = null; var classNames = current[0].className.split(' '); for (var key in classNames) { - if (classNames[key].match("child-of-")) { - parent = $("div.MainDialogContent #" + classNames[key].substring(9)); + if (classNames[key].match('child-of-')) { + parent = $('div.MainDialogContent #' + classNames[key].substring(9)); } } if (parent !== null) { @@ -170,9 +170,9 @@ function selectFolderCallbackCustomElements(node, elements) { var padding = parseInt(node.find('td:first').css('padding-left').slice(0, -2)); var html = ''; $.each(elements.folders, function (index, value) { - html += ""; - html += " " + trimName(value.name, padding) + ""; - html += ""; + html += ''; + html += ' ' + trimName(value.name, padding) + ''; + html += ''; i++; }); return html; diff --git a/core/public/js/browse/browse.selectitem.js b/core/public/js/browse/browse.selectitem.js index 407b5e815..40c75fc73 100644 --- a/core/public/js/browse/browse.selectitem.js +++ b/core/public/js/browse/browse.selectitem.js @@ -4,11 +4,11 @@ /* global sliceFileName */ /* global trimName */ -$("#moveTable").treeTable({ +$('#moveTable').treeTable({ pageLength: 99999 }); -$("img.tableLoading").hide(); -$("table#moveTable").show(); +$('img.tableLoading').hide(); +$('table#moveTable').show(); $('.uploadApplet').hide(); @@ -19,7 +19,7 @@ if ($('#selectElements') !== undefined) { $('#destinationId').val($('#selectedDestinationHidden').val()); $('.destinationUpload').html($('#selectedDestination').html()); $('.destinationId').val($('#selectedDestinationHidden').val()); - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); $('.uploadApplet').show(); if (typeof itemSelectionCallback == 'function') { @@ -66,17 +66,17 @@ function callbackCustomElements(node, elements, first) { var html = ''; $.each(elements['folders'], function (index, value) { - html += ""; - html += " " + trimName(value['name'], padding) + ""; - html += ""; + html += ''; + html += ' ' + trimName(value['name'], padding) + ''; + html += ''; i++; }); $.each(elements['items'], function (index, value) { - html += ""; - html += " " + trimName(value['name'], padding) + ""; - html += ""; + html += ''; + html += ' ' + trimName(value['name'], padding) + ''; + html += ''; i++; }); return html; @@ -84,14 +84,14 @@ function callbackCustomElements(node, elements, first) { } // Live search -$.widget("custom.catcomplete", $.ui.autocomplete, { +$.widget('custom.catcomplete', $.ui.autocomplete, { _renderMenu: function (ul, items) { 'use strict'; var self = this, - currentCategory = ""; + currentCategory = ''; $.each(items, function (index, item) { if (item.category != currentCategory) { - ul.append('
  • ' + item.category + "
  • "); + ul.append('
  • ' + item.category + '
  • '); currentCategory = item.category; } self._renderItemData(ul, item); @@ -101,7 +101,7 @@ $.widget("custom.catcomplete", $.ui.autocomplete, { var cacheSearchSelectItem = {}, lastXhr; -$("#live_search_item").catcomplete({ +$('#live_search_item').catcomplete({ minLength: 2, delay: 10, source: function (request, response) { @@ -112,10 +112,10 @@ $("#live_search_item").catcomplete({ return; } - $("#searchloadingSelectItem").show(); + $('#searchloadingSelectItem').show(); - lastXhr = $.getJSON($('.webroot').val() + "/search/live?itemSearch=true", request, function (data, status, xhr) { - $("#searchloadingSelectItem").hide(); + lastXhr = $.getJSON($('.webroot').val() + '/search/live?itemSearch=true', request, function (data, status, xhr) { + $('#searchloadingSelectItem').hide(); cacheSearchSelectItem[term] = data; if (xhr === lastXhr) { itemselected = false; diff --git a/core/public/js/common/common.browser.js b/core/public/js/common/common.browser.js index f11e203da..0feb58383 100644 --- a/core/public/js/common/common.browser.js +++ b/core/public/js/common/common.browser.js @@ -27,7 +27,7 @@ midas.genericCallbackSelect = function (node) { midas.createAction(node); midas.ajaxSelectRequest = $.ajax({ - type: "POST", + type: 'POST', url: json.global.webroot + '/browse/getelementinfo', data: { type: node.attr('type'), @@ -47,7 +47,7 @@ midas.genericCallbackCheckboxes = function (node) { arraySelected['items'] = []; var folders = ''; var items = ''; - node.find(".treeCheckbox:checked").each( + node.find('.treeCheckbox:checked').each( function () { if ($(this).parents('tr').attr('type') != 'item') { arraySelected['folders'].push($(this).attr('element')); @@ -78,16 +78,16 @@ midas.genericCallbackCheckboxes = function (node) { if (json.global.logged) { links += '
  • '; links += ' '; - links += ' ' + json.browse.deleteSelected + '
  • '; + links += ' ' + json.browse.deleteSelected + ''; links += ''; links += '
  • '; links += ' '; - links += 'Move all selected'; + links += 'Move all selected'; links += '
  • '; if (arraySelected['items'].length > 0) { links += '
  • '; links += ' '; - links += ' ' + json.browse.duplicateSelected + '
  • '; + links += ' ' + json.browse.duplicateSelected + ''; links += ''; } if (arraySelected['items'].length > 1 && arraySelected['folders'].length === 0) { @@ -199,7 +199,7 @@ midas.removeNodeFromTree = function (node, recursive) { for (var curNode in ancestorNodes) { var jCurNode = $(ancestorNodes[curNode]); jCurNode.find('span.elementCount').remove(); - jCurNode.find('span.elementSize').after(""); + jCurNode.find('span.elementSize').after(''); jCurNode.find('span.elementSize').remove(); } // update folder size @@ -232,9 +232,9 @@ midas.removeItem = function (id) { } $.post(json.global.webroot + '/folder/removeitem', { - folderId: folderId, - itemId: id - }, + folderId: folderId, + itemId: id + }, function (data) { var jsonResponse = $.parseJSON(data); if (!jsonResponse) { @@ -332,7 +332,7 @@ midas.deleteSelected = function (folders, items) { */ midas.duplicateSelected = function (folders, items) { 'use strict'; - midas.loadDialog("duplicateItem", "/browse/movecopy/?duplicate=true&items=" + encodeURIComponent(items)); + midas.loadDialog('duplicateItem', '/browse/movecopy/?duplicate=true&items=' + encodeURIComponent(items)); var title = 'Copy selected items'; if (folders != '') { title += ' ' + json.browse.ignoreSelectedFolders; @@ -345,7 +345,7 @@ midas.duplicateSelected = function (folders, items) { */ midas.duplicateItem = function (item) { 'use strict'; - midas.loadDialog("duplicateItem", "/browse/movecopy/?duplicate=true&items=" + encodeURIComponent(item)); + midas.loadDialog('duplicateItem', '/browse/movecopy/?duplicate=true&items=' + encodeURIComponent(item)); midas.showDialog('Copy item'); }; @@ -356,7 +356,7 @@ midas.duplicateItem = function (item) { */ midas.moveSelected = function (folders, items) { 'use strict'; - midas.loadDialog("moveItem", "/browse/movecopy/?move=true&items=" + encodeURIComponent(items) + "&folders=" + encodeURIComponent(folders)); + midas.loadDialog('moveItem', '/browse/movecopy/?move=true&items=' + encodeURIComponent(items) + '&folders=' + encodeURIComponent(folders)); midas.showDialog('Move all selected resources'); }; @@ -368,7 +368,7 @@ midas.removeChildren = function (node) { 'use strict'; node.each( function () { - var children = $("table.treeTable tbody tr.child-of-" + this.id); + var children = $('table.treeTable tbody tr.child-of-' + this.id); $(children).each( function () { midas.removeChildren($(this)); @@ -379,19 +379,19 @@ midas.removeChildren = function (node) { midas.editFolder = function (id) { 'use strict'; - midas.loadDialog("editFolder" + id, "/folder/edit?folderId=" + encodeURIComponent(id)); + midas.loadDialog('editFolder' + id, '/folder/edit?folderId=' + encodeURIComponent(id)); midas.showDialog(json.browse.edit, false); }; midas.moveFolder = function (id) { 'use strict'; - midas.loadDialog("moveFolder" + id, "/browse/movecopy?move=true&folders=" + encodeURIComponent(id)); + midas.loadDialog('moveFolder' + id, '/browse/movecopy?move=true&folders=' + encodeURIComponent(id)); midas.showDialog(json.browse.move); }; midas.moveItem = function (itemId, fromFolderId) { 'use strict'; - midas.loadDialog("moveItem" + itemId, "/browse/movecopy?move=true&items=" + encodeURIComponent(itemId) + "&from=" + encodeURIComponent(fromFolderId)); + midas.loadDialog('moveItem' + itemId, '/browse/movecopy?move=true&items=' + encodeURIComponent(itemId) + '&from=' + encodeURIComponent(fromFolderId)); midas.showDialog(json.browse.move); }; @@ -400,8 +400,8 @@ midas.parentOf = function (node) { var classNames = node[0].className.split(' '); for (var key in classNames) { - if (classNames[key].match("child-of-")) { - return $("#" + classNames[key].substring(9)); + if (classNames[key].match('child-of-')) { + return $('#' + classNames[key].substring(9)); } } }; @@ -469,11 +469,11 @@ midas.createAction = function (node) { html += '
  • ' + json.browse.download + '
  • '; html += '
  • Share
  • '; if (json.global.logged) { - html += '
  • Copy
  • '; + html += '
  • Copy
  • '; } if (policy >= 2) { html += '
  • '; - html += '
  • ' + json.browse.move + '
  • '; + html += '
  • ' + json.browse.move + '
  • '; html += '
  • ' + json.browse['removeItem'] + '
  • '; } } @@ -500,11 +500,11 @@ midas.createAction = function (node) { button.click(); }); $('a.sharingLink').click(function () { - midas.loadDialog("sharing" + $(this).attr('type') + $(this).attr('element'), "/share/dialog?type=" + encodeURIComponent($(this).attr('type')) + '&element=' + encodeURIComponent($(this).attr('element'))); + midas.loadDialog('sharing' + $(this).attr('type') + $(this).attr('element'), '/share/dialog?type=' + encodeURIComponent($(this).attr('type')) + '&element=' + encodeURIComponent($(this).attr('element'))); midas.showDialog(json.browse.share); }); $('a.getResourceLinks').click(function () { - midas.loadDialog("links" + $(this).attr('type') + $(this).attr('element'), '/share/links?type=' + encodeURIComponent($(this).attr('type')) + '&id=' + encodeURIComponent($(this).attr('element'))); + midas.loadDialog('links' + $(this).attr('type') + $(this).attr('element'), '/share/links?type=' + encodeURIComponent($(this).attr('type')) + '&id=' + encodeURIComponent($(this).attr('element'))); midas.showDialog('Link to this item'); }); $('a.downloadFolderLink').click(function () { @@ -548,7 +548,7 @@ midas.createAction = function (node) { midas.escape = function (text) { 'use strict'; - return $('
    ').text(text).html() + return $('
    ').text(text).html(); }; midas.createInfo = function (jsonContent) { @@ -643,7 +643,7 @@ midas.browser.enableSelectAll = function (opts) { $('#browseTableHeaderCheckbox').click( function () { var selector = this.checked ? '.treeCheckbox:visible' : '.treeCheckbox'; - $('#browseTable').find(selector).prop("checked", this.checked); + $('#browseTable').find(selector).prop('checked', this.checked); options.callback($('#browseTable')); }); }; diff --git a/core/public/js/common/common.feed.js b/core/public/js/common/common.feed.js index b58bf4cbb..97135f682 100644 --- a/core/public/js/common/common.feed.js +++ b/core/public/js/common/common.feed.js @@ -25,14 +25,14 @@ $(document).ready(function () { $('input.deleteFeedYes').unbind('click').click(function () { var elementId = $(this).attr('element'); $.post(json.global.webroot + '/feed/deleteajax', { - feed: $(this).attr('element') - }, + feed: $(this).attr('element') + }, function (data) {}); $('div.feedElement[element=' + elementId + ']').remove(); - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); $('input.deleteFeedNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); }); diff --git a/core/public/js/community/community.create.js b/core/public/js/community/community.create.js index 6b26a1c43..7c0bf0b42 100644 --- a/core/public/js/community/community.create.js +++ b/core/public/js/community/community.create.js @@ -10,10 +10,10 @@ $('form.createCommunityForm').submit(function () { $('div.createNameElement input').focusout(function () { 'use strict'; - $.post($('.webroot').val() + "/community/validentry", { - entry: $('input[name=name]').val(), - type: "dbcommunityname" - }, + $.post($('.webroot').val() + '/community/validentry', { + entry: $('input[name=name]').val(), + type: 'dbcommunityname' + }, function (data) { if (data.search('true') != -1) { midas.createNotice('Name already exists', 4000); diff --git a/core/public/js/community/community.index.js b/core/public/js/community/community.index.js index b4a3f605c..125481c02 100644 --- a/core/public/js/community/community.index.js +++ b/core/public/js/community/community.index.js @@ -8,12 +8,12 @@ $(document).ready(function () { 'use strict'; $('a.createCommunity').click(function () { if (json.global.logged) { - midas.loadDialog("createCommunity", "/community/create"); + midas.loadDialog('createCommunity', '/community/create'); midas.showDialog(json.community.createCommunity, false); } else { midas.createNotice(json.community.contentCreateLogin, 4000); - $("div.TopDynamicBar").show('blind'); + $('div.TopDynamicBar').show('blind'); midas.loadAjaxDynamicBar('login', '/user/login'); } }); diff --git a/core/public/js/community/community.invitation.js b/core/public/js/community/community.invitation.js index 340f37da9..c33a194d8 100644 --- a/core/public/js/community/community.invitation.js +++ b/core/public/js/community/community.invitation.js @@ -5,7 +5,7 @@ var midas = midas || {}; midas.invite = midas.invite || {}; -midas.invite.directAdd = $("#directAdd").val(); +midas.invite.directAdd = $('#directAdd').val(); /** * Render group selection dialog for the community @@ -34,14 +34,14 @@ midas.invite.showGroupSelect = function (item) { }; // Live search -$.widget("custom.catcomplete", $.ui.autocomplete, { +$.widget('custom.catcomplete', $.ui.autocomplete, { _renderMenu: function (ul, items) { 'use strict'; var self = this, - currentCategory = ""; + currentCategory = ''; $.each(items, function (index, item) { if (item.category != currentCategory) { - ul.append('
  • ' + item.category + "
  • "); + ul.append('
  • ' + item.category + '
  • '); currentCategory = item.category; } self._renderItemData(ul, item); @@ -52,7 +52,7 @@ $.widget("custom.catcomplete", $.ui.autocomplete, { var invitationSearchcache = {}, lastShareXhr; -$("#live_invitation_search").catcomplete({ +$('#live_invitation_search').catcomplete({ minLength: 2, delay: 10, source: function (request, response) { @@ -62,11 +62,11 @@ $("#live_invitation_search").catcomplete({ response(invitationSearchcache[term]); return; } - $("#searchInvitationLoading").show(); + $('#searchInvitationLoading').show(); - lastShareXhr = $.getJSON($('.webroot').val() + "/search/live?userSearch=true&allowEmail", + lastShareXhr = $.getJSON($('.webroot').val() + '/search/live?userSearch=true&allowEmail', request, function (data, status, xhr) { - $("#searchInvitationLoading").hide(); + $('#searchInvitationLoading').hide(); invitationSearchcache[term] = data; if (xhr === lastShareXhr) { response(data); diff --git a/core/public/js/community/community.manage.js b/core/public/js/community/community.manage.js index a4088d949..b95f60b2c 100644 --- a/core/public/js/community/community.manage.js +++ b/core/public/js/community/community.manage.js @@ -25,7 +25,7 @@ midas.community.manage.init = function () { }); $('a#addUserToGroupLink').click(function () { - midas.loadDialog("invitationCommunity", "/community/invitation?directadd=true&communityId=" + encodeURIComponent(json.community.community_id)); + midas.loadDialog('invitationCommunity', '/community/invitation?directadd=true&communityId=' + encodeURIComponent(json.community.community_id)); midas.showDialog(json.community.sendInvitation, false); }); @@ -51,8 +51,8 @@ midas.community.manage.init = function () { disableElementSize: true }); - $("img.tableLoading").hide(); - $("table#browseTable").show(); + $('img.tableLoading').hide(); + $('table#browseTable').show(); $('div.userPersonalData').hide(); @@ -100,10 +100,10 @@ $('a.deleteGroupLink').click(function () { $('input.deleteGroupYes').unbind('click').click(function () { var groupid = $(this).attr('element'); $.post(json.global.webroot + '/community/manage', { - communityId: json.community.community_id, - deleteGroup: 'true', - groupId: groupid - }, + communityId: json.community.community_id, + deleteGroup: 'true', + groupId: groupid + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { @@ -111,7 +111,7 @@ $('a.deleteGroupLink').click(function () { return; } if (jsonResponse[0]) { - $("div.MainDialog").dialog("close"); + $('div.MainDialog').dialog('close'); $('a.groupLink[groupid=' + groupid + ']').parent('li').remove(); midas.createNotice(jsonResponse[1], 4000); midas.community.manage.init(); @@ -125,44 +125,44 @@ $('a.deleteGroupLink').click(function () { ); }); $('input.deleteGroupNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); midas.community.manage.initDragAndDrop = function () { 'use strict'; - $("#browseTable .file, #browseTable .filePublic, #browseTable .filePrivate," + - "#browseTable .folderPublic:not(.notdraggable), #browseTable .folderPrivate:not(.notdraggable)").draggable({ - helper: "clone", - cursor: "move", - opacity: 0.75, - refreshPositions: true, // Performance? - revert: "invalid", - revertDuration: 300, - scroll: true, - start: function () { - $('div.userPersonalData').show(); - } - }); + $('#browseTable .file, #browseTable .filePublic, #browseTable .filePrivate,' + + '#browseTable .folderPublic:not(.notdraggable), #browseTable .folderPrivate:not(.notdraggable)').draggable({ + helper: 'clone', + cursor: 'move', + opacity: 0.75, + refreshPositions: true, // Performance? + revert: 'invalid', + revertDuration: 300, + scroll: true, + start: function () { + $('div.userPersonalData').show(); + } + }); // Configure droppable rows - $("#browseTable .folder, #browseTable .folderPublic, #browseTable .folderPrivate").each(function () { - $(this).parents("tr").droppable({ - accept: ".file, .filePublic, .filePrivate, .folder, .folderPublic, .folderPrivate", + $('#browseTable .folder, #browseTable .folderPublic, #browseTable .folderPrivate').each(function () { + $(this).parents('tr').droppable({ + accept: '.file, .filePublic, .filePrivate, .folder, .folderPublic, .folderPrivate', drop: function (e, ui) { // Call jQuery treeTable plugin to move the branch var elements = ''; - if ($(ui.draggable).parents("tr").attr('type') == 'folder') { - elements = $(ui.draggable).parents("tr").attr('element') + ';'; + if ($(ui.draggable).parents('tr').attr('type') == 'folder') { + elements = $(ui.draggable).parents('tr').attr('element') + ';'; } else { - elements = ';' + $(ui.draggable).parents("tr").attr('element'); + elements = ';' + $(ui.draggable).parents('tr').attr('element'); } var from_obj; - var classNames = $(ui.draggable).parents("tr").attr('class').split(' '); + var classNames = $(ui.draggable).parents('tr').attr('class').split(' '); for (var key in classNames) { if (classNames[key].match('child-of-')) { - from_obj = "#" + classNames[key].substring(9); + from_obj = '#' + classNames[key].substring(9); } } var destination_obj = this; @@ -170,12 +170,12 @@ midas.community.manage.initDragAndDrop = function () { // do nothing if drop item(s) to its current folder if ($(this).attr('id') != $(from_obj).attr('id')) { $.post(json.global.webroot + '/browse/movecopy', { - moveElement: true, - elements: elements, - destination: $(this).attr('element'), - from: $(from_obj).attr('element'), - ajax: true - }, + moveElement: true, + elements: elements, + destination: $(this).attr('element'), + from: $(from_obj).attr('element'), + ajax: true + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { @@ -184,7 +184,7 @@ midas.community.manage.initDragAndDrop = function () { } if (jsonResponse[0]) { midas.createNotice(jsonResponse[1], 1500); - $($(ui.draggable).parents("tr")).appendBranchTo(destination_obj); + $($(ui.draggable).parents('tr')).appendBranchTo(destination_obj); } else { midas.createNotice(jsonResponse[1], 4000, 'error'); @@ -193,10 +193,10 @@ midas.community.manage.initDragAndDrop = function () { ); } }, - hoverClass: "accept", + hoverClass: 'accept', over: function (e, ui) { // Make the droppable branch expand when a draggable node is moved over it. - if (this.id != $(ui.draggable.parents("tr")[0]).id && !$(this).is(".expanded")) { + if (this.id != $(ui.draggable.parents('tr')[0]).id && !$(this).is('.expanded')) { $(this).expand(); } } @@ -215,7 +215,7 @@ midas.community.manage.validateGroupChange = function (formData, jqForm, options midas.community.manage.successGroupChange = function (responseText, statusText, xhr, form) { 'use strict'; - $("div.MainDialog").dialog("close"); + $('div.MainDialog').dialog('close'); var jsonResponse = $.parseJSON(responseText); if (jsonResponse === null) { midas.createNotice('Error', 4000, 'error'); @@ -289,9 +289,9 @@ midas.community.manage.promoteMember = function (userId) { midas.community.manage.removeFromGroup = function (userId, groupId) { 'use strict'; $.post(json.global.webroot + '/community/removeuserfromgroup', { - groupId: groupId, - userId: userId - }, + groupId: groupId, + userId: userId + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { @@ -355,7 +355,7 @@ $(document).ready(function () { 'use strict'; midas.community.manage.initCommunityPrivacy(); - $("#tabsGeneric").tabs({ + $('#tabsGeneric').tabs({ select: function (event, ui) { $('div.genericAction').show(); $('div.genericCommunities').show(); @@ -367,7 +367,7 @@ $(document).ready(function () { $('td.tdUser input').removeAttr('checked'); } }); - $("#tabsGeneric").show(); + $('#tabsGeneric').show(); $('img.tabsLoading').hide(); $('a#communityDeleteLink').click(function () { @@ -385,7 +385,7 @@ $(document).ready(function () { location.replace(json.global.webroot + '/community/delete?communityId=' + encodeURIComponent(json.community.community_id)); }); $('input.deleteCommunityNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); @@ -415,8 +415,8 @@ $(document).ready(function () { $('table').filter(function () { return this.id.match(/browseTable*/); }).treeTable(); - $("img.tableLoading").hide(); - $("table#browseTable").show(); + $('img.tableLoading').hide(); + $('table#browseTable').show(); $('div.userPersonalData').hide(); midas.community.manage.initDragAndDrop(); diff --git a/core/public/js/community/community.selectgroup.js b/core/public/js/community/community.selectgroup.js index 6eea87d68..1de5a1890 100644 --- a/core/public/js/community/community.selectgroup.js +++ b/core/public/js/community/community.selectgroup.js @@ -18,15 +18,15 @@ $(document).ready(function () { else { params[midas.invite.item.key] = midas.invite.item.value; } - if (typeof midas.invite.directAdd !== "undefined" && midas.invite.directAdd == 1) { - url = json.global.webroot + '/community/addusertogroup' + if (typeof midas.invite.directAdd !== 'undefined' && midas.invite.directAdd == 1) { + url = json.global.webroot + '/community/addusertogroup'; } $.post(json.global.webroot + '/community/sendinvitation', params, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse[0]) { midas.createNotice(jsonResponse[1], 3000); - if (typeof midas.invite.directAdd !== "undefined" && midas.invite.directAdd == 1) { - window.location.href = json.global.webroot + "/community/manage?communityId=" + encodeURIComponent(json.community.community_id) + "#tabs-Users"; + if (typeof midas.invite.directAdd !== 'undefined' && midas.invite.directAdd == 1) { + window.location.href = json.global.webroot + '/community/manage?communityId=' + encodeURIComponent(json.community.community_id) + '#tabs-Users'; window.location.reload(); } $('div.MainDialog').dialog('close'); diff --git a/core/public/js/community/community.view.js b/core/public/js/community/community.view.js index cf7a5a20d..9265cd93b 100644 --- a/core/public/js/community/community.view.js +++ b/core/public/js/community/community.view.js @@ -6,7 +6,7 @@ var midas = midas || {}; $(document).ready(function () { 'use strict'; - $("#tabsGeneric").tabs({ + $('#tabsGeneric').tabs({ select: function (event, ui) { $('div.genericAction').show(); $('div.genericCommunities').show(); @@ -15,10 +15,10 @@ $(document).ready(function () { $('div.viewAction').hide(); } }); - $("#tabsGeneric").show(); + $('#tabsGeneric').show(); $('img.tabsLoading').hide(); - $("#browseTable").treeTable({ + $('#browseTable').treeTable({ onFirstInit: midas.enableRangeSelect, onNodeShow: midas.enableRangeSelect, onNodeHide: midas.enableRangeSelect @@ -27,11 +27,11 @@ $(document).ready(function () { midas.browser.enableSelectAll(); - $("img.tableLoading").hide(); - $("table#browseTable").show(); + $('img.tableLoading').hide(); + $('table#browseTable').show(); $('a#sendInvitationLink').click(function () { - midas.loadDialog("invitationCommunity", "/community/invitation?communityId=" + encodeURIComponent(json.community.community_id)); + midas.loadDialog('invitationCommunity', '/community/invitation?communityId=' + encodeURIComponent(json.community.community_id)); midas.showDialog(json.community.sendInvitation, false); }); diff --git a/core/public/js/element/serversidefilechooser.js b/core/public/js/element/serversidefilechooser.js index e9d55ea56..83c009729 100644 --- a/core/public/js/element/serversidefilechooser.js +++ b/core/public/js/element/serversidefilechooser.js @@ -2,31 +2,31 @@ $(document).ready(function () { 'use strict'; - var id = $("input#serversidefilechooser-id").val(); - var errorMessage = $("input#serversidefilechooser-errorMessage").val(); - var destSelector = $("input#serversidefilechooser-destSelector").val(); - var fileFilter = $("input#serversidefilechooser-fileFilter").val(); - var scriptaction = $("input#serversidefilechooser-script").val(); + var id = $('input#serversidefilechooser-id').val(); + var errorMessage = $('input#serversidefilechooser-errorMessage').val(); + var destSelector = $('input#serversidefilechooser-destSelector').val(); + var fileFilter = $('input#serversidefilechooser-fileFilter').val(); + var scriptaction = $('input#serversidefilechooser-script').val(); // Cancel button: hide - $("#fp-" + id + "-inputButtonCancel").click(function () { - $("#fp-" + id + "-panel, #fp-" + id + "-background").fadeOut(300); + $('#fp-' + id + '-inputButtonCancel').click(function () { + $('#fp-' + id + '-panel, #fp-' + id + '-background').fadeOut(300); return false; }); // Open button: show - $("#" + id).click(function () { + $('#' + id).click(function () { //$('
    ').addClass('lightbox_bg').appendTo('body').show(); $('.TopDynamicBar').after('
    '); - $("#fp-" + id + "-panel, #fp-" + id + "-background").fadeIn(300); + $('#fp-' + id + '-panel, #fp-' + id + '-background').fadeIn(300); return false; }); $('#fp-' + id + '-fileTree').fileTree({ - root: '', - script: scriptaction - }, + root: '', + script: scriptaction + }, function (file) { - $("#fp-" + id + "-inputFile").val('' + file); + $('#fp-' + id + '-inputFile').val('' + file); }, function (dir) { // Some checks if the root starts with // @@ -34,21 +34,21 @@ $(document).ready(function () { dir = dir.substr(1); } - $("#fp-" + id + "-inputFile").val('' + dir); + $('#fp-' + id + '-inputFile').val('' + dir); } ); // Validate button - $("#fp-" + id + "-inputButtonOK").click(function () { + $('#fp-' + id + '-inputButtonOK').click(function () { // extract file name - var file = $("#fp-" + id + "-inputFile").val(); + var file = $('#fp-' + id + '-inputFile').val(); var re = new RegExp(fileFilter); if (file.match(re)) { // if destSelector is valid set its value to file if ($(destSelector).length !== 0) { $(destSelector).val(file); $(destSelector).change(); // mark that it has changed - $("#fp-" + id + "-panel, #fp-" + id + "-background").fadeOut(300); + $('#fp-' + id + '-panel, #fp-' + id + '-background').fadeOut(300); } } else if (errorMessage) { diff --git a/core/public/js/feed/feed.index.js b/core/public/js/feed/feed.index.js index 7b60d116c..163686615 100644 --- a/core/public/js/feed/feed.index.js +++ b/core/public/js/feed/feed.index.js @@ -2,13 +2,13 @@ $(document).ready(function () { 'use strict'; - $('div.feedThumbnail img').fadeTo("slow", 0.4); + $('div.feedThumbnail img').fadeTo('slow', 0.4); $('div.feedThumbnail img').mouseover(function () { - $(this).fadeTo("fast", 1); + $(this).fadeTo('fast', 1); }); $('div.feedThumbnail img').mouseout(function () { - $(this).fadeTo("fast", 0.4); + $(this).fadeTo('fast', 0.4); }); }); diff --git a/core/public/js/folder/folder.createfolder.js b/core/public/js/folder/folder.createfolder.js index 116ea1bbb..219df6e7c 100644 --- a/core/public/js/folder/folder.createfolder.js +++ b/core/public/js/folder/folder.createfolder.js @@ -15,7 +15,7 @@ if (typeof callbackDblClick != 'function') { if (node[0] === undefined) { return null; } - return $("table.treeTable tbody tr.child-of-" + node[0].id); + return $('table.treeTable tbody tr.child-of-' + node[0].id); } } @@ -34,7 +34,7 @@ function successCreateFolder(responseText, statusText, xhr, form) { successCreateFolderCallback(responseText, statusText, xhr, form); return; } - $("div.MainDialog").dialog("close"); + $('div.MainDialog').dialog('close'); var jsonResponse = $.parseJSON(responseText); if (jsonResponse === null) { midas.createNotice('Error', 4000); @@ -49,8 +49,8 @@ function successCreateFolder(responseText, statusText, xhr, form) { // The new folder is a top level folder else { var newNodeId = ''; - if ($("#browseTable > tbody > tr:last").length > 0) { - var lastTopLevelNodeId = $("#browseTable > tbody > tr:last").attr("id").split("-")[2]; + if ($('#browseTable > tbody > tr:last').length > 0) { + var lastTopLevelNodeId = $('#browseTable > tbody > tr:last').attr('id').split('-')[2]; newNodeId = parseInt(eval(lastTopLevelNodeId) + 1); } else { @@ -59,20 +59,20 @@ function successCreateFolder(responseText, statusText, xhr, form) { var newRow = ''; // policy: 2 <=> MIDAS_POLICY_ADMIN - newRow += ""; - newRow += " " + jsonResponse[3].name + ""; - newRow += " "; - newRow += " " + jsonResponse[4] + ""; - newRow += " "; - newRow += ""; + newRow += ''; + newRow += ' ' + jsonResponse[3].name + ''; + newRow += ' '; + newRow += ' ' + jsonResponse[4] + ''; + newRow += ' '; + newRow += ''; - if ($("#browseTable > tbody > tr:last").length > 0) { - $(newRow).insertAfter("#browseTable > tbody > tr:last"); + if ($('#browseTable > tbody > tr:last').length > 0) { + $(newRow).insertAfter('#browseTable > tbody > tr:last'); } else { - $(newRow).appendTo("#browseTable > tbody"); + $(newRow).appendTo('#browseTable > tbody'); } - $("#browseTable").treeTable({ + $('#browseTable').treeTable({ onFirstInit: midas.enableRangeSelect, onNodeShow: midas.enableRangeSelect, onNodeHide: midas.enableRangeSelect diff --git a/core/public/js/folder/folder.view.js b/core/public/js/folder/folder.view.js index 75fd1dd7f..27a36d5fe 100644 --- a/core/public/js/folder/folder.view.js +++ b/core/public/js/folder/folder.view.js @@ -6,7 +6,7 @@ var midas = midas || {}; $(document).ready(function () { 'use strict'; - $("#browseTable").treeTable({ + $('#browseTable').treeTable({ onFirstInit: midas.enableRangeSelect, onNodeShow: midas.enableRangeSelect, onNodeHide: midas.enableRangeSelect @@ -23,11 +23,11 @@ $(document).ready(function () { }); $('a.sharingLink').click(function () { - midas.loadDialog("sharing" + $(this).attr('type') + $(this).attr('element'), "/share/dialog?type=" + encodeURIComponent($(this).attr('type')) + '&element=' + encodeURIComponent($(this).attr('element'))); + midas.loadDialog('sharing' + $(this).attr('type') + $(this).attr('element'), '/share/dialog?type=' + encodeURIComponent($(this).attr('type')) + '&element=' + encodeURIComponent($(this).attr('element'))); midas.showDialog(json.browse.share); }); $('a.getResourceLinks').click(function () { - midas.loadDialog("links" + $(this).attr('type') + $(this).attr('element'), '/share/links?type=' + encodeURIComponent($(this).attr('type')) + '&id=' + encodeURIComponent($(this).attr('element'))); + midas.loadDialog('links' + $(this).attr('type') + $(this).attr('element'), '/share/links?type=' + encodeURIComponent($(this).attr('type')) + '&id=' + encodeURIComponent($(this).attr('element'))); midas.showDialog('Link to this item'); }); $('a.uploadInFolder').click(function () { @@ -61,11 +61,11 @@ $(document).ready(function () { */ midas.browser.enableSelectAll(); - $("img.tableLoading").hide(); - $("table#browseTable").show(); + $('img.tableLoading').hide(); + $('table#browseTable').show(); - $("#tabsGeneric").tabs(); - $("#tabsGeneric").show(); + $('#tabsGeneric').tabs(); + $('#tabsGeneric').show(); if ($('.pathBrowser li').length > 5) { while ($('.pathBrowser li').length > 5) { diff --git a/core/public/js/import/import.index.js b/core/public/js/import/import.index.js index 25a53215e..2ae332e12 100644 --- a/core/public/js/import/import.index.js +++ b/core/public/js/import/import.index.js @@ -46,11 +46,11 @@ midas.import.importCallback = function (responseText, statusText, xhr, form) { 'use strict'; if (responseText.stage === 'validate') { midas.import.stage = 'initialize'; - $("#progress_status").html('Counting files (this could take some time)'); + $('#progress_status').html('Counting files (this could take some time)'); midas.import.formSubmitOptions.data = { initialize: '1' }; - $("#importsubmit").html($("#importstop").val()); + $('#importsubmit').html($('#importstop').val()); $('#importForm').ajaxSubmit(midas.import.formSubmitOptions); } else if (responseText.stage === 'initialize') { @@ -62,16 +62,16 @@ midas.import.importCallback = function (responseText, statusText, xhr, form) { } else if (responseText.error) { midas.import.stage = 'validate'; // goes back to the validate stage - $("#importsubmit").html(midas.import.importSubmitButtonValue); - $(".viewNotice").html(responseText.error); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(300); + $('#importsubmit').html(midas.import.importSubmitButtonValue); + $('.viewNotice').html(responseText.error); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(300); } else if (responseText.message) { midas.import.stage = 'validate'; // goes back to the validate stage - $("#progress_status").html('Import done'); - $("#progress").progressbar("value", 100); - $(".viewNotice").html(responseText.message); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(300); + $('#progress_status').html('Import done'); + $('#progress').progressbar('value', 100); + $('.viewNotice').html(responseText.message); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(300); $('#importsubmit').html(midas.import.importSubmitButtonValue); } }; @@ -81,8 +81,8 @@ midas.import.importCallback = function (responseText, statusText, xhr, form) { */ midas.import.displayStopMessage = function (data) { 'use strict'; - $(".viewNotice").html('Import has been stopped.'); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(300); + $('.viewNotice').html('Import has been stopped.'); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(300); }; /** If the button to start/stop the import has been clicked */ @@ -110,9 +110,9 @@ midas.import.assetstoreSubmit = function (formData, jqForm, options) { // Add the type is the one in the main page (because it's hidden in the assetstore add page) var assetstoretype = {}; assetstoretype.name = 'assetstoretype'; - assetstoretype.value = $("#importassetstoretype").val(); + assetstoretype.value = $('#importassetstoretype').val(); formData.push(assetstoretype); - $(".assetstoreLoading").show(); + $('.assetstoreLoading').show(); }; /** On assetstore add success */ @@ -120,18 +120,18 @@ midas.import.assetstoreAddCallback = function (responseText, statusText, xhr, fo 'use strict'; var newassetstore = {}; - $(".assetstoreLoading").hide(); + $('.assetstoreLoading').hide(); if (responseText.error) { - $(".viewNotice").html(responseText.error); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(100); + $('.viewNotice').html(responseText.error); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(100); } else if (responseText.msg) { $(document).trigger('hideCluetip'); if (responseText.assetstore_id) { - $("#assetstore").append($("") - .attr("value", responseText.assetstore_id) + $('#assetstore').append($('') + .attr('value', responseText.assetstore_id) .text(responseText.assetstore_name) - .attr("selected", "selected")); + .attr('selected', 'selected')); // Add to JSON newassetstore.assetstore_id = responseText.assetstore_id; @@ -140,8 +140,8 @@ midas.import.assetstoreAddCallback = function (responseText, statusText, xhr, fo midas.import.assetstores.push(newassetstore); } - $(".viewNotice").html(responseText.msg); - $(".viewNotice").fadeIn(100).delay(2000).fadeOut(100); + $('.viewNotice').html(responseText.msg); + $('.viewNotice').fadeIn(100).delay(2000).fadeOut(100); } }; @@ -149,8 +149,8 @@ midas.import.assetstoreAddCallback = function (responseText, statusText, xhr, fo midas.import.newAssetstoreShow = function () { 'use strict'; var assetstoretype = $('select#importassetstoretype option:selected').val(); - $('#assetstoretype').find('option:selected').removeAttr("selected"); - $('#assetstoretype').find('option[value=' + assetstoretype + ']').attr("selected", "selected"); + $('#assetstoretype').find('option:selected').removeAttr('selected'); + $('#assetstoretype').find('option[value=' + assetstoretype + ']').attr('selected', 'selected'); }; /** When the cancel is clicked in the new assetstore window */ @@ -169,10 +169,10 @@ midas.import.inputDirectoryChanged = function () { .substr(0, $('#inputdirectory').val().length - 1) .replace(/^.*[\/\\]/g, ''); } - $("#assetstorename").val(basename); + $('#assetstorename').val(basename); // set the input directory as the same - $("#assetstoreinputdirectory").val($('#inputdirectory').val()); + $('#assetstoreinputdirectory').val($('#inputdirectory').val()); }; /** When the assetstore type list is changed */ @@ -182,16 +182,16 @@ midas.import.assetstoretypeChanged = function () { assetstoretype = $('select#importassetstoretype option:selected').val(); // Set the same assetstore type for the new assetstore - $('#assetstoretype').find('option:selected').removeAttr("selected"); - $('#assetstoretype').find('option[value=' + assetstoretype + ']').attr("selected", "selected"); + $('#assetstoretype').find('option:selected').removeAttr('selected'); + $('#assetstoretype').find('option[value=' + assetstoretype + ']').attr('selected', 'selected'); // Clean the assetstore list - $("select#assetstore").find('option:not(:first)').remove(); + $('select#assetstore').find('option:not(:first)').remove(); for (i = 0; i < midas.import.assetstores.length; i += 1) { if (midas.import.assetstores[i].type === assetstoretype) { - $("select#assetstore").append($("") - .attr("value", midas.import.assetstores[i].assetstore_id).text(midas.import.assetstores[i].name)); + $('select#assetstore').append($('') + .attr('value', midas.import.assetstores[i].assetstore_id).text(midas.import.assetstores[i].name)); } } }; @@ -205,15 +205,15 @@ midas.import.makeProgressSuccessCallback = function (id) { if (html) { if (html.percent !== 'NA') { - $("#progress").show(); - $("#progress_status").show(); + $('#progress').show(); + $('#progress_status').show(); - $("#progress_status").html('Importing files ' + html.current + + $('#progress_status').html('Importing files ' + html.current + '/' + html.max + ' (' + html.percent + '%)'); - $("#progress").progressbar("value", html.percent); + $('#progress').progressbar('value', html.percent); } } - window.setTimeout("midas.import.checkProgress(" + id + ")", 3000); + window.setTimeout('midas.import.checkProgress(' + id + ')', 3000); }; }; @@ -231,7 +231,7 @@ midas.import.checkProgress = function (id) { } $.ajax({ - type: "GET", + type: 'GET', url: $('.webroot').val() + '/import/getprogress?id=' + encodeURIComponent(id), dataType: 'json', timeout: 10000000000, @@ -272,13 +272,13 @@ $(document).ready(function () { onShow: midas.import.newAssetstoreShow }); - $("#progress").progressbar(); + $('#progress').progressbar(); // Not possible to change the type of an assetstore. This is based on a // previous choice by the user - $("#assetstoretype").attr('disabled', 'disabled'); + $('#assetstoretype').attr('disabled', 'disabled'); - midas.import.importSubmitButtonValue = $("#importsubmit").html(); + midas.import.importSubmitButtonValue = $('#importsubmit').html(); // Init Browser $('input[name=importFolder]').val(''); @@ -287,7 +287,7 @@ $(document).ready(function () { $('input[name=importFolder]').before(''); $('input[name=importFolder]').before(''); $('#browseMIDASLink').click(function () { - midas.loadDialog("select", "/browse/movecopy/?selectElement=true"); + midas.loadDialog('select', '/browse/movecopy/?selectElement=true'); midas.showDialog('Browse'); }); }); diff --git a/core/public/js/install/install.step2.js b/core/public/js/install/install.step2.js index 5efd47c74..f1dc698e8 100644 --- a/core/public/js/install/install.step2.js +++ b/core/public/js/install/install.step2.js @@ -53,15 +53,15 @@ function checkDB(obj) { obj.find('.testOk').hide(); obj.find('.testNok').hide(); obj.find('.testError').html(''); - if (obj.find('[name=type]').val() != 'sqlite' && (obj.find('[name=host]').val() == '' || obj.find('[name=port]').val() == "") && obj.find('[name=unix_socket]').val() == '') { + if (obj.find('[name=type]').val() != 'sqlite' && (obj.find('[name=host]').val() == '' || obj.find('[name=port]').val() == '') && obj.find('[name=unix_socket]').val() == '') { obj.find('.testNok').show(); - obj.find('.testError').html("Please set the host and port or the socket."); + obj.find('.testError').html('Please set the host and port or the socket.'); obj.find('.testLoading').hide(); return; } $.ajax({ - type: "POST", + type: 'POST', url: json.global.webroot + '/install/testconnection', data: { type: obj.find('[name=type]').val(), @@ -75,7 +75,6 @@ function checkDB(obj) { cache: false, success: function (jsonContent) { var testConnexion = $.parseJSON(jsonContent); - console.log(jsonContent); obj.find('.testLoading').hide(); if (testConnexion[0] == true) { obj.find('.testOk').show(); @@ -91,9 +90,9 @@ function checkDB(obj) { function checkEmail(mailteste) { 'use strict'; - var local = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e'; - var host = 'a-z0-9\x2d\x2e'; - var reg = new RegExp('^['+local+']+(\x2e+['+local+']+)*@['+host+']{1,63}$', 'i'); + var local = 'a-zA-Z0-9\x21\x23\x24\x25\x26\x27\x2a\x2b\x2d\x2f\x3d\x3f\x5e\x5f\x60\x7b\x7c\x7d\x7e'; + var host = 'a-z0-9\x2d\x2e'; + var reg = new RegExp('^[' + local + ']+(\x2e+[' + local + ']+)*@[' + host + ']{1,63}$', 'i'); if (reg.test(mailteste)) { return (true); diff --git a/core/public/js/item/item.editmetadata.js b/core/public/js/item/item.editmetadata.js index 1a5b5d37f..fff7fa200 100644 --- a/core/public/js/item/item.editmetadata.js +++ b/core/public/js/item/item.editmetadata.js @@ -10,7 +10,7 @@ midas.item.initElementMetaData = function () { $.each(midas.item.jsonMetadata[value], function (i, l) { availableTags.push(i); }); - $("input[name=element]").autocomplete({ + $('input[name=element]').autocomplete({ source: availableTags, change: function () { midas.item.initElementMetaData(); @@ -28,7 +28,7 @@ midas.item.initQualifierMetaData = function () { availableTags.push(l.qualifier); }); - $("input[name=qualifier]").autocomplete({ + $('input[name=qualifier]').autocomplete({ source: availableTags, change: function () { midas.item.initElementMetaData(); diff --git a/core/public/js/item/item.view.js b/core/public/js/item/item.view.js index 6f75b2a3f..a1219ec65 100644 --- a/core/public/js/item/item.view.js +++ b/core/public/js/item/item.view.js @@ -25,8 +25,8 @@ $(document).ready(function () { }); $('a.metadataDeleteLink img').fadeTo('fast', 0.4); $('a.metadataDeleteLink img').hover(function () { - $(this).fadeTo('fast', 1.0); - }, + $(this).fadeTo('fast', 1.0); + }, function () { $(this).fadeTo('fast', 0.4); }); @@ -50,48 +50,48 @@ $(document).ready(function () { deleteMetadata: true }); metadataCell.remove(); - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); $('input.deleteMetaDataNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); $('a.metadataEditLink img').fadeTo('fast', 0.4); $('a.metadataEditLink img').hover(function () { - $(this).fadeTo('fast', 1.0); - }, + $(this).fadeTo('fast', 1.0); + }, function () { $(this).fadeTo('fast', 0.4); }); $('a.metadataEditLink').click(function () { var metadataId = $(this).attr('element'); var itemrevision = $(this).attr('itemrevision'); - midas.loadDialog("editmetadata" + metadataId, "/item/editmetadata/?metadataId=" + encodeURIComponent(metadataId) + "&itemId=" + encodeURIComponent(json.item.item_id) + "&itemrevision=" + encodeURIComponent(itemrevision)); + midas.loadDialog('editmetadata' + metadataId, '/item/editmetadata/?metadataId=' + encodeURIComponent(metadataId) + '&itemId=' + encodeURIComponent(json.item.item_id) + '&itemrevision=' + encodeURIComponent(itemrevision)); midas.showDialog('MetaData'); }); $('a.addMetadataLink').click(function () { var metadataId = $(this).attr('element'); - midas.loadDialog("editmetadata" + metadataId, "/item/editmetadata/?itemId=" + encodeURIComponent(json.item.item_id)); + midas.loadDialog('editmetadata' + metadataId, '/item/editmetadata/?itemId=' + encodeURIComponent(json.item.item_id)); var options = { buttons: { - "Add": function () { - $(this).dialog("close"); + 'Add': function () { + $(this).dialog('close'); // since we are adding, be sure that the metadata doesn't already exist // if it does, give the user an error message and don't add the new metadata var requestData = {}; - requestData["element"] = $('#midas_item_metadata_element').val(); - requestData["qualifier"] = $('#midas_item_metadata_qualifier').val(); - requestData["metadatatype"] = $('#midas_item_metadata_metadatatype').val(); - requestData["itemId"] = json.item.item_id; + requestData['element'] = $('#midas_item_metadata_element').val(); + requestData['qualifier'] = $('#midas_item_metadata_qualifier').val(); + requestData['metadatatype'] = $('#midas_item_metadata_metadatatype').val(); + requestData['itemId'] = json.item.item_id; $.ajax({ - type: "POST", - url: json.global.webroot + "/item/getmetadatavalueexists", + type: 'POST', + url: json.global.webroot + '/item/getmetadatavalueexists', data: requestData, success: function (jsonContent) { var data = $.parseJSON(jsonContent); - if (data.exists === "1") { - midas.createNotice("Metadata already exists for that metadatatype, element and qualifier", 4000, 'error'); + if (data.exists === '1') { + midas.createNotice('Metadata already exists for that metadatatype, element and qualifier', 4000, 'error'); // clear the form values $('#midas_item_metadata_element').val(''); $('#midas_item_metadata_qualifier').val(''); @@ -110,8 +110,8 @@ $(document).ready(function () { $('a.deleteItemRevision img').fadeTo('fast', 0.4); $('a.deleteItemRevision img').hover(function () { - $(this).fadeTo('fast', 1.0); - }, + $(this).fadeTo('fast', 1.0); + }, function () { $(this).fadeTo('fast', 0.4); }); @@ -131,21 +131,21 @@ $(document).ready(function () { midas.showDialogWithContent(json.item.message['delete'], html, false); $('input.deleteItemRevisionYes').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); $('#deleteItemrevisionForm' + itemrevisionId).submit(); }); $('input.deleteItemRevisionNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); $('a.duplicateItemLink').click(function () { - midas.loadDialog("duplicateItem", "/browse/movecopy/?duplicate=true&items=" + encodeURIComponent(json.item.item_id)); + midas.loadDialog('duplicateItem', '/browse/movecopy/?duplicate=true&items=' + encodeURIComponent(json.item.item_id)); midas.showDialog('Copy item'); }); $('a.linkItemLink').click(function () { - midas.loadDialog("linkToItem", "/share/links?type=item&id=" + encodeURIComponent(json.item.item_id)); + midas.loadDialog('linkToItem', '/share/links?type=item&id=' + encodeURIComponent(json.item.item_id)); midas.showDialog('Link to this item'); }); @@ -181,7 +181,7 @@ $(document).ready(function () { content: 'Edit bitstream' }).click(function () { var bitstreamId = $(this).attr('element'); - midas.loadDialog("editBitstream" + bitstreamId, "/item/editbitstream?bitstreamId=" + encodeURIComponent(bitstreamId)); + midas.loadDialog('editBitstream' + bitstreamId, '/item/editbitstream?bitstreamId=' + encodeURIComponent(bitstreamId)); midas.showDialog(json.browse.editBitstream, false, { width: 380 }); @@ -204,9 +204,9 @@ $(document).ready(function () { html += '
    '; midas.showDialogWithContent(json.item.message['delete'], html, false); $('input.deleteBitstreamYes').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); $.ajax({ - type: "POST", + type: 'POST', url: json.global.webroot + '/item/deletebitstream', data: { bitstreamId: bitstreamId @@ -221,13 +221,13 @@ $(document).ready(function () { }); }); $('input.deleteBitstreamNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); $('a#itemDeleteLink').click(function () { $.ajax({ - type: "GET", + type: 'GET', url: json.global.webroot + '/item/checkshared', data: { itemId: json.item.item_id @@ -253,14 +253,14 @@ $(document).ready(function () { location.replace(json.global.webroot + '/item/delete?itemId=' + encodeURIComponent(json.item.item_id)); }); $('input.deleteItemNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); } }); }); $('a.sharingLink').click(function () { - midas.loadDialog("sharing" + $(this).attr('type') + $(this).attr('element'), "/share/dialog?type=" + encodeURIComponent($(this).attr('type')) + '&element=' + encodeURIComponent($(this).attr('element'))); + midas.loadDialog('sharing' + $(this).attr('type') + $(this).attr('element'), '/share/dialog?type=' + encodeURIComponent($(this).attr('type')) + '&element=' + encodeURIComponent($(this).attr('element'))); midas.showDialog(json.browse.share); }); @@ -270,7 +270,7 @@ $(document).ready(function () { // Set the text to an image HTML string with the correct src URL to the loading image you want to use text: 'Loading...', ajax: { - url: json.global.webroot + "/upload/revision?itemId=" + encodeURIComponent(itemId) // Use the rel attribute of each element for the url to load + url: json.global.webroot + '/upload/revision?itemId=' + encodeURIComponent(itemId) // Use the rel attribute of each element for the url to load }, title: { text: $('a.uploadRevisionLink').html(), // Give the tooltip a title using each elements text @@ -301,7 +301,7 @@ $(document).ready(function () { }); $('a.editItemLink').click(function () { - midas.loadDialog("editItem" + json.item.item_id, "/item/edit?itemId=" + encodeURIComponent(json.item.item_id)); + midas.loadDialog('editItem' + json.item.item_id, '/item/edit?itemId=' + encodeURIComponent(json.item.item_id)); midas.showDialog(json.browse.editItem, false, { width: 545 }); diff --git a/core/public/js/jquery/jquery.autogrow-textarea.js b/core/public/js/jquery/jquery.autogrow-textarea.js index 16d8ea6d9..c9ce31e9b 100644 --- a/core/public/js/jquery/jquery.autogrow-textarea.js +++ b/core/public/js/jquery/jquery.autogrow-textarea.js @@ -34,12 +34,12 @@ .replace(/&/g, '&') .replace(/\n$/, '
     ') .replace(/\n/g, '
    ') - .replace(/ {2,}/g, function(space) { return times(' ', space.length -1) + ' ' }); + .replace(/ {2,}/g, function(space) { return times(' ', space.length -1) + ' '; }); shadow.html(val); $(this).css('height', Math.max(shadow.height() + 20, minHeight)); - } + }; $(this).change(update).keyup(update).keydown(update); @@ -49,6 +49,6 @@ return this; - } + }; })(jQuery); diff --git a/core/public/js/jquery/jquery.checkboxrange.js b/core/public/js/jquery/jquery.checkboxrange.js index 40dfa69be..0cf589dc1 100644 --- a/core/public/js/jquery/jquery.checkboxrange.js +++ b/core/public/js/jquery/jquery.checkboxrange.js @@ -1,25 +1,25 @@ (function($) { - $.fn.enableCheckboxRangeSelection = function(opts) { - var defaults = { - onRangeSelect: null - }; - var options = $.extend({}, defaults, opts); - var lastCheckbox = null; - var $spec = this; - $spec.unbind("click.checkboxrange"); - $spec.bind("click.checkboxrange", function(e) { - if (lastCheckbox != null && (e.shiftKey || e.metaKey)) { - $spec.slice( + $.fn.enableCheckboxRangeSelection = function(opts) { + var defaults = { + onRangeSelect: null + }; + var options = $.extend({}, defaults, opts); + var lastCheckbox = null; + var $spec = this; + $spec.unbind('click.checkboxrange'); + $spec.bind('click.checkboxrange', function(e) { + if (lastCheckbox != null && (e.shiftKey || e.metaKey)) { + $spec.slice( Math.min($spec.index(lastCheckbox), $spec.index(e.target)), Math.max($spec.index(lastCheckbox), $spec.index(e.target)) + 1 - ).attr({checked: e.target.checked ? "checked" : ""}); + ).attr({checked: e.target.checked ? 'checked' : ''}); - if ($.isFunction(options.onRangeSelect)) { - options.onRangeSelect.call(); + if ($.isFunction(options.onRangeSelect)) { + options.onRangeSelect.call(); } } - lastCheckbox = e.target; + lastCheckbox = e.target; }); }; })(jQuery); diff --git a/core/public/js/layout/midas.dialog.js b/core/public/js/layout/midas.dialog.js index 817f78e12..47759dfd4 100644 --- a/core/public/js/layout/midas.dialog.js +++ b/core/public/js/layout/midas.dialog.js @@ -7,8 +7,8 @@ midas.loadDialog = function (name, url) { 'use strict'; if ($('.DialogContentPage').val() != name) { $('.DialogContentPage').val(name); - $('div.MainDialogContent').html(""); - $("div.MainDialogLoading").show(); + $('div.MainDialogContent').html(''); + $('div.MainDialogLoading').show(); $.ajax({ url: $('.webroot').val() + url, // contentType: "application/x-www-form-urlencoded;charset=UTF-8", @@ -41,8 +41,8 @@ midas.showDialog = function (title, button, opts) { }; if (button) { options.buttons = { - "Ok": function () { - $(this).dialog("close"); + 'Ok': function () { + $(this).dialog('close'); } }; } @@ -80,7 +80,7 @@ midas.showBigDialogWithContent = function (title, content, button) { 'use strict'; $('.DialogContentPage').val(''); $('div.MainDialogContent').html(content); - $("div.MainDialogLoading").hide(); + $('div.MainDialogLoading').hide(); midas.showBigDialog(title, button); }; @@ -96,17 +96,17 @@ midas.loadAjaxDynamicBar = function (name, url) { if ($('.DynamicContentPage').val() != name) { $('.DynamicContentPage').val(name); $('div.TopDynamicContent').fadeOut('slow', function () { - $('div.TopDynamicContent').html(""); - $("div.TopDynamicLoading").show(); + $('div.TopDynamicContent').html(''); + $('div.TopDynamicLoading').show(); $.ajax({ url: $('.webroot').val() + url, - contentType: "application/x-www-form-urlencoded;charset=UTF-8", + contentType: 'application/x-www-form-urlencoded;charset=UTF-8', success: function (data) { - $("div.TopDynamicLoading").hide(); + $('div.TopDynamicLoading').hide(); $('div.TopDynamicContent').hide(); $('div.TopDynamicContent').html(data); - $('div.TopDynamicContent').fadeIn("slow"); + $('div.TopDynamicContent').fadeIn('slow'); } }); }); @@ -121,12 +121,12 @@ midas.showOrHideDynamicBar = function (name) { midas.showDialog(name); return; } - if ($("div.TopDynamicBar").is(':hidden')) { - $("div.TopDynamicBar").show('blind', function () { + if ($('div.TopDynamicBar').is(':hidden')) { + $('div.TopDynamicBar').show('blind', function () { $('#email').focus(); }); } else if ($('.DynamicContentPage').val() == name) { - $("div.TopDynamicBar").hide('blind'); + $('div.TopDynamicBar').hide('blind'); } }; diff --git a/core/public/js/layout/midas.empty.js b/core/public/js/layout/midas.empty.js index dabdbc418..33f0ab735 100644 --- a/core/public/js/layout/midas.empty.js +++ b/core/public/js/layout/midas.empty.js @@ -7,13 +7,6 @@ var json = json || {}; var midas = midas || {}; -// Prevent error if console.log is called -if (typeof console != "object") { - var console = { - 'log': function () {} - }; -} - $(function () { 'use strict'; // Parse json content diff --git a/core/public/js/layout/midas.layout.js b/core/public/js/layout/midas.layout.js index 9b32d8f16..609348500 100644 --- a/core/public/js/layout/midas.layout.js +++ b/core/public/js/layout/midas.layout.js @@ -4,13 +4,6 @@ var json = json || {}; var midas = midas || {}; var itemselected = false; -// Prevent error if console.log is called -if (typeof console != "object") { - var console = { - 'log': function () {} - }; -} - // Main calls $(function () { 'use strict'; @@ -49,9 +42,9 @@ $(function () { } function showStartingGuide() { - $("#dialogStartingGuide").dialog({ + $('#dialogStartingGuide').dialog({ width: 580, - title: $("#dialogStartingGuide").attr('title'), + title: $('#dialogStartingGuide').attr('title'), modal: true }); } @@ -61,7 +54,7 @@ $(function () { if ($(this).is(':checked')) { value = 0; } - $.post(json.global.webroot + "/user/startingguide", { + $.post(json.global.webroot + '/user/startingguide', { value: value }); }); @@ -77,51 +70,51 @@ $(function () { }); $('#blockSettingsLink').click(function () { midas.loadAjaxDynamicBar('settings', '/user/settings'); - if ($("div.TopDynamicBar").is(':hidden')) { - $("div.TopDynamicBar").show('blind', function () { + if ($('div.TopDynamicBar').is(':hidden')) { + $('div.TopDynamicBar').show('blind', function () { }); } - $('#dialogStartingGuide').dialog("close"); + $('#dialogStartingGuide').dialog('close'); }); // Login - $("a.loginLink").click(function () { + $('a.loginLink').click(function () { midas.showOrHideDynamicBar('login'); midas.loadAjaxDynamicBar('login', '/user/login'); }); // Setting link - $("li.settingsLink").click(function () { - if ($("div.TopDynamicBar").is(':hidden')) { - $("div.TopDynamicBar").show('blind', function () {}); + $('li.settingsLink').click(function () { + if ($('div.TopDynamicBar').is(':hidden')) { + $('div.TopDynamicBar').show('blind', function () {}); } midas.loadAjaxDynamicBar('settings', '/user/settings'); }); // Module link - $("li.modulesLink").click(function () { - if ($("div.TopDynamicBar").is(':hidden')) { - $("div.TopDynamicBar").show('blind', function () {}); + $('li.modulesLink').click(function () { + if ($('div.TopDynamicBar').is(':hidden')) { + $('div.TopDynamicBar').show('blind', function () {}); } midas.loadAjaxDynamicBar('settings', '/user/settings'); }); // Register link - $("a.registerLink").click(function () { + $('a.registerLink').click(function () { midas.showOrHideDynamicBar('register'); midas.loadAjaxDynamicBar('register', '/user/register'); }); // Search Bar ----------------------- // Live search - $.widget("custom.catcomplete", $.ui.autocomplete, { + $.widget('custom.catcomplete', $.ui.autocomplete, { _renderMenu: function (ul, items) { var self = this, - currentCategory = ""; + currentCategory = ''; $.each(items, function (index, item) { if (item.category != currentCategory) { - ul.append('
  • ' + item.category + "
  • "); + ul.append('
  • ' + item.category + '
  • '); currentCategory = item.category; } self._renderItemData(ul, item); @@ -131,7 +124,7 @@ $(function () { var cache = {}, lastXhr; - $("#live_search").catcomplete({ + $('#live_search').catcomplete({ minLength: 2, delay: 10, source: function (request, response) { @@ -141,10 +134,10 @@ $(function () { return; } - $("#searchloading").show(); + $('#searchloading').show(); - lastXhr = $.getJSON($('.webroot').val() + "/search/live", request, function (data, status, xhr) { - $("#searchloading").hide(); + lastXhr = $.getJSON($('.webroot').val() + '/search/live', request, function (data, status, xhr) { + $('#searchloading').hide(); cache[term] = data; if (xhr === lastXhr) { itemselected = false; @@ -254,7 +247,7 @@ $(function () { } else { midas.createNotice(json.login.contentUploadLogin, 4000); - $("div.TopDynamicBar").show('blind'); + $('div.TopDynamicBar').show('blind'); midas.loadAjaxDynamicBar('login', '/user/login'); } }); @@ -264,9 +257,9 @@ $(function () { $('#menuUserInfo').click(function () { globalAuthAsk(json.global.webroot + '/user/userpage'); }); - $("div.TopDynamicBar .closeButton").click(function () { - if (!$("div.TopDynamicBar").is(':hidden')) { - $("div.TopDynamicBar").hide('blind'); + $('div.TopDynamicBar .closeButton').click(function () { + if (!$('div.TopDynamicBar').is(':hidden')) { + $('div.TopDynamicBar').hide('blind'); } }); @@ -289,7 +282,7 @@ function globalAuthAsk(url) { } else { midas.createNotice(json.login.titleUploadLogin, 4000); - $("div.TopDynamicBar").show('blind'); + $('div.TopDynamicBar').show('blind'); midas.loadAjaxDynamicBar('login', '/user/login'); } } @@ -336,16 +329,16 @@ function TimerQtip() { if (!$('#dialogStartingGuide').is(':hidden')) { iQtips = 0; - setTimeout("TimerQtip()", 1000); + setTimeout('TimerQtip()', 1000); return; } qtipsHelp[iQtips].qtip('show'); if (qtipsHelp.length > iQtips + 1) { - setTimeout("TimerQtip()", 5000); + setTimeout('TimerQtip()', 5000); } else { - setTimeout("StopTimerQtip()", 5000); + setTimeout('StopTimerQtip()', 5000); } iQtips++; } diff --git a/core/public/js/layout/midas.notice.js b/core/public/js/layout/midas.notice.js index 7b6a3e6ac..8cef80f7d 100644 --- a/core/public/js/layout/midas.notice.js +++ b/core/public/js/layout/midas.notice.js @@ -28,7 +28,6 @@ midas.createNotice = function (text, delay, state) { */ function createNotice(text, delay, state) { 'use strict'; - console.log('WARNING: createNotice is deprecated, use midas.createNotice instead'); midas.createNotice(text, delay, state); } diff --git a/core/public/js/rest/rest.index.js b/core/public/js/rest/rest.index.js index 94dfbad9d..f8f6be1ce 100644 --- a/core/public/js/rest/rest.index.js +++ b/core/public/js/rest/rest.index.js @@ -1,6 +1,7 @@ // Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. /* global json */ +/* global SwaggerUi */ var midas = midas || {}; midas.rest = midas.rest || {}; @@ -10,23 +11,10 @@ $(document).ready(function () { window.swaggerUi = new SwaggerUi({ discoveryUrl: json.global.webroot + '/apidocs/', apiKey: null, - dom_id: "swagger-ui-container", + dom_id: 'swagger-ui-container', supportHeaderParams: false, supportedSubmitMethods: ['get', 'post', 'put', 'delete'], - onComplete: function (swaggerApi, swaggerUi) { - if (console) { - console.log("Loaded SwaggerUI"); - console.log(swaggerApi); - console.log(swaggerUi); - } - }, - onFailure: function (data) { - if (console) { - console.log("Unable to Load SwaggerUI"); - console.log(data); - } - }, - docExpansion: "none" + docExpansion: 'none' }); window.swaggerUi.load(); diff --git a/core/public/js/search/search.index.js b/core/public/js/search/search.index.js index cbc46cdf2..d60076ad6 100644 --- a/core/public/js/search/search.index.js +++ b/core/public/js/search/search.index.js @@ -5,7 +5,7 @@ $(document).ready(function () { 'use strict'; - json.search.keyword = $("
    ").html(json.search.keyword).text(); // remove html entity encoding + json.search.keyword = $('
    ').html(json.search.keyword).text(); // remove html entity encoding $('#live_search_value').val($('#live_search').val()); $('#live_search').val(json.search.keyword); @@ -78,10 +78,10 @@ function changeSorting(order) { $('img.searchLoading').show(); $('ul#searchResults').hide(); $.post(json.global.webroot + '/search', { - q: json.search.keyword, - ajax: true, - order: order - }, + q: json.search.keyword, + ajax: true, + order: order + }, function (data) { var tmp = $.parseJSON(data); json.search.results = tmp.results; @@ -130,28 +130,28 @@ function createSearchResults(element) { 'use strict'; var html = ''; if (element.resultType == 'user') { - html = ""; - html += "" + sliceFileName(element.firstname + ' ' + element.lastname, 45) + "
    "; - html += "" + element.company + ""; - html += "" + element.formattedDate + ""; + html = ''; + html += '' + sliceFileName(element.firstname + ' ' + element.lastname, 45) + '
    '; + html += '' + element.company + ''; + html += '' + element.formattedDate + ''; } if (element.resultType == 'item') { - html = ""; - html += "" + sliceFileName(element.name, 45) + "
    "; - html += "" + element.description + ""; - html += "" + element.formattedDate + ""; + html = ''; + html += '' + sliceFileName(element.name, 45) + '
    '; + html += '' + element.description + ''; + html += '' + element.formattedDate + ''; } if (element.resultType == 'folder') { - html = ""; - html += "" + sliceFileName(element.name, 45) + "
    "; - html += "" + element.description + ""; - html += "" + element.formattedDate + ""; + html = ''; + html += '' + sliceFileName(element.name, 45) + '
    '; + html += '' + element.description + ''; + html += '' + element.formattedDate + ''; } if (element.resultType == 'community') { - html = ""; - html += "" + sliceFileName(element.name, 45) + "
    "; - html += "" + element.description + ""; - html += "" + element.formattedDate + ""; + html = ''; + html += '' + sliceFileName(element.name, 45) + '
    '; + html += '' + element.description + ''; + html += '' + element.formattedDate + ''; } return '
  • ' + html + '
  • '; diff --git a/core/public/js/share/share.dialog.js b/core/public/js/share/share.dialog.js index 7efe0e661..d8e522a26 100644 --- a/core/public/js/share/share.dialog.js +++ b/core/public/js/share/share.dialog.js @@ -8,10 +8,10 @@ var jsonShare = $.parseJSON($('div.jsonShareContent').html()); $('a#setElementPublicLink').click(function () { 'use strict'; $.post(json.global.webroot + '/share/dialog', { - setPublic: true, - type: jsonShare.type, - element: jsonShare.element - }, + setPublic: true, + type: jsonShare.type, + element: jsonShare.element + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse[0]) { @@ -33,12 +33,12 @@ $('a.removeShareLink').click(function () { var removeId = $(this).parents('tr').attr('element'); var obj = $(this).parents('tr'); $.post(json.global.webroot + '/share/dialog', { - removePolicy: true, - removeType: removeType, - removeId: removeId, - type: jsonShare.type, - element: jsonShare.element - }, + removePolicy: true, + removeType: removeType, + removeId: removeId, + type: jsonShare.type, + element: jsonShare.element + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse[0]) { @@ -59,13 +59,13 @@ $('select.changePermissionSelect').change(function () { var changeVal = $(this).val(); var obj = $(this).parents('tr'); $.post(json.global.webroot + '/share/dialog', { - changePolicy: true, - changeVal: changeVal, - changeType: changeType, - changeId: changeId, - type: jsonShare.type, - element: jsonShare.element - }, + changePolicy: true, + changeVal: changeVal, + changeType: changeType, + changeId: changeId, + type: jsonShare.type, + element: jsonShare.element + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse[0]) { @@ -81,10 +81,10 @@ $('select.changePermissionSelect').change(function () { $('a#setElementPrivateLink').click(function () { 'use strict'; $.post(json.global.webroot + '/share/dialog', { - setPrivate: true, - type: jsonShare.type, - element: jsonShare.element - }, + setPrivate: true, + type: jsonShare.type, + element: jsonShare.element + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse[0]) { @@ -101,14 +101,14 @@ $('a#setElementPrivateLink').click(function () { }); // Live search -$.widget("custom.catcomplete", $.ui.autocomplete, { +$.widget('custom.catcomplete', $.ui.autocomplete, { _renderMenu: function (ul, items) { 'use strict'; var self = this, - currentCategory = ""; + currentCategory = ''; $.each(items, function (index, item) { if (item.category != currentCategory) { - ul.append('
  • ' + item.category + "
  • "); + ul.append('
  • ' + item.category + '
  • '); currentCategory = item.category; } self._renderItemData(ul, item); @@ -119,7 +119,7 @@ $.widget("custom.catcomplete", $.ui.autocomplete, { var shareSearchcache = {}, lastShareXhr; var itemShareSelected; -$("#live_share_search").catcomplete({ +$('#live_share_search').catcomplete({ minLength: 2, delay: 10, source: function (request, response) { @@ -130,11 +130,11 @@ $("#live_share_search").catcomplete({ return; } - $("#searchShareLoading").show(); + $('#searchShareLoading').show(); - lastShareXhr = $.getJSON($('.webroot').val() + "/search/live?shareSearch=true", request, + lastShareXhr = $.getJSON($('.webroot').val() + '/search/live?shareSearch=true', request, function (data, status, xhr) { - $("#searchShareLoading").hide(); + $('#searchShareLoading').hide(); shareSearchcache[term] = data; if (xhr === lastShareXhr) { itemShareSelected = false; @@ -162,17 +162,17 @@ $("#live_share_search").catcomplete({ return; } $.post(json.global.webroot + '/share/dialog', { - createPolicy: true, - newPolicyType: newPolicyType, - newPolicyId: newPolicyId, - type: jsonShare.type, - element: jsonShare.element - }, + createPolicy: true, + newPolicyType: newPolicyType, + newPolicyId: newPolicyId, + type: jsonShare.type, + element: jsonShare.element + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse[0]) { midas.createNotice(jsonResponse[1], 1500); - midas.loadDialog("sharing" + $(this).attr('type') + $(this).attr('element') + newPolicyId, "/share/dialog?type=" + encodeURIComponent(jsonShare.type) + '&element=' + encodeURIComponent(jsonShare.element)); + midas.loadDialog('sharing' + $(this).attr('type') + $(this).attr('element') + newPolicyId, '/share/dialog?type=' + encodeURIComponent(jsonShare.type) + '&element=' + encodeURIComponent(jsonShare.element)); midas.showDialog(json.browse.share); } else { @@ -204,8 +204,8 @@ $('#live_share_search').focusout(function () { $('input.permissionsDone').click(function () { 'use strict'; $('div.MainDialog').dialog('close'); - if (jsonShare.type == "folder") { - midas.loadDialog("applyRecursive" + jsonShare.element, "/share/applyrecursivedialog?folderId=" + encodeURIComponent(jsonShare.element)); + if (jsonShare.type == 'folder') { + midas.loadDialog('applyRecursive' + jsonShare.element, '/share/applyrecursivedialog?folderId=' + encodeURIComponent(jsonShare.element)); midas.showDialog(json.browse.share); } }); diff --git a/core/public/js/upload/upload.revision.js b/core/public/js/upload/upload.revision.js index 1b01756d7..2450a09b4 100644 --- a/core/public/js/upload/upload.revision.js +++ b/core/public/js/upload/upload.revision.js @@ -114,10 +114,9 @@ midas.upload.revision.initHtml5FileUpload = function () { var url = json.global.webroot + '/api/json?method=midas.upload.perform&uploadtoken=' + encodeURIComponent(uploadToken) + '&length=' + encodeURIComponent(file.size) + '&filename=' + encodeURIComponent(file.name); var changes = $('#revisionChanges').val(); - if(changes) { + if (changes) { url += '&changes=' + encodeURIComponent(changes); } - console.log(url); resumeUploadId = uploadToken; @@ -238,7 +237,6 @@ midas.upload.revision.initHtml5FileUpload = function () { $('div.uploadValidationError b').text('Could not connect to the server to resume upload.'); $('div.uploadValidationError').show(); $('#startUploadLink').removeClass('disabled'); - console.log(resp); }); }; }; @@ -252,11 +250,11 @@ $('.uploadTabs').tabs({ success: function () { 'use strict'; $('div.MainDialogLoading').hide(); - $(".uploadTabs").show(); + $('.uploadTabs').show(); }, error: function (xhr, status, index, anchor) { 'use strict'; - $(anchor.hash).html("Couldn't load this tab. "); + $(anchor.hash).html('Could not load this tab. '); } } }); diff --git a/core/public/js/upload/upload.simpleupload.js b/core/public/js/upload/upload.simpleupload.js index 65dba667c..0a08af118 100644 --- a/core/public/js/upload/upload.simpleupload.js +++ b/core/public/js/upload/upload.simpleupload.js @@ -208,7 +208,7 @@ midas.upload.simpleupload.initHtml5FileUpload = function () { } if ($('#destinationId').val() === undefined || $('#destinationId').val().length === 0) { - midas.createNotice("Please select where you want to upload your files.", 4000, 'warning'); + midas.createNotice('Please select where you want to upload your files.', 4000, 'warning'); return false; } @@ -244,7 +244,6 @@ midas.upload.simpleupload.initHtml5FileUpload = function () { $('div.uploadValidationError b').text('Could not connect to the server to resume upload.'); $('div.uploadValidationError').show(); $('#startUploadLink').removeClass('disabled'); - console.log(resp); }); }; }; @@ -258,11 +257,11 @@ $('.uploadTabs').tabs({ success: function () { 'use strict'; $('div.MainDialogLoading').hide(); - $(".uploadTabs").show(); + $('.uploadTabs').show(); }, error: function (xhr, status, index, anchor) { 'use strict'; - $(anchor.hash).html("Couldn't load this tab. "); + $(anchor.hash).html('Could not load this tab. '); } } }); @@ -278,7 +277,7 @@ midas.upload.simpleupload.initHtml5FileUpload(); $('.browseMIDASLink').click(function () { 'use strict'; - midas.loadDialog("select", "/browse/selectfolder/?policy=write"); + midas.loadDialog('select', '/browse/selectfolder/?policy=write'); midas.showDialog('Select upload destination'); }); diff --git a/core/public/js/user/user.emailregister.js b/core/public/js/user/user.emailregister.js index 7a3f369f1..23137fa36 100644 --- a/core/public/js/user/user.emailregister.js +++ b/core/public/js/user/user.emailregister.js @@ -12,8 +12,8 @@ $(document).ready(function () { 'use strict'; $('label.termLabel').after($('div.termDiv').html()); $('a.termOfService').click(function () { - midas.loadDialog("terms", "/user/termofservice"); - midas.showBigDialog("Terms of Service"); + midas.loadDialog('terms', '/user/termofservice'); + midas.showBigDialog('Terms of Service'); }); $('#registerForm').find('input').each(function () { diff --git a/core/public/js/user/user.login.js b/core/public/js/user/user.login.js index c0823d29b..71765c811 100644 --- a/core/public/js/user/user.login.js +++ b/core/public/js/user/user.login.js @@ -51,12 +51,12 @@ $(document).ready(function () { // Deal with password recovery if ($('a#forgotPasswordLink').length) { $('a#forgotPasswordLink').click(function () { - midas.loadDialog("forgotpassword", "/user/recoverpassword"); - midas.showDialog("Recover Password"); + midas.loadDialog('forgotpassword', '/user/recoverpassword'); + midas.showDialog('Recover Password'); }); } - $("a.registerLink").unbind('click').click(function () { + $('a.registerLink').unbind('click').click(function () { midas.showOrHideDynamicBar('register'); midas.loadAjaxDynamicBar('register', '/user/register'); }); diff --git a/core/public/js/user/user.manage.js b/core/public/js/user/user.manage.js index 8d6eb6e7b..1e0f01a70 100644 --- a/core/public/js/user/user.manage.js +++ b/core/public/js/user/user.manage.js @@ -20,8 +20,8 @@ $(document).ready(function () { disableElementSize: true }); - $("img.tableLoading").hide(); - $("table#browseTable").show(); + $('img.tableLoading').hide(); + $('table#browseTable').show(); $('div.communityList').hide(); @@ -62,39 +62,39 @@ function callbackCreateElement(node) { function initDragAndDrop() { 'use strict'; - $("#browseTable .file, #browseTable .filePublic, #browseTable .filePrivate," + - "#browseTable .folderPublic:not(.notdraggable), #browseTable .folderPrivate:not(.notdraggable)").draggable({ - helper: "clone", - cursor: "move", - opacity: 0.75, - refreshPositions: true, // Performance? - revert: "invalid", - revertDuration: 300, - scroll: true, + $('#browseTable .file, #browseTable .filePublic, #browseTable .filePrivate,' + + '#browseTable .folderPublic:not(.notdraggable), #browseTable .folderPrivate:not(.notdraggable)').draggable({ + helper: 'clone', + cursor: 'move', + opacity: 0.75, + refreshPositions: true, // Performance? + revert: 'invalid', + revertDuration: 300, + scroll: true, // Show communities when user starts to drag items - start: function () { - $('div.communityList').show(); - } - }); + start: function () { + $('div.communityList').show(); + } + }); - $("#browseTable .folder, #browseTable .folderPrivate, #browseTable .folderPublic").each(function () { + $('#browseTable .folder, #browseTable .folderPrivate, #browseTable .folderPublic').each(function () { // Configure droppable folders/items - $(this).parents("tr:[policy!=0]").droppable({ - accept: ".file, .filePublic, .filePrivate, .folder, .folderPublic, .folderPrivate", + $(this).parents('tr:[policy!=0]').droppable({ + accept: '.file, .filePublic, .filePrivate, .folder, .folderPublic, .folderPrivate', drop: function (e, ui) { // Call jQuery treeTable plugin to move the branch var elements = ''; - if ($(ui.draggable).parents("tr").attr('type') == 'folder') { - elements = $(ui.draggable).parents("tr").attr('element') + ';'; + if ($(ui.draggable).parents('tr').attr('type') == 'folder') { + elements = $(ui.draggable).parents('tr').attr('element') + ';'; } else { - elements = ';' + $(ui.draggable).parents("tr").attr('element'); + elements = ';' + $(ui.draggable).parents('tr').attr('element'); } var from_obj; - var classNames = $(ui.draggable).parents("tr").attr('class').split(' '); + var classNames = $(ui.draggable).parents('tr').attr('class').split(' '); for (var key in classNames) { if (classNames[key].match('child-of-')) { - from_obj = "#" + classNames[key].substring(9); + from_obj = '#' + classNames[key].substring(9); } } var destination_obj = this; @@ -102,12 +102,12 @@ function initDragAndDrop() { // do nothing if drop item(s) to its current folder, otherwise move item(s) if ($(this).attr('id') != $(from_obj).attr('id')) { $.post(json.global.webroot + '/browse/movecopy', { - moveElement: true, - elements: elements, - destination: $(destination_obj).attr('element'), - from: $(from_obj).attr('element'), - ajax: true - }, + moveElement: true, + elements: elements, + destination: $(destination_obj).attr('element'), + from: $(from_obj).attr('element'), + ajax: true + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { @@ -116,7 +116,7 @@ function initDragAndDrop() { } if (jsonResponse[0]) { midas.createNotice(jsonResponse[1], 1500); - $($(ui.draggable).parents("tr")[0]).appendBranchTo(destination_obj); + $($(ui.draggable).parents('tr')[0]).appendBranchTo(destination_obj); } else { midas.createNotice(jsonResponse[1], 4000); @@ -125,28 +125,28 @@ function initDragAndDrop() { } }, - hoverClass: "accept", + hoverClass: 'accept', over: function (e, ui) { // Make the droppable branch expand when a draggable node is moved over it. - if (this.id != $(ui.draggable.parents("tr")[0]).id && !$(this).is(".expanded")) { + if (this.id != $(ui.draggable.parents('tr')[0]).id && !$(this).is('.expanded')) { $(this).expand(); } } }); // Configure non-drappable folders/items - $(this).parents("tr:[policy=0]").droppable({ + $(this).parents('tr:[policy=0]').droppable({ revert: true, // Make the droppable branch expand when a draggable node is moved over it. over: function (e, ui) { - if (!$(this).is(".expanded")) { + if (!$(this).is('.expanded')) { $(this).expand(); } } }); // qtip pop-up for folders with only read permission - $(this).parents("tr:[policy=0]").qtip({ + $(this).parents('tr:[policy=0]').qtip({ content: 'You do not have write permission on this folder and cannot drop item(s) to it !', show: 'mouseover', hide: 'mouseout', diff --git a/core/public/js/user/user.recoverpassword.js b/core/public/js/user/user.recoverpassword.js index a02b3a956..bca9d256f 100644 --- a/core/public/js/user/user.recoverpassword.js +++ b/core/public/js/user/user.recoverpassword.js @@ -21,7 +21,7 @@ midas.user.successRecoverPassword = function (responseText, statusText, xhr, for } if (jsonResponse[0]) { midas.createNotice(jsonResponse[1], 4000); - $("div.MainDialog").dialog("close"); + $('div.MainDialog').dialog('close'); } else { midas.createNotice(jsonResponse[1], 4000, 'error'); diff --git a/core/public/js/user/user.register.js b/core/public/js/user/user.register.js index f6fa5ce11..cfb13c660 100644 --- a/core/public/js/user/user.register.js +++ b/core/public/js/user/user.register.js @@ -8,8 +8,8 @@ var jsonRegister = $.parseJSON($('div.jsonRegister').html()); $('label.termLabel').after($('div.termDiv').html()); $('a.termOfService').click(function () { 'use strict'; - midas.loadDialog("terms", "/user/termofservice"); - midas.showBigDialog("Terms of Service"); + midas.loadDialog('terms', '/user/termofservice'); + midas.showBigDialog('Terms of Service'); }); $('#registerForm').find('input').each(function () { @@ -36,7 +36,7 @@ function checkAll(obj) { email = false; } else { - $.post(json.global.webroot + "/user/userexists", { + $.post(json.global.webroot + '/user/userexists', { entry: obj.val() }, function (data) { if (data.search('true') != -1) { diff --git a/core/public/js/user/user.settings.js b/core/public/js/user/user.settings.js index cb12e4701..b0e7668b4 100644 --- a/core/public/js/user/user.settings.js +++ b/core/public/js/user/user.settings.js @@ -81,10 +81,10 @@ midas.user.successPictureChange = function (responseText, statusText, xhr, form) $(window).load(function () { 'use strict'; - $("#tabsSettings").tabs(); + $('#tabsSettings').tabs(); - $("#tabsSettings").css('display', 'block'); - $("#tabsSettings").show(); + $('#tabsSettings').css('display', 'block'); + $('#tabsSettings').show(); $('#modifyPassword').ajaxForm({ beforeSubmit: midas.user.validatePasswordChange, diff --git a/core/public/js/user/user.userpage.js b/core/public/js/user/user.userpage.js index 509bf5852..ee41f3963 100644 --- a/core/public/js/user/user.userpage.js +++ b/core/public/js/user/user.userpage.js @@ -5,7 +5,7 @@ midas.user = midas.user || {}; $(document).ready(function () { 'use strict'; - $("#tabsGeneric").tabs({ + $('#tabsGeneric').tabs({ select: function (event, ui) { $('div.genericAction').show(); $('div.genericCommunities').show(); @@ -16,10 +16,10 @@ $(document).ready(function () { $('div.viewAction').hide(); } }); - $("#tabsGeneric").show(); + $('#tabsGeneric').show(); $('img.tabsLoading').hide(); - $("#browseTable").treeTable({ + $('#browseTable').treeTable({ onFirstInit: midas.enableRangeSelect, onNodeShow: midas.enableRangeSelect, onNodeHide: midas.enableRangeSelect @@ -27,8 +27,8 @@ $(document).ready(function () { midas.browser.enableSelectAll(); - $("img.tableLoading").hide(); - $("table#browseTable").show(); + $('img.tableLoading').hide(); + $('table#browseTable').show(); }); // dependence: common/browser.js diff --git a/modules/dicomanonymize/public/js/upload/upload.index.js b/modules/dicomanonymize/public/js/upload/upload.index.js index f0e7f3f4a..8614b5b8a 100644 --- a/modules/dicomanonymize/public/js/upload/upload.index.js +++ b/modules/dicomanonymize/public/js/upload/upload.index.js @@ -15,7 +15,7 @@ midas.dcma.sendParentToJavaSession = function () { $('.browseMIDASLink').click(function () { 'use strict'; - midas.loadDialog("select", "/browse/selectfolder?policy=write"); + midas.loadDialog('select', '/browse/selectfolder?policy=write'); midas.showDialog('Browse', null, { close: function () { $('.uploadApplet').show(); diff --git a/modules/dicomserver/public/js/admin/admin.index.js b/modules/dicomserver/public/js/admin/admin.index.js index b5954386e..2e0c2392d 100644 --- a/modules/dicomserver/public/js/admin/admin.index.js +++ b/modules/dicomserver/public/js/admin/admin.index.js @@ -33,7 +33,7 @@ midas.dicomserver.start = function (email, apikey) { midas.createNotice(retVal.data.message, 4000); }, error: function (XMLHttpRequest, textStatus, errorThrown) { - midas.createNotice("Failed to start storescp or dcmqrscp!", 3000, 'error'); + midas.createNotice('Failed to start storescp or dcmqrscp!', 3000, 'error'); $('textarea#apicall_failure_reason').html(XMLHttpRequest.message); $('div#apicall_failure').show(); $('div#hideError').show(); @@ -89,7 +89,7 @@ midas.dicomserver.stop = function () { midas.createNotice(retVal.data.message, 4000); }, error: function (XMLHttpRequest, textStatus, errorThrown) { - midas.createNotice("Execution of storescp stop script failed!", 3000, 'error'); + midas.createNotice('Execution of storescp stop script failed!', 3000, 'error'); $('textarea#apicall_failure_reason').html(XMLHttpRequest.message); $('div#apicall_failure').show(); $('div#hideError').show(); @@ -128,7 +128,7 @@ midas.dicomserver.checkStatus = function () { '&dcmqrscp_cmd=' + dcmqrscp_val, log: $('

    '), success: function (retVal) { - if (retVal.data.status === 3 || retVal.data.status === "3") { + if (retVal.data.status === 3 || retVal.data.status === '3') { $('span#not_running_status').hide(); $('span#only_storescp_running_status').hide(); $('span#only_dcmqrscp_running_status').hide(); @@ -136,21 +136,21 @@ midas.dicomserver.checkStatus = function () { $('span#span_start_server_user').html(retVal.data.user_email); $('div#start_server_user').show(); } - else if (retVal.data.status === 2 || retVal.data.status === "2") { + else if (retVal.data.status === 2 || retVal.data.status === '2') { $('span#not_running_status').hide(); $('span#only_storescp_running_status').hide(); $('span#only_dcmqrscp_running_status').show(); $('span#running_status').hide(); $('div#start_server_user').hide(); } - else if (retVal.data.status === 1 || retVal.data.status === "1") { + else if (retVal.data.status === 1 || retVal.data.status === '1') { $('span#not_running_status').hide(); $('span#only_storescp_running_status').show(); $('span#only_dcmqrscp_running_status').hide(); $('span#span_start_server_user').html(retVal.data.user_email); $('div#start_server_user').show(); } - else if (retVal.data.status === 0 || retVal.data.status === "0") { + else if (retVal.data.status === 0 || retVal.data.status === '0') { $('span#not_running_status').show(); $('span#only_storescp_running_status').hide(); $('span#only_dcmqrscp_running_status').hide(); @@ -188,11 +188,11 @@ $(document).ready(function () { midas.showDialogWithContent('Start DICOM server', html, false); $('input.startServerYes').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); midas.dicomserver.start(); }); $('input.startServerNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); @@ -206,11 +206,11 @@ $(document).ready(function () { midas.showDialogWithContent('Stop DICOM server', html, false); $('input.stopServerYes').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); midas.dicomserver.stop(); }); $('input.stopServerNo').unbind('click').click(function () { - $("div.MainDialog").dialog('close'); + $('div.MainDialog').dialog('close'); }); }); diff --git a/modules/dicomserver/public/js/item/dicomserver.item.view.js b/modules/dicomserver/public/js/item/dicomserver.item.view.js index dee527964..ed3a27086 100644 --- a/modules/dicomserver/public/js/item/dicomserver.item.view.js +++ b/modules/dicomserver/public/js/item/dicomserver.item.view.js @@ -26,7 +26,7 @@ midas.dicomserver.registerAction = function () { args: 'item=' + json.item.item_id, success: function (retVal) { midas.createNotice('Dicom images registered successfully', 3000); - $("div#sideElementDicomRegistration").show(); + $('div#sideElementDicomRegistration').show(); }, error: function (retVal) { midas.createNotice(retVal.message, 3000, 'error'); @@ -45,10 +45,10 @@ midas.dicomserver.registrationStatus = function () { args: 'item=' + json.item.item_id, success: function (retVal) { if (retVal.data.status) { - $("div#sideElementDicomRegistration").show(); + $('div#sideElementDicomRegistration').show(); } else { - $("div#sideElementDicomRegistration").hide(); + $('div#sideElementDicomRegistration').hide(); } }, log: $('

    ') diff --git a/modules/googleauth/public/js/login/googleauth.login.js b/modules/googleauth/public/js/login/googleauth.login.js index 8107a9126..9344fc12d 100644 --- a/modules/googleauth/public/js/login/googleauth.login.js +++ b/modules/googleauth/public/js/login/googleauth.login.js @@ -4,4 +4,4 @@ var link = $(this); link.attr('href', link.attr('href') + window.encodeURIComponent(' ' + window.location.href)); }); -}) (); +})(); diff --git a/modules/javauploaddownload/public/js/common/common.notify.js b/modules/javauploaddownload/public/js/common/common.notify.js index 9dd6f7d09..ac212eb32 100644 --- a/modules/javauploaddownload/public/js/common/common.notify.js +++ b/modules/javauploaddownload/public/js/common/common.notify.js @@ -1,5 +1,7 @@ // Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. +/* global json */ + var midas = midas || {}; midas.javauploaddownload = midas.javauploaddownload || {}; diff --git a/modules/javauploaddownload/public/js/upload/upload.index.js b/modules/javauploaddownload/public/js/upload/upload.index.js index e4a0a4e95..9b6482d0c 100644 --- a/modules/javauploaddownload/public/js/upload/upload.index.js +++ b/modules/javauploaddownload/public/js/upload/upload.index.js @@ -16,7 +16,7 @@ midas.javauploaddownload.upload.sendParentToJavaSession = function () { $('.browseMIDASLink').click(function () { 'use strict'; - midas.loadDialog('select', "/browse/selectfolder?policy=write"); + midas.loadDialog('select', '/browse/selectfolder?policy=write'); midas.showDialog('Browse', null, { close: function () { $('.uploadApplet').show(); diff --git a/modules/mfa/public/js/config/config.usertab.js b/modules/mfa/public/js/config/config.usertab.js index ee89452e9..05c2b7c67 100644 --- a/modules/mfa/public/js/config/config.usertab.js +++ b/modules/mfa/public/js/config/config.usertab.js @@ -12,7 +12,7 @@ midas.mfa.successConfig = function (responseText, statusText, xhr, form) { jsonResponse = $.parseJSON(responseText); } catch (e) { - midas.createNotice("An error occured. Please check the logs.", 4000, 'error'); + midas.createNotice('An error occured. Please check the logs.', 4000, 'error'); return false; } if (jsonResponse === null) { diff --git a/modules/mfa/public/js/login/login.dialog.js b/modules/mfa/public/js/login/login.dialog.js index 65635eb1c..202edafa9 100644 --- a/modules/mfa/public/js/login/login.dialog.js +++ b/modules/mfa/public/js/login/login.dialog.js @@ -12,7 +12,7 @@ midas.mfa.successSubmit = function (responseText, statusText, xhr, form) { jsonResponse = $.parseJSON(responseText); } catch (e) { - midas.createNotice("An error occured. Please check the logs.", 4000, 'error'); + midas.createNotice('An error occured. Please check the logs.', 4000, 'error'); return false; } if (jsonResponse.status == 'ok') { diff --git a/modules/oauth/public/js/client/client.index.js b/modules/oauth/public/js/client/client.index.js index 5e0f3e512..dbd3b48d0 100644 --- a/modules/oauth/public/js/client/client.index.js +++ b/modules/oauth/public/js/client/client.index.js @@ -13,9 +13,9 @@ midas.oauth.newClientDialog = function () { var name = container.find('input.newClientName').attr('disabled', 'disabled').val(); $(this).attr('disabled', 'disabled'); $.post(json.global.webroot + '/oauth/client/create', { - name: name, - userId: $('.userIdValue').html() - }, + name: name, + userId: $('.userIdValue').html() + }, function (text) { var resp = $.parseJSON(text); $('div.MainDialog').dialog('close'); @@ -41,8 +41,8 @@ midas.oauth.confirmDeleteClient = function () { container.find('input').attr('disabled', 'disabled'); $.post(json.global.webroot + '/oauth/client/delete', { - clientId: clientId - }, + clientId: clientId + }, function (text) { var resp = $.parseJSON(text); $('div.MainDialog').dialog('close'); @@ -71,8 +71,8 @@ midas.oauth.confirmDeleteToken = function () { container.find('input').attr('disabled', 'disabled'); $.post(json.global.webroot + '/oauth/token/delete', { - tokenId: tokenId - }, + tokenId: tokenId + }, function (text) { var resp = $.parseJSON(text); $('div.MainDialog').dialog('close'); diff --git a/modules/pvw/public/js/paraview/paraview.common.js b/modules/pvw/public/js/paraview/paraview.common.js index 63ed6b327..2583c34ef 100644 --- a/modules/pvw/public/js/paraview/paraview.common.js +++ b/modules/pvw/public/js/paraview/paraview.common.js @@ -166,8 +166,8 @@ midas.pvw.hideStatus = function () { midas.pvw.rpcFailure = function (err) { 'use strict'; $('div.MainDialog').dialog('close'); - console.log(err); - midas.createNotice('A ParaViewWeb exception occurred, check your browser console', 4000, 'error'); + + midas.createNotice('A ParaViewWeb exception occurred.', 4000, 'error'); }; /** Show an indeterminate loading dialog with a message */ diff --git a/modules/pvw/public/js/paraview/paraview.volume.js b/modules/pvw/public/js/paraview/paraview.volume.js index aa49a9269..85b1ebb76 100644 --- a/modules/pvw/public/js/paraview/paraview.volume.js +++ b/modules/pvw/public/js/paraview/paraview.volume.js @@ -7,13 +7,13 @@ var midas = midas || {}; midas.pvw = midas.pvw || {}; midas.pvw.PRESET_TRANSFER_RGBPOINTS = { - "Grayscale": [0.0, 0, 0, 0, + 'Grayscale': [0.0, 0, 0, 0, 1.0, 1, 1, 1 ], - "X-Ray": [0.0, 1, 1, 1, + 'X-Ray': [0.0, 1, 1, 1, 1.0, 0, 0, 0 ], - "Rainbow": [0.0, 1.0, 0.0, 0.0, + 'Rainbow': [0.0, 1.0, 0.0, 0.0, 0.166667, 1.0, 0.0, 1.0, 0.333333, 0.0, 0.0, 1.0, 0.5, 0.0, 1.0, 1.0, @@ -21,7 +21,7 @@ midas.pvw.PRESET_TRANSFER_RGBPOINTS = { 0.833333, 1.0, 1.0, 0.0, 1.0, 1.0, 0.0, 0.0 ], - "Rainbow (Desaturated)": [0.0, 0.2784313725490196, 0.2784313725490196, 0.8588235294117647, + 'Rainbow (Desaturated)': [0.0, 0.2784313725490196, 0.2784313725490196, 0.8588235294117647, 0.1428, 0.0, 0.0, 0.3607843137254902, 0.2857, 0.0, 1.0, 1.0, 0.4286, 0.0, 0.5019607843137255, 0.0, @@ -30,12 +30,12 @@ midas.pvw.PRESET_TRANSFER_RGBPOINTS = { 0.8571, 0.4196078431372549, 0.0, 0.0, 1.0, 0.8784313725490196, 0.30196078431372547, 0.30196078431372547 ], - "Yellow-Orange-Brown": [0, 1.0, 1.0, 0.8313725490196079, + 'Yellow-Orange-Brown': [0, 1.0, 1.0, 0.8313725490196079, 0.33333, 0.996078431372549, 0.8509803921568627, 0.5568627450980392, 0.66667, 0.996078431372549, 0.6, 0.1607843137254902, 1.0, 0.8, 0.2980392156862745, 0.00784313725490196 ], - "Qualitative Accent 1": [0, 0.4980392156862745, 0.788235294117647, 0.4980392156862745, + 'Qualitative Accent 1': [0, 0.4980392156862745, 0.788235294117647, 0.4980392156862745, 0.1428, 0.7450980392156863, 0.6823529411764706, 0.8313725490196079, 0.2857, 0.9921568627450981, 0.7529411764705882, 0.5254901960784314, 0.4286, 1.0, 1.0, 0.6, @@ -44,7 +44,7 @@ midas.pvw.PRESET_TRANSFER_RGBPOINTS = { 0.8571, 0.7490196078431373, 0.3568627450980392, 0.09019607843137255, 1.0, 0.4, 0.4, 0.4 ], - "Qualitative Accent 2": [0, 0.4, 0.7607843137254902, 0.6470588235294118, + 'Qualitative Accent 2': [0, 0.4, 0.7607843137254902, 0.6470588235294118, 0.1428, 0.9882352941176471, 0.5529411764705883, 0.3843137254901961, 0.2857, 0.5529411764705883, 0.6274509803921569, 0.796078431372549, 0.4286, 0.9058823529411765, 0.5411764705882353, 0.7647058823529411, diff --git a/modules/remoteprocessing/public/js/executable/executable.define.js b/modules/remoteprocessing/public/js/executable/executable.define.js index 8a8df323c..61d2f1ec3 100644 --- a/modules/remoteprocessing/public/js/executable/executable.define.js +++ b/modules/remoteprocessing/public/js/executable/executable.define.js @@ -1,5 +1,6 @@ // Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. +/* global isExecutableMeta */ /* global isDefineAjax */ /* global json */ @@ -51,14 +52,14 @@ $(document).ready(function () { $(this).after('Saving...'); $(this).remove(); $.ajax({ - type: "POST", - url: json.global.webroot + "/remoteprocessing/executable/define?itemId=" + encodeURIComponent($('#itemIdExecutable').val()), + type: 'POST', + url: json.global.webroot + '/remoteprocessing/executable/define?itemId=' + encodeURIComponent($('#itemIdExecutable').val()), data: req, success: function (x) { if (typeof(isDefineAjax) == 'undefined' || !isDefineAjax) { window.location.replace($('.webroot').val() + '/item/' + encodeURIComponent(json.item.item_id)); } else { - $("div.MainDialog").dialog("close"); + $('div.MainDialog').dialog('close'); $('#metaWrapper').hide(); $('#metaPageBlock').html(''); isExecutableMeta = true; @@ -160,24 +161,24 @@ function addElement(paramaters) { function updateSortableElement() { 'use strict'; - $(".column").sortable({ - connectWith: ".column", + $('.column').sortable({ + connectWith: '.column', handle: '.portlet-header' }); - $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all") - .find(".portlet-header") - .addClass("ui-widget-header ui-corner-all") + $('.portlet').addClass('ui-widget ui-widget-content ui-helper-clearfix ui-corner-all') + .find('.portlet-header') + .addClass('ui-widget-header ui-corner-all') .end() - .find(".portlet-content"); + .find('.portlet-content'); - $(".portlet-header .ui-icon").click(function () { - $(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"); - $(this).parents(".portlet:first").find(".portlet-content").toggle(); + $('.portlet-header .ui-icon').click(function () { + $(this).toggleClass('ui-icon-minusthick').toggleClass('ui-icon-plusthick'); + $(this).parents('.portlet:first').find('.portlet-content').toggle(); }); - $(".column").disableSelection(); + $('.column').disableSelection(); $('[qtip]').qtip({ content: { diff --git a/modules/remoteprocessing/public/js/job/job.init.js b/modules/remoteprocessing/public/js/job/job.init.js index 71056f647..bbaf457e8 100644 --- a/modules/remoteprocessing/public/js/job/job.init.js +++ b/modules/remoteprocessing/public/js/job/job.init.js @@ -66,8 +66,8 @@ function onFinishCallback() { $(this).after('Saving...'); $(this).remove(); $.ajax({ - type: "POST", - url: json.global.webroot + "/remoteprocessing/job/init?itemId=" + encodeURIComponent($('#selectedExecutableId').val()), + type: 'POST', + url: json.global.webroot + '/remoteprocessing/job/init?itemId=' + encodeURIComponent($('#selectedExecutableId').val()), data: req, success: function (x) { window.location.replace($('.webroot').val() + '/remoteprocessing/job/manage'); @@ -75,7 +75,7 @@ function onFinishCallback() { }); } else { - midas.createNotice("There are some errors.", 4000); + midas.createNotice('There are some errors.', 4000); } } @@ -85,7 +85,7 @@ function validateSteps(stepnumber) { // validate step 1 if (stepnumber == 2) { if ($('#selectedExecutableId').val() == '' || executableValid === false || isExecutableMeta === false) { - midas.createNotice("Please select an Executable and set its Option information", 4000); + midas.createNotice('Please select an Executable and set its Option information', 4000); isStepValid = false; } } @@ -94,7 +94,7 @@ function validateSteps(stepnumber) { var i = 0; results = []; if ($('#jobName').val() == '') { - midas.createNotice('Please set the job\'s name.', 4000); + midas.createNotice('Please set the job name.', 4000); isStepValid = false; } $('.optionWrapper').each(function () { @@ -112,7 +112,7 @@ function validateSteps(stepnumber) { isStepValid = false; } } - else if ($(this).find('.nameOutputOption').val().indexOf(".") == -1) { + else if ($(this).find('.nameOutputOption').val().indexOf('.') == -1) { if (required) { midas.createNotice('Please set an extension in the option ' + $(this).attr('name'), 4000); } @@ -186,7 +186,7 @@ function onShowStepCallback(obj) { var step_num = obj.attr('rel'); // get the current step number if (step_num == 2) { $('#browseExecutableFile').click(function () { - midas.loadDialog("selectitem_executable", "/browse/selectitem"); + midas.loadDialog('selectitem_executable', '/browse/selectitem'); midas.showDialog('Browse'); currentBrowser = 'executable'; }); @@ -210,19 +210,19 @@ function loadRecentUpload() { $('#recentuploadContentBlock').html(''); return; } - var html = "

    Or select a Recently Uploaded File:
      "; + var html = '

      Or select a Recently Uploaded File:
        '; $('#recentuploadContentBlock').html('
          '); $.each(data, function (key, val) { html += '
        • ' + val.name + '
        • '; }); - html += "
        "; + html += '
      '; $('#recentuploadContentBlock').html(html); $('.recentUploadItemLi').click(function () { $('#selectedExecutable').html($(this).find('a').html()); $('#selectedExecutableId').val($(this).attr('element')); - midas.createNotice("Please set the executable meta informaiton.", 4000); + midas.createNotice('Please set the executable meta informaiton.', 4000); $('#metaPageBlock').load(json.global.webroot + '/remoteprocessing/executable/define?itemId=' + encodeURIComponent($(this).attr('element'))); $('#metaWrapper').show(); isExecutableMeta = false; @@ -234,7 +234,7 @@ function loadRecentUpload() { function initExecutableForm() { 'use strict'; inittializedExecutableForm = true; - $("#datepicker").datetimepicker(); + $('#datepicker').datetimepicker(); $('#ui-datepicker-div').hide(); $('#checkboxSchedule').change(function () { if (!$(this).is(':checked')) { @@ -246,19 +246,19 @@ function initExecutableForm() { }); $('.selectInputFileLink').click(function () { - midas.loadDialog("selectitem_" + $(this).attr('order'), "/browse/selectitem"); + midas.loadDialog('selectitem_' + $(this).attr('order'), '/browse/selectitem'); midas.showDialog('Browse'); currentBrowser = $(this).attr('order'); }); $('.selectOutputFolderLink').click(function () { - midas.loadDialog("selectfolder_" + $(this).attr('order'), "/browse/selectfolder?policy=write"); + midas.loadDialog('selectfolder_' + $(this).attr('order'), '/browse/selectfolder?policy=write'); midas.showDialog('Browse'); currentBrowser = $(this).attr('order'); }); $('.selectInputFolderLink').click(function () { - midas.loadDialog("selectfolder_" + $(this).attr('order'), "/browse/selectfolder?policy=read"); + midas.loadDialog('selectfolder_' + $(this).attr('order'), '/browse/selectfolder?policy=read'); midas.showDialog('Browse'); currentBrowser = $(this).attr('order'); }); @@ -274,32 +274,32 @@ function itemSelectionCallback(name, id) { if (currentBrowser == 'executable') { $('#selectedExecutable').html(name); $('#selectedExecutableId').val(id); - $.post(json.global.webroot + "/remoteprocessing/job/validentry", { - entry: id, - type: "isexecutable" - }, + $.post(json.global.webroot + '/remoteprocessing/job/validentry', { + entry: id, + type: 'isexecutable' + }, function (data) { if (data.search('true') != -1) { executableValid = true; - $.post(json.global.webroot + "/remoteprocessing/job/validentry", { - entry: id, - type: "ismeta" - }, + $.post(json.global.webroot + '/remoteprocessing/job/validentry', { + entry: id, + type: 'ismeta' + }, function (data) { if (data.search('true') != -1) { isExecutableMeta = true; } else { isExecutableMeta = false; - midas.createNotice("Please set the executable meta informaiton.", 4000); - midas.loadDialog("meta_" + id, '/remoteprocessing/executable/define?itemId=' + encodeURIComponent(id)); - midas.showBigDialog("MetaInformation", false); + midas.createNotice('Please set the executable meta informaiton.', 4000); + midas.loadDialog('meta_' + id, '/remoteprocessing/executable/define?itemId=' + encodeURIComponent(id)); + midas.showBigDialog('MetaInformation', false); } }); } else { executableValid = false; - midas.createNotice("The selected item is not a valid executable", 4000); + midas.createNotice('The selected item is not a valid executable', 4000); } }); diff --git a/modules/remoteprocessing/public/js/job/job.manage.js b/modules/remoteprocessing/public/js/job/job.manage.js index 202736038..6faad4493 100644 --- a/modules/remoteprocessing/public/js/job/job.manage.js +++ b/modules/remoteprocessing/public/js/job/job.manage.js @@ -26,13 +26,13 @@ function colorLines(checkHidden) { 'use strict'; var grey = false; $('.midasTree tr').each(function (index) { - $(this).css("border", "none"); + $(this).css('border', 'none'); if (index === 0) { return; } if (selectedJob == $(this).attr('element')) { - $(this).css("background-color", "#C0D1FE"); - $(this).css("border", "1px solid grey"); + $(this).css('background-color', '#C0D1FE'); + $(this).css('border', '1px solid grey'); grey = !grey; $(this).unbind('mouseenter mouseleave'); } diff --git a/modules/remoteprocessing/public/js/job/job.view.js b/modules/remoteprocessing/public/js/job/job.view.js index 928bfab3f..70ed0276f 100644 --- a/modules/remoteprocessing/public/js/job/job.view.js +++ b/modules/remoteprocessing/public/js/job/job.view.js @@ -16,7 +16,7 @@ $(document).ready(function () { $('#tableXml').dataTable(); $('.showInDialog').click(function () { - midas.showBigDialogWithContent('Output', '
      ' + $(this).attr('output').replace(/&/g, "&").replace(//g, ">") + '
      ', true); + midas.showBigDialogWithContent('Output', '
      ' + $(this).attr('output').replace(/&/g, '&').replace(//g, '>') + '
      ', true); }); initMetrics(); @@ -35,7 +35,7 @@ $(document).ready(function () { }); qtip.qtip('toggle', true); $.ajax({ - type: "POST", + type: 'POST', url: json.global.webroot + '/browse/getelementinfo', data: { type: 'item', @@ -74,11 +74,11 @@ function initMetrics() { max: max.toFixed(2), values: [0.00, max.toFixed(2)], slide: function (event, ui) { - $('#' + thisObj.attr('name') + '').html("" + (Math.round(ui.values[0] * 100) / 100) + " - " + (Math.round(ui.values[1] * 100) / 100) + ""); + $('#' + thisObj.attr('name') + '').html('' + (Math.round(ui.values[0] * 100) / 100) + ' - ' + (Math.round(ui.values[1] * 100) / 100) + ''); processXmlTableColors(); } }); - $('#' + $(this).attr('name') + '').html("0.00 - " + max.toFixed(2) + ""); + $('#' + $(this).attr('name') + '').html('0.00 - ' + max.toFixed(2) + ''); }); } diff --git a/modules/remoteprocessing/public/js/layout/remoteprocessing.js b/modules/remoteprocessing/public/js/layout/remoteprocessing.js index dca44133d..ebd22c2c5 100644 --- a/modules/remoteprocessing/public/js/layout/remoteprocessing.js +++ b/modules/remoteprocessing/public/js/layout/remoteprocessing.js @@ -17,7 +17,7 @@ $(document).ready(function () { } } else { midas.createNotice(json.login.contentUploadLogin, 4000); - $("div.TopDynamicBar").show('blind'); + $('div.TopDynamicBar').show('blind'); midas.loadAjaxDynamicBar('login', '/user/login'); } }); diff --git a/modules/sizequota/public/js/folder/folder.index.js b/modules/sizequota/public/js/folder/folder.index.js index b6e155793..27c7fb91e 100644 --- a/modules/sizequota/public/js/folder/folder.index.js +++ b/modules/sizequota/public/js/folder/folder.index.js @@ -4,8 +4,8 @@ var midas = midas || {}; midas.sizequota = midas.sizequota || {}; midas.sizequota.folder = midas.sizequota.folder || {}; midas.sizequota.constant = { - MIDAS_SIZEQUOTA_USE_DEFAULT_QUOTA: "0", - MIDAS_SIZEQUOTA_USE_SPECIFIC_QUOTA: "1" + MIDAS_SIZEQUOTA_USE_DEFAULT_QUOTA: '0', + MIDAS_SIZEQUOTA_USE_SPECIFIC_QUOTA: '1' }; midas.sizequota.folder.validateConfig = function (formData, jqForm, options) {}; @@ -17,7 +17,7 @@ midas.sizequota.folder.successConfig = function (responseText, statusText, xhr, jsonResponse = $.parseJSON(responseText); } catch (e) { - midas.createNotice("An error occured. Please check the logs.", 4000, 'error'); + midas.createNotice('An error occured. Please check the logs.', 4000, 'error'); return false; } if (jsonResponse === null) { diff --git a/modules/solr/public/js/advanced/advanced.index.js b/modules/solr/public/js/advanced/advanced.index.js index 6fc6df7c3..54e7ca553 100644 --- a/modules/solr/public/js/advanced/advanced.index.js +++ b/modules/solr/public/js/advanced/advanced.index.js @@ -72,13 +72,13 @@ midas.solr.fetchTypes = function () { ajaxWebApi.ajax({ method: 'midas.metadata.types.list', success: function (retVal) { - var typeCombo = $("#typeCombo"); + var typeCombo = $('#typeCombo'); var typeArray = retVal.data; var curType; var i; for (i = 0; i < typeArray.length; ++i) { curType = typeArray[i]; - typeCombo.append($('').attr("value", curType).text(curType)); + typeCombo.append($('').attr('value', curType).text(curType)); } typeCombo.change(function () { midas.solr.fetchElements($(this).val()); @@ -96,24 +96,24 @@ midas.solr.fetchElements = function (type) { 'use strict'; if (type === 'type') { $('#elementCombo').empty() - .append($('').attr("value", "element").text("Element")); + .append($('').attr('value', 'element').text('Element')); $('#qualifierCombo').empty() - .append($('').attr("value", "qualifier").text("Qualifier")); + .append($('').attr('value', 'qualifier').text('Qualifier')); return; } ajaxWebApi.ajax({ method: 'midas.metadata.elements.list', args: 'typename=' + type, success: function (retVal) { - var elementCombo = $("#elementCombo"); + var elementCombo = $('#elementCombo'); var elementArray = retVal.data; var curElement; var i; elementCombo.empty(); - elementCombo.append($('').attr("value", "element").text("Element")); + elementCombo.append($('').attr('value', 'element').text('Element')); for (i = 0; i < elementArray.length; ++i) { curElement = elementArray[i]; - elementCombo.append($('').attr("value", curElement).text(curElement)); + elementCombo.append($('').attr('value', curElement).text(curElement)); } elementCombo.change(function () { midas.solr.fetchQualifiers(type, $(this).val()); @@ -131,24 +131,24 @@ midas.solr.fetchQualifiers = function (type, element) { 'use strict'; if (type === 'type' || element === 'element') { $('#elementCombo').empty() - .append($('').attr("value", "element").text("Element")); + .append($('').attr('value', 'element').text('Element')); $('#qualifierCombo').empty() - .append($('').attr("value", "qualifier").text("Qualifier")); + .append($('').attr('value', 'qualifier').text('Qualifier')); return; } ajaxWebApi.ajax({ method: 'midas.metadata.qualifiers.list', args: 'typename=' + type + '&element=' + element, success: function (retVal) { - var qualifierCombo = $("#qualifierCombo"); + var qualifierCombo = $('#qualifierCombo'); var qualifierArray = retVal.data; var curQualifier; var i; qualifierCombo.empty(); - qualifierCombo.append($('').attr("value", "qualifier").text("Qualifier")); + qualifierCombo.append($('').attr('value', 'qualifier').text('Qualifier')); for (i = 0; i < qualifierArray.length; ++i) { curQualifier = qualifierArray[i]; - qualifierCombo.append($('').attr("value", curQualifier).text(curQualifier)); + qualifierCombo.append($('').attr('value', curQualifier).text(curQualifier)); } }, error: function (retVal) { diff --git a/modules/statistics/public/js/index/index.index.js b/modules/statistics/public/js/index/index.index.js index 207d2479f..03e5d4f21 100644 --- a/modules/statistics/public/js/index/index.index.js +++ b/modules/statistics/public/js/index/index.index.js @@ -6,10 +6,10 @@ var tabs; $(document).ready(function () { 'use strict'; - tabs = $("#tabsGeneric").tabs({ + tabs = $('#tabsGeneric').tabs({ select: function (event, ui) {} }); - $("#tabsGeneric").show(); + $('#tabsGeneric').show(); $('img.tabsLoading').hide(); var errors = json.stats.errors; $.each(errors, function (i, val) { @@ -65,7 +65,7 @@ $(document).ready(function () { plotAssetStores.push(plot); }); - $("#tabsGeneric").bind('tabsshow', function (event, ui) { + $('#tabsGeneric').bind('tabsshow', function (event, ui) { if (plotErrors._drawCount === 0) { plotErrors.replot(); } diff --git a/modules/statistics/public/js/item/item.index.js b/modules/statistics/public/js/item/item.index.js index 2526e4c0c..28eaec74a 100644 --- a/modules/statistics/public/js/item/item.index.js +++ b/modules/statistics/public/js/item/item.index.js @@ -1,6 +1,8 @@ // Midas Server. Copyright Kitware SAS. Licensed under the Apache License 2.0. +/* global google */ /* global json */ +/* global MarkerClusterer */ var midas = midas || {}; midas.statistics = midas.statistics || {}; @@ -52,7 +54,7 @@ midas.statistics.populateMap = function (responseText, statusText, xhr, form) { $('#filteredCount').html(html); } catch (e) { - alert("An error occured. Please check the logs."); + alert('An error occured. Please check the logs.'); return false; } finally { $('input.filterButton').removeAttr('disabled'); @@ -62,7 +64,7 @@ midas.statistics.populateMap = function (responseText, statusText, xhr, form) { $(document).ready(function () { 'use strict'; - var tabs = $("#tabsGeneric").tabs({ + var tabs = $('#tabsGeneric').tabs({ select: function (event, ui) {} }); $('#tabsGeneric').show(); @@ -109,19 +111,19 @@ $(document).ready(function () { midas.statistics.clusterer = new MarkerClusterer(midas.statistics.map, midas.statistics.mapMarkers); // Set up smart date picker widget logic - var dates = $("#startdate, #enddate").datepicker({ - defaultDate: "today", + var dates = $('#startdate, #enddate').datepicker({ + defaultDate: 'today', changeMonth: true, numberOfMonths: 1, onSelect: function (selectedDate) { - var option = this.id == "startdate" ? "minDate" : "maxDate"; - var instance = $(this).data("datepicker"); + var option = this.id == 'startdate' ? 'minDate' : 'maxDate'; + var instance = $(this).data('datepicker'); var date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings); - dates.not(this).datepicker("option", option, date); + dates.not(this).datepicker('option', option, date); }, - dayNamesMin: ["S", "M", "T", "W", "T", "F", "S"] + dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'] }); $('#downloadResultLimit').spinbox({ diff --git a/modules/tracker/public/js/producer/producer.edit.js b/modules/tracker/public/js/producer/producer.edit.js index fe823b819..394ffffed 100644 --- a/modules/tracker/public/js/producer/producer.edit.js +++ b/modules/tracker/public/js/producer/producer.edit.js @@ -31,9 +31,9 @@ $('form.editProducerForm').ajaxForm({ success: midas.tracker.editSuccess }); -midas.tracker.qtipContent = "Enter the URL that revision values in this producer will link to. " + - "Put %revision in the URL, and that will be expanded to the value of the revision." + - "

      Example: https:// github.com/myuser/myproject/commit/%revision

      "; +midas.tracker.qtipContent = 'Enter the URL that revision values in this producer will link to. ' + + 'Put %revision in the URL, and that will be expanded to the value of the revision.' + + '

      Example: https:// github.com/myuser/myproject/commit/%revision

      '; $.fn.qtip.zindex = 16000; // show qtip on top of the dialog instead of under it $('input[name="revisionUrl"]').qtip({ diff --git a/modules/tracker/public/js/producer/producer.view.js b/modules/tracker/public/js/producer/producer.view.js index 8b9c9b24e..a7936031c 100644 --- a/modules/tracker/public/js/producer/producer.view.js +++ b/modules/tracker/public/js/producer/producer.view.js @@ -29,7 +29,7 @@ $(document).ready(function () { $('img.deletingProducer').show(); $.post(json.global.webroot + '/tracker/producer/delete', { producerId: json.tracker.producer.producer_id - }, function (retVal) { + }, function (_) { // Use location.replace so we remove this page from back button history window.location.replace(json.global.webroot + '/community/' + encodeURIComponent(json.tracker.producer.community_id) + '#Trackers'); }); diff --git a/modules/tracker/public/js/scalar/scalar.details.js b/modules/tracker/public/js/scalar/scalar.details.js index 2c0877589..1ead05ec1 100644 --- a/modules/tracker/public/js/scalar/scalar.details.js +++ b/modules/tracker/public/js/scalar/scalar.details.js @@ -6,7 +6,7 @@ var midas = midas || {}; $('#deleteScalar').click(function () { 'use strict'; - var html = "Are you sure you want to delete this scalar value?"; + var html = 'Are you sure you want to delete this scalar value?'; html += '
      '; html += ''; html += ''; @@ -15,8 +15,8 @@ $('#deleteScalar').click(function () { midas.showDialogWithContent('Confirm delete scalar', html, false); $('#deleteScalarYes').click(function () { $.post(json.global.webroot + '/tracker/scalar/delete', { - scalarId: $('input.scalarIdChild').val() - }, + scalarId: $('input.scalarIdChild').val() + }, function (data) { var jsonResponse = $.parseJSON(data); if (jsonResponse === null) { diff --git a/modules/tracker/public/js/trend/trend.view.js b/modules/tracker/public/js/trend/trend.view.js index fc9454b60..d7d6a6841 100644 --- a/modules/tracker/public/js/trend/trend.view.js +++ b/modules/tracker/public/js/trend/trend.view.js @@ -147,7 +147,7 @@ midas.tracker.renderChartArea = function (curveData, first) { renderer: $.jqplot.DateAxisRenderer, tickRenderer: $.jqplot.CanvasAxisTickRenderer, tickOptions: { - formatString: "%Y-%m-%d", + formatString: '%Y-%m-%d', angle: 270, fontSize: '11px', labelPosition: 'middle', @@ -285,19 +285,19 @@ $(window).load(function () { } } - var dates = $("#startdate, #enddate").datepicker({ - defaultDate: "today", + var dates = $('#startdate, #enddate').datepicker({ + defaultDate: 'today', changeMonth: true, numberOfMonths: 1, onSelect: function (selectedDate) { - var option = this.id == "startdate" ? "minDate" : "maxDate"; - var instance = $(this).data("datepicker"); + var option = this.id == 'startdate' ? 'minDate' : 'maxDate'; + var instance = $(this).data('datepicker'); var date = $.datepicker.parseDate( instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings); - dates.not(this).datepicker("option", option, date); + dates.not(this).datepicker('option', option, date); }, - dayNamesMin: ["S", "M", "T", "W", "T", "F", "S"] + dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'] }); $('#startdate').val(json.tracker.initialStartDate); $('#enddate').val(json.tracker.initialEndDate); diff --git a/modules/visualize/public/js/image/image.index.js b/modules/visualize/public/js/image/image.index.js index 01604af6c..8248c0927 100644 --- a/modules/visualize/public/js/image/image.index.js +++ b/modules/visualize/public/js/image/image.index.js @@ -2,7 +2,7 @@ $(document).ready(function () { 'use strict'; - $("#viewer").iviewer({ + $('#viewer').iviewer({ src: $('div#urlImage').html(), update_on_resize: false }); diff --git a/modules/visualize/public/js/media/media.index.js b/modules/visualize/public/js/media/media.index.js index 2b73c0801..41fd244ef 100644 --- a/modules/visualize/public/js/media/media.index.js +++ b/modules/visualize/public/js/media/media.index.js @@ -4,42 +4,41 @@ $(document).ready(function () { 'use strict'; - json = $.parseJSON($('div.jsonContent').html()); if (json.type == 'mp3') { - $("#jquery_jplayer_1").jPlayer({ + $('#jquery_jplayer_1').jPlayer({ ready: function () { - $(this).jPlayer("setMedia", { - mp3: json.global.webroot + "/download?items=" + encodeURIComponent(json.itemId) + $(this).jPlayer('setMedia', { + mp3: json.global.webroot + '/download?items=' + encodeURIComponent(json.itemId) }); } }); } if (json.type == 'm4a') { - $("#jquery_jplayer_1").jPlayer({ + $('#jquery_jplayer_1').jPlayer({ ready: function () { - $(this).jPlayer("setMedia", { - m4a: json.global.webroot + "/download?items=" + encodeURIComponent(json.itemId) + $(this).jPlayer('setMedia', { + m4a: json.global.webroot + '/download?items=' + encodeURIComponent(json.itemId) }); }, - ended: function (event) { + ended: function (_) { }, - swfPath: json.global.moduleWebroot + "/public/js/jquery", - supplied: "m4a, oga" + swfPath: json.global.moduleWebroot + '/public/js/jquery', + supplied: 'm4a, oga' }); } if (json.type == 'm4v') { - $("#jquery_jplayer_1").jPlayer({ + $('#jquery_jplayer_1').jPlayer({ ready: function () { - $(this).jPlayer("setMedia", { - m4v: json.global.webroot + "/download?items=" + encodeURIComponent(json.itemId) + $(this).jPlayer('setMedia', { + m4v: json.global.webroot + '/download?items=' + encodeURIComponent(json.itemId) }); }, - ended: function (event) { - $(this).jPlayer("play"); + ended: function (_) { + $(this).jPlayer('play'); }, - swfPath: json.global.webroot + "/modules/visualize/public/js/jquery", - solution: "flash, html", - supplied: "m4v, ogv" + swfPath: json.global.webroot + '/modules/visualize/public/js/jquery', + solution: 'flash, html', + supplied: 'm4v, ogv' }); } }); diff --git a/modules/visualize/public/js/paraview/paraview.dual.js b/modules/visualize/public/js/paraview/paraview.dual.js index 1bc75e183..3e448528e 100644 --- a/modules/visualize/public/js/paraview/paraview.dual.js +++ b/modules/visualize/public/js/paraview/paraview.dual.js @@ -31,8 +31,7 @@ midas.visualize.start = function () { paraview.left.errorListener = { manageError: function (error) { if (error) { - midas.createNotice('A ParaViewWeb error occurred; check the console for information', 4000, 'error'); - console.log(error); + midas.createNotice('A ParaViewWeb error occurred.', 4000, 'error'); return false; } } @@ -42,8 +41,7 @@ midas.visualize.start = function () { paraview.right.errorListener = { manageError: function (error) { if (error) { - midas.createNotice('A ParaViewWeb error occurred; check the console for information', 4000, 'error'); - console.log(error); + midas.createNotice('A ParaViewWeb error occurred.', 4000, 'error'); return false; } } @@ -93,8 +91,6 @@ midas.visualize._dataOpened = function (side, retVal) { midas.visualize[side].midK = Math.floor((midas.visualize[side].bounds[4] + midas.visualize[side].bounds[5]) / 2.0); if (midas.visualize[side].bounds.length != 6) { - console.log('Invalid image bounds (' + side + ' image):'); - console.log(midas.visualize[side].bounds); return; } diff --git a/modules/visualize/public/js/paraview/paraview.slice.js b/modules/visualize/public/js/paraview/paraview.slice.js index 4232e4cd7..330a765bd 100644 --- a/modules/visualize/public/js/paraview/paraview.slice.js +++ b/modules/visualize/public/js/paraview/paraview.slice.js @@ -27,8 +27,7 @@ midas.visualize.start = function () { paraview.errorListener = { manageError: function (error) { if (error) { - midas.createNotice('A ParaViewWeb error occurred; check the console for information', 4000, 'error'); - console.log(error); + midas.createNotice('A ParaViewWeb error occurred.', 4000, 'error'); return false; } } @@ -62,8 +61,6 @@ midas.visualize._dataOpened = function (view, retVal) { midas.visualize.midK = Math.floor((midas.visualize.bounds[4] + midas.visualize.bounds[5]) / 2.0); if (midas.visualize.bounds.length != 6) { - console.log('Invalid image bounds:'); - console.log(midas.visualize.bounds); return; } diff --git a/modules/visualize/public/js/paraview/paraview.surface.js b/modules/visualize/public/js/paraview/paraview.surface.js index 843b69cb1..dc58f7a9c 100644 --- a/modules/visualize/public/js/paraview/paraview.surface.js +++ b/modules/visualize/public/js/paraview/paraview.surface.js @@ -24,8 +24,7 @@ midas.visualize.start = function () { paraview.errorListener = { manageError: function (error) { if (error) { - midas.createNotice('A ParaViewWeb error occurred; check the console for information', 4000, 'error'); - console.log(error); + midas.createNotice('A ParaViewWeb error occurred.', 4000, 'error'); return false; } } diff --git a/modules/visualize/public/js/paraview/paraview.volume.js b/modules/visualize/public/js/paraview/paraview.volume.js index a34e7f65d..e44d88862 100644 --- a/modules/visualize/public/js/paraview/paraview.volume.js +++ b/modules/visualize/public/js/paraview/paraview.volume.js @@ -23,8 +23,7 @@ midas.visualize.start = function () { paraview.errorListener = { manageError: function (error) { if (error) { - midas.createNotice('A ParaViewWeb error occurred; check the console for information', 4000, 'error'); - console.log(error); + midas.createNotice('A ParaViewWeb error occurred.', 4000, 'error'); return false; } } @@ -59,8 +58,6 @@ midas.visualize._dataOpened = function (view, retVal) { midas.visualize.midK = Math.floor((midas.visualize.bounds[4] + midas.visualize.bounds[5]) / 2.0); if (midas.visualize.bounds.length != 6) { - console.log('Invalid image bounds:'); - console.log(midas.visualize.bounds); return; } diff --git a/modules/visualize/public/js/wrapper/wrapper.index.js b/modules/visualize/public/js/wrapper/wrapper.index.js index b6a03fbb6..13a520bf3 100644 --- a/modules/visualize/public/js/wrapper/wrapper.index.js +++ b/modules/visualize/public/js/wrapper/wrapper.index.js @@ -15,7 +15,7 @@ function createInfoAjaxVisualize(itemId) { $('img.infoLoading').show(); $('div.ajaxInfoElement').html(''); $.ajax({ - type: "POST", + type: 'POST', url: json.global.webroot + '/browse/getelementinfo', data: { type: 'item', @@ -35,7 +35,7 @@ $(document).ready(function () { /** create preview page */ var height = $(window).height() - 100; var width = 800; - var url = json.global.webroot + "/visualize/?itemId=" + encodeURIComponent(json.item.item_id) + '&height=' + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&viewMode=' + encodeURIComponent(json.viewMode); + var url = json.global.webroot + '/visualize/?itemId=' + encodeURIComponent(json.item.item_id) + '&height=' + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&viewMode=' + encodeURIComponent(json.viewMode); var html = '
      '; html += '
      '; html += '
      '; @@ -69,7 +69,7 @@ $(document).ready(function () { $('#fullscreenVisualize').find('a.linkedcontentLink').click(function () { var height = $(window).height() - 100; var width = 900; - var url = json.global.webroot + "/visualize/?height=" + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&itemId=' + encodeURIComponent($(this).attr('element')); + var url = json.global.webroot + '/visualize/?height=' + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&itemId=' + encodeURIComponent($(this).attr('element')); $('iframe#fullscreenVisualizeIframe').attr('src', url); currentElement = $(this).attr('element'); highlightCurrentPreview(currentElement); @@ -93,7 +93,7 @@ $(document).ready(function () { var obj = $('#fullscreenVisualize').find('a.linkedcontentLink[element=' + currentElement + ']').parents('li').prev().find('a'); var height = $(window).height() - 100; var width = 900; - var url = json.global.webroot + "/visualize/?height=" + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&itemId=' + encodeURIComponent(obj.attr('element')); + var url = json.global.webroot + '/visualize/?height=' + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&itemId=' + encodeURIComponent(obj.attr('element')); $('iframe#fullscreenVisualizeIframe').attr('src', url); currentElement = obj.attr('element'); highlightCurrentPreview(currentElement); @@ -110,7 +110,7 @@ $(document).ready(function () { var obj = $('#fullscreenVisualize').find('a.linkedcontentLink[element=' + currentElement + ']').parents('li').next().find('a'); var height = $(window).height() - 100; var width = 900; - var url = json.global.webroot + "/visualize/?height=" + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&itemId=' + encodeURIComponent(obj.attr('element')); + var url = json.global.webroot + '/visualize/?height=' + encodeURIComponent(height) + '&width=' + encodeURIComponent(width) + '&itemId=' + encodeURIComponent(obj.attr('element')); $('iframe#fullscreenVisualizeIframe').attr('src', url); currentElement = obj.attr('element'); highlightCurrentPreview(currentElement); @@ -128,6 +128,6 @@ $(document).ready(function () { //$('.Header').hide(); $('.SubWrapper').hide(); $('#fullscreenVisualize').find('a.closeVisuButton').click(function () { - window.location.replace(json.global.webroot + "/item/" + encodeURIComponent(json.item.item_id)); + window.location.replace(json.global.webroot + '/item/' + encodeURIComponent(json.item.item_id)); }); });