From 0f72aaf6365483caf8dd4f20d4b1bbc4981720f4 Mon Sep 17 00:00:00 2001 From: Vernon Chapman Date: Wed, 25 Nov 2020 13:11:21 -0500 Subject: [PATCH] mitigation for https://github.com/NAL-i5K/genomics-workspace/pull/307, https://github.com/NAL-i5K/genomics-workspace/pull/312 and https://github.com/NAL-i5K/genomics-workspace/pull/257 the removed file was desired and was done wile testing the clean.js script --- blast/static/blast/scripts/dragscrollable.js | 125 ------------------- package.json | 39 +++--- util/clean.js | 48 +++++++ 3 files changed, 68 insertions(+), 144 deletions(-) delete mode 100755 blast/static/blast/scripts/dragscrollable.js create mode 100644 util/clean.js diff --git a/blast/static/blast/scripts/dragscrollable.js b/blast/static/blast/scripts/dragscrollable.js deleted file mode 100755 index 38e3f9c70..000000000 --- a/blast/static/blast/scripts/dragscrollable.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * jQuery dragscrollable Plugin - * version: 1.0 (25-Jun-2009) - * Copyright (c) 2009 Miquel Herrera - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ -;(function($){ // secure $ jQuery alias - -/** - * Adds the ability to manage elements scroll by dragging - * one or more of its descendant elements. Options parameter - * allow to specifically select which inner elements will - * respond to the drag events. - * - * options properties: - * ------------------------------------------------------------------------ - * dragSelector | jquery selector to apply to each wrapped element - * | to find which will be the dragging elements. - * | Defaults to '>:first' which is the first child of - * | scrollable element - * ------------------------------------------------------------------------ - * acceptPropagatedEvent| Will the dragging element accept propagated - * | events? default is yes, a propagated mouse event - * | on a inner element will be accepted and processed. - * | If set to false, only events originated on the - * | draggable elements will be processed. - * ------------------------------------------------------------------------ - * preventDefault | Prevents the event to propagate further effectivey - * | dissabling other default actions. Defaults to true - * ------------------------------------------------------------------------ - * - * usage examples: - * - * To add the scroll by drag to the element id=viewport when dragging its - * first child accepting any propagated events - * $('#viewport').dragscrollable(); - * - * To add the scroll by drag ability to any element div of class viewport - * when dragging its first descendant of class dragMe responding only to - * evcents originated on the '.dragMe' elements. - * $('div.viewport').dragscrollable({dragSelector:'.dragMe:first', - * acceptPropagatedEvent: false}); - * - * Notice that some 'viewports' could be nested within others but events - * would not interfere as acceptPropagatedEvent is set to false. - * - */ -$.fn.dragscrollable = function( options ){ - - var settings = $.extend( - { - dragSelector:'>:first', - acceptPropagatedEvent: true, - preventDefault: true, - // Hovav: - allowY: true - },options || {}); - - - var dragscroll= { - mouseDownHandler : function(event) { - // mousedown, left click, check propagation - if (event.which!=1 || - (!event.data.acceptPropagatedEvent && event.target != this)){ - return false; - } - - // Initial coordinates will be the last when dragging - event.data.lastCoord = {left: event.clientX, top: event.clientY}; - - $.event.add( document, "mouseup", - dragscroll.mouseUpHandler, event.data ); - $.event.add( document, "mousemove", - dragscroll.mouseMoveHandler, event.data ); - if (event.data.preventDefault) { - event.preventDefault(); - return false; - } - }, - mouseMoveHandler : function(event) { // User is dragging - // How much did the mouse move? - var delta = {left: (event.clientX - event.data.lastCoord.left), - top: ((settings.allowY) ? event.clientY - event.data.lastCoord.top : 0)}; - - // Set the scroll position relative to what ever the scroll is now - event.data.scrollable.scrollLeft( - event.data.scrollable.scrollLeft() - delta.left); - event.data.scrollable.scrollTop( - event.data.scrollable.scrollTop() - delta.top); - - // Save where the cursor is - event.data.lastCoord={left: event.clientX, top: event.clientY} - if (event.data.preventDefault) { - event.preventDefault(); - return false; - } - - }, - mouseUpHandler : function(event) { // Stop scrolling - $.event.remove( document, "mousemove", dragscroll.mouseMoveHandler); - $.event.remove( document, "mouseup", dragscroll.mouseUpHandler); - if (event.data.preventDefault) { - event.preventDefault(); - return false; - } - } - } - - // set up the initial events - this.each(function() { - // closure object data for each scrollable element - var data = {scrollable : $(this), - acceptPropagatedEvent : settings.acceptPropagatedEvent, - preventDefault : settings.preventDefault } - // Set mouse initiating event on the desired descendant - $(this).find(settings.dragSelector). - bind('mousedown', data, dragscroll.mouseDownHandler); - }); -}; //end plugin dragscrollable - -})( jQuery ); // confine scope diff --git a/package.json b/package.json index 0b300f284..9beb4e1af 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,8 @@ "name": "genomics-workspace", "version": "1.0.0", "scripts": { - "build": "npm install && webpack-cli && /usr/local/i5k/bin/python3 setup.py" + "build": "npm install && webpack", + "clean": "node util/clean.js" }, "private": true, "repository": { @@ -16,33 +17,33 @@ }, "homepage": "https://github.com/NAL-i5K/genomics-workspace#readme", "devDependencies": { - "jshint": "^2.9.6", + "jshint": "^2.12.0", "prettier": "1.13.0" }, "dependencies": { "Respond.js": "https://github.com/scottjehl/Respond/archive/1.4.0.tar.gz", - "backbone": "^1.1.2", + "backbone": "^1.4.0", "bootstrap": "^3.4.1", - "bootstrap-select": "^1.6.3", - "bootstrap-switch": "^3.0.2", + "bootstrap-select": "^1.13.6", + "bootstrap-switch": "^3.4.0", "chroma-js": "https://github.com/gka/chroma.js/archive/v0.6.1.tar.gz", - "codemirror": "^4.5.0", - "copy-webpack-plugin": "^4.5.1", - "d3": "^3.5.12", + "codemirror": "^4.13.0", + "copy-webpack-plugin": "^4.6.0", + "d3": "^3.5.17", "datatables-tabletools": "^2.2.2", - "datatables.net-bs": "^1.10.9", - "datatables.net-colreorder": "^1.5.1", - "datatables.net-colreorder-dt": "^1.5.1", - "datatables.net-dt": "^1.10.16", + "datatables.net-bs": "^1.10.22", + "datatables.net-colreorder": "^1.5.2", + "datatables.net-colreorder-dt": "^1.5.2", + "datatables.net-dt": "^1.10.22", "disable-output-webpack-plugin": "^1.0.1", - "jquery": "^3.4.0", - "jquery-hoverintent": "^1.9.0", - "jquery-ui-dist": "^1.12.0", + "jquery": "^3.5.1", + "jquery-hoverintent": "^1.10.1", + "jquery-ui-dist": "^1.12.1", "jquery-ui-themes": "^1.12.0", - "jquery-validation": "^1.14.0", + "jquery-validation": "^1.19.2", "jquery.dragscrollable": "^1.0.0", - "underscore": "^1.7.0", - "webpack": "^4.20.2", - "webpack-cli": "^3.1.1" + "underscore": "^1.12.0", + "webpack": "^4.44.2", + "webpack-cli": "^3.3.12" } } diff --git a/util/clean.js b/util/clean.js new file mode 100644 index 000000000..6416e938e --- /dev/null +++ b/util/clean.js @@ -0,0 +1,48 @@ +const fs = require('fs'); +const path = require('path'); + +const deleteFolderRecursive = function(path) { + fs.readdirSync(path).forEach(function(file, index){ + let curPath = path + "/" + file; + if (fs.lstatSync(curPath).isDirectory()) { // recurse + deleteFolderRecursive(curPath); + } else { // delete file + fs.unlinkSync(curPath); + } + }); + fs.rmdirSync(path); +}; + +const projectRootPath = path.resolve(__dirname, '..'); +const gitIgnorePath = path.resolve(projectRootPath, '.gitignore'); + +let files = fs.readFileSync(gitIgnorePath) + .toString() + .split('\n') + .filter(function(data){ + if ( + data !== '' && + !data.startsWith('#') && + !data.startsWith('*') && + !data.startsWith('.') + ) { + if ( + data.startsWith('/app/static') || + data.startsWith('/blast/static') || + data.startsWith('/clustal/static') || + data.startsWith('/hmmer/static') + ) + return true; + } + }); + +for (let f of files) { + f = path.resolve(projectRootPath, '.' + f); + if (fs.existsSync(f)) { + if (fs.lstatSync(f).isDirectory()) { + deleteFolderRecursive(f); + } else { + fs.unlinkSync(f); + } + } +} \ No newline at end of file